@fluidframework/debugger 0.59.2001 → 0.59.3000-66610
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +0 -1
- package/dist/fluidDebuggerController.d.ts.map +1 -1
- package/dist/fluidDebuggerController.js +8 -8
- package/dist/fluidDebuggerController.js.map +1 -1
- package/dist/fluidDebuggerUi.js +1 -1
- package/dist/fluidDebuggerUi.js.map +1 -1
- package/dist/messageSchema.js +5 -3
- package/dist/messageSchema.js.map +1 -1
- package/dist/sanitizer.js +5 -5
- package/dist/sanitizer.js.map +1 -1
- package/lib/fluidDebuggerController.d.ts.map +1 -1
- package/lib/fluidDebuggerController.js.map +1 -1
- package/lib/fluidDebuggerUi.js.map +1 -1
- package/lib/messageSchema.js +5 -3
- package/lib/messageSchema.js.map +1 -1
- package/lib/sanitizer.js.map +1 -1
- package/package.json +8 -7
- package/src/fluidDebuggerController.ts +2 -2
- package/src/fluidDebuggerUi.ts +1 -1
- package/src/messageSchema.ts +52 -52
package/.eslintrc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidDebuggerController.d.ts","sourceRoot":"","sources":["../src/fluidDebuggerController.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"fluidDebuggerController.d.ts","sourceRoot":"","sources":["../src/fluidDebuggerController.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAU,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EACH,gBAAgB,EAChB,uBAAuB,EAE1B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAEH,yBAAyB,EACzB,aAAa,EACb,QAAQ,EACX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAGH,8BAA8B,EAC9B,gBAAgB,EAEnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,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,MAAM,GAAG,SAAS;IAK9C,eAAe;IAIT,mBAAmB,CAC5B,sBAAsB,EAAE,uBAAuB,EAC/C,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,EAC1B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBxB,WAAW,CAAC,eAAe,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAgDhE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAOlD,WAAW,CACpB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAO1B,eAAe,CAAC,gBAAgB,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAO3E,qBAAqB;IAIlC;;OAEG;IACI,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO;IAczD,MAAM,CACf,OAAO,EAAE,CAAC,EAAE,EAAE,yBAAyB,EAAE,KAAK,IAAI,EAClD,UAAU,EAAE,yBAAyB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC3D,SAAS,CAAC,cAAc,CACpB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,8BAA8B,EACvC,OAAO,EAAE,QAAQ,GAAG,MAAM;CASjC"}
|
|
@@ -58,7 +58,7 @@ class DebugReplayController extends replay_driver_1.ReplayController {
|
|
|
58
58
|
return 0;
|
|
59
59
|
}
|
|
60
60
|
const attributesHash = tree.trees[".protocol"].blobs.attributes;
|
|
61
|
-
const attrib = await driver_utils_1.readAndParse(documentStorageService, attributesHash);
|
|
61
|
+
const attrib = await (0, driver_utils_1.readAndParse)(documentStorageService, attributesHash);
|
|
62
62
|
return attrib.sequenceNumber;
|
|
63
63
|
}
|
|
64
64
|
connectToUi(ui) {
|
|
@@ -173,9 +173,9 @@ class DebugReplayController extends replay_driver_1.ReplayController {
|
|
|
173
173
|
if (this.shouldUseController !== undefined) {
|
|
174
174
|
return this.shouldUseController;
|
|
175
175
|
}
|
|
176
|
-
common_utils_1.assert(!!documentService, 0x080 /* "Invalid document service!" */);
|
|
177
|
-
common_utils_1.assert(!this.documentService, 0x081 /* "Document service already set!" */);
|
|
178
|
-
common_utils_1.assert(!this.documentStorageService, 0x082 /* "Document storage service already set!" */);
|
|
176
|
+
(0, common_utils_1.assert)(!!documentService, 0x080 /* "Invalid document service!" */);
|
|
177
|
+
(0, common_utils_1.assert)(!this.documentService, 0x081 /* "Document service already set!" */);
|
|
178
|
+
(0, common_utils_1.assert)(!this.documentStorageService, 0x082 /* "Document storage service already set!" */);
|
|
179
179
|
this.documentService = documentService;
|
|
180
180
|
this.documentStorageService = await documentService.connectToStorage();
|
|
181
181
|
// User can chose "file" at any moment in time!
|
|
@@ -205,7 +205,7 @@ class DebugReplayController extends replay_driver_1.ReplayController {
|
|
|
205
205
|
});
|
|
206
206
|
// This hangs until the user makes a selection or closes the window.
|
|
207
207
|
this.shouldUseController = await this.startSeqDeferred.promise !== DebugReplayController.WindowClosedSeq;
|
|
208
|
-
common_utils_1.assert(this.isSelectionMade() === this.shouldUseController, 0x083 /* "User selection status does not match replay controller use status!" */);
|
|
208
|
+
(0, common_utils_1.assert)(this.isSelectionMade() === this.shouldUseController, 0x083 /* "User selection status does not match replay controller use status!" */);
|
|
209
209
|
return this.shouldUseController;
|
|
210
210
|
}
|
|
211
211
|
async readBlob(blobId) {
|
|
@@ -277,10 +277,10 @@ class DebugReplayController extends replay_driver_1.ReplayController {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
resolveStorage(seq, storage, version) {
|
|
280
|
-
common_utils_1.assert(!this.isSelectionMade(), 0x084 /* "On storage resolve, user selection already made!" */);
|
|
281
|
-
common_utils_1.assert(!!storage, 0x085 /* "On storage resolve, missing storage!" */);
|
|
280
|
+
(0, common_utils_1.assert)(!this.isSelectionMade(), 0x084 /* "On storage resolve, user selection already made!" */);
|
|
281
|
+
(0, common_utils_1.assert)(!!storage, 0x085 /* "On storage resolve, missing storage!" */);
|
|
282
282
|
this.storage = storage;
|
|
283
|
-
common_utils_1.assert(this.isSelectionMade(), 0x086 /* "After storage resolve, user selection status still false!" */);
|
|
283
|
+
(0, common_utils_1.assert)(this.isSelectionMade(), 0x086 /* "After storage resolve, user selection status still false!" */);
|
|
284
284
|
this.ui.versionSelected(seq, version);
|
|
285
285
|
this.startSeqDeferred.resolve(seq);
|
|
286
286
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidDebuggerController.js","sourceRoot":"","sources":["../src/fluidDebuggerController.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,+DAAiE;AAMjE,+DAA4D;AAO5D,iEAMuC;AAEvC,2CAAwC;AAIxC;;GAEG;AACH,MAAa,qBAAsB,SAAQ,gCAAgB;IAA3D;;QA2Bc,OAAE,GAAgB,IAA0B,CAAC,CAAC,gDAAgD;QAE9F,qBAAgB,GAAG,IAAI,uBAAQ,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;IAgR/B,CAAC;IAtTU,MAAM,CAAC,MAAM,CAChB,QAA2B;QACnB,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,KAAK,IAAI,IAAI,YAAY,CAAC,aAAa,EAAE;YACjG,MAAM,UAAU,GAAG,IAAI,qBAAqB,EAAE,CAAC;YAC/C,MAAM,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;YAChC,IAAI,EAAE,EAAE;gBACJ,OAAO,UAAU,CAAC;aACrB;SACJ;QACD,OAAO,IAAI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AiE,CAAC,CAAC;QAExG,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;;AAtTL,sDAuTC;AA1S6B,qCAAe,GAAG,CAAC,CAAC,CAAC,CAAC,2CAA2C;AA4S/F,SAAgB,yCAAyC,CAAC,YAA0C;;QAChG,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QACxD,OAAO,IAAI,EAAE;YACT,MAAM,MAAM,GAAG,cAAM,MAAM,CAAC,IAAI,EAAE,CAAA,CAAC;YACnC,IAAI,MAAM,CAAC,IAAI,EAAE;gBACb,6BAAO;aACV;YACD,oBAAM,MAAM,CAAC,KAAK,CAAA,CAAC;SACtB;IACL,CAAC;CAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert , Deferred } from \"@fluidframework/common-utils\";\nimport {\n IDocumentService,\n IDocumentStorageService,\n IDocumentDeltaStorageService,\n} from \"@fluidframework/driver-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n IDocumentAttributes,\n ISequencedDocumentMessage,\n ISnapshotTree,\n IVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n FileSnapshotReader,\n IFileSnapshot,\n ReadDocumentStorageServiceBase,\n ReplayController,\n SnapshotStorage,\n} from \"@fluidframework/replay-driver\";\nimport { IDebuggerController, IDebuggerUI } from \"./fluidDebuggerUi\";\nimport { Sanitizer } from \"./sanitizer\";\n\nexport type debuggerUIFactory = (controller: IDebuggerController) => IDebuggerUI | null;\n\n/**\n * Replay controller that uses pop-up window to control op playback\n */\nexport class DebugReplayController extends ReplayController implements IDebuggerController {\n public static create(\n createUi: debuggerUIFactory): DebugReplayController | null {\n if (typeof localStorage === \"object\" && localStorage !== null && localStorage.FluidDebugger) {\n const controller = new DebugReplayController();\n const ui = createUi(controller);\n if (ui) {\n return controller;\n }\n }\n return null;\n }\n\n protected static readonly WindowClosedSeq = -1; // Seq# to indicate that user closed window\n\n protected static async seqFromTree(\n documentStorageService: IDocumentStorageService,\n tree: ISnapshotTree | null): Promise<number> {\n if (!tree) {\n return 0;\n }\n\n const attributesHash = tree.trees[\".protocol\"].blobs.attributes;\n const attrib = await readAndParse<IDocumentAttributes>(documentStorageService, attributesHash);\n return attrib.sequenceNumber;\n }\n\n protected ui: IDebuggerUI = null as any as IDebuggerUI; // Not to check on every line that it's not null\n protected stepsDeferred?: Deferred<number>;\n protected startSeqDeferred = new Deferred<number>();\n\n // True will cause us ping server indefinitely waiting for new ops\n protected retryFetchOpsOnEndOfFile = false;\n\n protected documentService?: IDocumentService;\n protected documentStorageService?: IDocumentStorageService;\n protected versions: IVersion[] = [];\n protected stepsToPlay: number = 0;\n protected lastOpReached = false;\n protected versionCount = 0;\n\n protected storage?: ReadDocumentStorageServiceBase;\n\n // Member to prevent repeated initialization in initStorage(...), which also\n // returns if this controller should be used or function as a passthrough\n private shouldUseController: boolean | undefined;\n\n public connectToUi(ui: IDebuggerUI): void {\n this.ui = ui;\n }\n\n public onClose() {\n this.startSeqDeferred.resolve(DebugReplayController.WindowClosedSeq);\n }\n\n public async onVersionSelection(version: IVersion) {\n if (!this.documentStorageService) {\n throw new Error(\"onVersionSelection: no storage\");\n }\n\n const tree = await this.documentStorageService.getSnapshotTree(version);\n const seq = await DebugReplayController.seqFromTree(this.documentStorageService, tree);\n this.resolveStorage(\n seq,\n new SnapshotStorage(this.documentStorageService, tree),\n version);\n }\n\n public onOpButtonClick(steps: number) {\n if (this.stepsDeferred && !Number.isNaN(steps) && steps > 0) {\n this.stepsDeferred.resolve(steps);\n }\n }\n\n public onSnapshotFileSelection(file: File) {\n if (!/^snapshot.*\\.json/.exec(file.name)) {\n alert(`Incorrect file name: ${file.name}`);\n return;\n }\n if (/.*_expanded.*/.exec(file.name)) {\n alert(`Incorrect file name - please use non-extended files: ${file.name}`);\n return;\n }\n\n const reader = new FileReader();\n reader.onload = async () => {\n if (this.documentStorageService) {\n const text = reader.result as string;\n try {\n const json: IFileSnapshot = JSON.parse(text) as IFileSnapshot;\n /*\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 // No ability to load ops, so just say - pick up from infinite op.\n this.retryFetchOpsOnEndOfFile = false;\n this.lastOpReached = true;\n this.resolveStorage(\n Number.MAX_SAFE_INTEGER,\n new FileSnapshotReader(json),\n file.name);\n } catch (error) {\n alert(`Error parsing file: ${error}`);\n return;\n }\n }\n };\n reader.readAsText(file, \"utf-8\");\n }\n\n public async onDownloadOpsButtonClick(anonymize: boolean): Promise<string> {\n if (this.documentService === undefined) {\n throw new Error(\"DocumentService required\");\n }\n\n const documentDeltaStorageService = await this.documentService.connectToDeltaStorage();\n let messages = await this.fetchOpsFromDeltaStorage(documentDeltaStorageService);\n\n if(anonymize) {\n const sanitizer = new Sanitizer(messages, false /* fullScrub */, false /* noBail */);\n messages = sanitizer.sanitize();\n }\n\n return JSON.stringify(messages, undefined, 2);\n }\n\n private async fetchOpsFromDeltaStorage(documentDeltaStorageService): Promise<ISequencedDocumentMessage[]> {\n const deltaGenerator = generateSequencedMessagesFromDeltaStorage(documentDeltaStorageService);\n let messages: ISequencedDocumentMessage[] = [];\n for await (const message of deltaGenerator) {\n messages = messages.concat(message);\n }\n return messages;\n }\n\n public fetchTo(currentOp: number): number | undefined {\n return undefined;\n }\n\n // Returns true if version / file / ops selections is made.\n public isSelectionMade() {\n return this.storage !== undefined;\n }\n\n public async downloadVersionInfo(\n documentStorageService: IDocumentStorageService,\n prevRequest: Promise<void>,\n index: number,\n version: IVersion): Promise<void> {\n if (this.isSelectionMade()) {\n return;\n }\n\n await prevRequest;\n\n const treeV = await documentStorageService.getSnapshotTree(version);\n const seqV = await DebugReplayController.seqFromTree(documentStorageService, treeV);\n\n if (!this.isSelectionMade()) {\n this.versionCount--;\n this.ui.updateVersionText(this.versionCount);\n this.ui.updateVersion(index, version, seqV);\n }\n }\n\n public async initStorage(documentService: IDocumentService): Promise<boolean> {\n if (this.shouldUseController !== undefined) {\n return this.shouldUseController;\n }\n\n assert(!!documentService, 0x080 /* \"Invalid document service!\" */);\n assert(!this.documentService, 0x081 /* \"Document service already set!\" */);\n assert(!this.documentStorageService, 0x082 /* \"Document storage service already set!\" */);\n this.documentService = documentService;\n this.documentStorageService = await documentService.connectToStorage();\n\n // User can chose \"file\" at any moment in time!\n if (!this.isSelectionMade()) {\n this.versions = await this.documentStorageService.getVersions(\"\", 50);\n if (!this.isSelectionMade()) {\n this.ui.addVersions(this.versions);\n this.ui.updateVersionText(this.versionCount);\n }\n }\n\n this.versionCount = this.versions.length;\n\n // Download all versions - do 10 downloads in parallel to avoid being throttled\n const buckets = 10;\n const work: Promise<void>[] = [];\n for (let i = 0; i < buckets; i++) {\n let prevRequest = Promise.resolve();\n for (let index = i; index < this.versions.length; index += buckets) {\n const version = this.versions[index];\n prevRequest = this.downloadVersionInfo(this.documentStorageService, prevRequest, index, version);\n }\n work.push(prevRequest);\n }\n\n // Don't wait for stuff to populate.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Promise.all(work).then(() => {\n this.ui.updateVersionText(0);\n });\n\n // This hangs until the user makes a selection or closes the window.\n this.shouldUseController = await this.startSeqDeferred.promise !== DebugReplayController.WindowClosedSeq;\n\n assert(this.isSelectionMade() === this.shouldUseController,\n 0x083 /* \"User selection status does not match replay controller use status!\" */);\n return this.shouldUseController;\n }\n\n public async readBlob(blobId: string): Promise<ArrayBufferLike> {\n if (this.storage !== undefined) {\n return this.storage.readBlob(blobId);\n }\n throw new Error(\"Reading blob before storage is setup properly\");\n }\n\n public async getVersions(\n versionId: string | null,\n count: number): Promise<IVersion[]> {\n if (this.storage !== undefined) {\n return this.storage.getVersions(versionId, count);\n }\n throw new Error(\"initStorage() was not called!\");\n }\n\n public async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n if (this.storage !== undefined) {\n return this.storage.getSnapshotTree(versionRequested);\n }\n throw new Error(\"Reading snapshot tree before storage is setup properly\");\n }\n\n public async getStartingOpSequence() {\n return this.startSeqDeferred.promise;\n }\n\n /**\n * Return true if we are done processing ops\n */\n public isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean {\n if (lastTimeStamp === undefined) {\n this.lastOpReached = true;\n if (currentOp === Number.MAX_SAFE_INTEGER) {\n this.ui.updateLastOpText(-1, false);\n } else {\n this.ui.updateLastOpText(currentOp, false);\n }\n } else {\n this.ui.updateLastOpText(currentOp, true);\n }\n return this.lastOpReached && !this.retryFetchOpsOnEndOfFile;\n }\n\n public async replay(\n emitter: (op: ISequencedDocumentMessage[]) => void,\n fetchedOps: ISequencedDocumentMessage[]): Promise<void> {\n let _fetchedOps = fetchedOps;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n if (_fetchedOps.length === 0) {\n this.ui.updateNextOpText([]);\n return;\n }\n\n if (this.stepsToPlay === 0) {\n this.ui.disableNextOpButton(false);\n this.stepsDeferred = new Deferred<number>();\n\n this.ui.updateNextOpText(_fetchedOps);\n\n this.stepsToPlay = await this.stepsDeferred.promise;\n\n this.stepsDeferred = undefined;\n this.ui.disableNextOpButton(true);\n }\n\n let playOps: ISequencedDocumentMessage[];\n if (this.stepsToPlay >= _fetchedOps.length) {\n playOps = _fetchedOps;\n this.stepsToPlay -= _fetchedOps.length;\n _fetchedOps = [];\n } else {\n playOps = _fetchedOps.splice(0, this.stepsToPlay);\n this.stepsToPlay = 0;\n }\n emitter(playOps);\n }\n }\n\n protected resolveStorage(\n seq: number,\n storage: ReadDocumentStorageServiceBase,\n version: IVersion | string) {\n assert(!this.isSelectionMade(), 0x084 /* \"On storage resolve, user selection already made!\" */);\n assert(!!storage, 0x085 /* \"On storage resolve, missing storage!\" */);\n this.storage = storage;\n assert(this.isSelectionMade(), 0x086 /* \"After storage resolve, user selection status still false!\" */);\n\n this.ui.versionSelected(seq, version);\n this.startSeqDeferred.resolve(seq);\n }\n}\n\nasync function* generateSequencedMessagesFromDeltaStorage(deltaStorage: IDocumentDeltaStorageService) {\n const stream = deltaStorage.fetchMessages(1, undefined);\n while (true) {\n const result = await stream.read();\n if (result.done) {\n return;\n }\n yield result.value;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"fluidDebuggerController.js","sourceRoot":"","sources":["../src/fluidDebuggerController.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,+DAAgE;AAMhE,+DAA4D;AAO5D,iEAMuC;AAEvC,2CAAwC;AAIxC;;GAEG;AACH,MAAa,qBAAsB,SAAQ,gCAAgB;IAA3D;;QA2Bc,OAAE,GAAgB,IAA0B,CAAC,CAAC,gDAAgD;QAE9F,qBAAgB,GAAG,IAAI,uBAAQ,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;IAgR/B,CAAC;IAtTU,MAAM,CAAC,MAAM,CAChB,QAA2B;QACnB,IAAI,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,KAAK,IAAI,IAAI,YAAY,CAAC,aAAa,EAAE;YACjG,MAAM,UAAU,GAAG,IAAI,qBAAqB,EAAE,CAAC;YAC/C,MAAM,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;YAChC,IAAI,EAAE,EAAE;gBACJ,OAAO,UAAU,CAAC;aACrB;SACJ;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAIS,MAAM,CAAC,KAAK,CAAC,WAAW,CAC9B,sBAA+C,EAC/C,IAA0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EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;;AAtTL,sDAuTC;AA1S6B,qCAAe,GAAG,CAAC,CAAC,CAAC,CAAC,2CAA2C;AA4S/F,SAAgB,yCAAyC,CAAC,YAA0C;;QAChG,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QACxD,OAAO,IAAI,EAAE;YACT,MAAM,MAAM,GAAG,cAAM,MAAM,CAAC,IAAI,EAAE,CAAA,CAAC;YACnC,IAAI,MAAM,CAAC,IAAI,EAAE;gBACb,6BAAO;aACV;YACD,oBAAM,MAAM,CAAC,KAAK,CAAA,CAAC;SACtB;IACL,CAAC;CAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Deferred } from \"@fluidframework/common-utils\";\nimport {\n IDocumentService,\n IDocumentStorageService,\n IDocumentDeltaStorageService,\n} from \"@fluidframework/driver-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n IDocumentAttributes,\n ISequencedDocumentMessage,\n ISnapshotTree,\n IVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n FileSnapshotReader,\n IFileSnapshot,\n ReadDocumentStorageServiceBase,\n ReplayController,\n SnapshotStorage,\n} from \"@fluidframework/replay-driver\";\nimport { IDebuggerController, IDebuggerUI } from \"./fluidDebuggerUi\";\nimport { Sanitizer } from \"./sanitizer\";\n\nexport type debuggerUIFactory = (controller: IDebuggerController) => IDebuggerUI | null;\n\n/**\n * Replay controller that uses pop-up window to control op playback\n */\nexport class DebugReplayController extends ReplayController implements IDebuggerController {\n public static create(\n createUi: debuggerUIFactory): DebugReplayController | null {\n if (typeof localStorage === \"object\" && localStorage !== null && localStorage.FluidDebugger) {\n const controller = new DebugReplayController();\n const ui = createUi(controller);\n if (ui) {\n return controller;\n }\n }\n return null;\n }\n\n protected static readonly WindowClosedSeq = -1; // Seq# to indicate that user closed window\n\n protected static async seqFromTree(\n documentStorageService: IDocumentStorageService,\n tree: ISnapshotTree | null): Promise<number> {\n if (!tree) {\n return 0;\n }\n\n const attributesHash = tree.trees[\".protocol\"].blobs.attributes;\n const attrib = await readAndParse<IDocumentAttributes>(documentStorageService, attributesHash);\n return attrib.sequenceNumber;\n }\n\n protected ui: IDebuggerUI = null as any as IDebuggerUI; // Not to check on every line that it's not null\n protected stepsDeferred?: Deferred<number>;\n protected startSeqDeferred = new Deferred<number>();\n\n // True will cause us ping server indefinitely waiting for new ops\n protected retryFetchOpsOnEndOfFile = false;\n\n protected documentService?: IDocumentService;\n protected documentStorageService?: IDocumentStorageService;\n protected versions: IVersion[] = [];\n protected stepsToPlay: number = 0;\n protected lastOpReached = false;\n protected versionCount = 0;\n\n protected storage?: ReadDocumentStorageServiceBase;\n\n // Member to prevent repeated initialization in initStorage(...), which also\n // returns if this controller should be used or function as a passthrough\n private shouldUseController: boolean | undefined;\n\n public connectToUi(ui: IDebuggerUI): void {\n this.ui = ui;\n }\n\n public onClose() {\n this.startSeqDeferred.resolve(DebugReplayController.WindowClosedSeq);\n }\n\n public async onVersionSelection(version: IVersion) {\n if (!this.documentStorageService) {\n throw new Error(\"onVersionSelection: no storage\");\n }\n\n const tree = await this.documentStorageService.getSnapshotTree(version);\n const seq = await DebugReplayController.seqFromTree(this.documentStorageService, tree);\n this.resolveStorage(\n seq,\n new SnapshotStorage(this.documentStorageService, tree),\n version);\n }\n\n public onOpButtonClick(steps: number) {\n if (this.stepsDeferred && !Number.isNaN(steps) && steps > 0) {\n this.stepsDeferred.resolve(steps);\n }\n }\n\n public onSnapshotFileSelection(file: File) {\n if (!/^snapshot.*\\.json/.exec(file.name)) {\n alert(`Incorrect file name: ${file.name}`);\n return;\n }\n if (/.*_expanded.*/.exec(file.name)) {\n alert(`Incorrect file name - please use non-extended files: ${file.name}`);\n return;\n }\n\n const reader = new FileReader();\n reader.onload = async () => {\n if (this.documentStorageService) {\n const text = reader.result as string;\n try {\n const json: IFileSnapshot = JSON.parse(text) as IFileSnapshot;\n /*\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 // No ability to load ops, so just say - pick up from infinite op.\n this.retryFetchOpsOnEndOfFile = false;\n this.lastOpReached = true;\n this.resolveStorage(\n Number.MAX_SAFE_INTEGER,\n new FileSnapshotReader(json),\n file.name);\n } catch (error) {\n alert(`Error parsing file: ${error}`);\n return;\n }\n }\n };\n reader.readAsText(file, \"utf-8\");\n }\n\n public async onDownloadOpsButtonClick(anonymize: boolean): Promise<string> {\n if (this.documentService === undefined) {\n throw new Error(\"DocumentService required\");\n }\n\n const documentDeltaStorageService = await this.documentService.connectToDeltaStorage();\n let messages = await this.fetchOpsFromDeltaStorage(documentDeltaStorageService);\n\n if (anonymize) {\n const sanitizer = new Sanitizer(messages, false /* fullScrub */, false /* noBail */);\n messages = sanitizer.sanitize();\n }\n\n return JSON.stringify(messages, undefined, 2);\n }\n\n private async fetchOpsFromDeltaStorage(documentDeltaStorageService): Promise<ISequencedDocumentMessage[]> {\n const deltaGenerator = generateSequencedMessagesFromDeltaStorage(documentDeltaStorageService);\n let messages: ISequencedDocumentMessage[] = [];\n for await (const message of deltaGenerator) {\n messages = messages.concat(message);\n }\n return messages;\n }\n\n public fetchTo(currentOp: number): number | undefined {\n return undefined;\n }\n\n // Returns true if version / file / ops selections is made.\n public isSelectionMade() {\n return this.storage !== undefined;\n }\n\n public async downloadVersionInfo(\n documentStorageService: IDocumentStorageService,\n prevRequest: Promise<void>,\n index: number,\n version: IVersion): Promise<void> {\n if (this.isSelectionMade()) {\n return;\n }\n\n await prevRequest;\n\n const treeV = await documentStorageService.getSnapshotTree(version);\n const seqV = await DebugReplayController.seqFromTree(documentStorageService, treeV);\n\n if (!this.isSelectionMade()) {\n this.versionCount--;\n this.ui.updateVersionText(this.versionCount);\n this.ui.updateVersion(index, version, seqV);\n }\n }\n\n public async initStorage(documentService: IDocumentService): Promise<boolean> {\n if (this.shouldUseController !== undefined) {\n return this.shouldUseController;\n }\n\n assert(!!documentService, 0x080 /* \"Invalid document service!\" */);\n assert(!this.documentService, 0x081 /* \"Document service already set!\" */);\n assert(!this.documentStorageService, 0x082 /* \"Document storage service already set!\" */);\n this.documentService = documentService;\n this.documentStorageService = await documentService.connectToStorage();\n\n // User can chose \"file\" at any moment in time!\n if (!this.isSelectionMade()) {\n this.versions = await this.documentStorageService.getVersions(\"\", 50);\n if (!this.isSelectionMade()) {\n this.ui.addVersions(this.versions);\n this.ui.updateVersionText(this.versionCount);\n }\n }\n\n this.versionCount = this.versions.length;\n\n // Download all versions - do 10 downloads in parallel to avoid being throttled\n const buckets = 10;\n const work: Promise<void>[] = [];\n for (let i = 0; i < buckets; i++) {\n let prevRequest = Promise.resolve();\n for (let index = i; index < this.versions.length; index += buckets) {\n const version = this.versions[index];\n prevRequest = this.downloadVersionInfo(this.documentStorageService, prevRequest, index, version);\n }\n work.push(prevRequest);\n }\n\n // Don't wait for stuff to populate.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Promise.all(work).then(() => {\n this.ui.updateVersionText(0);\n });\n\n // This hangs until the user makes a selection or closes the window.\n this.shouldUseController = await this.startSeqDeferred.promise !== DebugReplayController.WindowClosedSeq;\n\n assert(this.isSelectionMade() === this.shouldUseController,\n 0x083 /* \"User selection status does not match replay controller use status!\" */);\n return this.shouldUseController;\n }\n\n public async readBlob(blobId: string): Promise<ArrayBufferLike> {\n if (this.storage !== undefined) {\n return this.storage.readBlob(blobId);\n }\n throw new Error(\"Reading blob before storage is setup properly\");\n }\n\n public async getVersions(\n versionId: string | null,\n count: number): Promise<IVersion[]> {\n if (this.storage !== undefined) {\n return this.storage.getVersions(versionId, count);\n }\n throw new Error(\"initStorage() was not called!\");\n }\n\n public async getSnapshotTree(versionRequested?: IVersion): Promise<ISnapshotTree | null> {\n if (this.storage !== undefined) {\n return this.storage.getSnapshotTree(versionRequested);\n }\n throw new Error(\"Reading snapshot tree before storage is setup properly\");\n }\n\n public async getStartingOpSequence() {\n return this.startSeqDeferred.promise;\n }\n\n /**\n * Return true if we are done processing ops\n */\n public isDoneFetch(currentOp: number, lastTimeStamp?: number): boolean {\n if (lastTimeStamp === undefined) {\n this.lastOpReached = true;\n if (currentOp === Number.MAX_SAFE_INTEGER) {\n this.ui.updateLastOpText(-1, false);\n } else {\n this.ui.updateLastOpText(currentOp, false);\n }\n } else {\n this.ui.updateLastOpText(currentOp, true);\n }\n return this.lastOpReached && !this.retryFetchOpsOnEndOfFile;\n }\n\n public async replay(\n emitter: (op: ISequencedDocumentMessage[]) => void,\n fetchedOps: ISequencedDocumentMessage[]): Promise<void> {\n let _fetchedOps = fetchedOps;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n if (_fetchedOps.length === 0) {\n this.ui.updateNextOpText([]);\n return;\n }\n\n if (this.stepsToPlay === 0) {\n this.ui.disableNextOpButton(false);\n this.stepsDeferred = new Deferred<number>();\n\n this.ui.updateNextOpText(_fetchedOps);\n\n this.stepsToPlay = await this.stepsDeferred.promise;\n\n this.stepsDeferred = undefined;\n this.ui.disableNextOpButton(true);\n }\n\n let playOps: ISequencedDocumentMessage[];\n if (this.stepsToPlay >= _fetchedOps.length) {\n playOps = _fetchedOps;\n this.stepsToPlay -= _fetchedOps.length;\n _fetchedOps = [];\n } else {\n playOps = _fetchedOps.splice(0, this.stepsToPlay);\n this.stepsToPlay = 0;\n }\n emitter(playOps);\n }\n }\n\n protected resolveStorage(\n seq: number,\n storage: ReadDocumentStorageServiceBase,\n version: IVersion | string) {\n assert(!this.isSelectionMade(), 0x084 /* \"On storage resolve, user selection already made!\" */);\n assert(!!storage, 0x085 /* \"On storage resolve, missing storage!\" */);\n this.storage = storage;\n assert(this.isSelectionMade(), 0x086 /* \"After storage resolve, user selection status still false!\" */);\n\n this.ui.versionSelected(seq, version);\n this.startSeqDeferred.resolve(seq);\n }\n}\n\nasync function* generateSequencedMessagesFromDeltaStorage(deltaStorage: IDocumentDeltaStorageService) {\n const stream = deltaStorage.fetchMessages(1, undefined);\n while (true) {\n const result = await stream.read();\n if (result.done) {\n return;\n }\n yield result.value;\n }\n}\n"]}
|
package/dist/fluidDebuggerUi.js
CHANGED
|
@@ -159,7 +159,7 @@ class DebuggerUI {
|
|
|
159
159
|
this.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);
|
|
160
160
|
}
|
|
161
161
|
disableNextOpButton(disable) {
|
|
162
|
-
common_utils_1.assert(!!this.buttonOps, 0x088 /* "Missing button ops button!" */);
|
|
162
|
+
(0, common_utils_1.assert)(!!this.buttonOps, 0x088 /* "Missing button ops button!" */);
|
|
163
163
|
this.buttonOps.disabled = disable;
|
|
164
164
|
}
|
|
165
165
|
updateNextOpText(ops) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidDebuggerUi.js","sourceRoot":"","sources":["../src/fluidDebuggerUi.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AA8FtD,MAAM,kBAAkB,GACpB;;;;;;;;;;;;;;;;QAgBI,CAAC;AAET,MAAM,mBAAmB,GACrB;;;;;;;;;;;;;;;QAeI,CAAC;AAET,MAAa,UAAU;IA4CnB,YAAuC,UAA+B,EAAmB,cAAsB;QAAxE,eAAU,GAAV,UAAU,CAAqB;QAAmB,mBAAc,GAAd,cAAc,CAAQ;QALrG,uBAAkB,GAAG,KAAK,CAAC;QAC3B,aAAQ,GAAe,EAAE,CAAC;QAE1B,mBAAc,GAAG,KAAK,CAAC;QAG7B,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;QACzC,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAE9B,MAAM,CA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;QACjB,IAAI,WAAW,GAAG,CAAC,EAAE;YACjB,IAAI,GAAG,2CAA2C,CAAC;SACtD;QACD,IAAI,YAAY,EAAE;YACd,IAAI,GAAG,4BAA4B,WAAW,EAAE,CAAC;SACpD;aAAM;YACH,IAAI,GAAG,4BAA4B,WAAW,EAAE,CAAC;SACpD;QACD,IAAI,CAAC,UAAW,CAAC,WAAW,GAAG,IAAI,CAAC;IACxC,CAAC;IAEO,QAAQ,CAAC,QAAgB,EAAE,IAAY;QAC3C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC5C,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,iCAAkC,kBAAkB,CAAC,IAAI,CAAE,EAAE,CAAC,CAAC;QAC5F,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;IACvC,CAAC;CACJ;AA5MD,gCA4MC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ISequencedDocumentMessage, IVersion } from \"@fluidframework/protocol-definitions\";\n\nexport interface IDebuggerUI {\n /**\n * Version information is provided.\n * Expect updates (information about seq#, timestamp) through updateVersion() calls\n */\n addVersions(version: IVersion[]): void;\n\n /**\n * Call when new version is downloaded from storage\n * Expect multiple callbacks.\n */\n updateVersion(index: number, version: IVersion, seqNumber: number): void;\n\n /**\n * Called in response to successful onVersionSelection() or onSnapshotFileSelection() call\n * and provides extra information about selection.\n * It expected that UI layer would change its mode as result of this call, i.e. switch to\n * displaying op playback controls (if this is supported)\n * Note: There maybe no call to versionSelected() in response to onSnapshotFileSelection() call\n * if file does not exist, has wrong name of wrong format.\n * @param version - version, file name, or undefined if playing ops.\n */\n versionSelected(seqNumber: number, version: IVersion | string): void;\n\n /**\n * Called by controller in response to new ops being downloaded\n * Called with disable = true if there are no (currently) ops to play\n */\n disableNextOpButton(disable: boolean): void;\n\n /**\n * Called by controller when new ops arrive (or we are done playing previous batch)\n * Indicates next batch of ops that would be played when UI calls controller's onOpButtonClick()\n * Called with ops=[] when there are no ops to play.\n */\n updateNextOpText(ops: ISequencedDocumentMessage[]): void;\n\n /**\n * Called periodically when new versions are downloaded from server\n */\n updateVersionText(versionsLeft: number): void;\n\n /**\n * Called periodically to notify about last known op\n * @param lastKnownOp - seq number of last known op. -1 if can't play ops in this mode (load from file)\n * @param stillLoading - true if we did not reach yet the end of the stream\n */\n updateLastOpText(lastKnownOp: number, stillLoading: boolean): void;\n}\n\nexport interface IDebuggerController {\n /**\n * Initialization. UI layers calls into controller to connect the two.\n * @param ui - UI layer\n */\n connectToUi(ui: IDebuggerUI);\n\n /**\n * Called by UI layer when debugger window is closed by user\n * If called before user makes selection of snapshot/file, original\n * document service is returned to loader (instead of debugger service) and normal document load continues.\n */\n onClose(): void;\n\n /**\n * UI Layer notifies about selection of version to continue.\n * On successful load, versionSelected() is called.\n * @param version - Snapshot version to start from.\n */\n onVersionSelection(version: IVersion): void;\n\n /**\n * UI Layer notifies about selection of version to continue.\n * On successful load, versionSelected() is called.\n * @param version - File to load snapshot from\n */\n onSnapshotFileSelection(file: File): void;\n\n /**\n * \"next op\" button is clicked in the UI\n * @param steps - number of ops to play.\n */\n onOpButtonClick(steps: number): void;\n\n /**\n * \"Download ops\" option is clicked in the UI. Returns JSON of the full opStream when available.\n * @param anonymize - anonymize the ops json using the sanitization tool\n */\n onDownloadOpsButtonClick(anonymize: boolean): Promise<string>;\n}\n\nconst debuggerWindowHtml =\n `<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 =\n `<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\nexport class DebuggerUI {\n public static create(controller: IDebuggerController): DebuggerUI | null {\n if (\n typeof window !== \"object\" ||\n window === null ||\n typeof window.document !== \"object\" ||\n window.document == null) {\n console.log(\"Can't create debugger window - not running in browser!\");\n return null;\n }\n\n const debuggerWindow = window.open(\n \"\",\n \"\",\n \"width=400,height=400,resizable=yes,location=no,menubar=no,titlebar=no,status=no,toolbar=no\");\n if (!debuggerWindow) {\n console.error(\"Can't create debugger window - please enable pop-up windows in your browser!\");\n return null;\n }\n\n return new DebuggerUI(controller, debuggerWindow);\n }\n\n private static formatDate(date: number) {\n // Alternative - without timezone\n // new Date().toLocaleString('default', { timeZone: 'UTC'}));\n // new Date().toLocaleString('default', { year: 'numeric', month: 'short',\n // day: 'numeric', hour: '2-digit', minute: 'numeric', second: 'numeric' }));\n return new Date(date).toUTCString();\n }\n\n protected selector?: HTMLSelectElement;\n protected versionText: HTMLDivElement;\n\n protected buttonOps?: HTMLButtonElement;\n protected text1?: HTMLDivElement;\n protected text2?: HTMLDivElement;\n protected text3?: HTMLDivElement;\n protected lastOpText?: HTMLDivElement;\n protected wasVersionSelected = false;\n protected versions: IVersion[] = [];\n\n protected documentClosed = false;\n\n protected constructor(private readonly controller: IDebuggerController, private readonly debuggerWindow: Window) {\n const doc = this.debuggerWindow.document;\n doc.write(debuggerWindowHtml);\n\n window.addEventListener(\"beforeunload\", (e) => {\n this.documentClosed = true;\n this.debuggerWindow.close();\n }, false);\n\n this.debuggerWindow.addEventListener(\"beforeunload\", (e) => {\n if (!this.documentClosed) {\n this.controller.onClose();\n }\n }, false);\n\n this.selector = doc.getElementById(\"selector\") as HTMLSelectElement;\n\n const buttonVers = doc.getElementById(\"buttonVers\") as HTMLDivElement;\n buttonVers.onclick = () => {\n const index = this.selector!.selectedIndex;\n controller.onVersionSelection(this.versions[index]);\n };\n\n const fileSnapshot = doc.getElementById(\"file\") as HTMLInputElement;\n fileSnapshot.addEventListener(\"change\", () => {\n const files = fileSnapshot.files;\n if (files) {\n controller.onSnapshotFileSelection(files[0]);\n }\n }, false);\n\n const opDownloadButton = doc.getElementById(\"downloadOps\") as HTMLElement;\n const anonymizeCheckbox = doc.getElementById(\"anonymize\") as HTMLInputElement;\n this.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);\n\n this.versionText = doc.getElementById(\"versionText\") as HTMLDivElement;\n this.versionText.textContent = \"Fetching snapshots, please wait...\";\n\n controller.connectToUi(this);\n }\n\n private attachDownloadOpsListener(element: HTMLElement, anonymize: HTMLInputElement) {\n element.addEventListener(\"click\", () => {\n this.controller.onDownloadOpsButtonClick(anonymize.checked).then((opJson) => {\n this.download(\"opStream.json\", opJson);\n }).catch((error) => {console.log(`Error downloading ops: ${error}`);});\n });\n }\n\n public addVersions(versions: IVersion[]) {\n if (this.selector) {\n this.versions = versions;\n for (const version of versions) {\n const option = document.createElement(\"option\");\n if (version.date !== undefined) {\n option.text = `id = ${version.id}, time = ${version.date}`;\n } else {\n option.text = `id = ${version.id}`;\n }\n this.selector.add(option);\n }\n }\n }\n\n public updateVersion(index: number, version: IVersion, seqNumber: number) {\n if (this.selector) {\n const option = this.selector[index] as HTMLOptionElement;\n option.text = `${option.text}, seq = ${seqNumber}`;\n this.selector[index] = option;\n }\n }\n\n public versionSelected(seqNumber: number, version: IVersion | string) {\n let text: string;\n if (typeof version === \"string\") {\n text = `Playing ${version} file`;\n } else {\n text = `Playing from ${version.id}, seq# ${seqNumber}`;\n }\n\n this.wasVersionSelected = true;\n this.selector = undefined;\n\n const doc = this.debuggerWindow.document;\n doc.open();\n doc.write(debuggerWindowHtml2);\n doc.close();\n\n this.lastOpText = doc.getElementById(\"lastOp\") as HTMLDivElement;\n this.text1 = doc.getElementById(\"text1\") as HTMLDivElement;\n this.text2 = doc.getElementById(\"text2\") as HTMLDivElement;\n this.text3 = doc.getElementById(\"text3\") as HTMLDivElement;\n\n const steps = doc.getElementById(\"steps\") as HTMLInputElement;\n this.buttonOps = doc.getElementById(\"buttonOps\") as HTMLButtonElement;\n this.buttonOps.disabled = true;\n this.buttonOps.onclick = () => {\n this.controller.onOpButtonClick(Number(steps.value));\n };\n\n this.versionText = doc.getElementById(\"versionText\") as HTMLDivElement;\n this.versionText.textContent = text;\n\n const opDownloadButton = doc.getElementById(\"downloadOps\") as HTMLElement;\n const anonymizeCheckbox = doc.getElementById(\"anonymize\") as HTMLInputElement;\n this.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);\n }\n\n public disableNextOpButton(disable: boolean) {\n assert(!!this.buttonOps, 0x088 /* \"Missing button ops button!\" */);\n this.buttonOps.disabled = disable;\n }\n\n public updateNextOpText(ops: ISequencedDocumentMessage[]) {\n if (ops.length === 0) {\n this.text1!.textContent = \"\";\n this.text2!.textContent = \"\";\n this.text3!.textContent = \"\";\n } else {\n const op = ops[0];\n const seq = op.sequenceNumber;\n const date = DebuggerUI.formatDate(op.timestamp);\n this.text1!.textContent = `Next op seq#: ${seq}`;\n this.text2!.textContent = `Type: ${op.type}`;\n this.text3!.textContent = `${date}`;\n }\n }\n\n public updateVersionText(versionCount: number) {\n if (!this.wasVersionSelected) {\n const text = versionCount === 0 ? \"\" : `Fetching information about ${versionCount} snapshots...`;\n this.versionText.textContent = text;\n }\n }\n\n public updateLastOpText(lastKnownOp: number, stillLoading: boolean) {\n let text: string;\n if (lastKnownOp < 0) {\n text = `FluidDebugger can't play ops in this mode`;\n }\n if (stillLoading) {\n text = `Last op (still loading): ${lastKnownOp}`;\n } else {\n text = `Document's last op seq#: ${lastKnownOp}`;\n }\n this.lastOpText!.textContent = text;\n }\n\n private download(filename: string, data: string): void {\n const element = document.createElement(\"a\");\n element.setAttribute(\"href\", `data:text/plain;charset=utf-8,${ encodeURIComponent(data) }`);\n element.setAttribute(\"download\", filename);\n\n element.style.display = \"none\";\n document.body.appendChild(element);\n\n element.click();\n\n document.body.removeChild(element);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"fluidDebuggerUi.js","sourceRoot":"","sources":["../src/fluidDebuggerUi.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AA8FtD,MAAM,kBAAkB,GACpB;;;;;;;;;;;;;;;;QAgBI,CAAC;AAET,MAAM,mBAAmB,GACrB;;;;;;;;;;;;;;;QAeI,CAAC;AAET,MAAa,UAAU;IA4CnB,YAAuC,UAA+B,EAAmB,cAAsB;QAAxE,eAAU,GAAV,UAAU,CAAqB;QAAmB,mBAAc,GAAd,cAAc,CAAQ;QALrG,uBAAkB,GAAG,KAAK,CAAC;QAC3B,aAAQ,GAAe,EAAE,CAAC;QAE1B,mBAAc,GAAG,KAAK,CAAC;QAG7B,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;QACzC,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAE9B,MAAM,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE;YAC1C,IAAI,CAAC,cAAc,GA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QACD,IAAI,YAAY,EAAE;YACd,IAAI,GAAG,4BAA4B,WAAW,EAAE,CAAC;SACpD;aAAM;YACH,IAAI,GAAG,4BAA4B,WAAW,EAAE,CAAC;SACpD;QACD,IAAI,CAAC,UAAW,CAAC,WAAW,GAAG,IAAI,CAAC;IACxC,CAAC;IAEO,QAAQ,CAAC,QAAgB,EAAE,IAAY;QAC3C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC5C,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,iCAAkC,kBAAkB,CAAC,IAAI,CAAE,EAAE,CAAC,CAAC;QAC5F,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;IACvC,CAAC;CACJ;AA5MD,gCA4MC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ISequencedDocumentMessage, IVersion } from \"@fluidframework/protocol-definitions\";\n\nexport interface IDebuggerUI {\n /**\n * Version information is provided.\n * Expect updates (information about seq#, timestamp) through updateVersion() calls\n */\n addVersions(version: IVersion[]): void;\n\n /**\n * Call when new version is downloaded from storage\n * Expect multiple callbacks.\n */\n updateVersion(index: number, version: IVersion, seqNumber: number): void;\n\n /**\n * Called in response to successful onVersionSelection() or onSnapshotFileSelection() call\n * and provides extra information about selection.\n * It expected that UI layer would change its mode as result of this call, i.e. switch to\n * displaying op playback controls (if this is supported)\n * Note: There maybe no call to versionSelected() in response to onSnapshotFileSelection() call\n * if file does not exist, has wrong name of wrong format.\n * @param version - version, file name, or undefined if playing ops.\n */\n versionSelected(seqNumber: number, version: IVersion | string): void;\n\n /**\n * Called by controller in response to new ops being downloaded\n * Called with disable = true if there are no (currently) ops to play\n */\n disableNextOpButton(disable: boolean): void;\n\n /**\n * Called by controller when new ops arrive (or we are done playing previous batch)\n * Indicates next batch of ops that would be played when UI calls controller's onOpButtonClick()\n * Called with ops=[] when there are no ops to play.\n */\n updateNextOpText(ops: ISequencedDocumentMessage[]): void;\n\n /**\n * Called periodically when new versions are downloaded from server\n */\n updateVersionText(versionsLeft: number): void;\n\n /**\n * Called periodically to notify about last known op\n * @param lastKnownOp - seq number of last known op. -1 if can't play ops in this mode (load from file)\n * @param stillLoading - true if we did not reach yet the end of the stream\n */\n updateLastOpText(lastKnownOp: number, stillLoading: boolean): void;\n}\n\nexport interface IDebuggerController {\n /**\n * Initialization. UI layers calls into controller to connect the two.\n * @param ui - UI layer\n */\n connectToUi(ui: IDebuggerUI);\n\n /**\n * Called by UI layer when debugger window is closed by user\n * If called before user makes selection of snapshot/file, original\n * document service is returned to loader (instead of debugger service) and normal document load continues.\n */\n onClose(): void;\n\n /**\n * UI Layer notifies about selection of version to continue.\n * On successful load, versionSelected() is called.\n * @param version - Snapshot version to start from.\n */\n onVersionSelection(version: IVersion): void;\n\n /**\n * UI Layer notifies about selection of version to continue.\n * On successful load, versionSelected() is called.\n * @param version - File to load snapshot from\n */\n onSnapshotFileSelection(file: File): void;\n\n /**\n * \"next op\" button is clicked in the UI\n * @param steps - number of ops to play.\n */\n onOpButtonClick(steps: number): void;\n\n /**\n * \"Download ops\" option is clicked in the UI. Returns JSON of the full opStream when available.\n * @param anonymize - anonymize the ops json using the sanitization tool\n */\n onDownloadOpsButtonClick(anonymize: boolean): Promise<string>;\n}\n\nconst debuggerWindowHtml =\n `<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 =\n `<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\nexport class DebuggerUI {\n public static create(controller: IDebuggerController): DebuggerUI | null {\n if (\n typeof window !== \"object\" ||\n window === null ||\n typeof window.document !== \"object\" ||\n window.document == null) {\n console.log(\"Can't create debugger window - not running in browser!\");\n return null;\n }\n\n const debuggerWindow = window.open(\n \"\",\n \"\",\n \"width=400,height=400,resizable=yes,location=no,menubar=no,titlebar=no,status=no,toolbar=no\");\n if (!debuggerWindow) {\n console.error(\"Can't create debugger window - please enable pop-up windows in your browser!\");\n return null;\n }\n\n return new DebuggerUI(controller, debuggerWindow);\n }\n\n private static formatDate(date: number) {\n // Alternative - without timezone\n // new Date().toLocaleString('default', { timeZone: 'UTC'}));\n // new Date().toLocaleString('default', { year: 'numeric', month: 'short',\n // day: 'numeric', hour: '2-digit', minute: 'numeric', second: 'numeric' }));\n return new Date(date).toUTCString();\n }\n\n protected selector?: HTMLSelectElement;\n protected versionText: HTMLDivElement;\n\n protected buttonOps?: HTMLButtonElement;\n protected text1?: HTMLDivElement;\n protected text2?: HTMLDivElement;\n protected text3?: HTMLDivElement;\n protected lastOpText?: HTMLDivElement;\n protected wasVersionSelected = false;\n protected versions: IVersion[] = [];\n\n protected documentClosed = false;\n\n protected constructor(private readonly controller: IDebuggerController, private readonly debuggerWindow: Window) {\n const doc = this.debuggerWindow.document;\n doc.write(debuggerWindowHtml);\n\n window.addEventListener(\"beforeunload\", (e) => {\n this.documentClosed = true;\n this.debuggerWindow.close();\n }, false);\n\n this.debuggerWindow.addEventListener(\"beforeunload\", (e) => {\n if (!this.documentClosed) {\n this.controller.onClose();\n }\n }, false);\n\n this.selector = doc.getElementById(\"selector\") as HTMLSelectElement;\n\n const buttonVers = doc.getElementById(\"buttonVers\") as HTMLDivElement;\n buttonVers.onclick = () => {\n const index = this.selector!.selectedIndex;\n controller.onVersionSelection(this.versions[index]);\n };\n\n const fileSnapshot = doc.getElementById(\"file\") as HTMLInputElement;\n fileSnapshot.addEventListener(\"change\", () => {\n const files = fileSnapshot.files;\n if (files) {\n controller.onSnapshotFileSelection(files[0]);\n }\n }, false);\n\n const opDownloadButton = doc.getElementById(\"downloadOps\") as HTMLElement;\n const anonymizeCheckbox = doc.getElementById(\"anonymize\") as HTMLInputElement;\n this.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);\n\n this.versionText = doc.getElementById(\"versionText\") as HTMLDivElement;\n this.versionText.textContent = \"Fetching snapshots, please wait...\";\n\n controller.connectToUi(this);\n }\n\n private attachDownloadOpsListener(element: HTMLElement, anonymize: HTMLInputElement) {\n element.addEventListener(\"click\", () => {\n this.controller.onDownloadOpsButtonClick(anonymize.checked).then((opJson) => {\n this.download(\"opStream.json\", opJson);\n }).catch((error) => { console.log(`Error downloading ops: ${error}`); });\n });\n }\n\n public addVersions(versions: IVersion[]) {\n if (this.selector) {\n this.versions = versions;\n for (const version of versions) {\n const option = document.createElement(\"option\");\n if (version.date !== undefined) {\n option.text = `id = ${version.id}, time = ${version.date}`;\n } else {\n option.text = `id = ${version.id}`;\n }\n this.selector.add(option);\n }\n }\n }\n\n public updateVersion(index: number, version: IVersion, seqNumber: number) {\n if (this.selector) {\n const option = this.selector[index] as HTMLOptionElement;\n option.text = `${option.text}, seq = ${seqNumber}`;\n this.selector[index] = option;\n }\n }\n\n public versionSelected(seqNumber: number, version: IVersion | string) {\n let text: string;\n if (typeof version === \"string\") {\n text = `Playing ${version} file`;\n } else {\n text = `Playing from ${version.id}, seq# ${seqNumber}`;\n }\n\n this.wasVersionSelected = true;\n this.selector = undefined;\n\n const doc = this.debuggerWindow.document;\n doc.open();\n doc.write(debuggerWindowHtml2);\n doc.close();\n\n this.lastOpText = doc.getElementById(\"lastOp\") as HTMLDivElement;\n this.text1 = doc.getElementById(\"text1\") as HTMLDivElement;\n this.text2 = doc.getElementById(\"text2\") as HTMLDivElement;\n this.text3 = doc.getElementById(\"text3\") as HTMLDivElement;\n\n const steps = doc.getElementById(\"steps\") as HTMLInputElement;\n this.buttonOps = doc.getElementById(\"buttonOps\") as HTMLButtonElement;\n this.buttonOps.disabled = true;\n this.buttonOps.onclick = () => {\n this.controller.onOpButtonClick(Number(steps.value));\n };\n\n this.versionText = doc.getElementById(\"versionText\") as HTMLDivElement;\n this.versionText.textContent = text;\n\n const opDownloadButton = doc.getElementById(\"downloadOps\") as HTMLElement;\n const anonymizeCheckbox = doc.getElementById(\"anonymize\") as HTMLInputElement;\n this.attachDownloadOpsListener(opDownloadButton, anonymizeCheckbox);\n }\n\n public disableNextOpButton(disable: boolean) {\n assert(!!this.buttonOps, 0x088 /* \"Missing button ops button!\" */);\n this.buttonOps.disabled = disable;\n }\n\n public updateNextOpText(ops: ISequencedDocumentMessage[]) {\n if (ops.length === 0) {\n this.text1!.textContent = \"\";\n this.text2!.textContent = \"\";\n this.text3!.textContent = \"\";\n } else {\n const op = ops[0];\n const seq = op.sequenceNumber;\n const date = DebuggerUI.formatDate(op.timestamp);\n this.text1!.textContent = `Next op seq#: ${seq}`;\n this.text2!.textContent = `Type: ${op.type}`;\n this.text3!.textContent = `${date}`;\n }\n }\n\n public updateVersionText(versionCount: number) {\n if (!this.wasVersionSelected) {\n const text = versionCount === 0 ? \"\" : `Fetching information about ${versionCount} snapshots...`;\n this.versionText.textContent = text;\n }\n }\n\n public updateLastOpText(lastKnownOp: number, stillLoading: boolean) {\n let text: string;\n if (lastKnownOp < 0) {\n text = `FluidDebugger can't play ops in this mode`;\n }\n if (stillLoading) {\n text = `Last op (still loading): ${lastKnownOp}`;\n } else {\n text = `Document's last op seq#: ${lastKnownOp}`;\n }\n this.lastOpText!.textContent = text;\n }\n\n private download(filename: string, data: string): void {\n const element = document.createElement(\"a\");\n element.setAttribute(\"href\", `data:text/plain;charset=utf-8,${ encodeURIComponent(data) }`);\n element.setAttribute(\"download\", filename);\n\n element.style.display = \"none\";\n document.body.appendChild(element);\n\n element.click();\n\n document.body.removeChild(element);\n }\n}\n"]}
|
package/dist/messageSchema.js
CHANGED
|
@@ -328,7 +328,7 @@ const mergeTreeDeltaOpSchema = {
|
|
|
328
328
|
oneOf: [
|
|
329
329
|
{
|
|
330
330
|
properties: {
|
|
331
|
-
type: { enum: [0
|
|
331
|
+
type: { enum: [0] },
|
|
332
332
|
seg: { type: ["string", "object"] },
|
|
333
333
|
pos1: { type: "number" },
|
|
334
334
|
},
|
|
@@ -337,7 +337,7 @@ const mergeTreeDeltaOpSchema = {
|
|
|
337
337
|
},
|
|
338
338
|
{
|
|
339
339
|
properties: {
|
|
340
|
-
type: { enum: [1
|
|
340
|
+
type: { enum: [1] },
|
|
341
341
|
register: { type: "string" },
|
|
342
342
|
pos1: { type: "number" },
|
|
343
343
|
pos2: { type: "number" },
|
|
@@ -347,7 +347,7 @@ const mergeTreeDeltaOpSchema = {
|
|
|
347
347
|
},
|
|
348
348
|
{
|
|
349
349
|
properties: {
|
|
350
|
-
type: { enum: [2
|
|
350
|
+
type: { enum: [2] },
|
|
351
351
|
combiningOp: {
|
|
352
352
|
type: "object",
|
|
353
353
|
properties: {
|
|
@@ -369,6 +369,8 @@ const mergeTreeDeltaOpSchema = {
|
|
|
369
369
|
required: ["props"],
|
|
370
370
|
additionalProperties: false,
|
|
371
371
|
},
|
|
372
|
+
// There's something weird with the typings/settings here where this doesn't get
|
|
373
|
+
// recognized as a valid Schema array if more than 1 item has "properties" defined
|
|
372
374
|
],
|
|
373
375
|
};
|
|
374
376
|
const mergeTreeGroupOpSchema = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageSchema.js","sourceRoot":"","sources":["../src/messageSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIU,QAAA,kBAAkB,GAAG;IAC9B,IAAI,EAAE,MAAM;CACf,CAAC;AAEW,QAAA,cAAc,GAAG;IAC1B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,MAAM,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACR,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACxB,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;gBAC7B,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;gBACzB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACxB,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACR,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBACtB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;wBACxB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;qBAC5B;oBACD,QAAQ,EAAE,CAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAE;oBACnC,oBAAoB,EAAE,KAAK;iBAC9B;aACJ;YACD,QAAQ,EAAE,CAAE,MAAM,CAAE;YACpB,oBAAoB,EAAE,KAAK;SAC9B;KACJ;IACD,QAAQ,EAAE,CAAE,UAAU,EAAE,Q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AAsB;KAClC;IACD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE;KAC9C;IACD,QAAQ,EAAE,CAAE,SAAS,EAAE,UAAU,CAAE;IACnC,oBAAoB,EAAE,KAAK;CAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Schema } from \"jsonschema\";\n\nexport const joinContentsSchema = {\n type: \"null\",\n};\n\nexport const joinDataSchema = {\n type: \"object\",\n properties: {\n clientId: { type: \"string\" },\n detail: {\n type: \"object\",\n properties: {\n details: { type: \"object\" },\n mode: { type: \"string\" },\n permission: { type: \"array\" },\n scopes: { type: \"array\" },\n type: { type: \"string\" },\n user: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n name: { type: \"string\" },\n email: { type: \"string\" },\n },\n required: [ \"id\", \"name\", \"email\" ],\n additionalProperties: false,\n },\n },\n required: [ \"user\" ],\n additionalProperties: false,\n },\n },\n required: [ \"clientId\", \"detail\" ],\n additionalProperties: false,\n};\n\nexport const proposeContentsSchema = {\n type: [ \"string\", \"object\" ],\n properties: {\n key: { type: \"string\" },\n value: { type: \"string\" },\n },\n required: [ \"key\" ],\n additionalProperties: false,\n};\n\n// The parsed json of a propose message's contents value\nexport const proposeCodeSchema = {\n type: \"object\",\n properties: {\n key: { type: \"string\" },\n value: {\n type: \"object\",\n properties: {\n package: {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n version: { type: \"string\" },\n fluid: { type: \"object\" },\n },\n required: [ \"name\" ],\n },\n config: { type: \"object\" },\n },\n required: [ \"package\", \"config\" ],\n additionalProperties: false,\n },\n },\n required: [ \"key\", \"value\" ],\n additionalProperties: false,\n};\n\n// This also needs to be in the root \"definitions\" key as \"entries\" to be used\nconst attachSnapshotEntriesSchema = {\n type: \"object\",\n properties: {\n mode: { type: \"string\" },\n path: { type: \"string\" },\n type: { enum: [ \"Blob\", \"Tree\" ] },\n value: {\n type: \"object\",\n oneOf: [\n // type Blob\n {\n properties: {\n contents: { type: \"string\" },\n encoding: { type: \"string\" },\n // Verify this\n id: { type: \"null\" },\n },\n required: [ \"contents\", \"encoding\" ],\n additionalProperties: false,\n },\n // type Tree\n {\n properties: {\n entries: {\n type: \"array\",\n items: { $ref: \"#/definitions/entries\" },\n },\n // Verify this\n id: { type: \"null\" },\n },\n required: [ \"entries\" ],\n additionalProperties: false,\n },\n ],\n },\n },\n required: [ \"mode\", \"path\", \"type\", \"value\" ],\n additionalProperties: false,\n};\n\nexport const attachContentsSchema = {\n definitions: {\n entries: attachSnapshotEntriesSchema,\n },\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n snapshot: {\n type: \"object\",\n properties: {\n entries: {\n type: \"array\",\n items: { $ref: \"#/definitions/entries\" },\n },\n // Verify this\n id: { type: \"null\" },\n },\n required: [ \"entries\" ],\n additionalProperties: false,\n },\n type: { type: \"string\" },\n },\n required: [ \"id\", \"snapshot\", \"type\" ],\n additionalProperties: false,\n};\n\n// can exist at the root level or within an op\nexport const chunkedOpContentsSchema = {\n type: \"object\",\n properties: {\n chunkId: { type: \"number\" },\n contents: { type: \"string\" },\n originalType: { type: \"string\" },\n totalChunks: { type: \"number\" },\n },\n required: [ \"chunkId\", \"contents\", \"originalType\", \"totalChunks\" ],\n additionalProperties: false,\n};\n\nconst contentsSchema = {\n type: \"object\",\n properties: {\n address: { type: \"string\" },\n contents: {\n type: \"object\",\n properties: {\n content: { type: \"object\" },\n type: { type: \"string\" },\n },\n required: [ \"content\", \"type\" ],\n additionalProperties: false,\n },\n },\n required: [ \"address\", \"contents\" ],\n additionalProperties: false,\n};\n\n// special contents formats from containerRuntime.ts's ContainerMessageType\nexport const opContentsSchema = {\n definitions: {\n content: contentsSchema,\n entries: attachSnapshotEntriesSchema,\n attachContents: attachContentsSchema,\n chunkedOpContents: chunkedOpContentsSchema,\n },\n type: \"object\",\n oneOf: [\n {\n properties: {\n type: { enum: [ \"component\" ] },\n contents: { $ref: \"#/definitions/content\" },\n },\n required: [ \"type\", \"contents\" ],\n additionalProperties: false,\n },\n {\n properties: {\n type: { enum: [ \"attach\" ] },\n contents: { $ref: \"#/definitions/attachContents\" },\n },\n required: [ \"type\", \"contents\" ],\n additionalProperties: false,\n },\n {\n properties: {\n type: { enum: [ \"chunkedOp\" ] },\n contents: { $ref: \"#/definitions/chunkedOpContents\" },\n },\n required: [ \"type\", \"contents\" ],\n additionalProperties: false,\n },\n {\n $ref: \"#/definitions/content\",\n },\n ],\n};\n\n// \"op\" message's contents.contents.content schemas\n\nexport const opContentsAttachSchema = attachContentsSchema;\n\n// Ops from dds/register-collection's consensusRegisterCollection\nexport const opContentsRegisterCollectionSchema = {\n type: \"object\",\n properties: {\n address: { type: \"string\" },\n contents: {\n type: \"object\",\n properties: {\n key: { type: \"string\" },\n refSeq: { type: \"number\" },\n serializedValue: { type: \"string\" },\n value: {\n type: \"object\",\n properties: {\n type: { type: \"string\" },\n value: { },\n },\n required: [ \"type\", \"value\" ],\n additionalProperties: false,\n },\n type: {\n type: \"string\",\n enum: [ \"write\" ],\n },\n },\n required: [ \"key\", \"type\" ],\n additionalProperties: false,\n },\n },\n required: [ \"address\", \"contents\" ],\n additionalProperties: false,\n};\n\n// Ops from dds/map's directory.ts\nexport const opContentsMapSchema = {\n type: \"object\",\n properties: {\n address: { type: \"string\" },\n contents: {\n type: \"object\",\n properties: {\n key: { type: \"string\" },\n path: { type: \"string\" },\n subdirName: { type: \"string\" },\n value: {\n type: \"object\",\n properties: {\n type: { type: \"string\" },\n value: { },\n },\n required: [ \"type\" ],\n additionalProperties: false,\n },\n type: {\n type: \"string\",\n enum: [\n \"act\",\n \"set\",\n \"delete\",\n \"clear\",\n \"createSubDirectory\",\n \"deleteSubDirectory\",\n ],\n },\n },\n required: [ \"type\" ],\n additionalProperties: false,\n // specific property combinations based on type value\n oneOf: [\n {\n properties: { type: { enum: [ \"act\" ] } },\n required: [ \"key\", \"path\", \"value\" ],\n },\n {\n properties: { type: { enum: [ \"set\" ] } },\n required: [ \"key\", \"value\" ],\n },\n {\n properties: { type: { enum: [ \"delete\" ] } },\n required: [ \"key\" ],\n },\n {\n properties: { type: { enum: [ \"clear\" ] } },\n required: [ \"path\" ],\n },\n {\n properties: { type: { enum: [ \"createSubDirectory\", \"deleteSubDirectory\" ] } },\n required: [ \"path\", \"subdirName\" ],\n },\n ],\n },\n },\n required: [ \"address\", \"contents\" ],\n additionalProperties: false,\n};\n\n// from dds/merge-tree's ops.ts and opBuilder.ts\n// Note: written op objects in opBuilder.ts are more restrictive than their\n// corresponding interface definitions in ops.ts, and the more restrictive\n// schema are used here\nconst mergeTreeRelativePosSchema = {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n before: { type: \"boolean\" },\n offset: { type: \"number\" },\n },\n additionalProperties: false,\n};\n\nconst mergeTreeDeltaOpSchema = {\n type: \"object\",\n properties: {\n type: {\n type: \"number\",\n minimum: 0 /* MergeTreeDeltaType.INSERT */,\n maximum: 2 /* MergeTreeDeltaType.ANNOTATE */,\n },\n },\n required: [ \"type\" ],\n oneOf: [\n {\n properties: {\n type: { enum: [ 0 /* MergeTreeDeltaType.INSERT */ ] },\n seg: { type: [ \"string\", \"object\" ] },\n pos1: { type: \"number\" },\n },\n required: [ \"pos1\" ],\n additionalProperties: false,\n },\n {\n properties: {\n type: { enum: [ 1 /* MergeTreeDeltaType.REMOVE */ ] },\n register: { type: \"string\" },\n pos1: { type: \"number\" },\n pos2: { type: \"number\" },\n },\n required: [ \"pos1\" ],\n additionalProperties: false,\n },\n {\n properties: {\n type: { enum: [ 2 /* MergeTreeDeltaType.ANNOTATE */ ] },\n combiningOp: {\n type: \"object\",\n properties: {\n defaultValue: { },\n maxValue: { },\n minValue: { },\n name: { type: \"string\" },\n },\n required: [ \"name\" ],\n additionalProperties: false,\n },\n pos1: { type: \"number\" },\n pos2: { type: \"number\" },\n props: { type: \"object\" },\n register: { type: \"string\" },\n relativePos1: { $ref: \"#/definitions/relativePos\" },\n relativePos2: { $ref: \"#/definitions/relativePos\" },\n },\n required: [ \"props\" ],\n additionalProperties: false,\n },\n // There's something weird with the typings/settings here where this doesn't get\n // recognized as a valid Schema array if more than 1 item has \"properties\" defined\n ] as Schema[],\n};\n\nconst mergeTreeGroupOpSchema = {\n type: \"object\",\n properties: {\n ops: {\n type: \"array\",\n items: { $ref: \"#/definitions/deltaOp\" },\n },\n type: {\n type: \"number\",\n minimum: 3 /* MergeTreeDeltaType.GROUP */,\n maximum: 3 /* MergeTreeDeltaType.GROUP */,\n },\n },\n required: [ \"ops\", \"type\" ],\n additionalProperties: false,\n};\n\nexport const opContentsMergeTreeDeltaOpSchema = {\n definitions: {\n relativePos: mergeTreeRelativePosSchema,\n deltaOp: mergeTreeDeltaOpSchema,\n },\n type: \"object\",\n properties: {\n address: { type: \"string\" },\n contents: { $ref: \"#/definitions/deltaOp\" },\n },\n required: [ \"address\", \"contents\" ],\n additionalProperties: false,\n};\n\nexport const opContentsMergeTreeGroupOpSchema = {\n definitions: {\n relativePos: mergeTreeRelativePosSchema,\n deltaOp: mergeTreeDeltaOpSchema,\n groupOp: mergeTreeGroupOpSchema,\n },\n type: \"object\",\n properties: {\n address: { type: \"string\" },\n contents: { $ref: \"#/definitions/groupOp\" },\n },\n required: [ \"address\", \"contents\" ],\n additionalProperties: false,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"messageSchema.js","sourceRoot":"","sources":["../src/messageSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIU,QAAA,kBAAkB,GAAG;IAC9B,IAAI,EAAE,MAAM;CACf,CAAC;AAEW,QAAA,cAAc,GAAG;IAC1B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,MAAM,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd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E;SAC3C;QACD,IAAI,EAAE;YACF,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,CAAC,CAAC,8BAA8B;YACzC,OAAO,EAAE,CAAC,CAAC,8BAA8B;SAC5C;KACJ;IACD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,KAAK;CAC9B,CAAC;AAEW,QAAA,gCAAgC,GAAG;IAC5C,WAAW,EAAE;QACT,WAAW,EAAE,0BAA0B;QACvC,OAAO,EAAE,sBAAsB;KAClC;IACD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE;KAC9C;IACD,QAAQ,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;IACjC,oBAAoB,EAAE,KAAK;CAC9B,CAAC;AAEW,QAAA,gCAAgC,GAAG;IAC5C,WAAW,EAAE;QACT,WAAW,EAAE,0BAA0B;QACvC,OAAO,EAAE,sBAAsB;QAC/B,OAAO,EAAE,sBAAsB;KAClC;IACD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE;KAC9C;IACD,QAAQ,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;IACjC,oBAAoB,EAAE,KAAK;CAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Schema } from \"jsonschema\";\n\nexport const joinContentsSchema = {\n type: \"null\",\n};\n\nexport const joinDataSchema = {\n type: \"object\",\n properties: {\n clientId: { type: \"string\" },\n detail: {\n type: \"object\",\n properties: {\n details: { type: \"object\" },\n mode: { type: \"string\" },\n permission: { type: \"array\" },\n scopes: { type: \"array\" },\n type: { type: \"string\" },\n user: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n name: { type: \"string\" },\n email: { type: \"string\" },\n },\n required: [\"id\", \"name\", \"email\"],\n additionalProperties: false,\n },\n },\n required: [\"user\"],\n additionalProperties: false,\n },\n },\n required: [\"clientId\", \"detail\"],\n additionalProperties: false,\n};\n\nexport const proposeContentsSchema = {\n type: [\"string\", \"object\"],\n properties: {\n key: { type: \"string\" },\n value: { type: \"string\" },\n },\n required: [\"key\"],\n additionalProperties: false,\n};\n\n// The parsed json of a propose message's contents value\nexport const proposeCodeSchema = {\n type: \"object\",\n properties: {\n key: { type: \"string\" },\n value: {\n type: \"object\",\n properties: {\n package: {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n version: { type: \"string\" },\n fluid: { type: \"object\" },\n },\n required: [\"name\"],\n },\n config: { type: \"object\" },\n },\n required: [\"package\", \"config\"],\n additionalProperties: false,\n },\n },\n required: [\"key\", \"value\"],\n additionalProperties: false,\n};\n\n// This also needs to be in the root \"definitions\" key as \"entries\" to be used\nconst attachSnapshotEntriesSchema = {\n type: \"object\",\n properties: {\n mode: { type: \"string\" },\n path: { type: \"string\" },\n type: { enum: [\"Blob\", \"Tree\"] },\n value: {\n type: \"object\",\n oneOf: [\n // type Blob\n {\n properties: {\n contents: { type: \"string\" },\n encoding: { type: \"string\" },\n // Verify this\n id: { type: \"null\" },\n },\n required: [\"contents\", \"encoding\"],\n additionalProperties: false,\n },\n // type Tree\n {\n properties: {\n entries: {\n type: \"array\",\n items: { $ref: \"#/definitions/entries\" },\n },\n // Verify this\n id: { type: \"null\" },\n },\n required: [\"entries\"],\n additionalProperties: false,\n },\n ],\n },\n },\n required: [\"mode\", \"path\", \"type\", \"value\"],\n additionalProperties: false,\n};\n\nexport const attachContentsSchema = {\n definitions: {\n entries: attachSnapshotEntriesSchema,\n },\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n snapshot: {\n type: \"object\",\n properties: {\n entries: {\n type: \"array\",\n items: { $ref: \"#/definitions/entries\" },\n },\n // Verify this\n id: { type: \"null\" },\n },\n required: [\"entries\"],\n additionalProperties: false,\n },\n type: { type: \"string\" },\n },\n required: [\"id\", \"snapshot\", \"type\"],\n additionalProperties: false,\n};\n\n// can exist at the root level or within an op\nexport const chunkedOpContentsSchema = {\n type: \"object\",\n properties: {\n chunkId: { type: \"number\" },\n contents: { type: \"string\" },\n originalType: { type: \"string\" },\n totalChunks: { type: \"number\" },\n },\n required: [\"chunkId\", \"contents\", \"originalType\", \"totalChunks\"],\n additionalProperties: false,\n};\n\nconst contentsSchema = {\n type: \"object\",\n properties: {\n address: { type: \"string\" },\n contents: {\n type: \"object\",\n properties: {\n content: { type: \"object\" },\n type: { type: \"string\" },\n },\n required: [\"content\", \"type\"],\n additionalProperties: false,\n },\n },\n required: [\"address\", \"contents\"],\n additionalProperties: false,\n};\n\n// special contents formats from containerRuntime.ts's ContainerMessageType\nexport const opContentsSchema = {\n definitions: {\n content: contentsSchema,\n entries: attachSnapshotEntriesSchema,\n attachContents: attachContentsSchema,\n chunkedOpContents: chunkedOpContentsSchema,\n },\n type: \"object\",\n oneOf: [\n {\n properties: {\n type: { enum: [\"component\"] },\n contents: { $ref: \"#/definitions/content\" },\n },\n required: [\"type\", \"contents\"],\n additionalProperties: false,\n },\n {\n properties: {\n type: { enum: [\"attach\"] },\n contents: { $ref: \"#/definitions/attachContents\" },\n },\n required: [\"type\", \"contents\"],\n additionalProperties: false,\n },\n {\n properties: {\n type: { enum: [\"chunkedOp\"] },\n contents: { $ref: \"#/definitions/chunkedOpContents\" },\n },\n required: [\"type\", \"contents\"],\n additionalProperties: false,\n },\n {\n $ref: \"#/definitions/content\",\n },\n ],\n};\n\n// \"op\" message's contents.contents.content schemas\n\nexport const opContentsAttachSchema = attachContentsSchema;\n\n// Ops from dds/register-collection's consensusRegisterCollection\nexport const opContentsRegisterCollectionSchema = {\n type: \"object\",\n properties: {\n address: { type: \"string\" },\n contents: {\n type: \"object\",\n properties: {\n key: { type: \"string\" },\n refSeq: { type: \"number\" },\n serializedValue: { type: \"string\" },\n value: {\n type: \"object\",\n properties: {\n type: { type: \"string\" },\n value: { },\n },\n required: [\"type\", \"value\"],\n additionalProperties: false,\n },\n type: {\n type: \"string\",\n enum: [\"write\"],\n },\n },\n required: [\"key\", \"type\"],\n additionalProperties: false,\n },\n },\n required: [\"address\", \"contents\"],\n additionalProperties: false,\n};\n\n// Ops from dds/map's directory.ts\nexport const opContentsMapSchema = {\n type: \"object\",\n properties: {\n address: { type: \"string\" },\n contents: {\n type: \"object\",\n properties: {\n key: { type: \"string\" },\n path: { type: \"string\" },\n subdirName: { type: \"string\" },\n value: {\n type: \"object\",\n properties: {\n type: { type: \"string\" },\n value: { },\n },\n required: [\"type\"],\n additionalProperties: false,\n },\n type: {\n type: \"string\",\n enum: [\n \"act\",\n \"set\",\n \"delete\",\n \"clear\",\n \"createSubDirectory\",\n \"deleteSubDirectory\",\n ],\n },\n },\n required: [\"type\"],\n additionalProperties: false,\n // specific property combinations based on type value\n oneOf: [\n {\n properties: { type: { enum: [\"act\"] } },\n required: [\"key\", \"path\", \"value\"],\n },\n {\n properties: { type: { enum: [\"set\"] } },\n required: [\"key\", \"value\"],\n },\n {\n properties: { type: { enum: [\"delete\"] } },\n required: [\"key\"],\n },\n {\n properties: { type: { enum: [\"clear\"] } },\n required: [\"path\"],\n },\n {\n properties: { type: { enum: [\"createSubDirectory\", \"deleteSubDirectory\"] } },\n required: [\"path\", \"subdirName\"],\n },\n ],\n },\n },\n required: [\"address\", \"contents\"],\n additionalProperties: false,\n};\n\n// from dds/merge-tree's ops.ts and opBuilder.ts\n// Note: written op objects in opBuilder.ts are more restrictive than their\n// corresponding interface definitions in ops.ts, and the more restrictive\n// schema are used here\nconst mergeTreeRelativePosSchema = {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n before: { type: \"boolean\" },\n offset: { type: \"number\" },\n },\n additionalProperties: false,\n};\n\nconst mergeTreeDeltaOpSchema = {\n type: \"object\",\n properties: {\n type: {\n type: \"number\",\n minimum: 0 /* MergeTreeDeltaType.INSERT */,\n maximum: 2 /* MergeTreeDeltaType.ANNOTATE */,\n },\n },\n required: [\"type\"],\n oneOf: [\n {\n properties: {\n type: { enum: [0] },\n seg: { type: [\"string\", \"object\"] },\n pos1: { type: \"number\" },\n },\n required: [\"pos1\"],\n additionalProperties: false,\n },\n {\n properties: {\n type: { enum: [1] },\n register: { type: \"string\" },\n pos1: { type: \"number\" },\n pos2: { type: \"number\" },\n },\n required: [\"pos1\"],\n additionalProperties: false,\n },\n {\n properties: {\n type: { enum: [2] },\n combiningOp: {\n type: \"object\",\n properties: {\n defaultValue: { },\n maxValue: { },\n minValue: { },\n name: { type: \"string\" },\n },\n required: [\"name\"],\n additionalProperties: false,\n },\n pos1: { type: \"number\" },\n pos2: { type: \"number\" },\n props: { type: \"object\" },\n register: { type: \"string\" },\n relativePos1: { $ref: \"#/definitions/relativePos\" },\n relativePos2: { $ref: \"#/definitions/relativePos\" },\n },\n required: [\"props\"],\n additionalProperties: false,\n },\n // There's something weird with the typings/settings here where this doesn't get\n // recognized as a valid Schema array if more than 1 item has \"properties\" defined\n ] as Schema[],\n};\n\nconst mergeTreeGroupOpSchema = {\n type: \"object\",\n properties: {\n ops: {\n type: \"array\",\n items: { $ref: \"#/definitions/deltaOp\" },\n },\n type: {\n type: \"number\",\n minimum: 3 /* MergeTreeDeltaType.GROUP */,\n maximum: 3 /* MergeTreeDeltaType.GROUP */,\n },\n },\n required: [\"ops\", \"type\"],\n additionalProperties: false,\n};\n\nexport const opContentsMergeTreeDeltaOpSchema = {\n definitions: {\n relativePos: mergeTreeRelativePosSchema,\n deltaOp: mergeTreeDeltaOpSchema,\n },\n type: \"object\",\n properties: {\n address: { type: \"string\" },\n contents: { $ref: \"#/definitions/deltaOp\" },\n },\n required: [\"address\", \"contents\"],\n additionalProperties: false,\n};\n\nexport const opContentsMergeTreeGroupOpSchema = {\n definitions: {\n relativePos: mergeTreeRelativePosSchema,\n deltaOp: mergeTreeDeltaOpSchema,\n groupOp: mergeTreeGroupOpSchema,\n },\n type: \"object\",\n properties: {\n address: { type: \"string\" },\n contents: { $ref: \"#/definitions/groupOp\" },\n },\n required: [\"address\", \"contents\"],\n additionalProperties: false,\n};\n"]}
|
package/dist/sanitizer.js
CHANGED
|
@@ -141,7 +141,7 @@ class ChunkedOpProcessor {
|
|
|
141
141
|
let stringified;
|
|
142
142
|
try {
|
|
143
143
|
stringified = JSON.stringify(contents);
|
|
144
|
-
common_utils_1.assert(stringified.length <= this.concatenatedLength, 0x089 /* "Stringified length of chunk contents > total starting length" */);
|
|
144
|
+
(0, common_utils_1.assert)(stringified.length <= this.concatenatedLength, 0x089 /* "Stringified length of chunk contents > total starting length" */);
|
|
145
145
|
}
|
|
146
146
|
catch (e) {
|
|
147
147
|
this.debugMsg(e);
|
|
@@ -175,7 +175,7 @@ class ChunkedOpProcessor {
|
|
|
175
175
|
this.writtenBack = true;
|
|
176
176
|
}
|
|
177
177
|
reset() {
|
|
178
|
-
common_utils_1.assert(this.writtenBack, 0x08a /* "resetting ChunkedOpProcessor that never wrote back its contents" */);
|
|
178
|
+
(0, common_utils_1.assert)(this.writtenBack, 0x08a /* "resetting ChunkedOpProcessor that never wrote back its contents" */);
|
|
179
179
|
this.messages = new Array();
|
|
180
180
|
this.parsedMessageContents = new Array();
|
|
181
181
|
this.writtenBack = false;
|
|
@@ -424,7 +424,7 @@ class Sanitizer {
|
|
|
424
424
|
* @param contents - contents object to fix
|
|
425
425
|
*/
|
|
426
426
|
fixAttachContents(contents) {
|
|
427
|
-
common_utils_1.assert(typeof contents === "object", 0x08b /* "Unexpected type on contents for fix of an attach!" */);
|
|
427
|
+
(0, common_utils_1.assert)(typeof contents === "object", 0x08b /* "Unexpected type on contents for fix of an attach!" */);
|
|
428
428
|
if (!this.objectMatchesSchema(contents, messageSchema_1.attachContentsSchema)) {
|
|
429
429
|
this.replaceObject(contents);
|
|
430
430
|
}
|
|
@@ -488,7 +488,7 @@ class Sanitizer {
|
|
|
488
488
|
contents.address = this.replaceText(contents.address, TextType.FluidObject);
|
|
489
489
|
}
|
|
490
490
|
const innerContent = contents.contents.content;
|
|
491
|
-
common_utils_1.assert(innerContent !== undefined, 0x08c /* "innerContent for fixing op contents is undefined!" */);
|
|
491
|
+
(0, common_utils_1.assert)(innerContent !== undefined, 0x08c /* "innerContent for fixing op contents is undefined!" */);
|
|
492
492
|
if (contents.contents.type === "attach") {
|
|
493
493
|
// attach op
|
|
494
494
|
// handle case where inner content is stringified json
|
|
@@ -656,7 +656,7 @@ class Sanitizer {
|
|
|
656
656
|
}
|
|
657
657
|
});
|
|
658
658
|
// make sure we don't miss an incomplete chunked op at the end
|
|
659
|
-
common_utils_1.assert(!this.chunkProcessor.isPendingProcessing(), 0x08d /* "After sanitize, pending incomplete ops!" */);
|
|
659
|
+
(0, common_utils_1.assert)(!this.chunkProcessor.isPendingProcessing(), 0x08d /* "After sanitize, pending incomplete ops!" */);
|
|
660
660
|
}
|
|
661
661
|
catch (error) {
|
|
662
662
|
this.debugMsg(`Error while processing sequenceNumber ${seq}`);
|