@fluidframework/local-driver 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.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.
Files changed (36) hide show
  1. package/.eslintrc.js +19 -22
  2. package/.mocharc.js +2 -2
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/auth.js +2 -2
  5. package/dist/auth.js.map +1 -1
  6. package/dist/localDeltaStorageService.d.ts.map +1 -1
  7. package/dist/localDeltaStorageService.js.map +1 -1
  8. package/dist/localDocumentDeltaConnection.d.ts.map +1 -1
  9. package/dist/localDocumentDeltaConnection.js.map +1 -1
  10. package/dist/localDocumentService.d.ts.map +1 -1
  11. package/dist/localDocumentService.js.map +1 -1
  12. package/dist/localDocumentServiceFactory.d.ts.map +1 -1
  13. package/dist/localDocumentServiceFactory.js +3 -2
  14. package/dist/localDocumentServiceFactory.js.map +1 -1
  15. package/dist/localDocumentStorageService.d.ts.map +1 -1
  16. package/dist/localDocumentStorageService.js +4 -3
  17. package/dist/localDocumentStorageService.js.map +1 -1
  18. package/dist/localResolver.d.ts.map +1 -1
  19. package/dist/localResolver.js.map +1 -1
  20. package/dist/localSessionStorageDb.d.ts.map +1 -1
  21. package/dist/localSessionStorageDb.js.map +1 -1
  22. package/dist/packageVersion.d.ts +1 -1
  23. package/dist/packageVersion.js +1 -1
  24. package/dist/packageVersion.js.map +1 -1
  25. package/package.json +37 -36
  26. package/prettier.config.cjs +1 -1
  27. package/src/auth.ts +35 -29
  28. package/src/localDeltaStorageService.ts +26 -29
  29. package/src/localDocumentDeltaConnection.ts +89 -85
  30. package/src/localDocumentService.ts +106 -98
  31. package/src/localDocumentServiceFactory.ts +126 -117
  32. package/src/localDocumentStorageService.ts +17 -10
  33. package/src/localResolver.ts +55 -55
  34. package/src/localSessionStorageDb.ts +267 -261
  35. package/src/packageVersion.ts +1 -1
  36. package/tsconfig.json +9 -13
@@ -4,103 +4,110 @@
4
4
  */
5
5
 
6
6
  import {
7
- IDocumentDeltaConnection,
8
- IDocumentDeltaStorageService,
9
- IDocumentService,
10
- IDocumentServicePolicies,
11
- IDocumentStorageService,
12
- IResolvedUrl,
7
+ IDocumentDeltaConnection,
8
+ IDocumentDeltaStorageService,
9
+ IDocumentService,
10
+ IDocumentServicePolicies,
11
+ IDocumentStorageService,
12
+ IResolvedUrl,
13
13
  } from "@fluidframework/driver-definitions";
14
14
  import { IClient } from "@fluidframework/protocol-definitions";
15
15
  import { ITokenProvider } from "@fluidframework/routerlicious-driver";
16
16
  import { GitManager } from "@fluidframework/server-services-client";
17
17
  import { TestHistorian } from "@fluidframework/server-test-utils";
18
18
  import { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
19
- import { LocalDeltaStorageService, LocalDocumentDeltaConnection, LocalDocumentStorageService } from ".";
19
+ import {
20
+ LocalDeltaStorageService,
21
+ LocalDocumentDeltaConnection,
22
+ LocalDocumentStorageService,
23
+ } from ".";
20
24
  /**
21
25
  * Basic implementation of a document service for local use.
22
26
  */
23
27
  export class LocalDocumentService implements IDocumentService {
24
- /**
25
- * @param localDeltaConnectionServer - delta connection server for ops
26
- * @param tokenProvider - token provider
27
- * @param tenantId - ID of tenant
28
- * @param documentId - ID of document
29
- */
30
- constructor(
31
- public readonly resolvedUrl: IResolvedUrl,
32
- private readonly localDeltaConnectionServer: ILocalDeltaConnectionServer,
33
- private readonly tokenProvider: ITokenProvider,
34
- private readonly tenantId: string,
35
- private readonly documentId: string,
36
- private readonly documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>,
37
- public readonly policies: IDocumentServicePolicies = {},
38
- private readonly innerDocumentService?: IDocumentService,
39
- ) { }
28
+ /**
29
+ * @param localDeltaConnectionServer - delta connection server for ops
30
+ * @param tokenProvider - token provider
31
+ * @param tenantId - ID of tenant
32
+ * @param documentId - ID of document
33
+ */
34
+ constructor(
35
+ public readonly resolvedUrl: IResolvedUrl,
36
+ private readonly localDeltaConnectionServer: ILocalDeltaConnectionServer,
37
+ private readonly tokenProvider: ITokenProvider,
38
+ private readonly tenantId: string,
39
+ private readonly documentId: string,
40
+ private readonly documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>,
41
+ public readonly policies: IDocumentServicePolicies = {},
42
+ private readonly innerDocumentService?: IDocumentService,
43
+ ) {}
40
44
 
41
- public dispose() { }
45
+ public dispose() {}
42
46
 
43
- /**
44
- * Creates and returns a document storage service for local use.
45
- */
46
- public async connectToStorage(): Promise<IDocumentStorageService> {
47
- return new LocalDocumentStorageService(
48
- this.documentId,
49
- new GitManager(new TestHistorian(this.localDeltaConnectionServer.testDbFactory.testDatabase)),
50
- {
51
- minBlobSize: 2048, // Test blob aggregation
52
- maximumCacheDurationMs: 432_000_000, // 5 days in ms. Not actually enforced but shouldn't matter for any local driver scenario
53
- },
54
- );
55
- }
47
+ /**
48
+ * Creates and returns a document storage service for local use.
49
+ */
50
+ public async connectToStorage(): Promise<IDocumentStorageService> {
51
+ return new LocalDocumentStorageService(
52
+ this.documentId,
53
+ new GitManager(
54
+ new TestHistorian(this.localDeltaConnectionServer.testDbFactory.testDatabase),
55
+ ),
56
+ {
57
+ minBlobSize: 2048, // Test blob aggregation
58
+ maximumCacheDurationMs: 432_000_000, // 5 days in ms. Not actually enforced but shouldn't matter for any local driver scenario
59
+ },
60
+ );
61
+ }
56
62
 
57
- /**
58
- * Creates and returns a delta storage service for local use.
59
- */
60
- public async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {
61
- if (this.innerDocumentService) {
62
- return this.innerDocumentService.connectToDeltaStorage();
63
- }
64
- return new LocalDeltaStorageService(
65
- this.tenantId,
66
- this.documentId,
67
- this.localDeltaConnectionServer.databaseManager);
68
- }
63
+ /**
64
+ * Creates and returns a delta storage service for local use.
65
+ */
66
+ public async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {
67
+ if (this.innerDocumentService) {
68
+ return this.innerDocumentService.connectToDeltaStorage();
69
+ }
70
+ return new LocalDeltaStorageService(
71
+ this.tenantId,
72
+ this.documentId,
73
+ this.localDeltaConnectionServer.databaseManager,
74
+ );
75
+ }
69
76
 
70
- /**
71
- * Creates and returns a delta stream for local use.
72
- * @param client - client data
73
- */
74
- public async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {
75
- if (this.policies.storageOnly === true) {
76
- throw new Error("can't connect to delta stream in storage-only mode");
77
- }
78
- if (this.innerDocumentService) {
79
- return this.innerDocumentService.connectToDeltaStream(client);
80
- }
81
- const ordererToken = await this.tokenProvider.fetchOrdererToken(
82
- this.tenantId,
83
- this.documentId,
84
- );
85
- const documentDeltaConnection = await LocalDocumentDeltaConnection.create(
86
- this.tenantId,
87
- this.documentId,
88
- ordererToken.jwt,
89
- client,
90
- this.localDeltaConnectionServer.webSocketServer,
91
- );
92
- const clientId = documentDeltaConnection.clientId;
77
+ /**
78
+ * Creates and returns a delta stream for local use.
79
+ * @param client - client data
80
+ */
81
+ public async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {
82
+ if (this.policies.storageOnly === true) {
83
+ throw new Error("can't connect to delta stream in storage-only mode");
84
+ }
85
+ if (this.innerDocumentService) {
86
+ return this.innerDocumentService.connectToDeltaStream(client);
87
+ }
88
+ const ordererToken = await this.tokenProvider.fetchOrdererToken(
89
+ this.tenantId,
90
+ this.documentId,
91
+ );
92
+ const documentDeltaConnection = await LocalDocumentDeltaConnection.create(
93
+ this.tenantId,
94
+ this.documentId,
95
+ ordererToken.jwt,
96
+ client,
97
+ this.localDeltaConnectionServer.webSocketServer,
98
+ );
99
+ const clientId = documentDeltaConnection.clientId;
93
100
 
94
- // Add this document service for the clientId in the document service factory.
95
- this.documentDeltaConnectionsMap.set(clientId, documentDeltaConnection);
101
+ // Add this document service for the clientId in the document service factory.
102
+ this.documentDeltaConnectionsMap.set(clientId, documentDeltaConnection);
96
103
 
97
- // Add a listener to remove this document service when the client is disconnected.
98
- documentDeltaConnection.on("disconnect", () => {
99
- this.documentDeltaConnectionsMap.delete(clientId);
100
- });
104
+ // Add a listener to remove this document service when the client is disconnected.
105
+ documentDeltaConnection.on("disconnect", () => {
106
+ this.documentDeltaConnectionsMap.delete(clientId);
107
+ });
101
108
 
102
- return documentDeltaConnection;
103
- }
109
+ return documentDeltaConnection;
110
+ }
104
111
  }
105
112
 
106
113
  /**
@@ -111,22 +118,23 @@ export class LocalDocumentService implements IDocumentService {
111
118
  * @param documentId - ID of document
112
119
  */
113
120
  export function createLocalDocumentService(
114
- resolvedUrl: IResolvedUrl,
115
- localDeltaConnectionServer: ILocalDeltaConnectionServer,
116
- tokenProvider: ITokenProvider,
117
- tenantId: string,
118
- documentId: string,
119
- documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>,
120
- policies?: IDocumentServicePolicies,
121
- innerDocumentService?: IDocumentService): IDocumentService {
122
- return new LocalDocumentService(
123
- resolvedUrl,
124
- localDeltaConnectionServer,
125
- tokenProvider,
126
- tenantId,
127
- documentId,
128
- documentDeltaConnectionsMap,
129
- policies,
130
- innerDocumentService,
131
- );
121
+ resolvedUrl: IResolvedUrl,
122
+ localDeltaConnectionServer: ILocalDeltaConnectionServer,
123
+ tokenProvider: ITokenProvider,
124
+ tenantId: string,
125
+ documentId: string,
126
+ documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection>,
127
+ policies?: IDocumentServicePolicies,
128
+ innerDocumentService?: IDocumentService,
129
+ ): IDocumentService {
130
+ return new LocalDocumentService(
131
+ resolvedUrl,
132
+ localDeltaConnectionServer,
133
+ tokenProvider,
134
+ tenantId,
135
+ documentId,
136
+ documentDeltaConnectionsMap,
137
+ policies,
138
+ innerDocumentService,
139
+ );
132
140
  }
@@ -5,18 +5,21 @@
5
5
 
6
6
  import { parse } from "url";
7
7
  import {
8
- IDocumentService,
9
- IDocumentServiceFactory,
10
- IDocumentServicePolicies,
11
- IResolvedUrl,
8
+ IDocumentService,
9
+ IDocumentServiceFactory,
10
+ IDocumentServicePolicies,
11
+ IResolvedUrl,
12
12
  } from "@fluidframework/driver-definitions";
13
13
  import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
14
14
  import { DefaultTokenProvider } from "@fluidframework/routerlicious-driver";
15
- import { ILocalDeltaConnectionServer, LocalDeltaConnectionServer } from "@fluidframework/server-local-server";
16
15
  import {
17
- ensureFluidResolvedUrl,
18
- getDocAttributesFromProtocolSummary,
19
- getQuorumValuesFromProtocolSummary,
16
+ ILocalDeltaConnectionServer,
17
+ LocalDeltaConnectionServer,
18
+ } from "@fluidframework/server-local-server";
19
+ import {
20
+ ensureFluidResolvedUrl,
21
+ getDocAttributesFromProtocolSummary,
22
+ getQuorumValuesFromProtocolSummary,
20
23
  } from "@fluidframework/driver-utils";
21
24
  import { ISummaryTree, NackErrorType } from "@fluidframework/protocol-definitions";
22
25
  import { defaultHash } from "@fluidframework/server-services-client";
@@ -27,124 +30,130 @@ import { createLocalDocumentService } from "./localDocumentService";
27
30
  * Implementation of document service factory for local use.
28
31
  */
29
32
  export class LocalDocumentServiceFactory implements IDocumentServiceFactory {
30
- public readonly protocolName = "fluid-test:";
33
+ public readonly protocolName = "fluid-test:";
31
34
 
32
- // A map of clientId to LocalDocumentService.
33
- private readonly documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection> = new Map();
35
+ // A map of clientId to LocalDocumentService.
36
+ private readonly documentDeltaConnectionsMap: Map<string, LocalDocumentDeltaConnection> =
37
+ new Map();
34
38
 
35
- /**
36
- * @param localDeltaConnectionServer - delta connection server for ops
37
- */
38
- constructor(
39
- private readonly localDeltaConnectionServer: ILocalDeltaConnectionServer,
40
- private readonly policies?: IDocumentServicePolicies,
41
- private readonly innerDocumentService?: IDocumentService) { }
39
+ /**
40
+ * @param localDeltaConnectionServer - delta connection server for ops
41
+ */
42
+ constructor(
43
+ private readonly localDeltaConnectionServer: ILocalDeltaConnectionServer,
44
+ private readonly policies?: IDocumentServicePolicies,
45
+ private readonly innerDocumentService?: IDocumentService,
46
+ ) {}
42
47
 
43
- public async createContainer(
44
- createNewSummary: ISummaryTree | undefined,
45
- resolvedUrl: IResolvedUrl,
46
- logger?: ITelemetryBaseLogger,
47
- clientIsSummarizer?: boolean,
48
- ): Promise<IDocumentService> {
49
- ensureFluidResolvedUrl(resolvedUrl);
50
- if (createNewSummary === undefined) {
51
- throw new Error("Empty file summary creation isn't supported in this driver.");
52
- }
53
- const pathName = new URL(resolvedUrl.url).pathname;
54
- const pathArr = pathName.split("/");
55
- const tenantId = pathArr[pathArr.length - 2];
56
- const id = pathArr[pathArr.length - 1];
57
- if (!this.localDeltaConnectionServer) {
58
- throw new Error("Provide the localDeltaConnectionServer!!");
59
- }
60
- const documentStorage = (this.localDeltaConnectionServer as LocalDeltaConnectionServer).documentStorage;
48
+ public async createContainer(
49
+ createNewSummary: ISummaryTree | undefined,
50
+ resolvedUrl: IResolvedUrl,
51
+ logger?: ITelemetryBaseLogger,
52
+ clientIsSummarizer?: boolean,
53
+ ): Promise<IDocumentService> {
54
+ ensureFluidResolvedUrl(resolvedUrl);
55
+ if (createNewSummary === undefined) {
56
+ throw new Error("Empty file summary creation isn't supported in this driver.");
57
+ }
58
+ const pathName = new URL(resolvedUrl.url).pathname;
59
+ const pathArr = pathName.split("/");
60
+ const tenantId = pathArr[pathArr.length - 2];
61
+ const id = pathArr[pathArr.length - 1];
62
+ if (!this.localDeltaConnectionServer) {
63
+ throw new Error("Provide the localDeltaConnectionServer!!");
64
+ }
65
+ const documentStorage = (this.localDeltaConnectionServer as LocalDeltaConnectionServer)
66
+ .documentStorage;
61
67
 
62
- const protocolSummary = createNewSummary.tree[".protocol"] as ISummaryTree;
63
- const appSummary = createNewSummary.tree[".app"] as ISummaryTree;
64
- if (!(protocolSummary && appSummary)) {
65
- throw new Error("Protocol and App Summary required in the full summary");
66
- }
67
- const documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);
68
- const quorumValues = getQuorumValuesFromProtocolSummary(protocolSummary);
69
- const sequenceNumber = documentAttributes.sequenceNumber;
70
- await documentStorage.createDocument(
71
- tenantId,
72
- id,
73
- appSummary,
74
- sequenceNumber,
75
- documentAttributes.term ?? 1,
76
- defaultHash,
77
- resolvedUrl.endpoints.ordererUrl ?? "",
78
- resolvedUrl.endpoints.storageUrl ?? "",
79
- resolvedUrl.endpoints.deltaStorageUrl ?? "",
80
- quorumValues,
81
- false, /* enableDiscovery */
82
- );
83
- return this.createDocumentService(resolvedUrl, logger, clientIsSummarizer);
84
- }
68
+ const protocolSummary = createNewSummary.tree[".protocol"] as ISummaryTree;
69
+ const appSummary = createNewSummary.tree[".app"] as ISummaryTree;
70
+ if (!(protocolSummary && appSummary)) {
71
+ throw new Error("Protocol and App Summary required in the full summary");
72
+ }
73
+ const documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);
74
+ const quorumValues = getQuorumValuesFromProtocolSummary(protocolSummary);
75
+ const sequenceNumber = documentAttributes.sequenceNumber;
76
+ await documentStorage.createDocument(
77
+ tenantId,
78
+ id,
79
+ appSummary,
80
+ sequenceNumber,
81
+ documentAttributes.term ?? 1,
82
+ defaultHash,
83
+ resolvedUrl.endpoints.ordererUrl ?? "",
84
+ resolvedUrl.endpoints.storageUrl ?? "",
85
+ resolvedUrl.endpoints.deltaStorageUrl ?? "",
86
+ quorumValues,
87
+ false /* enableDiscovery */,
88
+ );
89
+ return this.createDocumentService(resolvedUrl, logger, clientIsSummarizer);
90
+ }
85
91
 
86
- /**
87
- * Creates and returns a document service for testing using the given resolved
88
- * URL for the tenant ID, document ID, and token.
89
- * @param resolvedUrl - resolved URL of document
90
- */
91
- public async createDocumentService(
92
- resolvedUrl: IResolvedUrl,
93
- logger?: ITelemetryBaseLogger,
94
- clientIsSummarizer?: boolean,
95
- ): Promise<IDocumentService> {
96
- ensureFluidResolvedUrl(resolvedUrl);
92
+ /**
93
+ * Creates and returns a document service for testing using the given resolved
94
+ * URL for the tenant ID, document ID, and token.
95
+ * @param resolvedUrl - resolved URL of document
96
+ */
97
+ public async createDocumentService(
98
+ resolvedUrl: IResolvedUrl,
99
+ logger?: ITelemetryBaseLogger,
100
+ clientIsSummarizer?: boolean,
101
+ ): Promise<IDocumentService> {
102
+ ensureFluidResolvedUrl(resolvedUrl);
97
103
 
98
- const parsedUrl = parse(resolvedUrl.url);
99
- const [, tenantId, documentId] = parsedUrl.path ? parsedUrl.path.split("/") : [];
100
- if (!documentId || !tenantId) {
101
- throw new Error(`Couldn't parse resolved url. [documentId:${documentId}][tenantId:${tenantId}]`);
102
- }
104
+ const parsedUrl = parse(resolvedUrl.url);
105
+ const [, tenantId, documentId] = parsedUrl.path ? parsedUrl.path.split("/") : [];
106
+ if (!documentId || !tenantId) {
107
+ throw new Error(
108
+ `Couldn't parse resolved url. [documentId:${documentId}][tenantId:${tenantId}]`,
109
+ );
110
+ }
103
111
 
104
- const fluidResolvedUrl = resolvedUrl;
105
- const jwtToken = fluidResolvedUrl.tokens.jwt;
106
- if (!jwtToken) {
107
- throw new Error(`Token was not provided.`);
108
- }
112
+ const fluidResolvedUrl = resolvedUrl;
113
+ const jwtToken = fluidResolvedUrl.tokens.jwt;
114
+ if (!jwtToken) {
115
+ throw new Error(`Token was not provided.`);
116
+ }
109
117
 
110
- const tokenProvider = new DefaultTokenProvider(jwtToken);
118
+ const tokenProvider = new DefaultTokenProvider(jwtToken);
111
119
 
112
- return createLocalDocumentService(
113
- resolvedUrl,
114
- this.localDeltaConnectionServer,
115
- tokenProvider,
116
- tenantId,
117
- documentId,
118
- this.documentDeltaConnectionsMap,
119
- this.policies,
120
- this.innerDocumentService);
121
- }
120
+ return createLocalDocumentService(
121
+ resolvedUrl,
122
+ this.localDeltaConnectionServer,
123
+ tokenProvider,
124
+ tenantId,
125
+ documentId,
126
+ this.documentDeltaConnectionsMap,
127
+ this.policies,
128
+ this.innerDocumentService,
129
+ );
130
+ }
122
131
 
123
- /**
124
- * Gets the document delta connection for the clientId and asks it to disconnect the client.
125
- * @param clientId - The ID of the client to be disconnected.
126
- * @param disconnectReason - The reason of the disconnection.
127
- */
128
- public disconnectClient(clientId: string, disconnectReason: string) {
129
- const documentDeltaConnection = this.documentDeltaConnectionsMap.get(clientId);
130
- if (documentDeltaConnection === undefined) {
131
- throw new Error(`No client with the id: ${clientId}`);
132
- }
133
- documentDeltaConnection.disconnectClient(disconnectReason);
134
- }
132
+ /**
133
+ * Gets the document delta connection for the clientId and asks it to disconnect the client.
134
+ * @param clientId - The ID of the client to be disconnected.
135
+ * @param disconnectReason - The reason of the disconnection.
136
+ */
137
+ public disconnectClient(clientId: string, disconnectReason: string) {
138
+ const documentDeltaConnection = this.documentDeltaConnectionsMap.get(clientId);
139
+ if (documentDeltaConnection === undefined) {
140
+ throw new Error(`No client with the id: ${clientId}`);
141
+ }
142
+ documentDeltaConnection.disconnectClient(disconnectReason);
143
+ }
135
144
 
136
- /**
137
- * Gets the document delta connection for the clientId and asks it to nack the client.
138
- * @param clientId - The ID of the client to be Nack'd.
139
- * @param code - An error code number that represents the error. It will be a valid HTTP error code.
140
- * @param type - Type of the Nack.
141
- * @param message - A message about the nack for debugging/logging/telemetry purposes.
142
- */
143
- public nackClient(clientId: string, code?: number, type?: NackErrorType, message?: any) {
144
- const documentDeltaConnection = this.documentDeltaConnectionsMap.get(clientId);
145
- if (documentDeltaConnection === undefined) {
146
- throw new Error(`No client with the id: ${clientId}`);
147
- }
148
- documentDeltaConnection.nackClient(code, type, message);
149
- }
145
+ /**
146
+ * Gets the document delta connection for the clientId and asks it to nack the client.
147
+ * @param clientId - The ID of the client to be Nack'd.
148
+ * @param code - An error code number that represents the error. It will be a valid HTTP error code.
149
+ * @param type - Type of the Nack.
150
+ * @param message - A message about the nack for debugging/logging/telemetry purposes.
151
+ */
152
+ public nackClient(clientId: string, code?: number, type?: NackErrorType, message?: any) {
153
+ const documentDeltaConnection = this.documentDeltaConnectionsMap.get(clientId);
154
+ if (documentDeltaConnection === undefined) {
155
+ throw new Error(`No client with the id: ${clientId}`);
156
+ }
157
+ documentDeltaConnection.nackClient(code, type, message);
158
+ }
150
159
  }
@@ -17,7 +17,11 @@ import {
17
17
  IVersion,
18
18
  } from "@fluidframework/protocol-definitions";
19
19
  import { buildHierarchy } from "@fluidframework/protocol-base";
20
- import { GitManager, ISummaryUploadManager, SummaryTreeUploadManager } from "@fluidframework/server-services-client";
20
+ import {
21
+ GitManager,
22
+ ISummaryUploadManager,
23
+ SummaryTreeUploadManager,
24
+ } from "@fluidframework/server-services-client";
21
25
 
22
26
  export class LocalDocumentStorageService implements IDocumentStorageService {
23
27
  // The values of this cache is useless. We only need the keys. So we are always putting
@@ -74,7 +78,10 @@ export class LocalDocumentStorageService implements IDocumentStorageService {
74
78
  return bufferContent;
75
79
  }
76
80
 
77
- public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {
81
+ public async uploadSummaryWithContext(
82
+ summary: ISummaryTree,
83
+ context: ISummaryContext,
84
+ ): Promise<string> {
78
85
  return this.summaryTreeUploadManager.writeSummaryTree(
79
86
  summary,
80
87
  context.ackHandle ?? "",
@@ -84,24 +91,24 @@ export class LocalDocumentStorageService implements IDocumentStorageService {
84
91
 
85
92
  public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {
86
93
  const uint8ArrayFile = new Uint8Array(file);
87
- return this.manager.createBlob(
88
- Uint8ArrayToString(
89
- uint8ArrayFile, "base64"),
90
- "base64").then((r) => ({ id: r.sha, url: r.url }));
94
+ return this.manager
95
+ .createBlob(Uint8ArrayToString(uint8ArrayFile, "base64"), "base64")
96
+ .then((r) => ({ id: r.sha, url: r.url }));
91
97
  }
92
98
 
93
99
  public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {
94
100
  throw new Error("NOT IMPLEMENTED!");
95
101
  }
96
102
 
97
- private async getPreviousFullSnapshot(parentHandle: string): Promise<ISnapshotTreeEx | null | undefined> {
103
+ private async getPreviousFullSnapshot(
104
+ parentHandle: string,
105
+ ): Promise<ISnapshotTreeEx | null | undefined> {
98
106
  return parentHandle
99
- ? this.getVersions(parentHandle, 1)
100
- .then(async (versions) => {
107
+ ? this.getVersions(parentHandle, 1).then(async (versions) => {
101
108
  // Clear the cache as the getSnapshotTree call will fill the cache.
102
109
  this.blobsShaCache.clear();
103
110
  return this.getSnapshotTree(versions[0]);
104
- })
111
+ })
105
112
  : undefined;
106
113
  }
107
114
  }