@fluidframework/replay-driver 0.59.4001 → 1.1.0-75972

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/.eslintrc.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  module.exports = {
7
7
  "extends": [
8
- "@fluidframework/eslint-config-fluid"
8
+ require.resolve("@fluidframework/eslint-config-fluid")
9
9
  ],
10
10
  "rules": {
11
11
  "@typescript-eslint/strict-boolean-expressions": "off",
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/replay-driver";
8
- export declare const pkgVersion = "0.59.4001";
8
+ export declare const pkgVersion = "1.1.0-75972";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,cAAc,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,gBAAgB,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/replay-driver";
11
- exports.pkgVersion = "0.59.4001";
11
+ exports.pkgVersion = "1.1.0-75972";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/replay-driver\";\nexport const pkgVersion = \"0.59.4001\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,UAAU,GAAG,aAAa,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/replay-driver\";\nexport const pkgVersion = \"1.1.0-75972\";\n"]}
@@ -12,7 +12,6 @@ export declare abstract class ReadDocumentStorageServiceBase implements IDocumen
12
12
  abstract getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
13
13
  abstract readBlob(blobId: string): Promise<ArrayBufferLike>;
14
14
  uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string>;
15
- write(tree: api.ITree, parents: string[], message: string, ref: string): Promise<api.IVersion>;
16
15
  createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse>;
17
16
  downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree>;
18
17
  get repositoryUrl(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"replayController.d.ts","sourceRoot":"","sources":["../src/replayController.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAE5D;;GAEG;AACH,8BAAsB,8B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AO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAE9D;;;;;;;;OAQG;aACa,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO;IAE/E;;;;;OAKG;aACa,MAAM,CAClB,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,yBAAyB,EAAE,KAAK,IAAI,EACtD,UAAU,EAAE,GAAG,CAAC,yBAAyB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAClE"}
@@ -12,9 +12,6 @@ class ReadDocumentStorageServiceBase {
12
12
  async uploadSummaryWithContext(summary, context) {
13
13
  return Promise.reject(new Error("Invalid operation"));
14
14
  }
15
- async write(tree, parents, message, ref) {
16
- return Promise.reject(new Error("Invalid operation"));
17
- }
18
15
  async createBlob(file) {
19
16
  return Promise.reject(new Error("Invalid operation"));
20
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"replayController.js","sourceRoot":"","sources":["../src/replayController.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH;;GAEG;AACH,MAAsB,8BAA8B;IAKzC,KAAK,CAAC,wBAAwB,CAAC,OAAyB,EAAE,OAAwB;QACrF,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,IAAe,EAAE,OAAiB,EAAE,OAAe,EAAE,GAAW;QAC/E,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QACzC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAA0B;QACnD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,IAAW,aAAa;QACpB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC;CACJ;AAxBD,wEAwBC;AAED;;;;GAIG;AACH,MAAsB,gBAAiB,SAAQ,8BAA8B;CA0C5E;AA1CD,4CA0CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentService,\n IDocumentStorageService,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport * as api from \"@fluidframework/protocol-definitions\";\n\n/**\n * Partial implementation of IDocumentStorageService\n */\nexport abstract class ReadDocumentStorageServiceBase implements IDocumentStorageService {\n public abstract getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;\n public abstract getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;\n public abstract readBlob(blobId: string): Promise<ArrayBufferLike>;\n\n public async uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public async write(tree: api.ITree, parents: string[], message: string, ref: string): Promise<api.IVersion> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public async downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public get repositoryUrl(): string {\n throw new Error(\"Invalid operation\");\n }\n}\n\n/**\n * Replay controller object\n * It controls where we start (snapshot, local file, no snapshots)\n * As well as dispatch of ops\n */\nexport abstract class ReplayController extends ReadDocumentStorageServiceBase {\n /**\n * Initialize reply controller\n * @param documentService - the real document service\n * @returns - Boolean, indicating if controller should be used.\n * If false is returned, caller should fallback to original storage.\n */\n public abstract initStorage(documentService: IDocumentService): Promise<boolean>;\n\n /**\n * Returns sequence number to start processing ops\n * Should be zero if not using snapshot, and snapshot seq# otherwise\n */\n public abstract getStartingOpSequence(): Promise<number>;\n\n /**\n * Returns last op number to fetch from current op\n * Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel\n * @param currentOp - current op\n */\n public abstract fetchTo(currentOp: number): number | undefined;\n\n /**\n * Returns true if no more ops should be processed (or downloaded for future processing).\n * It's called at end of each batch with latest op timestamp.\n * Also it's called when there are no more ops available (lastTimeStamp === undefined).\n * If false is returned and there are no more ops, request for more ops is made every 2 seconds.\n * Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel\n * @param currentOp - current op\n * @param lastTimeStamp - timestamp of last op (if more ops are available). Undefined otherwise.\n */\n public abstract isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean;\n\n /**\n * Replay batch of ops\n * NOTE: new batch of ops is fetched (fetchTo() & isDoneFetch() APIs are called) while this call is in flights\n * @param emitter - callback to emit ops\n * @param fetchedOps - ops to process\n */\n public abstract replay(\n emitter: (op: api.ISequencedDocumentMessage[]) => void,\n fetchedOps: api.ISequencedDocumentMessage[]): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"replayController.js","sourceRoot":"","sources":["../src/replayController.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH;;GAEG;AACH,MAAsB,8BAA8B;IAKzC,KAAK,CAAC,wBAAwB,CAAC,OAAyB,EAAE,OAAwB;QACrF,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QACzC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAA0B;QACnD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,IAAW,aAAa;QACpB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC;CACJ;AApBD,wEAoBC;AAED;;;;GAIG;AACH,MAAsB,gBAAiB,SAAQ,8BAA8B;CA0C5E;AA1CD,4CA0CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentService,\n IDocumentStorageService,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport * as api from \"@fluidframework/protocol-definitions\";\n\n/**\n * Partial implementation of IDocumentStorageService\n */\nexport abstract class ReadDocumentStorageServiceBase implements IDocumentStorageService {\n public abstract getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;\n public abstract getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;\n public abstract readBlob(blobId: string): Promise<ArrayBufferLike>;\n\n public async uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public async downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public get repositoryUrl(): string {\n throw new Error(\"Invalid operation\");\n }\n}\n\n/**\n * Replay controller object\n * It controls where we start (snapshot, local file, no snapshots)\n * As well as dispatch of ops\n */\nexport abstract class ReplayController extends ReadDocumentStorageServiceBase {\n /**\n * Initialize reply controller\n * @param documentService - the real document service\n * @returns - Boolean, indicating if controller should be used.\n * If false is returned, caller should fallback to original storage.\n */\n public abstract initStorage(documentService: IDocumentService): Promise<boolean>;\n\n /**\n * Returns sequence number to start processing ops\n * Should be zero if not using snapshot, and snapshot seq# otherwise\n */\n public abstract getStartingOpSequence(): Promise<number>;\n\n /**\n * Returns last op number to fetch from current op\n * Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel\n * @param currentOp - current op\n */\n public abstract fetchTo(currentOp: number): number | undefined;\n\n /**\n * Returns true if no more ops should be processed (or downloaded for future processing).\n * It's called at end of each batch with latest op timestamp.\n * Also it's called when there are no more ops available (lastTimeStamp === undefined).\n * If false is returned and there are no more ops, request for more ops is made every 2 seconds.\n * Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel\n * @param currentOp - current op\n * @param lastTimeStamp - timestamp of last op (if more ops are available). Undefined otherwise.\n */\n public abstract isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean;\n\n /**\n * Replay batch of ops\n * NOTE: new batch of ops is fetched (fetchTo() & isDoneFetch() APIs are called) while this call is in flights\n * @param emitter - callback to emit ops\n * @param fetchedOps - ops to process\n */\n public abstract replay(\n emitter: (op: api.ISequencedDocumentMessage[]) => void,\n fetchedOps: api.ISequencedDocumentMessage[]): Promise<void>;\n}\n"]}
@@ -170,8 +170,8 @@ class ReplayDocumentDeltaConnection extends common_utils_1.TypedEventEmitter {
170
170
  maxMessageSize: ReplayDocumentDeltaConnection.ReplayMaxMessageSize,
171
171
  summary: {
172
172
  idleTime: 5000,
173
- maxOps: 1000,
174
173
  maxTime: 5000 * 12,
174
+ maxOps: 1000,
175
175
  maxAckWaitTime: 600000,
176
176
  },
177
177
  },
@@ -1 +1 @@
1
- {"version":3,"file":"replayDocumentDeltaConnection.js","sourceRoot":"","sources":["../src/replayDocumentDeltaConnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,+EAW8C;AAC9C,+DAAwE;AACxE,yDAAsD;AAEtD,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAEtC,MAAa,sBAAuB,SAAQ,mCAAgB;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,G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AAxJL,sEAyJC;AAlH2B,mDAAqB,GAAG,QAAQ,CAAC;AACzD,qFAAqF;AAC7D,kDAAoB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEjC,oCAAM,GAAiB;IAC3C,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,CAAC,gCAAS,CAAC,OAAO,CAAC;IAC3B,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE;QACF,EAAE,EAAE,EAAE;KACT;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;CACb,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 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 summary: {\n idleTime: 5000,\n maxOps: 1000,\n maxTime: 5000 * 12,\n maxAckWaitTime: 600000,\n },\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,+EAW8C;AAC9C,+DAAwE;AACxE,yDAAsD;AAEtD,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAEtC,MAAa,sBAAuB,SAAQ,mCAAgB;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,IAA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C;AAEjC,oCAAM,GAAiB;IAC3C,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,CAAC,gCAAS,CAAC,OAAO,CAAC;IAC3B,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE;QACF,EAAE,EAAE,EAAE;KACT;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;CACb,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 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 summary: {\n idleTime: 5000,\n maxTime: 5000 * 12,\n maxOps: 1000,\n maxAckWaitTime: 600000,\n },\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"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/replay-driver";
8
- export declare const pkgVersion = "0.59.4001";
8
+ export declare const pkgVersion = "1.1.0-75972";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,cAAc,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,gBAAgB,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/replay-driver";
8
- export const pkgVersion = "0.59.4001";
8
+ export const pkgVersion = "1.1.0-75972";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/replay-driver\";\nexport const pkgVersion = \"0.59.4001\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/replay-driver\";\nexport const pkgVersion = \"1.1.0-75972\";\n"]}
@@ -12,7 +12,6 @@ export declare abstract class ReadDocumentStorageServiceBase implements IDocumen
12
12
  abstract getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
13
13
  abstract readBlob(blobId: string): Promise<ArrayBufferLike>;
14
14
  uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string>;
15
- write(tree: api.ITree, parents: string[], message: string, ref: string): Promise<api.IVersion>;
16
15
  createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse>;
17
16
  downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree>;
18
17
  get repositoryUrl(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"replayController.d.ts","sourceRoot":"","sources":["../src/replayController.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAE5D;;GAEG;AACH,8BAAsB,8BAA+B,YAAW,uBAAuB;aACnE,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;aAC7E,eAAe,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC;aAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAErD,wBAAwB,CAAC,OAAO,EAAE,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAI9F,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IAI9F,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IAInE,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAInF,IAAW,aAAa,IAAI,MAAM,CAEjC;CACJ;AAED;;;;GAIG;AACH,8BAAsB,gBAAiB,SAAQ,8BAA8B;IACzE;;;;;OAKG;aACa,WAAW,CAAC,eAAe,EA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AAE,GAAG,CAAC,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAInF,IAAW,aAAa,IAAI,MAAM,CAEjC;CACJ;AAED;;;;GAIG;AACH,8BAAsB,gBAAiB,SAAQ,8BAA8B;IACzE;;;;;OAKG;aACa,WAAW,CAAC,eAAe,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAEhF;;;OAGG;aACa,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC;IAExD;;;;OAIG;aACa,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAE9D;;;;;;;;OAQG;aACa,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO;IAE/E;;;;;OAKG;aACa,MAAM,CAClB,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,yBAAyB,EAAE,KAAK,IAAI,EACtD,UAAU,EAAE,GAAG,CAAC,yBAAyB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAClE"}
@@ -9,9 +9,6 @@ export class ReadDocumentStorageServiceBase {
9
9
  async uploadSummaryWithContext(summary, context) {
10
10
  return Promise.reject(new Error("Invalid operation"));
11
11
  }
12
- async write(tree, parents, message, ref) {
13
- return Promise.reject(new Error("Invalid operation"));
14
- }
15
12
  async createBlob(file) {
16
13
  return Promise.reject(new Error("Invalid operation"));
17
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"replayController.js","sourceRoot":"","sources":["../src/replayController.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;GAEG;AACH,MAAM,OAAgB,8BAA8B;IAKzC,KAAK,CAAC,wBAAwB,CAAC,OAAyB,EAAE,OAAwB;QACrF,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,IAAe,EAAE,OAAiB,EAAE,OAAe,EAAE,GAAW;QAC/E,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QACzC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAA0B;QACnD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,IAAW,aAAa;QACpB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,8BAA8B;CA0C5E","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentService,\n IDocumentStorageService,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport * as api from \"@fluidframework/protocol-definitions\";\n\n/**\n * Partial implementation of IDocumentStorageService\n */\nexport abstract class ReadDocumentStorageServiceBase implements IDocumentStorageService {\n public abstract getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;\n public abstract getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;\n public abstract readBlob(blobId: string): Promise<ArrayBufferLike>;\n\n public async uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public async write(tree: api.ITree, parents: string[], message: string, ref: string): Promise<api.IVersion> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public async downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public get repositoryUrl(): string {\n throw new Error(\"Invalid operation\");\n }\n}\n\n/**\n * Replay controller object\n * It controls where we start (snapshot, local file, no snapshots)\n * As well as dispatch of ops\n */\nexport abstract class ReplayController extends ReadDocumentStorageServiceBase {\n /**\n * Initialize reply controller\n * @param documentService - the real document service\n * @returns - Boolean, indicating if controller should be used.\n * If false is returned, caller should fallback to original storage.\n */\n public abstract initStorage(documentService: IDocumentService): Promise<boolean>;\n\n /**\n * Returns sequence number to start processing ops\n * Should be zero if not using snapshot, and snapshot seq# otherwise\n */\n public abstract getStartingOpSequence(): Promise<number>;\n\n /**\n * Returns last op number to fetch from current op\n * Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel\n * @param currentOp - current op\n */\n public abstract fetchTo(currentOp: number): number | undefined;\n\n /**\n * Returns true if no more ops should be processed (or downloaded for future processing).\n * It's called at end of each batch with latest op timestamp.\n * Also it's called when there are no more ops available (lastTimeStamp === undefined).\n * If false is returned and there are no more ops, request for more ops is made every 2 seconds.\n * Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel\n * @param currentOp - current op\n * @param lastTimeStamp - timestamp of last op (if more ops are available). Undefined otherwise.\n */\n public abstract isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean;\n\n /**\n * Replay batch of ops\n * NOTE: new batch of ops is fetched (fetchTo() & isDoneFetch() APIs are called) while this call is in flights\n * @param emitter - callback to emit ops\n * @param fetchedOps - ops to process\n */\n public abstract replay(\n emitter: (op: api.ISequencedDocumentMessage[]) => void,\n fetchedOps: api.ISequencedDocumentMessage[]): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"replayController.js","sourceRoot":"","sources":["../src/replayController.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;GAEG;AACH,MAAM,OAAgB,8BAA8B;IAKzC,KAAK,CAAC,wBAAwB,CAAC,OAAyB,EAAE,OAAwB;QACrF,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QACzC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAA0B;QACnD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,IAAW,aAAa;QACpB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,8BAA8B;CA0C5E","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentService,\n IDocumentStorageService,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport * as api from \"@fluidframework/protocol-definitions\";\n\n/**\n * Partial implementation of IDocumentStorageService\n */\nexport abstract class ReadDocumentStorageServiceBase implements IDocumentStorageService {\n public abstract getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;\n public abstract getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;\n public abstract readBlob(blobId: string): Promise<ArrayBufferLike>;\n\n public async uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public async downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree> {\n return Promise.reject(new Error(\"Invalid operation\"));\n }\n\n public get repositoryUrl(): string {\n throw new Error(\"Invalid operation\");\n }\n}\n\n/**\n * Replay controller object\n * It controls where we start (snapshot, local file, no snapshots)\n * As well as dispatch of ops\n */\nexport abstract class ReplayController extends ReadDocumentStorageServiceBase {\n /**\n * Initialize reply controller\n * @param documentService - the real document service\n * @returns - Boolean, indicating if controller should be used.\n * If false is returned, caller should fallback to original storage.\n */\n public abstract initStorage(documentService: IDocumentService): Promise<boolean>;\n\n /**\n * Returns sequence number to start processing ops\n * Should be zero if not using snapshot, and snapshot seq# otherwise\n */\n public abstract getStartingOpSequence(): Promise<number>;\n\n /**\n * Returns last op number to fetch from current op\n * Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel\n * @param currentOp - current op\n */\n public abstract fetchTo(currentOp: number): number | undefined;\n\n /**\n * Returns true if no more ops should be processed (or downloaded for future processing).\n * It's called at end of each batch with latest op timestamp.\n * Also it's called when there are no more ops available (lastTimeStamp === undefined).\n * If false is returned and there are no more ops, request for more ops is made every 2 seconds.\n * Note: this API is called while replay() is in progress - next batch of ops is downloaded in parallel\n * @param currentOp - current op\n * @param lastTimeStamp - timestamp of last op (if more ops are available). Undefined otherwise.\n */\n public abstract isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean;\n\n /**\n * Replay batch of ops\n * NOTE: new batch of ops is fetched (fetchTo() & isDoneFetch() APIs are called) while this call is in flights\n * @param emitter - callback to emit ops\n * @param fetchedOps - ops to process\n */\n public abstract replay(\n emitter: (op: api.ISequencedDocumentMessage[]) => void,\n fetchedOps: api.ISequencedDocumentMessage[]): Promise<void>;\n}\n"]}
@@ -166,8 +166,8 @@ export class ReplayDocumentDeltaConnection extends TypedEventEmitter {
166
166
  maxMessageSize: ReplayDocumentDeltaConnection.ReplayMaxMessageSize,
167
167
  summary: {
168
168
  idleTime: 5000,
169
- maxOps: 1000,
170
169
  maxTime: 5000 * 12,
170
+ maxOps: 1000,
171
171
  maxAckWaitTime: 600000,
172
172
  },
173
173
  },
@@ -1 +1 @@
1
- {"version":3,"file":"replayDocumentDeltaConnection.js","sourceRoot":"","sources":["../src/replayDocumentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAUH,SAAS,GACZ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AAC,CAAC,CAAC;gBAE9F,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;aACrF,QAAQ,CAAC,IAAI,EAAE;YAEhB,eAAe,CAAC,KAAK,EAAE,CAAC;SAC3B,QAAQ,CAAC,IAAI,EAAE;QAChB,OAAO,kBAAkB,CAAC;IAC9B,CAAC;;AAjHuB,mDAAqB,GAAG,QAAQ,CAAC;AACzD,qFAAqF;AAC7D,kDAAoB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEjC,oCAAM,GAAiB;IAC3C,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;IAC3B,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE;QACF,EAAE,EAAE,EAAE;KACT;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;CACb,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 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 summary: {\n idleTime: 5000,\n maxOps: 1000,\n maxTime: 5000 * 12,\n maxAckWaitTime: 600000,\n },\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,EAUH,SAAS,GACZ,MAAM,sCAAsC,C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gBAE9F,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;aACrF,QAAQ,CAAC,IAAI,EAAE;YAEhB,eAAe,CAAC,KAAK,EAAE,CAAC;SAC3B,QAAQ,CAAC,IAAI,EAAE;QAChB,OAAO,kBAAkB,CAAC;IAC9B,CAAC;;AAjHuB,mDAAqB,GAAG,QAAQ,CAAC;AACzD,qFAAqF;AAC7D,kDAAoB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEjC,oCAAM,GAAiB;IAC3C,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;IAC3B,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE;QACF,EAAE,EAAE,EAAE;KACT;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;CACb,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 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 summary: {\n idleTime: 5000,\n maxTime: 5000 * 12,\n maxOps: 1000,\n maxAckWaitTime: 600000,\n },\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/replay-driver",
3
- "version": "0.59.4001",
3
+ "version": "1.1.0-75972",
4
4
  "description": "Document replay version of Socket.IO implementation",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -36,37 +36,24 @@
36
36
  "dependencies": {
37
37
  "@fluidframework/common-definitions": "^0.20.1",
38
38
  "@fluidframework/common-utils": "^0.32.1",
39
- "@fluidframework/driver-definitions": "^0.46.2000",
40
- "@fluidframework/driver-utils": "^0.59.4001",
39
+ "@fluidframework/driver-definitions": "1.1.0-75972",
40
+ "@fluidframework/driver-utils": "1.1.0-75972",
41
41
  "@fluidframework/protocol-definitions": "^0.1028.2000",
42
- "@fluidframework/telemetry-utils": "^0.59.4001"
42
+ "@fluidframework/telemetry-utils": "1.1.0-75972"
43
43
  },
44
44
  "devDependencies": {
45
- "@fluidframework/build-common": "^0.23.0",
46
- "@fluidframework/build-tools": "^0.2.70857",
45
+ "@fluidframework/build-common": "^0.24.0-0",
46
+ "@fluidframework/build-tools": "^0.2.71273",
47
47
  "@fluidframework/eslint-config-fluid": "^0.28.2000",
48
- "@fluidframework/replay-driver-previous": "npm:@fluidframework/replay-driver@0.59.4000",
48
+ "@fluidframework/replay-driver-previous": "npm:@fluidframework/replay-driver@^1.0.0",
49
49
  "@microsoft/api-extractor": "^7.22.2",
50
50
  "@rushstack/eslint-config": "^2.5.1",
51
51
  "@types/mocha": "^9.1.1",
52
52
  "@types/nock": "^9.3.0",
53
53
  "@types/node": "^14.18.0",
54
- "@typescript-eslint/eslint-plugin": "~5.9.0",
55
- "@typescript-eslint/parser": "~5.9.0",
56
54
  "concurrently": "^6.2.0",
57
55
  "copyfiles": "^2.1.0",
58
56
  "eslint": "~8.6.0",
59
- "eslint-plugin-editorconfig": "~3.2.0",
60
- "eslint-plugin-eslint-comments": "~3.2.0",
61
- "eslint-plugin-import": "~2.25.4",
62
- "eslint-plugin-jest": "~26.1.3",
63
- "eslint-plugin-jsdoc": "~39.3.0",
64
- "eslint-plugin-mocha": "~10.0.3",
65
- "eslint-plugin-promise": "~6.0.0",
66
- "eslint-plugin-react": "~7.28.0",
67
- "eslint-plugin-tsdoc": "~0.2.14",
68
- "eslint-plugin-unicorn": "~40.0.0",
69
- "eslint-plugin-unused-imports": "~2.0.0",
70
57
  "mocha": "^10.0.0",
71
58
  "nock": "^10.0.1",
72
59
  "rimraf": "^2.6.2",
@@ -74,7 +61,7 @@
74
61
  "typescript-formatter": "7.1.0"
75
62
  },
76
63
  "typeValidation": {
77
- "version": "0.59.4001",
64
+ "version": "1.1.0",
78
65
  "broken": {}
79
66
  }
80
67
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/replay-driver";
9
- export const pkgVersion = "0.59.4001";
9
+ export const pkgVersion = "1.1.0-75972";
@@ -22,10 +22,6 @@ export abstract class ReadDocumentStorageServiceBase implements IDocumentStorage
22
22
  return Promise.reject(new Error("Invalid operation"));
23
23
  }
24
24
 
25
- public async write(tree: api.ITree, parents: string[], message: string, ref: string): Promise<api.IVersion> {
26
- return Promise.reject(new Error("Invalid operation"));
27
- }
28
-
29
25
  public async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {
30
26
  return Promise.reject(new Error("Invalid operation"));
31
27
  }
@@ -204,8 +204,8 @@ export class ReplayDocumentDeltaConnection
204
204
  maxMessageSize: ReplayDocumentDeltaConnection.ReplayMaxMessageSize,
205
205
  summary: {
206
206
  idleTime: 5000,
207
- maxOps: 1000,
208
207
  maxTime: 5000 * 12,
208
+ maxOps: 1000,
209
209
  maxAckWaitTime: 600000,
210
210
  },
211
211
  },