@fluidframework/odsp-driver 2.0.0-dev.7.3.0.212138 → 2.0.0-dev.7.4.0.215366

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/api-extractor.json +12 -1
  2. package/api-report/odsp-driver.api.md +3 -0
  3. package/dist/fetchSnapshot.cjs +1 -1
  4. package/dist/fetchSnapshot.cjs.map +1 -1
  5. package/dist/index.cjs +3 -1
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/odsp-driver-alpha.d.ts +564 -0
  10. package/dist/odsp-driver-beta.d.ts +564 -0
  11. package/dist/odsp-driver-public.d.ts +564 -0
  12. package/dist/odsp-driver-untrimmed.d.ts +564 -0
  13. package/dist/odspUtils.cjs +8 -1
  14. package/dist/odspUtils.cjs.map +1 -1
  15. package/dist/odspUtils.d.ts +4 -0
  16. package/dist/odspUtils.d.ts.map +1 -1
  17. package/dist/packageVersion.cjs +1 -1
  18. package/dist/packageVersion.cjs.map +1 -1
  19. package/dist/packageVersion.d.ts +1 -1
  20. package/lib/fetchSnapshot.mjs +1 -1
  21. package/lib/fetchSnapshot.mjs.map +1 -1
  22. package/lib/index.d.ts +1 -1
  23. package/lib/index.d.ts.map +1 -1
  24. package/lib/index.mjs +1 -0
  25. package/lib/index.mjs.map +1 -1
  26. package/lib/odsp-driver-alpha.d.ts +564 -0
  27. package/lib/odsp-driver-beta.d.ts +564 -0
  28. package/lib/odsp-driver-public.d.ts +564 -0
  29. package/lib/odsp-driver-untrimmed.d.ts +564 -0
  30. package/lib/odspUtils.d.ts +4 -0
  31. package/lib/odspUtils.d.ts.map +1 -1
  32. package/lib/odspUtils.mjs +6 -0
  33. package/lib/odspUtils.mjs.map +1 -1
  34. package/lib/packageVersion.d.ts +1 -1
  35. package/lib/packageVersion.mjs +1 -1
  36. package/lib/packageVersion.mjs.map +1 -1
  37. package/package.json +30 -14
  38. package/src/fetchSnapshot.ts +1 -1
  39. package/src/index.ts +1 -1
  40. package/src/odspUtils.ts +7 -0
  41. package/src/packageVersion.ts +1 -1
@@ -0,0 +1,564 @@
1
+ import { DriverPreCheckInfo } from '@fluidframework/driver-definitions';
2
+ import { HostStoragePolicy } from '@fluidframework/odsp-driver-definitions';
3
+ import { IContainerPackageInfo } from '@fluidframework/driver-definitions';
4
+ import { IdentityType } from '@fluidframework/odsp-driver-definitions';
5
+ import { IDocumentService } from '@fluidframework/driver-definitions';
6
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
7
+ import { IEntry } from '@fluidframework/odsp-driver-definitions';
8
+ import { IFileEntry } from '@fluidframework/odsp-driver-definitions';
9
+ import { IOdspResolvedUrl } from '@fluidframework/odsp-driver-definitions';
10
+ import { IOdspUrlParts } from '@fluidframework/odsp-driver-definitions';
11
+ import { IPersistedCache } from '@fluidframework/odsp-driver-definitions';
12
+ import { IPrefetchSnapshotContents as IPrefetchSnapshotContents_2 } from './odspCache';
13
+ import { IRelaySessionAwareDriverFactory } from '@fluidframework/odsp-driver-definitions';
14
+ import { IRequest } from '@fluidframework/core-interfaces';
15
+ import { IResolvedUrl } from '@fluidframework/driver-definitions';
16
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
17
+ import { ISharingLinkKind } from '@fluidframework/odsp-driver-definitions';
18
+ import { ISnapshotOptions } from '@fluidframework/odsp-driver-definitions';
19
+ import { ISnapshotTree } from '@fluidframework/protocol-definitions';
20
+ import { ISocketStorageDiscovery } from '@fluidframework/odsp-driver-definitions';
21
+ import { ISummaryTree } from '@fluidframework/protocol-definitions';
22
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
23
+ import { ITelemetryLogger } from '@fluidframework/core-interfaces';
24
+ import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
25
+ import { ITelemetryProperties } from '@fluidframework/core-interfaces';
26
+ import { IUrlResolver } from '@fluidframework/driver-definitions';
27
+ import { OdspResourceTokenFetchOptions } from '@fluidframework/odsp-driver-definitions';
28
+ import { PromiseCache } from '@fluidframework/core-utils';
29
+ import { RateLimiter } from '@fluidframework/driver-utils';
30
+ import { ShareLinkTypes } from '@fluidframework/odsp-driver-definitions';
31
+ import { TokenFetcher } from '@fluidframework/odsp-driver-definitions';
32
+
33
+ /**
34
+ * A check that returns DriverPreCheckInfo if the URL format is likely supported by this driver.
35
+ * Note that returning information here is NOT a full guarantee that resolve will ultimately be successful.
36
+ * Instead, this should be used as a lightweight check that can filter out easily detectable unsupported URLs
37
+ * before the entire Fluid loading process needs to be kicked off.
38
+ * @public
39
+ */
40
+ export declare function checkUrl(documentUrl: URL): DriverPreCheckInfo | undefined;
41
+
42
+ /**
43
+ * @public
44
+ */
45
+ export declare enum ClpCompliantAppHeader {
46
+ isClpCompliantApp = "X-CLP-Compliant-App"
47
+ }
48
+
49
+ /**
50
+ * @public
51
+ */
52
+ export declare function createLocalOdspDocumentServiceFactory(localSnapshot: Uint8Array | string): IDocumentServiceFactory;
53
+
54
+ /**
55
+ * Create the request object with url and headers for creating a new file on OneDrive Sharepoint
56
+ * @param siteUrl - Base url for OneDrive
57
+ * @param driveId - drive identifier
58
+ * @param filePath - path where file needs to be created
59
+ * @param fileName - name of the new file to be created
60
+ * @param createShareLinkType - type of sharing link you would like to create for this file. ShareLinkTypes
61
+ * will be deprecated soon, so for any new implementation please provide createShareLinkType of type ShareLink
62
+ * @public
63
+ */
64
+ export declare function createOdspCreateContainerRequest(siteUrl: string, driveId: string, filePath: string, fileName: string, createShareLinkType?: ShareLinkTypes | ISharingLinkKind): IRequest;
65
+
66
+ /**
67
+ * Encodes ODC/SPO information into a URL format that can be handled by the Loader
68
+ * @param l -The property bag of necessary properties to locate a Fluid data store and craft a url for it
69
+ * @public
70
+ */
71
+ export declare function createOdspUrl(l: OdspFluidDataStoreLocator): string;
72
+
73
+ /**
74
+ * Transforms given Fluid data store locator into string that can be embedded into url
75
+ * @param locator - describes Fluid data store locator info to be encoded
76
+ * @returns string representing encoded Fluid data store locator info
77
+ * @public
78
+ */
79
+ export declare function encodeOdspFluidDataStoreLocator(locator: OdspFluidDataStoreLocator): string;
80
+
81
+ /**
82
+ * In ODSP, the concept of "epoch" refers to binary updates to files. For example, this might include using
83
+ * version restore, or if the user downloads a Fluid file and then uploads it again. These result in the epoch
84
+ * value being incremented.
85
+ *
86
+ * The implications of these binary updates is that the Fluid state is disrupted: the sequence number might
87
+ * go backwards, the data might be inconsistent with the latest state of collaboration, etc. As a result, it's
88
+ * not safe to continue collaboration across an epoch change. We need to detect these epoch changes and
89
+ * error out from the collaboration.
90
+ *
91
+ * This class is a wrapper around fetch calls. It adds epoch to the request made so that the
92
+ * server can match it with its epoch value in order to match the version.
93
+ * It also validates the epoch value received in response of fetch calls. If the epoch does not match,
94
+ * then it also clears all the cached entries for the given container.
95
+ * @public
96
+ */
97
+ export declare class EpochTracker implements IPersistedFileCache {
98
+ protected readonly cache: IPersistedCache;
99
+ protected readonly fileEntry: IFileEntry;
100
+ protected readonly logger: ITelemetryLoggerExt;
101
+ protected readonly clientIsSummarizer?: boolean | undefined;
102
+ private _fluidEpoch;
103
+ private readonly snapshotCacheExpiryTimeoutMs;
104
+ readonly rateLimiter: RateLimiter;
105
+ private readonly driverId;
106
+ private networkCallNumber;
107
+ constructor(cache: IPersistedCache, fileEntry: IFileEntry, logger: ITelemetryLoggerExt, clientIsSummarizer?: boolean | undefined);
108
+ setEpoch(epoch: string, fromCache: boolean, fetchType: FetchTypeInternal): void;
109
+ get(entry: IEntry): Promise<any>;
110
+ put(entry: IEntry, value: any): Promise<void>;
111
+ removeEntries(): Promise<void>;
112
+ get fluidEpoch(): string | undefined;
113
+ validateEpoch(epoch: string | undefined, fetchType: FetchType): Promise<void>;
114
+ /**
115
+ * Api to fetch the response for given request and parse it as json.
116
+ * @param url - url of the request
117
+ * @param fetchOptions - fetch options for request containing body, headers etc.
118
+ * @param fetchType - method for which fetch is called.
119
+ * @param addInBody - Pass True if caller wants to add epoch in post body.
120
+ * @param fetchReason - fetch reason to add to the request.
121
+ */
122
+ fetchAndParseAsJSON<T>(url: string, fetchOptions: RequestInit, fetchType: FetchType, addInBody?: boolean, fetchReason?: string): Promise<IOdspResponse<T>>;
123
+ /**
124
+ * Api to fetch the response for given request and parse it as json.
125
+ * @param url - url of the request
126
+ * @param fetchOptions - fetch options for request containing body, headers etc.
127
+ * @param fetchType - method for which fetch is called.
128
+ * @param addInBody - Pass True if caller wants to add epoch in post body.
129
+ * @param fetchReason - fetch reason to add to the request.
130
+ */
131
+ fetch(url: string, fetchOptions: RequestInit, fetchType: FetchType, addInBody?: boolean, fetchReason?: string): Promise<IOdspResponse<Response>>;
132
+ private fetchCore;
133
+ /**
134
+ * Api to fetch the response as it is for given request.
135
+ * @param url - url of the request
136
+ * @param fetchOptions - fetch options for request containing body, headers etc.
137
+ * @param fetchType - method for which fetch is called.
138
+ * @param addInBody - Pass True if caller wants to add epoch in post body.
139
+ * @param fetchReason - fetch reason to add to the request.
140
+ */
141
+ fetchArray(url: string, fetchOptions: {
142
+ [index: string]: any;
143
+ }, fetchType: FetchType, addInBody?: boolean, fetchReason?: string): Promise<IOdspResponse<ArrayBuffer>>;
144
+ private addEpochInRequest;
145
+ private addParamInBody;
146
+ private formatClientCorrelationId;
147
+ protected validateEpochFromResponse(epochFromResponse: string | undefined, fetchType: FetchTypeInternal, fromCache?: boolean): void;
148
+ private checkForEpochError;
149
+ private checkForEpochErrorCore;
150
+ private fileEntryFromEntry;
151
+ }
152
+
153
+ /**
154
+ * @public
155
+ */
156
+ export declare type FetchType = "blob" | "createBlob" | "createFile" | "joinSession" | "ops" | "test" | "snapshotTree" | "treesLatest" | "uploadSummary" | "push" | "versions";
157
+
158
+ /**
159
+ * @public
160
+ */
161
+ export declare type FetchTypeInternal = FetchType | "cache";
162
+
163
+ /**
164
+ * Gets the correct API root for the given ODSP url, e.g. 'https://foo-my.sharepoint.com/_api/v2.1'
165
+ * @param origin - The URL origin
166
+ * @public
167
+ */
168
+ export declare function getApiRoot(origin: string): string;
169
+
170
+ /**
171
+ * @public
172
+ */
173
+ export declare function getHashedDocumentId(driveId: string, itemId: string): Promise<string>;
174
+
175
+ /**
176
+ * Extract ODSP Fluid data store locator object from given ODSP url. This extracts things like
177
+ * driveId, ItemId, siteUrl etc from a url where these are encoded in nav query param.
178
+ * @param url - ODSP url representing Fluid file link
179
+ * @param requireFluidSignature - flag representing if the Fluid signature is expected in the url, default true
180
+ * @returns object representing Fluid data store location in ODSP terms
181
+ * @public
182
+ */
183
+ export declare function getLocatorFromOdspUrl(url: URL, requireFluidSignature?: boolean): OdspFluidDataStoreLocator | undefined;
184
+
185
+ /**
186
+ * Breaks an ODSP URL into its parts, extracting the site, drive ID, and item ID.
187
+ * Returns undefined for invalid/malformed URLs.
188
+ * @param url - The (raw) URL to parse
189
+ * @public
190
+ */
191
+ export declare function getOdspUrlParts(url: URL): Promise<IOdspUrlParts | undefined>;
192
+
193
+ /**
194
+ * @public
195
+ */
196
+ export declare interface ICacheAndTracker {
197
+ cache: IOdspCache;
198
+ epochTracker: EpochTracker;
199
+ }
200
+
201
+ /**
202
+ * @public
203
+ */
204
+ export declare interface IClpCompliantAppHeader {
205
+ [ClpCompliantAppHeader.isClpCompliantApp]: boolean;
206
+ }
207
+
208
+ /**
209
+ * Internal cache interface used within driver only
210
+ * @public
211
+ */
212
+ export declare interface INonPersistentCache {
213
+ /**
214
+ * Cache of joined/joining session info
215
+ */
216
+ readonly sessionJoinCache: PromiseCache<string, {
217
+ entryTime: number;
218
+ joinSessionResponse: ISocketStorageDiscovery;
219
+ }>;
220
+ /**
221
+ * Cache of resolved/resolving file URLs
222
+ */
223
+ readonly fileUrlCache: PromiseCache<string, IOdspResolvedUrl>;
224
+ /**
225
+ * Used to store the snapshot fetch promise if the prefetch has been made using the prefetchLatestSnapshot api.
226
+ * This is then used later to look for the promise during the container load.
227
+ */
228
+ readonly snapshotPrefetchResultCache: PromiseCache<string, IPrefetchSnapshotContents>;
229
+ }
230
+
231
+ /**
232
+ * Internal cache interface used within driver only
233
+ * @public
234
+ */
235
+ export declare interface IOdspCache extends INonPersistentCache {
236
+ /**
237
+ * Persisted cache - only serializable content is allowed
238
+ */
239
+ readonly persistedCache: IPersistedFileCache;
240
+ }
241
+
242
+ /**
243
+ * @public
244
+ */
245
+ export declare interface IOdspResponse<T> {
246
+ content: T;
247
+ headers: Map<string, string>;
248
+ propsToLog: ITelemetryProperties;
249
+ duration: number;
250
+ }
251
+
252
+ /**
253
+ * Similar to IPersistedCache, but exposes cache interface for single file
254
+ * @public
255
+ */
256
+ export declare interface IPersistedFileCache {
257
+ get(entry: IEntry): Promise<any>;
258
+ put(entry: IEntry, value: any): Promise<void>;
259
+ removeEntries(): Promise<void>;
260
+ }
261
+
262
+ /**
263
+ * @public
264
+ */
265
+ export declare interface IPrefetchSnapshotContents extends ISnapshotContents {
266
+ fluidEpoch: string;
267
+ prefetchStartTime: number;
268
+ }
269
+
270
+ /**
271
+ * @public
272
+ */
273
+ export declare interface ISharingLinkHeader {
274
+ [SharingLinkHeader.isSharingLinkToRedeem]: boolean;
275
+ }
276
+
277
+ /**
278
+ * @public
279
+ */
280
+ export declare interface ISnapshotContents {
281
+ snapshotTree: ISnapshotTree;
282
+ blobs: Map<string, ArrayBuffer>;
283
+ ops: ISequencedDocumentMessage[];
284
+ /**
285
+ * Sequence number of the snapshot
286
+ */
287
+ sequenceNumber: number | undefined;
288
+ /**
289
+ * Sequence number for the latest op/snapshot for the file in ODSP
290
+ */
291
+ latestSequenceNumber: number | undefined;
292
+ }
293
+
294
+ /**
295
+ * The parsing is significantly faster if the position of props is well known instead of dynamic. So these variables
296
+ * represents how many times slower parsing path is executed. This will be then logged into telemetry.
297
+ * @public
298
+ */
299
+ export declare interface ISnapshotContentsWithProps extends ISnapshotContents {
300
+ telemetryProps: Record<string, number>;
301
+ }
302
+
303
+ /**
304
+ * Checks whether or not the given URL origin is an ODC origin
305
+ * @param origin - The URL origin to check
306
+ * @public
307
+ */
308
+ export declare function isOdcOrigin(origin: string): boolean;
309
+
310
+ /**
311
+ * Whether or not the given URL is a valid ODC URL
312
+ * @param url - The URL to check
313
+ * @public
314
+ */
315
+ export declare function isOdcUrl(url: string | URL): boolean;
316
+
317
+ /**
318
+ * @public
319
+ */
320
+ export declare function isOdspResolvedUrl(resolvedUrl: IResolvedUrl): resolvedUrl is IOdspResolvedUrl;
321
+
322
+ /**
323
+ * Whether or not the given URL is a valid SPO/ODB URL
324
+ * @param url - The URL to check
325
+ * @public
326
+ */
327
+ export declare function isSpoUrl(url: string): boolean;
328
+
329
+ /**
330
+ * This parameter is provided by host in the resolve request and it contains information about the file
331
+ * like driveId, itemId, siteUrl, datastorePath, packageName etc.
332
+ * @public
333
+ */
334
+ export declare const locatorQueryParamName = "nav";
335
+
336
+ /**
337
+ * @public
338
+ */
339
+ export declare const OdcApiSiteOrigin = "https://my.microsoftpersonalcontent.com";
340
+
341
+ /**
342
+ * @public
343
+ */
344
+ export declare const OdcFileSiteOrigin = "https://1drv.ms";
345
+
346
+ /**
347
+ * Factory for creating the sharepoint document service. Use this if you want to
348
+ * use the sharepoint implementation.
349
+ * @public
350
+ */
351
+ export declare class OdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore {
352
+ constructor(getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>, getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined, persistedCache?: IPersistedCache, hostPolicy?: HostStoragePolicy);
353
+ }
354
+
355
+ /**
356
+ * Factory for creating the sharepoint document service. Use this if you want to
357
+ * use the sharepoint implementation.
358
+ *
359
+ * This constructor should be used by environments that support dynamic imports and that wish
360
+ * to leverage code splitting as a means to keep bundles as small as possible.
361
+ * @public
362
+ */
363
+ export declare class OdspDocumentServiceFactoryCore implements IDocumentServiceFactory, IRelaySessionAwareDriverFactory {
364
+ private readonly getStorageToken;
365
+ private readonly getWebsocketToken;
366
+ protected persistedCache: IPersistedCache;
367
+ private readonly hostPolicy;
368
+ private readonly nonPersistentCache;
369
+ private readonly socketReferenceKeyPrefix?;
370
+ get snapshotPrefetchResultCache(): PromiseCache<string, IPrefetchSnapshotContents_2>;
371
+ get IRelaySessionAwareDriverFactory(): this;
372
+ /**
373
+ * This function would return info about relay service session only if this factory established (or attempted to
374
+ * establish) connection very recently. Otherwise, it will return undefined.
375
+ * @param resolvedUrl - resolved url for container
376
+ * @returns The current join session response stored in cache. `undefined` if not present.
377
+ */
378
+ getRelayServiceSessionInfo(resolvedUrl: IResolvedUrl): Promise<ISocketStorageDiscovery | undefined>;
379
+ createContainer(createNewSummary: ISummaryTree | undefined, createNewResolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
380
+ /**
381
+ * @param getStorageToken - function that can provide the storage token for a given site. This is
382
+ * is also referred to as the "Vroom" token in SPO.
383
+ * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also
384
+ * to as the "Push" token in SPO. If undefined then websocket token is expected to be returned with joinSession
385
+ * response payload.
386
+ * @param persistedCache - PersistedCache provided by host for use in this session.
387
+ * @param hostPolicy - Policy for storage provided by host.
388
+ */
389
+ constructor(getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>, getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined, persistedCache?: IPersistedCache, hostPolicy?: HostStoragePolicy);
390
+ createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
391
+ protected createDocumentServiceCore(resolvedUrl: IResolvedUrl, odspLogger: ITelemetryLogger, cacheAndTrackerArg?: ICacheAndTracker, clientIsSummarizer?: boolean): Promise<IDocumentService>;
392
+ }
393
+
394
+ /**
395
+ * @deprecated This is deprecated in favour of OdspDocumentServiceFactory as the socket io is now loaded inside the
396
+ * other dynamically imported module.
397
+ * @public
398
+ */
399
+ export declare class OdspDocumentServiceFactoryWithCodeSplit extends OdspDocumentServiceFactoryCore implements IDocumentServiceFactory {
400
+ constructor(getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>, getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined, persistedCache?: IPersistedCache, hostPolicy?: HostStoragePolicy);
401
+ }
402
+
403
+ /**
404
+ * Resolver to resolve urls like the ones created by createOdspUrl which is driver inner
405
+ * url format. Ex: `${siteUrl}?driveId=${driveId}&itemId=${itemId}&path=${path}`
406
+ * @public
407
+ */
408
+ export declare class OdspDriverUrlResolver implements IUrlResolver {
409
+ constructor();
410
+ resolve(request: IRequest): Promise<IOdspResolvedUrl>;
411
+ /**
412
+ * Requests a driver + data store storage URL.
413
+ * @param resolvedUrl - The driver resolved URL.
414
+ * @param relativeUrl - The relative data store path URL.
415
+ * For requesting a driver URL, this value should always be '/'. If an empty string is passed, then dataStorePath
416
+ * will be extracted from the resolved url if present.
417
+ * @param packageInfoSource - optional, represents container package information to be included in url.
418
+ */
419
+ getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string, packageInfoSource?: IContainerPackageInfo): Promise<string>;
420
+ }
421
+
422
+ /**
423
+ * Resolver to resolve urls like the ones created by createOdspUrl which is driver inner
424
+ * url format and the ones which have things like driveId, siteId, itemId etc encoded in nav param.
425
+ * This resolver also handles share links and try to generate one for the use by the app.
426
+ * @public
427
+ */
428
+ export declare class OdspDriverUrlResolverForShareLink implements IUrlResolver {
429
+ private readonly appName?;
430
+ private readonly getContext?;
431
+ private readonly logger;
432
+ private readonly sharingLinkCache;
433
+ private readonly shareLinkFetcherProps;
434
+ /**
435
+ * Creates url resolver instance
436
+ * @param shareLinkFetcherProps - properties used when fetching share link.
437
+ * Can be set as 'undefined' for cases where share link is not needed. Currently, only
438
+ * getAbsoluteUrl() method requires share link.
439
+ * @param logger - logger object that is used as telemetry sink
440
+ * @param appName - application name hint that is encoded with url produced by getAbsoluteUrl() method.
441
+ * This hint is used by link handling logic which determines which app to redirect to when user
442
+ * navigates directly to the link.
443
+ * @param getContext - callback function which is used to get context for given resolved url. If context
444
+ * is returned then it will be embedded into url returned by getAbsoluteUrl() method.
445
+ */
446
+ constructor(shareLinkFetcherProps?: ShareLinkFetcherProps | undefined, logger?: ITelemetryBaseLogger, appName?: string | undefined, getContext?: ((resolvedUrl: IOdspResolvedUrl, dataStorePath: string) => Promise<string | undefined>) | undefined);
447
+ /**
448
+ * Takes an already generated data store url (from requestUrl) and appends a path to the
449
+ * existing data store information.
450
+ */
451
+ appendDataStorePath(requestUrl: URL, pathToAppend: string): string | undefined;
452
+ private getKey;
453
+ /**
454
+ * Resolves request URL into driver details
455
+ */
456
+ resolve(request: IRequest): Promise<IOdspResolvedUrl>;
457
+ private removeNavParam;
458
+ private getShareLinkPromise;
459
+ /**
460
+ * Requests a driver + data store storage URL. Note that this method requires share link to be fetched
461
+ * and it will throw in case share link fetcher props were not specified when instance was created.
462
+ * @param resolvedUrl - The driver resolved URL
463
+ * @param dataStorePath - The relative data store path URL.
464
+ * For requesting a driver URL, this value should always be '/'. If an empty string is passed, then dataStorePath
465
+ * will be extracted from the resolved url if present.
466
+ * @param packageInfoSource - optional, represents container package information to be included in url.
467
+ */
468
+ getAbsoluteUrl(resolvedUrl: IResolvedUrl, dataStorePath: string, packageInfoSource?: IContainerPackageInfo): Promise<string>;
469
+ /**
470
+ * Crafts a supported document/driver URL
471
+ */
472
+ static createDocumentUrl(baseUrl: string, driverInfo: OdspFluidDataStoreLocator): string;
473
+ /**
474
+ * Crafts a supported data store nav param
475
+ * @deprecated encodeOdspFluidDataStoreLocator should be used instead
476
+ */
477
+ static createNavParam(locator: OdspFluidDataStoreLocator): string;
478
+ }
479
+
480
+ /**
481
+ * @public
482
+ */
483
+ export declare interface OdspFluidDataStoreLocator extends IOdspUrlParts {
484
+ dataStorePath: string;
485
+ appName?: string;
486
+ containerPackageName?: string;
487
+ fileVersion?: string;
488
+ context?: string;
489
+ }
490
+
491
+ /**
492
+ * Converts snapshot from binary compact representation to tree/blobs/ops.
493
+ * @param buffer - Compact snapshot to be parsed into tree/blobs/ops.
494
+ * @returns Tree, blobs and ops from the snapshot.
495
+ * @public
496
+ */
497
+ export declare function parseCompactSnapshotResponse(buffer: Uint8Array, logger: ITelemetryLoggerExt): ISnapshotContentsWithProps;
498
+
499
+ /**
500
+ * Function to prefetch the snapshot and cached it in the persistant cache, so that when the container is loaded
501
+ * the cached latest snapshot could be used and removes the network call from the critical path.
502
+ *
503
+ * @param resolvedUrl - Resolved url to fetch the snapshot.
504
+ * @param getStorageToken - function that can provide the storage token for a given site. This is
505
+ * is also referred to as the "VROOM" token in SPO.
506
+ * @param persistedCache - Cache to store the fetched snapshot.
507
+ * @param forceAccessTokenViaAuthorizationHeader - whether to force passing given token via authorization header.
508
+ * @param logger - Logger to have telemetry events.
509
+ * @param hostSnapshotFetchOptions - Options to fetch the snapshot if any. Otherwise default will be used.
510
+ * @param enableRedeemFallback - True to have the sharing link redeem fallback in case the Trees Latest/Redeem
511
+ * 1RT call fails with redeem error. During fallback it will first redeem the sharing link and then make
512
+ * the Trees latest call.
513
+ * Note: this can be considered deprecated - it will be replaced with `snapshotFormatFetchType`.
514
+ * @param fetchBinarySnapshotFormat - Control if we want to fetch binary format snapshot.
515
+ * @param snapshotFormatFetchType - Snapshot format to fetch.
516
+ * @param odspDocumentServiceFactory - factory to access the non persistent cache and store the prefetch promise.
517
+ *
518
+ * @returns `true` if the snapshot is cached, `false` otherwise.
519
+ *
520
+ * @public
521
+ */
522
+ 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>;
523
+
524
+ /**
525
+ * Properties passed to the code responsible for fetching share link for a file.
526
+ * @public
527
+ */
528
+ export declare interface ShareLinkFetcherProps {
529
+ /**
530
+ * Callback method that is used to fetch access token necessary to call API that produces share link
531
+ */
532
+ tokenFetcher: TokenFetcher<OdspResourceTokenFetchOptions>;
533
+ /**
534
+ * Identity type determining the shape of share link as it differs for Enterprise and Consumer users.
535
+ */
536
+ identityType: IdentityType;
537
+ }
538
+
539
+ /**
540
+ * @public
541
+ */
542
+ export declare enum SharingLinkHeader {
543
+ isSharingLinkToRedeem = "isSharingLinkToRedeem"
544
+ }
545
+
546
+ /**
547
+ * Enum to support different types of snapshot formats.
548
+ * @public
549
+ */
550
+ export declare enum SnapshotFormatSupportType {
551
+ Json = 0,
552
+ Binary = 1,
553
+ JsonAndBinary = 2
554
+ }
555
+
556
+ /**
557
+ * Embeds Fluid data store locator data into given ODSP url
558
+ * @param url - file url in ODSP format (can be either canonical or share link)
559
+ * @param locator - object representing Fluid data store location in ODSP terms
560
+ * @public
561
+ */
562
+ export declare function storeLocatorInOdspUrl(url: URL, locator: OdspFluidDataStoreLocator): void;
563
+
564
+ export { }