@fluidframework/file-driver 2.0.0-dev-rc.5.0.0.263932 → 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.
Files changed (42) hide show
  1. package/api-report/file-driver.api.md +34 -30
  2. package/dist/fileDeltaStorageService.d.ts +4 -4
  3. package/dist/fileDeltaStorageService.d.ts.map +1 -1
  4. package/dist/fileDeltaStorageService.js.map +1 -1
  5. package/dist/fileDocumentDeltaConnection.d.ts +2 -2
  6. package/dist/fileDocumentDeltaConnection.d.ts.map +1 -1
  7. package/dist/fileDocumentDeltaConnection.js +3 -3
  8. package/dist/fileDocumentDeltaConnection.js.map +1 -1
  9. package/dist/fileDocumentService.d.ts +8 -8
  10. package/dist/fileDocumentService.d.ts.map +1 -1
  11. package/dist/fileDocumentService.js.map +1 -1
  12. package/dist/fileDocumentServiceFactory.d.ts +1 -1
  13. package/dist/fileDocumentServiceFactory.d.ts.map +1 -1
  14. package/dist/fileDocumentServiceFactory.js.map +1 -1
  15. package/dist/fileDocumentStorageService.d.ts +19 -19
  16. package/dist/fileDocumentStorageService.d.ts.map +1 -1
  17. package/dist/fileDocumentStorageService.js +11 -34
  18. package/dist/fileDocumentStorageService.js.map +1 -1
  19. package/lib/fileDeltaStorageService.d.ts +4 -4
  20. package/lib/fileDeltaStorageService.d.ts.map +1 -1
  21. package/lib/fileDeltaStorageService.js.map +1 -1
  22. package/lib/fileDocumentDeltaConnection.d.ts +2 -2
  23. package/lib/fileDocumentDeltaConnection.d.ts.map +1 -1
  24. package/lib/fileDocumentDeltaConnection.js +2 -2
  25. package/lib/fileDocumentDeltaConnection.js.map +1 -1
  26. package/lib/fileDocumentService.d.ts +8 -8
  27. package/lib/fileDocumentService.d.ts.map +1 -1
  28. package/lib/fileDocumentService.js.map +1 -1
  29. package/lib/fileDocumentServiceFactory.d.ts +1 -1
  30. package/lib/fileDocumentServiceFactory.d.ts.map +1 -1
  31. package/lib/fileDocumentServiceFactory.js.map +1 -1
  32. package/lib/fileDocumentStorageService.d.ts +19 -19
  33. package/lib/fileDocumentStorageService.d.ts.map +1 -1
  34. package/lib/fileDocumentStorageService.js +6 -6
  35. package/lib/fileDocumentStorageService.js.map +1 -1
  36. package/lib/tsdoc-metadata.json +1 -1
  37. package/package.json +17 -14
  38. package/src/fileDeltaStorageService.ts +6 -6
  39. package/src/fileDocumentDeltaConnection.ts +6 -6
  40. package/src/fileDocumentService.ts +17 -10
  41. package/src/fileDocumentServiceFactory.ts +1 -1
  42. package/src/fileDocumentStorageService.ts +23 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/file-driver",
3
- "version": "2.0.0-dev-rc.5.0.0.263932",
3
+ "version": "2.0.0-dev-rc.5.0.0.267932",
4
4
  "description": "A driver that reads/write from/to local file storage.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -37,29 +37,28 @@
37
37
  "main": "lib/index.js",
38
38
  "types": "lib/public.d.ts",
39
39
  "dependencies": {
40
- "@fluid-internal/client-utils": "2.0.0-dev-rc.5.0.0.263932",
41
- "@fluidframework/core-interfaces": "2.0.0-dev-rc.5.0.0.263932",
42
- "@fluidframework/core-utils": "2.0.0-dev-rc.5.0.0.263932",
43
- "@fluidframework/driver-definitions": "2.0.0-dev-rc.5.0.0.263932",
44
- "@fluidframework/driver-utils": "2.0.0-dev-rc.5.0.0.263932",
45
- "@fluidframework/protocol-definitions": "^3.2.0",
46
- "@fluidframework/replay-driver": "2.0.0-dev-rc.5.0.0.263932"
40
+ "@fluid-internal/client-utils": "2.0.0-dev-rc.5.0.0.267932",
41
+ "@fluidframework/core-interfaces": "2.0.0-dev-rc.5.0.0.267932",
42
+ "@fluidframework/core-utils": "2.0.0-dev-rc.5.0.0.267932",
43
+ "@fluidframework/driver-definitions": "2.0.0-dev-rc.5.0.0.267932",
44
+ "@fluidframework/driver-utils": "2.0.0-dev-rc.5.0.0.267932",
45
+ "@fluidframework/replay-driver": "2.0.0-dev-rc.5.0.0.267932"
47
46
  },
48
47
  "devDependencies": {
49
48
  "@arethetypeswrong/cli": "^0.15.2",
50
49
  "@biomejs/biome": "^1.6.2",
51
- "@fluid-tools/build-cli": "^0.38.0",
50
+ "@fluid-tools/build-cli": "^0.39.0-264124",
52
51
  "@fluidframework/build-common": "^2.0.3",
53
- "@fluidframework/build-tools": "^0.38.0",
52
+ "@fluidframework/build-tools": "^0.39.0-264124",
54
53
  "@fluidframework/eslint-config-fluid": "^5.1.0",
55
- "@fluidframework/file-driver-previous": "npm:@fluidframework/file-driver@2.0.0-rc.3.0.0",
56
- "@microsoft/api-extractor": "^7.43.1",
54
+ "@fluidframework/file-driver-previous": "npm:@fluidframework/file-driver@2.0.0-rc.4.0.0",
55
+ "@microsoft/api-extractor": "^7.45.1",
57
56
  "@types/node": "^18.19.0",
58
57
  "copyfiles": "^2.4.1",
59
58
  "eslint": "~8.55.0",
60
59
  "prettier": "~3.0.3",
61
60
  "rimraf": "^4.4.0",
62
- "typescript": "~5.1.6"
61
+ "typescript": "~5.4.5"
63
62
  },
64
63
  "fluidBuild": {
65
64
  "tasks": {
@@ -69,7 +68,11 @@
69
68
  }
70
69
  },
71
70
  "typeValidation": {
72
- "broken": {}
71
+ "broken": {
72
+ "VariableDeclaration_FluidFetchReaderFileSnapshotWriter": {
73
+ "forwardCompat": false
74
+ }
75
+ }
73
76
  },
74
77
  "scripts": {
75
78
  "api": "fluid-build . --task api",
@@ -6,17 +6,17 @@
6
6
  import fs from "fs";
7
7
 
8
8
  import { assert } from "@fluidframework/core-utils/internal";
9
+ import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions";
9
10
  import { IDocumentDeltaStorageService, IStream } from "@fluidframework/driver-definitions/internal";
10
11
  import { emptyMessageStream } from "@fluidframework/driver-utils/internal";
11
- import * as api from "@fluidframework/protocol-definitions";
12
12
 
13
13
  /**
14
14
  * Provides access to the underlying delta storage on the local file storage for file driver.
15
15
  * @internal
16
16
  */
17
17
  export class FileDeltaStorageService implements IDocumentDeltaStorageService {
18
- private readonly messages: api.ISequencedDocumentMessage[];
19
- private lastOps: api.ISequencedDocumentMessage[] = [];
18
+ private readonly messages: ISequencedDocumentMessage[];
19
+ private lastOps: ISequencedDocumentMessage[] = [];
20
20
 
21
21
  constructor(private readonly path: string) {
22
22
  this.messages = [];
@@ -41,11 +41,11 @@ export class FileDeltaStorageService implements IDocumentDeltaStorageService {
41
41
  to: number | undefined,
42
42
  abortSignal?: AbortSignal,
43
43
  cachedOnly?: boolean,
44
- ): IStream<api.ISequencedDocumentMessage[]> {
44
+ ): IStream<ISequencedDocumentMessage[]> {
45
45
  return emptyMessageStream;
46
46
  }
47
47
 
48
- public get ops(): readonly Readonly<api.ISequencedDocumentMessage>[] {
48
+ public get ops(): readonly Readonly<ISequencedDocumentMessage>[] {
49
49
  return this.messages;
50
50
  }
51
51
 
@@ -55,7 +55,7 @@ export class FileDeltaStorageService implements IDocumentDeltaStorageService {
55
55
  * @param from - First op to be fetched.
56
56
  * @param to - Last op to be fetched. This is exclusive.
57
57
  */
58
- public getFromWebSocket(from: number, to: number): api.ISequencedDocumentMessage[] {
58
+ public getFromWebSocket(from: number, to: number): ISequencedDocumentMessage[] {
59
59
  const readFrom = Math.max(from, 0); // Inclusive
60
60
  const readTo = Math.min(to, this.messages.length); // Exclusive
61
61
 
@@ -5,21 +5,21 @@
5
5
 
6
6
  import { TypedEventEmitter } from "@fluid-internal/client-utils";
7
7
  import { IDisposable } from "@fluidframework/core-interfaces";
8
+ import {
9
+ ConnectionMode,
10
+ ISequencedDocumentMessage,
11
+ ISignalMessage,
12
+ } from "@fluidframework/driver-definitions";
8
13
  import {
9
14
  IDocumentDeltaConnection,
10
15
  IDocumentDeltaConnectionEvents,
11
- } from "@fluidframework/driver-definitions/internal";
12
- import {
13
- ConnectionMode,
14
16
  IClientConfiguration,
15
17
  IConnected,
16
18
  IDocumentMessage,
17
- ISequencedDocumentMessage,
18
19
  ISignalClient,
19
- ISignalMessage,
20
20
  ITokenClaims,
21
21
  ScopeType,
22
- } from "@fluidframework/protocol-definitions";
22
+ } from "@fluidframework/driver-definitions/internal";
23
23
 
24
24
  import { FileDeltaStorageService } from "./fileDeltaStorageService.js";
25
25
 
@@ -4,8 +4,15 @@
4
4
  */
5
5
 
6
6
  import { TypedEventEmitter } from "@fluid-internal/client-utils";
7
- import * as api from "@fluidframework/driver-definitions/internal";
8
- import { IClient } from "@fluidframework/protocol-definitions";
7
+ import { IClient } from "@fluidframework/driver-definitions";
8
+ import {
9
+ IDocumentServiceEvents,
10
+ IDocumentService,
11
+ IResolvedUrl,
12
+ IDocumentStorageService,
13
+ IDocumentDeltaConnection,
14
+ IDocumentDeltaStorageService,
15
+ } from "@fluidframework/driver-definitions/internal";
9
16
 
10
17
  import { FileDeltaStorageService } from "./fileDeltaStorageService.js";
11
18
 
@@ -14,26 +21,26 @@ import { FileDeltaStorageService } from "./fileDeltaStorageService.js";
14
21
  * underlying storage for file document service.
15
22
  */
16
23
  export class FileDocumentService
17
- extends TypedEventEmitter<api.IDocumentServiceEvents>
24
+ extends TypedEventEmitter<IDocumentServiceEvents>
18
25
  // eslint-disable-next-line import/namespace
19
- implements api.IDocumentService
26
+ implements IDocumentService
20
27
  {
21
28
  constructor(
22
- public readonly resolvedUrl: api.IResolvedUrl,
23
- private readonly storage: api.IDocumentStorageService,
29
+ public readonly resolvedUrl: IResolvedUrl,
30
+ private readonly storage: IDocumentStorageService,
24
31
  private readonly deltaStorage: FileDeltaStorageService,
25
- private readonly deltaConnection: api.IDocumentDeltaConnection,
32
+ private readonly deltaConnection: IDocumentDeltaConnection,
26
33
  ) {
27
34
  super();
28
35
  }
29
36
 
30
37
  public dispose() {}
31
38
 
32
- public async connectToStorage(): Promise<api.IDocumentStorageService> {
39
+ public async connectToStorage(): Promise<IDocumentStorageService> {
33
40
  return this.storage;
34
41
  }
35
42
 
36
- public async connectToDeltaStorage(): Promise<api.IDocumentDeltaStorageService> {
43
+ public async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {
37
44
  return this.deltaStorage;
38
45
  }
39
46
 
@@ -44,7 +51,7 @@ export class FileDocumentService
44
51
  * @param client - Client that connects to socket.
45
52
  * @returns returns the delta stream service.
46
53
  */
47
- public async connectToDeltaStream(client: IClient): Promise<api.IDocumentDeltaConnection> {
54
+ public async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {
48
55
  return this.deltaConnection;
49
56
  }
50
57
  }
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
+ import { ISummaryTree } from "@fluidframework/driver-definitions";
7
8
  import {
8
9
  IDocumentDeltaConnection,
9
10
  IDocumentService,
@@ -11,7 +12,6 @@ import {
11
12
  IDocumentStorageService,
12
13
  IResolvedUrl,
13
14
  } from "@fluidframework/driver-definitions/internal";
14
- import { ISummaryTree } from "@fluidframework/protocol-definitions";
15
15
 
16
16
  import { FileDeltaStorageService } from "./fileDeltaStorageService.js";
17
17
  import { FileDocumentService } from "./fileDocumentService.js";
@@ -7,15 +7,21 @@ import fs from "fs";
7
7
 
8
8
  import { bufferToString } from "@fluid-internal/client-utils";
9
9
  import { assert } from "@fluidframework/core-utils/internal";
10
+ import { ISummaryTree } from "@fluidframework/driver-definitions";
10
11
  import {
11
12
  IDocumentStorageService,
12
13
  ISummaryContext,
14
+ ISnapshotTree,
15
+ IVersion,
16
+ ITree,
17
+ FileMode,
18
+ TreeEntry,
19
+ IBlob,
13
20
  } from "@fluidframework/driver-definitions/internal";
14
21
  import {
15
22
  buildSnapshotTree,
16
23
  convertSummaryTreeToSnapshotITree,
17
24
  } from "@fluidframework/driver-utils/internal";
18
- import * as api from "@fluidframework/protocol-definitions";
19
25
  import {
20
26
  IFileSnapshot,
21
27
  ReadDocumentStorageServiceBase,
@@ -39,7 +45,7 @@ export class FluidFetchReader
39
45
  extends ReadDocumentStorageServiceBase
40
46
  implements IDocumentStorageService
41
47
  {
42
- protected docTree: api.ISnapshotTree | null = null;
48
+ protected docTree: ISnapshotTree | null = null;
43
49
 
44
50
  constructor(
45
51
  private readonly path: string,
@@ -53,7 +59,7 @@ export class FluidFetchReader
53
59
  * @param version - The version contains the path of the file which contains the snapshot tree.
54
60
  */
55
61
  // eslint-disable-next-line @rushstack/no-new-null
56
- public async getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null> {
62
+ public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {
57
63
  assert(version !== null, 0x092 /* "version input for reading snapshot tree is null!" */);
58
64
  assert(
59
65
  !version || version.treeId === FileStorageVersionTreeId,
@@ -93,7 +99,7 @@ export class FluidFetchReader
93
99
  * @param count - Number of versions to be returned.
94
100
  */
95
101
  // eslint-disable-next-line @rushstack/no-new-null
96
- public async getVersions(versionId: string | null, count: number): Promise<api.IVersion[]> {
102
+ public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {
97
103
  if (versionId === FileStorageDocumentName || versionId === null) {
98
104
  if (this.docTree !== null || this.versionName !== undefined) {
99
105
  return [{ id: "latest", treeId: FileStorageVersionTreeId }];
@@ -143,7 +149,7 @@ export const FileSnapshotWriterClassFactory = <TBase extends ReaderConstructor>(
143
149
  class extends Base implements ISnapshotWriterStorage {
144
150
  // Note: if variable name has same name as in base class, it overrides it!
145
151
  public blobsWriter = new Map<string, ArrayBufferLike>();
146
- public latestWriterTree?: api.ISnapshotTree;
152
+ public latestWriterTree?: ISnapshotTree;
147
153
  public docId?: string;
148
154
 
149
155
  public reset() {
@@ -165,7 +171,7 @@ export const FileSnapshotWriterClassFactory = <TBase extends ReaderConstructor>(
165
171
  }
166
172
 
167
173
  // eslint-disable-next-line @rushstack/no-new-null
168
- public async getVersions(versionId: string | null, count: number): Promise<api.IVersion[]> {
174
+ public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {
169
175
  // If we already saved document, that means we are getting here because of snapshot generation.
170
176
  // Not returning tree ensures that ContainerRuntime.snapshot() would regenerate subtrees for
171
177
  // each unchanged data store.
@@ -183,7 +189,7 @@ export const FileSnapshotWriterClassFactory = <TBase extends ReaderConstructor>(
183
189
  }
184
190
 
185
191
  // eslint-disable-next-line @rushstack/no-new-null
186
- public async getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null> {
192
+ public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {
187
193
  if (this.latestWriterTree && (!version || version.id === "latest")) {
188
194
  return this.latestWriterTree;
189
195
  }
@@ -191,7 +197,7 @@ export const FileSnapshotWriterClassFactory = <TBase extends ReaderConstructor>(
191
197
  }
192
198
 
193
199
  public async uploadSummaryWithContext(
194
- summary: api.ISummaryTree,
200
+ summary: ISummaryTree,
195
201
  context: ISummaryContext,
196
202
  ): Promise<string> {
197
203
  const tree = convertSummaryTreeToSnapshotITree(summary);
@@ -207,15 +213,15 @@ export const FileSnapshotWriterClassFactory = <TBase extends ReaderConstructor>(
207
213
  return "testHandleId";
208
214
  }
209
215
 
210
- public async buildTree(snapshotTree: api.ISnapshotTree): Promise<api.ITree> {
211
- const tree: api.ITree = { entries: [] };
216
+ public async buildTree(snapshotTree: ISnapshotTree): Promise<ITree> {
217
+ const tree: ITree = { entries: [] };
212
218
 
213
219
  for (const subTreeId of Object.keys(snapshotTree.trees)) {
214
220
  const subTree = await this.buildTree(snapshotTree.trees[subTreeId]);
215
221
  tree.entries.push({
216
- mode: api.FileMode.Directory,
222
+ mode: FileMode.Directory,
217
223
  path: subTreeId,
218
- type: api.TreeEntry.Tree,
224
+ type: TreeEntry.Tree,
219
225
  value: subTree,
220
226
  });
221
227
  }
@@ -223,14 +229,14 @@ export const FileSnapshotWriterClassFactory = <TBase extends ReaderConstructor>(
223
229
  for (const blobName of Object.keys(snapshotTree.blobs)) {
224
230
  const buffer = await this.readBlob(snapshotTree.blobs[blobName]);
225
231
  const contents = bufferToString(buffer, "utf8");
226
- const blob: api.IBlob = {
232
+ const blob: IBlob = {
227
233
  contents,
228
234
  encoding: "utf-8",
229
235
  };
230
236
  tree.entries.push({
231
- mode: api.FileMode.File,
237
+ mode: FileMode.File,
232
238
  path: blobName,
233
- type: api.TreeEntry.Blob,
239
+ type: TreeEntry.Blob,
234
240
  value: blob,
235
241
  });
236
242
  }
@@ -239,9 +245,9 @@ export const FileSnapshotWriterClassFactory = <TBase extends ReaderConstructor>(
239
245
  }
240
246
  };
241
247
 
242
- function removeNullTreeIds(tree: api.ITree) {
248
+ function removeNullTreeIds(tree: ITree) {
243
249
  for (const node of tree.entries) {
244
- if (node.type === api.TreeEntry.Tree) {
250
+ if (node.type === TreeEntry.Tree) {
245
251
  removeNullTreeIds(node.value);
246
252
  }
247
253
  }