@fluidframework/replay-driver 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.eslintrc.js +5 -7
  2. package/api-extractor.json +2 -2
  3. package/dist/emptyDeltaStorageService.d.ts.map +1 -1
  4. package/dist/emptyDeltaStorageService.js.map +1 -1
  5. package/dist/packageVersion.d.ts +1 -1
  6. package/dist/packageVersion.js +1 -1
  7. package/dist/packageVersion.js.map +1 -1
  8. package/dist/replayController.d.ts.map +1 -1
  9. package/dist/replayController.js.map +1 -1
  10. package/dist/replayDocumentDeltaConnection.d.ts.map +1 -1
  11. package/dist/replayDocumentDeltaConnection.js +12 -9
  12. package/dist/replayDocumentDeltaConnection.js.map +1 -1
  13. package/dist/replayDocumentService.d.ts.map +1 -1
  14. package/dist/replayDocumentService.js.map +1 -1
  15. package/dist/replayDocumentServiceFactory.d.ts.map +1 -1
  16. package/dist/replayDocumentServiceFactory.js.map +1 -1
  17. package/dist/storageImplementations.d.ts.map +1 -1
  18. package/dist/storageImplementations.js.map +1 -1
  19. package/lib/emptyDeltaStorageService.d.ts.map +1 -1
  20. package/lib/emptyDeltaStorageService.js.map +1 -1
  21. package/lib/packageVersion.d.ts +1 -1
  22. package/lib/packageVersion.js +1 -1
  23. package/lib/packageVersion.js.map +1 -1
  24. package/lib/replayController.d.ts.map +1 -1
  25. package/lib/replayController.js.map +1 -1
  26. package/lib/replayDocumentDeltaConnection.d.ts.map +1 -1
  27. package/lib/replayDocumentDeltaConnection.js +12 -9
  28. package/lib/replayDocumentDeltaConnection.js.map +1 -1
  29. package/lib/replayDocumentService.d.ts.map +1 -1
  30. package/lib/replayDocumentService.js.map +1 -1
  31. package/lib/replayDocumentServiceFactory.d.ts.map +1 -1
  32. package/lib/replayDocumentServiceFactory.js.map +1 -1
  33. package/lib/storageImplementations.d.ts.map +1 -1
  34. package/lib/storageImplementations.js.map +1 -1
  35. package/package.json +34 -33
  36. package/prettier.config.cjs +1 -1
  37. package/src/emptyDeltaStorageService.ts +14 -13
  38. package/src/packageVersion.ts +1 -1
  39. package/src/replayController.ts +59 -55
  40. package/src/replayDocumentDeltaConnection.ts +323 -310
  41. package/src/replayDocumentService.ts +46 -44
  42. package/src/replayDocumentServiceFactory.ts +58 -44
  43. package/src/storageImplementations.ts +154 -150
  44. package/tsconfig.esnext.json +6 -6
  45. package/tsconfig.json +8 -13
@@ -1 +1 @@
1
- {"version":3,"file":"replayDocumentDeltaConnection.js","sourceRoot":"","sources":["../src/replayDocumentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAUH,SAAS,GACZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAEtC,MAAM,OAAO,sBAAuB,SAAQ,gBAAgB;IAMxD,gDAAgD;IAEhD;;;;;;OAMG;IACH,YACoB,UAAkB,EAClB,QAAgB,EAChB,UAAoB;QACpC,KAAK,EAAE,CAAC;QAHQ,eAAU,GAAV,UAAU,CAAQ;QAClB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,eAAU,GAAV,UAAU,CAAU;QAbhC,kBAAa,GAAG,CAAC,CAAC;QAetB,IAAI,UAAU,KAAK,IAAI,EAAE;YACrB,qFAAqF;YACrF,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;SACrB;IACL,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,eAAiC;QACtD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,SAAwB,EAAE,KAAa;QAC5D,OAAO,EAAE,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,OAAkB;QAC3C,OAAO,OAAO,CA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Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/common-definitions\";\nimport {\n IDocumentDeltaConnection,\n IDocumentDeltaStorageService,\n IDocumentDeltaConnectionEvents,\n IDocumentService,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ConnectionMode,\n IClientConfiguration,\n IConnected,\n IDocumentMessage,\n ISequencedDocumentMessage,\n ISignalClient,\n ISignalMessage,\n ITokenClaims,\n IVersion,\n ScopeType,\n} from \"@fluidframework/protocol-definitions\";\nimport { delay, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { ReplayController } from \"./replayController\";\n\nconst ReplayDocumentId = \"documentId\";\n\nexport class ReplayControllerStatic extends ReplayController {\n private static readonly DelayInterval = 50;\n private static readonly ReplayResolution = 15;\n\n private firstTimeStamp: number | undefined;\n private replayCurrent = 0;\n // Simulated delay interval for emitting the ops\n\n /**\n * Helper class\n *\n * @param replayFrom - First op to be played on socket.\n * @param replayTo - Last op number to be played on socket.\n * @param unitIsTime - True is user want to play ops that are within a replay resolution window.\n */\n public constructor(\n public readonly replayFrom: number,\n public readonly replayTo: number,\n public readonly unitIsTime?: boolean) {\n super();\n if (unitIsTime !== true) {\n // There is no code in here to start with snapshot, thus we have to start with op #0.\n this.replayTo = 0;\n }\n }\n\n public async initStorage(documentService: IDocumentService) {\n return true;\n }\n\n public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n return [];\n }\n\n public async getSnapshotTree(version?: IVersion) {\n return version ? Promise.reject(new Error(\"Invalid operation\")) : null;\n }\n\n public async readBlob(blobId: string): Promise<ArrayBufferLike> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public async getStartingOpSequence(): Promise<number> {\n return 0;\n }\n\n public fetchTo(currentOp: number) {\n if (!(this.unitIsTime !== true && this.replayTo >= 0)) {\n return undefined;\n }\n return this.replayTo;\n }\n\n public isDoneFetch(currentOp: number, lastTimeStamp?: number) {\n if (this.replayTo >= 0) {\n if (this.unitIsTime === true) {\n return (\n lastTimeStamp !== undefined\n && this.firstTimeStamp !== undefined\n && lastTimeStamp - this.firstTimeStamp >= this.replayTo);\n }\n return currentOp >= this.replayTo;\n }\n return lastTimeStamp === undefined; // No more ops\n }\n\n public skipToIndex(fetchedOps: ISequencedDocumentMessage[]) {\n if (this.replayFrom <= 0) {\n return 0;\n }\n if (this.unitIsTime === true) {\n for (let i = 0; i < fetchedOps.length; i += 1) {\n const timeStamp = fetchedOps[i].timestamp;\n if (timeStamp !== undefined) {\n if (this.firstTimeStamp === undefined) {\n this.firstTimeStamp = timeStamp;\n }\n if (timeStamp - this.firstTimeStamp >= this.replayFrom) {\n return i;\n }\n }\n }\n } else if (this.replayFrom > this.replayCurrent) {\n return this.replayFrom - this.replayCurrent;\n }\n return 0;\n }\n\n public async replay(\n emitter: (op: ISequencedDocumentMessage[]) => void,\n fetchedOps: ISequencedDocumentMessage[]): Promise<void> {\n let current = this.skipToIndex(fetchedOps);\n\n return new Promise((resolve) => {\n const replayNextOps = () => {\n // Emit the ops from replay to the end every \"deltainterval\" milliseconds\n // to simulate the socket stream\n const currentOp = fetchedOps[current];\n const playbackOps = [currentOp];\n let nextInterval = ReplayControllerStatic.DelayInterval;\n current += 1;\n\n if (this.unitIsTime === true) {\n const currentTimeStamp = currentOp.timestamp;\n if (currentTimeStamp !== undefined) {\n // Emit more ops that is in the ReplayResolution window\n\n while (current < fetchedOps.length) {\n const op = fetchedOps[current];\n if (op.timestamp === undefined) {\n // Missing timestamp, just delay the standard amount of time\n break;\n }\n const timeDiff = op.timestamp - currentTimeStamp;\n if (timeDiff >= ReplayControllerStatic.ReplayResolution) {\n // Time exceeded the resolution window, break out the loop\n // and delay for the time difference.\n nextInterval = timeDiff;\n break;\n }\n if (timeDiff < 0) {\n // Time have regressed, just delay the standard amount of time\n break;\n }\n\n // The op is within the ReplayResolution emit it now\n playbackOps.push(op);\n current += 1;\n }\n\n if (this.firstTimeStamp !== undefined\n && this.replayTo >= 0\n && currentTimeStamp + nextInterval - this.firstTimeStamp > this.replayTo) {\n nextInterval = -1;\n }\n }\n }\n scheduleNext(nextInterval);\n emitter(playbackOps);\n };\n const scheduleNext = (nextInterval: number) => {\n if (nextInterval >= 0 && current < fetchedOps.length) {\n setTimeout(replayNextOps, nextInterval);\n } else {\n this.replayCurrent += current;\n resolve();\n }\n };\n scheduleNext(ReplayControllerStatic.DelayInterval);\n });\n }\n}\n\nexport class ReplayDocumentDeltaConnection\n extends TypedEventEmitter<IDocumentDeltaConnectionEvents>\n implements IDocumentDeltaConnection, IDisposable {\n /**\n * Creates a new delta connection and mimics the delta connection to replay ops on it.\n * @param documentService - The document service to be used to get underlying endpoints.\n */\n public static create(\n documentStorageService: IDocumentDeltaStorageService,\n controller: ReplayController): IDocumentDeltaConnection {\n const connection: IConnected = {\n claims: ReplayDocumentDeltaConnection.claims,\n clientId: \"PseudoClientId\",\n existing: true,\n initialMessages: [],\n initialSignals: [],\n initialClients: [],\n maxMessageSize: ReplayDocumentDeltaConnection.ReplayMaxMessageSize,\n mode: \"read\",\n serviceConfiguration: {\n blockSize: 64436,\n maxMessageSize: ReplayDocumentDeltaConnection.ReplayMaxMessageSize,\n },\n supportedVersions: [ReplayDocumentDeltaConnection.replayProtocolVersion],\n version: ReplayDocumentDeltaConnection.replayProtocolVersion,\n };\n const deltaConnection = new ReplayDocumentDeltaConnection(connection);\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n deltaConnection.fetchAndEmitOps(documentStorageService, controller);\n\n return deltaConnection;\n }\n\n private static readonly replayProtocolVersion = \"^0.1.0\";\n // Since the replay service never actually sends messages the size below is arbitrary\n private static readonly ReplayMaxMessageSize = 16 * 1024;\n\n private static readonly claims: ITokenClaims = {\n documentId: ReplayDocumentId,\n scopes: [ScopeType.DocRead],\n tenantId: \"\",\n user: {\n id: \"\",\n },\n iat: Math.round(new Date().getTime() / 1000),\n exp: Math.round(new Date().getTime() / 1000) + 60 * 60, // 1 hour expiration\n ver: \"1.0\",\n };\n\n public get clientId(): string {\n return this.details.clientId;\n }\n\n public get mode(): ConnectionMode {\n return this.details.mode;\n }\n\n public get claims(): ITokenClaims {\n return this.details.claims;\n }\n\n public get existing(): boolean {\n return this.details.existing;\n }\n\n public get version(): string {\n return this.details.version;\n }\n\n public get initialMessages(): ISequencedDocumentMessage[] {\n return this.details.initialMessages;\n }\n\n public get initialSignals(): ISignalMessage[] {\n return this.details.initialSignals;\n }\n\n public get initialClients(): ISignalClient[] {\n return this.details.initialClients;\n }\n\n public get serviceConfiguration(): IClientConfiguration {\n return this.details.serviceConfiguration;\n }\n\n public readonly maxMessageSize = ReplayDocumentDeltaConnection.ReplayMaxMessageSize;\n\n constructor(\n public details: IConnected,\n ) {\n super();\n }\n\n public submit(documentMessage: IDocumentMessage[]): void {\n // ReplayDocumentDeltaConnection.submit() can't be called - client never sees its own join on,\n // and thus can never move to sending ops.\n throw new Error(\"ReplayDocumentDeltaConnection.submit() can't be called\");\n }\n\n public async submitSignal(message: any) {\n }\n\n private _disposed = false;\n public get disposed() { return this._disposed; }\n public dispose() { this._disposed = true; }\n\n /**\n * This gets the specified ops from the delta storage endpoint and replays them in the replayer.\n */\n private async fetchAndEmitOps(\n documentStorageService: IDocumentDeltaStorageService,\n controller: ReplayController,\n ): Promise<void> {\n let done;\n let replayPromiseChain = Promise.resolve();\n\n let currentOp = await controller.getStartingOpSequence();\n\n do {\n const fetchTo = controller.fetchTo(currentOp);\n\n const abortController = new AbortController();\n const stream = documentStorageService.fetchMessages(currentOp + 1, fetchTo, abortController.signal);\n do {\n const result = await stream.read();\n\n if (result.done) {\n // No more ops. But, they can show up later, either because document was just created,\n // or because another client keeps submitting new ops.\n done = controller.isDoneFetch(currentOp, undefined);\n if (!done) {\n await delay(2000);\n }\n break;\n }\n replayPromiseChain = replayPromiseChain.then(\n async () => controller.replay((ops) => this.emit(\"op\", ReplayDocumentId, ops), messages));\n\n const messages = result.value;\n currentOp += messages.length;\n done = controller.isDoneFetch(currentOp, messages[messages.length - 1].timestamp);\n } while (!done);\n\n abortController.abort();\n } while (!done);\n return replayPromiseChain;\n }\n}\n"]}
1
+ {"version":3,"file":"replayDocumentDeltaConnection.js","sourceRoot":"","sources":["../src/replayDocumentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAUN,SAAS,GACT,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAEtC,MAAM,OAAO,sBAAuB,SAAQ,gBAAgB;IAM3D,gDAAgD;IAEhD;;;;;;OAMG;IACH,YACiB,UAAkB,EAClB,QAAgB,EAChB,UAAoB;QAEpC,KAAK,EAAE,CAAC;QAJQ,eAAU,GAAV,UAAU,CAAQ;QAClB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,eAAU,GAAV,UAAU,CAAU;QAb7B,kBAAa,GAAG,CAAC,CAAC;QAgBzB,IAAI,UAAU,KAAK,IAAI,EAAE;YACxB,qFAAqF;YACrF,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;SAClB;IACF,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,eAAiC;QACzD,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,SAAwB,EAAE,KAAa;QAC/D,OAAO,EAAE,CAAC;IACX,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,OAAkB;QAC9C,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAc;QACnC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CA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,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,CAC5E,CAAC;gBAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;gBAC9B,SAAS,IAAI,QAAQ,CAAC,MAAM,CAAC;gBAC7B,IAAI,GAAG,UAAU,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;aAClF,QAAQ,CAAC,IAAI,EAAE;YAEhB,eAAe,CAAC,KAAK,EAAE,CAAC;SACxB,QAAQ,CAAC,IAAI,EAAE;QAChB,OAAO,kBAAkB,CAAC;IAC3B,CAAC;;AAvHuB,mDAAqB,GAAG,QAAQ,CAAC;AACzD,qFAAqF;AAC7D,kDAAoB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEjC,oCAAM,GAAiB;IAC9C,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;IAC3B,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE;QACL,EAAE,EAAE,EAAE;KACN;IACD,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC;IAC5C,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE;IACtD,GAAG,EAAE,KAAK;CACV,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/common-definitions\";\nimport {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentDeltaConnectionEvents,\n\tIDocumentService,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tConnectionMode,\n\tIClientConfiguration,\n\tIConnected,\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tISignalClient,\n\tISignalMessage,\n\tITokenClaims,\n\tIVersion,\n\tScopeType,\n} from \"@fluidframework/protocol-definitions\";\nimport { delay, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { ReplayController } from \"./replayController\";\n\nconst ReplayDocumentId = \"documentId\";\n\nexport class ReplayControllerStatic extends ReplayController {\n\tprivate static readonly DelayInterval = 50;\n\tprivate static readonly ReplayResolution = 15;\n\n\tprivate firstTimeStamp: number | undefined;\n\tprivate replayCurrent = 0;\n\t// Simulated delay interval for emitting the ops\n\n\t/**\n\t * Helper class\n\t *\n\t * @param replayFrom - First op to be played on socket.\n\t * @param replayTo - Last op number to be played on socket.\n\t * @param unitIsTime - True is user want to play ops that are within a replay resolution window.\n\t */\n\tpublic constructor(\n\t\tpublic readonly replayFrom: number,\n\t\tpublic readonly replayTo: number,\n\t\tpublic readonly unitIsTime?: boolean,\n\t) {\n\t\tsuper();\n\t\tif (unitIsTime !== true) {\n\t\t\t// There is no code in here to start with snapshot, thus we have to start with op #0.\n\t\t\tthis.replayTo = 0;\n\t\t}\n\t}\n\n\tpublic async initStorage(documentService: IDocumentService) {\n\t\treturn true;\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\treturn [];\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion) {\n\t\treturn version ? Promise.reject(new Error(\"Invalid operation\")) : null;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn Promise.reject(new Error(\"Invalid operation\"));\n\t}\n\n\tpublic async getStartingOpSequence(): Promise<number> {\n\t\treturn 0;\n\t}\n\n\tpublic fetchTo(currentOp: number) {\n\t\tif (!(this.unitIsTime !== true && this.replayTo >= 0)) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this.replayTo;\n\t}\n\n\tpublic isDoneFetch(currentOp: number, lastTimeStamp?: number) {\n\t\tif (this.replayTo >= 0) {\n\t\t\tif (this.unitIsTime === true) {\n\t\t\t\treturn (\n\t\t\t\t\tlastTimeStamp !== undefined &&\n\t\t\t\t\tthis.firstTimeStamp !== undefined &&\n\t\t\t\t\tlastTimeStamp - this.firstTimeStamp >= this.replayTo\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn currentOp >= this.replayTo;\n\t\t}\n\t\treturn lastTimeStamp === undefined; // No more ops\n\t}\n\n\tpublic skipToIndex(fetchedOps: ISequencedDocumentMessage[]) {\n\t\tif (this.replayFrom <= 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tif (this.unitIsTime === true) {\n\t\t\tfor (let i = 0; i < fetchedOps.length; i += 1) {\n\t\t\t\tconst timeStamp = fetchedOps[i].timestamp;\n\t\t\t\tif (timeStamp !== undefined) {\n\t\t\t\t\tif (this.firstTimeStamp === undefined) {\n\t\t\t\t\t\tthis.firstTimeStamp = timeStamp;\n\t\t\t\t\t}\n\t\t\t\t\tif (timeStamp - this.firstTimeStamp >= this.replayFrom) {\n\t\t\t\t\t\treturn i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (this.replayFrom > this.replayCurrent) {\n\t\t\treturn this.replayFrom - this.replayCurrent;\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic async replay(\n\t\temitter: (op: ISequencedDocumentMessage[]) => void,\n\t\tfetchedOps: ISequencedDocumentMessage[],\n\t): Promise<void> {\n\t\tlet current = this.skipToIndex(fetchedOps);\n\n\t\treturn new Promise((resolve) => {\n\t\t\tconst replayNextOps = () => {\n\t\t\t\t// Emit the ops from replay to the end every \"deltainterval\" milliseconds\n\t\t\t\t// to simulate the socket stream\n\t\t\t\tconst currentOp = fetchedOps[current];\n\t\t\t\tconst playbackOps = [currentOp];\n\t\t\t\tlet nextInterval = ReplayControllerStatic.DelayInterval;\n\t\t\t\tcurrent += 1;\n\n\t\t\t\tif (this.unitIsTime === true) {\n\t\t\t\t\tconst currentTimeStamp = currentOp.timestamp;\n\t\t\t\t\tif (currentTimeStamp !== undefined) {\n\t\t\t\t\t\t// Emit more ops that is in the ReplayResolution window\n\n\t\t\t\t\t\twhile (current < fetchedOps.length) {\n\t\t\t\t\t\t\tconst op = fetchedOps[current];\n\t\t\t\t\t\t\tif (op.timestamp === undefined) {\n\t\t\t\t\t\t\t\t// Missing timestamp, just delay the standard amount of time\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst timeDiff = op.timestamp - currentTimeStamp;\n\t\t\t\t\t\t\tif (timeDiff >= ReplayControllerStatic.ReplayResolution) {\n\t\t\t\t\t\t\t\t// Time exceeded the resolution window, break out the loop\n\t\t\t\t\t\t\t\t// and delay for the time difference.\n\t\t\t\t\t\t\t\tnextInterval = timeDiff;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (timeDiff < 0) {\n\t\t\t\t\t\t\t\t// Time have regressed, just delay the standard amount of time\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// The op is within the ReplayResolution emit it now\n\t\t\t\t\t\t\tplaybackOps.push(op);\n\t\t\t\t\t\t\tcurrent += 1;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tthis.firstTimeStamp !== undefined &&\n\t\t\t\t\t\t\tthis.replayTo >= 0 &&\n\t\t\t\t\t\t\tcurrentTimeStamp + nextInterval - this.firstTimeStamp > this.replayTo\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnextInterval = -1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tscheduleNext(nextInterval);\n\t\t\t\temitter(playbackOps);\n\t\t\t};\n\t\t\tconst scheduleNext = (nextInterval: number) => {\n\t\t\t\tif (nextInterval >= 0 && current < fetchedOps.length) {\n\t\t\t\t\tsetTimeout(replayNextOps, nextInterval);\n\t\t\t\t} else {\n\t\t\t\t\tthis.replayCurrent += current;\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t};\n\t\t\tscheduleNext(ReplayControllerStatic.DelayInterval);\n\t\t});\n\t}\n}\n\nexport class ReplayDocumentDeltaConnection\n\textends TypedEventEmitter<IDocumentDeltaConnectionEvents>\n\timplements IDocumentDeltaConnection, IDisposable\n{\n\t/**\n\t * Creates a new delta connection and mimics the delta connection to replay ops on it.\n\t * @param documentService - The document service to be used to get underlying endpoints.\n\t */\n\tpublic static create(\n\t\tdocumentStorageService: IDocumentDeltaStorageService,\n\t\tcontroller: ReplayController,\n\t): IDocumentDeltaConnection {\n\t\tconst connection: IConnected = {\n\t\t\tclaims: ReplayDocumentDeltaConnection.claims,\n\t\t\tclientId: \"PseudoClientId\",\n\t\t\texisting: true,\n\t\t\tinitialMessages: [],\n\t\t\tinitialSignals: [],\n\t\t\tinitialClients: [],\n\t\t\tmaxMessageSize: ReplayDocumentDeltaConnection.ReplayMaxMessageSize,\n\t\t\tmode: \"read\",\n\t\t\tserviceConfiguration: {\n\t\t\t\tblockSize: 64436,\n\t\t\t\tmaxMessageSize: ReplayDocumentDeltaConnection.ReplayMaxMessageSize,\n\t\t\t},\n\t\t\tsupportedVersions: [ReplayDocumentDeltaConnection.replayProtocolVersion],\n\t\t\tversion: ReplayDocumentDeltaConnection.replayProtocolVersion,\n\t\t};\n\t\tconst deltaConnection = new ReplayDocumentDeltaConnection(connection);\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tdeltaConnection.fetchAndEmitOps(documentStorageService, controller);\n\n\t\treturn deltaConnection;\n\t}\n\n\tprivate static readonly replayProtocolVersion = \"^0.1.0\";\n\t// Since the replay service never actually sends messages the size below is arbitrary\n\tprivate static readonly ReplayMaxMessageSize = 16 * 1024;\n\n\tprivate static readonly claims: ITokenClaims = {\n\t\tdocumentId: ReplayDocumentId,\n\t\tscopes: [ScopeType.DocRead],\n\t\ttenantId: \"\",\n\t\tuser: {\n\t\t\tid: \"\",\n\t\t},\n\t\tiat: Math.round(new Date().getTime() / 1000),\n\t\texp: Math.round(new Date().getTime() / 1000) + 60 * 60, // 1 hour expiration\n\t\tver: \"1.0\",\n\t};\n\n\tpublic get clientId(): string {\n\t\treturn this.details.clientId;\n\t}\n\n\tpublic get mode(): ConnectionMode {\n\t\treturn this.details.mode;\n\t}\n\n\tpublic get claims(): ITokenClaims {\n\t\treturn this.details.claims;\n\t}\n\n\tpublic get existing(): boolean {\n\t\treturn this.details.existing;\n\t}\n\n\tpublic get version(): string {\n\t\treturn this.details.version;\n\t}\n\n\tpublic get initialMessages(): ISequencedDocumentMessage[] {\n\t\treturn this.details.initialMessages;\n\t}\n\n\tpublic get initialSignals(): ISignalMessage[] {\n\t\treturn this.details.initialSignals;\n\t}\n\n\tpublic get initialClients(): ISignalClient[] {\n\t\treturn this.details.initialClients;\n\t}\n\n\tpublic get serviceConfiguration(): IClientConfiguration {\n\t\treturn this.details.serviceConfiguration;\n\t}\n\n\tpublic readonly maxMessageSize = ReplayDocumentDeltaConnection.ReplayMaxMessageSize;\n\n\tconstructor(public details: IConnected) {\n\t\tsuper();\n\t}\n\n\tpublic submit(documentMessage: IDocumentMessage[]): void {\n\t\t// ReplayDocumentDeltaConnection.submit() can't be called - client never sees its own join on,\n\t\t// and thus can never move to sending ops.\n\t\tthrow new Error(\"ReplayDocumentDeltaConnection.submit() can't be called\");\n\t}\n\n\tpublic async submitSignal(message: any) {}\n\n\tprivate _disposed = false;\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\tpublic dispose() {\n\t\tthis._disposed = true;\n\t}\n\n\t/**\n\t * This gets the specified ops from the delta storage endpoint and replays them in the replayer.\n\t */\n\tprivate async fetchAndEmitOps(\n\t\tdocumentStorageService: IDocumentDeltaStorageService,\n\t\tcontroller: ReplayController,\n\t): Promise<void> {\n\t\tlet done;\n\t\tlet replayPromiseChain = Promise.resolve();\n\n\t\tlet currentOp = await controller.getStartingOpSequence();\n\n\t\tdo {\n\t\t\tconst fetchTo = controller.fetchTo(currentOp);\n\n\t\t\tconst abortController = new AbortController();\n\t\t\tconst stream = documentStorageService.fetchMessages(\n\t\t\t\tcurrentOp + 1,\n\t\t\t\tfetchTo,\n\t\t\t\tabortController.signal,\n\t\t\t);\n\t\t\tdo {\n\t\t\t\tconst result = await stream.read();\n\n\t\t\t\tif (result.done) {\n\t\t\t\t\t// No more ops. But, they can show up later, either because document was just created,\n\t\t\t\t\t// or because another client keeps submitting new ops.\n\t\t\t\t\tdone = controller.isDoneFetch(currentOp, undefined);\n\t\t\t\t\tif (!done) {\n\t\t\t\t\t\tawait delay(2000);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\treplayPromiseChain = replayPromiseChain.then(async () =>\n\t\t\t\t\tcontroller.replay((ops) => this.emit(\"op\", ReplayDocumentId, ops), messages),\n\t\t\t\t);\n\n\t\t\t\tconst messages = result.value;\n\t\t\t\tcurrentOp += messages.length;\n\t\t\t\tdone = controller.isDoneFetch(currentOp, messages[messages.length - 1].timestamp);\n\t\t\t} while (!done);\n\n\t\t\tabortController.abort();\n\t\t} while (!done);\n\t\treturn replayPromiseChain;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"replayDocumentService.d.ts","sourceRoot":"","sources":["../src/replayDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,GAAG,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD;;;;GAIG;AAEH,qBAAa,qBAAsB,YAAW,GAAG,CAAC,gBAAgB;IAgB1D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;WAhBb,MAAM,CACtB,eAAe,EAAE,GAAG,CAAC,gBAAgB,EACrC,UAAU,EAAE,gBAAgB,GAAG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OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as api from \"@fluidframework/driver-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\nimport { EmptyDeltaStorageService } from \"./emptyDeltaStorageService\";\nimport { ReplayController } from \"./replayController\";\nimport { ReplayDocumentDeltaConnection } from \"./replayDocumentDeltaConnection\";\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 */\n// eslint-disable-next-line import/namespace\nexport class ReplayDocumentService implements api.IDocumentService {\n public static async create(\n documentService: api.IDocumentService,\n controller: ReplayController): Promise<api.IDocumentService> {\n const useController = await controller.initStorage(documentService);\n if (!useController) {\n return documentService;\n }\n\n const deltaConnection = ReplayDocumentDeltaConnection.create(\n await documentService.connectToDeltaStorage(),\n controller);\n return new ReplayDocumentService(controller, deltaConnection);\n }\n\n constructor(\n private readonly controller: api.IDocumentStorageService,\n private readonly deltaStorage: api.IDocumentDeltaConnection) {\n }\n\n public dispose() {}\n\n // TODO: Issue-2109 Implement detach container api or put appropriate comment.\n public get resolvedUrl(): api.IResolvedUrl {\n throw new Error(\"Not implemented\");\n }\n\n /**\n * Connects to a storage endpoint for snapshot service and blobs.\n * @returns returns the dummy document storage service for replay driver.\n */\n public async connectToStorage(): Promise<api.IDocumentStorageService> {\n return this.controller;\n }\n\n /**\n * Connects to a delta storage endpoint for getting ops between a range.\n * @returns returns the dummy document delta storage service for replay driver.\n */\n public async connectToDeltaStorage(): Promise<api.IDocumentDeltaStorageService> {\n return new EmptyDeltaStorageService();\n }\n\n /**\n * Connects to a delta storage endpoint of provided documentService to get ops and then replaying\n * them so as to mimic a delta stream endpoint.\n * @param client - Client that connects to socket.\n * @returns returns the delta stream service which replay ops from --from to --to arguments.\n */\n public async connectToDeltaStream(client: IClient): Promise<api.IDocumentDeltaConnection> {\n return this.deltaStorage;\n }\n}\n"]}
1
+ {"version":3,"file":"replayDocumentService.js","sourceRoot":"","sources":["../src/replayDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAEhF;;;;GAIG;AACH,4CAA4C;AAC5C,MAAM,OAAO,qBAAqB;IAiBjC,YACkB,UAAuC,EACvC,YAA0C;QAD1C,eAAU,GAAV,UAAU,CAA6B;QACvC,iBAAY,GAAZ,YAAY,CAA8B;IACzD,CAAC;IAnBG,MAAM,CAAC,KAAK,CAAC,MAAM,CACzB,eAAqC,EACrC,UAA4B;QAE5B,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QACpE,IAAI,CAAC,aAAa,EAAE;YACnB,OAAO,eAAe,CAAC;SACvB;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;IAOM,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 * as api from \"@fluidframework/driver-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\nimport { EmptyDeltaStorageService } from \"./emptyDeltaStorageService\";\nimport { ReplayController } from \"./replayController\";\nimport { ReplayDocumentDeltaConnection } from \"./replayDocumentDeltaConnection\";\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 */\n// eslint-disable-next-line import/namespace\nexport class ReplayDocumentService implements api.IDocumentService {\n\tpublic static async create(\n\t\tdocumentService: api.IDocumentService,\n\t\tcontroller: ReplayController,\n\t): Promise<api.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: api.IDocumentStorageService,\n\t\tprivate readonly deltaStorage: api.IDocumentDeltaConnection,\n\t) {}\n\n\tpublic dispose() {}\n\n\t// TODO: Issue-2109 Implement detach container api or put appropriate comment.\n\tpublic get resolvedUrl(): api.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<api.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<api.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<api.IDocumentDeltaConnection> {\n\t\treturn this.deltaStorage;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"replayDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/replayDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAC7G,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,qBAAa,4BAA6B,YAAW,uBAAuB;IAcpE,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU;WAdjB,MAAM,CAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,sBAAsB,EAAE,uBAAuB;IAOnD,SAAgB,YAAY,MAAC;gBAGR,sBAAsB,EAAE,uBAAuB,EAC/C,UAAU,EAAE,gBAAgB;IAIjD;;;;;OAKG;IACU,qBAAqB,CAC9B,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC7B,OAAO,CAAC,gBAAgB,CAAC;IAYf,eAAe,CACxB,gBAAgB,EAAE,YAAY,EAC9B,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC7B,OAAO,CAAC,gBAAgB,CAAC;CAG/B"}
1
+ {"version":3,"file":"replayDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/replayDocumentServiceFactory.ts"],"names":[],"m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sBAAsB,CAAyB;QAC/C,eAAU,GAAV,UAAU,CAAkB;QAC7C,IAAI,CAAC,YAAY,GAAG,sBAAsB,CAAC,YAAY,CAAC;IAC5D,CAAC;IAhBM,MAAM,CAAC,MAAM,CAChB,IAAY,EACZ,EAAU,EACV,sBAA+C;QAC/C,OAAO,IAAI,4BAA4B,CACnC,sBAAsB,EACtB,IAAI,sBAAsB,CAAC,IAAI,EAAE,EAAE,CAAC,CACvC,CAAC;IACN,CAAC;IAUD;;;;;OAKG;IACI,KAAK,CAAC,qBAAqB,CAC9B,WAAyB,EACzB,MAA6B,EAC7B,kBAA4B;QAE5B,iEAAiE;QACjE,wGAAwG;QACxG,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CACnC,MAAM,EAAE,SAAS,CAAC,eAAe,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC;QAErF,OAAO,qBAAqB,CAAC,MAAM,CAC/B,MAAM,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,WAAW,EAAE,YAAY,EAAE,kBAAkB,CAAC,EACtG,IAAI,CAAC,UAAU,CAAC,CAAC;IACzB,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,eAAe,CACxB,gBAA8B,EAC9B,WAAyB,EACzB,MAA6B,EAC7B,kBAA4B;QAE5B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentService, IDocumentServiceFactory, IResolvedUrl } from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { ReplayController } from \"./replayController\";\nimport { ReplayControllerStatic } from \"./replayDocumentDeltaConnection\";\nimport { ReplayDocumentService } from \"./replayDocumentService\";\n\nexport class ReplayDocumentServiceFactory implements IDocumentServiceFactory {\n public static create(\n from: number,\n to: number,\n documentServiceFactory: IDocumentServiceFactory) {\n return new ReplayDocumentServiceFactory(\n documentServiceFactory,\n new ReplayControllerStatic(from, to),\n );\n }\n\n public readonly protocolName;\n\n public constructor(\n private readonly documentServiceFactory: IDocumentServiceFactory,\n private readonly controller: ReplayController) {\n this.protocolName = documentServiceFactory.protocolName;\n }\n\n /**\n * Creates a replay document service which uses the document service of provided\n * documentServiceFactory for connecting to delta stream endpoint.\n * @param resolvedUrl - URL to be used for connecting to endpoints.\n * @returns returns the requested document service\n */\n public async createDocumentService(\n resolvedUrl: IResolvedUrl,\n logger?: ITelemetryBaseLogger,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n // Always include isReplay: true on events for the Replay Driver.\n // It's used in testing/debugging scenarios, so we want to be able to filter these events out sometimes.\n const replayLogger = ChildLogger.create(\n logger, undefined /* namespace */, { all: { isReplay: true } } /* properties */);\n\n return ReplayDocumentService.create(\n await this.documentServiceFactory.createDocumentService(resolvedUrl, replayLogger, clientIsSummarizer),\n this.controller);\n }\n\n // TODO: Issue-2109 Implement detach container api or put appropriate comment.\n public async createContainer(\n createNewSummary: ISummaryTree,\n resolvedUrl: IResolvedUrl,\n logger?: ITelemetryBaseLogger,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n throw new Error(\"Not implemented\");\n }\n}\n"]}
1
+ {"version":3,"file":"replayDocumentServiceFactory.js","sourceRoot":"","sources":["../src/replayDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,OAAO,4BAA4B;IAcxC,YACkB,sBAA+C,EAC/C,UAA4B;QAD5B,2BAAsB,GAAtB,sBAAsB,CAAyB;QAC/C,eAAU,GAAV,UAAU,CAAkB;QAE7C,IAAI,CAAC,YAAY,GAAG,sBAAsB,CAAC,YAAY,CAAC;IACzD,CAAC;IAlBM,MAAM,CAAC,MAAM,CACnB,IAAY,EACZ,EAAU,EACV,sBAA+C;QAE/C,OAAO,IAAI,4BAA4B,CACtC,sBAAsB,EACtB,IAAI,sBAAsB,CAAC,IAAI,EAAE,EAAE,CAAC,CACpC,CAAC;IACH,CAAC;IAWD;;;;;OAKG;IACI,KAAK,CAAC,qBAAqB,CACjC,WAAyB,EACzB,MAA6B,EAC7B,kBAA4B;QAE5B,iEAAiE;QACjE,wGAAwG;QACxG,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CACtC,MAAM,EACN,SAAS,CAAC,eAAe,EACzB,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAC5C,CAAC;QAEF,OAAO,qBAAqB,CAAC,MAAM,CAClC,MAAM,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,CACtD,WAAW,EACX,YAAY,EACZ,kBAAkB,CAClB,EACD,IAAI,CAAC,UAAU,CACf,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\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { ReplayController } from \"./replayController\";\nimport { ReplayControllerStatic } from \"./replayDocumentDeltaConnection\";\nimport { ReplayDocumentService } from \"./replayDocumentService\";\n\nexport class ReplayDocumentServiceFactory implements IDocumentServiceFactory {\n\tpublic static create(\n\t\tfrom: number,\n\t\tto: number,\n\t\tdocumentServiceFactory: IDocumentServiceFactory,\n\t) {\n\t\treturn new ReplayDocumentServiceFactory(\n\t\t\tdocumentServiceFactory,\n\t\t\tnew ReplayControllerStatic(from, to),\n\t\t);\n\t}\n\n\tpublic readonly protocolName;\n\n\tpublic constructor(\n\t\tprivate readonly documentServiceFactory: IDocumentServiceFactory,\n\t\tprivate readonly controller: ReplayController,\n\t) {\n\t\tthis.protocolName = documentServiceFactory.protocolName;\n\t}\n\n\t/**\n\t * Creates a replay document service which uses the document service of provided\n\t * documentServiceFactory for connecting to delta stream endpoint.\n\t * @param resolvedUrl - URL to be used for connecting to endpoints.\n\t * @returns returns the requested 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\t// Always include isReplay: true on events for the Replay Driver.\n\t\t// It's used in testing/debugging scenarios, so we want to be able to filter these events out sometimes.\n\t\tconst replayLogger = ChildLogger.create(\n\t\t\tlogger,\n\t\t\tundefined /* namespace */,\n\t\t\t{ all: { isReplay: true } } /* properties */,\n\t\t);\n\n\t\treturn ReplayDocumentService.create(\n\t\t\tawait this.documentServiceFactory.createDocumentService(\n\t\t\t\tresolvedUrl,\n\t\t\t\treplayLogger,\n\t\t\t\tclientIsSummarizer,\n\t\t\t),\n\t\t\tthis.controller,\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"storageImplementations.d.ts","sourceRoot":"","sources":["../src/storageImplementations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACH,OAAO,EACP,aAAa,EACb,KAAK,EACL,QAAQ,EACR,YAAY,EACf,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC;KAAE,CAAC;CACtC;AAED,qBAAa,kBAAmB,SAAQ,8BAA+B,YAAW,uBAAuB;IAErG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,wBAAwB,uBAAuB;IAEzE,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC;IACjC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC9C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC;KAAE,CAAM;IAC3D,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;KAAE,CAAM;gBAE9C,IAAI,EAAE,aAAa;IAQzB,WAAW,CACpB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,EAAE,MAAM,GACd,OAAO,CAAC,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IAE3D,OAAO,KAAI,CAAC;IAEnB,8EAA8E;IAC9E,IAAW,WAAW;QAClB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,gBAAgB;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,qBAAqB;QAC9B,OAAO,IAAI,wBAAwB,EAAE,CAAC;IAC1C,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAC7C,4DAA4D;QAC5D,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAClC,CAAC;CACJ;AAED,MAAM,OAAO,mCAAmC;IAE5C,YAAsC,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;QADtD,iBAAY,GAAG,uBAAuB,CAAC;IACmB,CAAC;IAEpE,KAAK,CAAC,qBAAqB,CAC9B,OAAqB,EACrB,MAAyB,EACzB,kBAA4B;QAE5B,OAAO,IAAI,4BAA4B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,eAAe,CACxB,gBAA8B,EAC9B,WAAyB,EACzB,MAAwB,EACxB,kBAA4B;QAE5B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n IDocumentDeltaConnection,\n IDocumentDeltaStorageService,\n IDocumentService,\n IDocumentServiceFactory,\n IDocumentStorageService,\n IResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport {\n IClient,\n ISnapshotTree,\n ITree,\n IVersion,\n ISummaryTree,\n} from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { EmptyDeltaStorageService } from \"./emptyDeltaStorageService\";\nimport { ReadDocumentStorageServiceBase } from \"./replayController\";\n\n/**\n * Structure of snapshot on disk, when we store snapshot as single file\n */\nexport interface IFileSnapshot {\n tree: ITree;\n commits: { [key: string]: ITree; };\n}\n\nexport class FileSnapshotReader extends ReadDocumentStorageServiceBase implements IDocumentStorageService {\n // IVersion.treeId used to communicate between getVersions() & getSnapshotTree() calls to indicate IVersion is ours.\n protected static readonly FileStorageVersionTreeId = \"FileStorageTreeId\";\n\n protected docId?: string;\n protected docTree: ISnapshotTree;\n protected blobs: Map<string, ArrayBufferLike>;\n protected readonly commits: { [key: string]: ITree; } = {};\n protected readonly trees: { [key: string]: ISnapshotTree; } = {};\n\n public constructor(json: IFileSnapshot) {\n super();\n this.commits = json.commits;\n\n this.blobs = new Map<string, ArrayBufferLike>();\n this.docTree = buildSnapshotTree(json.tree.entries, this.blobs);\n }\n\n public async getVersions(\n versionId: string | null,\n count: number,\n ): Promise<IVersion[]> {\n if (this.docId === undefined || this.docId === versionId || versionId === null) {\n if (versionId !== null) {\n this.docId = versionId;\n }\n return [{ id: \"latest\", treeId: \"\" }];\n }\n\n if (this.commits[versionId] !== undefined) {\n return [{ id: versionId, treeId: FileSnapshotReader.FileStorageVersionTreeId }];\n }\n throw new Error(`Unknown version ID: ${versionId}`);\n }\n\n public async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n if (!versionRequested || versionRequested.id === \"latest\") {\n return this.docTree;\n }\n if (versionRequested.treeId !== FileSnapshotReader.FileStorageVersionTreeId) {\n throw new Error(`Unknown version id: ${versionRequested}`);\n }\n\n let snapshotTree = this.trees[versionRequested.id];\n if (snapshotTree === undefined) {\n const tree = this.commits[versionRequested.id];\n if (tree === undefined) {\n throw new Error(`Can't find version ${versionRequested.id}`);\n }\n\n this.trees[versionRequested.id] = snapshotTree = buildSnapshotTree(tree.entries, this.blobs);\n }\n return snapshotTree;\n }\n\n public async readBlob(blobId: string): Promise<ArrayBufferLike> {\n const blob = this.blobs.get(blobId);\n if (blob !== undefined) {\n return blob;\n }\n throw new Error(`Unknown blob ID: ${blobId}`);\n }\n}\n\nexport class SnapshotStorage extends ReadDocumentStorageServiceBase {\n protected docId?: string;\n\n constructor(\n protected readonly storage: IDocumentStorageService,\n protected readonly docTree: ISnapshotTree | null) {\n super();\n assert(!!this.docTree, 0x0b0 /* \"Missing document snapshot tree!\" */);\n }\n\n public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n if (this.docId === undefined || this.docId === versionId || versionId === null) {\n if (versionId !== null) {\n this.docId = versionId;\n }\n return [{ id: \"latest\", treeId: \"\" }];\n }\n return this.storage.getVersions(versionId, count);\n }\n\n public async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n if (versionRequested && versionRequested.id !== \"latest\") {\n return this.storage.getSnapshotTree(versionRequested);\n }\n\n return this.docTree;\n }\n\n public async readBlob(blobId: string): Promise<ArrayBufferLike> {\n return this.storage.readBlob(blobId);\n }\n}\n\nexport class OpStorage extends ReadDocumentStorageServiceBase {\n public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n return [];\n }\n\n public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n throw new Error(\"no snapshot tree should be asked when playing ops\");\n }\n\n public async readBlob(blobId: string): Promise<ArrayBufferLike> {\n throw new Error(`Unknown blob ID: ${blobId}`);\n }\n}\n\nexport class StaticStorageDocumentService implements IDocumentService {\n constructor(private readonly storage: IDocumentStorageService) { }\n\n public dispose() {}\n\n // TODO: Issue-2109 Implement detach container api or put appropriate comment.\n public get resolvedUrl(): IResolvedUrl {\n throw new Error(\"Not implemented\");\n }\n\n public async connectToStorage(): Promise<IDocumentStorageService> {\n return this.storage;\n }\n\n public async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n return new EmptyDeltaStorageService();\n }\n\n public async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n // We have no delta stream, so make it not return forever...\n return new Promise(() => { });\n }\n}\n\nexport class StaticStorageDocumentServiceFactory implements IDocumentServiceFactory {\n public readonly protocolName = \"fluid-static-storage:\";\n public constructor(protected readonly storage: IDocumentStorageService) { }\n\n public async createDocumentService(\n fileURL: IResolvedUrl,\n logger?: ITelemetryLogger,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n return new StaticStorageDocumentService(this.storage);\n }\n\n // TODO: Issue-2109 Implement detach container api or put appropriate comment.\n public async createContainer(\n createNewSummary: ISummaryTree,\n resolvedUrl: IResolvedUrl,\n logger: ITelemetryLogger,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n throw new Error(\"Not implemented\");\n }\n}\n"]}
1
+ {"version":3,"file":"storageImplementations.js","sourceRoot":"","sources":["../src/storageImplementations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAStD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AASjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAUpE,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,CA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CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,8EAA8E;IACvE,KAAK,CAAC,eAAe,CAC3B,gBAA8B,EAC9B,WAAyB,EACzB,MAAwB,EACxB,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 { assert } from \"@fluidframework/common-utils\";\nimport {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport {\n\tIClient,\n\tISnapshotTree,\n\tITree,\n\tIVersion,\n\tISummaryTree,\n} from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { EmptyDeltaStorageService } from \"./emptyDeltaStorageService\";\nimport { ReadDocumentStorageServiceBase } from \"./replayController\";\n\n/**\n * Structure of snapshot on disk, when we store snapshot as single file\n */\nexport interface IFileSnapshot {\n\ttree: ITree;\n\tcommits: { [key: string]: ITree };\n}\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\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\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 OpStorage extends ReadDocumentStorageServiceBase {\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\treturn [];\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\tthrow new Error(\"no snapshot tree should be asked when playing ops\");\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tthrow new Error(`Unknown blob ID: ${blobId}`);\n\t}\n}\n\nexport class StaticStorageDocumentService implements IDocumentService {\n\tconstructor(private readonly storage: IDocumentStorageService) {}\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\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\nexport class StaticStorageDocumentServiceFactory implements IDocumentServiceFactory {\n\tpublic readonly protocolName = \"fluid-static-storage:\";\n\tpublic constructor(protected readonly storage: IDocumentStorageService) {}\n\n\tpublic async createDocumentService(\n\t\tfileURL: IResolvedUrl,\n\t\tlogger?: ITelemetryLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn new StaticStorageDocumentService(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: ITelemetryLogger,\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.0.0-internal.3.0.2",
3
+ "version": "2.0.0-internal.3.2.0",
4
4
  "description": "Document replay version of Socket.IO implementation",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -14,41 +14,20 @@
14
14
  "main": "dist/index.js",
15
15
  "module": "lib/index.js",
16
16
  "types": "dist/index.d.ts",
17
- "scripts": {
18
- "build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
19
- "build:compile": "concurrently npm:typetests:gen npm:tsc npm:build:esnext",
20
- "build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
21
- "build:esnext": "tsc --project ./tsconfig.esnext.json",
22
- "build:full": "npm run build",
23
- "build:full:compile": "npm run build:compile",
24
- "build:genver": "gen-version",
25
- "ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
26
- "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
27
- "eslint": "eslint --format stylish src",
28
- "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
29
- "format": "npm run prettier:fix",
30
- "lint": "npm run eslint",
31
- "lint:fix": "npm run eslint:fix",
32
- "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
33
- "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
34
- "tsc": "tsc",
35
- "typetests:gen": "flub generate typetests --generate --dir .",
36
- "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
37
- },
38
17
  "dependencies": {
39
18
  "@fluidframework/common-definitions": "^0.20.1",
40
- "@fluidframework/common-utils": "^1.0.0",
41
- "@fluidframework/driver-definitions": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
42
- "@fluidframework/driver-utils": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
19
+ "@fluidframework/common-utils": "^1.1.1",
20
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
21
+ "@fluidframework/driver-utils": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
43
22
  "@fluidframework/protocol-definitions": "^1.1.0",
44
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0"
23
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0"
45
24
  },
46
25
  "devDependencies": {
47
- "@fluid-tools/build-cli": "^0.8.0",
26
+ "@fluid-tools/build-cli": "^0.10.0",
48
27
  "@fluidframework/build-common": "^1.1.0",
49
- "@fluidframework/build-tools": "^0.8.0",
28
+ "@fluidframework/build-tools": "^0.10.0",
50
29
  "@fluidframework/eslint-config-fluid": "^2.0.0",
51
- "@fluidframework/replay-driver-previous": "npm:@fluidframework/replay-driver@2.0.0-internal.3.0.0",
30
+ "@fluidframework/replay-driver-previous": "npm:@fluidframework/replay-driver@2.0.0-internal.3.1.0",
52
31
  "@microsoft/api-extractor": "^7.22.2",
53
32
  "@rushstack/eslint-config": "^2.5.1",
54
33
  "@types/mocha": "^9.1.1",
@@ -64,9 +43,31 @@
64
43
  "typescript": "~4.5.5"
65
44
  },
66
45
  "typeValidation": {
67
- "version": "2.0.0-internal.3.0.1",
68
- "previousVersionStyle": "previousPatch",
69
- "baselineRange": "2.0.0-internal.3.0.0",
46
+ "version": "2.0.0-internal.3.2.0",
47
+ "previousVersionStyle": "~previousMinor",
48
+ "baselineRange": ">=2.0.0-internal.3.1.0 <2.0.0-internal.3.2.0",
49
+ "baselineVersion": "2.0.0-internal.3.1.0",
70
50
  "broken": {}
51
+ },
52
+ "scripts": {
53
+ "build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
54
+ "build:compile": "concurrently npm:typetests:gen npm:tsc npm:build:esnext",
55
+ "build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
56
+ "build:esnext": "tsc --project ./tsconfig.esnext.json",
57
+ "build:full": "npm run build",
58
+ "build:full:compile": "npm run build:compile",
59
+ "build:genver": "gen-version",
60
+ "ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
61
+ "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
62
+ "eslint": "eslint --format stylish src",
63
+ "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
64
+ "format": "npm run prettier:fix",
65
+ "lint": "npm run prettier && npm run eslint",
66
+ "lint:fix": "npm run prettier:fix && npm run eslint:fix",
67
+ "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
68
+ "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
69
+ "tsc": "tsc",
70
+ "typetests:gen": "flub generate typetests --generate --dir .",
71
+ "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
71
72
  }
72
- }
73
+ }
@@ -4,5 +4,5 @@
4
4
  */
5
5
 
6
6
  module.exports = {
7
- ...require("@fluidframework/build-common/prettier.config.cjs"),
7
+ ...require("@fluidframework/build-common/prettier.config.cjs"),
8
8
  };
@@ -8,17 +8,18 @@ import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions"
8
8
  import { emptyMessageStream } from "@fluidframework/driver-utils";
9
9
 
10
10
  export class EmptyDeltaStorageService implements IDocumentDeltaStorageService {
11
- /**
12
- * Returns ops from the list of ops generated till now.
13
- * @param from - Ops are returned from + 1.
14
- * @param to - Op are returned from to - 1.
15
- * @returns Array of ops requested by the user.
16
- */
17
- public fetchMessages(
18
- from: number,
19
- to: number | undefined,
20
- abortSignal?: AbortSignal,
21
- cachedOnly?: boolean): IStream<ISequencedDocumentMessage[]> {
22
- return emptyMessageStream;
23
- }
11
+ /**
12
+ * Returns ops from the list of ops generated till now.
13
+ * @param from - Ops are returned from + 1.
14
+ * @param to - Op are returned from to - 1.
15
+ * @returns Array of ops requested by the user.
16
+ */
17
+ public fetchMessages(
18
+ from: number,
19
+ to: number | undefined,
20
+ abortSignal?: AbortSignal,
21
+ cachedOnly?: boolean,
22
+ ): IStream<ISequencedDocumentMessage[]> {
23
+ return emptyMessageStream;
24
+ }
24
25
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/replay-driver";
9
- export const pkgVersion = "2.0.0-internal.3.0.2";
9
+ export const pkgVersion = "2.0.0-internal.3.2.0";
@@ -4,9 +4,9 @@
4
4
  */
5
5
 
6
6
  import {
7
- IDocumentService,
8
- IDocumentStorageService,
9
- ISummaryContext,
7
+ IDocumentService,
8
+ IDocumentStorageService,
9
+ ISummaryContext,
10
10
  } from "@fluidframework/driver-definitions";
11
11
  import * as api from "@fluidframework/protocol-definitions";
12
12
 
@@ -14,25 +14,28 @@ import * as api from "@fluidframework/protocol-definitions";
14
14
  * Partial implementation of IDocumentStorageService
15
15
  */
16
16
  export abstract class ReadDocumentStorageServiceBase implements IDocumentStorageService {
17
- public abstract getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
18
- public abstract getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
19
- public abstract readBlob(blobId: string): Promise<ArrayBufferLike>;
17
+ public abstract getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
18
+ public abstract getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
19
+ public abstract readBlob(blobId: string): Promise<ArrayBufferLike>;
20
20
 
21
- public async uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string> {
22
- return Promise.reject(new Error("Invalid operation"));
23
- }
21
+ public async uploadSummaryWithContext(
22
+ summary: api.ISummaryTree,
23
+ context: ISummaryContext,
24
+ ): Promise<string> {
25
+ return Promise.reject(new Error("Invalid operation"));
26
+ }
24
27
 
25
- public async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {
26
- return Promise.reject(new Error("Invalid operation"));
27
- }
28
+ public async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {
29
+ return Promise.reject(new Error("Invalid operation"));
30
+ }
28
31
 
29
- public async downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree> {
30
- return Promise.reject(new Error("Invalid operation"));
31
- }
32
+ public async downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree> {
33
+ return Promise.reject(new Error("Invalid operation"));
34
+ }
32
35
 
33
- public get repositoryUrl(): string {
34
- throw new Error("Invalid operation");
35
- }
36
+ public get repositoryUrl(): string {
37
+ throw new Error("Invalid operation");
38
+ }
36
39
  }
37
40
 
38
41
  /**
@@ -41,45 +44,46 @@ export abstract class ReadDocumentStorageServiceBase implements IDocumentStorage
41
44
  * As well as dispatch of ops
42
45
  */
43
46
  export abstract class ReplayController extends ReadDocumentStorageServiceBase {
44
- /**
45
- * Initialize reply controller
46
- * @param documentService - the real document service
47
- * @returns - Boolean, indicating if controller should be used.
48
- * If false is returned, caller should fallback to original storage.
49
- */
50
- public abstract initStorage(documentService: IDocumentService): Promise<boolean>;
47
+ /**
48
+ * Initialize reply controller
49
+ * @param documentService - the real document service
50
+ * @returns - Boolean, indicating if controller should be used.
51
+ * If false is returned, caller should fallback to original storage.
52
+ */
53
+ public abstract initStorage(documentService: IDocumentService): Promise<boolean>;
51
54
 
52
- /**
53
- * Returns sequence number to start processing ops
54
- * Should be zero if not using snapshot, and snapshot seq# otherwise
55
- */
56
- public abstract getStartingOpSequence(): Promise<number>;
55
+ /**
56
+ * Returns sequence number to start processing ops
57
+ * Should be zero if not using snapshot, and snapshot seq# otherwise
58
+ */
59
+ public abstract getStartingOpSequence(): Promise<number>;
57
60
 
58
- /**
59
- * Returns last op number to fetch from current op
60
- * Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel
61
- * @param currentOp - current op
62
- */
63
- public abstract fetchTo(currentOp: number): number | undefined;
61
+ /**
62
+ * Returns last op number to fetch from current op
63
+ * Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel
64
+ * @param currentOp - current op
65
+ */
66
+ public abstract fetchTo(currentOp: number): number | undefined;
64
67
 
65
- /**
66
- * Returns true if no more ops should be processed (or downloaded for future processing).
67
- * It's called at end of each batch with latest op timestamp.
68
- * Also it's called when there are no more ops available (lastTimeStamp === undefined).
69
- * If false is returned and there are no more ops, request for more ops is made every 2 seconds.
70
- * Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel
71
- * @param currentOp - current op
72
- * @param lastTimeStamp - timestamp of last op (if more ops are available). Undefined otherwise.
73
- */
74
- public abstract isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean;
68
+ /**
69
+ * Returns true if no more ops should be processed (or downloaded for future processing).
70
+ * It's called at end of each batch with latest op timestamp.
71
+ * Also it's called when there are no more ops available (lastTimeStamp === undefined).
72
+ * If false is returned and there are no more ops, request for more ops is made every 2 seconds.
73
+ * Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel
74
+ * @param currentOp - current op
75
+ * @param lastTimeStamp - timestamp of last op (if more ops are available). Undefined otherwise.
76
+ */
77
+ public abstract isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean;
75
78
 
76
- /**
77
- * Replay batch of ops
78
- * NOTE: new batch of ops is fetched (fetchTo() & isDoneFetch() APIs are called) while this call is in flights
79
- * @param emitter - callback to emit ops
80
- * @param fetchedOps - ops to process
81
- */
82
- public abstract replay(
83
- emitter: (op: api.ISequencedDocumentMessage[]) => void,
84
- fetchedOps: api.ISequencedDocumentMessage[]): Promise<void>;
79
+ /**
80
+ * Replay batch of ops
81
+ * NOTE: new batch of ops is fetched (fetchTo() & isDoneFetch() APIs are called) while this call is in flights
82
+ * @param emitter - callback to emit ops
83
+ * @param fetchedOps - ops to process
84
+ */
85
+ public abstract replay(
86
+ emitter: (op: api.ISequencedDocumentMessage[]) => void,
87
+ fetchedOps: api.ISequencedDocumentMessage[],
88
+ ): Promise<void>;
85
89
  }