@fluidframework/odsp-driver 0.51.0 → 0.52.0
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.
- package/dist/contractsPublic.d.ts +0 -4
- package/dist/contractsPublic.d.ts.map +1 -1
- package/dist/contractsPublic.js.map +1 -1
- package/dist/createFile.js +6 -5
- package/dist/createFile.js.map +1 -1
- package/dist/createNewUtils.js +5 -4
- package/dist/createNewUtils.js.map +1 -1
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/epochTracker.js +1 -4
- package/dist/epochTracker.js.map +1 -1
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js +4 -6
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/getFileLink.d.ts +1 -1
- package/dist/getFileLink.d.ts.map +1 -1
- package/dist/getFileLink.js +32 -22
- package/dist/getFileLink.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js +1 -8
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDriverUrlResolver.d.ts +0 -4
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/odspDriverUrlResolver.js +0 -7
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.d.ts +2 -6
- package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.js +3 -15
- package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/dist/odspSummaryUploadManager.js +24 -4
- package/dist/odspSummaryUploadManager.js.map +1 -1
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/odspUtils.js +0 -1
- package/dist/odspUtils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/zipItDataRepresentationUtils.js +0 -1
- package/dist/zipItDataRepresentationUtils.js.map +1 -1
- package/lib/contractsPublic.d.ts +0 -4
- package/lib/contractsPublic.d.ts.map +1 -1
- package/lib/contractsPublic.js.map +1 -1
- package/lib/createFile.js +6 -5
- package/lib/createFile.js.map +1 -1
- package/lib/createNewUtils.js +5 -4
- package/lib/createNewUtils.js.map +1 -1
- package/lib/epochTracker.d.ts.map +1 -1
- package/lib/epochTracker.js +2 -5
- package/lib/epochTracker.js.map +1 -1
- package/lib/fetchSnapshot.d.ts.map +1 -1
- package/lib/fetchSnapshot.js +4 -6
- package/lib/fetchSnapshot.js.map +1 -1
- package/lib/getFileLink.d.ts +1 -1
- package/lib/getFileLink.d.ts.map +1 -1
- package/lib/getFileLink.js +33 -23
- package/lib/getFileLink.js.map +1 -1
- package/lib/odspDocumentStorageManager.d.ts.map +1 -1
- package/lib/odspDocumentStorageManager.js +2 -9
- package/lib/odspDocumentStorageManager.js.map +1 -1
- package/lib/odspDriverUrlResolver.d.ts +0 -4
- package/lib/odspDriverUrlResolver.d.ts.map +1 -1
- package/lib/odspDriverUrlResolver.js +0 -7
- package/lib/odspDriverUrlResolver.js.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.d.ts +2 -6
- package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.js +3 -15
- package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/lib/odspSummaryUploadManager.js +5 -4
- package/lib/odspSummaryUploadManager.js.map +1 -1
- package/lib/odspUtils.d.ts.map +1 -1
- package/lib/odspUtils.js +0 -1
- package/lib/odspUtils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/zipItDataRepresentationUtils.js +0 -1
- package/lib/zipItDataRepresentationUtils.js.map +1 -1
- package/package.json +12 -12
- package/src/contractsPublic.ts +0 -5
- package/src/epochTracker.ts +2 -5
- package/src/fetchSnapshot.ts +3 -9
- package/src/getFileLink.ts +40 -26
- package/src/odspDocumentStorageManager.ts +1 -10
- package/src/odspDriverUrlResolver.ts +0 -13
- package/src/odspDriverUrlResolverForShareLink.ts +5 -23
- package/src/odspUtils.ts +0 -1
- package/src/packageVersion.ts +1 -1
- package/src/zipItDataRepresentationUtils.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/odsp-driver",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.0",
|
|
4
4
|
"description": "Socket storage implementation for SPO and ODC",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": "https://github.com/microsoft/FluidFramework",
|
|
@@ -57,16 +57,16 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
59
59
|
"@fluidframework/common-utils": "^0.32.1",
|
|
60
|
-
"@fluidframework/core-interfaces": "^0.
|
|
61
|
-
"@fluidframework/driver-base": "^0.
|
|
62
|
-
"@fluidframework/driver-definitions": "^0.
|
|
63
|
-
"@fluidframework/driver-utils": "^0.
|
|
64
|
-
"@fluidframework/gitresources": "^0.
|
|
65
|
-
"@fluidframework/odsp-doclib-utils": "^0.
|
|
66
|
-
"@fluidframework/odsp-driver-definitions": "^0.
|
|
67
|
-
"@fluidframework/protocol-base": "^0.
|
|
68
|
-
"@fluidframework/protocol-definitions": "^0.
|
|
69
|
-
"@fluidframework/telemetry-utils": "^0.
|
|
60
|
+
"@fluidframework/core-interfaces": "^0.41.0",
|
|
61
|
+
"@fluidframework/driver-base": "^0.52.0",
|
|
62
|
+
"@fluidframework/driver-definitions": "^0.42.0",
|
|
63
|
+
"@fluidframework/driver-utils": "^0.52.0",
|
|
64
|
+
"@fluidframework/gitresources": "^0.1034.0",
|
|
65
|
+
"@fluidframework/odsp-doclib-utils": "^0.52.0",
|
|
66
|
+
"@fluidframework/odsp-driver-definitions": "^0.52.0",
|
|
67
|
+
"@fluidframework/protocol-base": "^0.1034.0",
|
|
68
|
+
"@fluidframework/protocol-definitions": "^0.1026.0",
|
|
69
|
+
"@fluidframework/telemetry-utils": "^0.52.0",
|
|
70
70
|
"abort-controller": "^3.0.0",
|
|
71
71
|
"node-fetch": "^2.6.1",
|
|
72
72
|
"socket.io-client": "^2.4.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@fluidframework/build-common": "^0.23.0",
|
|
77
77
|
"@fluidframework/eslint-config-fluid": "^0.24.0",
|
|
78
|
-
"@fluidframework/mocha-test-setup": "^0.
|
|
78
|
+
"@fluidframework/mocha-test-setup": "^0.52.0",
|
|
79
79
|
"@microsoft/api-extractor": "^7.16.1",
|
|
80
80
|
"@types/mocha": "^8.2.2",
|
|
81
81
|
"@types/node-fetch": "^2.5.10",
|
package/src/contractsPublic.ts
CHANGED
|
@@ -5,11 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import { IOdspUrlParts } from "@fluidframework/odsp-driver-definitions";
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated - use OdspFluidDataStoreLocator
|
|
10
|
-
*/
|
|
11
|
-
export type OdspDocumentInfo = OdspFluidDataStoreLocator;
|
|
12
|
-
|
|
13
8
|
export interface OdspFluidDataStoreLocator extends IOdspUrlParts {
|
|
14
9
|
dataStorePath: string;
|
|
15
10
|
appName?: string;
|
package/src/epochTracker.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
IOdspError,
|
|
19
19
|
} from "@fluidframework/odsp-driver-definitions";
|
|
20
20
|
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
21
|
-
import { PerformanceEvent,
|
|
21
|
+
import { PerformanceEvent, isFluidError, normalizeError } from "@fluidframework/telemetry-utils";
|
|
22
22
|
import { fetchAndParseAsJSONHelper, fetchArray, IOdspResponse } from "./odspUtils";
|
|
23
23
|
import {
|
|
24
24
|
IOdspCache,
|
|
@@ -167,7 +167,6 @@ export class EpochTracker implements IPersistedFileCache {
|
|
|
167
167
|
throw error;
|
|
168
168
|
}).catch((error) => {
|
|
169
169
|
const fluidError = normalizeError(error, {props: {"X-RequestStats": clientCorelationId}});
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
171
170
|
throw fluidError;
|
|
172
171
|
});
|
|
173
172
|
}
|
|
@@ -209,7 +208,6 @@ export class EpochTracker implements IPersistedFileCache {
|
|
|
209
208
|
throw error;
|
|
210
209
|
}).catch((error) => {
|
|
211
210
|
const fluidError = normalizeError(error, {props: {"X-RequestStats": clientCorelationId}});
|
|
212
|
-
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
213
211
|
throw fluidError;
|
|
214
212
|
});
|
|
215
213
|
}
|
|
@@ -287,7 +285,7 @@ export class EpochTracker implements IPersistedFileCache {
|
|
|
287
285
|
// This will only throw if it is an epoch error.
|
|
288
286
|
this.checkForEpochErrorCore(epochFromResponse);
|
|
289
287
|
} catch (epochError) {
|
|
290
|
-
assert(
|
|
288
|
+
assert(isFluidError(epochError),
|
|
291
289
|
0x21f /* "epochError expected to be thrown by throwOdspNetworkError and of known type" */);
|
|
292
290
|
epochError.addTelemetryProperties({
|
|
293
291
|
fromCache,
|
|
@@ -297,7 +295,6 @@ export class EpochTracker implements IPersistedFileCache {
|
|
|
297
295
|
this.logger.sendErrorEvent({ eventName: "fileOverwrittenInStorage" }, epochError);
|
|
298
296
|
// If the epoch mismatches, then clear all entries for such file entry from cache.
|
|
299
297
|
await this.removeEntries();
|
|
300
|
-
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
301
298
|
throw epochError;
|
|
302
299
|
}
|
|
303
300
|
// If it was categorized as epoch error but the epoch returned in response matches with the client epoch
|
package/src/fetchSnapshot.ts
CHANGED
|
@@ -101,16 +101,10 @@ export async function fetchSnapshotWithRedeem(
|
|
|
101
101
|
logger.sendErrorEvent({
|
|
102
102
|
eventName: "RedeemFallback",
|
|
103
103
|
errorType: error.errorType,
|
|
104
|
-
});
|
|
104
|
+
}, error);
|
|
105
105
|
await redeemSharingLink(odspResolvedUrl, storageTokenFetcher, logger);
|
|
106
106
|
const odspResolvedUrlWithoutShareLink: IOdspResolvedUrl =
|
|
107
|
-
|
|
108
|
-
if(odspResolvedUrlWithoutShareLink.shareLinkInfo) {
|
|
109
|
-
odspResolvedUrlWithoutShareLink.shareLinkInfo = {
|
|
110
|
-
...odspResolvedUrlWithoutShareLink.shareLinkInfo,
|
|
111
|
-
sharingLinkToRedeem: undefined,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
107
|
+
{ ...odspResolvedUrl, shareLinkInfo: { ...odspResolvedUrl.shareLinkInfo, sharingLinkToRedeem: undefined } };
|
|
114
108
|
|
|
115
109
|
return fetchLatestSnapshotCore(
|
|
116
110
|
odspResolvedUrlWithoutShareLink,
|
|
@@ -466,7 +460,7 @@ export async function downloadSnapshot(
|
|
|
466
460
|
}
|
|
467
461
|
|
|
468
462
|
function isRedeemSharingLinkError(odspResolvedUrl: IOdspResolvedUrl, error: any) {
|
|
469
|
-
if (odspResolvedUrl.sharingLinkToRedeem !== undefined
|
|
463
|
+
if (odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem !== undefined
|
|
470
464
|
&& (typeof error === "object" && error !== null)
|
|
471
465
|
&& (error.errorType === DriverErrorType.authorizationError
|
|
472
466
|
|| error.errorType === DriverErrorType.fileNotFoundOrAccessDeniedError)) {
|
package/src/getFileLink.ts
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
7
|
-
import {
|
|
7
|
+
import { assert, delay } from "@fluidframework/common-utils";
|
|
8
8
|
import { canRetryOnError, getRetryDelayFromError } from "@fluidframework/driver-utils";
|
|
9
9
|
import { PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
10
|
+
import { fetchIncorrectResponse, throwOdspNetworkError } from "@fluidframework/odsp-doclib-utils";
|
|
10
11
|
import {
|
|
11
12
|
IOdspUrlParts,
|
|
12
13
|
OdspResourceTokenFetchOptions,
|
|
@@ -18,7 +19,7 @@ import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth";
|
|
|
18
19
|
import { fetchHelper, getWithRetryForTokenRefresh } from "./odspUtils";
|
|
19
20
|
|
|
20
21
|
// Store cached responses for the lifetime of web session as file link remains the same for given file item
|
|
21
|
-
const fileLinkCache = new
|
|
22
|
+
const fileLinkCache = new Map<string, Promise<string>>();
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Returns file link for a file with given drive and item ids.
|
|
@@ -39,10 +40,11 @@ export async function getFileLink(
|
|
|
39
40
|
odspUrlParts: IOdspUrlParts,
|
|
40
41
|
identityType: IdentityType,
|
|
41
42
|
logger: ITelemetryLogger,
|
|
42
|
-
): Promise<string
|
|
43
|
+
): Promise<string> {
|
|
43
44
|
const cacheKey = `${odspUrlParts.siteUrl}_${odspUrlParts.driveId}_${odspUrlParts.itemId}`;
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
const maybeFileLinkCacheEntry = fileLinkCache.get(cacheKey);
|
|
46
|
+
if (maybeFileLinkCacheEntry !== undefined) {
|
|
47
|
+
return maybeFileLinkCacheEntry;
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
const valueGenerator = async function() {
|
|
@@ -54,10 +56,11 @@ export async function getFileLink(
|
|
|
54
56
|
result = await getFileLinkCore(getToken, odspUrlParts, identityType, logger);
|
|
55
57
|
success = true;
|
|
56
58
|
} catch (err) {
|
|
57
|
-
// If it is not retriable, then just
|
|
59
|
+
// If it is not retriable, then just throw
|
|
58
60
|
if (!canRetryOnError(err)) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
// Delete from the cache to permit retrying later.
|
|
62
|
+
fileLinkCache.delete(cacheKey);
|
|
63
|
+
throw err;
|
|
61
64
|
}
|
|
62
65
|
// If the error is throttling error, then wait for the specified time before retrying.
|
|
63
66
|
// If the waitTime is not specified, then we start with retrying immediately to max of 8s.
|
|
@@ -65,10 +68,14 @@ export async function getFileLink(
|
|
|
65
68
|
await delay(retryAfterMs);
|
|
66
69
|
}
|
|
67
70
|
} while (!success);
|
|
71
|
+
|
|
72
|
+
// We are guaranteed to run the getFileLinkCore at least once with successful result (which must be a string)
|
|
73
|
+
assert(result !== undefined, 0x292 /* "Unexpected undefined result from getFileLinkCore" */);
|
|
68
74
|
return result;
|
|
69
75
|
};
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
const fileLink = valueGenerator();
|
|
77
|
+
fileLinkCache.set(cacheKey, fileLink);
|
|
78
|
+
return fileLink;
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
async function getFileLinkCore(
|
|
@@ -76,11 +83,8 @@ async function getFileLinkCore(
|
|
|
76
83
|
odspUrlParts: IOdspUrlParts,
|
|
77
84
|
identityType: IdentityType,
|
|
78
85
|
logger: ITelemetryLogger,
|
|
79
|
-
): Promise<string
|
|
86
|
+
): Promise<string> {
|
|
80
87
|
const fileItem = await getFileItemLite(getToken, odspUrlParts, logger);
|
|
81
|
-
if (!fileItem) {
|
|
82
|
-
return undefined;
|
|
83
|
-
}
|
|
84
88
|
|
|
85
89
|
// ODC canonical link does not require any additional processing
|
|
86
90
|
if (identityType === "Consumer") {
|
|
@@ -111,11 +115,14 @@ async function getFileLinkCore(
|
|
|
111
115
|
};
|
|
112
116
|
const response = await fetchHelper(url, requestInit);
|
|
113
117
|
additionalProps = response.commonSpoHeaders;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
|
|
119
|
+
const sharingInfo = await response.content.json();
|
|
120
|
+
const directUrl = sharingInfo?.d?.directUrl;
|
|
121
|
+
if (typeof directUrl !== "string") {
|
|
122
|
+
// This will retry once in getWithRetryForTokenRefresh
|
|
123
|
+
throwOdspNetworkError("malformedGetSharingInformationResponse", fetchIncorrectResponse);
|
|
117
124
|
}
|
|
118
|
-
return
|
|
125
|
+
return directUrl;
|
|
119
126
|
});
|
|
120
127
|
event.end({ ...additionalProps, attempts });
|
|
121
128
|
return fileLink;
|
|
@@ -131,11 +138,18 @@ interface FileItemLite {
|
|
|
131
138
|
webDavUrl: string;
|
|
132
139
|
}
|
|
133
140
|
|
|
141
|
+
const isFileItemLite = (maybeFileItemLite: any): maybeFileItemLite is FileItemLite => {
|
|
142
|
+
if (typeof maybeFileItemLite.webUrl !== "string" || typeof maybeFileItemLite.webDavUrl !== "string") {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
return true;
|
|
146
|
+
};
|
|
147
|
+
|
|
134
148
|
async function getFileItemLite(
|
|
135
149
|
getToken: TokenFetcher<OdspResourceTokenFetchOptions>,
|
|
136
150
|
odspUrlParts: IOdspUrlParts,
|
|
137
151
|
logger: ITelemetryLogger,
|
|
138
|
-
): Promise<FileItemLite
|
|
152
|
+
): Promise<FileItemLite> {
|
|
139
153
|
return PerformanceEvent.timedExecAsync(
|
|
140
154
|
logger,
|
|
141
155
|
{ eventName: "odspFileLink", requestName: "getFileItemLite" },
|
|
@@ -153,16 +167,16 @@ async function getFileItemLite(
|
|
|
153
167
|
const requestInit = { method: "GET", headers };
|
|
154
168
|
const response = await fetchHelper(url, requestInit);
|
|
155
169
|
additionalProps = response.commonSpoHeaders;
|
|
156
|
-
|
|
157
|
-
|
|
170
|
+
|
|
171
|
+
const responseJson = await response.content.json();
|
|
172
|
+
if (!isFileItemLite(responseJson)) {
|
|
173
|
+
// This will retry once in getWithRetryForTokenRefresh
|
|
174
|
+
throwOdspNetworkError("malformedGetFileItemLiteResponse", fetchIncorrectResponse);
|
|
158
175
|
}
|
|
159
|
-
return
|
|
176
|
+
return responseJson;
|
|
160
177
|
});
|
|
161
178
|
event.end({ ...additionalProps, attempts });
|
|
162
|
-
|
|
163
|
-
return fileItem;
|
|
164
|
-
}
|
|
165
|
-
return undefined;
|
|
179
|
+
return fileItem;
|
|
166
180
|
},
|
|
167
181
|
);
|
|
168
182
|
}
|
|
@@ -7,8 +7,6 @@ import { default as AbortController } from "abort-controller";
|
|
|
7
7
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
8
8
|
import {
|
|
9
9
|
assert,
|
|
10
|
-
stringToBuffer,
|
|
11
|
-
bufferToString,
|
|
12
10
|
delay,
|
|
13
11
|
} from "@fluidframework/common-utils";
|
|
14
12
|
import {
|
|
@@ -318,14 +316,7 @@ export class OdspDocumentStorageService implements IDocumentStorageService {
|
|
|
318
316
|
if (!this.attributesBlobHandles.has(blobId)) {
|
|
319
317
|
return blob;
|
|
320
318
|
}
|
|
321
|
-
|
|
322
|
-
// fix the branch name in attributes
|
|
323
|
-
// this prevents issues when generating summaries
|
|
324
|
-
const documentAttributes: api.IDocumentAttributes = JSON.parse(bufferToString(blob, "utf8"));
|
|
325
|
-
documentAttributes.branch = this.documentId;
|
|
326
|
-
const content = JSON.stringify(documentAttributes);
|
|
327
|
-
const patchedBlob = stringToBuffer(content, "utf8");
|
|
328
|
-
return patchedBlob;
|
|
319
|
+
return blob;
|
|
329
320
|
}
|
|
330
321
|
|
|
331
322
|
public async readBlob(blobId: string): Promise<ArrayBufferLike> {
|
|
@@ -7,7 +7,6 @@ import { assert } from "@fluidframework/common-utils";
|
|
|
7
7
|
import { IFluidCodeDetails, IRequest, isFluidPackage } from "@fluidframework/core-interfaces";
|
|
8
8
|
import { DriverHeader, IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
9
9
|
import { IOdspResolvedUrl, ShareLinkTypes, ShareLinkInfoType } from "@fluidframework/odsp-driver-definitions";
|
|
10
|
-
import { createOdspCreateContainerRequest } from "./createOdspCreateContainerRequest";
|
|
11
10
|
import { createOdspUrl } from "./createOdspUrl";
|
|
12
11
|
import { getApiRoot } from "./odspUrlHelper";
|
|
13
12
|
import { getOdspResolvedUrl } from "./odspUtils";
|
|
@@ -166,18 +165,6 @@ export class OdspDriverUrlResolver implements IUrlResolver {
|
|
|
166
165
|
dataStorePath,
|
|
167
166
|
});
|
|
168
167
|
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @deprecated - use createOdspCreateContainerRequest
|
|
172
|
-
*/
|
|
173
|
-
public createCreateNewRequest(
|
|
174
|
-
siteUrl: string,
|
|
175
|
-
driveId: string,
|
|
176
|
-
filePath: string,
|
|
177
|
-
fileName: string,
|
|
178
|
-
): IRequest {
|
|
179
|
-
return createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName);
|
|
180
|
-
}
|
|
181
168
|
}
|
|
182
169
|
|
|
183
170
|
function decodeOdspUrl(url: string): {
|
|
@@ -22,8 +22,7 @@ import {
|
|
|
22
22
|
encodeOdspFluidDataStoreLocator,
|
|
23
23
|
locatorQueryParamName,
|
|
24
24
|
} from "./odspFluidFileLink";
|
|
25
|
-
import {
|
|
26
|
-
import { createOdspCreateContainerRequest } from "./createOdspCreateContainerRequest";
|
|
25
|
+
import { OdspFluidDataStoreLocator, SharingLinkHeader } from "./contractsPublic";
|
|
27
26
|
import { createOdspUrl } from "./createOdspUrl";
|
|
28
27
|
import { OdspDriverUrlResolver } from "./odspDriverUrlResolver";
|
|
29
28
|
import { getOdspResolvedUrl, createOdspLogger } from "./odspUtils";
|
|
@@ -77,18 +76,6 @@ export class OdspDriverUrlResolverForShareLink implements IUrlResolver {
|
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
|
|
80
|
-
/**
|
|
81
|
-
* @deprecated - use createOdspCreateContainerRequest
|
|
82
|
-
*/
|
|
83
|
-
public createCreateNewRequest(
|
|
84
|
-
siteUrl: string,
|
|
85
|
-
driveId: string,
|
|
86
|
-
filePath: string,
|
|
87
|
-
fileName: string,
|
|
88
|
-
) {
|
|
89
|
-
return createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
79
|
/**
|
|
93
80
|
* Takes an already generated data store url (from requestUrl) and appends a path to the
|
|
94
81
|
* existing data store information.
|
|
@@ -145,9 +132,8 @@ export class OdspDriverUrlResolverForShareLink implements IUrlResolver {
|
|
|
145
132
|
// We need to remove the nav param if set by host when setting the sharelink as otherwise the shareLinkId
|
|
146
133
|
// when redeeming the share link during the redeem fallback for trees latest call becomes greater than
|
|
147
134
|
// the eligible length.
|
|
148
|
-
odspResolvedUrl.sharingLinkToRedeem = this.removeNavParam(request.url);
|
|
149
135
|
odspResolvedUrl.shareLinkInfo = Object.assign(odspResolvedUrl.shareLinkInfo || {},
|
|
150
|
-
{sharingLinkToRedeem:
|
|
136
|
+
{sharingLinkToRedeem: this.removeNavParam(request.url)});
|
|
151
137
|
}
|
|
152
138
|
if (odspResolvedUrl.itemId) {
|
|
153
139
|
// Kick start the sharing link request if we don't have it already as a performance optimization.
|
|
@@ -203,12 +189,8 @@ export class OdspDriverUrlResolverForShareLink implements IUrlResolver {
|
|
|
203
189
|
resolvedUrl,
|
|
204
190
|
this.shareLinkFetcherProps.identityType,
|
|
205
191
|
this.logger,
|
|
206
|
-
).
|
|
207
|
-
|
|
208
|
-
throw new Error("Failed to get share link");
|
|
209
|
-
}
|
|
210
|
-
return fileLink;
|
|
211
|
-
}).catch((error) => {
|
|
192
|
+
).catch((error) => {
|
|
193
|
+
// This should imply that error is a non-retriable error.
|
|
212
194
|
this.logger.sendErrorEvent({ eventName: "FluidFileUrlError" }, error);
|
|
213
195
|
this.sharingLinkCache.remove(key);
|
|
214
196
|
throw error;
|
|
@@ -254,7 +236,7 @@ export class OdspDriverUrlResolverForShareLink implements IUrlResolver {
|
|
|
254
236
|
/**
|
|
255
237
|
* Crafts a supported document/driver URL
|
|
256
238
|
*/
|
|
257
|
-
public static createDocumentUrl(baseUrl: string, driverInfo:
|
|
239
|
+
public static createDocumentUrl(baseUrl: string, driverInfo: OdspFluidDataStoreLocator) {
|
|
258
240
|
const url = new URL(baseUrl);
|
|
259
241
|
|
|
260
242
|
storeLocatorInOdspUrl(url, driverInfo);
|
package/src/odspUtils.ts
CHANGED
|
@@ -300,7 +300,6 @@ export function toInstrumentedOdspTokenFetcher(
|
|
|
300
300
|
const tokenError = wrapError(
|
|
301
301
|
error,
|
|
302
302
|
(errorMessage) => createOdspNetworkError("tokenFetcherFailed", errorMessage, fetchTokenErrorCode));
|
|
303
|
-
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
304
303
|
throw tokenError;
|
|
305
304
|
}),
|
|
306
305
|
{ cancel: "generic" });
|
package/src/packageVersion.ts
CHANGED