@fluidframework/replay-driver 2.12.0 → 2.13.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.
- package/CHANGELOG.md +4 -0
- package/dist/replayDocumentService.d.ts.map +1 -1
- package/dist/replayDocumentService.js.map +1 -1
- package/dist/storageImplementations.js.map +1 -1
- package/lib/replayDocumentService.d.ts.map +1 -1
- package/lib/replayDocumentService.js.map +1 -1
- package/lib/storageImplementations.js.map +1 -1
- package/package.json +8 -8
- package/src/replayDocumentService.ts +0 -1
- package/src/storageImplementations.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replayDocumentService.d.ts","sourceRoot":"","sources":["../src/replayDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EACN,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACZ,4BAA4B,EAC5B,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;;;;GAKG;AACH,qBAAa,qBACZ,SAAQ,iBAAiB,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"replayDocumentService.d.ts","sourceRoot":"","sources":["../src/replayDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EACN,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACZ,4BAA4B,EAC5B,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;;;;GAKG;AACH,qBAAa,qBACZ,SAAQ,iBAAiB,CAAC,sBAAsB,CAChD,YAAW,gBAAgB;IAmB1B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;WAlBV,MAAM,CACzB,eAAe,EAAE,gBAAgB,EACjC,UAAU,EAAE,gBAAgB,GAC1B,OAAO,CAAC,gBAAgB,CAAC;gBAcV,UAAU,EAAE,uBAAuB,EACnC,YAAY,EAAE,wBAAwB;IAKjD,OAAO;IAGd,IAAW,WAAW,IAAI,YAAY,CAErC;IAED;;;OAGG;IACU,gBAAgB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAIjE;;;OAGG;IACU,qBAAqB,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAI3E;;;;;OAKG;IACU,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAGrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replayDocumentService.js","sourceRoot":"","sources":["../src/replayDocumentService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAWjE,+EAAyE;AAEzE,yFAAmF;AAEnF;;;;;GAKG;AACH,MAAa,qBACZ,SAAQ,gCAAyC;
|
|
1
|
+
{"version":3,"file":"replayDocumentService.js","sourceRoot":"","sources":["../src/replayDocumentService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAWjE,+EAAyE;AAEzE,yFAAmF;AAEnF;;;;;GAKG;AACH,MAAa,qBACZ,SAAQ,gCAAyC;IAG1C,MAAM,CAAC,KAAK,CAAC,MAAM,CACzB,eAAiC,EACjC,UAA4B;QAE5B,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QACpE,IAAI,CAAC,aAAa,EAAE,CAAC;YACpB,OAAO,eAAe,CAAC;QACxB,CAAC;QAED,MAAM,eAAe,GAAG,gEAA6B,CAAC,MAAM,CAC3D,MAAM,eAAe,CAAC,qBAAqB,EAAE,EAC7C,UAAU,CACV,CAAC;QACF,OAAO,IAAI,qBAAqB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAC/D,CAAC;IAED,YACkB,UAAmC,EACnC,YAAsC;QAEvD,KAAK,EAAE,CAAC;QAHS,eAAU,GAAV,UAAU,CAAyB;QACnC,iBAAY,GAAZ,YAAY,CAA0B;IAGxD,CAAC;IAEM,OAAO,KAAI,CAAC;IAEnB,8EAA8E;IAC9E,IAAW,WAAW;QACrB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,gBAAgB;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,qBAAqB;QACjC,OAAO,IAAI,sDAAwB,EAAE,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAChD,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;CACD;AA3DD,sDA2DC","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 { IClient } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentServiceEvents,\n\tIDocumentService,\n\tIDocumentStorageService,\n\tIDocumentDeltaConnection,\n\tIResolvedUrl,\n\tIDocumentDeltaStorageService,\n} from \"@fluidframework/driver-definitions/internal\";\n\nimport { EmptyDeltaStorageService } from \"./emptyDeltaStorageService.js\";\nimport { ReplayController } from \"./replayController.js\";\nimport { ReplayDocumentDeltaConnection } from \"./replayDocumentDeltaConnection.js\";\n\n/**\n * The Replay document service dummies out the snapshot and the delta storage.\n * Delta connection simulates the socket by fetching the ops from delta storage\n * and emitting them with a pre determined delay\n * @internal\n */\nexport class ReplayDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tpublic static async create(\n\t\tdocumentService: IDocumentService,\n\t\tcontroller: ReplayController,\n\t): Promise<IDocumentService> {\n\t\tconst useController = await controller.initStorage(documentService);\n\t\tif (!useController) {\n\t\t\treturn documentService;\n\t\t}\n\n\t\tconst deltaConnection = ReplayDocumentDeltaConnection.create(\n\t\t\tawait documentService.connectToDeltaStorage(),\n\t\t\tcontroller,\n\t\t);\n\t\treturn new ReplayDocumentService(controller, deltaConnection);\n\t}\n\n\tconstructor(\n\t\tprivate readonly controller: IDocumentStorageService,\n\t\tprivate readonly deltaStorage: IDocumentDeltaConnection,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic dispose() {}\n\n\t// TODO: Issue-2109 Implement detach container api or put appropriate comment.\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n\n\t/**\n\t * Connects to a storage endpoint for snapshot service and blobs.\n\t * @returns returns the dummy document storage service for replay driver.\n\t */\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this.controller;\n\t}\n\n\t/**\n\t * Connects to a delta storage endpoint for getting ops between a range.\n\t * @returns returns the dummy document delta storage service for replay driver.\n\t */\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\treturn new EmptyDeltaStorageService();\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 * @param client - Client that connects to socket.\n\t * @returns returns the delta stream service which replay ops from --from to --to arguments.\n\t */\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\treturn this.deltaStorage;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageImplementations.js","sourceRoot":"","sources":["../src/storageImplementations.ts"],"names":[],"mappings":";AAAA;;;GAGG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;QACjC,OAAO,IAAI,sDAAwB,EAAE,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAChD,4DAA4D;QAC5D,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;CACD;AAzBD,oEAyBC;AAED;;GAEG;AACH,MAAa,mCAAmC;IAC/C,YAAsC,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;IAAG,CAAC;IAEnE,KAAK,CAAC,qBAAqB,CACjC,OAAqB,EACrB,MAA4B,EAC5B,kBAA4B;QAE5B,OAAO,IAAI,4BAA4B,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,eAAe,CAC3B,gBAA8B,EAC9B,WAAyB,EACzB,MAA2B,EAC3B,kBAA4B;QAE5B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD;AApBD,kFAoBC","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 { assert } from \"@fluidframework/core-utils/internal\";\nimport { IClient, ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n\tISnapshotTree,\n\tITree,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyDeltaStorageService } from \"./emptyDeltaStorageService.js\";\nimport { ReadDocumentStorageServiceBase } from \"./replayController.js\";\n\n/**\n * Structure of snapshot on disk, when we store snapshot as single file\n * @internal\n */\nexport interface IFileSnapshot {\n\ttree: ITree;\n\tcommits: { [key: string]: ITree };\n}\n\n/**\n * @internal\n */\nexport class FileSnapshotReader\n\textends ReadDocumentStorageServiceBase\n\timplements IDocumentStorageService\n{\n\t// IVersion.treeId used to communicate between getVersions() & getSnapshotTree() calls to indicate IVersion is ours.\n\tprotected static readonly FileStorageVersionTreeId = \"FileStorageTreeId\";\n\n\tprotected docId?: string;\n\tprotected docTree: ISnapshotTree;\n\tprotected blobs: Map<string, ArrayBufferLike>;\n\tprotected readonly commits: { [key: string]: ITree } = {};\n\tprotected readonly trees: { [key: string]: ISnapshotTree } = {};\n\n\tpublic constructor(json: IFileSnapshot) {\n\t\tsuper();\n\t\tthis.commits = json.commits;\n\n\t\tthis.blobs = new Map<string, ArrayBufferLike>();\n\t\tthis.docTree = buildSnapshotTree(json.tree.entries, this.blobs);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.docId === undefined || this.docId === versionId || versionId === null) {\n\t\t\tif (versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\t\t\treturn [{ id: \"latest\", treeId: \"\" }];\n\t\t}\n\n\t\tif (this.commits[versionId] !== undefined) {\n\t\t\treturn [{ id: versionId, treeId: FileSnapshotReader.FileStorageVersionTreeId }];\n\t\t}\n\t\tthrow new Error(`Unknown version ID: ${versionId}`);\n\t}\n\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (!versionRequested || versionRequested.id === \"latest\") {\n\t\t\treturn this.docTree;\n\t\t}\n\t\tif (versionRequested.treeId !== FileSnapshotReader.FileStorageVersionTreeId) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\tthrow new Error(`Unknown version id: ${versionRequested}`);\n\t\t}\n\n\t\tlet snapshotTree = this.trees[versionRequested.id];\n\t\tif (snapshotTree === undefined) {\n\t\t\tconst tree = this.commits[versionRequested.id];\n\t\t\tif (tree === undefined) {\n\t\t\t\tthrow new Error(`Can't find version ${versionRequested.id}`);\n\t\t\t}\n\n\t\t\tthis.trees[versionRequested.id] = snapshotTree = buildSnapshotTree(\n\t\t\t\ttree.entries,\n\t\t\t\tthis.blobs,\n\t\t\t);\n\t\t}\n\t\treturn snapshotTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst blob = this.blobs.get(blobId);\n\t\tif (blob !== undefined) {\n\t\t\treturn blob;\n\t\t}\n\t\tthrow new Error(`Unknown blob ID: ${blobId}`);\n\t}\n}\n\n/**\n * @internal\n */\nexport class SnapshotStorage extends ReadDocumentStorageServiceBase {\n\tprotected docId?: string;\n\n\tconstructor(\n\t\tprotected readonly storage: IDocumentStorageService,\n\t\tprotected readonly docTree: ISnapshotTree | null,\n\t) {\n\t\tsuper();\n\t\tassert(!!this.docTree, 0x0b0 /* \"Missing document snapshot tree!\" */);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.docId === undefined || this.docId === versionId || versionId === null) {\n\t\t\tif (versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\t\t\treturn [{ id: \"latest\", treeId: \"\" }];\n\t\t}\n\t\treturn this.storage.getVersions(versionId, count);\n\t}\n\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (versionRequested && versionRequested.id !== \"latest\") {\n\t\t\treturn this.storage.getSnapshotTree(versionRequested);\n\t\t}\n\n\t\treturn this.docTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.storage.readBlob(blobId);\n\t}\n}\n\nexport class StaticStorageDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tconstructor(\n\t\tpublic readonly resolvedUrl: IResolvedUrl,\n\t\tprivate readonly storage: IDocumentStorageService,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic dispose() {}\n\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this.storage;\n\t}\n\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\treturn new EmptyDeltaStorageService();\n\t}\n\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\t// We have no delta stream, so make it not return forever...\n\t\treturn new Promise(() => {});\n\t}\n}\n\n/**\n * @internal\n */\nexport class StaticStorageDocumentServiceFactory implements IDocumentServiceFactory {\n\tpublic constructor(protected readonly storage: IDocumentStorageService) {}\n\n\tpublic async createDocumentService(\n\t\tfileURL: IResolvedUrl,\n\t\tlogger?: ITelemetryLoggerExt,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn new StaticStorageDocumentService(fileURL, this.storage);\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: ITelemetryLoggerExt,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"storageImplementations.js","sourceRoot":"","sources":["../src/storageImplementations.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AACjE,kEAA6D;AAc7D,oEAA0E;AAG1E,+EAAyE;AACzE,+DAAuE;AAWvE;;GAEG;AACH,MAAa,kBACZ,SAAQ,oDAA8B;IAYtC,YAAmB,IAAmB;QACrC,KAAK,EAAE,CAAC;QAJU,YAAO,GAA6B,EAAE,CAAC;QACvC,UAAK,GAAqC,EAAE,CAAC;QAI/D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE5B,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAA2B,CAAC;QAChD,IAAI,CAAC,OAAO,GAAG,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AE5B,OAAO,IAAI,4BAA4B,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,eAAe,CAC3B,gBAA8B,EAC9B,WAAyB,EACzB,MAA2B,EAC3B,kBAA4B;QAE5B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD;AApBD,kFAoBC","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 { assert } from \"@fluidframework/core-utils/internal\";\nimport { IClient, ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n\tISnapshotTree,\n\tITree,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyDeltaStorageService } from \"./emptyDeltaStorageService.js\";\nimport { ReadDocumentStorageServiceBase } from \"./replayController.js\";\n\n/**\n * Structure of snapshot on disk, when we store snapshot as single file\n * @internal\n */\nexport interface IFileSnapshot {\n\ttree: ITree;\n\tcommits: { [key: string]: ITree };\n}\n\n/**\n * @internal\n */\nexport class FileSnapshotReader\n\textends ReadDocumentStorageServiceBase\n\timplements IDocumentStorageService\n{\n\t// IVersion.treeId used to communicate between getVersions() & getSnapshotTree() calls to indicate IVersion is ours.\n\tprotected static readonly FileStorageVersionTreeId = \"FileStorageTreeId\";\n\n\tprotected docId?: string;\n\tprotected docTree: ISnapshotTree;\n\tprotected blobs: Map<string, ArrayBufferLike>;\n\tprotected readonly commits: { [key: string]: ITree } = {};\n\tprotected readonly trees: { [key: string]: ISnapshotTree } = {};\n\n\tpublic constructor(json: IFileSnapshot) {\n\t\tsuper();\n\t\tthis.commits = json.commits;\n\n\t\tthis.blobs = new Map<string, ArrayBufferLike>();\n\t\tthis.docTree = buildSnapshotTree(json.tree.entries, this.blobs);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.docId === undefined || this.docId === versionId || versionId === null) {\n\t\t\tif (versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\t\t\treturn [{ id: \"latest\", treeId: \"\" }];\n\t\t}\n\n\t\tif (this.commits[versionId] !== undefined) {\n\t\t\treturn [{ id: versionId, treeId: FileSnapshotReader.FileStorageVersionTreeId }];\n\t\t}\n\t\tthrow new Error(`Unknown version ID: ${versionId}`);\n\t}\n\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (!versionRequested || versionRequested.id === \"latest\") {\n\t\t\treturn this.docTree;\n\t\t}\n\t\tif (versionRequested.treeId !== FileSnapshotReader.FileStorageVersionTreeId) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\tthrow new Error(`Unknown version id: ${versionRequested}`);\n\t\t}\n\n\t\tlet snapshotTree: ISnapshotTree | undefined = this.trees[versionRequested.id];\n\t\tif (snapshotTree === undefined) {\n\t\t\tconst tree: ITree | undefined = this.commits[versionRequested.id];\n\t\t\tif (tree === undefined) {\n\t\t\t\tthrow new Error(`Can't find version ${versionRequested.id}`);\n\t\t\t}\n\n\t\t\tthis.trees[versionRequested.id] = snapshotTree = buildSnapshotTree(\n\t\t\t\ttree.entries,\n\t\t\t\tthis.blobs,\n\t\t\t);\n\t\t}\n\t\treturn snapshotTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst blob = this.blobs.get(blobId);\n\t\tif (blob !== undefined) {\n\t\t\treturn blob;\n\t\t}\n\t\tthrow new Error(`Unknown blob ID: ${blobId}`);\n\t}\n}\n\n/**\n * @internal\n */\nexport class SnapshotStorage extends ReadDocumentStorageServiceBase {\n\tprotected docId?: string;\n\n\tconstructor(\n\t\tprotected readonly storage: IDocumentStorageService,\n\t\tprotected readonly docTree: ISnapshotTree | null,\n\t) {\n\t\tsuper();\n\t\tassert(!!this.docTree, 0x0b0 /* \"Missing document snapshot tree!\" */);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.docId === undefined || this.docId === versionId || versionId === null) {\n\t\t\tif (versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\t\t\treturn [{ id: \"latest\", treeId: \"\" }];\n\t\t}\n\t\treturn this.storage.getVersions(versionId, count);\n\t}\n\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (versionRequested && versionRequested.id !== \"latest\") {\n\t\t\treturn this.storage.getSnapshotTree(versionRequested);\n\t\t}\n\n\t\treturn this.docTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.storage.readBlob(blobId);\n\t}\n}\n\nexport class StaticStorageDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tconstructor(\n\t\tpublic readonly resolvedUrl: IResolvedUrl,\n\t\tprivate readonly storage: IDocumentStorageService,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic dispose() {}\n\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this.storage;\n\t}\n\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\treturn new EmptyDeltaStorageService();\n\t}\n\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\t// We have no delta stream, so make it not return forever...\n\t\treturn new Promise(() => {});\n\t}\n}\n\n/**\n * @internal\n */\nexport class StaticStorageDocumentServiceFactory implements IDocumentServiceFactory {\n\tpublic constructor(protected readonly storage: IDocumentStorageService) {}\n\n\tpublic async createDocumentService(\n\t\tfileURL: IResolvedUrl,\n\t\tlogger?: ITelemetryLoggerExt,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn new StaticStorageDocumentService(fileURL, this.storage);\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: ITelemetryLoggerExt,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replayDocumentService.d.ts","sourceRoot":"","sources":["../src/replayDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EACN,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACZ,4BAA4B,EAC5B,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;;;;GAKG;AACH,qBAAa,qBACZ,SAAQ,iBAAiB,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"replayDocumentService.d.ts","sourceRoot":"","sources":["../src/replayDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EACN,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,EACZ,4BAA4B,EAC5B,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;;;;GAKG;AACH,qBAAa,qBACZ,SAAQ,iBAAiB,CAAC,sBAAsB,CAChD,YAAW,gBAAgB;IAmB1B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;WAlBV,MAAM,CACzB,eAAe,EAAE,gBAAgB,EACjC,UAAU,EAAE,gBAAgB,GAC1B,OAAO,CAAC,gBAAgB,CAAC;gBAcV,UAAU,EAAE,uBAAuB,EACnC,YAAY,EAAE,wBAAwB;IAKjD,OAAO;IAGd,IAAW,WAAW,IAAI,YAAY,CAErC;IAED;;;OAGG;IACU,gBAAgB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAIjE;;;OAGG;IACU,qBAAqB,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAI3E;;;;;OAKG;IACU,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAGrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replayDocumentService.js","sourceRoot":"","sources":["../src/replayDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAWjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,OAAO,qBACZ,SAAQ,iBAAyC;
|
|
1
|
+
{"version":3,"file":"replayDocumentService.js","sourceRoot":"","sources":["../src/replayDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAWjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,OAAO,qBACZ,SAAQ,iBAAyC;IAG1C,MAAM,CAAC,KAAK,CAAC,MAAM,CACzB,eAAiC,EACjC,UAA4B;QAE5B,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QACpE,IAAI,CAAC,aAAa,EAAE,CAAC;YACpB,OAAO,eAAe,CAAC;QACxB,CAAC;QAED,MAAM,eAAe,GAAG,6BAA6B,CAAC,MAAM,CAC3D,MAAM,eAAe,CAAC,qBAAqB,EAAE,EAC7C,UAAU,CACV,CAAC;QACF,OAAO,IAAI,qBAAqB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAC/D,CAAC;IAED,YACkB,UAAmC,EACnC,YAAsC;QAEvD,KAAK,EAAE,CAAC;QAHS,eAAU,GAAV,UAAU,CAAyB;QACnC,iBAAY,GAAZ,YAAY,CAA0B;IAGxD,CAAC;IAEM,OAAO,KAAI,CAAC;IAEnB,8EAA8E;IAC9E,IAAW,WAAW;QACrB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,gBAAgB;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,qBAAqB;QACjC,OAAO,IAAI,wBAAwB,EAAE,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAChD,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,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 { IClient } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentServiceEvents,\n\tIDocumentService,\n\tIDocumentStorageService,\n\tIDocumentDeltaConnection,\n\tIResolvedUrl,\n\tIDocumentDeltaStorageService,\n} from \"@fluidframework/driver-definitions/internal\";\n\nimport { EmptyDeltaStorageService } from \"./emptyDeltaStorageService.js\";\nimport { ReplayController } from \"./replayController.js\";\nimport { ReplayDocumentDeltaConnection } from \"./replayDocumentDeltaConnection.js\";\n\n/**\n * The Replay document service dummies out the snapshot and the delta storage.\n * Delta connection simulates the socket by fetching the ops from delta storage\n * and emitting them with a pre determined delay\n * @internal\n */\nexport class ReplayDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tpublic static async create(\n\t\tdocumentService: IDocumentService,\n\t\tcontroller: ReplayController,\n\t): Promise<IDocumentService> {\n\t\tconst useController = await controller.initStorage(documentService);\n\t\tif (!useController) {\n\t\t\treturn documentService;\n\t\t}\n\n\t\tconst deltaConnection = ReplayDocumentDeltaConnection.create(\n\t\t\tawait documentService.connectToDeltaStorage(),\n\t\t\tcontroller,\n\t\t);\n\t\treturn new ReplayDocumentService(controller, deltaConnection);\n\t}\n\n\tconstructor(\n\t\tprivate readonly controller: IDocumentStorageService,\n\t\tprivate readonly deltaStorage: IDocumentDeltaConnection,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic dispose() {}\n\n\t// TODO: Issue-2109 Implement detach container api or put appropriate comment.\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n\n\t/**\n\t * Connects to a storage endpoint for snapshot service and blobs.\n\t * @returns returns the dummy document storage service for replay driver.\n\t */\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this.controller;\n\t}\n\n\t/**\n\t * Connects to a delta storage endpoint for getting ops between a range.\n\t * @returns returns the dummy document delta storage service for replay driver.\n\t */\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\treturn new EmptyDeltaStorageService();\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 * @param client - Client that connects to socket.\n\t * @returns returns the delta stream service which replay ops from --from to --to arguments.\n\t */\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\treturn this.deltaStorage;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageImplementations.js","sourceRoot":"","sources":["../src/storageImplementations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAc7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAG1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAWvE;;GAEG;AACH,MAAM,OAAO,kBACZ,SAAQ,8BAA8B;IAYtC,YAAmB,IAAmB;QACrC,KAAK,EAAE,CAAC;QAJU,YAAO,GAA6B,EAAE,CAAC;QACvC,UAAK,GAAqC,EAAE,CAAC;QAI/D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE5B,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAA2B,CAAC;QAChD,IAAI,CAAC,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACjE,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,SAAwB,EAAE,KAAa;QAC/D,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YAChF,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;gBACxB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;YACxB,CAAC;YACD,OAAO,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EA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,CAAC,MAAc;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;CACD;AAED,MAAM,OAAO,4BACZ,SAAQ,iBAAyC;IAGjD,YACiB,WAAyB,EACxB,OAAgC;QAEjD,KAAK,EAAE,CAAC;QAHQ,gBAAW,GAAX,WAAW,CAAc;QACxB,YAAO,GAAP,OAAO,CAAyB;IAGlD,CAAC;IAEM,OAAO,KAAI,CAAC;IAEZ,KAAK,CAAC,gBAAgB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,qBAAqB;QACjC,OAAO,IAAI,wBAAwB,EAAE,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAChD,4DAA4D;QAC5D,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,mCAAmC;IAC/C,YAAsC,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;IAAG,CAAC;IAEnE,KAAK,CAAC,qBAAqB,CACjC,OAAqB,EACrB,MAA4B,EAC5B,kBAA4B;QAE5B,OAAO,IAAI,4BAA4B,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,eAAe,CAC3B,gBAA8B,EAC9B,WAAyB,EACzB,MAA2B,EAC3B,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 { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { IClient, ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n\tISnapshotTree,\n\tITree,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyDeltaStorageService } from \"./emptyDeltaStorageService.js\";\nimport { ReadDocumentStorageServiceBase } from \"./replayController.js\";\n\n/**\n * Structure of snapshot on disk, when we store snapshot as single file\n * @internal\n */\nexport interface IFileSnapshot {\n\ttree: ITree;\n\tcommits: { [key: string]: ITree };\n}\n\n/**\n * @internal\n */\nexport class FileSnapshotReader\n\textends ReadDocumentStorageServiceBase\n\timplements IDocumentStorageService\n{\n\t// IVersion.treeId used to communicate between getVersions() & getSnapshotTree() calls to indicate IVersion is ours.\n\tprotected static readonly FileStorageVersionTreeId = \"FileStorageTreeId\";\n\n\tprotected docId?: string;\n\tprotected docTree: ISnapshotTree;\n\tprotected blobs: Map<string, ArrayBufferLike>;\n\tprotected readonly commits: { [key: string]: ITree } = {};\n\tprotected readonly trees: { [key: string]: ISnapshotTree } = {};\n\n\tpublic constructor(json: IFileSnapshot) {\n\t\tsuper();\n\t\tthis.commits = json.commits;\n\n\t\tthis.blobs = new Map<string, ArrayBufferLike>();\n\t\tthis.docTree = buildSnapshotTree(json.tree.entries, this.blobs);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.docId === undefined || this.docId === versionId || versionId === null) {\n\t\t\tif (versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\t\t\treturn [{ id: \"latest\", treeId: \"\" }];\n\t\t}\n\n\t\tif (this.commits[versionId] !== undefined) {\n\t\t\treturn [{ id: versionId, treeId: FileSnapshotReader.FileStorageVersionTreeId }];\n\t\t}\n\t\tthrow new Error(`Unknown version ID: ${versionId}`);\n\t}\n\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (!versionRequested || versionRequested.id === \"latest\") {\n\t\t\treturn this.docTree;\n\t\t}\n\t\tif (versionRequested.treeId !== FileSnapshotReader.FileStorageVersionTreeId) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\tthrow new Error(`Unknown version id: ${versionRequested}`);\n\t\t}\n\n\t\tlet snapshotTree = this.trees[versionRequested.id];\n\t\tif (snapshotTree === undefined) {\n\t\t\tconst tree = this.commits[versionRequested.id];\n\t\t\tif (tree === undefined) {\n\t\t\t\tthrow new Error(`Can't find version ${versionRequested.id}`);\n\t\t\t}\n\n\t\t\tthis.trees[versionRequested.id] = snapshotTree = buildSnapshotTree(\n\t\t\t\ttree.entries,\n\t\t\t\tthis.blobs,\n\t\t\t);\n\t\t}\n\t\treturn snapshotTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst blob = this.blobs.get(blobId);\n\t\tif (blob !== undefined) {\n\t\t\treturn blob;\n\t\t}\n\t\tthrow new Error(`Unknown blob ID: ${blobId}`);\n\t}\n}\n\n/**\n * @internal\n */\nexport class SnapshotStorage extends ReadDocumentStorageServiceBase {\n\tprotected docId?: string;\n\n\tconstructor(\n\t\tprotected readonly storage: IDocumentStorageService,\n\t\tprotected readonly docTree: ISnapshotTree | null,\n\t) {\n\t\tsuper();\n\t\tassert(!!this.docTree, 0x0b0 /* \"Missing document snapshot tree!\" */);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.docId === undefined || this.docId === versionId || versionId === null) {\n\t\t\tif (versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\t\t\treturn [{ id: \"latest\", treeId: \"\" }];\n\t\t}\n\t\treturn this.storage.getVersions(versionId, count);\n\t}\n\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (versionRequested && versionRequested.id !== \"latest\") {\n\t\t\treturn this.storage.getSnapshotTree(versionRequested);\n\t\t}\n\n\t\treturn this.docTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.storage.readBlob(blobId);\n\t}\n}\n\nexport class StaticStorageDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tconstructor(\n\t\tpublic readonly resolvedUrl: IResolvedUrl,\n\t\tprivate readonly storage: IDocumentStorageService,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic dispose() {}\n\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this.storage;\n\t}\n\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\treturn new EmptyDeltaStorageService();\n\t}\n\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\t// We have no delta stream, so make it not return forever...\n\t\treturn new Promise(() => {});\n\t}\n}\n\n/**\n * @internal\n */\nexport class StaticStorageDocumentServiceFactory implements IDocumentServiceFactory {\n\tpublic constructor(protected readonly storage: IDocumentStorageService) {}\n\n\tpublic async createDocumentService(\n\t\tfileURL: IResolvedUrl,\n\t\tlogger?: ITelemetryLoggerExt,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn new StaticStorageDocumentService(fileURL, this.storage);\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: ITelemetryLoggerExt,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"storageImplementations.js","sourceRoot":"","sources":["../src/storageImplementations.ts"],"names":[],"mappings":"AAAA;;;GAGG;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AP,OAAO,CAAyB;IAGlD,CAAC;IAEM,OAAO,KAAI,CAAC;IAEZ,KAAK,CAAC,gBAAgB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,qBAAqB;QACjC,OAAO,IAAI,wBAAwB,EAAE,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAChD,4DAA4D;QAC5D,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,mCAAmC;IAC/C,YAAsC,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;IAAG,CAAC;IAEnE,KAAK,CAAC,qBAAqB,CACjC,OAAqB,EACrB,MAA4B,EAC5B,kBAA4B;QAE5B,OAAO,IAAI,4BAA4B,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,eAAe,CAC3B,gBAA8B,EAC9B,WAAyB,EACzB,MAA2B,EAC3B,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 { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { IClient, ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n\tISnapshotTree,\n\tITree,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyDeltaStorageService } from \"./emptyDeltaStorageService.js\";\nimport { ReadDocumentStorageServiceBase } from \"./replayController.js\";\n\n/**\n * Structure of snapshot on disk, when we store snapshot as single file\n * @internal\n */\nexport interface IFileSnapshot {\n\ttree: ITree;\n\tcommits: { [key: string]: ITree };\n}\n\n/**\n * @internal\n */\nexport class FileSnapshotReader\n\textends ReadDocumentStorageServiceBase\n\timplements IDocumentStorageService\n{\n\t// IVersion.treeId used to communicate between getVersions() & getSnapshotTree() calls to indicate IVersion is ours.\n\tprotected static readonly FileStorageVersionTreeId = \"FileStorageTreeId\";\n\n\tprotected docId?: string;\n\tprotected docTree: ISnapshotTree;\n\tprotected blobs: Map<string, ArrayBufferLike>;\n\tprotected readonly commits: { [key: string]: ITree } = {};\n\tprotected readonly trees: { [key: string]: ISnapshotTree } = {};\n\n\tpublic constructor(json: IFileSnapshot) {\n\t\tsuper();\n\t\tthis.commits = json.commits;\n\n\t\tthis.blobs = new Map<string, ArrayBufferLike>();\n\t\tthis.docTree = buildSnapshotTree(json.tree.entries, this.blobs);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.docId === undefined || this.docId === versionId || versionId === null) {\n\t\t\tif (versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\t\t\treturn [{ id: \"latest\", treeId: \"\" }];\n\t\t}\n\n\t\tif (this.commits[versionId] !== undefined) {\n\t\t\treturn [{ id: versionId, treeId: FileSnapshotReader.FileStorageVersionTreeId }];\n\t\t}\n\t\tthrow new Error(`Unknown version ID: ${versionId}`);\n\t}\n\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (!versionRequested || versionRequested.id === \"latest\") {\n\t\t\treturn this.docTree;\n\t\t}\n\t\tif (versionRequested.treeId !== FileSnapshotReader.FileStorageVersionTreeId) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\tthrow new Error(`Unknown version id: ${versionRequested}`);\n\t\t}\n\n\t\tlet snapshotTree: ISnapshotTree | undefined = this.trees[versionRequested.id];\n\t\tif (snapshotTree === undefined) {\n\t\t\tconst tree: ITree | undefined = this.commits[versionRequested.id];\n\t\t\tif (tree === undefined) {\n\t\t\t\tthrow new Error(`Can't find version ${versionRequested.id}`);\n\t\t\t}\n\n\t\t\tthis.trees[versionRequested.id] = snapshotTree = buildSnapshotTree(\n\t\t\t\ttree.entries,\n\t\t\t\tthis.blobs,\n\t\t\t);\n\t\t}\n\t\treturn snapshotTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst blob = this.blobs.get(blobId);\n\t\tif (blob !== undefined) {\n\t\t\treturn blob;\n\t\t}\n\t\tthrow new Error(`Unknown blob ID: ${blobId}`);\n\t}\n}\n\n/**\n * @internal\n */\nexport class SnapshotStorage extends ReadDocumentStorageServiceBase {\n\tprotected docId?: string;\n\n\tconstructor(\n\t\tprotected readonly storage: IDocumentStorageService,\n\t\tprotected readonly docTree: ISnapshotTree | null,\n\t) {\n\t\tsuper();\n\t\tassert(!!this.docTree, 0x0b0 /* \"Missing document snapshot tree!\" */);\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.docId === undefined || this.docId === versionId || versionId === null) {\n\t\t\tif (versionId !== null) {\n\t\t\t\tthis.docId = versionId;\n\t\t\t}\n\t\t\treturn [{ id: \"latest\", treeId: \"\" }];\n\t\t}\n\t\treturn this.storage.getVersions(versionId, count);\n\t}\n\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (versionRequested && versionRequested.id !== \"latest\") {\n\t\t\treturn this.storage.getSnapshotTree(versionRequested);\n\t\t}\n\n\t\treturn this.docTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.storage.readBlob(blobId);\n\t}\n}\n\nexport class StaticStorageDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tconstructor(\n\t\tpublic readonly resolvedUrl: IResolvedUrl,\n\t\tprivate readonly storage: IDocumentStorageService,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic dispose() {}\n\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this.storage;\n\t}\n\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\treturn new EmptyDeltaStorageService();\n\t}\n\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\t// We have no delta stream, so make it not return forever...\n\t\treturn new Promise(() => {});\n\t}\n}\n\n/**\n * @internal\n */\nexport class StaticStorageDocumentServiceFactory implements IDocumentServiceFactory {\n\tpublic constructor(protected readonly storage: IDocumentStorageService) {}\n\n\tpublic async createDocumentService(\n\t\tfileURL: IResolvedUrl,\n\t\tlogger?: ITelemetryLoggerExt,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn new StaticStorageDocumentService(fileURL, this.storage);\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: ITelemetryLoggerExt,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/replay-driver",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "Document replay version of Socket.IO implementation",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"main": "lib/index.js",
|
|
38
38
|
"types": "lib/public.d.ts",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@fluid-internal/client-utils": "~2.
|
|
41
|
-
"@fluidframework/core-interfaces": "~2.
|
|
42
|
-
"@fluidframework/core-utils": "~2.
|
|
43
|
-
"@fluidframework/driver-definitions": "~2.
|
|
44
|
-
"@fluidframework/driver-utils": "~2.
|
|
45
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
40
|
+
"@fluid-internal/client-utils": "~2.13.0",
|
|
41
|
+
"@fluidframework/core-interfaces": "~2.13.0",
|
|
42
|
+
"@fluidframework/core-utils": "~2.13.0",
|
|
43
|
+
"@fluidframework/driver-definitions": "~2.13.0",
|
|
44
|
+
"@fluidframework/driver-utils": "~2.13.0",
|
|
45
|
+
"@fluidframework/telemetry-utils": "~2.13.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@fluidframework/build-common": "^2.0.3",
|
|
52
52
|
"@fluidframework/build-tools": "^0.51.0",
|
|
53
53
|
"@fluidframework/eslint-config-fluid": "^5.6.0",
|
|
54
|
-
"@fluidframework/replay-driver-previous": "npm:@fluidframework/replay-driver@2.
|
|
54
|
+
"@fluidframework/replay-driver-previous": "npm:@fluidframework/replay-driver@2.12.0",
|
|
55
55
|
"@microsoft/api-extractor": "7.47.8",
|
|
56
56
|
"@types/nock": "^9.3.0",
|
|
57
57
|
"@types/node": "^18.19.0",
|
|
@@ -26,7 +26,6 @@ import { ReplayDocumentDeltaConnection } from "./replayDocumentDeltaConnection.j
|
|
|
26
26
|
*/
|
|
27
27
|
export class ReplayDocumentService
|
|
28
28
|
extends TypedEventEmitter<IDocumentServiceEvents>
|
|
29
|
-
// eslint-disable-next-line import/namespace
|
|
30
29
|
implements IDocumentService
|
|
31
30
|
{
|
|
32
31
|
public static async create(
|
|
@@ -80,9 +80,9 @@ export class FileSnapshotReader
|
|
|
80
80
|
throw new Error(`Unknown version id: ${versionRequested}`);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
let snapshotTree = this.trees[versionRequested.id];
|
|
83
|
+
let snapshotTree: ISnapshotTree | undefined = this.trees[versionRequested.id];
|
|
84
84
|
if (snapshotTree === undefined) {
|
|
85
|
-
const tree = this.commits[versionRequested.id];
|
|
85
|
+
const tree: ITree | undefined = this.commits[versionRequested.id];
|
|
86
86
|
if (tree === undefined) {
|
|
87
87
|
throw new Error(`Can't find version ${versionRequested.id}`);
|
|
88
88
|
}
|