@fluidframework/odsp-driver 2.0.0-dev-rc.1.0.0.228517 → 2.0.0-dev-rc.1.0.0.232845
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/api-report/odsp-driver.api.md +5 -5
- package/dist/compactSnapshotParser.d.ts +2 -2
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/compactSnapshotParser.js +8 -7
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/compactSnapshotWriter.d.ts +2 -2
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/compactSnapshotWriter.js +1 -1
- package/dist/compactSnapshotWriter.js.map +1 -1
- package/dist/contracts.d.ts +14 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +5 -1
- package/dist/contracts.js.map +1 -1
- package/dist/createFile.d.ts +1 -1
- package/dist/createFile.d.ts.map +1 -1
- package/dist/createFile.js +9 -28
- package/dist/createFile.js.map +1 -1
- package/dist/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/dist/createNewContainerOnExistingFile.js.map +1 -1
- package/dist/createNewUtils.d.ts +2 -2
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/createNewUtils.js +4 -3
- package/dist/createNewUtils.js.map +1 -1
- package/dist/createOdspCreateContainerRequest.d.ts +2 -2
- package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/dist/createOdspCreateContainerRequest.js.map +1 -1
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/epochTracker.js +3 -4
- package/dist/epochTracker.js.map +1 -1
- package/dist/fetchSnapshot.d.ts +4 -4
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js +12 -13
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/getFileLink.d.ts.map +1 -1
- package/dist/getFileLink.js +3 -3
- package/dist/getFileLink.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.d.ts +3 -2
- package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.js +3 -1
- package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +2 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js +3 -0
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
- package/dist/odsp-driver-alpha.d.ts +4 -3
- package/dist/odsp-driver-beta.d.ts +3 -3
- package/dist/odsp-driver-public.d.ts +3 -3
- package/dist/odsp-driver-untrimmed.d.ts +5 -4
- package/dist/odspCache.d.ts +2 -2
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/odspCache.js.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts +5 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.js +56 -5
- package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
- package/dist/odspDocumentService.d.ts +3 -2
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/odspDocumentService.js +6 -3
- package/dist/odspDocumentService.js.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.js +1 -8
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts +2 -1
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js +30 -11
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts +3 -3
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/odspDocumentStorageServiceBase.js +3 -3
- package/dist/odspDocumentStorageServiceBase.js.map +1 -1
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/odspDriverUrlResolver.js +2 -11
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspError.d.ts.map +1 -1
- package/dist/odspError.js +2 -2
- package/dist/odspError.js.map +1 -1
- package/dist/odspPublicUtils.d.ts +1 -0
- package/dist/odspPublicUtils.d.ts.map +1 -1
- package/dist/odspPublicUtils.js.map +1 -1
- package/dist/odspSnapshotParser.d.ts +2 -2
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/odspSnapshotParser.js +2 -1
- package/dist/odspSnapshotParser.js.map +1 -1
- package/dist/odspUtils.d.ts +11 -7
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/odspUtils.js +20 -16
- 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/retryErrorsStorageAdapter.d.ts +2 -1
- package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/dist/retryErrorsStorageAdapter.js +8 -0
- package/dist/retryErrorsStorageAdapter.js.map +1 -1
- package/dist/retryUtils.js +1 -1
- package/dist/retryUtils.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/zipItDataRepresentationUtils.js +2 -2
- package/dist/zipItDataRepresentationUtils.js.map +1 -1
- package/lib/compactSnapshotParser.d.mts +2 -2
- package/lib/compactSnapshotParser.d.mts.map +1 -1
- package/lib/compactSnapshotParser.mjs +8 -7
- package/lib/compactSnapshotParser.mjs.map +1 -1
- package/lib/compactSnapshotWriter.d.mts +2 -2
- package/lib/compactSnapshotWriter.d.mts.map +1 -1
- package/lib/compactSnapshotWriter.mjs +1 -1
- package/lib/compactSnapshotWriter.mjs.map +1 -1
- package/lib/contracts.d.mts +14 -0
- package/lib/contracts.d.mts.map +1 -1
- package/lib/contracts.mjs +4 -0
- package/lib/contracts.mjs.map +1 -1
- package/lib/createFile.d.mts +1 -1
- package/lib/createFile.d.mts.map +1 -1
- package/lib/createFile.mjs +10 -29
- package/lib/createFile.mjs.map +1 -1
- package/lib/createNewContainerOnExistingFile.d.mts.map +1 -1
- package/lib/createNewContainerOnExistingFile.mjs.map +1 -1
- package/lib/createNewUtils.d.mts +2 -2
- package/lib/createNewUtils.d.mts.map +1 -1
- package/lib/createNewUtils.mjs +4 -3
- package/lib/createNewUtils.mjs.map +1 -1
- package/lib/createOdspCreateContainerRequest.d.mts +2 -2
- package/lib/createOdspCreateContainerRequest.d.mts.map +1 -1
- package/lib/createOdspCreateContainerRequest.mjs.map +1 -1
- package/lib/epochTracker.d.mts.map +1 -1
- package/lib/epochTracker.mjs +4 -5
- package/lib/epochTracker.mjs.map +1 -1
- package/lib/fetchSnapshot.d.mts +4 -4
- package/lib/fetchSnapshot.d.mts.map +1 -1
- package/lib/fetchSnapshot.mjs +13 -14
- package/lib/fetchSnapshot.mjs.map +1 -1
- package/lib/getFileLink.d.mts.map +1 -1
- package/lib/getFileLink.mjs +3 -3
- package/lib/getFileLink.mjs.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.d.mts +3 -2
- package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.mjs +3 -1
- package/lib/localOdspDriver/localOdspDocumentService.mjs.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts +2 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs +3 -0
- package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +1 -1
- package/lib/odsp-driver-alpha.d.mts +4 -3
- package/lib/odsp-driver-beta.d.mts +3 -3
- package/lib/odsp-driver-public.d.mts +3 -3
- package/lib/odsp-driver-untrimmed.d.mts +5 -4
- package/lib/odspCache.d.mts +2 -2
- package/lib/odspCache.d.mts.map +1 -1
- package/lib/odspCache.mjs.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.d.mts +5 -1
- package/lib/odspDelayLoadedDeltaStream.d.mts.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.mjs +57 -6
- package/lib/odspDelayLoadedDeltaStream.mjs.map +1 -1
- package/lib/odspDocumentService.d.mts +3 -2
- package/lib/odspDocumentService.d.mts.map +1 -1
- package/lib/odspDocumentService.mjs +6 -3
- package/lib/odspDocumentService.mjs.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.mts.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.mjs +2 -9
- package/lib/odspDocumentServiceFactoryCore.mjs.map +1 -1
- package/lib/odspDocumentStorageManager.d.mts +2 -1
- package/lib/odspDocumentStorageManager.d.mts.map +1 -1
- package/lib/odspDocumentStorageManager.mjs +33 -14
- package/lib/odspDocumentStorageManager.mjs.map +1 -1
- package/lib/odspDocumentStorageServiceBase.d.mts +3 -3
- package/lib/odspDocumentStorageServiceBase.d.mts.map +1 -1
- package/lib/odspDocumentStorageServiceBase.mjs +3 -3
- package/lib/odspDocumentStorageServiceBase.mjs.map +1 -1
- package/lib/odspDriverUrlResolver.d.mts.map +1 -1
- package/lib/odspDriverUrlResolver.mjs +4 -13
- package/lib/odspDriverUrlResolver.mjs.map +1 -1
- package/lib/odspError.d.mts.map +1 -1
- package/lib/odspError.mjs +2 -2
- package/lib/odspError.mjs.map +1 -1
- package/lib/odspPublicUtils.d.mts +1 -0
- package/lib/odspPublicUtils.d.mts.map +1 -1
- package/lib/odspPublicUtils.mjs.map +1 -1
- package/lib/odspSnapshotParser.d.mts +2 -2
- package/lib/odspSnapshotParser.d.mts.map +1 -1
- package/lib/odspSnapshotParser.mjs +2 -1
- package/lib/odspSnapshotParser.mjs.map +1 -1
- package/lib/odspUtils.d.mts +11 -7
- package/lib/odspUtils.d.mts.map +1 -1
- package/lib/odspUtils.mjs +19 -16
- package/lib/odspUtils.mjs.map +1 -1
- package/lib/packageVersion.d.mts +1 -1
- package/lib/packageVersion.mjs +1 -1
- package/lib/packageVersion.mjs.map +1 -1
- package/lib/retryErrorsStorageAdapter.d.mts +2 -1
- package/lib/retryErrorsStorageAdapter.d.mts.map +1 -1
- package/lib/retryErrorsStorageAdapter.mjs +9 -1
- package/lib/retryErrorsStorageAdapter.mjs.map +1 -1
- package/lib/retryUtils.mjs +2 -2
- package/lib/retryUtils.mjs.map +1 -1
- package/lib/zipItDataRepresentationUtils.mjs +2 -2
- package/lib/zipItDataRepresentationUtils.mjs.map +1 -1
- package/package.json +25 -16
- package/src/compactSnapshotParser.ts +10 -9
- package/src/compactSnapshotWriter.ts +3 -3
- package/src/contracts.ts +17 -0
- package/src/createFile.ts +10 -38
- package/src/createNewContainerOnExistingFile.ts +2 -2
- package/src/createNewUtils.ts +7 -6
- package/src/createOdspCreateContainerRequest.ts +2 -2
- package/src/epochTracker.ts +4 -4
- package/src/fetchSnapshot.ts +21 -22
- package/src/getFileLink.ts +3 -3
- package/src/localOdspDriver/localOdspDocumentService.ts +9 -2
- package/src/localOdspDriver/localOdspDocumentStorageManager.ts +10 -3
- package/src/odspCache.ts +2 -2
- package/src/odspDelayLoadedDeltaStream.ts +67 -6
- package/src/odspDocumentService.ts +10 -2
- package/src/odspDocumentServiceFactoryCore.ts +3 -11
- package/src/odspDocumentStorageManager.ts +60 -27
- package/src/odspDocumentStorageServiceBase.ts +8 -5
- package/src/odspDriverUrlResolver.ts +3 -17
- package/src/odspError.ts +2 -3
- package/src/odspPublicUtils.ts +1 -0
- package/src/odspSnapshotParser.ts +5 -6
- package/src/odspUtils.ts +34 -28
- package/src/packageVersion.ts +1 -1
- package/src/retryErrorsStorageAdapter.ts +12 -1
- package/src/retryUtils.ts +2 -2
- package/src/zipItDataRepresentationUtils.ts +2 -2
- /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils";
|
|
7
7
|
import { ISequencedDocumentMessage, ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
9
|
-
import {
|
|
9
|
+
import { ISnapshot } from "@fluidframework/driver-definitions";
|
|
10
10
|
import { ReadBuffer } from "./ReadBufferUtils";
|
|
11
11
|
import {
|
|
12
12
|
assertBlobCoreInstance,
|
|
@@ -29,7 +29,7 @@ export const currentReadVersion = "1.0";
|
|
|
29
29
|
* represents how many times slower parsing path is executed. This will be then logged into telemetry.
|
|
30
30
|
* @internal
|
|
31
31
|
*/
|
|
32
|
-
export interface ISnapshotContentsWithProps extends
|
|
32
|
+
export interface ISnapshotContentsWithProps extends ISnapshot {
|
|
33
33
|
telemetryProps: Record<string, number>;
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -40,7 +40,7 @@ export interface ISnapshotContentsWithProps extends ISnapshotContents {
|
|
|
40
40
|
function readBlobSection(node: NodeTypes) {
|
|
41
41
|
assertNodeCoreInstance(node, "TreeBlobs should be of type NodeCore");
|
|
42
42
|
let slowBlobStructureCount = 0;
|
|
43
|
-
const
|
|
43
|
+
const blobContents: Map<string, ArrayBuffer> = new Map();
|
|
44
44
|
for (const blob of node) {
|
|
45
45
|
assertNodeCoreInstance(blob, "blob should be node");
|
|
46
46
|
|
|
@@ -56,7 +56,7 @@ function readBlobSection(node: NodeTypes) {
|
|
|
56
56
|
) {
|
|
57
57
|
// "id": <node name>
|
|
58
58
|
// "data": <blob>
|
|
59
|
-
|
|
59
|
+
blobContents.set(blob.getString(1), blob.getBlob(3).arrayBuffer);
|
|
60
60
|
continue;
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -67,9 +67,9 @@ function readBlobSection(node: NodeTypes) {
|
|
|
67
67
|
const records = getNodeProps(blob);
|
|
68
68
|
assertBlobCoreInstance(records.data, "data should be of BlobCore type");
|
|
69
69
|
const id = getStringInstance(records.id, "blob id should be string");
|
|
70
|
-
|
|
70
|
+
blobContents.set(id, records.data.arrayBuffer);
|
|
71
71
|
}
|
|
72
|
-
return {
|
|
72
|
+
return { blobContents, slowBlobStructureCount };
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -249,19 +249,20 @@ export function parseCompactSnapshotResponse(
|
|
|
249
249
|
);
|
|
250
250
|
|
|
251
251
|
const [snapshot, durationSnapshotTree] = measure(() => readSnapshotSection(records.snapshot));
|
|
252
|
-
const [
|
|
252
|
+
const [blobContents, durationBlobs] = measure(() => readBlobSection(records.blobs));
|
|
253
253
|
|
|
254
254
|
return {
|
|
255
255
|
...snapshot,
|
|
256
|
-
...
|
|
256
|
+
...blobContents,
|
|
257
257
|
ops: records.deltas !== undefined ? readOpsSection(records.deltas) : [],
|
|
258
258
|
latestSequenceNumber: records.lsn,
|
|
259
|
+
snapshotFormatV: 1,
|
|
259
260
|
telemetryProps: {
|
|
260
261
|
...telemetryProps,
|
|
261
262
|
durationSnapshotTree,
|
|
262
263
|
durationBlobs,
|
|
263
264
|
slowTreeStructureCount: snapshot.slowTreeStructureCount,
|
|
264
|
-
slowBlobStructureCount:
|
|
265
|
+
slowBlobStructureCount: blobContents.slowBlobStructureCount,
|
|
265
266
|
},
|
|
266
267
|
};
|
|
267
268
|
}
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
ISequencedDocumentMessage,
|
|
11
11
|
ISnapshotTree,
|
|
12
12
|
} from "@fluidframework/protocol-definitions";
|
|
13
|
+
import { ISnapshot } from "@fluidframework/driver-definitions";
|
|
13
14
|
import { snapshotMinReadVersion } from "./compactSnapshotParser";
|
|
14
|
-
import { ISnapshotContents } from "./odspPublicUtils";
|
|
15
15
|
import { TreeBuilderSerializer } from "./WriteBufferUtils";
|
|
16
16
|
import {
|
|
17
17
|
addBoolProperty,
|
|
@@ -144,7 +144,7 @@ function writeOpsSection(rootNode: NodeCore, ops: ISequencedDocumentMessage[]) {
|
|
|
144
144
|
* @param snapshotContents - snapshot tree contents to serialize
|
|
145
145
|
* @returns ReadBuffer - binary representation of the data.
|
|
146
146
|
*/
|
|
147
|
-
export function convertToCompactSnapshot(snapshotContents:
|
|
147
|
+
export function convertToCompactSnapshot(snapshotContents: ISnapshot): Uint8Array {
|
|
148
148
|
const builder = new TreeBuilderSerializer();
|
|
149
149
|
// Create the root node.
|
|
150
150
|
const rootNode = builder.addNode();
|
|
@@ -166,7 +166,7 @@ export function convertToCompactSnapshot(snapshotContents: ISnapshotContents): U
|
|
|
166
166
|
writeSnapshotSection(rootNode, snapshotContents.snapshotTree, snapshotContents.sequenceNumber);
|
|
167
167
|
|
|
168
168
|
// Add Blobs
|
|
169
|
-
writeBlobsSection(rootNode, snapshotContents.
|
|
169
|
+
writeBlobsSection(rootNode, snapshotContents.blobContents);
|
|
170
170
|
|
|
171
171
|
// Then write the ops node.
|
|
172
172
|
writeOpsSection(rootNode, snapshotContents.ops);
|
package/src/contracts.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import * as api from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { HostStoragePolicy } from "@fluidframework/odsp-driver-definitions";
|
|
8
|
+
import { ISnapshot } from "@fluidframework/driver-definitions";
|
|
8
9
|
import { ISnapshotContents } from "./odspPublicUtils";
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -165,6 +166,8 @@ export interface IOdspSnapshot {
|
|
|
165
166
|
*/
|
|
166
167
|
export interface HostStoragePolicyInternal extends HostStoragePolicy {
|
|
167
168
|
summarizerClient?: boolean;
|
|
169
|
+
|
|
170
|
+
supportGetSnapshotApi?: boolean;
|
|
168
171
|
}
|
|
169
172
|
|
|
170
173
|
export interface ICreateFileResponse {
|
|
@@ -207,7 +210,21 @@ export interface IFlushOpsResponse {
|
|
|
207
210
|
|
|
208
211
|
/**
|
|
209
212
|
* Represents the cached snapshot value.
|
|
213
|
+
* @deprecated - This will be replaced with ISnapshotCachedEntry2 which wraps the new ISnapshot interface.
|
|
214
|
+
* For now, to support back compat from cache, we need to keep it for now.
|
|
210
215
|
*/
|
|
211
216
|
export interface ISnapshotCachedEntry extends ISnapshotContents {
|
|
212
217
|
cacheEntryTime: number;
|
|
213
218
|
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Represents the cached snapshot value.
|
|
222
|
+
*/
|
|
223
|
+
export interface ISnapshotCachedEntry2 extends ISnapshot {
|
|
224
|
+
cacheEntryTime: number;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Represents the type of signal containing the sensitivity policy labels for the container.
|
|
229
|
+
*/
|
|
230
|
+
export const policyLabelsUpdatesSignalType = "PolicyLabelsUpdate";
|
package/src/createFile.ts
CHANGED
|
@@ -10,13 +10,11 @@ import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry
|
|
|
10
10
|
import {
|
|
11
11
|
InstrumentedStorageTokenFetcher,
|
|
12
12
|
IOdspResolvedUrl,
|
|
13
|
-
|
|
13
|
+
OdspErrorTypes,
|
|
14
14
|
ShareLinkInfoType,
|
|
15
|
-
ISharingLinkKind,
|
|
16
|
-
ShareLinkTypes,
|
|
17
15
|
IFileEntry,
|
|
18
16
|
} from "@fluidframework/odsp-driver-definitions";
|
|
19
|
-
import {
|
|
17
|
+
import { ISnapshot } from "@fluidframework/driver-definitions";
|
|
20
18
|
import { ICreateFileResponse } from "./contracts";
|
|
21
19
|
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth";
|
|
22
20
|
import {
|
|
@@ -26,7 +24,6 @@ import {
|
|
|
26
24
|
INewFileInfo,
|
|
27
25
|
getOrigin,
|
|
28
26
|
} from "./odspUtils";
|
|
29
|
-
import { ISnapshotContents } from "./odspPublicUtils";
|
|
30
27
|
import { createOdspUrl } from "./createOdspUrl";
|
|
31
28
|
import { getApiRoot } from "./odspUrlHelper";
|
|
32
29
|
import { EpochTracker } from "./epochTracker";
|
|
@@ -60,14 +57,13 @@ export async function createNewFluidFile(
|
|
|
60
57
|
forceAccessTokenViaAuthorizationHeader: boolean,
|
|
61
58
|
isClpCompliantApp?: boolean,
|
|
62
59
|
enableSingleRequestForShareLinkWithCreate?: boolean,
|
|
63
|
-
enableShareLinkWithCreate?: boolean,
|
|
64
60
|
): Promise<IOdspResolvedUrl> {
|
|
65
61
|
// Check for valid filename before the request to create file is actually made.
|
|
66
62
|
if (isInvalidFileName(newFileInfo.filename)) {
|
|
67
63
|
throw new NonRetryableError(
|
|
68
64
|
// pre-0.58 error message: Invalid filename
|
|
69
65
|
"Invalid filename for createNew",
|
|
70
|
-
|
|
66
|
+
OdspErrorTypes.invalidFileNameError,
|
|
71
67
|
{ driverVersion },
|
|
72
68
|
);
|
|
73
69
|
}
|
|
@@ -95,12 +91,7 @@ export async function createNewFluidFile(
|
|
|
95
91
|
itemId = content.itemId;
|
|
96
92
|
summaryHandle = content.id;
|
|
97
93
|
|
|
98
|
-
shareLinkInfo = extractShareLinkData(
|
|
99
|
-
newFileInfo.createLinkType,
|
|
100
|
-
content,
|
|
101
|
-
enableSingleRequestForShareLinkWithCreate,
|
|
102
|
-
enableShareLinkWithCreate,
|
|
103
|
-
);
|
|
94
|
+
shareLinkInfo = extractShareLinkData(content, enableSingleRequestForShareLinkWithCreate);
|
|
104
95
|
}
|
|
105
96
|
|
|
106
97
|
const odspUrl = createOdspUrl({ ...newFileInfo, itemId, dataStorePath: "/" });
|
|
@@ -117,7 +108,7 @@ export async function createNewFluidFile(
|
|
|
117
108
|
if (createNewSummary !== undefined && createNewCaching) {
|
|
118
109
|
assert(summaryHandle !== undefined, 0x203 /* "Summary handle is undefined" */);
|
|
119
110
|
// converting summary and getting sequence number
|
|
120
|
-
const snapshot:
|
|
111
|
+
const snapshot: ISnapshot = convertCreateNewSummaryTreeToTreeAndBlobs(
|
|
121
112
|
createNewSummary,
|
|
122
113
|
summaryHandle,
|
|
123
114
|
);
|
|
@@ -128,9 +119,9 @@ export async function createNewFluidFile(
|
|
|
128
119
|
}
|
|
129
120
|
|
|
130
121
|
/**
|
|
131
|
-
* If user requested creation of a sharing link along with the creation of the file by providing
|
|
132
|
-
*
|
|
133
|
-
*
|
|
122
|
+
* If user requested creation of a sharing link along with the creation of the file by providing
|
|
123
|
+
* createLinkScope in the request parameters then extract and save the sharing link information from
|
|
124
|
+
* the response if it is available.
|
|
134
125
|
* In case there was an error in creation of the sharing link, error is provided back in the response,
|
|
135
126
|
* and does not impact the creation of file in ODSP.
|
|
136
127
|
* @param requestedSharingLinkKind - Kind of sharing link requested to be created along with the creation of file.
|
|
@@ -138,14 +129,9 @@ export async function createNewFluidFile(
|
|
|
138
129
|
* @returns Sharing link information received in the response from a successful creation of a file.
|
|
139
130
|
*/
|
|
140
131
|
function extractShareLinkData(
|
|
141
|
-
requestedSharingLinkKind: ShareLinkTypes | ISharingLinkKind | undefined,
|
|
142
132
|
response: ICreateFileResponse,
|
|
143
133
|
enableSingleRequestForShareLinkWithCreate?: boolean,
|
|
144
|
-
enableShareLinkWithCreate?: boolean,
|
|
145
134
|
): ShareLinkInfoType | undefined {
|
|
146
|
-
if (!requestedSharingLinkKind) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
135
|
let shareLinkInfo: ShareLinkInfoType | undefined;
|
|
150
136
|
if (enableSingleRequestForShareLinkWithCreate) {
|
|
151
137
|
const { sharing } = response;
|
|
@@ -154,7 +140,6 @@ function extractShareLinkData(
|
|
|
154
140
|
}
|
|
155
141
|
shareLinkInfo = {
|
|
156
142
|
createLink: {
|
|
157
|
-
type: requestedSharingLinkKind,
|
|
158
143
|
link: sharing.sharingLink
|
|
159
144
|
? {
|
|
160
145
|
scope: sharing.sharingLink.scope,
|
|
@@ -167,19 +152,6 @@ function extractShareLinkData(
|
|
|
167
152
|
shareId: sharing.shareId,
|
|
168
153
|
},
|
|
169
154
|
};
|
|
170
|
-
} else if (enableShareLinkWithCreate) {
|
|
171
|
-
const { sharing, sharingLink, sharingLinkErrorReason } = response;
|
|
172
|
-
if (!sharingLink && !sharingLinkErrorReason) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
shareLinkInfo = {
|
|
176
|
-
createLink: {
|
|
177
|
-
type: requestedSharingLinkKind,
|
|
178
|
-
link: sharingLink,
|
|
179
|
-
error: sharingLinkErrorReason,
|
|
180
|
-
shareId: sharing?.shareId,
|
|
181
|
-
},
|
|
182
|
-
};
|
|
183
155
|
}
|
|
184
156
|
return shareLinkInfo;
|
|
185
157
|
}
|
|
@@ -232,7 +204,7 @@ export async function createNewEmptyFluidFile(
|
|
|
232
204
|
throw new NonRetryableError(
|
|
233
205
|
// pre-0.58 error message: ODSP CreateFile call returned no item ID
|
|
234
206
|
"ODSP CreateFile call returned no item ID (for empty file)",
|
|
235
|
-
|
|
207
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
236
208
|
{ driverVersion },
|
|
237
209
|
);
|
|
238
210
|
}
|
|
@@ -283,7 +255,7 @@ export async function createNewFluidFileFromSummary(
|
|
|
283
255
|
if (!content?.itemId) {
|
|
284
256
|
throw new NonRetryableError(
|
|
285
257
|
"ODSP CreateFile call returned no item ID",
|
|
286
|
-
|
|
258
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
287
259
|
{ driverVersion },
|
|
288
260
|
);
|
|
289
261
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
8
8
|
import { UsageError } from "@fluidframework/driver-utils";
|
|
9
|
+
import { ISnapshot } from "@fluidframework/driver-definitions";
|
|
9
10
|
import {
|
|
10
11
|
IFileEntry,
|
|
11
12
|
InstrumentedStorageTokenFetcher,
|
|
@@ -13,7 +14,6 @@ import {
|
|
|
13
14
|
} from "@fluidframework/odsp-driver-definitions";
|
|
14
15
|
import { IWriteSummaryResponse } from "./contracts";
|
|
15
16
|
import { createCacheSnapshotKey, getOrigin, IExistingFileInfo } from "./odspUtils";
|
|
16
|
-
import { ISnapshotContents } from "./odspPublicUtils";
|
|
17
17
|
import { createOdspUrl } from "./createOdspUrl";
|
|
18
18
|
import { getApiRoot } from "./odspUrlHelper";
|
|
19
19
|
import { EpochTracker } from "./epochTracker";
|
|
@@ -81,7 +81,7 @@ export async function createNewContainerOnExistingFile(
|
|
|
81
81
|
|
|
82
82
|
if (createNewCaching) {
|
|
83
83
|
// converting summary and getting sequence number
|
|
84
|
-
const snapshot:
|
|
84
|
+
const snapshot: ISnapshot = convertCreateNewSummaryTreeToTreeAndBlobs(
|
|
85
85
|
createNewSummary,
|
|
86
86
|
summaryHandle,
|
|
87
87
|
);
|
package/src/createNewUtils.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { unreachableCase } from "@fluidframework/core-utils";
|
|
|
19
19
|
import { getGitType } from "@fluidframework/protocol-base";
|
|
20
20
|
import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
21
21
|
import { InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions";
|
|
22
|
+
import { ISnapshot } from "@fluidframework/driver-definitions";
|
|
22
23
|
import {
|
|
23
24
|
IOdspSummaryPayload,
|
|
24
25
|
IOdspSummaryTree,
|
|
@@ -26,7 +27,6 @@ import {
|
|
|
26
27
|
OdspSummaryTreeValue,
|
|
27
28
|
} from "./contracts";
|
|
28
29
|
import { getWithRetryForTokenRefresh, maxUmpPostBodySize } from "./odspUtils";
|
|
29
|
-
import { ISnapshotContents } from "./odspPublicUtils";
|
|
30
30
|
import { EpochTracker, FetchType } from "./epochTracker";
|
|
31
31
|
import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth";
|
|
32
32
|
import { runWithRetry } from "./retryUtils";
|
|
@@ -37,19 +37,20 @@ import { runWithRetry } from "./retryUtils";
|
|
|
37
37
|
export function convertCreateNewSummaryTreeToTreeAndBlobs(
|
|
38
38
|
summary: ISummaryTree,
|
|
39
39
|
treeId: string,
|
|
40
|
-
):
|
|
40
|
+
): ISnapshot {
|
|
41
41
|
const protocolSummary = summary.tree[".protocol"] as ISummaryTree;
|
|
42
42
|
const documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);
|
|
43
43
|
const sequenceNumber = documentAttributes.sequenceNumber;
|
|
44
|
-
const
|
|
45
|
-
const snapshotTree = convertCreateNewSummaryTreeToTreeAndBlobsCore(summary,
|
|
44
|
+
const blobContents = new Map<string, ArrayBuffer>();
|
|
45
|
+
const snapshotTree = convertCreateNewSummaryTreeToTreeAndBlobsCore(summary, blobContents);
|
|
46
46
|
snapshotTree.id = treeId;
|
|
47
|
-
const snapshotTreeValue:
|
|
47
|
+
const snapshotTreeValue: ISnapshot = {
|
|
48
48
|
snapshotTree,
|
|
49
|
-
|
|
49
|
+
blobContents,
|
|
50
50
|
ops: [],
|
|
51
51
|
sequenceNumber,
|
|
52
52
|
latestSequenceNumber: sequenceNumber,
|
|
53
|
+
snapshotFormatV: 1,
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
return snapshotTreeValue;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IRequest } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { DriverHeader } from "@fluidframework/driver-definitions";
|
|
7
|
-
import {
|
|
7
|
+
import { ISharingLinkKind } from "@fluidframework/odsp-driver-definitions";
|
|
8
8
|
import { buildOdspShareLinkReqParams } from "./odspUtils";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -22,7 +22,7 @@ export function createOdspCreateContainerRequest(
|
|
|
22
22
|
driveId: string,
|
|
23
23
|
filePath: string,
|
|
24
24
|
fileName: string,
|
|
25
|
-
createShareLinkType?:
|
|
25
|
+
createShareLinkType?: ISharingLinkKind,
|
|
26
26
|
): IRequest {
|
|
27
27
|
const shareLinkRequestParams = buildOdspShareLinkReqParams(createShareLinkType);
|
|
28
28
|
const createNewRequest: IRequest = {
|
package/src/epochTracker.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
LocationRedirectionError,
|
|
21
21
|
} from "@fluidframework/driver-utils";
|
|
22
22
|
import {
|
|
23
|
+
OdspErrorTypes,
|
|
23
24
|
snapshotKey,
|
|
24
25
|
ICacheEntry,
|
|
25
26
|
IEntry,
|
|
@@ -29,7 +30,6 @@ import {
|
|
|
29
30
|
IOdspErrorAugmentations,
|
|
30
31
|
IOdspResolvedUrl,
|
|
31
32
|
} from "@fluidframework/odsp-driver-definitions";
|
|
32
|
-
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
33
33
|
import {
|
|
34
34
|
fetchAndParseAsJSONHelper,
|
|
35
35
|
fetchArray,
|
|
@@ -292,7 +292,7 @@ export class EpochTracker implements IPersistedFileCache {
|
|
|
292
292
|
// location info.
|
|
293
293
|
if (
|
|
294
294
|
isFluidError(error) &&
|
|
295
|
-
error.errorType ===
|
|
295
|
+
error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError
|
|
296
296
|
) {
|
|
297
297
|
const redirectLocation = (error as IOdspErrorAugmentations).redirectLocation;
|
|
298
298
|
if (redirectLocation !== undefined) {
|
|
@@ -436,7 +436,7 @@ export class EpochTracker implements IPersistedFileCache {
|
|
|
436
436
|
fetchType: FetchTypeInternal,
|
|
437
437
|
fromCache: boolean = false,
|
|
438
438
|
) {
|
|
439
|
-
if (isFluidError(error) && error.errorType ===
|
|
439
|
+
if (isFluidError(error) && error.errorType === OdspErrorTypes.fileOverwrittenInStorage) {
|
|
440
440
|
const epochError = this.checkForEpochErrorCore(epochFromResponse);
|
|
441
441
|
if (epochError !== undefined) {
|
|
442
442
|
epochError.addTelemetryProperties({
|
|
@@ -470,7 +470,7 @@ export class EpochTracker implements IPersistedFileCache {
|
|
|
470
470
|
// Difference - client detected mismatch, instead of server detecting it.
|
|
471
471
|
return new NonRetryableError(
|
|
472
472
|
"Epoch mismatch",
|
|
473
|
-
|
|
473
|
+
OdspErrorTypes.fileOverwrittenInStorage,
|
|
474
474
|
{ driverVersion, serverEpoch: epochFromResponse, clientEpoch: this.fluidEpoch },
|
|
475
475
|
);
|
|
476
476
|
}
|
package/src/fetchSnapshot.ts
CHANGED
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
import { fromUtf8ToBase64 } from "@fluid-internal/client-utils";
|
|
14
14
|
import { assert } from "@fluidframework/core-utils";
|
|
15
15
|
import { getW3CData } from "@fluidframework/driver-base";
|
|
16
|
-
import {
|
|
16
|
+
import { ISnapshot } from "@fluidframework/driver-definitions";
|
|
17
17
|
import {
|
|
18
18
|
IOdspResolvedUrl,
|
|
19
19
|
ISnapshotOptions,
|
|
20
|
-
|
|
20
|
+
OdspErrorTypes,
|
|
21
21
|
InstrumentedStorageTokenFetcher,
|
|
22
22
|
} from "@fluidframework/odsp-driver-definitions";
|
|
23
23
|
import { ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
import { fetchIncorrectResponse, throwOdspNetworkError } from "@fluidframework/odsp-doclib-utils";
|
|
30
30
|
import {
|
|
31
31
|
IOdspSnapshot,
|
|
32
|
-
|
|
32
|
+
ISnapshotCachedEntry2,
|
|
33
33
|
IVersionedValueWithEpoch,
|
|
34
34
|
persistedCacheValueVersion,
|
|
35
35
|
} from "./contracts";
|
|
@@ -44,7 +44,6 @@ import {
|
|
|
44
44
|
measure,
|
|
45
45
|
measureP,
|
|
46
46
|
} from "./odspUtils";
|
|
47
|
-
import { ISnapshotContents } from "./odspPublicUtils";
|
|
48
47
|
import { convertOdspSnapshotToSnapshotTreeAndBlobs } from "./odspSnapshotParser";
|
|
49
48
|
import {
|
|
50
49
|
currentReadVersion,
|
|
@@ -86,7 +85,7 @@ export async function fetchSnapshot(
|
|
|
86
85
|
url: string,
|
|
87
86
|
fetchOptions: { [index: string]: any },
|
|
88
87
|
) => Promise<IOdspResponse<unknown>>,
|
|
89
|
-
): Promise<
|
|
88
|
+
): Promise<ISnapshot> {
|
|
90
89
|
const path = `/trees/${versionId}`;
|
|
91
90
|
let queryParams: ISnapshotOptions = {};
|
|
92
91
|
|
|
@@ -126,7 +125,7 @@ export async function fetchSnapshotWithRedeem(
|
|
|
126
125
|
putInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>,
|
|
127
126
|
removeEntries: () => Promise<void>,
|
|
128
127
|
enableRedeemFallback?: boolean,
|
|
129
|
-
): Promise<
|
|
128
|
+
): Promise<ISnapshot> {
|
|
130
129
|
// back-compat: This block to be removed with #8784 when we only consume/consider odsp resolvers that are >= 0.51
|
|
131
130
|
const sharingLinkToRedeem = (odspResolvedUrl as any).sharingLinkToRedeem;
|
|
132
131
|
if (sharingLinkToRedeem) {
|
|
@@ -191,8 +190,8 @@ export async function fetchSnapshotWithRedeem(
|
|
|
191
190
|
if (
|
|
192
191
|
(typeof error === "object" &&
|
|
193
192
|
error !== null &&
|
|
194
|
-
error.errorType ===
|
|
195
|
-
error.errorType ===
|
|
193
|
+
error.errorType === OdspErrorTypes.authorizationError) ||
|
|
194
|
+
error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError
|
|
196
195
|
) {
|
|
197
196
|
await removeEntries();
|
|
198
197
|
}
|
|
@@ -249,7 +248,7 @@ async function fetchLatestSnapshotCore(
|
|
|
249
248
|
) => Promise<ISnapshotRequestAndResponseOptions>,
|
|
250
249
|
putInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>,
|
|
251
250
|
enableRedeemFallback?: boolean,
|
|
252
|
-
): Promise<
|
|
251
|
+
): Promise<ISnapshot> {
|
|
253
252
|
return getWithRetryForTokenRefresh(async (tokenFetchOptions) => {
|
|
254
253
|
const storageToken = await storageTokenFetcher(tokenFetchOptions, "TreesLatest", true);
|
|
255
254
|
assert(storageToken !== null, 0x1e5 /* "Storage token should not be null" */);
|
|
@@ -328,7 +327,7 @@ async function fetchLatestSnapshotCore(
|
|
|
328
327
|
let content: IOdspSnapshot;
|
|
329
328
|
[content, parseTime] = measure(() => JSON.parse(text) as IOdspSnapshot);
|
|
330
329
|
validateBlobsAndTrees(content);
|
|
331
|
-
const snapshotContents:
|
|
330
|
+
const snapshotContents: ISnapshot =
|
|
332
331
|
convertOdspSnapshotToSnapshotTreeAndBlobs(content);
|
|
333
332
|
parsedSnapshotContents = {
|
|
334
333
|
...odspResponse,
|
|
@@ -365,7 +364,7 @@ async function fetchLatestSnapshotCore(
|
|
|
365
364
|
) {
|
|
366
365
|
throw new NonRetryableError(
|
|
367
366
|
"Returned odsp snapshot is malformed. No trees or blobs!",
|
|
368
|
-
|
|
367
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
369
368
|
propsToLog,
|
|
370
369
|
);
|
|
371
370
|
}
|
|
@@ -386,7 +385,7 @@ async function fetchLatestSnapshotCore(
|
|
|
386
385
|
default:
|
|
387
386
|
throw new NonRetryableError(
|
|
388
387
|
"Unknown snapshot content type",
|
|
389
|
-
|
|
388
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
390
389
|
propsToLog,
|
|
391
390
|
);
|
|
392
391
|
}
|
|
@@ -400,7 +399,7 @@ async function fetchLatestSnapshotCore(
|
|
|
400
399
|
(errorMessage) =>
|
|
401
400
|
new NonRetryableError(
|
|
402
401
|
`Error parsing snapshot response: ${errorMessage}`,
|
|
403
|
-
|
|
402
|
+
OdspErrorTypes.genericError,
|
|
404
403
|
propsToLog,
|
|
405
404
|
),
|
|
406
405
|
);
|
|
@@ -437,7 +436,7 @@ async function fetchLatestSnapshotCore(
|
|
|
437
436
|
fluidEpoch !== undefined,
|
|
438
437
|
0x1e6 /* "Epoch should be present in response" */,
|
|
439
438
|
);
|
|
440
|
-
const value:
|
|
439
|
+
const value: ISnapshotCachedEntry2 = {
|
|
441
440
|
...snapshot,
|
|
442
441
|
cacheEntryTime: Date.now(),
|
|
443
442
|
};
|
|
@@ -452,7 +451,7 @@ async function fetchLatestSnapshotCore(
|
|
|
452
451
|
|
|
453
452
|
event.end({
|
|
454
453
|
trees,
|
|
455
|
-
blobs: snapshot.
|
|
454
|
+
blobs: snapshot.blobContents?.size ?? 0,
|
|
456
455
|
leafNodes: numBlobs,
|
|
457
456
|
encodedBlobsSize,
|
|
458
457
|
sequenceNumber,
|
|
@@ -490,8 +489,8 @@ async function fetchLatestSnapshotCore(
|
|
|
490
489
|
if (
|
|
491
490
|
typeof error === "object" &&
|
|
492
491
|
error !== null &&
|
|
493
|
-
(error.errorType ===
|
|
494
|
-
error.errorType ===
|
|
492
|
+
(error.errorType === OdspErrorTypes.fetchFailure ||
|
|
493
|
+
error.errorType === OdspErrorTypes.fetchTimeout)
|
|
495
494
|
) {
|
|
496
495
|
error[getWithRetryForTokenRefreshRepeat] = true;
|
|
497
496
|
}
|
|
@@ -536,11 +535,11 @@ function getFormBodyAndHeaders(
|
|
|
536
535
|
return { body: postBody, headers: header };
|
|
537
536
|
}
|
|
538
537
|
|
|
539
|
-
export function evalBlobsAndTrees(snapshot:
|
|
538
|
+
export function evalBlobsAndTrees(snapshot: ISnapshot) {
|
|
540
539
|
const trees = countTreesInSnapshotTree(snapshot.snapshotTree);
|
|
541
|
-
const numBlobs = snapshot.
|
|
540
|
+
const numBlobs = snapshot.blobContents.size;
|
|
542
541
|
let encodedBlobsSize = 0;
|
|
543
|
-
for (const [_, blobContent] of snapshot.
|
|
542
|
+
for (const [_, blobContent] of snapshot.blobContents) {
|
|
544
543
|
encodedBlobsSize += blobContent.byteLength;
|
|
545
544
|
}
|
|
546
545
|
return { trees, numBlobs, encodedBlobsSize };
|
|
@@ -649,8 +648,8 @@ function isRedeemSharingLinkError(odspResolvedUrl: IOdspResolvedUrl, error: any)
|
|
|
649
648
|
odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem !== undefined &&
|
|
650
649
|
typeof error === "object" &&
|
|
651
650
|
error !== null &&
|
|
652
|
-
(error.errorType ===
|
|
653
|
-
error.errorType ===
|
|
651
|
+
(error.errorType === OdspErrorTypes.authorizationError ||
|
|
652
|
+
error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError)
|
|
654
653
|
) {
|
|
655
654
|
return true;
|
|
656
655
|
}
|
package/src/getFileLink.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { assert } from "@fluidframework/core-utils";
|
|
8
8
|
import { NonRetryableError, runWithRetry } from "@fluidframework/driver-utils";
|
|
9
|
-
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
10
9
|
import {
|
|
11
10
|
IOdspUrlParts,
|
|
11
|
+
OdspErrorTypes,
|
|
12
12
|
OdspResourceTokenFetchOptions,
|
|
13
13
|
TokenFetcher,
|
|
14
14
|
} from "@fluidframework/odsp-driver-definitions";
|
|
@@ -150,7 +150,7 @@ async function getFileLinkCore(
|
|
|
150
150
|
// This will retry once in getWithRetryForTokenRefresh
|
|
151
151
|
throw new NonRetryableError(
|
|
152
152
|
"Malformed GetSharingInformation response",
|
|
153
|
-
|
|
153
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
154
154
|
{ driverVersion },
|
|
155
155
|
);
|
|
156
156
|
}
|
|
@@ -229,7 +229,7 @@ async function getFileItemLite(
|
|
|
229
229
|
// This will retry once in getWithRetryForTokenRefresh
|
|
230
230
|
throw new NonRetryableError(
|
|
231
231
|
"Malformed getFileItemLite response",
|
|
232
|
-
|
|
232
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
233
233
|
{ driverVersion },
|
|
234
234
|
);
|
|
235
235
|
}
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
6
7
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
7
8
|
import {
|
|
8
9
|
IDocumentDeltaStorageService,
|
|
9
10
|
IDocumentService,
|
|
11
|
+
IDocumentServiceEvents,
|
|
10
12
|
IDocumentStorageService,
|
|
11
13
|
IResolvedUrl,
|
|
12
14
|
} from "@fluidframework/driver-definitions";
|
|
@@ -19,7 +21,10 @@ import { LocalOdspDocumentStorageService } from "./localOdspDocumentStorageManag
|
|
|
19
21
|
/**
|
|
20
22
|
* IDocumentService implementation that provides explicit snapshot to the document storage service.
|
|
21
23
|
*/
|
|
22
|
-
export class LocalOdspDocumentService
|
|
24
|
+
export class LocalOdspDocumentService
|
|
25
|
+
extends TypedEventEmitter<IDocumentServiceEvents>
|
|
26
|
+
implements IDocumentService
|
|
27
|
+
{
|
|
23
28
|
public policies = { storageOnly: true };
|
|
24
29
|
private storageManager?: LocalOdspDocumentStorageService;
|
|
25
30
|
|
|
@@ -27,7 +32,9 @@ export class LocalOdspDocumentService implements IDocumentService {
|
|
|
27
32
|
private readonly odspResolvedUrl: IOdspResolvedUrl,
|
|
28
33
|
private readonly logger: ITelemetryLoggerExt,
|
|
29
34
|
private readonly localSnapshot: Uint8Array | string,
|
|
30
|
-
) {
|
|
35
|
+
) {
|
|
36
|
+
super();
|
|
37
|
+
}
|
|
31
38
|
|
|
32
39
|
public get resolvedUrl(): IResolvedUrl {
|
|
33
40
|
return this.odspResolvedUrl;
|
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils";
|
|
7
7
|
import { ITelemetryLoggerExt, loggerToMonitoringContext } from "@fluidframework/telemetry-utils";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
ISnapshot,
|
|
10
|
+
ISnapshotFetchOptions,
|
|
11
|
+
ISummaryContext,
|
|
12
|
+
} from "@fluidframework/driver-definitions";
|
|
9
13
|
import { UsageError } from "@fluidframework/driver-utils";
|
|
10
14
|
import * as api from "@fluidframework/protocol-definitions";
|
|
11
15
|
import { OdspDocumentStorageServiceBase } from "../odspDocumentStorageServiceBase";
|
|
12
|
-
import { ISnapshotContents } from "../odspPublicUtils";
|
|
13
16
|
import { IOdspSnapshot } from "../contracts";
|
|
14
17
|
import { convertOdspSnapshotToSnapshotTreeAndBlobs } from "../odspSnapshotParser";
|
|
15
18
|
import { parseCompactSnapshotResponse } from "../compactSnapshotParser";
|
|
@@ -45,7 +48,7 @@ export class LocalOdspDocumentStorageService extends OdspDocumentStorageServiceB
|
|
|
45
48
|
}
|
|
46
49
|
this.calledGetVersions = true;
|
|
47
50
|
|
|
48
|
-
let snapshotContents:
|
|
51
|
+
let snapshotContents: ISnapshot;
|
|
49
52
|
|
|
50
53
|
if (typeof this.localSnapshot === "string") {
|
|
51
54
|
const content: IOdspSnapshot = JSON.parse(this.localSnapshot);
|
|
@@ -58,6 +61,10 @@ export class LocalOdspDocumentStorageService extends OdspDocumentStorageServiceB
|
|
|
58
61
|
return this.getSnapshotVersion();
|
|
59
62
|
}
|
|
60
63
|
|
|
64
|
+
public async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {
|
|
65
|
+
this.throwUsageError("getSnapshot");
|
|
66
|
+
}
|
|
67
|
+
|
|
61
68
|
private getSnapshotVersion(): api.IVersion[] {
|
|
62
69
|
return this.snapshotTreeId ? [{ id: this.snapshotTreeId, treeId: undefined! }] : [];
|
|
63
70
|
}
|
package/src/odspCache.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
ISocketStorageDiscovery,
|
|
13
13
|
getKeyForCacheEntry,
|
|
14
14
|
} from "@fluidframework/odsp-driver-definitions";
|
|
15
|
-
import {
|
|
15
|
+
import { ISnapshot } from "@fluidframework/driver-definitions";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Similar to IPersistedCache, but exposes cache interface for single file
|
|
@@ -142,7 +142,7 @@ export class NonPersistentCache implements INonPersistentCache {
|
|
|
142
142
|
/**
|
|
143
143
|
* @alpha
|
|
144
144
|
*/
|
|
145
|
-
export interface IPrefetchSnapshotContents extends
|
|
145
|
+
export interface IPrefetchSnapshotContents extends ISnapshot {
|
|
146
146
|
fluidEpoch: string;
|
|
147
147
|
prefetchStartTime: number;
|
|
148
148
|
}
|