@fluidframework/debugger 2.1.0-276985 → 2.1.0-281041
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/api-extractor/api-extractor.current.json +5 -0
- package/api-extractor/api-extractor.legacy.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/debugger.legacy.public.api.md +9 -0
- package/dist/fluidDebuggerController.d.ts.map +1 -1
- package/dist/fluidDebuggerController.js +2 -0
- package/dist/fluidDebuggerController.js.map +1 -1
- package/dist/fluidDebuggerUi.d.ts.map +1 -1
- package/dist/fluidDebuggerUi.js +3 -0
- package/dist/fluidDebuggerUi.js.map +1 -1
- package/dist/legacy.d.ts +1 -1
- package/dist/public.d.ts +1 -1
- package/dist/sanitize.js +3 -0
- package/dist/sanitize.js.map +1 -1
- package/internal.d.ts +1 -1
- package/legacy.d.ts +1 -1
- package/lib/fluidDebuggerController.d.ts.map +1 -1
- package/lib/fluidDebuggerController.js +2 -0
- package/lib/fluidDebuggerController.js.map +1 -1
- package/lib/fluidDebuggerUi.d.ts.map +1 -1
- package/lib/fluidDebuggerUi.js +3 -0
- package/lib/fluidDebuggerUi.js.map +1 -1
- package/lib/legacy.d.ts +1 -1
- package/lib/public.d.ts +1 -1
- package/lib/sanitize.js +3 -0
- package/lib/sanitize.js.map +1 -1
- package/package.json +19 -17
- package/src/fluidDebuggerController.ts +4 -2
- package/src/fluidDebuggerUi.ts +6 -3
- package/src/sanitize.ts +6 -3
- package/tsconfig.json +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
+
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-report.esm.current.json",
|
|
4
|
+
"mainEntryPointFilePath": "<projectFolder>/lib/public.d.ts"
|
|
5
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-
|
|
3
|
+
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-report.esm.legacy.json"
|
|
4
4
|
}
|
package/api-extractor.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-model.esm.json"
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidDebuggerController.d.ts","sourceRoot":"","sources":["../src/fluidDebuggerController.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAU,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAEN,gBAAgB,EAChB,uBAAuB,EAEvB,aAAa,EACb,QAAQ,EACR,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAGN,8BAA8B,EAC9B,gBAAgB,EAEhB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxE;;GAEG;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,mBAAmB,KAAK,WAAW,GAAG,IAAI,CAAC;AAExF;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,gBAAiB,YAAW,mBAAmB;WAE3E,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,qBAAqB,GAAG,IAAI;IAW/E,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,MAAM;qBAExB,WAAW,CACjC,sBAAsB,EAAE,uBAAuB,EAC/C,IAAI,EAAE,aAAa,GAAG,IAAI,GACxB,OAAO,CAAC,MAAM,CAAC;
|
|
1
|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AAO,EAAE,8BAA8B,EACvC,OAAO,EAAE,QAAQ,GAAG,MAAM;CAgB3B"}
|
|
@@ -40,6 +40,7 @@ class DebugReplayController extends internal_3.ReplayController {
|
|
|
40
40
|
if (!tree) {
|
|
41
41
|
return 0;
|
|
42
42
|
}
|
|
43
|
+
// TODO Why are we non null asserting here
|
|
43
44
|
const attributesHash = tree.trees[".protocol"].blobs.attributes;
|
|
44
45
|
const attrib = await (0, internal_2.readAndParse)(documentStorageService, attributesHash);
|
|
45
46
|
return attrib.sequenceNumber;
|
|
@@ -165,6 +166,7 @@ class DebugReplayController extends internal_3.ReplayController {
|
|
|
165
166
|
for (let i = 0; i < buckets; i++) {
|
|
166
167
|
let prevRequest = Promise.resolve();
|
|
167
168
|
for (let index = i; index < this.versions.length; index += buckets) {
|
|
169
|
+
// Non null asserting here because we are iterating though versions
|
|
168
170
|
const version = this.versions[index];
|
|
169
171
|
prevRequest = this.downloadVersionInfo(this.documentStorageService, prevRequest, index, version);
|
|
170
172
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidDebuggerController.js","sourceRoot":"","sources":["../src/fluidDebuggerController.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAuE;AAUvE,oEAAqE;AACrE,qEAMgD;AAGhD,iDAA2C;AAQ3C;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,2BAAgB;IAA3D;;QA+BW,OAAE,GAAgB,IAA0B,CAAC,CAAC,gDAAgD;QAE9F,qBAAgB,GAAG,IAAI,mBAAQ,EAAU,CAAC;QAEpD,kEAAkE;QACxD,6BAAwB,GAAG,KAAK,CAAC;QAIjC,aAAQ,GAAe,EAAE,CAAC;QAC1B,gBAAW,GAAW,CAAC,CAAC;QACxB,kBAAa,GAAG,KAAK,CAAC;QACtB,iBAAY,GAAG,CAAC,CAAC;IAmS5B,CAAC;IA7UA,kDAAkD;IAC3C,MAAM,CAAC,MAAM,CAAC,QAA2B;QAC/C,IAAI,OAAO,Y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C;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentStorageService,\n\tIDocumentAttributes,\n\tISnapshotTree,\n\tIVersion,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tFileSnapshotReader,\n\tIFileSnapshot,\n\tReadDocumentStorageServiceBase,\n\tReplayController,\n\tSnapshotStorage,\n} from \"@fluidframework/replay-driver/internal\";\n\nimport { IDebuggerController, IDebuggerUI } from \"./fluidDebuggerUi.js\";\nimport { Sanitizer } from \"./sanitizer.js\";\n\n/**\n * @internal\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport type debuggerUIFactory = (controller: IDebuggerController) => IDebuggerUI | null;\n\n/**\n * Replay controller that uses pop-up window to control op playback\n * @internal\n */\nexport class DebugReplayController extends ReplayController implements IDebuggerController {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic static create(createUi: debuggerUIFactory): DebugReplayController | null {\n\t\tif (typeof localStorage === \"object\" && localStorage?.FluidDebugger) {\n\t\t\tconst controller = new DebugReplayController();\n\t\t\tconst ui = createUi(controller);\n\t\t\tif (ui) {\n\t\t\t\treturn controller;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected static readonly WindowClosedSeq = -1; // Seq# to indicate that user closed window\n\n\tprotected static async seqFromTree(\n\t\tdocumentStorageService: IDocumentStorageService,\n\t\ttree: ISnapshotTree | null,\n\t): Promise<number> {\n\t\tif (!tree) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst attributesHash = tree.trees[\".protocol\"].blobs.attributes;\n\t\tconst attrib = await readAndParse<IDocumentAttributes>(\n\t\t\tdocumentStorageService,\n\t\t\tattributesHash,\n\t\t);\n\t\treturn attrib.sequenceNumber;\n\t}\n\n\tprotected ui: IDebuggerUI = null as any as IDebuggerUI; // Not to check on every line that it's not null\n\tprotected stepsDeferred?: Deferred<number>;\n\tprotected startSeqDeferred = new Deferred<number>();\n\n\t// True will cause us ping server indefinitely waiting for new ops\n\tprotected retryFetchOpsOnEndOfFile = false;\n\n\tprotected documentService?: IDocumentService;\n\tprotected documentStorageService?: IDocumentStorageService;\n\tprotected versions: IVersion[] = [];\n\tprotected stepsToPlay: number = 0;\n\tprotected lastOpReached = false;\n\tprotected versionCount = 0;\n\n\tprotected storage?: ReadDocumentStorageServiceBase;\n\n\t// Member to prevent repeated initialization in initStorage(...), which also\n\t// returns if this controller should be used or function as a passthrough\n\tprivate shouldUseController: boolean | undefined;\n\n\tpublic connectToUi(ui: IDebuggerUI): void {\n\t\tthis.ui = ui;\n\t}\n\n\tpublic onClose() {\n\t\tthis.startSeqDeferred.resolve(DebugReplayController.WindowClosedSeq);\n\t}\n\n\tpublic async onVersionSelection(version: IVersion) {\n\t\tif (!this.documentStorageService) {\n\t\t\tthrow new Error(\"onVersionSelection: no storage\");\n\t\t}\n\n\t\tconst tree = await this.documentStorageService.getSnapshotTree(version);\n\t\tconst seq = await DebugReplayController.seqFromTree(this.documentStorageService, tree);\n\t\tthis.resolveStorage(seq, new SnapshotStorage(this.documentStorageService, tree), version);\n\t}\n\n\tpublic onOpButtonClick(steps: number) {\n\t\tif (this.stepsDeferred && !Number.isNaN(steps) && steps > 0) {\n\t\t\tthis.stepsDeferred.resolve(steps);\n\t\t}\n\t}\n\n\tpublic onSnapshotFileSelection(file: File) {\n\t\tif (!/^snapshot.*\\.json/.exec(file.name)) {\n\t\t\talert(`Incorrect file name: ${file.name}`);\n\t\t\treturn;\n\t\t}\n\t\tif (/.*_expanded.*/.exec(file.name)) {\n\t\t\talert(`Incorrect file name - please use non-extended files: ${file.name}`);\n\t\t\treturn;\n\t\t}\n\n\t\tconst reader = new FileReader();\n\t\treader.onload = async () => {\n\t\t\tif (this.documentStorageService) {\n\t\t\t\tconst text = reader.result as string;\n\t\t\t\ttry {\n\t\t\t\t\tconst json: IFileSnapshot = JSON.parse(text) as IFileSnapshot;\n\t\t\t\t\t/*\n Const docStorage = this.documentStorageService;\n const storage = {\n read: (blobId: string) => this.read(docStorage, blobId),\n };\n const seq = await DebugReplayController.seqFromTree(\n storage as IDocumentStorageService,\n tree);\n this.startSeqDeferred.resolve(seq);\n */\n\t\t\t\t\t// No ability to load ops, so just say - pick up from infinite op.\n\t\t\t\t\tthis.retryFetchOpsOnEndOfFile = false;\n\t\t\t\t\tthis.lastOpReached = true;\n\t\t\t\t\tthis.resolveStorage(\n\t\t\t\t\t\tNumber.MAX_SAFE_INTEGER,\n\t\t\t\t\t\tnew FileSnapshotReader(json),\n\t\t\t\t\t\tfile.name,\n\t\t\t\t\t);\n\t\t\t\t} catch (error) {\n\t\t\t\t\talert(`Error parsing file: ${error}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\treader.readAsText(file, \"utf-8\");\n\t}\n\n\tpublic async onDownloadOpsButtonClick(anonymize: boolean): Promise<string> {\n\t\tif (this.documentService === undefined) {\n\t\t\tthrow new Error(\"DocumentService required\");\n\t\t}\n\n\t\tconst documentDeltaStorageService = await this.documentService.connectToDeltaStorage();\n\t\tlet messages = await this.fetchOpsFromDeltaStorage(documentDeltaStorageService);\n\n\t\tif (anonymize) {\n\t\t\tconst sanitizer = new Sanitizer(messages, false /* fullScrub */, false /* noBail */);\n\t\t\tmessages = sanitizer.sanitize();\n\t\t}\n\n\t\treturn JSON.stringify(messages, undefined, 2);\n\t}\n\n\tprivate async fetchOpsFromDeltaStorage(\n\t\tdocumentDeltaStorageService,\n\t): Promise<ISequencedDocumentMessage[]> {\n\t\tconst deltaGenerator = generateSequencedMessagesFromDeltaStorage(\n\t\t\tdocumentDeltaStorageService,\n\t\t);\n\t\tlet messages: ISequencedDocumentMessage[] = [];\n\t\tfor await (const message of deltaGenerator) {\n\t\t\tmessages = messages.concat(message);\n\t\t}\n\t\treturn messages;\n\t}\n\n\tpublic fetchTo(currentOp: number): number | undefined {\n\t\treturn undefined;\n\t}\n\n\t// Returns true if version / file / ops selections is made.\n\tpublic isSelectionMade() {\n\t\treturn this.storage !== undefined;\n\t}\n\n\tpublic async downloadVersionInfo(\n\t\tdocumentStorageService: IDocumentStorageService,\n\t\tprevRequest: Promise<void>,\n\t\tindex: number,\n\t\tversion: IVersion,\n\t): Promise<void> {\n\t\tif (this.isSelectionMade()) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait prevRequest;\n\n\t\tconst treeV = await documentStorageService.getSnapshotTree(version);\n\t\tconst seqV = await DebugReplayController.seqFromTree(documentStorageService, treeV);\n\n\t\tif (!this.isSelectionMade()) {\n\t\t\tthis.versionCount--;\n\t\t\tthis.ui.updateVersionText(this.versionCount);\n\t\t\tthis.ui.updateVersion(index, version, seqV);\n\t\t}\n\t}\n\n\tpublic async initStorage(documentService: IDocumentService): Promise<boolean> {\n\t\tif (this.shouldUseController !== undefined) {\n\t\t\treturn this.shouldUseController;\n\t\t}\n\n\t\tassert(!!documentService, 0x080 /* \"Invalid document service!\" */);\n\t\tassert(!this.documentService, 0x081 /* \"Document service already set!\" */);\n\t\tassert(!this.documentStorageService, 0x082 /* \"Document storage service already set!\" */);\n\t\tthis.documentService = documentService;\n\t\tthis.documentStorageService = await documentService.connectToStorage();\n\n\t\t// User can chose \"file\" at any moment in time!\n\t\tif (!this.isSelectionMade()) {\n\t\t\tthis.versions = await this.documentStorageService.getVersions(\"\", 50);\n\t\t\tif (!this.isSelectionMade()) {\n\t\t\t\tthis.ui.addVersions(this.versions);\n\t\t\t\tthis.ui.updateVersionText(this.versionCount);\n\t\t\t}\n\t\t}\n\n\t\tthis.versionCount = this.versions.length;\n\n\t\t// Download all versions - do 10 downloads in parallel to avoid being throttled\n\t\tconst buckets = 10;\n\t\tconst work: Promise<void>[] = [];\n\t\tfor (let i = 0; i < buckets; i++) {\n\t\t\tlet prevRequest = Promise.resolve();\n\t\t\tfor (let index = i; index < this.versions.length; index += buckets) {\n\t\t\t\tconst version = this.versions[index];\n\t\t\t\tprevRequest = this.downloadVersionInfo(\n\t\t\t\t\tthis.documentStorageService,\n\t\t\t\t\tprevRequest,\n\t\t\t\t\tindex,\n\t\t\t\t\tversion,\n\t\t\t\t);\n\t\t\t}\n\t\t\twork.push(prevRequest);\n\t\t}\n\n\t\t// Don't wait for stuff to populate.\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tPromise.all(work).then(() => {\n\t\t\tthis.ui.updateVersionText(0);\n\t\t});\n\n\t\t// This hangs until the user makes a selection or closes the window.\n\t\tthis.shouldUseController =\n\t\t\t(await this.startSeqDeferred.promise) !== DebugReplayController.WindowClosedSeq;\n\n\t\tassert(\n\t\t\tthis.isSelectionMade() === this.shouldUseController,\n\t\t\t0x083 /* \"User selection status does not match replay controller use status!\" */,\n\t\t);\n\t\treturn this.shouldUseController;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tif (this.storage !== undefined) {\n\t\t\treturn this.storage.readBlob(blobId);\n\t\t}\n\t\tthrow new Error(\"Reading blob before storage is setup properly\");\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.storage !== undefined) {\n\t\t\treturn this.storage.getVersions(versionId, count);\n\t\t}\n\t\tthrow new Error(\"initStorage() was not called!\");\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (this.storage !== undefined) {\n\t\t\treturn this.storage.getSnapshotTree(versionRequested);\n\t\t}\n\t\tthrow new Error(\"Reading snapshot tree before storage is setup properly\");\n\t}\n\n\tpublic async getStartingOpSequence() {\n\t\treturn this.startSeqDeferred.promise;\n\t}\n\n\t/**\n\t * Return true if we are done processing ops\n\t */\n\tpublic isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean {\n\t\tif (lastTimeStamp === undefined) {\n\t\t\tthis.lastOpReached = true;\n\t\t\tif (currentOp === Number.MAX_SAFE_INTEGER) {\n\t\t\t\tthis.ui.updateLastOpText(-1, false);\n\t\t\t} else {\n\t\t\t\tthis.ui.updateLastOpText(currentOp, false);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.ui.updateLastOpText(currentOp, true);\n\t\t}\n\t\treturn this.lastOpReached && !this.retryFetchOpsOnEndOfFile;\n\t}\n\n\tpublic async replay(\n\t\temitter: (op: ISequencedDocumentMessage[]) => void,\n\t\tfetchedOps: ISequencedDocumentMessage[],\n\t): Promise<void> {\n\t\tlet _fetchedOps = fetchedOps;\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\tif (_fetchedOps.length === 0) {\n\t\t\t\tthis.ui.updateNextOpText([]);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this.stepsToPlay === 0) {\n\t\t\t\tthis.ui.disableNextOpButton(false);\n\t\t\t\tthis.stepsDeferred = new Deferred<number>();\n\n\t\t\t\tthis.ui.updateNextOpText(_fetchedOps);\n\n\t\t\t\tthis.stepsToPlay = await this.stepsDeferred.promise;\n\n\t\t\t\tthis.stepsDeferred = undefined;\n\t\t\t\tthis.ui.disableNextOpButton(true);\n\t\t\t}\n\n\t\t\tlet playOps: ISequencedDocumentMessage[];\n\t\t\tif (this.stepsToPlay >= _fetchedOps.length) {\n\t\t\t\tplayOps = _fetchedOps;\n\t\t\t\tthis.stepsToPlay -= _fetchedOps.length;\n\t\t\t\t_fetchedOps = [];\n\t\t\t} else {\n\t\t\t\tplayOps = _fetchedOps.splice(0, this.stepsToPlay);\n\t\t\t\tthis.stepsToPlay = 0;\n\t\t\t}\n\t\t\temitter(playOps);\n\t\t}\n\t}\n\n\tprotected resolveStorage(\n\t\tseq: number,\n\t\tstorage: ReadDocumentStorageServiceBase,\n\t\tversion: IVersion | string,\n\t) {\n\t\tassert(\n\t\t\t!this.isSelectionMade(),\n\t\t\t0x084 /* \"On storage resolve, user selection already made!\" */,\n\t\t);\n\t\tassert(!!storage, 0x085 /* \"On storage resolve, missing storage!\" */);\n\t\tthis.storage = storage;\n\t\tassert(\n\t\t\tthis.isSelectionMade(),\n\t\t\t0x086 /* \"After storage resolve, user selection status still false!\" */,\n\t\t);\n\n\t\tthis.ui.versionSelected(seq, version);\n\t\tthis.startSeqDeferred.resolve(seq);\n\t}\n}\n\nasync function* generateSequencedMessagesFromDeltaStorage(\n\tdeltaStorage: IDocumentDeltaStorageService,\n) {\n\tconst stream = deltaStorage.fetchMessages(1, undefined);\n\twhile (true) {\n\t\tconst result = await stream.read();\n\t\tif (result.done) {\n\t\t\treturn;\n\t\t}\n\t\tyield result.value;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"fluidDebuggerController.js","sourceRoot":"","sources":["../src/fluidDebuggerController.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAuE;AAUvE,oEAAqE;AACrE,qEAMgD;AAGhD,iDAA2C;AAQ3C;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,2BAAgB;IAA3D;;QAgCW,OAAE,GAAgB,IAA0B,CAAC,CAAC,gDAAgD;QAE9F,qBAAgB,GAAG,IAAI,mBAAQ,EAAU,CAAC;QAEpD,kEAAkE;QACxD,6BAAwB,GAAG,KAAK,CAAC;QAIjC,aAAQ,GAAe,EAAE,CAAC;QAC1B,gBAAW,GAAW,CAAC,CAAC;QACxB,kBAAa,GAAG,KAAK,CAAC;QACtB,iBAAY,GAAG,CAAC,CAAC;IAoS5B,CAAC;IA/UA,kDAAkD;IAC3C,MAAM,CAAC,MAAM,CAAC,QAA2B;QAC/C,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,EAAE,aAAa,EAAE,CAAC;YACrE,MAAM,UAAU,GAAG,IAAI,qBAAqB,EAAE,CAAC;YAC/C,MAAM,EAAE,GAAG,QA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YAClB,CAAC;iBAAM,CAAC;gBACP,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;gBAClD,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;YACtB,CAAC;YACD,OAAO,CAAC,OAAO,CAAC,CAAC;QAClB,CAAC;IACF,CAAC;IAES,cAAc,CACvB,GAAW,EACX,OAAuC,EACvC,OAA0B;QAE1B,IAAA,iBAAM,EACL,CAAC,IAAI,CAAC,eAAe,EAAE,EACvB,KAAK,CAAC,wDAAwD,CAC9D,CAAC;QACF,IAAA,iBAAM,EAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,4CAA4C,CAAC,CAAC;QACtE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAA,iBAAM,EACL,IAAI,CAAC,eAAe,EAAE,EACtB,KAAK,CAAC,iEAAiE,CACvE,CAAC;QAEF,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;;AA/UF,sDAgVC;AAnU0B,qCAAe,GAAG,CAAC,CAAC,AAAL,CAAM,CAAC,2CAA2C;AAqU5F,KAAK,SAAS,CAAC,CAAC,yCAAyC,CACxD,YAA0C;IAE1C,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IACxD,OAAO,IAAI,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO;QACR,CAAC;QACD,MAAM,MAAM,CAAC,KAAK,CAAC;IACpB,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentStorageService,\n\tIDocumentAttributes,\n\tISnapshotTree,\n\tIVersion,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tFileSnapshotReader,\n\tIFileSnapshot,\n\tReadDocumentStorageServiceBase,\n\tReplayController,\n\tSnapshotStorage,\n} from \"@fluidframework/replay-driver/internal\";\n\nimport { IDebuggerController, IDebuggerUI } from \"./fluidDebuggerUi.js\";\nimport { Sanitizer } from \"./sanitizer.js\";\n\n/**\n * @internal\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport type debuggerUIFactory = (controller: IDebuggerController) => IDebuggerUI | null;\n\n/**\n * Replay controller that uses pop-up window to control op playback\n * @internal\n */\nexport class DebugReplayController extends ReplayController implements IDebuggerController {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic static create(createUi: debuggerUIFactory): DebugReplayController | null {\n\t\tif (typeof localStorage === \"object\" && localStorage?.FluidDebugger) {\n\t\t\tconst controller = new DebugReplayController();\n\t\t\tconst ui = createUi(controller);\n\t\t\tif (ui) {\n\t\t\t\treturn controller;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected static readonly WindowClosedSeq = -1; // Seq# to indicate that user closed window\n\n\tprotected static async seqFromTree(\n\t\tdocumentStorageService: IDocumentStorageService,\n\t\ttree: ISnapshotTree | null,\n\t): Promise<number> {\n\t\tif (!tree) {\n\t\t\treturn 0;\n\t\t}\n\n\t\t// TODO Why are we non null asserting here\n\t\tconst attributesHash = tree.trees[\".protocol\"]!.blobs.attributes!;\n\t\tconst attrib = await readAndParse<IDocumentAttributes>(\n\t\t\tdocumentStorageService,\n\t\t\tattributesHash,\n\t\t);\n\t\treturn attrib.sequenceNumber;\n\t}\n\n\tprotected ui: IDebuggerUI = null as any as IDebuggerUI; // Not to check on every line that it's not null\n\tprotected stepsDeferred?: Deferred<number>;\n\tprotected startSeqDeferred = new Deferred<number>();\n\n\t// True will cause us ping server indefinitely waiting for new ops\n\tprotected retryFetchOpsOnEndOfFile = false;\n\n\tprotected documentService?: IDocumentService;\n\tprotected documentStorageService?: IDocumentStorageService;\n\tprotected versions: IVersion[] = [];\n\tprotected stepsToPlay: number = 0;\n\tprotected lastOpReached = false;\n\tprotected versionCount = 0;\n\n\tprotected storage?: ReadDocumentStorageServiceBase;\n\n\t// Member to prevent repeated initialization in initStorage(...), which also\n\t// returns if this controller should be used or function as a passthrough\n\tprivate shouldUseController: boolean | undefined;\n\n\tpublic connectToUi(ui: IDebuggerUI): void {\n\t\tthis.ui = ui;\n\t}\n\n\tpublic onClose() {\n\t\tthis.startSeqDeferred.resolve(DebugReplayController.WindowClosedSeq);\n\t}\n\n\tpublic async onVersionSelection(version: IVersion) {\n\t\tif (!this.documentStorageService) {\n\t\t\tthrow new Error(\"onVersionSelection: no storage\");\n\t\t}\n\n\t\tconst tree = await this.documentStorageService.getSnapshotTree(version);\n\t\tconst seq = await DebugReplayController.seqFromTree(this.documentStorageService, tree);\n\t\tthis.resolveStorage(seq, new SnapshotStorage(this.documentStorageService, tree), version);\n\t}\n\n\tpublic onOpButtonClick(steps: number) {\n\t\tif (this.stepsDeferred && !Number.isNaN(steps) && steps > 0) {\n\t\t\tthis.stepsDeferred.resolve(steps);\n\t\t}\n\t}\n\n\tpublic onSnapshotFileSelection(file: File) {\n\t\tif (!/^snapshot.*\\.json/.exec(file.name)) {\n\t\t\talert(`Incorrect file name: ${file.name}`);\n\t\t\treturn;\n\t\t}\n\t\tif (/.*_expanded.*/.exec(file.name)) {\n\t\t\talert(`Incorrect file name - please use non-extended files: ${file.name}`);\n\t\t\treturn;\n\t\t}\n\n\t\tconst reader = new FileReader();\n\t\treader.onload = async () => {\n\t\t\tif (this.documentStorageService) {\n\t\t\t\tconst text = reader.result as string;\n\t\t\t\ttry {\n\t\t\t\t\tconst json: IFileSnapshot = JSON.parse(text) as IFileSnapshot;\n\t\t\t\t\t/*\n Const docStorage = this.documentStorageService;\n const storage = {\n read: (blobId: string) => this.read(docStorage, blobId),\n };\n const seq = await DebugReplayController.seqFromTree(\n storage as IDocumentStorageService,\n tree);\n this.startSeqDeferred.resolve(seq);\n */\n\t\t\t\t\t// No ability to load ops, so just say - pick up from infinite op.\n\t\t\t\t\tthis.retryFetchOpsOnEndOfFile = false;\n\t\t\t\t\tthis.lastOpReached = true;\n\t\t\t\t\tthis.resolveStorage(\n\t\t\t\t\t\tNumber.MAX_SAFE_INTEGER,\n\t\t\t\t\t\tnew FileSnapshotReader(json),\n\t\t\t\t\t\tfile.name,\n\t\t\t\t\t);\n\t\t\t\t} catch (error) {\n\t\t\t\t\talert(`Error parsing file: ${error}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\treader.readAsText(file, \"utf-8\");\n\t}\n\n\tpublic async onDownloadOpsButtonClick(anonymize: boolean): Promise<string> {\n\t\tif (this.documentService === undefined) {\n\t\t\tthrow new Error(\"DocumentService required\");\n\t\t}\n\n\t\tconst documentDeltaStorageService = await this.documentService.connectToDeltaStorage();\n\t\tlet messages = await this.fetchOpsFromDeltaStorage(documentDeltaStorageService);\n\n\t\tif (anonymize) {\n\t\t\tconst sanitizer = new Sanitizer(messages, false /* fullScrub */, false /* noBail */);\n\t\t\tmessages = sanitizer.sanitize();\n\t\t}\n\n\t\treturn JSON.stringify(messages, undefined, 2);\n\t}\n\n\tprivate async fetchOpsFromDeltaStorage(\n\t\tdocumentDeltaStorageService,\n\t): Promise<ISequencedDocumentMessage[]> {\n\t\tconst deltaGenerator = generateSequencedMessagesFromDeltaStorage(\n\t\t\tdocumentDeltaStorageService,\n\t\t);\n\t\tlet messages: ISequencedDocumentMessage[] = [];\n\t\tfor await (const message of deltaGenerator) {\n\t\t\tmessages = messages.concat(message);\n\t\t}\n\t\treturn messages;\n\t}\n\n\tpublic fetchTo(currentOp: number): number | undefined {\n\t\treturn undefined;\n\t}\n\n\t// Returns true if version / file / ops selections is made.\n\tpublic isSelectionMade() {\n\t\treturn this.storage !== undefined;\n\t}\n\n\tpublic async downloadVersionInfo(\n\t\tdocumentStorageService: IDocumentStorageService,\n\t\tprevRequest: Promise<void>,\n\t\tindex: number,\n\t\tversion: IVersion,\n\t): Promise<void> {\n\t\tif (this.isSelectionMade()) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait prevRequest;\n\n\t\tconst treeV = await documentStorageService.getSnapshotTree(version);\n\t\tconst seqV = await DebugReplayController.seqFromTree(documentStorageService, treeV);\n\n\t\tif (!this.isSelectionMade()) {\n\t\t\tthis.versionCount--;\n\t\t\tthis.ui.updateVersionText(this.versionCount);\n\t\t\tthis.ui.updateVersion(index, version, seqV);\n\t\t}\n\t}\n\n\tpublic async initStorage(documentService: IDocumentService): Promise<boolean> {\n\t\tif (this.shouldUseController !== undefined) {\n\t\t\treturn this.shouldUseController;\n\t\t}\n\n\t\tassert(!!documentService, 0x080 /* \"Invalid document service!\" */);\n\t\tassert(!this.documentService, 0x081 /* \"Document service already set!\" */);\n\t\tassert(!this.documentStorageService, 0x082 /* \"Document storage service already set!\" */);\n\t\tthis.documentService = documentService;\n\t\tthis.documentStorageService = await documentService.connectToStorage();\n\n\t\t// User can chose \"file\" at any moment in time!\n\t\tif (!this.isSelectionMade()) {\n\t\t\tthis.versions = await this.documentStorageService.getVersions(\"\", 50);\n\t\t\tif (!this.isSelectionMade()) {\n\t\t\t\tthis.ui.addVersions(this.versions);\n\t\t\t\tthis.ui.updateVersionText(this.versionCount);\n\t\t\t}\n\t\t}\n\n\t\tthis.versionCount = this.versions.length;\n\n\t\t// Download all versions - do 10 downloads in parallel to avoid being throttled\n\t\tconst buckets = 10;\n\t\tconst work: Promise<void>[] = [];\n\t\tfor (let i = 0; i < buckets; i++) {\n\t\t\tlet prevRequest = Promise.resolve();\n\t\t\tfor (let index = i; index < this.versions.length; index += buckets) {\n\t\t\t\t// Non null asserting here because we are iterating though versions\n\t\t\t\tconst version = this.versions[index]!;\n\t\t\t\tprevRequest = this.downloadVersionInfo(\n\t\t\t\t\tthis.documentStorageService,\n\t\t\t\t\tprevRequest,\n\t\t\t\t\tindex,\n\t\t\t\t\tversion,\n\t\t\t\t);\n\t\t\t}\n\t\t\twork.push(prevRequest);\n\t\t}\n\n\t\t// Don't wait for stuff to populate.\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tPromise.all(work).then(() => {\n\t\t\tthis.ui.updateVersionText(0);\n\t\t});\n\n\t\t// This hangs until the user makes a selection or closes the window.\n\t\tthis.shouldUseController =\n\t\t\t(await this.startSeqDeferred.promise) !== DebugReplayController.WindowClosedSeq;\n\n\t\tassert(\n\t\t\tthis.isSelectionMade() === this.shouldUseController,\n\t\t\t0x083 /* \"User selection status does not match replay controller use status!\" */,\n\t\t);\n\t\treturn this.shouldUseController;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tif (this.storage !== undefined) {\n\t\t\treturn this.storage.readBlob(blobId);\n\t\t}\n\t\tthrow new Error(\"Reading blob before storage is setup properly\");\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.storage !== undefined) {\n\t\t\treturn this.storage.getVersions(versionId, count);\n\t\t}\n\t\tthrow new Error(\"initStorage() was not called!\");\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (this.storage !== undefined) {\n\t\t\treturn this.storage.getSnapshotTree(versionRequested);\n\t\t}\n\t\tthrow new Error(\"Reading snapshot tree before storage is setup properly\");\n\t}\n\n\tpublic async getStartingOpSequence() {\n\t\treturn this.startSeqDeferred.promise;\n\t}\n\n\t/**\n\t * Return true if we are done processing ops\n\t */\n\tpublic isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean {\n\t\tif (lastTimeStamp === undefined) {\n\t\t\tthis.lastOpReached = true;\n\t\t\tif (currentOp === Number.MAX_SAFE_INTEGER) {\n\t\t\t\tthis.ui.updateLastOpText(-1, false);\n\t\t\t} else {\n\t\t\t\tthis.ui.updateLastOpText(currentOp, false);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.ui.updateLastOpText(currentOp, true);\n\t\t}\n\t\treturn this.lastOpReached && !this.retryFetchOpsOnEndOfFile;\n\t}\n\n\tpublic async replay(\n\t\temitter: (op: ISequencedDocumentMessage[]) => void,\n\t\tfetchedOps: ISequencedDocumentMessage[],\n\t): Promise<void> {\n\t\tlet _fetchedOps = fetchedOps;\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\tif (_fetchedOps.length === 0) {\n\t\t\t\tthis.ui.updateNextOpText([]);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this.stepsToPlay === 0) {\n\t\t\t\tthis.ui.disableNextOpButton(false);\n\t\t\t\tthis.stepsDeferred = new Deferred<number>();\n\n\t\t\t\tthis.ui.updateNextOpText(_fetchedOps);\n\n\t\t\t\tthis.stepsToPlay = await this.stepsDeferred.promise;\n\n\t\t\t\tthis.stepsDeferred = undefined;\n\t\t\t\tthis.ui.disableNextOpButton(true);\n\t\t\t}\n\n\t\t\tlet playOps: ISequencedDocumentMessage[];\n\t\t\tif (this.stepsToPlay >= _fetchedOps.length) {\n\t\t\t\tplayOps = _fetchedOps;\n\t\t\t\tthis.stepsToPlay -= _fetchedOps.length;\n\t\t\t\t_fetchedOps = [];\n\t\t\t} else {\n\t\t\t\tplayOps = _fetchedOps.splice(0, this.stepsToPlay);\n\t\t\t\tthis.stepsToPlay = 0;\n\t\t\t}\n\t\t\temitter(playOps);\n\t\t}\n\t}\n\n\tprotected resolveStorage(\n\t\tseq: number,\n\t\tstorage: ReadDocumentStorageServiceBase,\n\t\tversion: IVersion | string,\n\t) {\n\t\tassert(\n\t\t\t!this.isSelectionMade(),\n\t\t\t0x084 /* \"On storage resolve, user selection already made!\" */,\n\t\t);\n\t\tassert(!!storage, 0x085 /* \"On storage resolve, missing storage!\" */);\n\t\tthis.storage = storage;\n\t\tassert(\n\t\t\tthis.isSelectionMade(),\n\t\t\t0x086 /* \"After storage resolve, user selection status still false!\" */,\n\t\t);\n\n\t\tthis.ui.versionSelected(seq, version);\n\t\tthis.startSeqDeferred.resolve(seq);\n\t}\n}\n\nasync function* generateSequencedMessagesFromDeltaStorage(\n\tdeltaStorage: IDocumentDeltaStorageService,\n) {\n\tconst stream = deltaStorage.fetchMessages(1, undefined);\n\twhile (true) {\n\t\tconst result = await stream.read();\n\t\tif (result.done) {\n\t\t\treturn;\n\t\t}\n\t\tyield result.value;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidDebuggerUi.d.ts","sourceRoot":"","sources":["../src/fluidDebuggerUi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,QAAQ,EACR,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAEvC;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzE;;;;;;;;OAQG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAAC;IAErE;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAE5C;;;;OAIG;IACH,gBAAgB,CAAC,GAAG,EAAE,yBAAyB,EAAE,GAAG,IAAI,CAAC;IAEzD;;OAEG;IACH,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;I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AAM,EAAE,YAAY,EAAE,OAAO;IAOlE,OAAO,CAAC,QAAQ;CAYhB"}
|
package/dist/fluidDebuggerUi.js
CHANGED
|
@@ -86,12 +86,14 @@ class DebuggerUI {
|
|
|
86
86
|
const buttonVers = doc.getElementById("buttonVers");
|
|
87
87
|
buttonVers.onclick = () => {
|
|
88
88
|
const index = this.selector.selectedIndex;
|
|
89
|
+
// TODO Why are we non null asserting here
|
|
89
90
|
controller.onVersionSelection(this.versions[index]);
|
|
90
91
|
};
|
|
91
92
|
const fileSnapshot = doc.getElementById("file");
|
|
92
93
|
fileSnapshot.addEventListener("change", () => {
|
|
93
94
|
const files = fileSnapshot.files;
|
|
94
95
|
if (files) {
|
|
96
|
+
// TODO Why are we non null asserting here
|
|
95
97
|
controller.onSnapshotFileSelection(files[0]);
|
|
96
98
|
}
|
|
97
99
|
}, false);
|
|
@@ -171,6 +173,7 @@ class DebuggerUI {
|
|
|
171
173
|
this.text3.textContent = "";
|
|
172
174
|
}
|
|
173
175
|
else {
|
|
176
|
+
// Non null asserting here because of the length check above
|
|
174
177
|
const op = ops[0];
|
|
175
178
|
const seq = op.sequenceNumber;
|
|
176
179
|
const date = DebuggerUI.formatDate(op.timestamp);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidDebuggerUi.js","sourceRoot":"","sources":["../src/fluidDebuggerUi.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAuG7D,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;QAgBnB,CAAC;AAET,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;QAepB,CAAC;AAET;;GAEG;AACH,MAAa,UAAU;IACf,MAAM,CAAC,MAAM,CAAC,UAA+B;QACnD,IACC,OAAO,MAAM,KAAK,QAAQ;YAC1B,MAAM,KAAK,IAAI;YACf,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ;YACnC,MAAM,CAAC,QAAQ,IAAI,IAAI,EACtB,CAAC;YACF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8BAA8B,YAAY,eAAe,CAAC;YACrF,IAAI,CAAC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;QACrC,CAAC;IACF,CAAC;IAEM,gBAAgB,CAAC,WAAmB,EAAE,YAAqB;QACjE,MAAM,IAAI,GAAG,YAAY;YACxB,CAAC,CAAC,4BAA4B,WAAW,EAAE;YAC3C,CAAC,CAAC,4BAA4B,WAAW,EAAE,CAAC;QAC7C,IAAI,CAAC,UAAW,CAAC,WAAW,GAAG,IAAI,CAAC;IACrC,CAAC;IAEO,QAAQ,CAAC,QAAgB,EAAE,IAAY;QAC9C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC5C,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,iCAAiC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1F,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAE3C,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QAC/B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAEnC,OAAO,CAAC,KAAK,EAAE,CAAC;QAEhB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;CACD;AA5ND,gCA4NC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIVersion,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * @internal\n */\nexport interface IDebuggerUI {\n\t/**\n\t * Version information is provided.\n\t * Expect updates (information about seq#, timestamp) through updateVersion() calls\n\t */\n\taddVersions(version: IVersion[]): void;\n\n\t/**\n\t * Call when new version is downloaded from storage\n\t * Expect multiple callbacks.\n\t */\n\tupdateVersion(index: number, version: IVersion, seqNumber: number): void;\n\n\t/**\n\t * Called in response to successful onVersionSelection() or onSnapshotFileSelection() call\n\t * and provides extra information about selection.\n\t * It expected that UI layer would change its mode as result of this call, i.e. switch to\n\t * displaying op playback controls (if this is supported)\n\t * Note: There maybe no call to versionSelected() in response to onSnapshotFileSelection() call\n\t * if file does not exist, has wrong name of wrong format.\n\t * @param version - version, file name, or undefined if playing ops.\n\t */\n\tversionSelected(seqNumber: number, version: IVersion | string): void;\n\n\t/**\n\t * Called by controller in response to new ops being downloaded\n\t * Called with disable = true if there are no (currently) ops to play\n\t */\n\tdisableNextOpButton(disable: boolean): void;\n\n\t/**\n\t * Called by controller when new ops arrive (or we are done playing previous batch)\n\t * Indicates next batch of ops that would be played when UI calls controller's onOpButtonClick()\n\t * Called with ops=[] when there are no ops to play.\n\t */\n\tupdateNextOpText(ops: ISequencedDocumentMessage[]): void;\n\n\t/**\n\t * Called periodically when new versions are downloaded from server\n\t */\n\tupdateVersionText(versionsLeft: number): void;\n\n\t/**\n\t * Called periodically to notify about last known op\n\t * @param lastKnownOp - seq number of last known op. -1 if can't play ops in this mode (load from file)\n\t * @param stillLoading - true if we did not reach yet the end of the stream\n\t */\n\tupdateLastOpText(lastKnownOp: number, stillLoading: boolean): void;\n}\n\n/**\n * @internal\n */\nexport interface IDebuggerController {\n\t/**\n\t * Initialization. UI layers calls into controller to connect the two.\n\t * @param ui - UI layer\n\t */\n\tconnectToUi(ui: IDebuggerUI);\n\n\t/**\n\t * Called by UI layer when debugger window is closed by user\n\t * If called before user makes selection of snapshot/file, original\n\t * document service is returned to loader (instead of debugger service) and normal document load continues.\n\t */\n\tonClose(): void;\n\n\t/**\n\t * UI Layer notifies about selection of version to continue.\n\t * On successful load, versionSelected() is called.\n\t * @param version - Snapshot version to start from.\n\t */\n\tonVersionSelection(version: IVersion): void;\n\n\t/**\n\t * UI Layer notifies about selection of version to continue.\n\t * On successful load, versionSelected() is called.\n\t * @param version - File to load snapshot from\n\t */\n\tonSnapshotFileSelection(file: File): void;\n\n\t/**\n\t * \"next op\" button is clicked in the UI\n\t * @param steps - number of ops to play.\n\t */\n\tonOpButtonClick(steps: number): void;\n\n\t/**\n\t * \"Download ops\" option is clicked in the UI. Returns JSON of the full opStream when available.\n\t * @param anonymize - anonymize the ops json using the sanitization tool\n\t */\n\tonDownloadOpsButtonClick(anonymize: boolean): Promise<string>;\n}\n\nconst debuggerWindowHtml = `<Title>Fluid Debugger</Title>\n<body>\n<h3>Fluid Debugger</h3>\nPlease select snapshot or file to start with<br/>\nClose debugger window to proceed to live document<br/><br/>\n<select style='width:250px' id='selector'>\n</select>\n \n<button id='buttonVers' style='width:60px'>Go</button><br/>\n<input id='file' type='file' value='Load from file'/>\n<br/><br/>\n<h4>Download the current document's ops</h4>\n<input type='checkbox' id='anonymize' value='Anonymize'>\n<label for='anonymize'>Anonymize</label>\n<button type='button' id='downloadOps'>Download ops</button>\n<br/><br/><div id='versionText'></div>\n</body>`;\n\nconst debuggerWindowHtml2 = `<Title>Fluid Debugger</Title>\n<body>\n<h3>Fluid Debugger</h3>\n<div id='versionText'></div>\n<div id='lastOp'></div>\n<br/>\nStep to move: <input type='number' id='steps' value='1' min='1' style='width:50px'/>\n <button id='buttonOps' style='width:60px'>Go</button>\n<br/><br/>\n<div id='text1'></div><div id='text2'></div><div id='text3'></div>\n<br/>\n<h4>Download the current document's ops</h4>\n<input type='checkbox' id='anonymize' value='Anonymize'>\n<label for='anonymize'>Anonymize</label>\n<button type='button' id='downloadOps'>Download ops</button>\n</body>`;\n\n/**\n * @internal\n */\nexport class DebuggerUI {\n\tpublic static create(controller: IDebuggerController): DebuggerUI | null {\n\t\tif (\n\t\t\ttypeof window !== \"object\" ||\n\t\t\twindow === null ||\n\t\t\ttypeof window.document !== \"object\" ||\n\t\t\twindow.document == null\n\t\t) {\n\t\t\tconsole.log(\"Can't create debugger window - not running in browser!\");\n\t\t\treturn null;\n\t\t}\n\n\t\tconst debuggerWindow = window.open(\n\t\t\t\"\",\n\t\t\t\"\",\n\t\t\t\"width=400,height=400,resizable=yes,location=no,menubar=no,titlebar=no,status=no,toolbar=no\",\n\t\t);\n\t\tif (!debuggerWindow) {\n\t\t\tconsole.error(\n\t\t\t\t\"Can't create debugger window - please enable pop-up windows in your browser!\",\n\t\t\t);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn new DebuggerUI(controller, debuggerWindow);\n\t}\n\n\tprivate static formatDate(date: number) {\n\t\t// Alternative - without timezone\n\t\t// new Date().toLocaleString('default', { timeZone: 'UTC'}));\n\t\t// new Date().toLocaleString('default', { year: 'numeric', month: 'short',\n\t\t// day: 'numeric', hour: '2-digit', minute: 'numeric', second: 'numeric' }));\n\t\treturn new Date(date).toUTCString();\n\t}\n\n\tprotected selector?: HTMLSelectElement;\n\tprotected versionText: HTMLDivElement;\n\n\tprotected buttonOps?: HTMLButtonElement;\n\tprotected text1?: HTMLDivElement;\n\tprotected text2?: HTMLDivElement;\n\tprotected text3?: HTMLDivElement;\n\tprotected lastOpText?: HTMLDivElement;\n\tprotected wasVersionSelected = false;\n\tprotected versions: IVersion[] = [];\n\n\tprotected documentClosed = false;\n\n\tprotected constructor(\n\t\tprivate readonly controller: IDebuggerController,\n\t\tprivate readonly debuggerWindow: Window,\n\t) {\n\t\tconst doc = this.debuggerWindow.document;\n\t\tdoc.write(debuggerWindowHtml);\n\n\t\twindow.addEventListener(\n\t\t\t\"beforeunload\",\n\t\t\t(e) => {\n\t\t\t\tthis.documentClosed = true;\n\t\t\t\tthis.debuggerWindow.close();\n\t\t\t},\n\t\t\tfalse,\n\t\t);\n\n\t\tthis.debuggerWindow.addEventListener(\n\t\t\t\"beforeunload\",\n\t\t\t(e) => {\n\t\t\t\tif (!this.documentClosed) {\n\t\t\t\t\tthis.controller.onClose();\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t);\n\n\t\tthis.selector = doc.getElementById(\"selector\") as HTMLSelectElement;\n\n\t\tconst buttonVers = doc.getElementById(\"buttonVers\") as HTMLDivElement;\n\t\tbuttonVers.onclick = () => {\n\t\t\tconst index = this.selector!.selectedIndex;\n\t\t\tcontroller.onVersionSelection(this.versions[index]);\n\t\t};\n\n\t\tconst fileSnapshot = doc.getElementById(\"file\") as HTMLInputElement;\n\t\tfileSnapshot.addEventListener(\n\t\t\t\"change\",\n\t\t\t() => {\n\t\t\t\tconst files = fileSnapshot.files;\n\t\t\t\tif (files) {\n\t\t\t\t\tcontroller.onSnapshotFileSelection(files[0]);\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t);\n\n\t\tconst opDownloadButton = doc.getElementById(\"downloadOps\") as HTMLElement;\n\t\tconst anonymizeCheckbox = doc.getElementById(\"anonymize\") as HTMLInputElement;\n\t\tthis.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);\n\n\t\tthis.versionText = doc.getElementById(\"versionText\") as HTMLDivElement;\n\t\tthis.versionText.textContent = \"Fetching snapshots, please wait...\";\n\n\t\tcontroller.connectToUi(this);\n\t}\n\n\tprivate attachDownloadOpsListener(element: HTMLElement, anonymize: HTMLInputElement) {\n\t\telement.addEventListener(\"click\", () => {\n\t\t\tthis.controller\n\t\t\t\t.onDownloadOpsButtonClick(anonymize.checked)\n\t\t\t\t.then((opJson) => {\n\t\t\t\t\tthis.download(\"opStream.json\", opJson);\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tconsole.log(`Error downloading ops: ${error}`);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tpublic addVersions(versions: IVersion[]) {\n\t\tif (this.selector) {\n\t\t\tthis.versions = versions;\n\t\t\tfor (const version of versions) {\n\t\t\t\tconst option = document.createElement(\"option\");\n\t\t\t\toption.text =\n\t\t\t\t\tversion.date !== undefined\n\t\t\t\t\t\t? `id = ${version.id}, time = ${version.date}`\n\t\t\t\t\t\t: `id = ${version.id}`;\n\t\t\t\tthis.selector.add(option);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic updateVersion(index: number, version: IVersion, seqNumber: number) {\n\t\tif (this.selector) {\n\t\t\tconst option = this.selector[index] as HTMLOptionElement;\n\t\t\toption.text = `${option.text}, seq = ${seqNumber}`;\n\t\t\tthis.selector[index] = option;\n\t\t}\n\t}\n\n\tpublic versionSelected(seqNumber: number, version: IVersion | string) {\n\t\tconst text =\n\t\t\ttypeof version === \"string\"\n\t\t\t\t? `Playing ${version} file`\n\t\t\t\t: `Playing from ${version.id}, seq# ${seqNumber}`;\n\n\t\tthis.wasVersionSelected = true;\n\t\tthis.selector = undefined;\n\n\t\tconst doc = this.debuggerWindow.document;\n\t\tdoc.open();\n\t\tdoc.write(debuggerWindowHtml2);\n\t\tdoc.close();\n\n\t\tthis.lastOpText = doc.getElementById(\"lastOp\") as HTMLDivElement;\n\t\tthis.text1 = doc.getElementById(\"text1\") as HTMLDivElement;\n\t\tthis.text2 = doc.getElementById(\"text2\") as HTMLDivElement;\n\t\tthis.text3 = doc.getElementById(\"text3\") as HTMLDivElement;\n\n\t\tconst steps = doc.getElementById(\"steps\") as HTMLInputElement;\n\t\tthis.buttonOps = doc.getElementById(\"buttonOps\") as HTMLButtonElement;\n\t\tthis.buttonOps.disabled = true;\n\t\tthis.buttonOps.onclick = () => {\n\t\t\tthis.controller.onOpButtonClick(Number(steps.value));\n\t\t};\n\n\t\tthis.versionText = doc.getElementById(\"versionText\") as HTMLDivElement;\n\t\tthis.versionText.textContent = text;\n\n\t\tconst opDownloadButton = doc.getElementById(\"downloadOps\") as HTMLElement;\n\t\tconst anonymizeCheckbox = doc.getElementById(\"anonymize\") as HTMLInputElement;\n\t\tthis.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);\n\t}\n\n\tpublic disableNextOpButton(disable: boolean) {\n\t\tassert(!!this.buttonOps, 0x088 /* \"Missing button ops button!\" */);\n\t\tthis.buttonOps.disabled = disable;\n\t}\n\n\tpublic updateNextOpText(ops: ISequencedDocumentMessage[]) {\n\t\tif (ops.length === 0) {\n\t\t\tthis.text1!.textContent = \"\";\n\t\t\tthis.text2!.textContent = \"\";\n\t\t\tthis.text3!.textContent = \"\";\n\t\t} else {\n\t\t\tconst op = ops[0];\n\t\t\tconst seq = op.sequenceNumber;\n\t\t\tconst date = DebuggerUI.formatDate(op.timestamp);\n\t\t\tthis.text1!.textContent = `Next op seq#: ${seq}`;\n\t\t\tthis.text2!.textContent = `Type: ${op.type}`;\n\t\t\tthis.text3!.textContent = `${date}`;\n\t\t}\n\t}\n\n\tpublic updateVersionText(versionCount: number) {\n\t\tif (!this.wasVersionSelected) {\n\t\t\tconst text =\n\t\t\t\tversionCount === 0 ? \"\" : `Fetching information about ${versionCount} snapshots...`;\n\t\t\tthis.versionText.textContent = text;\n\t\t}\n\t}\n\n\tpublic updateLastOpText(lastKnownOp: number, stillLoading: boolean) {\n\t\tconst text = stillLoading\n\t\t\t? `Last op (still loading): ${lastKnownOp}`\n\t\t\t: `Document's last op seq#: ${lastKnownOp}`;\n\t\tthis.lastOpText!.textContent = text;\n\t}\n\n\tprivate download(filename: string, data: string): void {\n\t\tconst element = document.createElement(\"a\");\n\t\telement.setAttribute(\"href\", `data:text/plain;charset=utf-8,${encodeURIComponent(data)}`);\n\t\telement.setAttribute(\"download\", filename);\n\n\t\telement.style.display = \"none\";\n\t\tdocument.body.appendChild(element);\n\n\t\telement.click();\n\n\t\tdocument.body.removeChild(element);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"fluidDebuggerUi.js","sourceRoot":"","sources":["../src/fluidDebuggerUi.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAuG7D,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;QAgBnB,CAAC;AAET,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;QAepB,CAAC;AAET;;GAEG;AACH,MAAa,UAAU;IACf,MAAM,CAAC,MAAM,CAAC,UAA+B;QACnD,IACC,OAAO,MAAM,KAAK,QAAQ;YAC1B,MAAM,KAAK,IAAI;YACf,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ;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AkB,EAAE,CAAC;YAC9B,MAAM,IAAI,GACT,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,8BAA8B,YAAY,eAAe,CAAC;YACrF,IAAI,CAAC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;QACrC,CAAC;IACF,CAAC;IAEM,gBAAgB,CAAC,WAAmB,EAAE,YAAqB;QACjE,MAAM,IAAI,GAAG,YAAY;YACxB,CAAC,CAAC,4BAA4B,WAAW,EAAE;YAC3C,CAAC,CAAC,4BAA4B,WAAW,EAAE,CAAC;QAC7C,IAAI,CAAC,UAAW,CAAC,WAAW,GAAG,IAAI,CAAC;IACrC,CAAC;IAEO,QAAQ,CAAC,QAAgB,EAAE,IAAY;QAC9C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC5C,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,iCAAiC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1F,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAE3C,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QAC/B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAEnC,OAAO,CAAC,KAAK,EAAE,CAAC;QAEhB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;CACD;AA/ND,gCA+NC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIVersion,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * @internal\n */\nexport interface IDebuggerUI {\n\t/**\n\t * Version information is provided.\n\t * Expect updates (information about seq#, timestamp) through updateVersion() calls\n\t */\n\taddVersions(version: IVersion[]): void;\n\n\t/**\n\t * Call when new version is downloaded from storage\n\t * Expect multiple callbacks.\n\t */\n\tupdateVersion(index: number, version: IVersion, seqNumber: number): void;\n\n\t/**\n\t * Called in response to successful onVersionSelection() or onSnapshotFileSelection() call\n\t * and provides extra information about selection.\n\t * It expected that UI layer would change its mode as result of this call, i.e. switch to\n\t * displaying op playback controls (if this is supported)\n\t * Note: There maybe no call to versionSelected() in response to onSnapshotFileSelection() call\n\t * if file does not exist, has wrong name of wrong format.\n\t * @param version - version, file name, or undefined if playing ops.\n\t */\n\tversionSelected(seqNumber: number, version: IVersion | string): void;\n\n\t/**\n\t * Called by controller in response to new ops being downloaded\n\t * Called with disable = true if there are no (currently) ops to play\n\t */\n\tdisableNextOpButton(disable: boolean): void;\n\n\t/**\n\t * Called by controller when new ops arrive (or we are done playing previous batch)\n\t * Indicates next batch of ops that would be played when UI calls controller's onOpButtonClick()\n\t * Called with ops=[] when there are no ops to play.\n\t */\n\tupdateNextOpText(ops: ISequencedDocumentMessage[]): void;\n\n\t/**\n\t * Called periodically when new versions are downloaded from server\n\t */\n\tupdateVersionText(versionsLeft: number): void;\n\n\t/**\n\t * Called periodically to notify about last known op\n\t * @param lastKnownOp - seq number of last known op. -1 if can't play ops in this mode (load from file)\n\t * @param stillLoading - true if we did not reach yet the end of the stream\n\t */\n\tupdateLastOpText(lastKnownOp: number, stillLoading: boolean): void;\n}\n\n/**\n * @internal\n */\nexport interface IDebuggerController {\n\t/**\n\t * Initialization. UI layers calls into controller to connect the two.\n\t * @param ui - UI layer\n\t */\n\tconnectToUi(ui: IDebuggerUI);\n\n\t/**\n\t * Called by UI layer when debugger window is closed by user\n\t * If called before user makes selection of snapshot/file, original\n\t * document service is returned to loader (instead of debugger service) and normal document load continues.\n\t */\n\tonClose(): void;\n\n\t/**\n\t * UI Layer notifies about selection of version to continue.\n\t * On successful load, versionSelected() is called.\n\t * @param version - Snapshot version to start from.\n\t */\n\tonVersionSelection(version: IVersion): void;\n\n\t/**\n\t * UI Layer notifies about selection of version to continue.\n\t * On successful load, versionSelected() is called.\n\t * @param version - File to load snapshot from\n\t */\n\tonSnapshotFileSelection(file: File): void;\n\n\t/**\n\t * \"next op\" button is clicked in the UI\n\t * @param steps - number of ops to play.\n\t */\n\tonOpButtonClick(steps: number): void;\n\n\t/**\n\t * \"Download ops\" option is clicked in the UI. Returns JSON of the full opStream when available.\n\t * @param anonymize - anonymize the ops json using the sanitization tool\n\t */\n\tonDownloadOpsButtonClick(anonymize: boolean): Promise<string>;\n}\n\nconst debuggerWindowHtml = `<Title>Fluid Debugger</Title>\n<body>\n<h3>Fluid Debugger</h3>\nPlease select snapshot or file to start with<br/>\nClose debugger window to proceed to live document<br/><br/>\n<select style='width:250px' id='selector'>\n</select>\n \n<button id='buttonVers' style='width:60px'>Go</button><br/>\n<input id='file' type='file' value='Load from file'/>\n<br/><br/>\n<h4>Download the current document's ops</h4>\n<input type='checkbox' id='anonymize' value='Anonymize'>\n<label for='anonymize'>Anonymize</label>\n<button type='button' id='downloadOps'>Download ops</button>\n<br/><br/><div id='versionText'></div>\n</body>`;\n\nconst debuggerWindowHtml2 = `<Title>Fluid Debugger</Title>\n<body>\n<h3>Fluid Debugger</h3>\n<div id='versionText'></div>\n<div id='lastOp'></div>\n<br/>\nStep to move: <input type='number' id='steps' value='1' min='1' style='width:50px'/>\n <button id='buttonOps' style='width:60px'>Go</button>\n<br/><br/>\n<div id='text1'></div><div id='text2'></div><div id='text3'></div>\n<br/>\n<h4>Download the current document's ops</h4>\n<input type='checkbox' id='anonymize' value='Anonymize'>\n<label for='anonymize'>Anonymize</label>\n<button type='button' id='downloadOps'>Download ops</button>\n</body>`;\n\n/**\n * @internal\n */\nexport class DebuggerUI {\n\tpublic static create(controller: IDebuggerController): DebuggerUI | null {\n\t\tif (\n\t\t\ttypeof window !== \"object\" ||\n\t\t\twindow === null ||\n\t\t\ttypeof window.document !== \"object\" ||\n\t\t\twindow.document == null\n\t\t) {\n\t\t\tconsole.log(\"Can't create debugger window - not running in browser!\");\n\t\t\treturn null;\n\t\t}\n\n\t\tconst debuggerWindow = window.open(\n\t\t\t\"\",\n\t\t\t\"\",\n\t\t\t\"width=400,height=400,resizable=yes,location=no,menubar=no,titlebar=no,status=no,toolbar=no\",\n\t\t);\n\t\tif (!debuggerWindow) {\n\t\t\tconsole.error(\n\t\t\t\t\"Can't create debugger window - please enable pop-up windows in your browser!\",\n\t\t\t);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn new DebuggerUI(controller, debuggerWindow);\n\t}\n\n\tprivate static formatDate(date: number) {\n\t\t// Alternative - without timezone\n\t\t// new Date().toLocaleString('default', { timeZone: 'UTC'}));\n\t\t// new Date().toLocaleString('default', { year: 'numeric', month: 'short',\n\t\t// day: 'numeric', hour: '2-digit', minute: 'numeric', second: 'numeric' }));\n\t\treturn new Date(date).toUTCString();\n\t}\n\n\tprotected selector?: HTMLSelectElement;\n\tprotected versionText: HTMLDivElement;\n\n\tprotected buttonOps?: HTMLButtonElement;\n\tprotected text1?: HTMLDivElement;\n\tprotected text2?: HTMLDivElement;\n\tprotected text3?: HTMLDivElement;\n\tprotected lastOpText?: HTMLDivElement;\n\tprotected wasVersionSelected = false;\n\tprotected versions: IVersion[] = [];\n\n\tprotected documentClosed = false;\n\n\tprotected constructor(\n\t\tprivate readonly controller: IDebuggerController,\n\t\tprivate readonly debuggerWindow: Window,\n\t) {\n\t\tconst doc = this.debuggerWindow.document;\n\t\tdoc.write(debuggerWindowHtml);\n\n\t\twindow.addEventListener(\n\t\t\t\"beforeunload\",\n\t\t\t(e) => {\n\t\t\t\tthis.documentClosed = true;\n\t\t\t\tthis.debuggerWindow.close();\n\t\t\t},\n\t\t\tfalse,\n\t\t);\n\n\t\tthis.debuggerWindow.addEventListener(\n\t\t\t\"beforeunload\",\n\t\t\t(e) => {\n\t\t\t\tif (!this.documentClosed) {\n\t\t\t\t\tthis.controller.onClose();\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t);\n\n\t\tthis.selector = doc.getElementById(\"selector\") as HTMLSelectElement;\n\n\t\tconst buttonVers = doc.getElementById(\"buttonVers\") as HTMLDivElement;\n\t\tbuttonVers.onclick = () => {\n\t\t\tconst index = this.selector!.selectedIndex;\n\t\t\t// TODO Why are we non null asserting here\n\t\t\tcontroller.onVersionSelection(this.versions[index]!);\n\t\t};\n\n\t\tconst fileSnapshot = doc.getElementById(\"file\") as HTMLInputElement;\n\t\tfileSnapshot.addEventListener(\n\t\t\t\"change\",\n\t\t\t() => {\n\t\t\t\tconst files = fileSnapshot.files;\n\t\t\t\tif (files) {\n\t\t\t\t\t// TODO Why are we non null asserting here\n\t\t\t\t\tcontroller.onSnapshotFileSelection(files[0]!);\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t);\n\n\t\tconst opDownloadButton = doc.getElementById(\"downloadOps\") as HTMLElement;\n\t\tconst anonymizeCheckbox = doc.getElementById(\"anonymize\") as HTMLInputElement;\n\t\tthis.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);\n\n\t\tthis.versionText = doc.getElementById(\"versionText\") as HTMLDivElement;\n\t\tthis.versionText.textContent = \"Fetching snapshots, please wait...\";\n\n\t\tcontroller.connectToUi(this);\n\t}\n\n\tprivate attachDownloadOpsListener(element: HTMLElement, anonymize: HTMLInputElement) {\n\t\telement.addEventListener(\"click\", () => {\n\t\t\tthis.controller\n\t\t\t\t.onDownloadOpsButtonClick(anonymize.checked)\n\t\t\t\t.then((opJson) => {\n\t\t\t\t\tthis.download(\"opStream.json\", opJson);\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tconsole.log(`Error downloading ops: ${error}`);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tpublic addVersions(versions: IVersion[]) {\n\t\tif (this.selector) {\n\t\t\tthis.versions = versions;\n\t\t\tfor (const version of versions) {\n\t\t\t\tconst option = document.createElement(\"option\");\n\t\t\t\toption.text =\n\t\t\t\t\tversion.date !== undefined\n\t\t\t\t\t\t? `id = ${version.id}, time = ${version.date}`\n\t\t\t\t\t\t: `id = ${version.id}`;\n\t\t\t\tthis.selector.add(option);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic updateVersion(index: number, version: IVersion, seqNumber: number) {\n\t\tif (this.selector) {\n\t\t\tconst option = this.selector[index] as HTMLOptionElement;\n\t\t\toption.text = `${option.text}, seq = ${seqNumber}`;\n\t\t\tthis.selector[index] = option;\n\t\t}\n\t}\n\n\tpublic versionSelected(seqNumber: number, version: IVersion | string) {\n\t\tconst text =\n\t\t\ttypeof version === \"string\"\n\t\t\t\t? `Playing ${version} file`\n\t\t\t\t: `Playing from ${version.id}, seq# ${seqNumber}`;\n\n\t\tthis.wasVersionSelected = true;\n\t\tthis.selector = undefined;\n\n\t\tconst doc = this.debuggerWindow.document;\n\t\tdoc.open();\n\t\tdoc.write(debuggerWindowHtml2);\n\t\tdoc.close();\n\n\t\tthis.lastOpText = doc.getElementById(\"lastOp\") as HTMLDivElement;\n\t\tthis.text1 = doc.getElementById(\"text1\") as HTMLDivElement;\n\t\tthis.text2 = doc.getElementById(\"text2\") as HTMLDivElement;\n\t\tthis.text3 = doc.getElementById(\"text3\") as HTMLDivElement;\n\n\t\tconst steps = doc.getElementById(\"steps\") as HTMLInputElement;\n\t\tthis.buttonOps = doc.getElementById(\"buttonOps\") as HTMLButtonElement;\n\t\tthis.buttonOps.disabled = true;\n\t\tthis.buttonOps.onclick = () => {\n\t\t\tthis.controller.onOpButtonClick(Number(steps.value));\n\t\t};\n\n\t\tthis.versionText = doc.getElementById(\"versionText\") as HTMLDivElement;\n\t\tthis.versionText.textContent = text;\n\n\t\tconst opDownloadButton = doc.getElementById(\"downloadOps\") as HTMLElement;\n\t\tconst anonymizeCheckbox = doc.getElementById(\"anonymize\") as HTMLInputElement;\n\t\tthis.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);\n\t}\n\n\tpublic disableNextOpButton(disable: boolean) {\n\t\tassert(!!this.buttonOps, 0x088 /* \"Missing button ops button!\" */);\n\t\tthis.buttonOps.disabled = disable;\n\t}\n\n\tpublic updateNextOpText(ops: ISequencedDocumentMessage[]) {\n\t\tif (ops.length === 0) {\n\t\t\tthis.text1!.textContent = \"\";\n\t\t\tthis.text2!.textContent = \"\";\n\t\t\tthis.text3!.textContent = \"\";\n\t\t} else {\n\t\t\t// Non null asserting here because of the length check above\n\t\t\tconst op = ops[0]!;\n\t\t\tconst seq = op.sequenceNumber;\n\t\t\tconst date = DebuggerUI.formatDate(op.timestamp);\n\t\t\tthis.text1!.textContent = `Next op seq#: ${seq}`;\n\t\t\tthis.text2!.textContent = `Type: ${op.type}`;\n\t\t\tthis.text3!.textContent = `${date}`;\n\t\t}\n\t}\n\n\tpublic updateVersionText(versionCount: number) {\n\t\tif (!this.wasVersionSelected) {\n\t\t\tconst text =\n\t\t\t\tversionCount === 0 ? \"\" : `Fetching information about ${versionCount} snapshots...`;\n\t\t\tthis.versionText.textContent = text;\n\t\t}\n\t}\n\n\tpublic updateLastOpText(lastKnownOp: number, stillLoading: boolean) {\n\t\tconst text = stillLoading\n\t\t\t? `Last op (still loading): ${lastKnownOp}`\n\t\t\t: `Document's last op seq#: ${lastKnownOp}`;\n\t\tthis.lastOpText!.textContent = text;\n\t}\n\n\tprivate download(filename: string, data: string): void {\n\t\tconst element = document.createElement(\"a\");\n\t\telement.setAttribute(\"href\", `data:text/plain;charset=utf-8,${encodeURIComponent(data)}`);\n\t\telement.setAttribute(\"download\", filename);\n\n\t\telement.style.display = \"none\";\n\t\tdocument.body.appendChild(element);\n\n\t\telement.click();\n\n\t\tdocument.body.removeChild(element);\n\t}\n}\n"]}
|
package/dist/legacy.d.ts
CHANGED
package/dist/public.d.ts
CHANGED
package/dist/sanitize.js
CHANGED
|
@@ -44,13 +44,16 @@ function Sanitize(msgPath, fullScrub, noBail) {
|
|
|
44
44
|
}
|
|
45
45
|
function main() {
|
|
46
46
|
if (node_process_1.default.argv.length === 3) {
|
|
47
|
+
// Non null asserting here because of the length check above
|
|
47
48
|
return Sanitize(node_process_1.default.argv[2], false, false);
|
|
48
49
|
}
|
|
49
50
|
if (node_process_1.default.argv.length === 4) {
|
|
51
|
+
// Non null asserting here because of the length check above
|
|
50
52
|
if (node_process_1.default.argv[2] === "--full") {
|
|
51
53
|
return Sanitize(node_process_1.default.argv[3], true, false);
|
|
52
54
|
}
|
|
53
55
|
if (node_process_1.default.argv[2] === "--noBail") {
|
|
56
|
+
// Non null asserting here because of the length check above
|
|
54
57
|
return Sanitize(node_process_1.default.argv[3], false, true);
|
|
55
58
|
}
|
|
56
59
|
}
|
package/dist/sanitize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH;;;;;;;;;;;;;GAaG;AAEH,sDAAyB;AACzB,gEAAmC;AAInC,iDAA2C;AAE3C,SAAS,UAAU;IAClB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtB,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC;IACnF,OAAO,CAAC,GAAG,CACV,iGAAiG,CACjG,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,4EAA4E,CAAC,CAAC;IAC1F,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IACnD,sBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,QAAQ,CAAC,OAAe,EAAE,SAAkB,EAAE,MAAe;IACrE,MAAM,KAAK,GAAG,iBAAE,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAA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*/\n\n/**\n * This tool cleans up a message.json file downloaded through fluid-fetch to remove\n * user content and user identifying information. Enough information can be retained\n * to allow loading through Fluid Preview, or everything can be scrubbed so that only\n * replay-tool can read the result. Anonymous identifying information such as client\n * IDs are always retained. Object keys are NOT scrubbed, including those that are\n * nested within values (only leaf values are scrubbed).\n *\n * Note: While user content/information is scrubbed, it should not be assumed to be\n * fully anonymized because certain meta-information (such as word lengths and\n * consistent replacement) are preserved.\n *\n * Messages must match known structures when scrubbing for Fluid Preview.\n */\n\nimport fs from \"node:fs\";\nimport process from \"node:process\";\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport { Sanitizer } from \"./sanitizer.js\";\n\nfunction printUsage() {\n\tconsole.log(\"Usage:\");\n\tconsole.log(\" node sanitize [--full | --noBail] <input>\");\n\tconsole.log(\"Where\");\n\tconsole.log(\" [--full] - scrub fully (result cannot be loaded in Fluid Preview)\");\n\tconsole.log(\n\t\t\" [--noBail] - don't bail out when encountering an unknown message format (it won't be scrubbed\",\n\t);\n\tconsole.log(\" <input> - file path to message.json - file downloaded by FluidFetch tool\");\n\tconsole.log(\"Note: <input> is sanitized in place\");\n\tprocess.exit(-1);\n}\n\nfunction Sanitize(msgPath: string, fullScrub: boolean, noBail: boolean) {\n\tconst input = fs.readFileSync(msgPath, { encoding: \"utf-8\" });\n\tconst messages = JSON.parse(input) as ISequencedDocumentMessage[];\n\n\tconst sanitizer = new Sanitizer(messages, fullScrub, noBail, true);\n\tconst cleanMessages = sanitizer.sanitize();\n\n\tfs.writeFileSync(msgPath, JSON.stringify(cleanMessages, undefined, 2));\n\n\tconsole.log(\"Done.\");\n}\n\nfunction main() {\n\tif (process.argv.length === 3) {\n\t\t// Non null asserting here because of the length check above\n\t\treturn Sanitize(process.argv[2]!, false, false);\n\t}\n\tif (process.argv.length === 4) {\n\t\t// Non null asserting here because of the length check above\n\t\tif (process.argv[2] === \"--full\") {\n\t\t\treturn Sanitize(process.argv[3]!, true, false);\n\t\t}\n\t\tif (process.argv[2] === \"--noBail\") {\n\t\t\t// Non null asserting here because of the length check above\n\t\t\treturn Sanitize(process.argv[3]!, false, true);\n\t\t}\n\t}\n\tprintUsage();\n}\n\nmain();\n"]}
|
package/internal.d.ts
CHANGED
package/legacy.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
|
-
* Generated by "flub generate entrypoints" in @
|
|
8
|
+
* Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
export * from "./lib/legacy.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidDebuggerController.d.ts","sourceRoot":"","sources":["../src/fluidDebuggerController.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAU,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAEN,gBAAgB,EAChB,uBAAuB,EAEvB,aAAa,EACb,QAAQ,EACR,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAGN,8BAA8B,EAC9B,gBAAgB,EAEhB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxE;;GAEG;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,mBAAmB,KAAK,WAAW,GAAG,IAAI,CAAC;AAExF;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,gBAAiB,YAAW,mBAAmB;WAE3E,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,qBAAqB,GAAG,IAAI;IAW/E,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,MAAM;qBAExB,WAAW,CACjC,sBAAsB,EAAE,uBAAuB,EAC/C,IAAI,EAAE,aAAa,GAAG,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AS,CAAC,cAAc,CACvB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,8BAA8B,EACvC,OAAO,EAAE,QAAQ,GAAG,MAAM;CAgB3B"}
|
|
@@ -37,6 +37,7 @@ export class DebugReplayController extends ReplayController {
|
|
|
37
37
|
if (!tree) {
|
|
38
38
|
return 0;
|
|
39
39
|
}
|
|
40
|
+
// TODO Why are we non null asserting here
|
|
40
41
|
const attributesHash = tree.trees[".protocol"].blobs.attributes;
|
|
41
42
|
const attrib = await readAndParse(documentStorageService, attributesHash);
|
|
42
43
|
return attrib.sequenceNumber;
|
|
@@ -162,6 +163,7 @@ export class DebugReplayController extends ReplayController {
|
|
|
162
163
|
for (let i = 0; i < buckets; i++) {
|
|
163
164
|
let prevRequest = Promise.resolve();
|
|
164
165
|
for (let index = i; index < this.versions.length; index += buckets) {
|
|
166
|
+
// Non null asserting here because we are iterating though versions
|
|
165
167
|
const version = this.versions[index];
|
|
166
168
|
prevRequest = this.downloadVersionInfo(this.documentStorageService, prevRequest, index, version);
|
|
167
169
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidDebuggerController.js","sourceRoot":"","sources":["../src/fluidDebuggerController.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAUvE,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EACN,kBAAkB,EAGlB,gBAAgB,EAChB,eAAe,GACf,MAAM,wCAAwC,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAQ3C;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,gBAAgB;IAA3D;;QA+BW,OAAE,GAAgB,IAA0B,CAAC,CAAC,gDAAgD;QAE9F,qBAAgB,GAAG,IAAI,QAAQ,EAAU,CAAC;QAEpD,kEAAkE;QACxD,6BAAwB,GAAG,KAAK,CAAC;QAI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M,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO;QACR,CAAC;QACD,MAAM,MAAM,CAAC,KAAK,CAAC;IACpB,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentStorageService,\n\tIDocumentAttributes,\n\tISnapshotTree,\n\tIVersion,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tFileSnapshotReader,\n\tIFileSnapshot,\n\tReadDocumentStorageServiceBase,\n\tReplayController,\n\tSnapshotStorage,\n} from \"@fluidframework/replay-driver/internal\";\n\nimport { IDebuggerController, IDebuggerUI } from \"./fluidDebuggerUi.js\";\nimport { Sanitizer } from \"./sanitizer.js\";\n\n/**\n * @internal\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport type debuggerUIFactory = (controller: IDebuggerController) => IDebuggerUI | null;\n\n/**\n * Replay controller that uses pop-up window to control op playback\n * @internal\n */\nexport class DebugReplayController extends ReplayController implements IDebuggerController {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic static create(createUi: debuggerUIFactory): DebugReplayController | null {\n\t\tif (typeof localStorage === \"object\" && localStorage?.FluidDebugger) {\n\t\t\tconst controller = new DebugReplayController();\n\t\t\tconst ui = createUi(controller);\n\t\t\tif (ui) {\n\t\t\t\treturn controller;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected static readonly WindowClosedSeq = -1; // Seq# to indicate that user closed window\n\n\tprotected static async seqFromTree(\n\t\tdocumentStorageService: IDocumentStorageService,\n\t\ttree: ISnapshotTree | null,\n\t): Promise<number> {\n\t\tif (!tree) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tconst attributesHash = tree.trees[\".protocol\"].blobs.attributes;\n\t\tconst attrib = await readAndParse<IDocumentAttributes>(\n\t\t\tdocumentStorageService,\n\t\t\tattributesHash,\n\t\t);\n\t\treturn attrib.sequenceNumber;\n\t}\n\n\tprotected ui: IDebuggerUI = null as any as IDebuggerUI; // Not to check on every line that it's not null\n\tprotected stepsDeferred?: Deferred<number>;\n\tprotected startSeqDeferred = new Deferred<number>();\n\n\t// True will cause us ping server indefinitely waiting for new ops\n\tprotected retryFetchOpsOnEndOfFile = false;\n\n\tprotected documentService?: IDocumentService;\n\tprotected documentStorageService?: IDocumentStorageService;\n\tprotected versions: IVersion[] = [];\n\tprotected stepsToPlay: number = 0;\n\tprotected lastOpReached = false;\n\tprotected versionCount = 0;\n\n\tprotected storage?: ReadDocumentStorageServiceBase;\n\n\t// Member to prevent repeated initialization in initStorage(...), which also\n\t// returns if this controller should be used or function as a passthrough\n\tprivate shouldUseController: boolean | undefined;\n\n\tpublic connectToUi(ui: IDebuggerUI): void {\n\t\tthis.ui = ui;\n\t}\n\n\tpublic onClose() {\n\t\tthis.startSeqDeferred.resolve(DebugReplayController.WindowClosedSeq);\n\t}\n\n\tpublic async onVersionSelection(version: IVersion) {\n\t\tif (!this.documentStorageService) {\n\t\t\tthrow new Error(\"onVersionSelection: no storage\");\n\t\t}\n\n\t\tconst tree = await this.documentStorageService.getSnapshotTree(version);\n\t\tconst seq = await DebugReplayController.seqFromTree(this.documentStorageService, tree);\n\t\tthis.resolveStorage(seq, new SnapshotStorage(this.documentStorageService, tree), version);\n\t}\n\n\tpublic onOpButtonClick(steps: number) {\n\t\tif (this.stepsDeferred && !Number.isNaN(steps) && steps > 0) {\n\t\t\tthis.stepsDeferred.resolve(steps);\n\t\t}\n\t}\n\n\tpublic onSnapshotFileSelection(file: File) {\n\t\tif (!/^snapshot.*\\.json/.exec(file.name)) {\n\t\t\talert(`Incorrect file name: ${file.name}`);\n\t\t\treturn;\n\t\t}\n\t\tif (/.*_expanded.*/.exec(file.name)) {\n\t\t\talert(`Incorrect file name - please use non-extended files: ${file.name}`);\n\t\t\treturn;\n\t\t}\n\n\t\tconst reader = new FileReader();\n\t\treader.onload = async () => {\n\t\t\tif (this.documentStorageService) {\n\t\t\t\tconst text = reader.result as string;\n\t\t\t\ttry {\n\t\t\t\t\tconst json: IFileSnapshot = JSON.parse(text) as IFileSnapshot;\n\t\t\t\t\t/*\n Const docStorage = this.documentStorageService;\n const storage = {\n read: (blobId: string) => this.read(docStorage, blobId),\n };\n const seq = await DebugReplayController.seqFromTree(\n storage as IDocumentStorageService,\n tree);\n this.startSeqDeferred.resolve(seq);\n */\n\t\t\t\t\t// No ability to load ops, so just say - pick up from infinite op.\n\t\t\t\t\tthis.retryFetchOpsOnEndOfFile = false;\n\t\t\t\t\tthis.lastOpReached = true;\n\t\t\t\t\tthis.resolveStorage(\n\t\t\t\t\t\tNumber.MAX_SAFE_INTEGER,\n\t\t\t\t\t\tnew FileSnapshotReader(json),\n\t\t\t\t\t\tfile.name,\n\t\t\t\t\t);\n\t\t\t\t} catch (error) {\n\t\t\t\t\talert(`Error parsing file: ${error}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\treader.readAsText(file, \"utf-8\");\n\t}\n\n\tpublic async onDownloadOpsButtonClick(anonymize: boolean): Promise<string> {\n\t\tif (this.documentService === undefined) {\n\t\t\tthrow new Error(\"DocumentService required\");\n\t\t}\n\n\t\tconst documentDeltaStorageService = await this.documentService.connectToDeltaStorage();\n\t\tlet messages = await this.fetchOpsFromDeltaStorage(documentDeltaStorageService);\n\n\t\tif (anonymize) {\n\t\t\tconst sanitizer = new Sanitizer(messages, false /* fullScrub */, false /* noBail */);\n\t\t\tmessages = sanitizer.sanitize();\n\t\t}\n\n\t\treturn JSON.stringify(messages, undefined, 2);\n\t}\n\n\tprivate async fetchOpsFromDeltaStorage(\n\t\tdocumentDeltaStorageService,\n\t): Promise<ISequencedDocumentMessage[]> {\n\t\tconst deltaGenerator = generateSequencedMessagesFromDeltaStorage(\n\t\t\tdocumentDeltaStorageService,\n\t\t);\n\t\tlet messages: ISequencedDocumentMessage[] = [];\n\t\tfor await (const message of deltaGenerator) {\n\t\t\tmessages = messages.concat(message);\n\t\t}\n\t\treturn messages;\n\t}\n\n\tpublic fetchTo(currentOp: number): number | undefined {\n\t\treturn undefined;\n\t}\n\n\t// Returns true if version / file / ops selections is made.\n\tpublic isSelectionMade() {\n\t\treturn this.storage !== undefined;\n\t}\n\n\tpublic async downloadVersionInfo(\n\t\tdocumentStorageService: IDocumentStorageService,\n\t\tprevRequest: Promise<void>,\n\t\tindex: number,\n\t\tversion: IVersion,\n\t): Promise<void> {\n\t\tif (this.isSelectionMade()) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait prevRequest;\n\n\t\tconst treeV = await documentStorageService.getSnapshotTree(version);\n\t\tconst seqV = await DebugReplayController.seqFromTree(documentStorageService, treeV);\n\n\t\tif (!this.isSelectionMade()) {\n\t\t\tthis.versionCount--;\n\t\t\tthis.ui.updateVersionText(this.versionCount);\n\t\t\tthis.ui.updateVersion(index, version, seqV);\n\t\t}\n\t}\n\n\tpublic async initStorage(documentService: IDocumentService): Promise<boolean> {\n\t\tif (this.shouldUseController !== undefined) {\n\t\t\treturn this.shouldUseController;\n\t\t}\n\n\t\tassert(!!documentService, 0x080 /* \"Invalid document service!\" */);\n\t\tassert(!this.documentService, 0x081 /* \"Document service already set!\" */);\n\t\tassert(!this.documentStorageService, 0x082 /* \"Document storage service already set!\" */);\n\t\tthis.documentService = documentService;\n\t\tthis.documentStorageService = await documentService.connectToStorage();\n\n\t\t// User can chose \"file\" at any moment in time!\n\t\tif (!this.isSelectionMade()) {\n\t\t\tthis.versions = await this.documentStorageService.getVersions(\"\", 50);\n\t\t\tif (!this.isSelectionMade()) {\n\t\t\t\tthis.ui.addVersions(this.versions);\n\t\t\t\tthis.ui.updateVersionText(this.versionCount);\n\t\t\t}\n\t\t}\n\n\t\tthis.versionCount = this.versions.length;\n\n\t\t// Download all versions - do 10 downloads in parallel to avoid being throttled\n\t\tconst buckets = 10;\n\t\tconst work: Promise<void>[] = [];\n\t\tfor (let i = 0; i < buckets; i++) {\n\t\t\tlet prevRequest = Promise.resolve();\n\t\t\tfor (let index = i; index < this.versions.length; index += buckets) {\n\t\t\t\tconst version = this.versions[index];\n\t\t\t\tprevRequest = this.downloadVersionInfo(\n\t\t\t\t\tthis.documentStorageService,\n\t\t\t\t\tprevRequest,\n\t\t\t\t\tindex,\n\t\t\t\t\tversion,\n\t\t\t\t);\n\t\t\t}\n\t\t\twork.push(prevRequest);\n\t\t}\n\n\t\t// Don't wait for stuff to populate.\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tPromise.all(work).then(() => {\n\t\t\tthis.ui.updateVersionText(0);\n\t\t});\n\n\t\t// This hangs until the user makes a selection or closes the window.\n\t\tthis.shouldUseController =\n\t\t\t(await this.startSeqDeferred.promise) !== DebugReplayController.WindowClosedSeq;\n\n\t\tassert(\n\t\t\tthis.isSelectionMade() === this.shouldUseController,\n\t\t\t0x083 /* \"User selection status does not match replay controller use status!\" */,\n\t\t);\n\t\treturn this.shouldUseController;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tif (this.storage !== undefined) {\n\t\t\treturn this.storage.readBlob(blobId);\n\t\t}\n\t\tthrow new Error(\"Reading blob before storage is setup properly\");\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.storage !== undefined) {\n\t\t\treturn this.storage.getVersions(versionId, count);\n\t\t}\n\t\tthrow new Error(\"initStorage() was not called!\");\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (this.storage !== undefined) {\n\t\t\treturn this.storage.getSnapshotTree(versionRequested);\n\t\t}\n\t\tthrow new Error(\"Reading snapshot tree before storage is setup properly\");\n\t}\n\n\tpublic async getStartingOpSequence() {\n\t\treturn this.startSeqDeferred.promise;\n\t}\n\n\t/**\n\t * Return true if we are done processing ops\n\t */\n\tpublic isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean {\n\t\tif (lastTimeStamp === undefined) {\n\t\t\tthis.lastOpReached = true;\n\t\t\tif (currentOp === Number.MAX_SAFE_INTEGER) {\n\t\t\t\tthis.ui.updateLastOpText(-1, false);\n\t\t\t} else {\n\t\t\t\tthis.ui.updateLastOpText(currentOp, false);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.ui.updateLastOpText(currentOp, true);\n\t\t}\n\t\treturn this.lastOpReached && !this.retryFetchOpsOnEndOfFile;\n\t}\n\n\tpublic async replay(\n\t\temitter: (op: ISequencedDocumentMessage[]) => void,\n\t\tfetchedOps: ISequencedDocumentMessage[],\n\t): Promise<void> {\n\t\tlet _fetchedOps = fetchedOps;\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\tif (_fetchedOps.length === 0) {\n\t\t\t\tthis.ui.updateNextOpText([]);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this.stepsToPlay === 0) {\n\t\t\t\tthis.ui.disableNextOpButton(false);\n\t\t\t\tthis.stepsDeferred = new Deferred<number>();\n\n\t\t\t\tthis.ui.updateNextOpText(_fetchedOps);\n\n\t\t\t\tthis.stepsToPlay = await this.stepsDeferred.promise;\n\n\t\t\t\tthis.stepsDeferred = undefined;\n\t\t\t\tthis.ui.disableNextOpButton(true);\n\t\t\t}\n\n\t\t\tlet playOps: ISequencedDocumentMessage[];\n\t\t\tif (this.stepsToPlay >= _fetchedOps.length) {\n\t\t\t\tplayOps = _fetchedOps;\n\t\t\t\tthis.stepsToPlay -= _fetchedOps.length;\n\t\t\t\t_fetchedOps = [];\n\t\t\t} else {\n\t\t\t\tplayOps = _fetchedOps.splice(0, this.stepsToPlay);\n\t\t\t\tthis.stepsToPlay = 0;\n\t\t\t}\n\t\t\temitter(playOps);\n\t\t}\n\t}\n\n\tprotected resolveStorage(\n\t\tseq: number,\n\t\tstorage: ReadDocumentStorageServiceBase,\n\t\tversion: IVersion | string,\n\t) {\n\t\tassert(\n\t\t\t!this.isSelectionMade(),\n\t\t\t0x084 /* \"On storage resolve, user selection already made!\" */,\n\t\t);\n\t\tassert(!!storage, 0x085 /* \"On storage resolve, missing storage!\" */);\n\t\tthis.storage = storage;\n\t\tassert(\n\t\t\tthis.isSelectionMade(),\n\t\t\t0x086 /* \"After storage resolve, user selection status still false!\" */,\n\t\t);\n\n\t\tthis.ui.versionSelected(seq, version);\n\t\tthis.startSeqDeferred.resolve(seq);\n\t}\n}\n\nasync function* generateSequencedMessagesFromDeltaStorage(\n\tdeltaStorage: IDocumentDeltaStorageService,\n) {\n\tconst stream = deltaStorage.fetchMessages(1, undefined);\n\twhile (true) {\n\t\tconst result = await stream.read();\n\t\tif (result.done) {\n\t\t\treturn;\n\t\t}\n\t\tyield result.value;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"fluidDebuggerController.js","sourceRoot":"","sources":["../src/fluidDebuggerController.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAUvE,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EACN,kBAAkB,EAGlB,gBAAgB,EAChB,eAAe,GACf,MAAM,wCAAwC,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAQ3C;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,gBAAgB;IAA3D;;QAgCW,OAAE,GAAgB,IAA0B,CAAC,CAAC,gDAAgD;QAE9F,qBAAgB,GAAG,IAAI,QAAQ,EAAU,CAAC;QAEpD,kEAAkE;QACxD,6BAAwB,GAAG,KAAK,CAAC;QAIjC,aAAQ,GAAe,EAAE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MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO;QACR,CAAC;QACD,MAAM,MAAM,CAAC,KAAK,CAAC;IACpB,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentStorageService,\n\tIDocumentAttributes,\n\tISnapshotTree,\n\tIVersion,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tFileSnapshotReader,\n\tIFileSnapshot,\n\tReadDocumentStorageServiceBase,\n\tReplayController,\n\tSnapshotStorage,\n} from \"@fluidframework/replay-driver/internal\";\n\nimport { IDebuggerController, IDebuggerUI } from \"./fluidDebuggerUi.js\";\nimport { Sanitizer } from \"./sanitizer.js\";\n\n/**\n * @internal\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport type debuggerUIFactory = (controller: IDebuggerController) => IDebuggerUI | null;\n\n/**\n * Replay controller that uses pop-up window to control op playback\n * @internal\n */\nexport class DebugReplayController extends ReplayController implements IDebuggerController {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic static create(createUi: debuggerUIFactory): DebugReplayController | null {\n\t\tif (typeof localStorage === \"object\" && localStorage?.FluidDebugger) {\n\t\t\tconst controller = new DebugReplayController();\n\t\t\tconst ui = createUi(controller);\n\t\t\tif (ui) {\n\t\t\t\treturn controller;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected static readonly WindowClosedSeq = -1; // Seq# to indicate that user closed window\n\n\tprotected static async seqFromTree(\n\t\tdocumentStorageService: IDocumentStorageService,\n\t\ttree: ISnapshotTree | null,\n\t): Promise<number> {\n\t\tif (!tree) {\n\t\t\treturn 0;\n\t\t}\n\n\t\t// TODO Why are we non null asserting here\n\t\tconst attributesHash = tree.trees[\".protocol\"]!.blobs.attributes!;\n\t\tconst attrib = await readAndParse<IDocumentAttributes>(\n\t\t\tdocumentStorageService,\n\t\t\tattributesHash,\n\t\t);\n\t\treturn attrib.sequenceNumber;\n\t}\n\n\tprotected ui: IDebuggerUI = null as any as IDebuggerUI; // Not to check on every line that it's not null\n\tprotected stepsDeferred?: Deferred<number>;\n\tprotected startSeqDeferred = new Deferred<number>();\n\n\t// True will cause us ping server indefinitely waiting for new ops\n\tprotected retryFetchOpsOnEndOfFile = false;\n\n\tprotected documentService?: IDocumentService;\n\tprotected documentStorageService?: IDocumentStorageService;\n\tprotected versions: IVersion[] = [];\n\tprotected stepsToPlay: number = 0;\n\tprotected lastOpReached = false;\n\tprotected versionCount = 0;\n\n\tprotected storage?: ReadDocumentStorageServiceBase;\n\n\t// Member to prevent repeated initialization in initStorage(...), which also\n\t// returns if this controller should be used or function as a passthrough\n\tprivate shouldUseController: boolean | undefined;\n\n\tpublic connectToUi(ui: IDebuggerUI): void {\n\t\tthis.ui = ui;\n\t}\n\n\tpublic onClose() {\n\t\tthis.startSeqDeferred.resolve(DebugReplayController.WindowClosedSeq);\n\t}\n\n\tpublic async onVersionSelection(version: IVersion) {\n\t\tif (!this.documentStorageService) {\n\t\t\tthrow new Error(\"onVersionSelection: no storage\");\n\t\t}\n\n\t\tconst tree = await this.documentStorageService.getSnapshotTree(version);\n\t\tconst seq = await DebugReplayController.seqFromTree(this.documentStorageService, tree);\n\t\tthis.resolveStorage(seq, new SnapshotStorage(this.documentStorageService, tree), version);\n\t}\n\n\tpublic onOpButtonClick(steps: number) {\n\t\tif (this.stepsDeferred && !Number.isNaN(steps) && steps > 0) {\n\t\t\tthis.stepsDeferred.resolve(steps);\n\t\t}\n\t}\n\n\tpublic onSnapshotFileSelection(file: File) {\n\t\tif (!/^snapshot.*\\.json/.exec(file.name)) {\n\t\t\talert(`Incorrect file name: ${file.name}`);\n\t\t\treturn;\n\t\t}\n\t\tif (/.*_expanded.*/.exec(file.name)) {\n\t\t\talert(`Incorrect file name - please use non-extended files: ${file.name}`);\n\t\t\treturn;\n\t\t}\n\n\t\tconst reader = new FileReader();\n\t\treader.onload = async () => {\n\t\t\tif (this.documentStorageService) {\n\t\t\t\tconst text = reader.result as string;\n\t\t\t\ttry {\n\t\t\t\t\tconst json: IFileSnapshot = JSON.parse(text) as IFileSnapshot;\n\t\t\t\t\t/*\n Const docStorage = this.documentStorageService;\n const storage = {\n read: (blobId: string) => this.read(docStorage, blobId),\n };\n const seq = await DebugReplayController.seqFromTree(\n storage as IDocumentStorageService,\n tree);\n this.startSeqDeferred.resolve(seq);\n */\n\t\t\t\t\t// No ability to load ops, so just say - pick up from infinite op.\n\t\t\t\t\tthis.retryFetchOpsOnEndOfFile = false;\n\t\t\t\t\tthis.lastOpReached = true;\n\t\t\t\t\tthis.resolveStorage(\n\t\t\t\t\t\tNumber.MAX_SAFE_INTEGER,\n\t\t\t\t\t\tnew FileSnapshotReader(json),\n\t\t\t\t\t\tfile.name,\n\t\t\t\t\t);\n\t\t\t\t} catch (error) {\n\t\t\t\t\talert(`Error parsing file: ${error}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\treader.readAsText(file, \"utf-8\");\n\t}\n\n\tpublic async onDownloadOpsButtonClick(anonymize: boolean): Promise<string> {\n\t\tif (this.documentService === undefined) {\n\t\t\tthrow new Error(\"DocumentService required\");\n\t\t}\n\n\t\tconst documentDeltaStorageService = await this.documentService.connectToDeltaStorage();\n\t\tlet messages = await this.fetchOpsFromDeltaStorage(documentDeltaStorageService);\n\n\t\tif (anonymize) {\n\t\t\tconst sanitizer = new Sanitizer(messages, false /* fullScrub */, false /* noBail */);\n\t\t\tmessages = sanitizer.sanitize();\n\t\t}\n\n\t\treturn JSON.stringify(messages, undefined, 2);\n\t}\n\n\tprivate async fetchOpsFromDeltaStorage(\n\t\tdocumentDeltaStorageService,\n\t): Promise<ISequencedDocumentMessage[]> {\n\t\tconst deltaGenerator = generateSequencedMessagesFromDeltaStorage(\n\t\t\tdocumentDeltaStorageService,\n\t\t);\n\t\tlet messages: ISequencedDocumentMessage[] = [];\n\t\tfor await (const message of deltaGenerator) {\n\t\t\tmessages = messages.concat(message);\n\t\t}\n\t\treturn messages;\n\t}\n\n\tpublic fetchTo(currentOp: number): number | undefined {\n\t\treturn undefined;\n\t}\n\n\t// Returns true if version / file / ops selections is made.\n\tpublic isSelectionMade() {\n\t\treturn this.storage !== undefined;\n\t}\n\n\tpublic async downloadVersionInfo(\n\t\tdocumentStorageService: IDocumentStorageService,\n\t\tprevRequest: Promise<void>,\n\t\tindex: number,\n\t\tversion: IVersion,\n\t): Promise<void> {\n\t\tif (this.isSelectionMade()) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait prevRequest;\n\n\t\tconst treeV = await documentStorageService.getSnapshotTree(version);\n\t\tconst seqV = await DebugReplayController.seqFromTree(documentStorageService, treeV);\n\n\t\tif (!this.isSelectionMade()) {\n\t\t\tthis.versionCount--;\n\t\t\tthis.ui.updateVersionText(this.versionCount);\n\t\t\tthis.ui.updateVersion(index, version, seqV);\n\t\t}\n\t}\n\n\tpublic async initStorage(documentService: IDocumentService): Promise<boolean> {\n\t\tif (this.shouldUseController !== undefined) {\n\t\t\treturn this.shouldUseController;\n\t\t}\n\n\t\tassert(!!documentService, 0x080 /* \"Invalid document service!\" */);\n\t\tassert(!this.documentService, 0x081 /* \"Document service already set!\" */);\n\t\tassert(!this.documentStorageService, 0x082 /* \"Document storage service already set!\" */);\n\t\tthis.documentService = documentService;\n\t\tthis.documentStorageService = await documentService.connectToStorage();\n\n\t\t// User can chose \"file\" at any moment in time!\n\t\tif (!this.isSelectionMade()) {\n\t\t\tthis.versions = await this.documentStorageService.getVersions(\"\", 50);\n\t\t\tif (!this.isSelectionMade()) {\n\t\t\t\tthis.ui.addVersions(this.versions);\n\t\t\t\tthis.ui.updateVersionText(this.versionCount);\n\t\t\t}\n\t\t}\n\n\t\tthis.versionCount = this.versions.length;\n\n\t\t// Download all versions - do 10 downloads in parallel to avoid being throttled\n\t\tconst buckets = 10;\n\t\tconst work: Promise<void>[] = [];\n\t\tfor (let i = 0; i < buckets; i++) {\n\t\t\tlet prevRequest = Promise.resolve();\n\t\t\tfor (let index = i; index < this.versions.length; index += buckets) {\n\t\t\t\t// Non null asserting here because we are iterating though versions\n\t\t\t\tconst version = this.versions[index]!;\n\t\t\t\tprevRequest = this.downloadVersionInfo(\n\t\t\t\t\tthis.documentStorageService,\n\t\t\t\t\tprevRequest,\n\t\t\t\t\tindex,\n\t\t\t\t\tversion,\n\t\t\t\t);\n\t\t\t}\n\t\t\twork.push(prevRequest);\n\t\t}\n\n\t\t// Don't wait for stuff to populate.\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tPromise.all(work).then(() => {\n\t\t\tthis.ui.updateVersionText(0);\n\t\t});\n\n\t\t// This hangs until the user makes a selection or closes the window.\n\t\tthis.shouldUseController =\n\t\t\t(await this.startSeqDeferred.promise) !== DebugReplayController.WindowClosedSeq;\n\n\t\tassert(\n\t\t\tthis.isSelectionMade() === this.shouldUseController,\n\t\t\t0x083 /* \"User selection status does not match replay controller use status!\" */,\n\t\t);\n\t\treturn this.shouldUseController;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tif (this.storage !== undefined) {\n\t\t\treturn this.storage.readBlob(blobId);\n\t\t}\n\t\tthrow new Error(\"Reading blob before storage is setup properly\");\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (this.storage !== undefined) {\n\t\t\treturn this.storage.getVersions(versionId, count);\n\t\t}\n\t\tthrow new Error(\"initStorage() was not called!\");\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n\t\tif (this.storage !== undefined) {\n\t\t\treturn this.storage.getSnapshotTree(versionRequested);\n\t\t}\n\t\tthrow new Error(\"Reading snapshot tree before storage is setup properly\");\n\t}\n\n\tpublic async getStartingOpSequence() {\n\t\treturn this.startSeqDeferred.promise;\n\t}\n\n\t/**\n\t * Return true if we are done processing ops\n\t */\n\tpublic isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean {\n\t\tif (lastTimeStamp === undefined) {\n\t\t\tthis.lastOpReached = true;\n\t\t\tif (currentOp === Number.MAX_SAFE_INTEGER) {\n\t\t\t\tthis.ui.updateLastOpText(-1, false);\n\t\t\t} else {\n\t\t\t\tthis.ui.updateLastOpText(currentOp, false);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.ui.updateLastOpText(currentOp, true);\n\t\t}\n\t\treturn this.lastOpReached && !this.retryFetchOpsOnEndOfFile;\n\t}\n\n\tpublic async replay(\n\t\temitter: (op: ISequencedDocumentMessage[]) => void,\n\t\tfetchedOps: ISequencedDocumentMessage[],\n\t): Promise<void> {\n\t\tlet _fetchedOps = fetchedOps;\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\tif (_fetchedOps.length === 0) {\n\t\t\t\tthis.ui.updateNextOpText([]);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this.stepsToPlay === 0) {\n\t\t\t\tthis.ui.disableNextOpButton(false);\n\t\t\t\tthis.stepsDeferred = new Deferred<number>();\n\n\t\t\t\tthis.ui.updateNextOpText(_fetchedOps);\n\n\t\t\t\tthis.stepsToPlay = await this.stepsDeferred.promise;\n\n\t\t\t\tthis.stepsDeferred = undefined;\n\t\t\t\tthis.ui.disableNextOpButton(true);\n\t\t\t}\n\n\t\t\tlet playOps: ISequencedDocumentMessage[];\n\t\t\tif (this.stepsToPlay >= _fetchedOps.length) {\n\t\t\t\tplayOps = _fetchedOps;\n\t\t\t\tthis.stepsToPlay -= _fetchedOps.length;\n\t\t\t\t_fetchedOps = [];\n\t\t\t} else {\n\t\t\t\tplayOps = _fetchedOps.splice(0, this.stepsToPlay);\n\t\t\t\tthis.stepsToPlay = 0;\n\t\t\t}\n\t\t\temitter(playOps);\n\t\t}\n\t}\n\n\tprotected resolveStorage(\n\t\tseq: number,\n\t\tstorage: ReadDocumentStorageServiceBase,\n\t\tversion: IVersion | string,\n\t) {\n\t\tassert(\n\t\t\t!this.isSelectionMade(),\n\t\t\t0x084 /* \"On storage resolve, user selection already made!\" */,\n\t\t);\n\t\tassert(!!storage, 0x085 /* \"On storage resolve, missing storage!\" */);\n\t\tthis.storage = storage;\n\t\tassert(\n\t\t\tthis.isSelectionMade(),\n\t\t\t0x086 /* \"After storage resolve, user selection status still false!\" */,\n\t\t);\n\n\t\tthis.ui.versionSelected(seq, version);\n\t\tthis.startSeqDeferred.resolve(seq);\n\t}\n}\n\nasync function* generateSequencedMessagesFromDeltaStorage(\n\tdeltaStorage: IDocumentDeltaStorageService,\n) {\n\tconst stream = deltaStorage.fetchMessages(1, undefined);\n\twhile (true) {\n\t\tconst result = await stream.read();\n\t\tif (result.done) {\n\t\t\treturn;\n\t\t}\n\t\tyield result.value;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidDebuggerUi.d.ts","sourceRoot":"","sources":["../src/fluidDebuggerUi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,QAAQ,EACR,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAEvC;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzE;;;;;;;;OAQG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG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,MAAM;IAQjE,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,MAAM;IAkC7D,mBAAmB,CAAC,OAAO,EAAE,OAAO;IAKpC,gBAAgB,CAAC,GAAG,EAAE,yBAAyB,EAAE;IAgBjD,iBAAiB,CAAC,YAAY,EAAE,MAAM;IAQtC,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO;IAOlE,OAAO,CAAC,QAAQ;CAYhB"}
|
package/lib/fluidDebuggerUi.js
CHANGED
|
@@ -83,12 +83,14 @@ export class DebuggerUI {
|
|
|
83
83
|
const buttonVers = doc.getElementById("buttonVers");
|
|
84
84
|
buttonVers.onclick = () => {
|
|
85
85
|
const index = this.selector.selectedIndex;
|
|
86
|
+
// TODO Why are we non null asserting here
|
|
86
87
|
controller.onVersionSelection(this.versions[index]);
|
|
87
88
|
};
|
|
88
89
|
const fileSnapshot = doc.getElementById("file");
|
|
89
90
|
fileSnapshot.addEventListener("change", () => {
|
|
90
91
|
const files = fileSnapshot.files;
|
|
91
92
|
if (files) {
|
|
93
|
+
// TODO Why are we non null asserting here
|
|
92
94
|
controller.onSnapshotFileSelection(files[0]);
|
|
93
95
|
}
|
|
94
96
|
}, false);
|
|
@@ -168,6 +170,7 @@ export class DebuggerUI {
|
|
|
168
170
|
this.text3.textContent = "";
|
|
169
171
|
}
|
|
170
172
|
else {
|
|
173
|
+
// Non null asserting here because of the length check above
|
|
171
174
|
const op = ops[0];
|
|
172
175
|
const seq = op.sequenceNumber;
|
|
173
176
|
const date = DebuggerUI.formatDate(op.timestamp);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidDebuggerUi.js","sourceRoot":"","sources":["../src/fluidDebuggerUi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAuG7D,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;QAgBnB,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AE,CAAC,IAAI,EAAE,CAAC;YAC7C,IAAI,CAAC,KAAM,CAAC,WAAW,GAAG,GAAG,IAAI,EAAE,CAAC;QACrC,CAAC;IACF,CAAC;IAEM,iBAAiB,CAAC,YAAoB;QAC5C,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC9B,MAAM,IAAI,GACT,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,8BAA8B,YAAY,eAAe,CAAC;YACrF,IAAI,CAAC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;QACrC,CAAC;IACF,CAAC;IAEM,gBAAgB,CAAC,WAAmB,EAAE,YAAqB;QACjE,MAAM,IAAI,GAAG,YAAY;YACxB,CAAC,CAAC,4BAA4B,WAAW,EAAE;YAC3C,CAAC,CAAC,4BAA4B,WAAW,EAAE,CAAC;QAC7C,IAAI,CAAC,UAAW,CAAC,WAAW,GAAG,IAAI,CAAC;IACrC,CAAC;IAEO,QAAQ,CAAC,QAAgB,EAAE,IAAY;QAC9C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC5C,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,iCAAiC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1F,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAE3C,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QAC/B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAEnC,OAAO,CAAC,KAAK,EAAE,CAAC;QAEhB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,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/core-utils/internal\";\nimport {\n\tIVersion,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * @internal\n */\nexport interface IDebuggerUI {\n\t/**\n\t * Version information is provided.\n\t * Expect updates (information about seq#, timestamp) through updateVersion() calls\n\t */\n\taddVersions(version: IVersion[]): void;\n\n\t/**\n\t * Call when new version is downloaded from storage\n\t * Expect multiple callbacks.\n\t */\n\tupdateVersion(index: number, version: IVersion, seqNumber: number): void;\n\n\t/**\n\t * Called in response to successful onVersionSelection() or onSnapshotFileSelection() call\n\t * and provides extra information about selection.\n\t * It expected that UI layer would change its mode as result of this call, i.e. switch to\n\t * displaying op playback controls (if this is supported)\n\t * Note: There maybe no call to versionSelected() in response to onSnapshotFileSelection() call\n\t * if file does not exist, has wrong name of wrong format.\n\t * @param version - version, file name, or undefined if playing ops.\n\t */\n\tversionSelected(seqNumber: number, version: IVersion | string): void;\n\n\t/**\n\t * Called by controller in response to new ops being downloaded\n\t * Called with disable = true if there are no (currently) ops to play\n\t */\n\tdisableNextOpButton(disable: boolean): void;\n\n\t/**\n\t * Called by controller when new ops arrive (or we are done playing previous batch)\n\t * Indicates next batch of ops that would be played when UI calls controller's onOpButtonClick()\n\t * Called with ops=[] when there are no ops to play.\n\t */\n\tupdateNextOpText(ops: ISequencedDocumentMessage[]): void;\n\n\t/**\n\t * Called periodically when new versions are downloaded from server\n\t */\n\tupdateVersionText(versionsLeft: number): void;\n\n\t/**\n\t * Called periodically to notify about last known op\n\t * @param lastKnownOp - seq number of last known op. -1 if can't play ops in this mode (load from file)\n\t * @param stillLoading - true if we did not reach yet the end of the stream\n\t */\n\tupdateLastOpText(lastKnownOp: number, stillLoading: boolean): void;\n}\n\n/**\n * @internal\n */\nexport interface IDebuggerController {\n\t/**\n\t * Initialization. UI layers calls into controller to connect the two.\n\t * @param ui - UI layer\n\t */\n\tconnectToUi(ui: IDebuggerUI);\n\n\t/**\n\t * Called by UI layer when debugger window is closed by user\n\t * If called before user makes selection of snapshot/file, original\n\t * document service is returned to loader (instead of debugger service) and normal document load continues.\n\t */\n\tonClose(): void;\n\n\t/**\n\t * UI Layer notifies about selection of version to continue.\n\t * On successful load, versionSelected() is called.\n\t * @param version - Snapshot version to start from.\n\t */\n\tonVersionSelection(version: IVersion): void;\n\n\t/**\n\t * UI Layer notifies about selection of version to continue.\n\t * On successful load, versionSelected() is called.\n\t * @param version - File to load snapshot from\n\t */\n\tonSnapshotFileSelection(file: File): void;\n\n\t/**\n\t * \"next op\" button is clicked in the UI\n\t * @param steps - number of ops to play.\n\t */\n\tonOpButtonClick(steps: number): void;\n\n\t/**\n\t * \"Download ops\" option is clicked in the UI. Returns JSON of the full opStream when available.\n\t * @param anonymize - anonymize the ops json using the sanitization tool\n\t */\n\tonDownloadOpsButtonClick(anonymize: boolean): Promise<string>;\n}\n\nconst debuggerWindowHtml = `<Title>Fluid Debugger</Title>\n<body>\n<h3>Fluid Debugger</h3>\nPlease select snapshot or file to start with<br/>\nClose debugger window to proceed to live document<br/><br/>\n<select style='width:250px' id='selector'>\n</select>\n \n<button id='buttonVers' style='width:60px'>Go</button><br/>\n<input id='file' type='file' value='Load from file'/>\n<br/><br/>\n<h4>Download the current document's ops</h4>\n<input type='checkbox' id='anonymize' value='Anonymize'>\n<label for='anonymize'>Anonymize</label>\n<button type='button' id='downloadOps'>Download ops</button>\n<br/><br/><div id='versionText'></div>\n</body>`;\n\nconst debuggerWindowHtml2 = `<Title>Fluid Debugger</Title>\n<body>\n<h3>Fluid Debugger</h3>\n<div id='versionText'></div>\n<div id='lastOp'></div>\n<br/>\nStep to move: <input type='number' id='steps' value='1' min='1' style='width:50px'/>\n <button id='buttonOps' style='width:60px'>Go</button>\n<br/><br/>\n<div id='text1'></div><div id='text2'></div><div id='text3'></div>\n<br/>\n<h4>Download the current document's ops</h4>\n<input type='checkbox' id='anonymize' value='Anonymize'>\n<label for='anonymize'>Anonymize</label>\n<button type='button' id='downloadOps'>Download ops</button>\n</body>`;\n\n/**\n * @internal\n */\nexport class DebuggerUI {\n\tpublic static create(controller: IDebuggerController): DebuggerUI | null {\n\t\tif (\n\t\t\ttypeof window !== \"object\" ||\n\t\t\twindow === null ||\n\t\t\ttypeof window.document !== \"object\" ||\n\t\t\twindow.document == null\n\t\t) {\n\t\t\tconsole.log(\"Can't create debugger window - not running in browser!\");\n\t\t\treturn null;\n\t\t}\n\n\t\tconst debuggerWindow = window.open(\n\t\t\t\"\",\n\t\t\t\"\",\n\t\t\t\"width=400,height=400,resizable=yes,location=no,menubar=no,titlebar=no,status=no,toolbar=no\",\n\t\t);\n\t\tif (!debuggerWindow) {\n\t\t\tconsole.error(\n\t\t\t\t\"Can't create debugger window - please enable pop-up windows in your browser!\",\n\t\t\t);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn new DebuggerUI(controller, debuggerWindow);\n\t}\n\n\tprivate static formatDate(date: number) {\n\t\t// Alternative - without timezone\n\t\t// new Date().toLocaleString('default', { timeZone: 'UTC'}));\n\t\t// new Date().toLocaleString('default', { year: 'numeric', month: 'short',\n\t\t// day: 'numeric', hour: '2-digit', minute: 'numeric', second: 'numeric' }));\n\t\treturn new Date(date).toUTCString();\n\t}\n\n\tprotected selector?: HTMLSelectElement;\n\tprotected versionText: HTMLDivElement;\n\n\tprotected buttonOps?: HTMLButtonElement;\n\tprotected text1?: HTMLDivElement;\n\tprotected text2?: HTMLDivElement;\n\tprotected text3?: HTMLDivElement;\n\tprotected lastOpText?: HTMLDivElement;\n\tprotected wasVersionSelected = false;\n\tprotected versions: IVersion[] = [];\n\n\tprotected documentClosed = false;\n\n\tprotected constructor(\n\t\tprivate readonly controller: IDebuggerController,\n\t\tprivate readonly debuggerWindow: Window,\n\t) {\n\t\tconst doc = this.debuggerWindow.document;\n\t\tdoc.write(debuggerWindowHtml);\n\n\t\twindow.addEventListener(\n\t\t\t\"beforeunload\",\n\t\t\t(e) => {\n\t\t\t\tthis.documentClosed = true;\n\t\t\t\tthis.debuggerWindow.close();\n\t\t\t},\n\t\t\tfalse,\n\t\t);\n\n\t\tthis.debuggerWindow.addEventListener(\n\t\t\t\"beforeunload\",\n\t\t\t(e) => {\n\t\t\t\tif (!this.documentClosed) {\n\t\t\t\t\tthis.controller.onClose();\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t);\n\n\t\tthis.selector = doc.getElementById(\"selector\") as HTMLSelectElement;\n\n\t\tconst buttonVers = doc.getElementById(\"buttonVers\") as HTMLDivElement;\n\t\tbuttonVers.onclick = () => {\n\t\t\tconst index = this.selector!.selectedIndex;\n\t\t\tcontroller.onVersionSelection(this.versions[index]);\n\t\t};\n\n\t\tconst fileSnapshot = doc.getElementById(\"file\") as HTMLInputElement;\n\t\tfileSnapshot.addEventListener(\n\t\t\t\"change\",\n\t\t\t() => {\n\t\t\t\tconst files = fileSnapshot.files;\n\t\t\t\tif (files) {\n\t\t\t\t\tcontroller.onSnapshotFileSelection(files[0]);\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t);\n\n\t\tconst opDownloadButton = doc.getElementById(\"downloadOps\") as HTMLElement;\n\t\tconst anonymizeCheckbox = doc.getElementById(\"anonymize\") as HTMLInputElement;\n\t\tthis.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);\n\n\t\tthis.versionText = doc.getElementById(\"versionText\") as HTMLDivElement;\n\t\tthis.versionText.textContent = \"Fetching snapshots, please wait...\";\n\n\t\tcontroller.connectToUi(this);\n\t}\n\n\tprivate attachDownloadOpsListener(element: HTMLElement, anonymize: HTMLInputElement) {\n\t\telement.addEventListener(\"click\", () => {\n\t\t\tthis.controller\n\t\t\t\t.onDownloadOpsButtonClick(anonymize.checked)\n\t\t\t\t.then((opJson) => {\n\t\t\t\t\tthis.download(\"opStream.json\", opJson);\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tconsole.log(`Error downloading ops: ${error}`);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tpublic addVersions(versions: IVersion[]) {\n\t\tif (this.selector) {\n\t\t\tthis.versions = versions;\n\t\t\tfor (const version of versions) {\n\t\t\t\tconst option = document.createElement(\"option\");\n\t\t\t\toption.text =\n\t\t\t\t\tversion.date !== undefined\n\t\t\t\t\t\t? `id = ${version.id}, time = ${version.date}`\n\t\t\t\t\t\t: `id = ${version.id}`;\n\t\t\t\tthis.selector.add(option);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic updateVersion(index: number, version: IVersion, seqNumber: number) {\n\t\tif (this.selector) {\n\t\t\tconst option = this.selector[index] as HTMLOptionElement;\n\t\t\toption.text = `${option.text}, seq = ${seqNumber}`;\n\t\t\tthis.selector[index] = option;\n\t\t}\n\t}\n\n\tpublic versionSelected(seqNumber: number, version: IVersion | string) {\n\t\tconst text =\n\t\t\ttypeof version === \"string\"\n\t\t\t\t? `Playing ${version} file`\n\t\t\t\t: `Playing from ${version.id}, seq# ${seqNumber}`;\n\n\t\tthis.wasVersionSelected = true;\n\t\tthis.selector = undefined;\n\n\t\tconst doc = this.debuggerWindow.document;\n\t\tdoc.open();\n\t\tdoc.write(debuggerWindowHtml2);\n\t\tdoc.close();\n\n\t\tthis.lastOpText = doc.getElementById(\"lastOp\") as HTMLDivElement;\n\t\tthis.text1 = doc.getElementById(\"text1\") as HTMLDivElement;\n\t\tthis.text2 = doc.getElementById(\"text2\") as HTMLDivElement;\n\t\tthis.text3 = doc.getElementById(\"text3\") as HTMLDivElement;\n\n\t\tconst steps = doc.getElementById(\"steps\") as HTMLInputElement;\n\t\tthis.buttonOps = doc.getElementById(\"buttonOps\") as HTMLButtonElement;\n\t\tthis.buttonOps.disabled = true;\n\t\tthis.buttonOps.onclick = () => {\n\t\t\tthis.controller.onOpButtonClick(Number(steps.value));\n\t\t};\n\n\t\tthis.versionText = doc.getElementById(\"versionText\") as HTMLDivElement;\n\t\tthis.versionText.textContent = text;\n\n\t\tconst opDownloadButton = doc.getElementById(\"downloadOps\") as HTMLElement;\n\t\tconst anonymizeCheckbox = doc.getElementById(\"anonymize\") as HTMLInputElement;\n\t\tthis.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);\n\t}\n\n\tpublic disableNextOpButton(disable: boolean) {\n\t\tassert(!!this.buttonOps, 0x088 /* \"Missing button ops button!\" */);\n\t\tthis.buttonOps.disabled = disable;\n\t}\n\n\tpublic updateNextOpText(ops: ISequencedDocumentMessage[]) {\n\t\tif (ops.length === 0) {\n\t\t\tthis.text1!.textContent = \"\";\n\t\t\tthis.text2!.textContent = \"\";\n\t\t\tthis.text3!.textContent = \"\";\n\t\t} else {\n\t\t\tconst op = ops[0];\n\t\t\tconst seq = op.sequenceNumber;\n\t\t\tconst date = DebuggerUI.formatDate(op.timestamp);\n\t\t\tthis.text1!.textContent = `Next op seq#: ${seq}`;\n\t\t\tthis.text2!.textContent = `Type: ${op.type}`;\n\t\t\tthis.text3!.textContent = `${date}`;\n\t\t}\n\t}\n\n\tpublic updateVersionText(versionCount: number) {\n\t\tif (!this.wasVersionSelected) {\n\t\t\tconst text =\n\t\t\t\tversionCount === 0 ? \"\" : `Fetching information about ${versionCount} snapshots...`;\n\t\t\tthis.versionText.textContent = text;\n\t\t}\n\t}\n\n\tpublic updateLastOpText(lastKnownOp: number, stillLoading: boolean) {\n\t\tconst text = stillLoading\n\t\t\t? `Last op (still loading): ${lastKnownOp}`\n\t\t\t: `Document's last op seq#: ${lastKnownOp}`;\n\t\tthis.lastOpText!.textContent = text;\n\t}\n\n\tprivate download(filename: string, data: string): void {\n\t\tconst element = document.createElement(\"a\");\n\t\telement.setAttribute(\"href\", `data:text/plain;charset=utf-8,${encodeURIComponent(data)}`);\n\t\telement.setAttribute(\"download\", filename);\n\n\t\telement.style.display = \"none\";\n\t\tdocument.body.appendChild(element);\n\n\t\telement.click();\n\n\t\tdocument.body.removeChild(element);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"fluidDebuggerUi.js","sourceRoot":"","sources":["../src/fluidDebuggerUi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,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ent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIVersion,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * @internal\n */\nexport interface IDebuggerUI {\n\t/**\n\t * Version information is provided.\n\t * Expect updates (information about seq#, timestamp) through updateVersion() calls\n\t */\n\taddVersions(version: IVersion[]): void;\n\n\t/**\n\t * Call when new version is downloaded from storage\n\t * Expect multiple callbacks.\n\t */\n\tupdateVersion(index: number, version: IVersion, seqNumber: number): void;\n\n\t/**\n\t * Called in response to successful onVersionSelection() or onSnapshotFileSelection() call\n\t * and provides extra information about selection.\n\t * It expected that UI layer would change its mode as result of this call, i.e. switch to\n\t * displaying op playback controls (if this is supported)\n\t * Note: There maybe no call to versionSelected() in response to onSnapshotFileSelection() call\n\t * if file does not exist, has wrong name of wrong format.\n\t * @param version - version, file name, or undefined if playing ops.\n\t */\n\tversionSelected(seqNumber: number, version: IVersion | string): void;\n\n\t/**\n\t * Called by controller in response to new ops being downloaded\n\t * Called with disable = true if there are no (currently) ops to play\n\t */\n\tdisableNextOpButton(disable: boolean): void;\n\n\t/**\n\t * Called by controller when new ops arrive (or we are done playing previous batch)\n\t * Indicates next batch of ops that would be played when UI calls controller's onOpButtonClick()\n\t * Called with ops=[] when there are no ops to play.\n\t */\n\tupdateNextOpText(ops: ISequencedDocumentMessage[]): void;\n\n\t/**\n\t * Called periodically when new versions are downloaded from server\n\t */\n\tupdateVersionText(versionsLeft: number): void;\n\n\t/**\n\t * Called periodically to notify about last known op\n\t * @param lastKnownOp - seq number of last known op. -1 if can't play ops in this mode (load from file)\n\t * @param stillLoading - true if we did not reach yet the end of the stream\n\t */\n\tupdateLastOpText(lastKnownOp: number, stillLoading: boolean): void;\n}\n\n/**\n * @internal\n */\nexport interface IDebuggerController {\n\t/**\n\t * Initialization. UI layers calls into controller to connect the two.\n\t * @param ui - UI layer\n\t */\n\tconnectToUi(ui: IDebuggerUI);\n\n\t/**\n\t * Called by UI layer when debugger window is closed by user\n\t * If called before user makes selection of snapshot/file, original\n\t * document service is returned to loader (instead of debugger service) and normal document load continues.\n\t */\n\tonClose(): void;\n\n\t/**\n\t * UI Layer notifies about selection of version to continue.\n\t * On successful load, versionSelected() is called.\n\t * @param version - Snapshot version to start from.\n\t */\n\tonVersionSelection(version: IVersion): void;\n\n\t/**\n\t * UI Layer notifies about selection of version to continue.\n\t * On successful load, versionSelected() is called.\n\t * @param version - File to load snapshot from\n\t */\n\tonSnapshotFileSelection(file: File): void;\n\n\t/**\n\t * \"next op\" button is clicked in the UI\n\t * @param steps - number of ops to play.\n\t */\n\tonOpButtonClick(steps: number): void;\n\n\t/**\n\t * \"Download ops\" option is clicked in the UI. Returns JSON of the full opStream when available.\n\t * @param anonymize - anonymize the ops json using the sanitization tool\n\t */\n\tonDownloadOpsButtonClick(anonymize: boolean): Promise<string>;\n}\n\nconst debuggerWindowHtml = `<Title>Fluid Debugger</Title>\n<body>\n<h3>Fluid Debugger</h3>\nPlease select snapshot or file to start with<br/>\nClose debugger window to proceed to live document<br/><br/>\n<select style='width:250px' id='selector'>\n</select>\n \n<button id='buttonVers' style='width:60px'>Go</button><br/>\n<input id='file' type='file' value='Load from file'/>\n<br/><br/>\n<h4>Download the current document's ops</h4>\n<input type='checkbox' id='anonymize' value='Anonymize'>\n<label for='anonymize'>Anonymize</label>\n<button type='button' id='downloadOps'>Download ops</button>\n<br/><br/><div id='versionText'></div>\n</body>`;\n\nconst debuggerWindowHtml2 = `<Title>Fluid Debugger</Title>\n<body>\n<h3>Fluid Debugger</h3>\n<div id='versionText'></div>\n<div id='lastOp'></div>\n<br/>\nStep to move: <input type='number' id='steps' value='1' min='1' style='width:50px'/>\n <button id='buttonOps' style='width:60px'>Go</button>\n<br/><br/>\n<div id='text1'></div><div id='text2'></div><div id='text3'></div>\n<br/>\n<h4>Download the current document's ops</h4>\n<input type='checkbox' id='anonymize' value='Anonymize'>\n<label for='anonymize'>Anonymize</label>\n<button type='button' id='downloadOps'>Download ops</button>\n</body>`;\n\n/**\n * @internal\n */\nexport class DebuggerUI {\n\tpublic static create(controller: IDebuggerController): DebuggerUI | null {\n\t\tif (\n\t\t\ttypeof window !== \"object\" ||\n\t\t\twindow === null ||\n\t\t\ttypeof window.document !== \"object\" ||\n\t\t\twindow.document == null\n\t\t) {\n\t\t\tconsole.log(\"Can't create debugger window - not running in browser!\");\n\t\t\treturn null;\n\t\t}\n\n\t\tconst debuggerWindow = window.open(\n\t\t\t\"\",\n\t\t\t\"\",\n\t\t\t\"width=400,height=400,resizable=yes,location=no,menubar=no,titlebar=no,status=no,toolbar=no\",\n\t\t);\n\t\tif (!debuggerWindow) {\n\t\t\tconsole.error(\n\t\t\t\t\"Can't create debugger window - please enable pop-up windows in your browser!\",\n\t\t\t);\n\t\t\treturn null;\n\t\t}\n\n\t\treturn new DebuggerUI(controller, debuggerWindow);\n\t}\n\n\tprivate static formatDate(date: number) {\n\t\t// Alternative - without timezone\n\t\t// new Date().toLocaleString('default', { timeZone: 'UTC'}));\n\t\t// new Date().toLocaleString('default', { year: 'numeric', month: 'short',\n\t\t// day: 'numeric', hour: '2-digit', minute: 'numeric', second: 'numeric' }));\n\t\treturn new Date(date).toUTCString();\n\t}\n\n\tprotected selector?: HTMLSelectElement;\n\tprotected versionText: HTMLDivElement;\n\n\tprotected buttonOps?: HTMLButtonElement;\n\tprotected text1?: HTMLDivElement;\n\tprotected text2?: HTMLDivElement;\n\tprotected text3?: HTMLDivElement;\n\tprotected lastOpText?: HTMLDivElement;\n\tprotected wasVersionSelected = false;\n\tprotected versions: IVersion[] = [];\n\n\tprotected documentClosed = false;\n\n\tprotected constructor(\n\t\tprivate readonly controller: IDebuggerController,\n\t\tprivate readonly debuggerWindow: Window,\n\t) {\n\t\tconst doc = this.debuggerWindow.document;\n\t\tdoc.write(debuggerWindowHtml);\n\n\t\twindow.addEventListener(\n\t\t\t\"beforeunload\",\n\t\t\t(e) => {\n\t\t\t\tthis.documentClosed = true;\n\t\t\t\tthis.debuggerWindow.close();\n\t\t\t},\n\t\t\tfalse,\n\t\t);\n\n\t\tthis.debuggerWindow.addEventListener(\n\t\t\t\"beforeunload\",\n\t\t\t(e) => {\n\t\t\t\tif (!this.documentClosed) {\n\t\t\t\t\tthis.controller.onClose();\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t);\n\n\t\tthis.selector = doc.getElementById(\"selector\") as HTMLSelectElement;\n\n\t\tconst buttonVers = doc.getElementById(\"buttonVers\") as HTMLDivElement;\n\t\tbuttonVers.onclick = () => {\n\t\t\tconst index = this.selector!.selectedIndex;\n\t\t\t// TODO Why are we non null asserting here\n\t\t\tcontroller.onVersionSelection(this.versions[index]!);\n\t\t};\n\n\t\tconst fileSnapshot = doc.getElementById(\"file\") as HTMLInputElement;\n\t\tfileSnapshot.addEventListener(\n\t\t\t\"change\",\n\t\t\t() => {\n\t\t\t\tconst files = fileSnapshot.files;\n\t\t\t\tif (files) {\n\t\t\t\t\t// TODO Why are we non null asserting here\n\t\t\t\t\tcontroller.onSnapshotFileSelection(files[0]!);\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t);\n\n\t\tconst opDownloadButton = doc.getElementById(\"downloadOps\") as HTMLElement;\n\t\tconst anonymizeCheckbox = doc.getElementById(\"anonymize\") as HTMLInputElement;\n\t\tthis.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);\n\n\t\tthis.versionText = doc.getElementById(\"versionText\") as HTMLDivElement;\n\t\tthis.versionText.textContent = \"Fetching snapshots, please wait...\";\n\n\t\tcontroller.connectToUi(this);\n\t}\n\n\tprivate attachDownloadOpsListener(element: HTMLElement, anonymize: HTMLInputElement) {\n\t\telement.addEventListener(\"click\", () => {\n\t\t\tthis.controller\n\t\t\t\t.onDownloadOpsButtonClick(anonymize.checked)\n\t\t\t\t.then((opJson) => {\n\t\t\t\t\tthis.download(\"opStream.json\", opJson);\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tconsole.log(`Error downloading ops: ${error}`);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tpublic addVersions(versions: IVersion[]) {\n\t\tif (this.selector) {\n\t\t\tthis.versions = versions;\n\t\t\tfor (const version of versions) {\n\t\t\t\tconst option = document.createElement(\"option\");\n\t\t\t\toption.text =\n\t\t\t\t\tversion.date !== undefined\n\t\t\t\t\t\t? `id = ${version.id}, time = ${version.date}`\n\t\t\t\t\t\t: `id = ${version.id}`;\n\t\t\t\tthis.selector.add(option);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic updateVersion(index: number, version: IVersion, seqNumber: number) {\n\t\tif (this.selector) {\n\t\t\tconst option = this.selector[index] as HTMLOptionElement;\n\t\t\toption.text = `${option.text}, seq = ${seqNumber}`;\n\t\t\tthis.selector[index] = option;\n\t\t}\n\t}\n\n\tpublic versionSelected(seqNumber: number, version: IVersion | string) {\n\t\tconst text =\n\t\t\ttypeof version === \"string\"\n\t\t\t\t? `Playing ${version} file`\n\t\t\t\t: `Playing from ${version.id}, seq# ${seqNumber}`;\n\n\t\tthis.wasVersionSelected = true;\n\t\tthis.selector = undefined;\n\n\t\tconst doc = this.debuggerWindow.document;\n\t\tdoc.open();\n\t\tdoc.write(debuggerWindowHtml2);\n\t\tdoc.close();\n\n\t\tthis.lastOpText = doc.getElementById(\"lastOp\") as HTMLDivElement;\n\t\tthis.text1 = doc.getElementById(\"text1\") as HTMLDivElement;\n\t\tthis.text2 = doc.getElementById(\"text2\") as HTMLDivElement;\n\t\tthis.text3 = doc.getElementById(\"text3\") as HTMLDivElement;\n\n\t\tconst steps = doc.getElementById(\"steps\") as HTMLInputElement;\n\t\tthis.buttonOps = doc.getElementById(\"buttonOps\") as HTMLButtonElement;\n\t\tthis.buttonOps.disabled = true;\n\t\tthis.buttonOps.onclick = () => {\n\t\t\tthis.controller.onOpButtonClick(Number(steps.value));\n\t\t};\n\n\t\tthis.versionText = doc.getElementById(\"versionText\") as HTMLDivElement;\n\t\tthis.versionText.textContent = text;\n\n\t\tconst opDownloadButton = doc.getElementById(\"downloadOps\") as HTMLElement;\n\t\tconst anonymizeCheckbox = doc.getElementById(\"anonymize\") as HTMLInputElement;\n\t\tthis.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);\n\t}\n\n\tpublic disableNextOpButton(disable: boolean) {\n\t\tassert(!!this.buttonOps, 0x088 /* \"Missing button ops button!\" */);\n\t\tthis.buttonOps.disabled = disable;\n\t}\n\n\tpublic updateNextOpText(ops: ISequencedDocumentMessage[]) {\n\t\tif (ops.length === 0) {\n\t\t\tthis.text1!.textContent = \"\";\n\t\t\tthis.text2!.textContent = \"\";\n\t\t\tthis.text3!.textContent = \"\";\n\t\t} else {\n\t\t\t// Non null asserting here because of the length check above\n\t\t\tconst op = ops[0]!;\n\t\t\tconst seq = op.sequenceNumber;\n\t\t\tconst date = DebuggerUI.formatDate(op.timestamp);\n\t\t\tthis.text1!.textContent = `Next op seq#: ${seq}`;\n\t\t\tthis.text2!.textContent = `Type: ${op.type}`;\n\t\t\tthis.text3!.textContent = `${date}`;\n\t\t}\n\t}\n\n\tpublic updateVersionText(versionCount: number) {\n\t\tif (!this.wasVersionSelected) {\n\t\t\tconst text =\n\t\t\t\tversionCount === 0 ? \"\" : `Fetching information about ${versionCount} snapshots...`;\n\t\t\tthis.versionText.textContent = text;\n\t\t}\n\t}\n\n\tpublic updateLastOpText(lastKnownOp: number, stillLoading: boolean) {\n\t\tconst text = stillLoading\n\t\t\t? `Last op (still loading): ${lastKnownOp}`\n\t\t\t: `Document's last op seq#: ${lastKnownOp}`;\n\t\tthis.lastOpText!.textContent = text;\n\t}\n\n\tprivate download(filename: string, data: string): void {\n\t\tconst element = document.createElement(\"a\");\n\t\telement.setAttribute(\"href\", `data:text/plain;charset=utf-8,${encodeURIComponent(data)}`);\n\t\telement.setAttribute(\"download\", filename);\n\n\t\telement.style.display = \"none\";\n\t\tdocument.body.appendChild(element);\n\n\t\telement.click();\n\n\t\tdocument.body.removeChild(element);\n\t}\n}\n"]}
|
package/lib/legacy.d.ts
CHANGED
package/lib/public.d.ts
CHANGED
package/lib/sanitize.js
CHANGED
|
@@ -39,13 +39,16 @@ function Sanitize(msgPath, fullScrub, noBail) {
|
|
|
39
39
|
}
|
|
40
40
|
function main() {
|
|
41
41
|
if (process.argv.length === 3) {
|
|
42
|
+
// Non null asserting here because of the length check above
|
|
42
43
|
return Sanitize(process.argv[2], false, false);
|
|
43
44
|
}
|
|
44
45
|
if (process.argv.length === 4) {
|
|
46
|
+
// Non null asserting here because of the length check above
|
|
45
47
|
if (process.argv[2] === "--full") {
|
|
46
48
|
return Sanitize(process.argv[3], true, false);
|
|
47
49
|
}
|
|
48
50
|
if (process.argv[2] === "--noBail") {
|
|
51
|
+
// Non null asserting here because of the length check above
|
|
49
52
|
return Sanitize(process.argv[3], false, true);
|
|
50
53
|
}
|
|
51
54
|
}
|
package/lib/sanitize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,OAAO,MAAM,cAAc,CAAC;AAInC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,SAAS,UAAU;IAClB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtB,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC;IACnF,OAAO,CAAC,GAAG,CACV,iGAAiG,CACjG,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,4EAA4E,CAAC,CAAC;IAC1F,OAAO,CAAC,GAAG,CAAC,q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AK,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE,CAAC;YACpC,4DAA4D;YAC5D,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC;IACF,CAAC;IACD,UAAU,EAAE,CAAC;AACd,CAAC;AAED,IAAI,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This tool cleans up a message.json file downloaded through fluid-fetch to remove\n * user content and user identifying information. Enough information can be retained\n * to allow loading through Fluid Preview, or everything can be scrubbed so that only\n * replay-tool can read the result. Anonymous identifying information such as client\n * IDs are always retained. Object keys are NOT scrubbed, including those that are\n * nested within values (only leaf values are scrubbed).\n *\n * Note: While user content/information is scrubbed, it should not be assumed to be\n * fully anonymized because certain meta-information (such as word lengths and\n * consistent replacement) are preserved.\n *\n * Messages must match known structures when scrubbing for Fluid Preview.\n */\n\nimport fs from \"node:fs\";\nimport process from \"node:process\";\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport { Sanitizer } from \"./sanitizer.js\";\n\nfunction printUsage() {\n\tconsole.log(\"Usage:\");\n\tconsole.log(\" node sanitize [--full | --noBail] <input>\");\n\tconsole.log(\"Where\");\n\tconsole.log(\" [--full] - scrub fully (result cannot be loaded in Fluid Preview)\");\n\tconsole.log(\n\t\t\" [--noBail] - don't bail out when encountering an unknown message format (it won't be scrubbed\",\n\t);\n\tconsole.log(\" <input> - file path to message.json - file downloaded by FluidFetch tool\");\n\tconsole.log(\"Note: <input> is sanitized in place\");\n\tprocess.exit(-1);\n}\n\nfunction Sanitize(msgPath: string, fullScrub: boolean, noBail: boolean) {\n\tconst input = fs.readFileSync(msgPath, { encoding: \"utf-8\" });\n\tconst messages = JSON.parse(input) as ISequencedDocumentMessage[];\n\n\tconst sanitizer = new Sanitizer(messages, fullScrub, noBail, true);\n\tconst cleanMessages = sanitizer.sanitize();\n\n\tfs.writeFileSync(msgPath, JSON.stringify(cleanMessages, undefined, 2));\n\n\tconsole.log(\"Done.\");\n}\n\nfunction main() {\n\tif (process.argv.length === 3) {\n\t\t// Non null asserting here because of the length check above\n\t\treturn Sanitize(process.argv[2]!, false, false);\n\t}\n\tif (process.argv.length === 4) {\n\t\t// Non null asserting here because of the length check above\n\t\tif (process.argv[2] === \"--full\") {\n\t\t\treturn Sanitize(process.argv[3]!, true, false);\n\t\t}\n\t\tif (process.argv[2] === \"--noBail\") {\n\t\t\t// Non null asserting here because of the length check above\n\t\t\treturn Sanitize(process.argv[3]!, false, true);\n\t\t}\n\t}\n\tprintUsage();\n}\n\nmain();\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/debugger",
|
|
3
|
-
"version": "2.1.0-
|
|
3
|
+
"version": "2.1.0-281041",
|
|
4
4
|
"description": "Fluid Debugger - a tool to play through history of a file",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -47,19 +47,19 @@
|
|
|
47
47
|
"main": "lib/index.js",
|
|
48
48
|
"types": "lib/public.d.ts",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@fluidframework/core-utils": "2.1.0-
|
|
51
|
-
"@fluidframework/driver-definitions": "2.1.0-
|
|
52
|
-
"@fluidframework/driver-utils": "2.1.0-
|
|
53
|
-
"@fluidframework/replay-driver": "2.1.0-
|
|
50
|
+
"@fluidframework/core-utils": "2.1.0-281041",
|
|
51
|
+
"@fluidframework/driver-definitions": "2.1.0-281041",
|
|
52
|
+
"@fluidframework/driver-utils": "2.1.0-281041",
|
|
53
|
+
"@fluidframework/replay-driver": "2.1.0-281041",
|
|
54
54
|
"jsonschema": "^1.2.6"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
58
|
-
"@biomejs/biome": "
|
|
59
|
-
"@fluid-tools/build-cli": "^0.
|
|
58
|
+
"@biomejs/biome": "~1.8.3",
|
|
59
|
+
"@fluid-tools/build-cli": "^0.40.0",
|
|
60
60
|
"@fluidframework/build-common": "^2.0.3",
|
|
61
|
-
"@fluidframework/build-tools": "^0.
|
|
62
|
-
"@fluidframework/debugger-previous": "npm:@fluidframework/debugger@2.0.0
|
|
61
|
+
"@fluidframework/build-tools": "^0.40.0",
|
|
62
|
+
"@fluidframework/debugger-previous": "npm:@fluidframework/debugger@2.0.0",
|
|
63
63
|
"@fluidframework/eslint-config-fluid": "^5.3.0",
|
|
64
64
|
"@microsoft/api-extractor": "^7.45.1",
|
|
65
65
|
"@types/node": "^18.19.0",
|
|
@@ -85,13 +85,14 @@
|
|
|
85
85
|
"api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
|
|
86
86
|
"api-extractor:esnext": "flub generate entrypoints --outDir ./lib --node10TypeCompat",
|
|
87
87
|
"build": "fluid-build . --task build",
|
|
88
|
+
"build:api-reports": "concurrently \"npm:build:api-reports:*\"",
|
|
89
|
+
"build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor.current.json",
|
|
90
|
+
"build:api-reports:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
|
|
88
91
|
"build:compile": "fluid-build . --task compile",
|
|
89
|
-
"build:docs": "
|
|
90
|
-
"build:docs:current": "api-extractor run --local",
|
|
91
|
-
"build:docs:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
|
|
92
|
+
"build:docs": "api-extractor run --local",
|
|
92
93
|
"build:esnext": "tsc --project ./tsconfig.json",
|
|
93
94
|
"check:are-the-types-wrong": "attw --pack .",
|
|
94
|
-
"check:biome": "biome check .
|
|
95
|
+
"check:biome": "biome check .",
|
|
95
96
|
"check:exports": "concurrently \"npm:check:exports:*\"",
|
|
96
97
|
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
|
|
97
98
|
"check:exports:cjs:legacy": "api-extractor run --config api-extractor/api-extractor-lint-legacy.cjs.json",
|
|
@@ -100,14 +101,15 @@
|
|
|
100
101
|
"check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
|
|
101
102
|
"check:format": "npm run check:biome",
|
|
102
103
|
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
103
|
-
"ci:build:
|
|
104
|
-
"ci:build:
|
|
105
|
-
"ci:build:
|
|
104
|
+
"ci:build:api-reports": "concurrently \"npm:ci:build:api-reports:*\"",
|
|
105
|
+
"ci:build:api-reports:current": "api-extractor run --config api-extractor/api-extractor.current.json",
|
|
106
|
+
"ci:build:api-reports:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
|
|
107
|
+
"ci:build:docs": "api-extractor run",
|
|
106
108
|
"clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
|
|
107
109
|
"eslint": "eslint --format stylish src",
|
|
108
110
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
109
111
|
"format": "npm run format:biome",
|
|
110
|
-
"format:biome": "biome check . --
|
|
112
|
+
"format:biome": "biome check . --write",
|
|
111
113
|
"format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
112
114
|
"lint": "fluid-build . --task lint",
|
|
113
115
|
"lint:fix": "fluid-build . --task eslint:fix --task format",
|
|
@@ -58,7 +58,8 @@ export class DebugReplayController extends ReplayController implements IDebugger
|
|
|
58
58
|
return 0;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
// TODO Why are we non null asserting here
|
|
62
|
+
const attributesHash = tree.trees[".protocol"]!.blobs.attributes!;
|
|
62
63
|
const attrib = await readAndParse<IDocumentAttributes>(
|
|
63
64
|
documentStorageService,
|
|
64
65
|
attributesHash,
|
|
@@ -241,7 +242,8 @@ export class DebugReplayController extends ReplayController implements IDebugger
|
|
|
241
242
|
for (let i = 0; i < buckets; i++) {
|
|
242
243
|
let prevRequest = Promise.resolve();
|
|
243
244
|
for (let index = i; index < this.versions.length; index += buckets) {
|
|
244
|
-
|
|
245
|
+
// Non null asserting here because we are iterating though versions
|
|
246
|
+
const version = this.versions[index]!;
|
|
245
247
|
prevRequest = this.downloadVersionInfo(
|
|
246
248
|
this.documentStorageService,
|
|
247
249
|
prevRequest,
|
package/src/fluidDebuggerUi.ts
CHANGED
|
@@ -223,7 +223,8 @@ export class DebuggerUI {
|
|
|
223
223
|
const buttonVers = doc.getElementById("buttonVers") as HTMLDivElement;
|
|
224
224
|
buttonVers.onclick = () => {
|
|
225
225
|
const index = this.selector!.selectedIndex;
|
|
226
|
-
|
|
226
|
+
// TODO Why are we non null asserting here
|
|
227
|
+
controller.onVersionSelection(this.versions[index]!);
|
|
227
228
|
};
|
|
228
229
|
|
|
229
230
|
const fileSnapshot = doc.getElementById("file") as HTMLInputElement;
|
|
@@ -232,7 +233,8 @@ export class DebuggerUI {
|
|
|
232
233
|
() => {
|
|
233
234
|
const files = fileSnapshot.files;
|
|
234
235
|
if (files) {
|
|
235
|
-
|
|
236
|
+
// TODO Why are we non null asserting here
|
|
237
|
+
controller.onSnapshotFileSelection(files[0]!);
|
|
236
238
|
}
|
|
237
239
|
},
|
|
238
240
|
false,
|
|
@@ -328,7 +330,8 @@ export class DebuggerUI {
|
|
|
328
330
|
this.text2!.textContent = "";
|
|
329
331
|
this.text3!.textContent = "";
|
|
330
332
|
} else {
|
|
331
|
-
|
|
333
|
+
// Non null asserting here because of the length check above
|
|
334
|
+
const op = ops[0]!;
|
|
332
335
|
const seq = op.sequenceNumber;
|
|
333
336
|
const date = DebuggerUI.formatDate(op.timestamp);
|
|
334
337
|
this.text1!.textContent = `Next op seq#: ${seq}`;
|
package/src/sanitize.ts
CHANGED
|
@@ -52,14 +52,17 @@ function Sanitize(msgPath: string, fullScrub: boolean, noBail: boolean) {
|
|
|
52
52
|
|
|
53
53
|
function main() {
|
|
54
54
|
if (process.argv.length === 3) {
|
|
55
|
-
|
|
55
|
+
// Non null asserting here because of the length check above
|
|
56
|
+
return Sanitize(process.argv[2]!, false, false);
|
|
56
57
|
}
|
|
57
58
|
if (process.argv.length === 4) {
|
|
59
|
+
// Non null asserting here because of the length check above
|
|
58
60
|
if (process.argv[2] === "--full") {
|
|
59
|
-
return Sanitize(process.argv[3]
|
|
61
|
+
return Sanitize(process.argv[3]!, true, false);
|
|
60
62
|
}
|
|
61
63
|
if (process.argv[2] === "--noBail") {
|
|
62
|
-
|
|
64
|
+
// Non null asserting here because of the length check above
|
|
65
|
+
return Sanitize(process.argv[3]!, false, true);
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
printUsage();
|