@fluidframework/debugger 2.0.0-internal.3.0.1 → 2.0.0-internal.3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/.eslintrc.js +9 -12
  2. package/README.md +33 -33
  3. package/api-extractor.json +2 -2
  4. package/dist/fluidDebugger.d.ts.map +1 -1
  5. package/dist/fluidDebugger.js.map +1 -1
  6. package/dist/fluidDebuggerController.d.ts.map +1 -1
  7. package/dist/fluidDebuggerController.js +5 -2
  8. package/dist/fluidDebuggerController.js.map +1 -1
  9. package/dist/fluidDebuggerUi.d.ts.map +1 -1
  10. package/dist/fluidDebuggerUi.js +11 -5
  11. package/dist/fluidDebuggerUi.js.map +1 -1
  12. package/dist/messageSchema.js.map +1 -1
  13. package/dist/sanitize.js.map +1 -1
  14. package/dist/sanitizer.d.ts.map +1 -1
  15. package/dist/sanitizer.js +9 -5
  16. package/dist/sanitizer.js.map +1 -1
  17. package/lib/fluidDebugger.d.ts.map +1 -1
  18. package/lib/fluidDebugger.js.map +1 -1
  19. package/lib/fluidDebuggerController.d.ts.map +1 -1
  20. package/lib/fluidDebuggerController.js +5 -2
  21. package/lib/fluidDebuggerController.js.map +1 -1
  22. package/lib/fluidDebuggerUi.d.ts.map +1 -1
  23. package/lib/fluidDebuggerUi.js +11 -5
  24. package/lib/fluidDebuggerUi.js.map +1 -1
  25. package/lib/messageSchema.js.map +1 -1
  26. package/lib/sanitize.js.map +1 -1
  27. package/lib/sanitizer.d.ts.map +1 -1
  28. package/lib/sanitizer.js +9 -5
  29. package/lib/sanitizer.js.map +1 -1
  30. package/package.json +68 -67
  31. package/prettier.config.cjs +1 -1
  32. package/src/fluidDebugger.ts +30 -30
  33. package/src/fluidDebuggerController.ts +348 -322
  34. package/src/fluidDebuggerUi.ts +306 -281
  35. package/src/messageSchema.ts +367 -367
  36. package/src/sanitize.ts +29 -29
  37. package/src/sanitizer.ts +699 -638
  38. package/tsconfig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d,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"]}
1
+ {"version":3,"file":"messageSchema.js","sourceRoot":"","sources":["../src/messageSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,IAAI,EAAE,MAAM;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACX,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,MAAM,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACX,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,E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AE,MAAM,CAAC;IACzB,oBAAoB,EAAE,KAAK;CAC3B,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC/C,WAAW,EAAE;QACZ,WAAW,EAAE,0BAA0B;QACvC,OAAO,EAAE,sBAAsB;KAC/B;IACD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACX,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE;KAC3C;IACD,QAAQ,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;IACjC,oBAAoB,EAAE,KAAK;CAC3B,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC/C,WAAW,EAAE;QACZ,WAAW,EAAE,0BAA0B;QACvC,OAAO,EAAE,sBAAsB;QAC/B,OAAO,EAAE,sBAAsB;KAC/B;IACD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACX,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,QAAQ,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE;KAC3C;IACD,QAAQ,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;IACjC,oBAAoB,EAAE,KAAK;CAC3B,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\ttype: \"null\",\n};\n\nexport const joinDataSchema = {\n\ttype: \"object\",\n\tproperties: {\n\t\tclientId: { type: \"string\" },\n\t\tdetail: {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tdetails: { type: \"object\" },\n\t\t\t\tmode: { type: \"string\" },\n\t\t\t\tpermission: { type: \"array\" },\n\t\t\t\tscopes: { type: \"array\" },\n\t\t\t\ttype: { type: \"string\" },\n\t\t\t\tuser: {\n\t\t\t\t\ttype: \"object\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tid: { type: \"string\" },\n\t\t\t\t\t\tname: { type: \"string\" },\n\t\t\t\t\t\temail: { type: \"string\" },\n\t\t\t\t\t},\n\t\t\t\t\trequired: [\"id\", \"name\", \"email\"],\n\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t},\n\t\t\t},\n\t\t\trequired: [\"user\"],\n\t\t\tadditionalProperties: false,\n\t\t},\n\t},\n\trequired: [\"clientId\", \"detail\"],\n\tadditionalProperties: false,\n};\n\nexport const proposeContentsSchema = {\n\ttype: [\"string\", \"object\"],\n\tproperties: {\n\t\tkey: { type: \"string\" },\n\t\tvalue: { type: \"string\" },\n\t},\n\trequired: [\"key\"],\n\tadditionalProperties: false,\n};\n\n// The parsed json of a propose message's contents value\nexport const proposeCodeSchema = {\n\ttype: \"object\",\n\tproperties: {\n\t\tkey: { type: \"string\" },\n\t\tvalue: {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tpackage: {\n\t\t\t\t\ttype: \"object\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tname: { type: \"string\" },\n\t\t\t\t\t\tversion: { type: \"string\" },\n\t\t\t\t\t\tfluid: { type: \"object\" },\n\t\t\t\t\t},\n\t\t\t\t\trequired: [\"name\"],\n\t\t\t\t},\n\t\t\t\tconfig: { type: \"object\" },\n\t\t\t},\n\t\t\trequired: [\"package\", \"config\"],\n\t\t\tadditionalProperties: false,\n\t\t},\n\t},\n\trequired: [\"key\", \"value\"],\n\tadditionalProperties: false,\n};\n\n// This also needs to be in the root \"definitions\" key as \"entries\" to be used\nconst attachSnapshotEntriesSchema = {\n\ttype: \"object\",\n\tproperties: {\n\t\tmode: { type: \"string\" },\n\t\tpath: { type: \"string\" },\n\t\ttype: { enum: [\"Blob\", \"Tree\"] },\n\t\tvalue: {\n\t\t\ttype: \"object\",\n\t\t\toneOf: [\n\t\t\t\t// type Blob\n\t\t\t\t{\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tcontents: { type: \"string\" },\n\t\t\t\t\t\tencoding: { type: \"string\" },\n\t\t\t\t\t\t// Verify this\n\t\t\t\t\t\tid: { type: \"null\" },\n\t\t\t\t\t},\n\t\t\t\t\trequired: [\"contents\", \"encoding\"],\n\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t},\n\t\t\t\t// type Tree\n\t\t\t\t{\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tentries: {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\titems: { $ref: \"#/definitions/entries\" },\n\t\t\t\t\t\t},\n\t\t\t\t\t\t// Verify this\n\t\t\t\t\t\tid: { type: \"null\" },\n\t\t\t\t\t},\n\t\t\t\t\trequired: [\"entries\"],\n\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\trequired: [\"mode\", \"path\", \"type\", \"value\"],\n\tadditionalProperties: false,\n};\n\nexport const attachContentsSchema = {\n\tdefinitions: {\n\t\tentries: attachSnapshotEntriesSchema,\n\t},\n\ttype: \"object\",\n\tproperties: {\n\t\tid: { type: \"string\" },\n\t\tsnapshot: {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tentries: {\n\t\t\t\t\ttype: \"array\",\n\t\t\t\t\titems: { $ref: \"#/definitions/entries\" },\n\t\t\t\t},\n\t\t\t\t// Verify this\n\t\t\t\tid: { type: \"null\" },\n\t\t\t},\n\t\t\trequired: [\"entries\"],\n\t\t\tadditionalProperties: false,\n\t\t},\n\t\ttype: { type: \"string\" },\n\t},\n\trequired: [\"id\", \"snapshot\", \"type\"],\n\tadditionalProperties: false,\n};\n\n// can exist at the root level or within an op\nexport const chunkedOpContentsSchema = {\n\ttype: \"object\",\n\tproperties: {\n\t\tchunkId: { type: \"number\" },\n\t\tcontents: { type: \"string\" },\n\t\toriginalType: { type: \"string\" },\n\t\ttotalChunks: { type: \"number\" },\n\t},\n\trequired: [\"chunkId\", \"contents\", \"originalType\", \"totalChunks\"],\n\tadditionalProperties: false,\n};\n\nconst contentsSchema = {\n\ttype: \"object\",\n\tproperties: {\n\t\taddress: { type: \"string\" },\n\t\tcontents: {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tcontent: { type: \"object\" },\n\t\t\t\ttype: { type: \"string\" },\n\t\t\t},\n\t\t\trequired: [\"content\", \"type\"],\n\t\t\tadditionalProperties: false,\n\t\t},\n\t},\n\trequired: [\"address\", \"contents\"],\n\tadditionalProperties: false,\n};\n\n// special contents formats from containerRuntime.ts's ContainerMessageType\nexport const opContentsSchema = {\n\tdefinitions: {\n\t\tcontent: contentsSchema,\n\t\tentries: attachSnapshotEntriesSchema,\n\t\tattachContents: attachContentsSchema,\n\t\tchunkedOpContents: chunkedOpContentsSchema,\n\t},\n\ttype: \"object\",\n\toneOf: [\n\t\t{\n\t\t\tproperties: {\n\t\t\t\ttype: { enum: [\"component\"] },\n\t\t\t\tcontents: { $ref: \"#/definitions/content\" },\n\t\t\t},\n\t\t\trequired: [\"type\", \"contents\"],\n\t\t\tadditionalProperties: false,\n\t\t},\n\t\t{\n\t\t\tproperties: {\n\t\t\t\ttype: { enum: [\"attach\"] },\n\t\t\t\tcontents: { $ref: \"#/definitions/attachContents\" },\n\t\t\t},\n\t\t\trequired: [\"type\", \"contents\"],\n\t\t\tadditionalProperties: false,\n\t\t},\n\t\t{\n\t\t\tproperties: {\n\t\t\t\ttype: { enum: [\"chunkedOp\"] },\n\t\t\t\tcontents: { $ref: \"#/definitions/chunkedOpContents\" },\n\t\t\t},\n\t\t\trequired: [\"type\", \"contents\"],\n\t\t\tadditionalProperties: false,\n\t\t},\n\t\t{\n\t\t\t$ref: \"#/definitions/content\",\n\t\t},\n\t],\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\ttype: \"object\",\n\tproperties: {\n\t\taddress: { type: \"string\" },\n\t\tcontents: {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tkey: { type: \"string\" },\n\t\t\t\trefSeq: { type: \"number\" },\n\t\t\t\tserializedValue: { type: \"string\" },\n\t\t\t\tvalue: {\n\t\t\t\t\ttype: \"object\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\ttype: { type: \"string\" },\n\t\t\t\t\t\tvalue: {},\n\t\t\t\t\t},\n\t\t\t\t\trequired: [\"type\", \"value\"],\n\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t},\n\t\t\t\ttype: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tenum: [\"write\"],\n\t\t\t\t},\n\t\t\t},\n\t\t\trequired: [\"key\", \"type\"],\n\t\t\tadditionalProperties: false,\n\t\t},\n\t},\n\trequired: [\"address\", \"contents\"],\n\tadditionalProperties: false,\n};\n\n// Ops from dds/map's directory.ts\nexport const opContentsMapSchema = {\n\ttype: \"object\",\n\tproperties: {\n\t\taddress: { type: \"string\" },\n\t\tcontents: {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tkey: { type: \"string\" },\n\t\t\t\tpath: { type: \"string\" },\n\t\t\t\tsubdirName: { type: \"string\" },\n\t\t\t\tvalue: {\n\t\t\t\t\ttype: \"object\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\ttype: { type: \"string\" },\n\t\t\t\t\t\tvalue: {},\n\t\t\t\t\t},\n\t\t\t\t\trequired: [\"type\"],\n\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t},\n\t\t\t\ttype: {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tenum: [\n\t\t\t\t\t\t\"act\",\n\t\t\t\t\t\t\"set\",\n\t\t\t\t\t\t\"delete\",\n\t\t\t\t\t\t\"clear\",\n\t\t\t\t\t\t\"createSubDirectory\",\n\t\t\t\t\t\t\"deleteSubDirectory\",\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\trequired: [\"type\"],\n\t\t\tadditionalProperties: false,\n\t\t\t// specific property combinations based on type value\n\t\t\toneOf: [\n\t\t\t\t{\n\t\t\t\t\tproperties: { type: { enum: [\"act\"] } },\n\t\t\t\t\trequired: [\"key\", \"path\", \"value\"],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperties: { type: { enum: [\"set\"] } },\n\t\t\t\t\trequired: [\"key\", \"value\"],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperties: { type: { enum: [\"delete\"] } },\n\t\t\t\t\trequired: [\"key\"],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperties: { type: { enum: [\"clear\"] } },\n\t\t\t\t\trequired: [\"path\"],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperties: { type: { enum: [\"createSubDirectory\", \"deleteSubDirectory\"] } },\n\t\t\t\t\trequired: [\"path\", \"subdirName\"],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\trequired: [\"address\", \"contents\"],\n\tadditionalProperties: 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\ttype: \"object\",\n\tproperties: {\n\t\tid: { type: \"string\" },\n\t\tbefore: { type: \"boolean\" },\n\t\toffset: { type: \"number\" },\n\t},\n\tadditionalProperties: false,\n};\n\nconst mergeTreeDeltaOpSchema = {\n\ttype: \"object\",\n\tproperties: {\n\t\ttype: {\n\t\t\ttype: \"number\",\n\t\t\tminimum: 0 /* MergeTreeDeltaType.INSERT */,\n\t\t\tmaximum: 2 /* MergeTreeDeltaType.ANNOTATE */,\n\t\t},\n\t},\n\trequired: [\"type\"],\n\toneOf: [\n\t\t{\n\t\t\tproperties: {\n\t\t\t\ttype: { enum: [0] },\n\t\t\t\tseg: { type: [\"string\", \"object\"] },\n\t\t\t\tpos1: { type: \"number\" },\n\t\t\t},\n\t\t\trequired: [\"pos1\"],\n\t\t\tadditionalProperties: false,\n\t\t},\n\t\t{\n\t\t\tproperties: {\n\t\t\t\ttype: { enum: [1] },\n\t\t\t\tregister: { type: \"string\" },\n\t\t\t\tpos1: { type: \"number\" },\n\t\t\t\tpos2: { type: \"number\" },\n\t\t\t},\n\t\t\trequired: [\"pos1\"],\n\t\t\tadditionalProperties: false,\n\t\t},\n\t\t{\n\t\t\tproperties: {\n\t\t\t\ttype: { enum: [2] },\n\t\t\t\tcombiningOp: {\n\t\t\t\t\ttype: \"object\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tdefaultValue: {},\n\t\t\t\t\t\tmaxValue: {},\n\t\t\t\t\t\tminValue: {},\n\t\t\t\t\t\tname: { type: \"string\" },\n\t\t\t\t\t},\n\t\t\t\t\trequired: [\"name\"],\n\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t},\n\t\t\t\tpos1: { type: \"number\" },\n\t\t\t\tpos2: { type: \"number\" },\n\t\t\t\tprops: { type: \"object\" },\n\t\t\t\tregister: { type: \"string\" },\n\t\t\t\trelativePos1: { $ref: \"#/definitions/relativePos\" },\n\t\t\t\trelativePos2: { $ref: \"#/definitions/relativePos\" },\n\t\t\t},\n\t\t\trequired: [\"props\"],\n\t\t\tadditionalProperties: false,\n\t\t},\n\t\t// There's something weird with the typings/settings here where this doesn't get\n\t\t// recognized as a valid Schema array if more than 1 item has \"properties\" defined\n\t] as Schema[],\n};\n\nconst mergeTreeGroupOpSchema = {\n\ttype: \"object\",\n\tproperties: {\n\t\tops: {\n\t\t\ttype: \"array\",\n\t\t\titems: { $ref: \"#/definitions/deltaOp\" },\n\t\t},\n\t\ttype: {\n\t\t\ttype: \"number\",\n\t\t\tminimum: 3 /* MergeTreeDeltaType.GROUP */,\n\t\t\tmaximum: 3 /* MergeTreeDeltaType.GROUP */,\n\t\t},\n\t},\n\trequired: [\"ops\", \"type\"],\n\tadditionalProperties: false,\n};\n\nexport const opContentsMergeTreeDeltaOpSchema = {\n\tdefinitions: {\n\t\trelativePos: mergeTreeRelativePosSchema,\n\t\tdeltaOp: mergeTreeDeltaOpSchema,\n\t},\n\ttype: \"object\",\n\tproperties: {\n\t\taddress: { type: \"string\" },\n\t\tcontents: { $ref: \"#/definitions/deltaOp\" },\n\t},\n\trequired: [\"address\", \"contents\"],\n\tadditionalProperties: false,\n};\n\nexport const opContentsMergeTreeGroupOpSchema = {\n\tdefinitions: {\n\t\trelativePos: mergeTreeRelativePosSchema,\n\t\tdeltaOp: mergeTreeDeltaOpSchema,\n\t\tgroupOp: mergeTreeGroupOpSchema,\n\t},\n\ttype: \"object\",\n\tproperties: {\n\t\taddress: { type: \"string\" },\n\t\tcontents: { $ref: \"#/definitions/groupOp\" },\n\t},\n\trequired: [\"address\", \"contents\"],\n\tadditionalProperties: false,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,SAAS,UAAU;IACf,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,CAAC,iGAAiG,CAAC,CAAC;IAC/G,OAAO,CAAC,GAAG,CAAC,4EAA4E,CAAC,CAAC;IAC1F,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,QAAQ,CAAC,OAA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ensed 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 \"fs\";\nimport process from \"process\";\nimport {\n ISequencedDocumentMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { Sanitizer } from \"./sanitizer\";\n\nfunction printUsage() {\n console.log(\"Usage:\");\n console.log(\" node sanitize [--full | --noBail] <input>\");\n console.log(\"Where\");\n console.log(\" [--full] - scrub fully (result cannot be loaded in Fluid Preview)\");\n console.log(\" [--noBail] - don't bail out when encountering an unknown message format (it won't be scrubbed\");\n console.log(\" <input> - file path to message.json - file downloaded by FluidFetch tool\");\n console.log(\"Note: <input> is sanitized in place\");\n process.exit(-1);\n}\n\nfunction Sanitize(msgPath: string, fullScrub: boolean, noBail: boolean) {\n const input = fs.readFileSync(msgPath, { encoding: \"utf-8\" });\n const messages = JSON.parse(input) as ISequencedDocumentMessage[];\n\n const sanitizer = new Sanitizer(messages, fullScrub, noBail, true);\n const cleanMessages = sanitizer.sanitize();\n\n fs.writeFileSync(msgPath, JSON.stringify(cleanMessages, undefined, 2));\n\n console.log(\"Done.\");\n}\n\nfunction main() {\n if (process.argv.length === 3) {\n return Sanitize(process.argv[2], false, false);\n }\n if (process.argv.length === 4) {\n if (process.argv[2] === \"--full\") {\n return Sanitize(process.argv[3], true, false);\n }\n if (process.argv[2] === \"--noBail\") {\n return Sanitize(process.argv[3], false, true);\n }\n }\n printUsage();\n}\n\nmain();\n"]}
1
+ {"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"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EAAE;QAC9B,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;KAC/C;IACD,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC9B,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;YACjC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;SAC9C;QACD,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE;YACnC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;SAC9C;KACD;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 \"fs\";\nimport process from \"process\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { Sanitizer } from \"./sanitizer\";\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\treturn Sanitize(process.argv[2], false, false);\n\t}\n\tif (process.argv.length === 4) {\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\treturn Sanitize(process.argv[3], false, true);\n\t\t}\n\t}\n\tprintUsage();\n}\n\nmain();\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sanitizer.d.ts","sourceRoot":"","sources":["../src/sanitizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAExC,OAAO,EACH,yBAAyB,EAC5B,MAAM,sCAAsC,CAAC;AAc9C,aAAK,QAAQ;IACT,OAAO,IAAA;IACP,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,WAAW,IAAA;IACX,MAAM,IAAA;CACT;AASD;;;;;GAKG;AACH,cAAM,kBAAkB;IAqBhB,QAAQ,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,OAAO;IAChE,QAAQ,CAAC,KAAK,EAAE,OAAO;IArB3B;;;;OAIG;IACH,OAAO,CAAC,QAA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31,7 +31,9 @@ var TextType;
31
31
  // that matches nothing
32
32
  const falseResult = {
33
33
  valid: false,
34
- toString: () => { return "Unmatched format"; },
34
+ toString: () => {
35
+ return "Unmatched format";
36
+ },
35
37
  };
36
38
  /**
37
39
  * Class that takes chunkedOp messages and can provide their concatenated
@@ -87,7 +89,8 @@ class ChunkedOpProcessor {
87
89
  }
88
90
  hasAllMessages() {
89
91
  const lastMsgContents = this.parsedMessageContents[this.parsedMessageContents.length - 1];
90
- return lastMsgContents.chunkId !== undefined && lastMsgContents.chunkId === lastMsgContents.totalChunks;
92
+ return (lastMsgContents.chunkId !== undefined &&
93
+ lastMsgContents.chunkId === lastMsgContents.totalChunks);
91
94
  }
92
95
  /**
93
96
  * @returns The concatenated contents of all the messages parsed as json
@@ -431,9 +434,10 @@ export class Sanitizer {
431
434
  }
432
435
  }
433
436
  fixDeltaOp(deltaOp) {
434
- deltaOp.seg = typeof deltaOp.seg === "string"
435
- ? this.replaceText(deltaOp.seg)
436
- : this.replaceObject(deltaOp.seg, this.mergeTreeExcludedKeys);
437
+ deltaOp.seg =
438
+ typeof deltaOp.seg === "string"
439
+ ? this.replaceText(deltaOp.seg)
440
+ : this.replaceObject(deltaOp.seg, this.mergeTreeExcludedKeys);
437
441
  }
438
442
  /**
439
443
  * Fix the contents object for an op message. Does not do extra type handling. Does
@@ -1 +1 @@
1
- {"version":3,"file":"sanitizer.js","sourceRoot":"","sources":["../src/sanitizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAItD,OAAO,EACH,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,gCAAgC,EAChC,gCAAgC,EAChC,kCAAkC,EAClC,qBAAqB,GACxB,MAAM,iBAAiB,CAAC;AAEzB,IA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AQ,CAAC,sBAAsB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;iBAC3D;YACL,CAAC,CAAC,CAAC;YAEH,8DAA8D;YAC9D,MAAM,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,mBAAmB,EAAE,EAAE,KAAK,CAAC,+CAA+C,CAAC,CAAC;SAC7G;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,CAAC,QAAQ,CAAC,yCAAyC,GAAG,EAAE,CAAC,CAAC;YAC9D,MAAM,KAAK,CAAC;SACf;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;CACJ","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 * as Validator from \"jsonschema\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n ISequencedDocumentMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n attachContentsSchema,\n chunkedOpContentsSchema,\n joinContentsSchema,\n joinDataSchema,\n opContentsMapSchema,\n opContentsSchema,\n opContentsMergeTreeDeltaOpSchema,\n opContentsMergeTreeGroupOpSchema,\n opContentsRegisterCollectionSchema,\n proposeContentsSchema,\n} from \"./messageSchema\";\n\nenum TextType {\n Generic,\n Email,\n Name,\n FluidObject,\n MapKey,\n}\n\n// Workaround to jsonschema package not supporting \"false\" as a schema\n// that matches nothing\nconst falseResult = {\n valid: false,\n toString: () => { return \"Unmatched format\"; },\n};\n\n/**\n * Class that takes chunkedOp messages and can provide their concatenated\n * contents along with re-write sanitized content in-place back into the\n * messages. Assumes sanitized messages are always less than or equal in\n * size to the original message.\n */\nclass ChunkedOpProcessor {\n /**\n * Message references so we can replace their contents in-place. These can\n * be top-level chunkedOp messages, or top-level op messages with a chunkedOp\n * within the contents\n */\n private messages = new Array<any>();\n /**\n * The messages' parsed contents for processing. Should parallel the\n * messages member\n */\n private parsedMessageContents = new Array<any>();\n private writtenBack = false;\n /**\n * keep track of the total starting length to make sure we don't somehow end\n * up with more content than we started with (meaning we may not be able to\n * write it back)\n */\n private concatenatedLength = 0;\n\n constructor(\n readonly validateSchemaFn: (object: any, schema: any) => boolean,\n readonly debug: boolean,\n ) { }\n\n debugMsg(msg: any) {\n if (this.debug) {\n console.error(msg);\n }\n }\n\n addMessage(message: any): void {\n this.messages.push(message);\n\n let parsed;\n try {\n parsed = JSON.parse(message.contents);\n if (message.type === \"op\") {\n // nested within a regular op\n // need to go deeper to get the desired contents\n parsed = parsed.contents;\n }\n } catch (e) {\n this.debugMsg(e);\n this.debugMsg(message.contents);\n }\n this.validateSchemaFn(parsed, chunkedOpContentsSchema);\n this.parsedMessageContents.push(parsed);\n }\n\n hasAllMessages(): boolean {\n const lastMsgContents = this.parsedMessageContents[this.parsedMessageContents.length - 1];\n return lastMsgContents.chunkId !== undefined && lastMsgContents.chunkId === lastMsgContents.totalChunks;\n }\n\n /**\n * @returns The concatenated contents of all the messages parsed as json\n */\n getConcatenatedContents(): any {\n const contentsString = this.parsedMessageContents.reduce((previousValue: string, currentValue: any) => {\n return previousValue + (currentValue.contents as string);\n }, \"\");\n\n this.concatenatedLength = contentsString.length;\n try {\n return JSON.parse(contentsString);\n } catch (e) {\n this.debugMsg(contentsString);\n this.debugMsg(e);\n return undefined;\n }\n }\n\n /**\n * Write back sanitized contents into the messages. The contents are\n * stringified, split up, and written in place to the messages that\n * were added earlier. The number of messages is preserved.\n * @param contents - Sanitized contents to write back\n */\n writeSanitizedContents(contents: any): void {\n // Write back a chunk size equal to the original\n const chunkSize = this.parsedMessageContents[0].contents.length;\n\n let stringified: string;\n try {\n stringified = JSON.stringify(contents);\n assert(stringified.length <= this.concatenatedLength,\n 0x089 /* \"Stringified length of chunk contents > total starting length\" */);\n } catch (e) {\n this.debugMsg(e);\n throw e;\n }\n\n for (let i = 0; i < this.messages.length; i++) {\n const substring = stringified.substring(i * chunkSize, (i + 1) * chunkSize);\n\n const parsedContents = this.parsedMessageContents[i];\n parsedContents.contents = substring;\n const message = this.messages[i];\n\n let stringifiedParsedContents;\n try {\n // for nested chunkedOps, we need to recreate the extra nesting layer\n // we removed earlier when adding the message\n if (message.type === \"op\") {\n const nestingLayer = {\n type: \"chunkedOp\",\n contents: parsedContents,\n };\n stringifiedParsedContents = JSON.stringify(nestingLayer);\n } else {\n stringifiedParsedContents = JSON.stringify(parsedContents);\n }\n } catch (e) {\n this.debugMsg(e);\n }\n\n message.contents = stringifiedParsedContents;\n }\n\n this.writtenBack = true;\n }\n\n reset(): void {\n assert(this.writtenBack, 0x08a /* \"resetting ChunkedOpProcessor that never wrote back its contents\" */);\n this.messages = new Array<any>();\n this.parsedMessageContents = new Array<any>();\n this.writtenBack = false;\n this.concatenatedLength = 0;\n }\n\n isPendingProcessing(): boolean {\n return this.messages.length !== 0;\n }\n}\n\nexport class Sanitizer {\n readonly validator = new Validator.Validator();\n // Represents the keys used to store Fluid object identifiers, snapshot info,\n // and other string fields that should not be replaced in contents blobs to\n // ensure the messages are still usable\n readonly defaultExcludedKeys = new Set<string>();\n // Represents the keys used by merge-tree ops their \"seg\" property, where other\n // keys represent user information\n readonly mergeTreeExcludedKeys = new Set<string>();\n // Map of user information to what it was replaced with. Used to ensure the same\n // data have the same replacements\n readonly replacementMap = new Map<string, string>();\n\n /**\n * Validate that the provided message matches the provided schema.\n * For a full scrub, warn and continue (scrubber should fully sanitize unexpected\n * fields for ops), otherwise throw an error because we cannot be sure user\n * information is being sufficiently sanitized.\n */\n objectMatchesSchema = (object: any, schema: any): boolean => {\n const result = schema === false ? falseResult : this.validator.validate(object, schema);\n if (!result.valid) {\n const errorMsg = `Bad msg fmt:\\n${result.toString()}\\n${JSON.stringify(object, undefined, 2)}`;\n\n if (this.fullScrub || this.noBail) {\n this.debugMsg(errorMsg);\n } else {\n throw new Error(errorMsg);\n }\n }\n return result.valid;\n };\n\n readonly chunkProcessor = new ChunkedOpProcessor(this.objectMatchesSchema, this.debug);\n\n constructor(\n readonly messages: ISequencedDocumentMessage[],\n readonly fullScrub: boolean,\n readonly noBail: boolean,\n readonly debug: boolean = false,\n ) {\n this.defaultExcludedKeys.add(\"type\");\n this.defaultExcludedKeys.add(\"id\");\n this.defaultExcludedKeys.add(\"pkg\");\n this.defaultExcludedKeys.add(\"snapshotFormatVersion\");\n this.defaultExcludedKeys.add(\"packageVersion\");\n this.mergeTreeExcludedKeys.add(\"nodeType\");\n }\n\n debugMsg(msg: any) {\n if (this.debug) {\n console.error(msg);\n }\n }\n\n isFluidObjectKey(key: string): boolean {\n return key === \"type\" || key === \"id\";\n }\n\n getRandomText(len: number): string {\n let str = \"\";\n while (str.length < len) {\n str = str + Math.random().toString(36).substring(2);\n }\n return str.substr(0, len);\n }\n\n readonly wordTokenRegex = /\\S+/g;\n\n readonly replaceRandomTextFn = (match: string): string => {\n if (this.replacementMap.has(match)) {\n return this.replacementMap.get(match)!;\n }\n\n const replacement = this.getRandomText(match.length);\n this.replacementMap.set(match, replacement);\n return replacement;\n };\n\n /**\n * Replace text with garbage. FluidObject types are not replaced when not under\n * full scrub mode. All other text is replaced consistently.\n */\n replaceText(input?: string, type: TextType = TextType.Generic): string | undefined {\n if (input === undefined) {\n return undefined;\n }\n\n if (type === TextType.FluidObject) {\n if (this.replacementMap.has(input)) {\n return this.replacementMap.get(input)!;\n }\n\n const replacement = this.fullScrub ? this.getRandomText(input.length) : input;\n\n this.replacementMap.set(input, replacement);\n return replacement;\n }\n\n return input.replace(this.wordTokenRegex, this.replaceRandomTextFn);\n }\n\n replaceArray(input: any[]): any[] {\n for (let i = 0; i < input.length; i++) {\n const value = input[i];\n if (typeof value === \"string\") {\n input[i] = this.replaceText(value);\n } else if (Array.isArray(value)) {\n input[i] = this.replaceArray(value);\n } else if (typeof value === \"object\") {\n input[i] = this.replaceObject(value);\n }\n }\n return input;\n }\n\n /**\n * (sort of) recurses down the values of a JSON object to sanitize all its strings\n * (only checks strings, arrays, and objects)\n * @param input - The object to sanitize\n * @param excludedKeys - object keys for which to skip replacement when not in fullScrub\n */\n replaceObject(input: object | null, excludedKeys: Set<string> = this.defaultExcludedKeys): object | null {\n // File might contain actual nulls\n if (input === null || input === undefined) {\n return input;\n }\n\n const keys = Object.keys(input);\n keys.forEach((key) => {\n if (this.fullScrub || !excludedKeys.has(key)) {\n const value = input[key];\n if (typeof value === \"string\") {\n input[key] = this.replaceText(\n value,\n this.isFluidObjectKey(key) ? TextType.FluidObject : TextType.Generic,\n );\n } else if (Array.isArray(value)) {\n input[key] = this.replaceArray(value);\n } else if (typeof value === \"object\") {\n input[key] = this.replaceObject(value, excludedKeys);\n }\n }\n });\n return input;\n }\n\n /**\n * Replacement on an unknown type or a parsed root level object\n * without a key\n * @param input - The object to sanitize\n * @param excludedKeys - object keys for which to skip replacement when not in fullScrub\n */\n replaceAny(input: any, excludedKeys: Set<string> = this.defaultExcludedKeys): any {\n if (input === null || input === undefined) {\n return input;\n }\n\n if (typeof input === \"string\") {\n return this.replaceText(input);\n } else if (Array.isArray(input)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return this.replaceArray(input);\n } else if (typeof input === \"object\") {\n return this.replaceObject(input, excludedKeys);\n }\n\n // Don't run replacement on any other types\n return input;\n }\n\n fixJoin(message: any) {\n if (!this.objectMatchesSchema(message.contents, joinContentsSchema)) {\n message.contents = this.replaceAny(message.contents);\n }\n\n try {\n let data = JSON.parse(message.data);\n if (!this.objectMatchesSchema(data, joinDataSchema)) {\n data = this.replaceAny(data);\n } else {\n const user = data.detail.user;\n user.id = this.replaceText(user.id, TextType.Email);\n user.email = this.replaceText(user.email, TextType.Email);\n user.name = this.replaceText(user.name, TextType.Name);\n }\n\n message.data = JSON.stringify(data);\n } catch (e) {\n this.debugMsg(e);\n }\n }\n\n fixPropose(message: any) {\n if (!this.objectMatchesSchema(message.contents, proposeContentsSchema)) {\n message.contents = this.replaceAny(message.contents);\n } else {\n if (typeof message.contents === \"string\") {\n try {\n const data = JSON.parse(message.contents);\n if (this.fullScrub) {\n const pkg = data.value?.package;\n if (pkg?.name) {\n pkg.name = this.replaceText(pkg.name, TextType.FluidObject);\n }\n if (Array.isArray(pkg?.fluid?.browser?.umd?.files)) {\n pkg.fluid.browser.umd.files = this.replaceArray(pkg.fluid.browser.umd.files);\n }\n }\n } catch (e) {\n this.debugMsg(e);\n }\n } else {\n if (this.fullScrub) {\n message.contents.value = this.replaceText(message.contents.value, TextType.FluidObject);\n }\n }\n }\n }\n\n fixAttachEntries(entries: any[]) {\n entries.forEach((element) => {\n // Tree type\n if (element.value.entries) {\n this.fixAttachEntries(element.value.entries);\n } else {\n // Blob (leaf) type\n try {\n if (typeof element.value.contents === \"string\") {\n let data = JSON.parse(element.value.contents);\n data = this.replaceObject(data);\n element.value.contents = JSON.stringify(data);\n }\n } catch (e) {\n this.debugMsg(e);\n }\n }\n });\n }\n\n /**\n * Fix the content of an attach in place\n * @param contents - contents object to fix\n */\n fixAttachContents(contents: any): any {\n assert(typeof contents === \"object\", 0x08b /* \"Unexpected type on contents for fix of an attach!\" */);\n if (!this.objectMatchesSchema(contents, attachContentsSchema)) {\n this.replaceObject(contents);\n } else {\n if (this.fullScrub) {\n contents.id = this.replaceText(contents.id, TextType.FluidObject);\n contents.type = this.replaceText(contents.type, TextType.FluidObject);\n }\n\n this.fixAttachEntries(contents.snapshot.entries);\n }\n }\n\n /**\n * Fix an attach message at the root level or a ContainerMessageType attach. Attach\n * messages found within an op message should instead have their contents parsed out\n * and sent to fixAttachContents.\n * @param message - The attach message to fix\n * @param withinOp - If the message is from within an op message (as opposed to being\n * an attach message at the root level). Root level attach messages have \"snapshot\"\n * under a \"contents\" key, whereas attach messages from within an op message have it\n * under a \"content\" key\n */\n fixAttach(message: any) {\n // Handle case where contents is stringified json\n if (typeof message.contents === \"string\") {\n try {\n const data = JSON.parse(message.contents);\n this.fixAttachContents(data);\n message.contents = JSON.stringify(data);\n } catch (e) {\n this.debugMsg(e);\n return;\n }\n } else {\n this.fixAttachContents(message.contents);\n }\n }\n\n fixDeltaOp(deltaOp: any) {\n deltaOp.seg = typeof deltaOp.seg === \"string\"\n ? this.replaceText(deltaOp.seg)\n : this.replaceObject(deltaOp.seg, this.mergeTreeExcludedKeys);\n }\n\n /**\n * Fix the contents object for an op message. Does not do extra type handling. Does\n * not handle special container message types like \"attach\", \"component\", and\n * \"chunkedOp\" (these should be handled by the caller)\n * @param contents - The contents object for an op message. If it was a string in the\n * message, it must have been converted to an object first\n */\n fixOpContentsObject(contents: any) {\n // do replacement\n if (!this.objectMatchesSchema(contents, opContentsSchema)) {\n this.replaceAny(contents);\n } else {\n if (this.fullScrub) {\n contents.address = this.replaceText(contents.address, TextType.FluidObject);\n }\n\n const innerContent = contents.contents.content;\n assert(innerContent !== undefined, 0x08c /* \"innerContent for fixing op contents is undefined!\" */);\n if (contents.contents.type === \"attach\") {\n // attach op\n // handle case where inner content is stringified json\n if (typeof contents.contents.content === \"string\") {\n try {\n const data = JSON.parse(contents.contents.content);\n this.fixAttachContents(data);\n contents.contents.content = JSON.stringify(data);\n } catch (e) {\n this.debugMsg(e);\n }\n } else {\n this.fixAttachContents(contents.contents.content);\n }\n } else if (this.validator.validate(innerContent, opContentsMapSchema).valid) {\n // map op\n if (this.fullScrub) {\n innerContent.address = this.replaceText(innerContent.address, TextType.FluidObject);\n innerContent.contents.key = this.replaceText(innerContent.contents.key, TextType.MapKey);\n }\n if (innerContent.contents.value !== undefined) {\n innerContent.contents.value.value = this.replaceAny(innerContent.contents.value.value);\n }\n } else if (this.validator.validate(innerContent, opContentsMergeTreeGroupOpSchema).valid) {\n // merge tree group op\n if (this.fullScrub) {\n innerContent.address = this.replaceText(innerContent.address, TextType.FluidObject);\n }\n innerContent.contents.ops.forEach((deltaOp) => {\n this.fixDeltaOp(deltaOp);\n });\n } else if (this.validator.validate(innerContent, opContentsMergeTreeDeltaOpSchema).valid) {\n // merge tree delta op\n if (this.fullScrub) {\n innerContent.address = this.replaceText(innerContent.address, TextType.FluidObject);\n }\n this.fixDeltaOp(innerContent.contents);\n } else if (this.validator.validate(innerContent, opContentsRegisterCollectionSchema).valid) {\n // register collection op\n if (this.fullScrub) {\n innerContent.address = this.replaceText(innerContent.address, TextType.FluidObject);\n innerContent.contents.key = this.replaceText(innerContent.contents.key, TextType.MapKey);\n }\n if (innerContent.contents.value !== undefined) {\n innerContent.contents.value.value = this.replaceAny(innerContent.contents.value.value);\n }\n } else {\n // message contents don't match any known op format\n this.objectMatchesSchema(contents, false);\n }\n }\n }\n\n fixOp(message: any) {\n // handle case where contents is stringified json\n let msgContents;\n if (typeof message.contents === \"string\") {\n try {\n msgContents = JSON.parse(message.contents);\n } catch (e) {\n this.debugMsg(e);\n return;\n }\n } else {\n msgContents = message.contents;\n }\n\n // handle container message types\n switch (msgContents.type) {\n case \"attach\": {\n // this one is like a regular attach op, except its contents aren't nested as deep\n // run fixAttach directly and return\n this.fixAttach(msgContents);\n break;\n }\n case \"component\": {\n // this one functionally nests its contents one layer deeper\n // bring up the contents object and continue as usual\n this.fixOpContentsObject(msgContents.contents);\n break;\n }\n case \"chunkedOp\": {\n // this is a (regular?) op split into multiple parts due to size, e.g. because it\n // has an attached image, and where the chunkedOp is within the top-level op's contents\n // (as opposed to being at the top-level). The contents of the chunks need to be\n // concatenated to form the complete stringified json object\n // Early return here to skip re-stringify because no changes are made until the last\n // chunk, and the ChunkedOpProcessor will handle everything at that point\n return this.fixChunkedOp(message);\n }\n case \"blobAttach\": {\n // TODO: handle this properly once blob api is used\n this.debugMsg(\"TODO: blobAttach ops are skipped/unhandled\");\n return;\n }\n default: {\n // A regular op\n this.fixOpContentsObject(msgContents);\n }\n }\n\n // re-stringify the json if needed\n if (typeof message.contents === \"string\") {\n try {\n message.contents = JSON.stringify(msgContents);\n } catch (e) {\n this.debugMsg(e);\n return;\n }\n }\n }\n\n /**\n * @param message - The top-level chunkedOp message or a top-level op message\n * with a chunkedOp inside its contents\n */\n fixChunkedOp(message: any) {\n this.chunkProcessor.addMessage(message);\n if (!this.chunkProcessor.hasAllMessages()) {\n return;\n }\n\n const contents = this.chunkProcessor.getConcatenatedContents();\n this.fixOpContentsObject(contents);\n\n this.chunkProcessor.writeSanitizedContents(contents);\n this.chunkProcessor.reset();\n }\n\n sanitize(): ISequencedDocumentMessage[] {\n let seq = 0;\n\n try {\n this.messages.map((message) => {\n seq = message.sequenceNumber;\n // message types from protocol-definitions' protocol.ts\n switch (message.type) {\n case \"join\": {\n this.fixJoin(message);\n break;\n }\n case \"propose\": {\n this.fixPropose(message);\n break;\n }\n case \"attach\": {\n this.fixAttach(message);\n break;\n }\n case \"op\": {\n this.fixOp(message);\n break;\n }\n case \"chunkedOp\": {\n this.fixChunkedOp(message);\n break;\n }\n case \"noop\":\n case \"leave\":\n case \"noClient\":\n case \"summarize\":\n case \"summaryAck\":\n case \"summaryNack\":\n break;\n default:\n this.debugMsg(`Unexpected op type ${message.type}`);\n }\n });\n\n // make sure we don't miss an incomplete chunked op at the end\n assert(!this.chunkProcessor.isPendingProcessing(), 0x08d /* \"After sanitize, pending incomplete ops!\" */);\n } catch (error) {\n this.debugMsg(`Error while processing sequenceNumber ${seq}`);\n throw error;\n }\n\n return this.messages;\n }\n}\n"]}
1
+ {"version":3,"file":"sanitizer.js","sourceRoot":"","sources":["../src/sanitizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,OAAO,EACN,oBAAoB,EACpB,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ACb,KAAK,UAAU,CAAC;oBAChB,KAAK,WAAW,CAAC;oBACjB,KAAK,YAAY,CAAC;oBAClB,KAAK,aAAa;wBACjB,MAAM;oBACP;wBACC,IAAI,CAAC,QAAQ,CAAC,sBAAsB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;iBACrD;YACF,CAAC,CAAC,CAAC;YAEH,8DAA8D;YAC9D,MAAM,CACL,CAAC,IAAI,CAAC,cAAc,CAAC,mBAAmB,EAAE,EAC1C,KAAK,CAAC,+CAA+C,CACrD,CAAC;SACF;QAAC,OAAO,KAAK,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,yCAAyC,GAAG,EAAE,CAAC,CAAC;YAC9D,MAAM,KAAK,CAAC;SACZ;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;CACD","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 * as Validator from \"jsonschema\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n\tattachContentsSchema,\n\tchunkedOpContentsSchema,\n\tjoinContentsSchema,\n\tjoinDataSchema,\n\topContentsMapSchema,\n\topContentsSchema,\n\topContentsMergeTreeDeltaOpSchema,\n\topContentsMergeTreeGroupOpSchema,\n\topContentsRegisterCollectionSchema,\n\tproposeContentsSchema,\n} from \"./messageSchema\";\n\nenum TextType {\n\tGeneric,\n\tEmail,\n\tName,\n\tFluidObject,\n\tMapKey,\n}\n\n// Workaround to jsonschema package not supporting \"false\" as a schema\n// that matches nothing\nconst falseResult = {\n\tvalid: false,\n\ttoString: () => {\n\t\treturn \"Unmatched format\";\n\t},\n};\n\n/**\n * Class that takes chunkedOp messages and can provide their concatenated\n * contents along with re-write sanitized content in-place back into the\n * messages. Assumes sanitized messages are always less than or equal in\n * size to the original message.\n */\nclass ChunkedOpProcessor {\n\t/**\n\t * Message references so we can replace their contents in-place. These can\n\t * be top-level chunkedOp messages, or top-level op messages with a chunkedOp\n\t * within the contents\n\t */\n\tprivate messages = new Array<any>();\n\t/**\n\t * The messages' parsed contents for processing. Should parallel the\n\t * messages member\n\t */\n\tprivate parsedMessageContents = new Array<any>();\n\tprivate writtenBack = false;\n\t/**\n\t * keep track of the total starting length to make sure we don't somehow end\n\t * up with more content than we started with (meaning we may not be able to\n\t * write it back)\n\t */\n\tprivate concatenatedLength = 0;\n\n\tconstructor(\n\t\treadonly validateSchemaFn: (object: any, schema: any) => boolean,\n\t\treadonly debug: boolean,\n\t) {}\n\n\tdebugMsg(msg: any) {\n\t\tif (this.debug) {\n\t\t\tconsole.error(msg);\n\t\t}\n\t}\n\n\taddMessage(message: any): void {\n\t\tthis.messages.push(message);\n\n\t\tlet parsed;\n\t\ttry {\n\t\t\tparsed = JSON.parse(message.contents);\n\t\t\tif (message.type === \"op\") {\n\t\t\t\t// nested within a regular op\n\t\t\t\t// need to go deeper to get the desired contents\n\t\t\t\tparsed = parsed.contents;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis.debugMsg(e);\n\t\t\tthis.debugMsg(message.contents);\n\t\t}\n\t\tthis.validateSchemaFn(parsed, chunkedOpContentsSchema);\n\t\tthis.parsedMessageContents.push(parsed);\n\t}\n\n\thasAllMessages(): boolean {\n\t\tconst lastMsgContents = this.parsedMessageContents[this.parsedMessageContents.length - 1];\n\t\treturn (\n\t\t\tlastMsgContents.chunkId !== undefined &&\n\t\t\tlastMsgContents.chunkId === lastMsgContents.totalChunks\n\t\t);\n\t}\n\n\t/**\n\t * @returns The concatenated contents of all the messages parsed as json\n\t */\n\tgetConcatenatedContents(): any {\n\t\tconst contentsString = this.parsedMessageContents.reduce(\n\t\t\t(previousValue: string, currentValue: any) => {\n\t\t\t\treturn previousValue + (currentValue.contents as string);\n\t\t\t},\n\t\t\t\"\",\n\t\t);\n\n\t\tthis.concatenatedLength = contentsString.length;\n\t\ttry {\n\t\t\treturn JSON.parse(contentsString);\n\t\t} catch (e) {\n\t\t\tthis.debugMsg(contentsString);\n\t\t\tthis.debugMsg(e);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Write back sanitized contents into the messages. The contents are\n\t * stringified, split up, and written in place to the messages that\n\t * were added earlier. The number of messages is preserved.\n\t * @param contents - Sanitized contents to write back\n\t */\n\twriteSanitizedContents(contents: any): void {\n\t\t// Write back a chunk size equal to the original\n\t\tconst chunkSize = this.parsedMessageContents[0].contents.length;\n\n\t\tlet stringified: string;\n\t\ttry {\n\t\t\tstringified = JSON.stringify(contents);\n\t\t\tassert(\n\t\t\t\tstringified.length <= this.concatenatedLength,\n\t\t\t\t0x089 /* \"Stringified length of chunk contents > total starting length\" */,\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tthis.debugMsg(e);\n\t\t\tthrow e;\n\t\t}\n\n\t\tfor (let i = 0; i < this.messages.length; i++) {\n\t\t\tconst substring = stringified.substring(i * chunkSize, (i + 1) * chunkSize);\n\n\t\t\tconst parsedContents = this.parsedMessageContents[i];\n\t\t\tparsedContents.contents = substring;\n\t\t\tconst message = this.messages[i];\n\n\t\t\tlet stringifiedParsedContents;\n\t\t\ttry {\n\t\t\t\t// for nested chunkedOps, we need to recreate the extra nesting layer\n\t\t\t\t// we removed earlier when adding the message\n\t\t\t\tif (message.type === \"op\") {\n\t\t\t\t\tconst nestingLayer = {\n\t\t\t\t\t\ttype: \"chunkedOp\",\n\t\t\t\t\t\tcontents: parsedContents,\n\t\t\t\t\t};\n\t\t\t\t\tstringifiedParsedContents = JSON.stringify(nestingLayer);\n\t\t\t\t} else {\n\t\t\t\t\tstringifiedParsedContents = JSON.stringify(parsedContents);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tthis.debugMsg(e);\n\t\t\t}\n\n\t\t\tmessage.contents = stringifiedParsedContents;\n\t\t}\n\n\t\tthis.writtenBack = true;\n\t}\n\n\treset(): void {\n\t\tassert(\n\t\t\tthis.writtenBack,\n\t\t\t0x08a /* \"resetting ChunkedOpProcessor that never wrote back its contents\" */,\n\t\t);\n\t\tthis.messages = new Array<any>();\n\t\tthis.parsedMessageContents = new Array<any>();\n\t\tthis.writtenBack = false;\n\t\tthis.concatenatedLength = 0;\n\t}\n\n\tisPendingProcessing(): boolean {\n\t\treturn this.messages.length !== 0;\n\t}\n}\n\nexport class Sanitizer {\n\treadonly validator = new Validator.Validator();\n\t// Represents the keys used to store Fluid object identifiers, snapshot info,\n\t// and other string fields that should not be replaced in contents blobs to\n\t// ensure the messages are still usable\n\treadonly defaultExcludedKeys = new Set<string>();\n\t// Represents the keys used by merge-tree ops their \"seg\" property, where other\n\t// keys represent user information\n\treadonly mergeTreeExcludedKeys = new Set<string>();\n\t// Map of user information to what it was replaced with. Used to ensure the same\n\t// data have the same replacements\n\treadonly replacementMap = new Map<string, string>();\n\n\t/**\n\t * Validate that the provided message matches the provided schema.\n\t * For a full scrub, warn and continue (scrubber should fully sanitize unexpected\n\t * fields for ops), otherwise throw an error because we cannot be sure user\n\t * information is being sufficiently sanitized.\n\t */\n\tobjectMatchesSchema = (object: any, schema: any): boolean => {\n\t\tconst result = schema === false ? falseResult : this.validator.validate(object, schema);\n\t\tif (!result.valid) {\n\t\t\tconst errorMsg = `Bad msg fmt:\\n${result.toString()}\\n${JSON.stringify(\n\t\t\t\tobject,\n\t\t\t\tundefined,\n\t\t\t\t2,\n\t\t\t)}`;\n\n\t\t\tif (this.fullScrub || this.noBail) {\n\t\t\t\tthis.debugMsg(errorMsg);\n\t\t\t} else {\n\t\t\t\tthrow new Error(errorMsg);\n\t\t\t}\n\t\t}\n\t\treturn result.valid;\n\t};\n\n\treadonly chunkProcessor = new ChunkedOpProcessor(this.objectMatchesSchema, this.debug);\n\n\tconstructor(\n\t\treadonly messages: ISequencedDocumentMessage[],\n\t\treadonly fullScrub: boolean,\n\t\treadonly noBail: boolean,\n\t\treadonly debug: boolean = false,\n\t) {\n\t\tthis.defaultExcludedKeys.add(\"type\");\n\t\tthis.defaultExcludedKeys.add(\"id\");\n\t\tthis.defaultExcludedKeys.add(\"pkg\");\n\t\tthis.defaultExcludedKeys.add(\"snapshotFormatVersion\");\n\t\tthis.defaultExcludedKeys.add(\"packageVersion\");\n\t\tthis.mergeTreeExcludedKeys.add(\"nodeType\");\n\t}\n\n\tdebugMsg(msg: any) {\n\t\tif (this.debug) {\n\t\t\tconsole.error(msg);\n\t\t}\n\t}\n\n\tisFluidObjectKey(key: string): boolean {\n\t\treturn key === \"type\" || key === \"id\";\n\t}\n\n\tgetRandomText(len: number): string {\n\t\tlet str = \"\";\n\t\twhile (str.length < len) {\n\t\t\tstr = str + Math.random().toString(36).substring(2);\n\t\t}\n\t\treturn str.substr(0, len);\n\t}\n\n\treadonly wordTokenRegex = /\\S+/g;\n\n\treadonly replaceRandomTextFn = (match: string): string => {\n\t\tif (this.replacementMap.has(match)) {\n\t\t\treturn this.replacementMap.get(match)!;\n\t\t}\n\n\t\tconst replacement = this.getRandomText(match.length);\n\t\tthis.replacementMap.set(match, replacement);\n\t\treturn replacement;\n\t};\n\n\t/**\n\t * Replace text with garbage. FluidObject types are not replaced when not under\n\t * full scrub mode. All other text is replaced consistently.\n\t */\n\treplaceText(input?: string, type: TextType = TextType.Generic): string | undefined {\n\t\tif (input === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (type === TextType.FluidObject) {\n\t\t\tif (this.replacementMap.has(input)) {\n\t\t\t\treturn this.replacementMap.get(input)!;\n\t\t\t}\n\n\t\t\tconst replacement = this.fullScrub ? this.getRandomText(input.length) : input;\n\n\t\t\tthis.replacementMap.set(input, replacement);\n\t\t\treturn replacement;\n\t\t}\n\n\t\treturn input.replace(this.wordTokenRegex, this.replaceRandomTextFn);\n\t}\n\n\treplaceArray(input: any[]): any[] {\n\t\tfor (let i = 0; i < input.length; i++) {\n\t\t\tconst value = input[i];\n\t\t\tif (typeof value === \"string\") {\n\t\t\t\tinput[i] = this.replaceText(value);\n\t\t\t} else if (Array.isArray(value)) {\n\t\t\t\tinput[i] = this.replaceArray(value);\n\t\t\t} else if (typeof value === \"object\") {\n\t\t\t\tinput[i] = this.replaceObject(value);\n\t\t\t}\n\t\t}\n\t\treturn input;\n\t}\n\n\t/**\n\t * (sort of) recurses down the values of a JSON object to sanitize all its strings\n\t * (only checks strings, arrays, and objects)\n\t * @param input - The object to sanitize\n\t * @param excludedKeys - object keys for which to skip replacement when not in fullScrub\n\t */\n\treplaceObject(\n\t\tinput: object | null,\n\t\texcludedKeys: Set<string> = this.defaultExcludedKeys,\n\t): object | null {\n\t\t// File might contain actual nulls\n\t\tif (input === null || input === undefined) {\n\t\t\treturn input;\n\t\t}\n\n\t\tconst keys = Object.keys(input);\n\t\tkeys.forEach((key) => {\n\t\t\tif (this.fullScrub || !excludedKeys.has(key)) {\n\t\t\t\tconst value = input[key];\n\t\t\t\tif (typeof value === \"string\") {\n\t\t\t\t\tinput[key] = this.replaceText(\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tthis.isFluidObjectKey(key) ? TextType.FluidObject : TextType.Generic,\n\t\t\t\t\t);\n\t\t\t\t} else if (Array.isArray(value)) {\n\t\t\t\t\tinput[key] = this.replaceArray(value);\n\t\t\t\t} else if (typeof value === \"object\") {\n\t\t\t\t\tinput[key] = this.replaceObject(value, excludedKeys);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn input;\n\t}\n\n\t/**\n\t * Replacement on an unknown type or a parsed root level object\n\t * without a key\n\t * @param input - The object to sanitize\n\t * @param excludedKeys - object keys for which to skip replacement when not in fullScrub\n\t */\n\treplaceAny(input: any, excludedKeys: Set<string> = this.defaultExcludedKeys): any {\n\t\tif (input === null || input === undefined) {\n\t\t\treturn input;\n\t\t}\n\n\t\tif (typeof input === \"string\") {\n\t\t\treturn this.replaceText(input);\n\t\t} else if (Array.isArray(input)) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn this.replaceArray(input);\n\t\t} else if (typeof input === \"object\") {\n\t\t\treturn this.replaceObject(input, excludedKeys);\n\t\t}\n\n\t\t// Don't run replacement on any other types\n\t\treturn input;\n\t}\n\n\tfixJoin(message: any) {\n\t\tif (!this.objectMatchesSchema(message.contents, joinContentsSchema)) {\n\t\t\tmessage.contents = this.replaceAny(message.contents);\n\t\t}\n\n\t\ttry {\n\t\t\tlet data = JSON.parse(message.data);\n\t\t\tif (!this.objectMatchesSchema(data, joinDataSchema)) {\n\t\t\t\tdata = this.replaceAny(data);\n\t\t\t} else {\n\t\t\t\tconst user = data.detail.user;\n\t\t\t\tuser.id = this.replaceText(user.id, TextType.Email);\n\t\t\t\tuser.email = this.replaceText(user.email, TextType.Email);\n\t\t\t\tuser.name = this.replaceText(user.name, TextType.Name);\n\t\t\t}\n\n\t\t\tmessage.data = JSON.stringify(data);\n\t\t} catch (e) {\n\t\t\tthis.debugMsg(e);\n\t\t}\n\t}\n\n\tfixPropose(message: any) {\n\t\tif (!this.objectMatchesSchema(message.contents, proposeContentsSchema)) {\n\t\t\tmessage.contents = this.replaceAny(message.contents);\n\t\t} else {\n\t\t\tif (typeof message.contents === \"string\") {\n\t\t\t\ttry {\n\t\t\t\t\tconst data = JSON.parse(message.contents);\n\t\t\t\t\tif (this.fullScrub) {\n\t\t\t\t\t\tconst pkg = data.value?.package;\n\t\t\t\t\t\tif (pkg?.name) {\n\t\t\t\t\t\t\tpkg.name = this.replaceText(pkg.name, TextType.FluidObject);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (Array.isArray(pkg?.fluid?.browser?.umd?.files)) {\n\t\t\t\t\t\t\tpkg.fluid.browser.umd.files = this.replaceArray(\n\t\t\t\t\t\t\t\tpkg.fluid.browser.umd.files,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.debugMsg(e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this.fullScrub) {\n\t\t\t\t\tmessage.contents.value = this.replaceText(\n\t\t\t\t\t\tmessage.contents.value,\n\t\t\t\t\t\tTextType.FluidObject,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfixAttachEntries(entries: any[]) {\n\t\tentries.forEach((element) => {\n\t\t\t// Tree type\n\t\t\tif (element.value.entries) {\n\t\t\t\tthis.fixAttachEntries(element.value.entries);\n\t\t\t} else {\n\t\t\t\t// Blob (leaf) type\n\t\t\t\ttry {\n\t\t\t\t\tif (typeof element.value.contents === \"string\") {\n\t\t\t\t\t\tlet data = JSON.parse(element.value.contents);\n\t\t\t\t\t\tdata = this.replaceObject(data);\n\t\t\t\t\t\telement.value.contents = JSON.stringify(data);\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.debugMsg(e);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Fix the content of an attach in place\n\t * @param contents - contents object to fix\n\t */\n\tfixAttachContents(contents: any): any {\n\t\tassert(\n\t\t\ttypeof contents === \"object\",\n\t\t\t0x08b /* \"Unexpected type on contents for fix of an attach!\" */,\n\t\t);\n\t\tif (!this.objectMatchesSchema(contents, attachContentsSchema)) {\n\t\t\tthis.replaceObject(contents);\n\t\t} else {\n\t\t\tif (this.fullScrub) {\n\t\t\t\tcontents.id = this.replaceText(contents.id, TextType.FluidObject);\n\t\t\t\tcontents.type = this.replaceText(contents.type, TextType.FluidObject);\n\t\t\t}\n\n\t\t\tthis.fixAttachEntries(contents.snapshot.entries);\n\t\t}\n\t}\n\n\t/**\n\t * Fix an attach message at the root level or a ContainerMessageType attach. Attach\n\t * messages found within an op message should instead have their contents parsed out\n\t * and sent to fixAttachContents.\n\t * @param message - The attach message to fix\n\t * @param withinOp - If the message is from within an op message (as opposed to being\n\t * an attach message at the root level). Root level attach messages have \"snapshot\"\n\t * under a \"contents\" key, whereas attach messages from within an op message have it\n\t * under a \"content\" key\n\t */\n\tfixAttach(message: any) {\n\t\t// Handle case where contents is stringified json\n\t\tif (typeof message.contents === \"string\") {\n\t\t\ttry {\n\t\t\t\tconst data = JSON.parse(message.contents);\n\t\t\t\tthis.fixAttachContents(data);\n\t\t\t\tmessage.contents = JSON.stringify(data);\n\t\t\t} catch (e) {\n\t\t\t\tthis.debugMsg(e);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.fixAttachContents(message.contents);\n\t\t}\n\t}\n\n\tfixDeltaOp(deltaOp: any) {\n\t\tdeltaOp.seg =\n\t\t\ttypeof deltaOp.seg === \"string\"\n\t\t\t\t? this.replaceText(deltaOp.seg)\n\t\t\t\t: this.replaceObject(deltaOp.seg, this.mergeTreeExcludedKeys);\n\t}\n\n\t/**\n\t * Fix the contents object for an op message. Does not do extra type handling. Does\n\t * not handle special container message types like \"attach\", \"component\", and\n\t * \"chunkedOp\" (these should be handled by the caller)\n\t * @param contents - The contents object for an op message. If it was a string in the\n\t * message, it must have been converted to an object first\n\t */\n\tfixOpContentsObject(contents: any) {\n\t\t// do replacement\n\t\tif (!this.objectMatchesSchema(contents, opContentsSchema)) {\n\t\t\tthis.replaceAny(contents);\n\t\t} else {\n\t\t\tif (this.fullScrub) {\n\t\t\t\tcontents.address = this.replaceText(contents.address, TextType.FluidObject);\n\t\t\t}\n\n\t\t\tconst innerContent = contents.contents.content;\n\t\t\tassert(\n\t\t\t\tinnerContent !== undefined,\n\t\t\t\t0x08c /* \"innerContent for fixing op contents is undefined!\" */,\n\t\t\t);\n\t\t\tif (contents.contents.type === \"attach\") {\n\t\t\t\t// attach op\n\t\t\t\t// handle case where inner content is stringified json\n\t\t\t\tif (typeof contents.contents.content === \"string\") {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst data = JSON.parse(contents.contents.content);\n\t\t\t\t\t\tthis.fixAttachContents(data);\n\t\t\t\t\t\tcontents.contents.content = JSON.stringify(data);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthis.debugMsg(e);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.fixAttachContents(contents.contents.content);\n\t\t\t\t}\n\t\t\t} else if (this.validator.validate(innerContent, opContentsMapSchema).valid) {\n\t\t\t\t// map op\n\t\t\t\tif (this.fullScrub) {\n\t\t\t\t\tinnerContent.address = this.replaceText(\n\t\t\t\t\t\tinnerContent.address,\n\t\t\t\t\t\tTextType.FluidObject,\n\t\t\t\t\t);\n\t\t\t\t\tinnerContent.contents.key = this.replaceText(\n\t\t\t\t\t\tinnerContent.contents.key,\n\t\t\t\t\t\tTextType.MapKey,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (innerContent.contents.value !== undefined) {\n\t\t\t\t\tinnerContent.contents.value.value = this.replaceAny(\n\t\t\t\t\t\tinnerContent.contents.value.value,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tthis.validator.validate(innerContent, opContentsMergeTreeGroupOpSchema).valid\n\t\t\t) {\n\t\t\t\t// merge tree group op\n\t\t\t\tif (this.fullScrub) {\n\t\t\t\t\tinnerContent.address = this.replaceText(\n\t\t\t\t\t\tinnerContent.address,\n\t\t\t\t\t\tTextType.FluidObject,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tinnerContent.contents.ops.forEach((deltaOp) => {\n\t\t\t\t\tthis.fixDeltaOp(deltaOp);\n\t\t\t\t});\n\t\t\t} else if (\n\t\t\t\tthis.validator.validate(innerContent, opContentsMergeTreeDeltaOpSchema).valid\n\t\t\t) {\n\t\t\t\t// merge tree delta op\n\t\t\t\tif (this.fullScrub) {\n\t\t\t\t\tinnerContent.address = this.replaceText(\n\t\t\t\t\t\tinnerContent.address,\n\t\t\t\t\t\tTextType.FluidObject,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.fixDeltaOp(innerContent.contents);\n\t\t\t} else if (\n\t\t\t\tthis.validator.validate(innerContent, opContentsRegisterCollectionSchema).valid\n\t\t\t) {\n\t\t\t\t// register collection op\n\t\t\t\tif (this.fullScrub) {\n\t\t\t\t\tinnerContent.address = this.replaceText(\n\t\t\t\t\t\tinnerContent.address,\n\t\t\t\t\t\tTextType.FluidObject,\n\t\t\t\t\t);\n\t\t\t\t\tinnerContent.contents.key = this.replaceText(\n\t\t\t\t\t\tinnerContent.contents.key,\n\t\t\t\t\t\tTextType.MapKey,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (innerContent.contents.value !== undefined) {\n\t\t\t\t\tinnerContent.contents.value.value = this.replaceAny(\n\t\t\t\t\t\tinnerContent.contents.value.value,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// message contents don't match any known op format\n\t\t\t\tthis.objectMatchesSchema(contents, false);\n\t\t\t}\n\t\t}\n\t}\n\n\tfixOp(message: any) {\n\t\t// handle case where contents is stringified json\n\t\tlet msgContents;\n\t\tif (typeof message.contents === \"string\") {\n\t\t\ttry {\n\t\t\t\tmsgContents = JSON.parse(message.contents);\n\t\t\t} catch (e) {\n\t\t\t\tthis.debugMsg(e);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\tmsgContents = message.contents;\n\t\t}\n\n\t\t// handle container message types\n\t\tswitch (msgContents.type) {\n\t\t\tcase \"attach\": {\n\t\t\t\t// this one is like a regular attach op, except its contents aren't nested as deep\n\t\t\t\t// run fixAttach directly and return\n\t\t\t\tthis.fixAttach(msgContents);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"component\": {\n\t\t\t\t// this one functionally nests its contents one layer deeper\n\t\t\t\t// bring up the contents object and continue as usual\n\t\t\t\tthis.fixOpContentsObject(msgContents.contents);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"chunkedOp\": {\n\t\t\t\t// this is a (regular?) op split into multiple parts due to size, e.g. because it\n\t\t\t\t// has an attached image, and where the chunkedOp is within the top-level op's contents\n\t\t\t\t// (as opposed to being at the top-level). The contents of the chunks need to be\n\t\t\t\t// concatenated to form the complete stringified json object\n\t\t\t\t// Early return here to skip re-stringify because no changes are made until the last\n\t\t\t\t// chunk, and the ChunkedOpProcessor will handle everything at that point\n\t\t\t\treturn this.fixChunkedOp(message);\n\t\t\t}\n\t\t\tcase \"blobAttach\": {\n\t\t\t\t// TODO: handle this properly once blob api is used\n\t\t\t\tthis.debugMsg(\"TODO: blobAttach ops are skipped/unhandled\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\t// A regular op\n\t\t\t\tthis.fixOpContentsObject(msgContents);\n\t\t\t}\n\t\t}\n\n\t\t// re-stringify the json if needed\n\t\tif (typeof message.contents === \"string\") {\n\t\t\ttry {\n\t\t\t\tmessage.contents = JSON.stringify(msgContents);\n\t\t\t} catch (e) {\n\t\t\t\tthis.debugMsg(e);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param message - The top-level chunkedOp message or a top-level op message\n\t * with a chunkedOp inside its contents\n\t */\n\tfixChunkedOp(message: any) {\n\t\tthis.chunkProcessor.addMessage(message);\n\t\tif (!this.chunkProcessor.hasAllMessages()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst contents = this.chunkProcessor.getConcatenatedContents();\n\t\tthis.fixOpContentsObject(contents);\n\n\t\tthis.chunkProcessor.writeSanitizedContents(contents);\n\t\tthis.chunkProcessor.reset();\n\t}\n\n\tsanitize(): ISequencedDocumentMessage[] {\n\t\tlet seq = 0;\n\n\t\ttry {\n\t\t\tthis.messages.map((message) => {\n\t\t\t\tseq = message.sequenceNumber;\n\t\t\t\t// message types from protocol-definitions' protocol.ts\n\t\t\t\tswitch (message.type) {\n\t\t\t\t\tcase \"join\": {\n\t\t\t\t\t\tthis.fixJoin(message);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"propose\": {\n\t\t\t\t\t\tthis.fixPropose(message);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"attach\": {\n\t\t\t\t\t\tthis.fixAttach(message);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"op\": {\n\t\t\t\t\t\tthis.fixOp(message);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"chunkedOp\": {\n\t\t\t\t\t\tthis.fixChunkedOp(message);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"noop\":\n\t\t\t\t\tcase \"leave\":\n\t\t\t\t\tcase \"noClient\":\n\t\t\t\t\tcase \"summarize\":\n\t\t\t\t\tcase \"summaryAck\":\n\t\t\t\t\tcase \"summaryNack\":\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthis.debugMsg(`Unexpected op type ${message.type}`);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// make sure we don't miss an incomplete chunked op at the end\n\t\t\tassert(\n\t\t\t\t!this.chunkProcessor.isPendingProcessing(),\n\t\t\t\t0x08d /* \"After sanitize, pending incomplete ops!\" */,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthis.debugMsg(`Error while processing sequenceNumber ${seq}`);\n\t\t\tthrow error;\n\t\t}\n\n\t\treturn this.messages;\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,69 +1,70 @@
1
1
  {
2
- "name": "@fluidframework/debugger",
3
- "version": "2.0.0-internal.3.0.1",
4
- "description": "Fluid Debugger - a tool to play through history of a file",
5
- "homepage": "https://fluidframework.com",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/microsoft/FluidFramework.git",
9
- "directory": "packages/drivers/debugger"
10
- },
11
- "license": "MIT",
12
- "author": "Microsoft and contributors",
13
- "sideEffects": false,
14
- "main": "dist/index.js",
15
- "module": "lib/index.js",
16
- "types": "dist/index.d.ts",
17
- "scripts": {
18
- "build": "concurrently npm:build:compile npm:lint && npm run build:docs",
19
- "build:compile": "concurrently npm:typetests:gen npm:tsc npm:build:esnext",
20
- "build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
21
- "build:esnext": "tsc --project ./tsconfig.esnext.json",
22
- "build:full": "npm run build",
23
- "build:full:compile": "npm run build:compile",
24
- "ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
25
- "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
26
- "eslint": "eslint --format stylish src",
27
- "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
28
- "format": "npm run prettier:fix",
29
- "lint": "npm run eslint",
30
- "lint:fix": "npm run eslint:fix",
31
- "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
32
- "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
33
- "tsc": "tsc",
34
- "typetests:gen": "flub generate typetests --generate --dir .",
35
- "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
36
- },
37
- "dependencies": {
38
- "@fluidframework/common-utils": "^1.0.0",
39
- "@fluidframework/driver-definitions": ">=2.0.0-internal.3.0.1 <2.0.0-internal.4.0.0",
40
- "@fluidframework/driver-utils": ">=2.0.0-internal.3.0.1 <2.0.0-internal.4.0.0",
41
- "@fluidframework/protocol-definitions": "^1.1.0",
42
- "@fluidframework/replay-driver": ">=2.0.0-internal.3.0.1 <2.0.0-internal.4.0.0",
43
- "jsonschema": "^1.2.6"
44
- },
45
- "devDependencies": {
46
- "@fluid-tools/build-cli": "^0.8.0",
47
- "@fluidframework/build-common": "^1.1.0",
48
- "@fluidframework/build-tools": "^0.8.0",
49
- "@fluidframework/debugger-previous": "npm:@fluidframework/debugger@2.0.0-internal.2.2.0",
50
- "@fluidframework/eslint-config-fluid": "^2.0.0",
51
- "@microsoft/api-extractor": "^7.22.2",
52
- "@rushstack/eslint-config": "^2.5.1",
53
- "@types/mocha": "^9.1.1",
54
- "@types/node": "^14.18.36",
55
- "concurrently": "^6.2.0",
56
- "copyfiles": "^2.4.1",
57
- "eslint": "~8.6.0",
58
- "mocha": "^10.0.0",
59
- "prettier": "~2.6.2",
60
- "rimraf": "^2.6.2",
61
- "typescript": "~4.5.5"
62
- },
63
- "typeValidation": {
64
- "version": "2.0.0-internal.3.0.0",
65
- "baselineRange": ">=2.0.0-internal.2.0.0 <2.0.0-internal.3.0.0",
66
- "baselineVersion": "2.0.0-internal.2.1.1",
67
- "broken": {}
68
- }
2
+ "name": "@fluidframework/debugger",
3
+ "version": "2.0.0-internal.3.1.0",
4
+ "description": "Fluid Debugger - a tool to play through history of a file",
5
+ "homepage": "https://fluidframework.com",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/microsoft/FluidFramework.git",
9
+ "directory": "packages/drivers/debugger"
10
+ },
11
+ "license": "MIT",
12
+ "author": "Microsoft and contributors",
13
+ "sideEffects": false,
14
+ "main": "dist/index.js",
15
+ "module": "lib/index.js",
16
+ "types": "dist/index.d.ts",
17
+ "scripts": {
18
+ "build": "concurrently npm:build:compile npm:lint && npm run build:docs",
19
+ "build:compile": "concurrently npm:typetests:gen npm:tsc npm:build:esnext",
20
+ "build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
21
+ "build:esnext": "tsc --project ./tsconfig.esnext.json",
22
+ "build:full": "npm run build",
23
+ "build:full:compile": "npm run build:compile",
24
+ "ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
25
+ "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
26
+ "eslint": "eslint --format stylish src",
27
+ "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
28
+ "format": "npm run prettier:fix",
29
+ "lint": "npm run prettier && npm run eslint",
30
+ "lint:fix": "npm run prettier:fix && npm run eslint:fix",
31
+ "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
32
+ "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
33
+ "tsc": "tsc",
34
+ "typetests:gen": "flub generate typetests --generate --dir .",
35
+ "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
36
+ },
37
+ "dependencies": {
38
+ "@fluidframework/common-utils": "^1.0.0",
39
+ "@fluidframework/driver-definitions": ">=2.0.0-internal.3.1.0 <2.0.0-internal.4.0.0",
40
+ "@fluidframework/driver-utils": ">=2.0.0-internal.3.1.0 <2.0.0-internal.4.0.0",
41
+ "@fluidframework/protocol-definitions": "^1.1.0",
42
+ "@fluidframework/replay-driver": ">=2.0.0-internal.3.1.0 <2.0.0-internal.4.0.0",
43
+ "jsonschema": "^1.2.6"
44
+ },
45
+ "devDependencies": {
46
+ "@fluid-tools/build-cli": "^0.9.0",
47
+ "@fluidframework/build-common": "^1.1.0",
48
+ "@fluidframework/build-tools": "^0.9.0",
49
+ "@fluidframework/debugger-previous": "npm:@fluidframework/debugger@2.0.0-internal.3.0.0",
50
+ "@fluidframework/eslint-config-fluid": "^2.0.0",
51
+ "@microsoft/api-extractor": "^7.22.2",
52
+ "@rushstack/eslint-config": "^2.5.1",
53
+ "@types/mocha": "^9.1.1",
54
+ "@types/node": "^14.18.36",
55
+ "concurrently": "^6.2.0",
56
+ "copyfiles": "^2.4.1",
57
+ "eslint": "~8.6.0",
58
+ "mocha": "^10.0.0",
59
+ "prettier": "~2.6.2",
60
+ "rimraf": "^2.6.2",
61
+ "typescript": "~4.5.5"
62
+ },
63
+ "typeValidation": {
64
+ "version": "2.0.0-internal.3.1.0",
65
+ "previousVersionStyle": "~previousMinor",
66
+ "baselineRange": ">=2.0.0-internal.3.0.0 <2.0.0-internal.3.1.0",
67
+ "baselineVersion": "2.0.0-internal.3.0.0",
68
+ "broken": {}
69
+ }
69
70
  }
@@ -4,5 +4,5 @@
4
4
  */
5
5
 
6
6
  module.exports = {
7
- ...require("@fluidframework/build-common/prettier.config.cjs"),
7
+ ...require("@fluidframework/build-common/prettier.config.cjs"),
8
8
  };