@fluidframework/file-driver 2.0.0-rc.1.0.3 → 2.0.0-rc.2.0.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 (67) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +4 -1
  2. package/CHANGELOG.md +20 -0
  3. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -2
  4. package/api-extractor-lint.json +1 -1
  5. package/api-extractor.json +1 -1
  6. package/api-report/file-driver.api.md +4 -2
  7. package/dist/file-driver-alpha.d.ts +2 -0
  8. package/dist/file-driver-beta.d.ts +2 -0
  9. package/dist/file-driver-public.d.ts +2 -0
  10. package/dist/file-driver-untrimmed.d.ts +4 -2
  11. package/dist/fileDocumentDeltaConnection.d.ts +1 -1
  12. package/dist/fileDocumentDeltaConnection.d.ts.map +1 -1
  13. package/dist/fileDocumentDeltaConnection.js.map +1 -1
  14. package/dist/fileDocumentService.d.ts +3 -2
  15. package/dist/fileDocumentService.d.ts.map +1 -1
  16. package/dist/fileDocumentService.js +3 -1
  17. package/dist/fileDocumentService.js.map +1 -1
  18. package/dist/fileDocumentServiceFactory.d.ts +1 -1
  19. package/dist/fileDocumentServiceFactory.d.ts.map +1 -1
  20. package/dist/fileDocumentServiceFactory.js +2 -2
  21. package/dist/fileDocumentServiceFactory.js.map +1 -1
  22. package/dist/fileDocumentStorageService.d.ts +2 -2
  23. package/dist/index.d.ts +4 -4
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +12 -12
  26. package/dist/index.js.map +1 -1
  27. package/dist/package.json +3 -0
  28. package/dist/tsdoc-metadata.json +1 -1
  29. package/lib/file-driver-alpha.d.ts +53 -0
  30. package/lib/file-driver-beta.d.ts +71 -0
  31. package/lib/file-driver-public.d.ts +71 -0
  32. package/lib/file-driver-untrimmed.d.ts +211 -0
  33. package/lib/fileDeltaStorageService.d.ts +26 -0
  34. package/lib/fileDeltaStorageService.d.ts.map +1 -0
  35. package/lib/fileDeltaStorageService.js +59 -0
  36. package/lib/fileDeltaStorageService.js.map +1 -0
  37. package/lib/fileDocumentDeltaConnection.d.ts +61 -0
  38. package/lib/fileDocumentDeltaConnection.d.ts.map +1 -0
  39. package/lib/fileDocumentDeltaConnection.js +161 -0
  40. package/lib/fileDocumentDeltaConnection.js.map +1 -0
  41. package/lib/fileDocumentService.d.ts +31 -0
  42. package/lib/fileDocumentService.d.ts.map +1 -0
  43. package/lib/fileDocumentService.js +37 -0
  44. package/lib/fileDocumentService.js.map +1 -0
  45. package/lib/fileDocumentServiceFactory.d.ts +28 -0
  46. package/lib/fileDocumentServiceFactory.d.ts.map +1 -0
  47. package/lib/fileDocumentServiceFactory.js +31 -0
  48. package/lib/fileDocumentServiceFactory.js.map +1 -0
  49. package/lib/fileDocumentStorageService.d.ts +91 -0
  50. package/lib/fileDocumentStorageService.d.ts.map +1 -0
  51. package/lib/fileDocumentStorageService.js +197 -0
  52. package/lib/fileDocumentStorageService.js.map +1 -0
  53. package/lib/index.d.ts +9 -0
  54. package/lib/index.d.ts.map +1 -0
  55. package/lib/index.js +9 -0
  56. package/lib/index.js.map +1 -0
  57. package/lib/test/types/validateFileDriverPrevious.generated.d.ts +2 -0
  58. package/lib/test/types/validateFileDriverPrevious.generated.d.ts.map +1 -0
  59. package/lib/test/types/validateFileDriverPrevious.generated.js +26 -0
  60. package/lib/test/types/validateFileDriverPrevious.generated.js.map +1 -0
  61. package/package.json +61 -19
  62. package/src/fileDocumentDeltaConnection.ts +1 -1
  63. package/src/fileDocumentService.ts +9 -3
  64. package/src/fileDocumentServiceFactory.ts +2 -2
  65. package/src/index.ts +4 -4
  66. package/tsconfig.cjs.json +7 -0
  67. package/tsconfig.json +2 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileDocumentService.d.ts","sourceRoot":"","sources":["../src/fileDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,GAAG,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE;;;GAGG;AAEH,qBAAa,mBACZ,SAAQ,iBAAiB,CAAC,GAAG,CAAC,sBAAsB,CACpD,YAAW,GAAG,CAAC,gBAAgB;aAGd,WAAW,EAAE,GAAG,CAAC,YAAY;IAC7C,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAHhB,WAAW,EAAE,GAAG,CAAC,YAAY,EAC5B,OAAO,EAAE,GAAG,CAAC,uBAAuB,EACpC,YAAY,EAAE,uBAAuB,EACrC,eAAe,EAAE,GAAG,CAAC,wBAAwB;IAKxD,OAAO;IAED,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;IAIxD,qBAAqB,IAAI,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC;IAI/E;;;;;;OAMG;IACU,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;CAGzF"}
@@ -0,0 +1,37 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { TypedEventEmitter } from "@fluid-internal/client-utils";
6
+ /**
7
+ * The DocumentService manages the different endpoints for connecting to
8
+ * underlying storage for file document service.
9
+ */
10
+ // eslint-disable-next-line import/namespace
11
+ export class FileDocumentService extends TypedEventEmitter {
12
+ constructor(resolvedUrl, storage, deltaStorage, deltaConnection) {
13
+ super();
14
+ this.resolvedUrl = resolvedUrl;
15
+ this.storage = storage;
16
+ this.deltaStorage = deltaStorage;
17
+ this.deltaConnection = deltaConnection;
18
+ }
19
+ dispose() { }
20
+ async connectToStorage() {
21
+ return this.storage;
22
+ }
23
+ async connectToDeltaStorage() {
24
+ return this.deltaStorage;
25
+ }
26
+ /**
27
+ * Connects to a delta storage endpoint of provided documentService to get ops and then replaying
28
+ * them so as to mimic a delta stream endpoint.
29
+ *
30
+ * @param client - Client that connects to socket.
31
+ * @returns returns the delta stream service.
32
+ */
33
+ async connectToDeltaStream(client) {
34
+ return this.deltaConnection;
35
+ }
36
+ }
37
+ //# sourceMappingURL=fileDocumentService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileDocumentService.js","sourceRoot":"","sources":["../src/fileDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAKjE;;;GAGG;AACH,4CAA4C;AAC5C,MAAM,OAAO,mBACZ,SAAQ,iBAA6C;IAGrD,YACiB,WAA6B,EAC5B,OAAoC,EACpC,YAAqC,EACrC,eAA6C;QAE9D,KAAK,EAAE,CAAC;QALQ,gBAAW,GAAX,WAAW,CAAkB;QAC5B,YAAO,GAAP,OAAO,CAA6B;QACpC,iBAAY,GAAZ,YAAY,CAAyB;QACrC,oBAAe,GAAf,eAAe,CAA8B;IAG/D,CAAC;IAEM,OAAO,KAAI,CAAC;IAEZ,KAAK,CAAC,gBAAgB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,qBAAqB;QACjC,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAChD,OAAO,IAAI,CAAC,eAAe,CAAC;IAC7B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport * as api from \"@fluidframework/driver-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\nimport { FileDeltaStorageService } from \"./fileDeltaStorageService.js\";\n\n/**\n * The DocumentService manages the different endpoints for connecting to\n * underlying storage for file document service.\n */\n// eslint-disable-next-line import/namespace\nexport class FileDocumentService\n\textends TypedEventEmitter<api.IDocumentServiceEvents>\n\timplements api.IDocumentService\n{\n\tconstructor(\n\t\tpublic readonly resolvedUrl: api.IResolvedUrl,\n\t\tprivate readonly storage: api.IDocumentStorageService,\n\t\tprivate readonly deltaStorage: FileDeltaStorageService,\n\t\tprivate readonly deltaConnection: api.IDocumentDeltaConnection,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic dispose() {}\n\n\tpublic async connectToStorage(): Promise<api.IDocumentStorageService> {\n\t\treturn this.storage;\n\t}\n\n\tpublic async connectToDeltaStorage(): Promise<api.IDocumentDeltaStorageService> {\n\t\treturn this.deltaStorage;\n\t}\n\n\t/**\n\t * Connects to a delta storage endpoint of provided documentService to get ops and then replaying\n\t * them so as to mimic a delta stream endpoint.\n\t *\n\t * @param client - Client that connects to socket.\n\t * @returns returns the delta stream service.\n\t */\n\tpublic async connectToDeltaStream(client: IClient): Promise<api.IDocumentDeltaConnection> {\n\t\treturn this.deltaConnection;\n\t}\n}\n"]}
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { IDocumentDeltaConnection, IDocumentService, IDocumentServiceFactory, IDocumentStorageService, IResolvedUrl } from "@fluidframework/driver-definitions";
6
+ import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
+ import { ISummaryTree } from "@fluidframework/protocol-definitions";
8
+ import { FileDeltaStorageService } from "./fileDeltaStorageService.js";
9
+ /**
10
+ * Factory for creating the file document service. Use this if you want to
11
+ * use the local file storage as underlying storage.
12
+ * @internal
13
+ */
14
+ export declare class FileDocumentServiceFactory implements IDocumentServiceFactory {
15
+ private readonly storage;
16
+ private readonly deltaStorage;
17
+ private readonly deltaConnection;
18
+ constructor(storage: IDocumentStorageService, deltaStorage: FileDeltaStorageService, deltaConnection: IDocumentDeltaConnection);
19
+ /**
20
+ * Creates the file document service if the path exists.
21
+ *
22
+ * @param fileURL - Path of directory containing ops/snapshots.
23
+ * @returns file document service.
24
+ */
25
+ createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
26
+ createContainer(createNewSummary: ISummaryTree, resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
27
+ }
28
+ //# sourceMappingURL=fileDocumentServiceFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/fileDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGvE;;;;GAIG;AACH,qBAAa,0BAA2B,YAAW,uBAAuB;IAExE,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAFf,OAAO,EAAE,uBAAuB,EAChC,YAAY,EAAE,uBAAuB,EACrC,eAAe,EAAE,wBAAwB;IAG3D;;;;;OAKG;IACU,qBAAqB,CACjC,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;IAUf,eAAe,CAC3B,gBAAgB,EAAE,YAAY,EAC9B,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;CAG5B"}
@@ -0,0 +1,31 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { FileDocumentService } from "./fileDocumentService.js";
6
+ /**
7
+ * Factory for creating the file document service. Use this if you want to
8
+ * use the local file storage as underlying storage.
9
+ * @internal
10
+ */
11
+ export class FileDocumentServiceFactory {
12
+ constructor(storage, deltaStorage, deltaConnection) {
13
+ this.storage = storage;
14
+ this.deltaStorage = deltaStorage;
15
+ this.deltaConnection = deltaConnection;
16
+ }
17
+ /**
18
+ * Creates the file document service if the path exists.
19
+ *
20
+ * @param fileURL - Path of directory containing ops/snapshots.
21
+ * @returns file document service.
22
+ */
23
+ async createDocumentService(resolvedUrl, logger, clientIsSummarizer) {
24
+ return new FileDocumentService(resolvedUrl, this.storage, this.deltaStorage, this.deltaConnection);
25
+ }
26
+ // TODO: Issue-2109 Implement detach container api or put appropriate comment.
27
+ async createContainer(createNewSummary, resolvedUrl, logger, clientIsSummarizer) {
28
+ throw new Error("Not implemented");
29
+ }
30
+ }
31
+ //# sourceMappingURL=fileDocumentServiceFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileDocumentServiceFactory.js","sourceRoot":"","sources":["../src/fileDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;;GAIG;AACH,MAAM,OAAO,0BAA0B;IACtC,YACkB,OAAgC,EAChC,YAAqC,EACrC,eAAyC;QAFzC,YAAO,GAAP,OAAO,CAAyB;QAChC,iBAAY,GAAZ,YAAY,CAAyB;QACrC,oBAAe,GAAf,eAAe,CAA0B;IACxD,CAAC;IAEJ;;;;;OAKG;IACI,KAAK,CAAC,qBAAqB,CACjC,WAAyB,EACzB,MAA6B,EAC7B,kBAA4B;QAE5B,OAAO,IAAI,mBAAmB,CAC7B,WAAW,EACX,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,eAAe,CACpB,CAAC;IACH,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,eAAe,CAC3B,gBAA8B,EAC9B,WAAyB,EACzB,MAA6B,EAC7B,kBAA4B;QAE5B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDocumentDeltaConnection,\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { FileDeltaStorageService } from \"./fileDeltaStorageService.js\";\nimport { FileDocumentService } from \"./fileDocumentService.js\";\n\n/**\n * Factory for creating the file document service. Use this if you want to\n * use the local file storage as underlying storage.\n * @internal\n */\nexport class FileDocumentServiceFactory implements IDocumentServiceFactory {\n\tconstructor(\n\t\tprivate readonly storage: IDocumentStorageService,\n\t\tprivate readonly deltaStorage: FileDeltaStorageService,\n\t\tprivate readonly deltaConnection: IDocumentDeltaConnection,\n\t) {}\n\n\t/**\n\t * Creates the file document service if the path exists.\n\t *\n\t * @param fileURL - Path of directory containing ops/snapshots.\n\t * @returns file document service.\n\t */\n\tpublic async createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn new FileDocumentService(\n\t\t\tresolvedUrl,\n\t\t\tthis.storage,\n\t\t\tthis.deltaStorage,\n\t\t\tthis.deltaConnection,\n\t\t);\n\t}\n\n\t// TODO: Issue-2109 Implement detach container api or put appropriate comment.\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n}\n"]}
@@ -0,0 +1,91 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { IDocumentStorageService, ISummaryContext } from "@fluidframework/driver-definitions";
6
+ import * as api from "@fluidframework/protocol-definitions";
7
+ import { IFileSnapshot, ReadDocumentStorageServiceBase } from "@fluidframework/replay-driver";
8
+ /**
9
+ * @internal
10
+ */
11
+ export declare const FileStorageDocumentName = "FileStorageDocId";
12
+ /**
13
+ * Document storage service for the file driver.
14
+ * @internal
15
+ */
16
+ export declare class FluidFetchReader extends ReadDocumentStorageServiceBase implements IDocumentStorageService {
17
+ private readonly path;
18
+ private readonly versionName?;
19
+ protected docTree: api.ISnapshotTree | null;
20
+ constructor(path: string, versionName?: string | undefined);
21
+ /**
22
+ * Read the file and returns the snapshot tree.
23
+ * @param version - The version contains the path of the file which contains the snapshot tree.
24
+ */
25
+ getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
26
+ /**
27
+ * Gets the path of the snapshot tree to be read.
28
+ * @param versionId - version ID.
29
+ * @param count - Number of versions to be returned.
30
+ */
31
+ getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
32
+ readBlob(sha: string): Promise<ArrayBufferLike>;
33
+ }
34
+ /**
35
+ * @internal
36
+ */
37
+ export interface ISnapshotWriterStorage extends IDocumentStorageService {
38
+ onSnapshotHandler(snapshot: IFileSnapshot): void;
39
+ reset(): void;
40
+ }
41
+ /**
42
+ * @internal
43
+ */
44
+ export type ReaderConstructor = new (...args: any[]) => IDocumentStorageService;
45
+ /**
46
+ * @internal
47
+ */
48
+ export declare const FileSnapshotWriterClassFactory: <TBase extends ReaderConstructor>(Base: TBase) => {
49
+ new (...args: any[]): {
50
+ blobsWriter: Map<string, ArrayBufferLike>;
51
+ latestWriterTree?: api.ISnapshotTree | undefined;
52
+ docId?: string | undefined;
53
+ reset(): void;
54
+ onSnapshotHandler(snapshot: IFileSnapshot): void;
55
+ readBlob(sha: string): Promise<ArrayBufferLike>;
56
+ getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
57
+ getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
58
+ uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string>;
59
+ buildTree(snapshotTree: api.ISnapshotTree): Promise<api.ITree>;
60
+ readonly policies?: import("@fluidframework/driver-definitions").IDocumentStorageServicePolicies | undefined;
61
+ getSnapshot?(snapshotFetchOptions?: import("@fluidframework/driver-definitions").ISnapshotFetchOptions | undefined): Promise<import("@fluidframework/driver-definitions").ISnapshot>;
62
+ createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse>;
63
+ downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree>;
64
+ readonly disposed?: boolean | undefined;
65
+ dispose?: ((error?: Error | undefined) => void) | undefined;
66
+ };
67
+ } & TBase;
68
+ /**
69
+ * @internal
70
+ */
71
+ export declare const FluidFetchReaderFileSnapshotWriter: {
72
+ new (...args: any[]): {
73
+ blobsWriter: Map<string, ArrayBufferLike>;
74
+ latestWriterTree?: api.ISnapshotTree | undefined;
75
+ docId?: string | undefined;
76
+ reset(): void;
77
+ onSnapshotHandler(snapshot: IFileSnapshot): void;
78
+ readBlob(sha: string): Promise<ArrayBufferLike>;
79
+ getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
80
+ getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
81
+ uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string>;
82
+ buildTree(snapshotTree: api.ISnapshotTree): Promise<api.ITree>;
83
+ readonly policies?: import("@fluidframework/driver-definitions").IDocumentStorageServicePolicies | undefined;
84
+ getSnapshot?(snapshotFetchOptions?: import("@fluidframework/driver-definitions").ISnapshotFetchOptions | undefined): Promise<import("@fluidframework/driver-definitions").ISnapshot>;
85
+ createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse>;
86
+ downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree>;
87
+ readonly disposed?: boolean | undefined;
88
+ dispose?: ((error?: Error | undefined) => void) | undefined;
89
+ };
90
+ } & typeof FluidFetchReader;
91
+ //# sourceMappingURL=fileDocumentStorageService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/fileDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE9F,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAI9F;;GAEG;AACH,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAK1D;;;GAGG;AACH,qBAAa,gBACZ,SAAQ,8BACR,YAAW,uBAAuB;IAKjC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAJ9B,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,aAAa,GAAG,IAAI,CAAQ;gBAGjC,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,oBAAQ;IAKtC;;;OAGG;IAEU,eAAe,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC;IAkCvF;;;;OAIG;IAEU,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE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(c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import fs from "fs";
6
+ import { bufferToString } from "@fluid-internal/client-utils";
7
+ import { assert } from "@fluidframework/core-utils";
8
+ import { buildSnapshotTree, convertSummaryTreeToSnapshotITree } from "@fluidframework/driver-utils";
9
+ import * as api from "@fluidframework/protocol-definitions";
10
+ import { ReadDocumentStorageServiceBase } from "@fluidframework/replay-driver";
11
+ // This ID is used by replay tool as Document Id.
12
+ // We leverage it to figure out when container is asking for root document tree.
13
+ /**
14
+ * @internal
15
+ */
16
+ export const FileStorageDocumentName = "FileStorageDocId"; // Some unique document name
17
+ // Tree ID use to communicate between getVersions() & getSnapshotTree() that IVersion is ours.
18
+ const FileStorageVersionTreeId = "FileStorageTreeId";
19
+ /**
20
+ * Document storage service for the file driver.
21
+ * @internal
22
+ */
23
+ export class FluidFetchReader extends ReadDocumentStorageServiceBase {
24
+ constructor(path, versionName) {
25
+ super();
26
+ this.path = path;
27
+ this.versionName = versionName;
28
+ this.docTree = null;
29
+ }
30
+ /**
31
+ * Read the file and returns the snapshot tree.
32
+ * @param version - The version contains the path of the file which contains the snapshot tree.
33
+ */
34
+ // eslint-disable-next-line @rushstack/no-new-null
35
+ async getSnapshotTree(version) {
36
+ assert(version !== null, 0x092 /* "version input for reading snapshot tree is null!" */);
37
+ assert(!version || version.treeId === FileStorageVersionTreeId, 0x093 /* "invalid version input for reading snapshot tree!" */);
38
+ let filename;
39
+ let rootTree = false;
40
+ if (!version || version.id === "latest") {
41
+ if (this.docTree) {
42
+ return this.docTree;
43
+ }
44
+ if (this.versionName === undefined) {
45
+ return null;
46
+ }
47
+ rootTree = true;
48
+ filename = `${this.path}/${this.versionName}/tree.json`;
49
+ }
50
+ else {
51
+ filename = `${this.path}/${this.versionName}/${version.id}.json`;
52
+ }
53
+ if (!fs.existsSync(filename)) {
54
+ throw new Error(`Can't find file ${filename}`);
55
+ }
56
+ const data = fs.readFileSync(filename);
57
+ const tree = JSON.parse(data.toString("utf-8"));
58
+ if (rootTree) {
59
+ this.docTree = tree;
60
+ }
61
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
62
+ return tree;
63
+ }
64
+ /**
65
+ * Gets the path of the snapshot tree to be read.
66
+ * @param versionId - version ID.
67
+ * @param count - Number of versions to be returned.
68
+ */
69
+ // eslint-disable-next-line @rushstack/no-new-null
70
+ async getVersions(versionId, count) {
71
+ if (versionId === FileStorageDocumentName || versionId === null) {
72
+ if (this.docTree !== null || this.versionName !== undefined) {
73
+ return [{ id: "latest", treeId: FileStorageVersionTreeId }];
74
+ }
75
+ // Started with ops - return empty set.
76
+ return [];
77
+ }
78
+ else if (this.versionName !== undefined) {
79
+ assert(!!this.docTree, 0x094 /* "Missing snapshot tree!" */);
80
+ return [
81
+ {
82
+ id: versionId,
83
+ treeId: FileStorageVersionTreeId,
84
+ },
85
+ ];
86
+ }
87
+ throw new Error(`Unknown version: ${versionId}`);
88
+ }
89
+ async readBlob(sha) {
90
+ if (this.versionName !== undefined) {
91
+ const fileName = `${this.path}/${this.versionName}/${sha}`;
92
+ if (fs.existsSync(fileName)) {
93
+ const data = fs.readFileSync(fileName);
94
+ return data;
95
+ }
96
+ }
97
+ throw new Error(`Can't find blob ${sha}`);
98
+ }
99
+ }
100
+ /**
101
+ * @internal
102
+ */
103
+ export const FileSnapshotWriterClassFactory = (Base) => class extends Base {
104
+ constructor() {
105
+ super(...arguments);
106
+ // Note: if variable name has same name as in base class, it overrides it!
107
+ this.blobsWriter = new Map();
108
+ }
109
+ reset() {
110
+ this.blobsWriter = new Map();
111
+ this.latestWriterTree = undefined;
112
+ this.docId = undefined;
113
+ }
114
+ onSnapshotHandler(snapshot) {
115
+ throw new Error("onSnapshotHandler is not setup! Please provide your handler!");
116
+ }
117
+ async readBlob(sha) {
118
+ const blob = this.blobsWriter.get(sha);
119
+ if (blob !== undefined) {
120
+ return blob;
121
+ }
122
+ return super.readBlob(sha);
123
+ }
124
+ // eslint-disable-next-line @rushstack/no-new-null
125
+ async getVersions(versionId, count) {
126
+ // If we already saved document, that means we are getting here because of snapshot generation.
127
+ // Not returning tree ensures that ContainerRuntime.snapshot() would regenerate subtrees for
128
+ // each unchanged data store.
129
+ // If we want to change that, we would need to capture docId on first call and return this.latestWriterTree
130
+ // when latest is requested.
131
+ if (this.latestWriterTree && (this.docId === versionId || versionId === null)) {
132
+ return [{ id: "latest", treeId: FileStorageVersionTreeId }];
133
+ }
134
+ if (this.docId === undefined && versionId !== null) {
135
+ this.docId = versionId;
136
+ }
137
+ return super.getVersions(versionId, count);
138
+ }
139
+ // eslint-disable-next-line @rushstack/no-new-null
140
+ async getSnapshotTree(version) {
141
+ if (this.latestWriterTree && (!version || version.id === "latest")) {
142
+ return this.latestWriterTree;
143
+ }
144
+ return super.getSnapshotTree(version);
145
+ }
146
+ async uploadSummaryWithContext(summary, context) {
147
+ const tree = convertSummaryTreeToSnapshotITree(summary);
148
+ // Remove tree IDs for easier comparison of snapshots
149
+ delete tree.id;
150
+ removeNullTreeIds(tree);
151
+ this.latestWriterTree = buildSnapshotTree(tree.entries, this.blobsWriter);
152
+ const fileSnapshot = { tree, commits: {} };
153
+ this.onSnapshotHandler(fileSnapshot);
154
+ return "testHandleId";
155
+ }
156
+ async buildTree(snapshotTree) {
157
+ const tree = { entries: [] };
158
+ for (const subTreeId of Object.keys(snapshotTree.trees)) {
159
+ const subTree = await this.buildTree(snapshotTree.trees[subTreeId]);
160
+ tree.entries.push({
161
+ mode: api.FileMode.Directory,
162
+ path: subTreeId,
163
+ type: api.TreeEntry.Tree,
164
+ value: subTree,
165
+ });
166
+ }
167
+ for (const blobName of Object.keys(snapshotTree.blobs)) {
168
+ const buffer = await this.readBlob(snapshotTree.blobs[blobName]);
169
+ const contents = bufferToString(buffer, "utf8");
170
+ const blob = {
171
+ contents,
172
+ encoding: "utf-8",
173
+ };
174
+ tree.entries.push({
175
+ mode: api.FileMode.File,
176
+ path: blobName,
177
+ type: api.TreeEntry.Blob,
178
+ value: blob,
179
+ });
180
+ }
181
+ return tree;
182
+ }
183
+ };
184
+ function removeNullTreeIds(tree) {
185
+ for (const node of tree.entries) {
186
+ if (node.type === api.TreeEntry.Tree) {
187
+ removeNullTreeIds(node.value);
188
+ }
189
+ }
190
+ assert(tree.id === undefined || tree.id === null, 0x096 /* "Trying to remove valid tree IDs in removeNullTreeIds()!" */);
191
+ delete tree.id;
192
+ }
193
+ /**
194
+ * @internal
195
+ */
196
+ export const FluidFetchReaderFileSnapshotWriter = FileSnapshotWriterClassFactory(FluidFetchReader);
197
+ //# sourceMappingURL=fileDocumentStorageService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileDocumentStorageService.js","sourceRoot":"","sources":["../src/fileDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,iCAAiC,EAAE,MAAM,8BAA8B,CAAC;AACpG,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAiB,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAE9F,iDAAiD;AACjD,gFAAgF;AAChF;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAC,CAAC,4BAA4B;AAEvF,8FAA8F;AAC9F,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;AAErD;;;GAGG;AACH,MAAM,OAAO,gBACZ,SAAQ,8BAA8B;IAKtC,YACkB,IAAY,EACZ,WAAoB;QAErC,KAAK,EAAE,CAAC;QAHS,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAS;QAJ5B,YAAO,GAA6B,IAAI,CAAC;IAOnD,CAAC;IAED;;;OAGG;IACH,kDAAkD;IAC3C,KAAK,CA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EAAE,MAAM,CAAC,CAAC;YAChD,MAAM,IAAI,GAAc;gBACvB,QAAQ;gBACR,QAAQ,EAAE,OAAO;aACjB,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;gBACjB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,IAAI;gBACvB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,GAAG,CAAC,SAAS,CAAC,IAAI;gBACxB,KAAK,EAAE,IAAI;aACX,CAAC,CAAC;SACH;QAED,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAC;AAEH,SAAS,iBAAiB,CAAC,IAAe;IACzC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;QAChC,IAAI,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE;YACrC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC9B;KACD;IACD,MAAM,CACL,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,EACzC,KAAK,CAAC,+DAA+D,CACrE,CAAC;IACF,OAAO,IAAI,CAAC,EAAE,CAAC;AAChB,CAAC;AACD;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,8BAA8B,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport fs from \"fs\";\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDocumentStorageService, ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport { buildSnapshotTree, convertSummaryTreeToSnapshotITree } from \"@fluidframework/driver-utils\";\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { IFileSnapshot, ReadDocumentStorageServiceBase } from \"@fluidframework/replay-driver\";\n\n// This ID is used by replay tool as Document Id.\n// We leverage it to figure out when container is asking for root document tree.\n/**\n * @internal\n */\nexport const FileStorageDocumentName = \"FileStorageDocId\"; // Some unique document name\n\n// Tree ID use to communicate between getVersions() & getSnapshotTree() that IVersion is ours.\nconst FileStorageVersionTreeId = \"FileStorageTreeId\";\n\n/**\n * Document storage service for the file driver.\n * @internal\n */\nexport class FluidFetchReader\n\textends ReadDocumentStorageServiceBase\n\timplements IDocumentStorageService\n{\n\tprotected docTree: api.ISnapshotTree | null = null;\n\n\tconstructor(\n\t\tprivate readonly path: string,\n\t\tprivate readonly versionName?: string,\n\t) {\n\t\tsuper();\n\t}\n\n\t/**\n\t * Read the file and returns the snapshot tree.\n\t * @param version - The version contains the path of the file which contains the snapshot tree.\n\t */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null> {\n\t\tassert(version !== null, 0x092 /* \"version input for reading snapshot tree is null!\" */);\n\t\tassert(\n\t\t\t!version || version.treeId === FileStorageVersionTreeId,\n\t\t\t0x093 /* \"invalid version input for reading snapshot tree!\" */,\n\t\t);\n\n\t\tlet filename: string;\n\t\tlet rootTree = false;\n\t\tif (!version || version.id === \"latest\") {\n\t\t\tif (this.docTree) {\n\t\t\t\treturn this.docTree;\n\t\t\t}\n\t\t\tif (this.versionName === undefined) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\trootTree = true;\n\t\t\tfilename = `${this.path}/${this.versionName}/tree.json`;\n\t\t} else {\n\t\t\tfilename = `${this.path}/${this.versionName}/${version.id}.json`;\n\t\t}\n\n\t\tif (!fs.existsSync(filename)) {\n\t\t\tthrow new Error(`Can't find file ${filename}`);\n\t\t}\n\t\tconst data = fs.readFileSync(filename);\n\t\tconst tree = JSON.parse(data.toString(\"utf-8\"));\n\t\tif (rootTree) {\n\t\t\tthis.docTree = tree;\n\t\t}\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn tree;\n\t}\n\n\t/**\n\t * Gets the path of the snapshot tree to be read.\n\t * @param versionId - version ID.\n\t * @param count - Number of versions to be returned.\n\t */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getVersions(versionId: string | null, count: number): Promise<api.IVersion[]> {\n\t\tif (versionId === FileStorageDocumentName || versionId === null) {\n\t\t\tif (this.docTree !== null || this.versionName !== undefined) {\n\t\t\t\treturn [{ id: \"latest\", treeId: FileStorageVersionTreeId }];\n\t\t\t}\n\t\t\t// Started with ops - return empty set.\n\t\t\treturn [];\n\t\t} else if (this.versionName !== undefined) {\n\t\t\tassert(!!this.docTree, 0x094 /* \"Missing snapshot tree!\" */);\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: versionId,\n\t\t\t\t\ttreeId: FileStorageVersionTreeId,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\tthrow new Error(`Unknown version: ${versionId}`);\n\t}\n\n\tpublic async readBlob(sha: string): Promise<ArrayBufferLike> {\n\t\tif (this.versionName !== undefined) {\n\t\t\tconst fileName = `${this.path}/${this.versionName}/${sha}`;\n\t\t\tif (fs.existsSync(fileName)) {\n\t\t\t\tconst data = fs.readFileSync(fileName);\n\t\t\t\treturn data;\n\t\t\t}\n\t\t}\n\t\tthrow new Error(`Can't find blob ${sha}`);\n\t}\n}\n\n/**\n * @internal\n */\nexport interface ISnapshotWriterStorage extends IDocumentStorageService {\n\tonSnapshotHandler(snapshot: IFileSnapshot): void;\n\treset(): void;\n}\n\n/**\n * @internal\n */\nexport type ReaderConstructor = new (...args: any[]) => IDocumentStorageService;\n/**\n * @internal\n */\nexport const FileSnapshotWriterClassFactory = <TBase extends ReaderConstructor>(Base: TBase) =>\n\tclass extends Base implements ISnapshotWriterStorage {\n\t\t// Note: if variable name has same name as in base class, it overrides it!\n\t\tpublic blobsWriter = new Map<string, ArrayBufferLike>();\n\t\tpublic latestWriterTree?: api.ISnapshotTree;\n\t\tpublic docId?: string;\n\n\t\tpublic reset() {\n\t\t\tthis.blobsWriter = new Map<string, ArrayBufferLike>();\n\t\t\tthis.latestWriterTree = undefined;\n\t\t\tthis.docId = undefined;\n\t\t}\n\n\t\tpublic onSnapshotHandler(snapshot: IFileSnapshot): void {\n\t\t\tthrow new Error(\"onSnapshotHandler is not setup! Please provide your handler!\");\n\t\t}\n\n\t\tpublic async readBlob(sha: string): Promise<ArrayBufferLike> {\n\t\t\tconst blob = this.blobsWriter.get(sha);\n\t\t\tif (blob !== undefined) {\n\t\t\t\treturn blob;\n\t\t\t}\n\t\t\treturn super.readBlob(sha);\n\t\t}\n\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tpublic async getVersions(versionId: string | null, count: number): Promise<api.IVersion[]> {\n\t\t\t// If we already saved document, that means we are getting here because of snapshot generation.\n\t\t\t// Not returning tree ensures that ContainerRuntime.snapshot() would regenerate subtrees for\n\t\t\t// each unchanged data store.\n\t\t\t// If we want to change that, we would need to capture docId on first call and return this.latestWriterTree\n\t\t\t// when latest is requested.\n\t\t\tif (this.latestWriterTree && (this.docId === versionId || versionId === null)) {\n\t\t\t\treturn [{ id: \"latest\", treeId: FileStorageVersionTreeId }];\n\t\t\t}\n\n\t\t\tif (this.docId === undefined && versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\n\t\t\treturn super.getVersions(versionId, count);\n\t\t}\n\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tpublic async getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null> {\n\t\t\tif (this.latestWriterTree && (!version || version.id === \"latest\")) {\n\t\t\t\treturn this.latestWriterTree;\n\t\t\t}\n\t\t\treturn super.getSnapshotTree(version);\n\t\t}\n\n\t\tpublic async uploadSummaryWithContext(\n\t\t\tsummary: api.ISummaryTree,\n\t\t\tcontext: ISummaryContext,\n\t\t): Promise<string> {\n\t\t\tconst tree = convertSummaryTreeToSnapshotITree(summary);\n\n\t\t\t// Remove tree IDs for easier comparison of snapshots\n\t\t\tdelete tree.id;\n\t\t\tremoveNullTreeIds(tree);\n\n\t\t\tthis.latestWriterTree = buildSnapshotTree(tree.entries, this.blobsWriter);\n\n\t\t\tconst fileSnapshot: IFileSnapshot = { tree, commits: {} };\n\t\t\tthis.onSnapshotHandler(fileSnapshot);\n\t\t\treturn \"testHandleId\";\n\t\t}\n\n\t\tpublic async buildTree(snapshotTree: api.ISnapshotTree): Promise<api.ITree> {\n\t\t\tconst tree: api.ITree = { entries: [] };\n\n\t\t\tfor (const subTreeId of Object.keys(snapshotTree.trees)) {\n\t\t\t\tconst subTree = await this.buildTree(snapshotTree.trees[subTreeId]);\n\t\t\t\ttree.entries.push({\n\t\t\t\t\tmode: api.FileMode.Directory,\n\t\t\t\t\tpath: subTreeId,\n\t\t\t\t\ttype: api.TreeEntry.Tree,\n\t\t\t\t\tvalue: subTree,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tfor (const blobName of Object.keys(snapshotTree.blobs)) {\n\t\t\t\tconst buffer = await this.readBlob(snapshotTree.blobs[blobName]);\n\t\t\t\tconst contents = bufferToString(buffer, \"utf8\");\n\t\t\t\tconst blob: api.IBlob = {\n\t\t\t\t\tcontents,\n\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t};\n\t\t\t\ttree.entries.push({\n\t\t\t\t\tmode: api.FileMode.File,\n\t\t\t\t\tpath: blobName,\n\t\t\t\t\ttype: api.TreeEntry.Blob,\n\t\t\t\t\tvalue: blob,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn tree;\n\t\t}\n\t};\n\nfunction removeNullTreeIds(tree: api.ITree) {\n\tfor (const node of tree.entries) {\n\t\tif (node.type === api.TreeEntry.Tree) {\n\t\t\tremoveNullTreeIds(node.value);\n\t\t}\n\t}\n\tassert(\n\t\ttree.id === undefined || tree.id === null,\n\t\t0x096 /* \"Trying to remove valid tree IDs in removeNullTreeIds()!\" */,\n\t);\n\tdelete tree.id;\n}\n/**\n * @internal\n */\nexport const FluidFetchReaderFileSnapshotWriter = FileSnapshotWriterClassFactory(FluidFetchReader);\n"]}
package/lib/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { FileDeltaStorageService } from "./fileDeltaStorageService.js";
6
+ export { FileDocumentServiceFactory } from "./fileDocumentServiceFactory.js";
7
+ export { Replayer, ReplayFileDeltaConnection } from "./fileDocumentDeltaConnection.js";
8
+ export { FileSnapshotWriterClassFactory, FileStorageDocumentName, FluidFetchReader, FluidFetchReaderFileSnapshotWriter, ISnapshotWriterStorage, ReaderConstructor, } from "./fileDocumentStorageService.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EACN,8BAA8B,EAC9B,uBAAuB,EACvB,gBAAgB,EAChB,kCAAkC,EAClC,sBAAsB,EACtB,iBAAiB,GACjB,MAAM,iCAAiC,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { FileDeltaStorageService } from "./fileDeltaStorageService.js";
6
+ export { FileDocumentServiceFactory } from "./fileDocumentServiceFactory.js";
7
+ export { Replayer, ReplayFileDeltaConnection } from "./fileDocumentDeltaConnection.js";
8
+ export { FileSnapshotWriterClassFactory, FileStorageDocumentName, FluidFetchReader, FluidFetchReaderFileSnapshotWriter, } from "./fileDocumentStorageService.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EACN,8BAA8B,EAC9B,uBAAuB,EACvB,gBAAgB,EAChB,kCAAkC,GAGlC,MAAM,iCAAiC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { FileDeltaStorageService } from \"./fileDeltaStorageService.js\";\nexport { FileDocumentServiceFactory } from \"./fileDocumentServiceFactory.js\";\nexport { Replayer, ReplayFileDeltaConnection } from \"./fileDocumentDeltaConnection.js\";\nexport {\n\tFileSnapshotWriterClassFactory,\n\tFileStorageDocumentName,\n\tFluidFetchReader,\n\tFluidFetchReaderFileSnapshotWriter,\n\tISnapshotWriterStorage,\n\tReaderConstructor,\n} from \"./fileDocumentStorageService.js\";\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validateFileDriverPrevious.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateFileDriverPrevious.generated.d.ts","sourceRoot":"","sources":["../../../src/test/types/validateFileDriverPrevious.generated.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ use_current_ClassDeclaration_FileDeltaStorageService(get_old_ClassDeclaration_FileDeltaStorageService());
2
+ use_old_ClassDeclaration_FileDeltaStorageService(get_current_ClassDeclaration_FileDeltaStorageService());
3
+ use_current_ClassDeclaration_FileDocumentServiceFactory(get_old_ClassDeclaration_FileDocumentServiceFactory());
4
+ use_old_ClassDeclaration_FileDocumentServiceFactory(get_current_ClassDeclaration_FileDocumentServiceFactory());
5
+ use_current_VariableDeclaration_FileSnapshotWriterClassFactory(get_old_VariableDeclaration_FileSnapshotWriterClassFactory());
6
+ use_old_VariableDeclaration_FileSnapshotWriterClassFactory(get_current_VariableDeclaration_FileSnapshotWriterClassFactory());
7
+ use_current_VariableDeclaration_FileStorageDocumentName(get_old_VariableDeclaration_FileStorageDocumentName());
8
+ use_old_VariableDeclaration_FileStorageDocumentName(get_current_VariableDeclaration_FileStorageDocumentName());
9
+ use_current_ClassDeclaration_FluidFetchReader(get_old_ClassDeclaration_FluidFetchReader());
10
+ use_old_ClassDeclaration_FluidFetchReader(
11
+ // @ts-expect-error compatibility expected to be broken
12
+ get_current_ClassDeclaration_FluidFetchReader());
13
+ use_current_VariableDeclaration_FluidFetchReaderFileSnapshotWriter(get_old_VariableDeclaration_FluidFetchReaderFileSnapshotWriter());
14
+ use_old_VariableDeclaration_FluidFetchReaderFileSnapshotWriter(get_current_VariableDeclaration_FluidFetchReaderFileSnapshotWriter());
15
+ use_current_InterfaceDeclaration_ISnapshotWriterStorage(get_old_InterfaceDeclaration_ISnapshotWriterStorage());
16
+ use_old_InterfaceDeclaration_ISnapshotWriterStorage(
17
+ // @ts-expect-error compatibility expected to be broken
18
+ get_current_InterfaceDeclaration_ISnapshotWriterStorage());
19
+ use_current_TypeAliasDeclaration_ReaderConstructor(get_old_TypeAliasDeclaration_ReaderConstructor());
20
+ use_old_TypeAliasDeclaration_ReaderConstructor(get_current_TypeAliasDeclaration_ReaderConstructor());
21
+ use_current_ClassDeclaration_ReplayFileDeltaConnection(get_old_ClassDeclaration_ReplayFileDeltaConnection());
22
+ use_old_ClassDeclaration_ReplayFileDeltaConnection(get_current_ClassDeclaration_ReplayFileDeltaConnection());
23
+ use_current_ClassDeclaration_Replayer(get_old_ClassDeclaration_Replayer());
24
+ use_old_ClassDeclaration_Replayer(get_current_ClassDeclaration_Replayer());
25
+ export {};
26
+ //# sourceMappingURL=validateFileDriverPrevious.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateFileDriverPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateFileDriverPrevious.generated.ts"],"names":[],"mappings":"AAgCA,oDAAoD,CAChD,gDAAgD,EAAE,CAAC,CAAC;AAWxD,gDAAgD,CAC5C,oDAAoD,EAAE,CAAC,CAAC;AAW5D,uDAAuD,CACnD,mDAAmD,EAAE,CAAC,CAAC;AAW3D,mDAAmD,CAC/C,uDAAuD,EAAE,CAAC,CAAC;AAW/D,8DAA8D,CAC1D,0DAA0D,EAAE,CAAC,CAAC;AAWlE,0DAA0D,CACtD,8DAA8D,EAAE,CAAC,CAAC;AAWtE,uDAAuD,CACnD,mDAAmD,EAAE,CAAC,CAAC;AAW3D,mDAAmD,CAC/C,uDAAuD,EAAE,CAAC,CAAC;AAW/D,6CAA6C,CACzC,yCAAyC,EAAE,CAAC,CAAC;AAWjD,yCAAyC;AACrC,uDAAuD;AACvD,6CAA6C,EAAE,CAAC,CAAC;AAWrD,kEAAkE,CAC9D,8DAA8D,EAAE,CAAC,CAAC;AAWtE,8DAA8D,CAC1D,kEAAkE,EAAE,CAAC,CAAC;AAW1E,uDAAuD,CACnD,mDAAmD,EAAE,CAAC,CAAC;AAW3D,mDAAmD;AAC/C,uDAAuD;AACvD,uDAAuD,EAAE,CAAC,CAAC;AAW/D,kDAAkD,CAC9C,8CAA8C,EAAE,CAAC,CAAC;AAWtD,8CAA8C,CAC1C,kDAAkD,EAAE,CAAC,CAAC;AAW1D,sDAAsD,CAClD,kDAAkD,EAAE,CAAC,CAAC;AAW1D,kDAAkD,CAC9C,sDAAsD,EAAE,CAAC,CAAC;AAW9D,qCAAqC,CACjC,iCAAiC,EAAE,CAAC,CAAC;AAWzC,iCAAiC,CAC7B,qCAAqC,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by fluid-type-test-generator in @fluidframework/build-tools.\n */\nimport type * as old from \"@fluidframework/file-driver-previous\";\nimport type * as current from \"../../index.js\";\n\n\n// See 'build-tools/src/type-test-generator/compatibility.ts' for more information.\ntype TypeOnly<T> = T extends number\n\t? number\n\t: T extends string\n\t? string\n\t: T extends boolean | bigint | symbol\n\t? T\n\t: {\n\t\t\t[P in keyof T]: TypeOnly<T[P]>;\n\t };\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_FileDeltaStorageService\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_FileDeltaStorageService():\n TypeOnly<old.FileDeltaStorageService>;\ndeclare function use_current_ClassDeclaration_FileDeltaStorageService(\n use: TypeOnly<current.FileDeltaStorageService>): void;\nuse_current_ClassDeclaration_FileDeltaStorageService(\n get_old_ClassDeclaration_FileDeltaStorageService());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_FileDeltaStorageService\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_FileDeltaStorageService():\n TypeOnly<current.FileDeltaStorageService>;\ndeclare function use_old_ClassDeclaration_FileDeltaStorageService(\n use: TypeOnly<old.FileDeltaStorageService>): void;\nuse_old_ClassDeclaration_FileDeltaStorageService(\n get_current_ClassDeclaration_FileDeltaStorageService());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_FileDocumentServiceFactory\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_FileDocumentServiceFactory():\n TypeOnly<old.FileDocumentServiceFactory>;\ndeclare function use_current_ClassDeclaration_FileDocumentServiceFactory(\n use: TypeOnly<current.FileDocumentServiceFactory>): void;\nuse_current_ClassDeclaration_FileDocumentServiceFactory(\n get_old_ClassDeclaration_FileDocumentServiceFactory());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_FileDocumentServiceFactory\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_FileDocumentServiceFactory():\n TypeOnly<current.FileDocumentServiceFactory>;\ndeclare function use_old_ClassDeclaration_FileDocumentServiceFactory(\n use: TypeOnly<old.FileDocumentServiceFactory>): void;\nuse_old_ClassDeclaration_FileDocumentServiceFactory(\n get_current_ClassDeclaration_FileDocumentServiceFactory());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_FileSnapshotWriterClassFactory\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_FileSnapshotWriterClassFactory():\n TypeOnly<typeof old.FileSnapshotWriterClassFactory>;\ndeclare function use_current_VariableDeclaration_FileSnapshotWriterClassFactory(\n use: TypeOnly<typeof current.FileSnapshotWriterClassFactory>): void;\nuse_current_VariableDeclaration_FileSnapshotWriterClassFactory(\n get_old_VariableDeclaration_FileSnapshotWriterClassFactory());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_FileSnapshotWriterClassFactory\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_FileSnapshotWriterClassFactory():\n TypeOnly<typeof current.FileSnapshotWriterClassFactory>;\ndeclare function use_old_VariableDeclaration_FileSnapshotWriterClassFactory(\n use: TypeOnly<typeof old.FileSnapshotWriterClassFactory>): void;\nuse_old_VariableDeclaration_FileSnapshotWriterClassFactory(\n get_current_VariableDeclaration_FileSnapshotWriterClassFactory());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_FileStorageDocumentName\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_FileStorageDocumentName():\n TypeOnly<typeof old.FileStorageDocumentName>;\ndeclare function use_current_VariableDeclaration_FileStorageDocumentName(\n use: TypeOnly<typeof current.FileStorageDocumentName>): void;\nuse_current_VariableDeclaration_FileStorageDocumentName(\n get_old_VariableDeclaration_FileStorageDocumentName());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_FileStorageDocumentName\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_FileStorageDocumentName():\n TypeOnly<typeof current.FileStorageDocumentName>;\ndeclare function use_old_VariableDeclaration_FileStorageDocumentName(\n use: TypeOnly<typeof old.FileStorageDocumentName>): void;\nuse_old_VariableDeclaration_FileStorageDocumentName(\n get_current_VariableDeclaration_FileStorageDocumentName());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_FluidFetchReader\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_FluidFetchReader():\n TypeOnly<old.FluidFetchReader>;\ndeclare function use_current_ClassDeclaration_FluidFetchReader(\n use: TypeOnly<current.FluidFetchReader>): void;\nuse_current_ClassDeclaration_FluidFetchReader(\n get_old_ClassDeclaration_FluidFetchReader());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_FluidFetchReader\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_FluidFetchReader():\n TypeOnly<current.FluidFetchReader>;\ndeclare function use_old_ClassDeclaration_FluidFetchReader(\n use: TypeOnly<old.FluidFetchReader>): void;\nuse_old_ClassDeclaration_FluidFetchReader(\n // @ts-expect-error compatibility expected to be broken\n get_current_ClassDeclaration_FluidFetchReader());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_FluidFetchReaderFileSnapshotWriter\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_FluidFetchReaderFileSnapshotWriter():\n TypeOnly<typeof old.FluidFetchReaderFileSnapshotWriter>;\ndeclare function use_current_VariableDeclaration_FluidFetchReaderFileSnapshotWriter(\n use: TypeOnly<typeof current.FluidFetchReaderFileSnapshotWriter>): void;\nuse_current_VariableDeclaration_FluidFetchReaderFileSnapshotWriter(\n get_old_VariableDeclaration_FluidFetchReaderFileSnapshotWriter());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_FluidFetchReaderFileSnapshotWriter\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_FluidFetchReaderFileSnapshotWriter():\n TypeOnly<typeof current.FluidFetchReaderFileSnapshotWriter>;\ndeclare function use_old_VariableDeclaration_FluidFetchReaderFileSnapshotWriter(\n use: TypeOnly<typeof old.FluidFetchReaderFileSnapshotWriter>): void;\nuse_old_VariableDeclaration_FluidFetchReaderFileSnapshotWriter(\n get_current_VariableDeclaration_FluidFetchReaderFileSnapshotWriter());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ISnapshotWriterStorage\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_ISnapshotWriterStorage():\n TypeOnly<old.ISnapshotWriterStorage>;\ndeclare function use_current_InterfaceDeclaration_ISnapshotWriterStorage(\n use: TypeOnly<current.ISnapshotWriterStorage>): void;\nuse_current_InterfaceDeclaration_ISnapshotWriterStorage(\n get_old_InterfaceDeclaration_ISnapshotWriterStorage());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ISnapshotWriterStorage\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_ISnapshotWriterStorage():\n TypeOnly<current.ISnapshotWriterStorage>;\ndeclare function use_old_InterfaceDeclaration_ISnapshotWriterStorage(\n use: TypeOnly<old.ISnapshotWriterStorage>): void;\nuse_old_InterfaceDeclaration_ISnapshotWriterStorage(\n // @ts-expect-error compatibility expected to be broken\n get_current_InterfaceDeclaration_ISnapshotWriterStorage());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_ReaderConstructor\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_ReaderConstructor():\n TypeOnly<old.ReaderConstructor>;\ndeclare function use_current_TypeAliasDeclaration_ReaderConstructor(\n use: TypeOnly<current.ReaderConstructor>): void;\nuse_current_TypeAliasDeclaration_ReaderConstructor(\n get_old_TypeAliasDeclaration_ReaderConstructor());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_ReaderConstructor\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_ReaderConstructor():\n TypeOnly<current.ReaderConstructor>;\ndeclare function use_old_TypeAliasDeclaration_ReaderConstructor(\n use: TypeOnly<old.ReaderConstructor>): void;\nuse_old_TypeAliasDeclaration_ReaderConstructor(\n get_current_TypeAliasDeclaration_ReaderConstructor());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_ReplayFileDeltaConnection\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_ReplayFileDeltaConnection():\n TypeOnly<old.ReplayFileDeltaConnection>;\ndeclare function use_current_ClassDeclaration_ReplayFileDeltaConnection(\n use: TypeOnly<current.ReplayFileDeltaConnection>): void;\nuse_current_ClassDeclaration_ReplayFileDeltaConnection(\n get_old_ClassDeclaration_ReplayFileDeltaConnection());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_ReplayFileDeltaConnection\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_ReplayFileDeltaConnection():\n TypeOnly<current.ReplayFileDeltaConnection>;\ndeclare function use_old_ClassDeclaration_ReplayFileDeltaConnection(\n use: TypeOnly<old.ReplayFileDeltaConnection>): void;\nuse_old_ClassDeclaration_ReplayFileDeltaConnection(\n get_current_ClassDeclaration_ReplayFileDeltaConnection());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_Replayer\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_Replayer():\n TypeOnly<old.Replayer>;\ndeclare function use_current_ClassDeclaration_Replayer(\n use: TypeOnly<current.Replayer>): void;\nuse_current_ClassDeclaration_Replayer(\n get_old_ClassDeclaration_Replayer());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_Replayer\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_Replayer():\n TypeOnly<current.Replayer>;\ndeclare function use_old_ClassDeclaration_Replayer(\n use: TypeOnly<old.Replayer>): void;\nuse_old_ClassDeclaration_Replayer(\n get_current_ClassDeclaration_Replayer());\n"]}