@fluidframework/file-driver 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.1

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 (33) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-extractor-lint.json +13 -0
  3. package/api-extractor.json +3 -3
  4. package/api-report/file-driver.api.md +10 -10
  5. package/dist/file-driver-alpha.d.ts +51 -0
  6. package/dist/file-driver-beta.d.ts +75 -0
  7. package/dist/file-driver-public.d.ts +75 -0
  8. package/dist/file-driver-untrimmed.d.ts +209 -0
  9. package/dist/fileDeltaStorageService.d.ts +1 -0
  10. package/dist/fileDeltaStorageService.d.ts.map +1 -1
  11. package/dist/fileDeltaStorageService.js +1 -0
  12. package/dist/fileDeltaStorageService.js.map +1 -1
  13. package/dist/fileDocumentDeltaConnection.d.ts +4 -0
  14. package/dist/fileDocumentDeltaConnection.d.ts.map +1 -1
  15. package/dist/fileDocumentDeltaConnection.js +4 -0
  16. package/dist/fileDocumentDeltaConnection.js.map +1 -1
  17. package/dist/fileDocumentServiceFactory.d.ts +1 -0
  18. package/dist/fileDocumentServiceFactory.d.ts.map +1 -1
  19. package/dist/fileDocumentServiceFactory.js +1 -0
  20. package/dist/fileDocumentServiceFactory.js.map +1 -1
  21. package/dist/fileDocumentStorageService.d.ts +16 -0
  22. package/dist/fileDocumentStorageService.d.ts.map +1 -1
  23. package/dist/fileDocumentStorageService.js +10 -0
  24. package/dist/fileDocumentStorageService.js.map +1 -1
  25. package/lib/file-driver-alpha.d.ts +51 -0
  26. package/lib/file-driver-beta.d.ts +75 -0
  27. package/lib/file-driver-public.d.ts +75 -0
  28. package/lib/file-driver-untrimmed.d.ts +209 -0
  29. package/package.json +27 -12
  30. package/src/fileDeltaStorageService.ts +1 -0
  31. package/src/fileDocumentDeltaConnection.ts +4 -0
  32. package/src/fileDocumentServiceFactory.ts +1 -0
  33. package/src/fileDocumentStorageService.ts +16 -0
@@ -0,0 +1,209 @@
1
+ import * as api from '@fluidframework/protocol-definitions';
2
+ import { ConnectionMode } from '@fluidframework/protocol-definitions';
3
+ import { IClientConfiguration } from '@fluidframework/protocol-definitions';
4
+ import { IConnected } from '@fluidframework/protocol-definitions';
5
+ import { IDisposable } from '@fluidframework/core-interfaces';
6
+ import { IDocumentDeltaConnection } from '@fluidframework/driver-definitions';
7
+ import { IDocumentDeltaConnectionEvents } from '@fluidframework/driver-definitions';
8
+ import { IDocumentDeltaStorageService } from '@fluidframework/driver-definitions';
9
+ import { IDocumentMessage } from '@fluidframework/protocol-definitions';
10
+ import { IDocumentService } from '@fluidframework/driver-definitions';
11
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
12
+ import { IDocumentStorageService } from '@fluidframework/driver-definitions';
13
+ import { IDocumentStorageServicePolicies } from '@fluidframework/driver-definitions';
14
+ import { IFileSnapshot } from '@fluidframework/replay-driver';
15
+ import { IResolvedUrl } from '@fluidframework/driver-definitions';
16
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
17
+ import { ISignalClient } from '@fluidframework/protocol-definitions';
18
+ import { ISignalMessage } from '@fluidframework/protocol-definitions';
19
+ import { IStream } from '@fluidframework/driver-definitions';
20
+ import { ISummaryContext } from '@fluidframework/driver-definitions';
21
+ import { ISummaryTree } from '@fluidframework/protocol-definitions';
22
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
23
+ import { ITokenClaims } from '@fluidframework/protocol-definitions';
24
+ import { ReadDocumentStorageServiceBase } from '@fluidframework/replay-driver';
25
+ import { TypedEventEmitter } from '@fluid-internal/client-utils';
26
+
27
+ /**
28
+ * Provides access to the underlying delta storage on the local file storage for file driver.
29
+ * @internal
30
+ */
31
+ export declare class FileDeltaStorageService implements IDocumentDeltaStorageService {
32
+ private readonly path;
33
+ private readonly messages;
34
+ private lastOps;
35
+ constructor(path: string);
36
+ fetchMessages(from: number, to: number | undefined, abortSignal?: AbortSignal, cachedOnly?: boolean): IStream<api.ISequencedDocumentMessage[]>;
37
+ get ops(): readonly Readonly<api.ISequencedDocumentMessage>[];
38
+ /**
39
+ * Retrieve ops within the exclusive sequence number range.
40
+ *
41
+ * @param from - First op to be fetched.
42
+ * @param to - Last op to be fetched. This is exclusive.
43
+ */
44
+ getFromWebSocket(from: number, to: number): api.ISequencedDocumentMessage[];
45
+ }
46
+
47
+ /**
48
+ * Factory for creating the file document service. Use this if you want to
49
+ * use the local file storage as underlying storage.
50
+ * @internal
51
+ */
52
+ export declare class FileDocumentServiceFactory implements IDocumentServiceFactory {
53
+ private readonly storage;
54
+ private readonly deltaStorage;
55
+ private readonly deltaConnection;
56
+ constructor(storage: IDocumentStorageService, deltaStorage: FileDeltaStorageService, deltaConnection: IDocumentDeltaConnection);
57
+ /**
58
+ * Creates the file document service if the path exists.
59
+ *
60
+ * @param fileURL - Path of directory containing ops/snapshots.
61
+ * @returns file document service.
62
+ */
63
+ createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
64
+ createContainer(createNewSummary: ISummaryTree, resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
65
+ }
66
+
67
+ /**
68
+ * @internal
69
+ */
70
+ export declare const FileSnapshotWriterClassFactory: <TBase extends ReaderConstructor>(Base: TBase) => {
71
+ new (...args: any[]): {
72
+ blobsWriter: Map<string, ArrayBufferLike>;
73
+ latestWriterTree?: api.ISnapshotTree | undefined;
74
+ docId?: string | undefined;
75
+ reset(): void;
76
+ onSnapshotHandler(snapshot: IFileSnapshot): void;
77
+ readBlob(sha: string): Promise<ArrayBufferLike>;
78
+ getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
79
+ getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
80
+ uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string>;
81
+ buildTree(snapshotTree: api.ISnapshotTree): Promise<api.ITree>;
82
+ repositoryUrl: string;
83
+ readonly policies?: IDocumentStorageServicePolicies | undefined;
84
+ createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse>;
85
+ downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree>;
86
+ readonly disposed?: boolean | undefined;
87
+ dispose?: ((error?: Error | undefined) => void) | undefined;
88
+ };
89
+ } & TBase;
90
+
91
+ /**
92
+ * @internal
93
+ */
94
+ export declare const FileStorageDocumentName = "FileStorageDocId";
95
+
96
+ /**
97
+ * Document storage service for the file driver.
98
+ * @internal
99
+ */
100
+ export declare class FluidFetchReader extends ReadDocumentStorageServiceBase implements IDocumentStorageService {
101
+ private readonly path;
102
+ private readonly versionName?;
103
+ protected docTree: api.ISnapshotTree | null;
104
+ constructor(path: string, versionName?: string | undefined);
105
+ /**
106
+ * Read the file and returns the snapshot tree.
107
+ * @param version - The version contains the path of the file which contains the snapshot tree.
108
+ */
109
+ getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
110
+ /**
111
+ * Gets the path of the snapshot tree to be read.
112
+ * @param versionId - version ID.
113
+ * @param count - Number of versions to be returned.
114
+ */
115
+ getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
116
+ readBlob(sha: string): Promise<ArrayBufferLike>;
117
+ }
118
+
119
+ /**
120
+ * @internal
121
+ */
122
+ export declare const FluidFetchReaderFileSnapshotWriter: {
123
+ new (...args: any[]): {
124
+ blobsWriter: Map<string, ArrayBufferLike>;
125
+ latestWriterTree?: api.ISnapshotTree | undefined;
126
+ docId?: string | undefined;
127
+ reset(): void;
128
+ onSnapshotHandler(snapshot: IFileSnapshot): void;
129
+ readBlob(sha: string): Promise<ArrayBufferLike>;
130
+ getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
131
+ getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
132
+ uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string>;
133
+ buildTree(snapshotTree: api.ISnapshotTree): Promise<api.ITree>;
134
+ repositoryUrl: string;
135
+ readonly policies?: IDocumentStorageServicePolicies | undefined;
136
+ createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse>;
137
+ downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree>;
138
+ readonly disposed?: boolean | undefined;
139
+ dispose?: ((error?: Error | undefined) => void) | undefined;
140
+ };
141
+ } & typeof FluidFetchReader;
142
+
143
+ /**
144
+ * @internal
145
+ */
146
+ export declare interface ISnapshotWriterStorage extends IDocumentStorageService {
147
+ onSnapshotHandler(snapshot: IFileSnapshot): void;
148
+ reset(): void;
149
+ }
150
+
151
+ /**
152
+ * @internal
153
+ */
154
+ export declare type ReaderConstructor = new (...args: any[]) => IDocumentStorageService;
155
+
156
+ /**
157
+ * Replay service used to play ops using the delta connection.
158
+ * @internal
159
+ */
160
+ export declare class Replayer {
161
+ private readonly deltaConnection;
162
+ private readonly documentStorageService;
163
+ private currentReplayOp;
164
+ constructor(deltaConnection: ReplayFileDeltaConnection, documentStorageService: FileDeltaStorageService);
165
+ get currentReplayedOp(): number;
166
+ set currentReplayedOp(op: number);
167
+ get ops(): readonly Readonly<ISequencedDocumentMessage>[];
168
+ /**
169
+ * Replay the ops upto a certain number.
170
+ * @param replayTo - The last op number to be replayed.
171
+ */
172
+ replay(replayTo: number): number;
173
+ private isDoneFetch;
174
+ private emit;
175
+ }
176
+
177
+ /**
178
+ * @internal
179
+ */
180
+ export declare class ReplayFileDeltaConnection extends TypedEventEmitter<IDocumentDeltaConnectionEvents> implements IDocumentDeltaConnection, IDisposable {
181
+ details: IConnected;
182
+ /**
183
+ * Mimic the delta connection to replay ops on it.
184
+ *
185
+ * @param documentDeltaStorageService - The delta storage service to get ops from.
186
+ * @returns Document delta connection.
187
+ */
188
+ static create(documentDeltaStorageService: FileDeltaStorageService): Promise<ReplayFileDeltaConnection>;
189
+ readonly maxMessageSize: number;
190
+ private readonly replayer;
191
+ constructor(details: IConnected, documentDeltaStorageService: FileDeltaStorageService);
192
+ getReplayer(): Replayer;
193
+ get clientId(): string;
194
+ get mode(): ConnectionMode;
195
+ get claims(): ITokenClaims;
196
+ get existing(): boolean;
197
+ get version(): string;
198
+ get initialMessages(): ISequencedDocumentMessage[];
199
+ get initialSignals(): ISignalMessage[];
200
+ get initialClients(): ISignalClient[];
201
+ get serviceConfiguration(): IClientConfiguration;
202
+ submit(documentMessages: IDocumentMessage[]): void;
203
+ submitSignal(message: any): Promise<void>;
204
+ private _disposed;
205
+ get disposed(): boolean;
206
+ dispose(): void;
207
+ }
208
+
209
+ export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/file-driver",
3
- "version": "2.0.0-internal.7.3.0",
3
+ "version": "2.0.0-internal.7.4.1",
4
4
  "description": "A driver that reads/write from/to local file storage.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -15,22 +15,24 @@
15
15
  "main": "dist/index.js",
16
16
  "types": "dist/index.d.ts",
17
17
  "dependencies": {
18
- "@fluid-internal/client-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
19
- "@fluidframework/core-interfaces": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
20
- "@fluidframework/core-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
21
- "@fluidframework/driver-definitions": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
22
- "@fluidframework/driver-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
18
+ "@fluid-internal/client-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
19
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
20
+ "@fluidframework/core-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
21
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
22
+ "@fluidframework/driver-utils": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0",
23
23
  "@fluidframework/protocol-definitions": "^3.0.0",
24
- "@fluidframework/replay-driver": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0"
24
+ "@fluidframework/replay-driver": ">=2.0.0-internal.7.4.1 <2.0.0-internal.7.5.0"
25
25
  },
26
26
  "devDependencies": {
27
+ "@arethetypeswrong/cli": "^0.13.3",
27
28
  "@fluid-tools/build-cli": "^0.28.0",
28
29
  "@fluidframework/build-common": "^2.0.3",
29
30
  "@fluidframework/build-tools": "^0.28.0",
30
31
  "@fluidframework/eslint-config-fluid": "^3.1.0",
31
32
  "@fluidframework/file-driver-previous": "npm:@fluidframework/file-driver@2.0.0-internal.7.2.0",
32
33
  "@microsoft/api-extractor": "^7.38.3",
33
- "@types/node": "^16.18.38",
34
+ "@types/node": "^18.19.0",
35
+ "copyfiles": "^2.4.1",
34
36
  "eslint": "~8.50.0",
35
37
  "prettier": "~3.0.3",
36
38
  "rimraf": "^4.4.0",
@@ -38,6 +40,14 @@
38
40
  },
39
41
  "fluidBuild": {
40
42
  "tasks": {
43
+ "build:docs": {
44
+ "dependsOn": [
45
+ "...",
46
+ "api-extractor:commonjs",
47
+ "api-extractor:esnext"
48
+ ],
49
+ "script": false
50
+ },
41
51
  "tsc": [
42
52
  "...",
43
53
  "typetests:gen"
@@ -48,18 +58,23 @@
48
58
  "broken": {}
49
59
  },
50
60
  "scripts": {
61
+ "api": "fluid-build . --task api",
62
+ "api-extractor:commonjs": "api-extractor run --local",
63
+ "api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
51
64
  "build": "fluid-build . --task build",
52
65
  "build:compile": "fluid-build . --task compile",
53
- "build:docs": "api-extractor run --local",
66
+ "build:docs": "fluid-build . --task api",
67
+ "check:are-the-types-wrong": "attw --pack",
68
+ "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
54
69
  "ci:build:docs": "api-extractor run",
55
70
  "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
56
71
  "eslint": "eslint --format stylish src",
57
72
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
58
73
  "format": "npm run prettier:fix",
59
- "lint": "npm run prettier && npm run eslint",
74
+ "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
60
75
  "lint:fix": "npm run prettier:fix && npm run eslint:fix",
61
- "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
62
- "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
76
+ "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
77
+ "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
63
78
  "tsc": "tsc",
64
79
  "typetests:gen": "fluid-type-test-generator",
65
80
  "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
@@ -11,6 +11,7 @@ import * as api from "@fluidframework/protocol-definitions";
11
11
 
12
12
  /**
13
13
  * Provides access to the underlying delta storage on the local file storage for file driver.
14
+ * @internal
14
15
  */
15
16
  export class FileDeltaStorageService implements IDocumentDeltaStorageService {
16
17
  private readonly messages: api.ISequencedDocumentMessage[];
@@ -45,6 +45,7 @@ const Claims: ITokenClaims = {
45
45
 
46
46
  /**
47
47
  * Replay service used to play ops using the delta connection.
48
+ * @internal
48
49
  */
49
50
  export class Replayer {
50
51
  private currentReplayOp = 0;
@@ -110,6 +111,9 @@ export class Replayer {
110
111
  }
111
112
  }
112
113
 
114
+ /**
115
+ * @internal
116
+ */
113
117
  export class ReplayFileDeltaConnection
114
118
  extends TypedEventEmitter<IDocumentDeltaConnectionEvents>
115
119
  implements IDocumentDeltaConnection, IDisposable
@@ -18,6 +18,7 @@ import { FileDocumentService } from "./fileDocumentService";
18
18
  /**
19
19
  * Factory for creating the file document service. Use this if you want to
20
20
  * use the local file storage as underlying storage.
21
+ * @internal
21
22
  */
22
23
  export class FileDocumentServiceFactory implements IDocumentServiceFactory {
23
24
  constructor(
@@ -13,6 +13,9 @@ import { IFileSnapshot, ReadDocumentStorageServiceBase } from "@fluidframework/r
13
13
 
14
14
  // This ID is used by replay tool as Document Id.
15
15
  // We leverage it to figure out when container is asking for root document tree.
16
+ /**
17
+ * @internal
18
+ */
16
19
  export const FileStorageDocumentName = "FileStorageDocId"; // Some unique document name
17
20
 
18
21
  // Tree ID use to communicate between getVersions() & getSnapshotTree() that IVersion is ours.
@@ -20,6 +23,7 @@ const FileStorageVersionTreeId = "FileStorageTreeId";
20
23
 
21
24
  /**
22
25
  * Document storage service for the file driver.
26
+ * @internal
23
27
  */
24
28
  export class FluidFetchReader
25
29
  extends ReadDocumentStorageServiceBase
@@ -110,12 +114,21 @@ export class FluidFetchReader
110
114
  }
111
115
  }
112
116
 
117
+ /**
118
+ * @internal
119
+ */
113
120
  export interface ISnapshotWriterStorage extends IDocumentStorageService {
114
121
  onSnapshotHandler(snapshot: IFileSnapshot): void;
115
122
  reset(): void;
116
123
  }
117
124
 
125
+ /**
126
+ * @internal
127
+ */
118
128
  export type ReaderConstructor = new (...args: any[]) => IDocumentStorageService;
129
+ /**
130
+ * @internal
131
+ */
119
132
  export const FileSnapshotWriterClassFactory = <TBase extends ReaderConstructor>(Base: TBase) =>
120
133
  class extends Base implements ISnapshotWriterStorage {
121
134
  // Note: if variable name has same name as in base class, it overrides it!
@@ -228,4 +241,7 @@ function removeNullTreeIds(tree: api.ITree) {
228
241
  );
229
242
  delete tree.id;
230
243
  }
244
+ /**
245
+ * @internal
246
+ */
231
247
  export const FluidFetchReaderFileSnapshotWriter = FileSnapshotWriterClassFactory(FluidFetchReader);