@fluidframework/routerlicious-driver 2.0.0-dev-rc.5.0.0.265721 → 2.0.0-dev-rc.5.0.0.267932
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/routerlicious-driver.api.md +2 -2
- package/dist/contracts.d.ts +1 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/createNewUtils.d.ts +1 -1
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/createNewUtils.js +4 -4
- package/dist/createNewUtils.js.map +1 -1
- package/dist/definitions.d.ts +1 -1
- package/dist/definitions.d.ts.map +1 -1
- package/dist/definitions.js.map +1 -1
- package/dist/deltaStorageService.d.ts +1 -1
- package/dist/deltaStorageService.d.ts.map +1 -1
- package/dist/deltaStorageService.js.map +1 -1
- package/dist/documentDeltaConnection.d.ts +1 -1
- package/dist/documentDeltaConnection.d.ts.map +1 -1
- package/dist/documentDeltaConnection.js.map +1 -1
- package/dist/documentService.d.ts +8 -8
- package/dist/documentService.d.ts.map +1 -1
- package/dist/documentService.js.map +1 -1
- package/dist/documentServiceFactory.d.ts +1 -1
- package/dist/documentServiceFactory.d.ts.map +1 -1
- package/dist/documentServiceFactory.js.map +1 -1
- package/dist/documentStorageService.d.ts +1 -2
- package/dist/documentStorageService.d.ts.map +1 -1
- package/dist/documentStorageService.js.map +1 -1
- package/dist/gitManager.d.ts +6 -6
- package/dist/gitManager.d.ts.map +1 -1
- package/dist/gitManager.js.map +1 -1
- package/dist/historian.d.ts +6 -6
- package/dist/historian.d.ts.map +1 -1
- package/dist/historian.js.map +1 -1
- package/dist/nullBlobStorageService.d.ts +7 -7
- package/dist/nullBlobStorageService.d.ts.map +1 -1
- package/dist/nullBlobStorageService.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/r11sSnapshotParser.js.map +1 -1
- package/dist/retriableGitManager.d.ts +6 -6
- package/dist/retriableGitManager.d.ts.map +1 -1
- package/dist/retriableGitManager.js.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.d.ts +2 -2
- package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/dist/storageContracts.d.ts +13 -13
- package/dist/storageContracts.d.ts.map +1 -1
- package/dist/storageContracts.js.map +1 -1
- package/dist/summaryTreeUploadManager.d.ts +2 -1
- package/dist/summaryTreeUploadManager.d.ts.map +1 -1
- package/dist/summaryTreeUploadManager.js +7 -7
- package/dist/summaryTreeUploadManager.js.map +1 -1
- package/dist/tokens.d.ts +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js.map +1 -1
- package/dist/treeUtils.d.ts +2 -1
- package/dist/treeUtils.d.ts.map +1 -1
- package/dist/treeUtils.js +5 -5
- package/dist/treeUtils.js.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.d.ts +2 -2
- package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
- package/lib/contracts.d.ts +1 -1
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/createNewUtils.d.ts +1 -1
- package/lib/createNewUtils.d.ts.map +1 -1
- package/lib/createNewUtils.js +1 -1
- package/lib/createNewUtils.js.map +1 -1
- package/lib/definitions.d.ts +1 -1
- package/lib/definitions.d.ts.map +1 -1
- package/lib/definitions.js.map +1 -1
- package/lib/deltaStorageService.d.ts +1 -1
- package/lib/deltaStorageService.d.ts.map +1 -1
- package/lib/deltaStorageService.js.map +1 -1
- package/lib/documentDeltaConnection.d.ts +1 -1
- package/lib/documentDeltaConnection.d.ts.map +1 -1
- package/lib/documentDeltaConnection.js.map +1 -1
- package/lib/documentService.d.ts +8 -8
- package/lib/documentService.d.ts.map +1 -1
- package/lib/documentService.js.map +1 -1
- package/lib/documentServiceFactory.d.ts +1 -1
- package/lib/documentServiceFactory.d.ts.map +1 -1
- package/lib/documentServiceFactory.js.map +1 -1
- package/lib/documentStorageService.d.ts +1 -2
- package/lib/documentStorageService.d.ts.map +1 -1
- package/lib/documentStorageService.js.map +1 -1
- package/lib/gitManager.d.ts +6 -6
- package/lib/gitManager.d.ts.map +1 -1
- package/lib/gitManager.js.map +1 -1
- package/lib/historian.d.ts +6 -6
- package/lib/historian.d.ts.map +1 -1
- package/lib/historian.js.map +1 -1
- package/lib/nullBlobStorageService.d.ts +7 -7
- package/lib/nullBlobStorageService.d.ts.map +1 -1
- package/lib/nullBlobStorageService.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/r11sSnapshotParser.js.map +1 -1
- package/lib/retriableGitManager.d.ts +6 -6
- package/lib/retriableGitManager.d.ts.map +1 -1
- package/lib/retriableGitManager.js.map +1 -1
- package/lib/shreddedSummaryDocumentStorageService.d.ts +2 -2
- package/lib/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/lib/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/lib/storageContracts.d.ts +13 -13
- package/lib/storageContracts.d.ts.map +1 -1
- package/lib/storageContracts.js.map +1 -1
- package/lib/summaryTreeUploadManager.d.ts +2 -1
- package/lib/summaryTreeUploadManager.d.ts.map +1 -1
- package/lib/summaryTreeUploadManager.js +1 -1
- package/lib/summaryTreeUploadManager.js.map +1 -1
- package/lib/tokens.d.ts +1 -1
- package/lib/tokens.d.ts.map +1 -1
- package/lib/tokens.js.map +1 -1
- package/lib/treeUtils.d.ts +2 -1
- package/lib/treeUtils.d.ts.map +1 -1
- package/lib/treeUtils.js +1 -1
- package/lib/treeUtils.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/wholeSummaryDocumentStorageService.d.ts +2 -2
- package/lib/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.js.map +1 -1
- package/package.json +11 -13
- package/src/contracts.ts +1 -1
- package/src/createNewUtils.ts +1 -1
- package/src/definitions.ts +1 -1
- package/src/deltaStorageService.ts +1 -1
- package/src/documentDeltaConnection.ts +2 -1
- package/src/documentService.ts +18 -10
- package/src/documentServiceFactory.ts +1 -1
- package/src/documentStorageService.ts +2 -1
- package/src/gitManager.ts +14 -9
- package/src/historian.ts +20 -13
- package/src/nullBlobStorageService.ts +9 -6
- package/src/packageVersion.ts +1 -1
- package/src/r11sSnapshotParser.ts +1 -1
- package/src/retriableGitManager.ts +12 -6
- package/src/shreddedSummaryDocumentStorageService.ts +4 -7
- package/src/storageContracts.ts +20 -13
- package/src/summaryTreeUploadManager.ts +4 -8
- package/src/tokens.ts +1 -1
- package/src/treeUtils.ts +2 -6
- package/src/wholeSummaryDocumentStorageService.ts +2 -5
package/src/contracts.ts
CHANGED
package/src/createNewUtils.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { Uint8ArrayToString } from "@fluid-internal/client-utils";
|
|
7
|
-
import { ISummaryTree, SummaryType } from "@fluidframework/
|
|
7
|
+
import { ISummaryTree, SummaryType } from "@fluidframework/driver-definitions";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Utility api to convert ISummaryTree to a summary tree where blob contents are only utf8 strings.
|
package/src/definitions.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { getW3CData, validateMessages } from "@fluidframework/driver-base/internal";
|
|
8
|
+
import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions";
|
|
8
9
|
import {
|
|
9
10
|
IDeltaStorageService,
|
|
10
11
|
IDeltasFetchResult,
|
|
@@ -17,7 +18,6 @@ import {
|
|
|
17
18
|
requestOps,
|
|
18
19
|
streamObserver,
|
|
19
20
|
} from "@fluidframework/driver-utils/internal";
|
|
20
|
-
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
21
21
|
import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils/internal";
|
|
22
22
|
|
|
23
23
|
import { DocumentStorageService } from "./documentStorageService.js";
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { DocumentDeltaConnection } from "@fluidframework/driver-base/internal";
|
|
7
|
+
import { IClient } from "@fluidframework/driver-definitions";
|
|
7
8
|
import {
|
|
8
9
|
IDocumentDeltaConnection,
|
|
9
10
|
IAnyDriverError,
|
|
11
|
+
IConnect,
|
|
10
12
|
} from "@fluidframework/driver-definitions/internal";
|
|
11
|
-
import { IClient, IConnect } from "@fluidframework/protocol-definitions";
|
|
12
13
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
13
14
|
import type { io as SocketIOClientStatic } from "socket.io-client";
|
|
14
15
|
|
package/src/documentService.ts
CHANGED
|
@@ -5,13 +5,21 @@
|
|
|
5
5
|
|
|
6
6
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
7
7
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
|
-
import
|
|
8
|
+
import { IClient } from "@fluidframework/driver-definitions";
|
|
9
|
+
import {
|
|
10
|
+
IDocumentServiceEvents,
|
|
11
|
+
IDocumentDeltaConnection,
|
|
12
|
+
IDocumentDeltaStorageService,
|
|
13
|
+
IDocumentService,
|
|
14
|
+
IDocumentStorageService,
|
|
15
|
+
IDocumentStorageServicePolicies,
|
|
16
|
+
IResolvedUrl,
|
|
17
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
9
18
|
import {
|
|
10
19
|
NetworkErrorBasic,
|
|
11
20
|
RateLimiter,
|
|
12
21
|
canRetryOnError,
|
|
13
22
|
} from "@fluidframework/driver-utils/internal";
|
|
14
|
-
import { IClient } from "@fluidframework/protocol-definitions";
|
|
15
23
|
import {
|
|
16
24
|
ITelemetryLoggerExt,
|
|
17
25
|
PerformanceEvent,
|
|
@@ -52,9 +60,9 @@ const RediscoverAfterTimeSinceDiscoveryMs = 5 * 60000; // 5 minute
|
|
|
52
60
|
* clients.
|
|
53
61
|
*/
|
|
54
62
|
export class DocumentService
|
|
55
|
-
extends TypedEventEmitter<
|
|
63
|
+
extends TypedEventEmitter<IDocumentServiceEvents>
|
|
56
64
|
// eslint-disable-next-line import/namespace
|
|
57
|
-
implements
|
|
65
|
+
implements IDocumentService
|
|
58
66
|
{
|
|
59
67
|
private lastDiscoveredAt: number = Date.now();
|
|
60
68
|
private discoverP: Promise<void> | undefined;
|
|
@@ -67,7 +75,7 @@ export class DocumentService
|
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
constructor(
|
|
70
|
-
private _resolvedUrl:
|
|
78
|
+
private _resolvedUrl: IResolvedUrl,
|
|
71
79
|
protected ordererUrl: string,
|
|
72
80
|
private deltaStorageUrl: string,
|
|
73
81
|
private deltaStreamUrl: string,
|
|
@@ -77,12 +85,12 @@ export class DocumentService
|
|
|
77
85
|
protected tenantId: string,
|
|
78
86
|
protected documentId: string,
|
|
79
87
|
protected ordererRestWrapper: RouterliciousOrdererRestWrapper,
|
|
80
|
-
private readonly documentStorageServicePolicies:
|
|
88
|
+
private readonly documentStorageServicePolicies: IDocumentStorageServicePolicies,
|
|
81
89
|
private readonly driverPolicies: IRouterliciousDriverPolicies,
|
|
82
90
|
private readonly blobCache: ICache<ArrayBufferLike>,
|
|
83
91
|
private readonly wholeSnapshotTreeCache: ICache<INormalizedWholeSnapshot>,
|
|
84
92
|
private readonly shreddedSummaryTreeCache: ICache<ISnapshotTreeVersion>,
|
|
85
|
-
private readonly discoverFluidResolvedUrl: () => Promise<
|
|
93
|
+
private readonly discoverFluidResolvedUrl: () => Promise<IResolvedUrl>,
|
|
86
94
|
private storageRestWrapper: RouterliciousStorageRestWrapper,
|
|
87
95
|
private readonly storageTokenFetcher: TokenFetcher,
|
|
88
96
|
private readonly ordererTokenFetcher: TokenFetcher,
|
|
@@ -99,7 +107,7 @@ export class DocumentService
|
|
|
99
107
|
*
|
|
100
108
|
* @returns returns the document storage service for routerlicious driver.
|
|
101
109
|
*/
|
|
102
|
-
public async connectToStorage(): Promise<
|
|
110
|
+
public async connectToStorage(): Promise<IDocumentStorageService> {
|
|
103
111
|
if (this.documentStorageService !== undefined) {
|
|
104
112
|
return this.documentStorageService;
|
|
105
113
|
}
|
|
@@ -162,7 +170,7 @@ export class DocumentService
|
|
|
162
170
|
*
|
|
163
171
|
* @returns returns the document delta storage service for routerlicious driver.
|
|
164
172
|
*/
|
|
165
|
-
public async connectToDeltaStorage(): Promise<
|
|
173
|
+
public async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {
|
|
166
174
|
await this.connectToStorage();
|
|
167
175
|
assert(!!this.documentStorageService, 0x0b1 /* "Storage service not initialized" */);
|
|
168
176
|
|
|
@@ -205,7 +213,7 @@ export class DocumentService
|
|
|
205
213
|
*
|
|
206
214
|
* @returns returns the document delta stream service for routerlicious driver.
|
|
207
215
|
*/
|
|
208
|
-
public async connectToDeltaStream(client: IClient): Promise<
|
|
216
|
+
public async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {
|
|
209
217
|
const connect = async (refreshToken?: boolean) => {
|
|
210
218
|
let ordererToken = await this.ordererRestWrapper.getToken();
|
|
211
219
|
if (this.shouldUpdateDiscoveredSessionInfo()) {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import { getW3CData } from "@fluidframework/driver-base/internal";
|
|
9
|
+
import { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
9
10
|
import {
|
|
10
11
|
FiveDaysMs,
|
|
11
12
|
IDocumentService,
|
|
@@ -20,7 +21,6 @@ import {
|
|
|
20
21
|
getQuorumValuesFromProtocolSummary,
|
|
21
22
|
isCombinedAppAndProtocolSummary,
|
|
22
23
|
} from "@fluidframework/driver-utils/internal";
|
|
23
|
-
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
24
24
|
import {
|
|
25
25
|
ISession,
|
|
26
26
|
convertSummaryTreeToWholeSummaryTree,
|
|
@@ -7,12 +7,13 @@ import {
|
|
|
7
7
|
IDocumentStorageService,
|
|
8
8
|
IDocumentStorageServicePolicies,
|
|
9
9
|
LoaderCachingPolicy,
|
|
10
|
+
ISnapshotTree,
|
|
11
|
+
IVersion,
|
|
10
12
|
} from "@fluidframework/driver-definitions/internal";
|
|
11
13
|
import {
|
|
12
14
|
DocumentStorageServiceProxy,
|
|
13
15
|
PrefetchDocumentStorageService,
|
|
14
16
|
} from "@fluidframework/driver-utils/internal";
|
|
15
|
-
import { ISnapshotTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
16
17
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
17
18
|
|
|
18
19
|
import { ICache } from "./cache.js";
|
package/src/gitManager.ts
CHANGED
|
@@ -3,7 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import type {
|
|
7
|
+
IGitBlob,
|
|
8
|
+
IGitCommitDetails,
|
|
9
|
+
IGitCreateBlobParams,
|
|
10
|
+
IGitCreateBlobResponse,
|
|
11
|
+
IGitCreateTreeParams,
|
|
12
|
+
IGitTree,
|
|
13
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
7
14
|
import {
|
|
8
15
|
IWholeSummaryPayload,
|
|
9
16
|
IWriteSummaryResponse,
|
|
@@ -22,35 +29,33 @@ export class GitManager implements IGitManager {
|
|
|
22
29
|
public async getCommits(
|
|
23
30
|
sha: string,
|
|
24
31
|
count: number,
|
|
25
|
-
): Promise<IR11sResponse<
|
|
32
|
+
): Promise<IR11sResponse<IGitCommitDetails[]>> {
|
|
26
33
|
return this.historian.getCommits(sha, count);
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
/**
|
|
30
37
|
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
31
38
|
*/
|
|
32
|
-
public async getTree(root: string, recursive = true): Promise<IR11sResponse<
|
|
39
|
+
public async getTree(root: string, recursive = true): Promise<IR11sResponse<IGitTree>> {
|
|
33
40
|
return this.historian.getTree(root, recursive);
|
|
34
41
|
}
|
|
35
42
|
|
|
36
|
-
public async getBlob(sha: string): Promise<IR11sResponse<
|
|
43
|
+
public async getBlob(sha: string): Promise<IR11sResponse<IGitBlob>> {
|
|
37
44
|
return this.historian.getBlob(sha);
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
public async createBlob(
|
|
41
48
|
content: string,
|
|
42
49
|
encoding: "utf-8" | "base64",
|
|
43
|
-
): Promise<IR11sResponse<
|
|
44
|
-
const blob:
|
|
50
|
+
): Promise<IR11sResponse<IGitCreateBlobResponse>> {
|
|
51
|
+
const blob: IGitCreateBlobParams = {
|
|
45
52
|
content,
|
|
46
53
|
encoding,
|
|
47
54
|
};
|
|
48
55
|
return this.historian.createBlob(blob);
|
|
49
56
|
}
|
|
50
57
|
|
|
51
|
-
public async createGitTree(
|
|
52
|
-
params: resources.ICreateTreeParams,
|
|
53
|
-
): Promise<IR11sResponse<resources.ITree>> {
|
|
58
|
+
public async createGitTree(params: IGitCreateTreeParams): Promise<IR11sResponse<IGitTree>> {
|
|
54
59
|
const treeP = this.historian.createTree(params);
|
|
55
60
|
return treeP;
|
|
56
61
|
}
|
package/src/historian.ts
CHANGED
|
@@ -4,7 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { fromUtf8ToBase64 } from "@fluid-internal/client-utils";
|
|
7
|
-
import
|
|
7
|
+
import type {
|
|
8
|
+
IGitBlob,
|
|
9
|
+
IGitCommitDetails,
|
|
10
|
+
IGitCreateBlobParams,
|
|
11
|
+
IGitCreateBlobResponse,
|
|
12
|
+
IGitCreateTreeParams,
|
|
13
|
+
IGitTree,
|
|
14
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
8
15
|
import {
|
|
9
16
|
IWholeSummaryPayload,
|
|
10
17
|
IWriteSummaryResponse,
|
|
@@ -43,17 +50,17 @@ export class Historian implements IHistorian {
|
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
public async getBlob(sha: string): Promise<IR11sResponse<
|
|
47
|
-
return this.restWrapper.get<
|
|
53
|
+
public async getBlob(sha: string): Promise<IR11sResponse<IGitBlob>> {
|
|
54
|
+
return this.restWrapper.get<IGitBlob>(
|
|
48
55
|
`/git/blobs/${encodeURIComponent(sha)}`,
|
|
49
56
|
this.getQueryString(),
|
|
50
57
|
);
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
public async createBlob(
|
|
54
|
-
blob:
|
|
55
|
-
): Promise<IR11sResponse<
|
|
56
|
-
return this.restWrapper.post<
|
|
61
|
+
blob: IGitCreateBlobParams,
|
|
62
|
+
): Promise<IR11sResponse<IGitCreateBlobResponse>> {
|
|
63
|
+
return this.restWrapper.post<IGitCreateBlobResponse>(
|
|
57
64
|
`/git/blobs`,
|
|
58
65
|
blob,
|
|
59
66
|
this.getQueryString(),
|
|
@@ -63,9 +70,9 @@ export class Historian implements IHistorian {
|
|
|
63
70
|
public async getCommits(
|
|
64
71
|
sha: string,
|
|
65
72
|
count: number,
|
|
66
|
-
): Promise<IR11sResponse<
|
|
73
|
+
): Promise<IR11sResponse<IGitCommitDetails[]>> {
|
|
67
74
|
return this.restWrapper
|
|
68
|
-
.get<
|
|
75
|
+
.get<IGitCommitDetails[]>(`/commits`, this.getQueryString({ count, sha }))
|
|
69
76
|
.catch(async (error) =>
|
|
70
77
|
error.statusCode === 400 || error.statusCode === 404
|
|
71
78
|
? {
|
|
@@ -74,16 +81,16 @@ export class Historian implements IHistorian {
|
|
|
74
81
|
propsToLog: {},
|
|
75
82
|
requestUrl: "",
|
|
76
83
|
}
|
|
77
|
-
: Promise.reject<IR11sResponse<
|
|
84
|
+
: Promise.reject<IR11sResponse<IGitCommitDetails[]>>(error),
|
|
78
85
|
);
|
|
79
86
|
}
|
|
80
87
|
|
|
81
|
-
public async createTree(tree:
|
|
82
|
-
return this.restWrapper.post<
|
|
88
|
+
public async createTree(tree: IGitCreateTreeParams): Promise<IR11sResponse<IGitTree>> {
|
|
89
|
+
return this.restWrapper.post<IGitTree>(`/git/trees`, tree, this.getQueryString());
|
|
83
90
|
}
|
|
84
91
|
|
|
85
|
-
public async getTree(sha: string, recursive: boolean): Promise<IR11sResponse<
|
|
86
|
-
return this.restWrapper.get<
|
|
92
|
+
public async getTree(sha: string, recursive: boolean): Promise<IR11sResponse<IGitTree>> {
|
|
93
|
+
return this.restWrapper.get<IGitTree>(
|
|
87
94
|
`/git/trees/${encodeURIComponent(sha)}`,
|
|
88
95
|
this.getQueryString({ recursive: recursive ? 1 : 0 }),
|
|
89
96
|
);
|
|
@@ -3,37 +3,40 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ISummaryTree, ISummaryHandle } from "@fluidframework/driver-definitions";
|
|
6
7
|
import {
|
|
7
8
|
IDocumentStorageService,
|
|
8
9
|
ISummaryContext,
|
|
10
|
+
IVersion,
|
|
11
|
+
ISnapshotTree,
|
|
12
|
+
ICreateBlobResponse,
|
|
9
13
|
} from "@fluidframework/driver-definitions/internal";
|
|
10
|
-
import * as api from "@fluidframework/protocol-definitions";
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* Document access to underlying storage. It is default implementation of a storage service.
|
|
14
17
|
* Does not read/write anything.
|
|
15
18
|
*/
|
|
16
19
|
export class NullBlobStorageService implements IDocumentStorageService {
|
|
17
|
-
public async getSnapshotTree(version?:
|
|
20
|
+
public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {
|
|
18
21
|
return version ? Promise.reject(new Error("Invalid operation")) : null;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
|
-
public async getVersions(versionId: string | null, count: number): Promise<
|
|
24
|
+
public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {
|
|
22
25
|
return [];
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
public async uploadSummaryWithContext(
|
|
26
|
-
summary:
|
|
29
|
+
summary: ISummaryTree,
|
|
27
30
|
context: ISummaryContext,
|
|
28
31
|
): Promise<string> {
|
|
29
32
|
throw new Error("Invalid operation");
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
public async downloadSummary(handle:
|
|
35
|
+
public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {
|
|
33
36
|
throw new Error("Invalid operation");
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
public async createBlob(file: ArrayBufferLike): Promise<
|
|
39
|
+
public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {
|
|
37
40
|
throw new Error("Null blob storage can not create blob");
|
|
38
41
|
}
|
|
39
42
|
public async readBlob(blobId: string): Promise<ArrayBufferLike> {
|
package/src/packageVersion.ts
CHANGED
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import type {
|
|
7
|
+
IGitCommitDetails,
|
|
8
|
+
IGitBlob,
|
|
9
|
+
IGitCreateBlobResponse,
|
|
10
|
+
IGitCreateTreeParams,
|
|
11
|
+
IGitTree,
|
|
12
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
6
13
|
import { runWithRetry } from "@fluidframework/driver-utils/internal";
|
|
7
|
-
import type * as git from "@fluidframework/gitresources";
|
|
8
14
|
import {
|
|
9
15
|
IWholeSummaryPayload,
|
|
10
16
|
IWriteSummaryResponse,
|
|
@@ -24,21 +30,21 @@ export class RetriableGitManager implements IGitManager {
|
|
|
24
30
|
public async getCommits(
|
|
25
31
|
sha: string,
|
|
26
32
|
count: number,
|
|
27
|
-
): Promise<IR11sResponse<
|
|
33
|
+
): Promise<IR11sResponse<IGitCommitDetails[]>> {
|
|
28
34
|
return this.runWithRetry(
|
|
29
35
|
async () => this.internalGitManager.getCommits(sha, count),
|
|
30
36
|
"gitManager_getCommits",
|
|
31
37
|
);
|
|
32
38
|
}
|
|
33
39
|
|
|
34
|
-
public async getTree(root: string, recursive: boolean): Promise<IR11sResponse<
|
|
40
|
+
public async getTree(root: string, recursive: boolean): Promise<IR11sResponse<IGitTree>> {
|
|
35
41
|
return this.runWithRetry(
|
|
36
42
|
async () => this.internalGitManager.getTree(root, recursive),
|
|
37
43
|
"gitManager_getTree",
|
|
38
44
|
);
|
|
39
45
|
}
|
|
40
46
|
|
|
41
|
-
public async getBlob(sha: string): Promise<IR11sResponse<
|
|
47
|
+
public async getBlob(sha: string): Promise<IR11sResponse<IGitBlob>> {
|
|
42
48
|
return this.runWithRetry(
|
|
43
49
|
async () => this.internalGitManager.getBlob(sha),
|
|
44
50
|
"gitManager_getBlob",
|
|
@@ -48,14 +54,14 @@ export class RetriableGitManager implements IGitManager {
|
|
|
48
54
|
public async createBlob(
|
|
49
55
|
content: string,
|
|
50
56
|
encoding: string,
|
|
51
|
-
): Promise<IR11sResponse<
|
|
57
|
+
): Promise<IR11sResponse<IGitCreateBlobResponse>> {
|
|
52
58
|
return this.runWithRetry(
|
|
53
59
|
async () => this.internalGitManager.createBlob(content, encoding),
|
|
54
60
|
"gitManager_createBlob",
|
|
55
61
|
);
|
|
56
62
|
}
|
|
57
63
|
|
|
58
|
-
public async createGitTree(params:
|
|
64
|
+
public async createGitTree(params: IGitCreateTreeParams): Promise<IR11sResponse<IGitTree>> {
|
|
59
65
|
return this.runWithRetry(
|
|
60
66
|
async () => this.internalGitManager.createGitTree(params),
|
|
61
67
|
"gitManager_createGitTree",
|
|
@@ -4,19 +4,16 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { Uint8ArrayToString, stringToBuffer } from "@fluid-internal/client-utils";
|
|
7
|
+
import { ISummaryHandle, ISummaryTree } from "@fluidframework/driver-definitions";
|
|
7
8
|
import {
|
|
8
9
|
IDocumentStorageService,
|
|
9
10
|
IDocumentStorageServicePolicies,
|
|
10
11
|
ISummaryContext,
|
|
11
|
-
} from "@fluidframework/driver-definitions/internal";
|
|
12
|
-
import { buildGitTreeHierarchy } from "@fluidframework/protocol-base";
|
|
13
|
-
import {
|
|
14
12
|
ICreateBlobResponse,
|
|
15
13
|
ISnapshotTreeEx,
|
|
16
|
-
ISummaryHandle,
|
|
17
|
-
ISummaryTree,
|
|
18
14
|
IVersion,
|
|
19
|
-
} from "@fluidframework/
|
|
15
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
16
|
+
import { buildGitTreeHierarchy } from "@fluidframework/protocol-base";
|
|
20
17
|
import {
|
|
21
18
|
ITelemetryLoggerExt,
|
|
22
19
|
MonitoringContext,
|
|
@@ -125,7 +122,7 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
|
|
|
125
122
|
},
|
|
126
123
|
async (event) => {
|
|
127
124
|
const manager = await this.getStorageManager();
|
|
128
|
-
const response = (await manager.getTree(requestVersion
|
|
125
|
+
const response = (await manager.getTree(requestVersion.treeId)).content;
|
|
129
126
|
event.end({
|
|
130
127
|
size: response.tree.length,
|
|
131
128
|
});
|
package/src/storageContracts.ts
CHANGED
|
@@ -3,8 +3,15 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
7
|
+
import type {
|
|
8
|
+
IGitBlob,
|
|
9
|
+
IGitCommitDetails,
|
|
10
|
+
IGitCreateBlobParams,
|
|
11
|
+
IGitCreateBlobResponse,
|
|
12
|
+
IGitCreateTreeParams,
|
|
13
|
+
IGitTree,
|
|
14
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
8
15
|
import {
|
|
9
16
|
IWholeSummaryPayload,
|
|
10
17
|
IWholeSummaryPayloadType,
|
|
@@ -18,11 +25,11 @@ import { IR11sResponse } from "./restWrapper.js";
|
|
|
18
25
|
* Interface to a generic Git provider
|
|
19
26
|
*/
|
|
20
27
|
export interface IHistorian {
|
|
21
|
-
getBlob(sha: string): Promise<IR11sResponse<
|
|
22
|
-
createBlob(blob:
|
|
23
|
-
getCommits(sha: string, count: number): Promise<IR11sResponse<
|
|
24
|
-
createTree(tree:
|
|
25
|
-
getTree(sha: string, recursive: boolean): Promise<IR11sResponse<
|
|
28
|
+
getBlob(sha: string): Promise<IR11sResponse<IGitBlob>>;
|
|
29
|
+
createBlob(blob: IGitCreateBlobParams): Promise<IR11sResponse<IGitCreateBlobResponse>>;
|
|
30
|
+
getCommits(sha: string, count: number): Promise<IR11sResponse<IGitCommitDetails[]>>;
|
|
31
|
+
createTree(tree: IGitCreateTreeParams): Promise<IR11sResponse<IGitTree>>;
|
|
32
|
+
getTree(sha: string, recursive: boolean): Promise<IR11sResponse<IGitTree>>;
|
|
26
33
|
createSummary(
|
|
27
34
|
summary: IWholeSummaryPayload,
|
|
28
35
|
initial?: boolean,
|
|
@@ -31,11 +38,11 @@ export interface IHistorian {
|
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
export interface IGitManager {
|
|
34
|
-
getCommits(sha: string, count: number): Promise<IR11sResponse<
|
|
35
|
-
getTree(root: string, recursive: boolean): Promise<IR11sResponse<
|
|
36
|
-
getBlob(sha: string): Promise<IR11sResponse<
|
|
37
|
-
createBlob(content: string, encoding: string): Promise<IR11sResponse<
|
|
38
|
-
createGitTree(params:
|
|
41
|
+
getCommits(sha: string, count: number): Promise<IR11sResponse<IGitCommitDetails[]>>;
|
|
42
|
+
getTree(root: string, recursive: boolean): Promise<IR11sResponse<IGitTree>>;
|
|
43
|
+
getBlob(sha: string): Promise<IR11sResponse<IGitBlob>>;
|
|
44
|
+
createBlob(content: string, encoding: string): Promise<IR11sResponse<IGitCreateBlobResponse>>;
|
|
45
|
+
createGitTree(params: IGitCreateTreeParams): Promise<IR11sResponse<IGitTree>>;
|
|
39
46
|
createSummary(
|
|
40
47
|
summary: IWholeSummaryPayload,
|
|
41
48
|
initial?: boolean,
|
|
@@ -56,7 +63,7 @@ export interface ISummaryUploadManager {
|
|
|
56
63
|
* @returns Id of created tree as a string.
|
|
57
64
|
*/
|
|
58
65
|
writeSummaryTree(
|
|
59
|
-
summaryTree:
|
|
66
|
+
summaryTree: ISummaryTree,
|
|
60
67
|
parentHandle: string,
|
|
61
68
|
summaryType: IWholeSummaryPayloadType,
|
|
62
69
|
sequenceNumber?: number,
|
|
@@ -5,14 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
import { IsoBuffer, Uint8ArrayToString, gitHashFile } from "@fluid-internal/client-utils";
|
|
7
7
|
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
8
|
-
import {
|
|
8
|
+
import { ISummaryTree, SummaryObject, SummaryType } from "@fluidframework/driver-definitions";
|
|
9
|
+
import type { IGitCreateTreeEntry } from "@fluidframework/driver-definitions/internal";
|
|
10
|
+
import { ISnapshotTreeEx } from "@fluidframework/driver-definitions/internal";
|
|
9
11
|
import { getGitMode, getGitType } from "@fluidframework/protocol-base";
|
|
10
|
-
import {
|
|
11
|
-
ISnapshotTreeEx,
|
|
12
|
-
ISummaryTree,
|
|
13
|
-
SummaryObject,
|
|
14
|
-
SummaryType,
|
|
15
|
-
} from "@fluidframework/protocol-definitions";
|
|
16
12
|
import { IWholeSummaryPayloadType } from "@fluidframework/server-services-client";
|
|
17
13
|
|
|
18
14
|
import { IGitManager, ISummaryUploadManager } from "./storageContracts.js";
|
|
@@ -48,7 +44,7 @@ export class SummaryTreeUploadManager implements ISummaryUploadManager {
|
|
|
48
44
|
Object.keys(summaryTree.tree).map(async (key) => {
|
|
49
45
|
const entry = summaryTree.tree[key];
|
|
50
46
|
const pathHandle = await this.writeSummaryTreeObject(entry, previousFullSnapshot);
|
|
51
|
-
const treeEntry:
|
|
47
|
+
const treeEntry: IGitCreateTreeEntry = {
|
|
52
48
|
mode: getGitMode(entry),
|
|
53
49
|
path: encodeURIComponent(key),
|
|
54
50
|
sha: pathHandle,
|
package/src/tokens.ts
CHANGED
package/src/treeUtils.ts
CHANGED
|
@@ -5,12 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
import { IsoBuffer } from "@fluid-internal/client-utils";
|
|
7
7
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
ISummaryTree,
|
|
11
|
-
SummaryObject,
|
|
12
|
-
SummaryType,
|
|
13
|
-
} from "@fluidframework/protocol-definitions";
|
|
8
|
+
import { ISummaryTree, SummaryObject, SummaryType } from "@fluidframework/driver-definitions";
|
|
9
|
+
import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
14
10
|
|
|
15
11
|
import { INormalizedWholeSnapshot } from "./contracts.js";
|
|
16
12
|
|
|
@@ -6,18 +6,15 @@
|
|
|
6
6
|
import { Uint8ArrayToString, performance, stringToBuffer } from "@fluid-internal/client-utils";
|
|
7
7
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import { getW3CData, promiseRaceWithWinner } from "@fluidframework/driver-base/internal";
|
|
9
|
+
import { ISummaryHandle, ISummaryTree } from "@fluidframework/driver-definitions";
|
|
9
10
|
import {
|
|
10
11
|
IDocumentStorageService,
|
|
11
12
|
IDocumentStorageServicePolicies,
|
|
12
13
|
ISummaryContext,
|
|
13
|
-
} from "@fluidframework/driver-definitions/internal";
|
|
14
|
-
import {
|
|
15
14
|
ICreateBlobResponse,
|
|
16
15
|
ISnapshotTree,
|
|
17
|
-
ISummaryHandle,
|
|
18
|
-
ISummaryTree,
|
|
19
16
|
IVersion,
|
|
20
|
-
} from "@fluidframework/
|
|
17
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
21
18
|
import {
|
|
22
19
|
ITelemetryLoggerExt,
|
|
23
20
|
MonitoringContext,
|