@fluid-tools/fetch-tool 2.0.0-dev-rc.3.0.0.250606 → 2.0.0-dev-rc.3.0.0.254274

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 (41) hide show
  1. package/dist/fluidAnalyzeMessages.js +19 -19
  2. package/dist/fluidAnalyzeMessages.js.map +1 -1
  3. package/dist/fluidFetch.js.map +1 -1
  4. package/dist/fluidFetchInit.d.ts +1 -1
  5. package/dist/fluidFetchInit.d.ts.map +1 -1
  6. package/dist/fluidFetchInit.js +9 -9
  7. package/dist/fluidFetchInit.js.map +1 -1
  8. package/dist/fluidFetchMessages.d.ts +1 -1
  9. package/dist/fluidFetchMessages.d.ts.map +1 -1
  10. package/dist/fluidFetchMessages.js +6 -6
  11. package/dist/fluidFetchMessages.js.map +1 -1
  12. package/dist/fluidFetchSharePoint.d.ts.map +1 -1
  13. package/dist/fluidFetchSharePoint.js +4 -4
  14. package/dist/fluidFetchSharePoint.js.map +1 -1
  15. package/dist/fluidFetchSnapshot.d.ts +1 -1
  16. package/dist/fluidFetchSnapshot.d.ts.map +1 -1
  17. package/dist/fluidFetchSnapshot.js.map +1 -1
  18. package/lib/fluidAnalyzeMessages.js +3 -3
  19. package/lib/fluidAnalyzeMessages.js.map +1 -1
  20. package/lib/fluidFetch.js.map +1 -1
  21. package/lib/fluidFetchInit.d.ts +1 -1
  22. package/lib/fluidFetchInit.d.ts.map +1 -1
  23. package/lib/fluidFetchInit.js +5 -5
  24. package/lib/fluidFetchInit.js.map +1 -1
  25. package/lib/fluidFetchMessages.d.ts +1 -1
  26. package/lib/fluidFetchMessages.d.ts.map +1 -1
  27. package/lib/fluidFetchMessages.js +1 -1
  28. package/lib/fluidFetchMessages.js.map +1 -1
  29. package/lib/fluidFetchSharePoint.d.ts.map +1 -1
  30. package/lib/fluidFetchSharePoint.js +1 -1
  31. package/lib/fluidFetchSharePoint.js.map +1 -1
  32. package/lib/fluidFetchSnapshot.d.ts +1 -1
  33. package/lib/fluidFetchSnapshot.d.ts.map +1 -1
  34. package/lib/fluidFetchSnapshot.js.map +1 -1
  35. package/package.json +15 -17
  36. package/src/fluidAnalyzeMessages.ts +4 -4
  37. package/src/fluidFetch.ts +2 -0
  38. package/src/fluidFetchInit.ts +11 -7
  39. package/src/fluidFetchMessages.ts +4 -2
  40. package/src/fluidFetchSharePoint.ts +3 -1
  41. package/src/fluidFetchSnapshot.ts +4 -1
@@ -5,9 +5,9 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.printMessageStats = exports.formatNumber = void 0;
8
- const container_runtime_1 = require("@fluidframework/container-runtime");
9
- const core_utils_1 = require("@fluidframework/core-utils");
10
- const datastore_1 = require("@fluidframework/datastore");
8
+ const internal_1 = require("@fluidframework/container-runtime/internal");
9
+ const internal_2 = require("@fluidframework/core-utils/internal");
10
+ const internal_3 = require("@fluidframework/datastore/internal");
11
11
  const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
12
12
  const noClientName = "No Client";
13
13
  const objectTypePrefix = "https://graph.microsoft.com/types/";
@@ -398,26 +398,26 @@ function processOp(runtimeMessage, dataType, objectStats, msgSize, dataTypeStats
398
398
  let recorded = false;
399
399
  let totalMsgSize = msgSize;
400
400
  let opCount = 1;
401
- if ((0, container_runtime_1.unpackRuntimeMessage)(runtimeMessage)) {
401
+ if ((0, internal_1.unpackRuntimeMessage)(runtimeMessage)) {
402
402
  const messageType = runtimeMessage.type;
403
403
  switch (messageType) {
404
- case container_runtime_1.ContainerMessageType.Attach: {
404
+ case internal_1.ContainerMessageType.Attach: {
405
405
  const attachMessage = runtimeMessage.contents;
406
406
  processDataStoreAttachOp(attachMessage, dataType);
407
407
  break;
408
408
  }
409
409
  // skip for now because these ops do not have contents
410
- case container_runtime_1.ContainerMessageType.BlobAttach: {
410
+ case internal_1.ContainerMessageType.BlobAttach: {
411
411
  break;
412
412
  }
413
413
  // The default method to count stats should be used for GC messages.
414
- case container_runtime_1.ContainerMessageType.GC: {
414
+ case internal_1.ContainerMessageType.GC: {
415
415
  break;
416
416
  }
417
- case container_runtime_1.ContainerMessageType.DocumentSchemaChange: {
417
+ case internal_1.ContainerMessageType.DocumentSchemaChange: {
418
418
  break;
419
419
  }
420
- case container_runtime_1.ContainerMessageType.ChunkedOp: {
420
+ case internal_1.ContainerMessageType.ChunkedOp: {
421
421
  const chunk = runtimeMessage.contents;
422
422
  // TODO: Verify whether this should be able to handle server-generated ops (with null clientId)
423
423
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
@@ -430,7 +430,7 @@ function processOp(runtimeMessage, dataType, objectStats, msgSize, dataTypeStats
430
430
  }
431
431
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
432
432
  const value = chunkMap.get(runtimeMessage.clientId);
433
- (0, core_utils_1.assert)(value !== undefined, 0x2b8 /* "Chunk should be set in map" */);
433
+ (0, internal_2.assert)(value !== undefined, 0x2b8 /* "Chunk should be set in map" */);
434
434
  const chunks = value.chunks;
435
435
  const chunkIndex = chunk.chunkId - 1;
436
436
  if (chunks[chunkIndex] !== undefined) {
@@ -452,10 +452,10 @@ function processOp(runtimeMessage, dataType, objectStats, msgSize, dataTypeStats
452
452
  }
453
453
  // eslint-disable-next-line no-fallthrough
454
454
  }
455
- case container_runtime_1.ContainerMessageType.IdAllocation:
456
- case container_runtime_1.ContainerMessageType.FluidDataStoreOp:
457
- case container_runtime_1.ContainerMessageType.Alias:
458
- case container_runtime_1.ContainerMessageType.Rejoin: {
455
+ case internal_1.ContainerMessageType.IdAllocation:
456
+ case internal_1.ContainerMessageType.FluidDataStoreOp:
457
+ case internal_1.ContainerMessageType.Alias:
458
+ case internal_1.ContainerMessageType.Rejoin: {
459
459
  let envelope = runtimeMessage.contents;
460
460
  // TODO: Legacy?
461
461
  if (envelope !== undefined && typeof envelope === "string") {
@@ -465,7 +465,7 @@ function processOp(runtimeMessage, dataType, objectStats, msgSize, dataTypeStats
465
465
  const address = envelope.address;
466
466
  type = `${type}/${innerContent.type}`;
467
467
  switch (innerContent.type) {
468
- case datastore_1.DataStoreMessageType.Attach: {
468
+ case internal_3.DataStoreMessageType.Attach: {
469
469
  const attachMessage = innerContent.content;
470
470
  let objectType = attachMessage.type;
471
471
  if (objectType.startsWith(objectTypePrefix)) {
@@ -474,7 +474,7 @@ function processOp(runtimeMessage, dataType, objectStats, msgSize, dataTypeStats
474
474
  dataType.set(getObjectId(address, attachMessage.id), objectType);
475
475
  break;
476
476
  }
477
- case datastore_1.DataStoreMessageType.ChannelOp:
477
+ case internal_3.DataStoreMessageType.ChannelOp:
478
478
  default: {
479
479
  const innerEnvelope = innerContent.content;
480
480
  const innerContent2 = innerEnvelope.contents;
@@ -510,7 +510,7 @@ function processOp(runtimeMessage, dataType, objectStats, msgSize, dataTypeStats
510
510
  break;
511
511
  }
512
512
  default:
513
- (0, core_utils_1.unreachableCase)(messageType, "Message type not recognized!");
513
+ (0, internal_2.unreachableCase)(messageType, "Message type not recognized!");
514
514
  }
515
515
  }
516
516
  incr(messageTypeStats, type, totalMsgSize, opCount);
@@ -604,7 +604,7 @@ function processQuorumMessages(message, skipMessage, sessionsInProgress, session
604
604
  const clientId = JSON.parse(dataString);
605
605
  session = sessionsInProgress.get(clientId);
606
606
  sessionsInProgress.delete(clientId);
607
- (0, core_utils_1.assert)(!!session, 0x1b7 /* "Bad session state for processing quorum messages" */);
607
+ (0, internal_2.assert)(!!session, 0x1b7 /* "Bad session state for processing quorum messages" */);
608
608
  if (session !== undefined) {
609
609
  if (!skipMessage) {
610
610
  session.reportOp(message.timestamp);
@@ -625,7 +625,7 @@ function processQuorumMessages(message, skipMessage, sessionsInProgress, session
625
625
  session = sessionsInProgress.get(message.clientId);
626
626
  if (session === undefined) {
627
627
  session = sessionsInProgress.get(noClientName);
628
- (0, core_utils_1.assert)(!!session, 0x1b8 /* "Bad session state for processing quorum messages" */);
628
+ (0, internal_2.assert)(!!session, 0x1b8 /* "Bad session state for processing quorum messages" */);
629
629
  }
630
630
  }
631
631
  return session;
@@ -1 +1 @@
1
- {"version":3,"file":"fluidAnalyzeMessages.js","sourceRoot":"","sources":["../src/fluidAnalyzeMessages.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yEAI2C;AAC3C,2DAAqE;AACrE,yDAAiE;AACjE,+EAO8C;AAG9C,MAAM,YAAY,GAAG,WAAW,CAAC;AACjC,MAAM,gBAAgB,GAAG,oCAAoC,CAAC;AAE9D,SAAS,IAAI,CAAC,GAAkC,EAAE,GAAW,EAAE,IAAY,EAAE,KAAK,GAAG,CAAC;IACrF,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS,EAAE;QACxB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;KAC5B;SAAM;QACN,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;QAClB,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;QACjB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KACpB;AACF,CAAC;AAcD;;GAEG;AACH,MAAM,aAAa;IACX,MAAM,CAAC,MAAM,CAAC,KAAa,EAAE,OAAkC;QACrE,OAAO,IAAI,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAID,YACkB,KAAa,EACb,YAAuC;QADvC,UAAK,GAAL,KAAK,CAAQ;QACb,iBAAY,GAAZ,YAAY,CAA2B;QAJjD,YAAO,GAAG,CAAC,CAAC;IAKjB,CAAC;IAEG,QAAQ,CAAC,SAAiB;QAChC,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,SAAiB;QAC7B,OAAO;YACN,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,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AC;QAClF,IAAI,OAAO,KAAK,SAAS,EAAE;YAC1B,IAAI,CAAC,WAAW,EAAE;gBACjB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;aACpC;YACD,MAAM,WAAW,GAAiB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACnE,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,KAAK,WAAW,CAAC,KAAK,GAAG,EAAE;gBAClD,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC;gBACtC,WAAW,CAAC,OAAO;aACnB,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;YACpD,OAAO,GAAG,SAAS,CAAC,CAAC,+BAA+B;SACpD;KACD;SAAM;QACN,+BAA+B;QAC/B,+FAA+F;QAC/F,4EAA4E;QAC5E,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,QAAkB,CAAC,CAAC;QAC7D,IAAI,OAAO,KAAK,SAAS,EAAE;YAC1B,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAC/C,IAAA,mBAAM,EAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,wDAAwD,CAAC,CAAC;SAClF;KACD;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tContainerMessageType,\n\tIChunkedOp,\n\tunpackRuntimeMessage,\n} from \"@fluidframework/container-runtime\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils\";\nimport { DataStoreMessageType } from \"@fluidframework/datastore\";\nimport {\n\tISequencedDocumentMessage,\n\tISummaryAck,\n\tISummaryNack,\n\tISummaryProposal,\n\tMessageType,\n\tTreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport { IAttachMessage, IEnvelope } from \"@fluidframework/runtime-definitions\";\n\nconst noClientName = \"No Client\";\nconst objectTypePrefix = \"https://graph.microsoft.com/types/\";\n\nfunction incr(map: Map<string, [number, number]>, key: string, size: number, count = 1) {\n\tconst value = map.get(key);\n\tif (value === undefined) {\n\t\tmap.set(key, [count, size]);\n\t} else {\n\t\tvalue[0] += count;\n\t\tvalue[1] += size;\n\t\tmap.set(key, value);\n\t}\n}\n\ninterface ISessionInfo {\n\tstartSeq: number;\n\topCount: number;\n\temail: string;\n\tduration: number;\n}\n\ninterface IMessageAnalyzer {\n\tprocessOp(op: ISequencedDocumentMessage, msgSize: number, filteredOutOp: boolean): void;\n\treportAnalyzes(lastOp: ISequencedDocumentMessage): void;\n}\n\n/**\n * Helper class to track session statistics\n */\nclass ActiveSession {\n\tpublic static create(email: string, message: ISequencedDocumentMessage) {\n\t\treturn new ActiveSession(email, message);\n\t}\n\n\tprivate opCount = 0;\n\n\tconstructor(\n\t\tprivate readonly email: string,\n\t\tprivate readonly startMessage: ISequencedDocumentMessage,\n\t) {}\n\n\tpublic reportOp(timestamp: number) {\n\t\tthis.opCount++;\n\t}\n\n\tpublic leave(timestamp: number): ISessionInfo {\n\t\treturn {\n\t\t\topCount: this.opCount,\n\t\t\temail: this.email,\n\t\t\tstartSeq: this.startMessage.sequenceNumber,\n\t\t\tduration: timestamp - this.startMessage.timestamp,\n\t\t};\n\t}\n}\n\n// Format a number separating 3 digits by comma\nexport const formatNumber = (num: number): string =>\n\t// eslint-disable-next-line unicorn/no-unsafe-regex\n\tnum.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n\nfunction dumpStats(\n\tmap: Map<string, [number, number]>,\n\tprops: {\n\t\ttitle: string;\n\t\theaders: [string, string];\n\t\tlines?: number;\n\t\torderByFirstColumn?: boolean;\n\t\treverseColumnsInUI?: boolean;\n\t\tremoveTotals?: boolean;\n\t\treverseSort?: boolean;\n\t},\n) {\n\tconst fieldSizes = [10, 14];\n\tconst nameLength = 72;\n\tconst fieldsLength = fieldSizes[0] + fieldSizes[1] + 1;\n\tlet headers = props.headers;\n\n\tlet recordsToShow = props.lines ?? 10;\n\tif (map.size !== recordsToShow && props.removeTotals === undefined && recordsToShow > 1) {\n\t\trecordsToShow--;\n\t}\n\n\tlet sorted: [string, [number, number]][];\n\tconst sortIndex = props.orderByFirstColumn === true ? 0 : 1;\n\tlet add: string;\n\tif (props.reverseSort !== undefined) {\n\t\tsorted = [...map.entries()].sort((a, b) => a[1][sortIndex] - b[1][sortIndex]);\n\t\tadd = \"↑\";\n\t} else {\n\t\tsorted = [...map.entries()].sort((a, b) => b[1][sortIndex] - a[1][sortIndex]);\n\t\tadd = \"↓\";\n\t}\n\theaders[sortIndex] = `${headers[sortIndex]} ${add}`;\n\n\tif (props.reverseColumnsInUI !== undefined) {\n\t\theaders = [headers[1], headers[0]];\n\t\tconst sorted2: [string, [number, number]][] = [];\n\t\tfor (const [name, [count, size]] of sorted) {\n\t\t\tsorted2.push([name, [size, count]]);\n\t\t}\n\t\tsorted = sorted2;\n\t}\n\n\tlet totalCount = 0;\n\tlet sizeTotal = 0;\n\n\tprops.title = `${props.title} (${sorted.length})`;\n\tconst header0 = headers[0].padStart(fieldSizes[0]);\n\tlet overflow = header0.length - fieldSizes[0];\n\tconsole.log(\n\t\t`\\n\\n${props.title.padEnd(nameLength)} │ ${header0} ${headers[1].padStart(\n\t\t\tfieldSizes[1] - overflow,\n\t\t)}`,\n\t);\n\n\tconsole.log(`${\"─\".repeat(nameLength + 1)}┼${\"─\".repeat(fieldsLength + 1)}`);\n\tlet index = 0;\n\tlet allOtherCount = 0;\n\tlet allOtherSize = 0;\n\tfor (const [name, [count, size]] of sorted) {\n\t\tindex++;\n\t\ttotalCount += count;\n\t\tsizeTotal += size;\n\t\tif (index <= recordsToShow) {\n\t\t\tconst item = name.padEnd(nameLength);\n\t\t\toverflow = item.length - nameLength;\n\t\t\tconst col1 = formatNumber(count).padStart(fieldSizes[0] - overflow);\n\t\t\toverflow += col1.length - fieldSizes[0];\n\t\t\tconst col2 = formatNumber(size).padStart(fieldSizes[1] - overflow);\n\t\t\tconsole.log(`${item} │ ${col1} ${col2}`);\n\t\t} else {\n\t\t\tallOtherCount += count;\n\t\t\tallOtherSize += size;\n\t\t}\n\t}\n\n\tif (props.removeTotals === undefined) {\n\t\tif (allOtherCount || allOtherSize) {\n\t\t\tconsole.log(\n\t\t\t\t`${`All Others (${sorted.length - recordsToShow})`.padEnd(\n\t\t\t\t\tnameLength,\n\t\t\t\t)} │ ${formatNumber(allOtherCount).padStart(fieldSizes[0])} ${formatNumber(\n\t\t\t\t\tallOtherSize,\n\t\t\t\t).padStart(fieldSizes[1])}`,\n\t\t\t);\n\t\t}\n\t\tconsole.log(`${\"─\".repeat(nameLength + 1)}┼${\"─\".repeat(fieldsLength + 1)}`);\n\t\tconsole.log(\n\t\t\t`${\"Total\".padEnd(nameLength)} │ ${formatNumber(totalCount).padStart(\n\t\t\t\tfieldSizes[0],\n\t\t\t)} ${formatNumber(sizeTotal).padStart(fieldSizes[1])}`,\n\t\t);\n\t}\n}\n\nconst getObjectId = (dataStoreId: string, id: string) => `[${dataStoreId}]/${id}`;\n\n/**\n * Analyzer for sessions\n */\nclass SessionAnalyzer implements IMessageAnalyzer {\n\tprivate readonly sessionsInProgress = new Map<string, ActiveSession>();\n\tprivate readonly sessions = new Map<string, [number, number]>();\n\tprivate readonly users = new Map<string, [number, number]>();\n\n\tprivate first = true;\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tif (this.first) {\n\t\t\tthis.first = false;\n\t\t\t// Start of the road.\n\t\t\tconst noNameSession = ActiveSession.create(noClientName, message);\n\t\t\tthis.sessionsInProgress.set(noClientName, noNameSession);\n\t\t}\n\t\tconst session = processQuorumMessages(\n\t\t\tmessage,\n\t\t\tskipMessage,\n\t\t\tthis.sessionsInProgress,\n\t\t\tthis.sessions,\n\t\t\tthis.users,\n\t\t);\n\t\tif (!skipMessage && session) {\n\t\t\tsession.reportOp(message.timestamp);\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {\n\t\t// Close any open sessions\n\t\treportOpenSessions(lastOp.timestamp, this.sessionsInProgress, this.sessions, this.users);\n\t\tdumpStats(this.users, {\n\t\t\ttitle: \"Users\",\n\t\t\theaders: [\"Sessions\", \"Op count\"],\n\t\t\treverseColumnsInUI: true,\n\t\t\tlines: 6,\n\t\t});\n\t\tdumpStats(this.sessions, {\n\t\t\ttitle: \"Sessions\",\n\t\t\theaders: [\"Duration(s)\", \"Op count\"],\n\t\t\treverseColumnsInUI: true,\n\t\t\tlines: 6,\n\t\t});\n\t\tdumpStats(this.sessions, {\n\t\t\ttitle: \"Sessions\",\n\t\t\theaders: [\"Duration(s)\", \"Op count\"],\n\t\t\torderByFirstColumn: true,\n\t\t\treverseColumnsInUI: true,\n\t\t\tremoveTotals: true,\n\t\t\tlines: 5,\n\t\t});\n\t}\n}\n\n/**\n * Analyzer for data structures\n */\nclass DataStructureAnalyzer implements IMessageAnalyzer {\n\tprivate readonly messageTypeStats = new Map<string, [number, number]>();\n\tprivate readonly dataType = new Map<string, string>();\n\tprivate readonly dataTypeStats = new Map<string, [number, number]>();\n\tprivate readonly objectStats = new Map<string, [number, number]>();\n\t// eslint-disable-next-line @typescript-eslint/member-delimiter-style\n\tprivate readonly chunkMap = new Map<string, { chunks: string[]; totalSize: number }>();\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tif (!skipMessage) {\n\t\t\tprocessOp(\n\t\t\t\tmessage,\n\t\t\t\tthis.dataType,\n\t\t\t\tthis.objectStats,\n\t\t\t\tmsgSize,\n\t\t\t\tthis.dataTypeStats,\n\t\t\t\tthis.messageTypeStats,\n\t\t\t\tthis.chunkMap,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {\n\t\tdumpStats(this.messageTypeStats, {\n\t\t\ttitle: \"Message Type\",\n\t\t\theaders: [\"Op count\", \"Bytes\"],\n\t\t\tlines: 20,\n\t\t});\n\t\tdumpStats(calcChannelStats(this.dataType, this.objectStats), {\n\t\t\ttitle: \"Channel name\",\n\t\t\theaders: [\"Op count\", \"Bytes\"],\n\t\t\tlines: 7,\n\t\t});\n\t\t/*\n dumpStats(this.dataTypeStats, {\n title: \"Channel type\",\n headers: [\"Op count\", \"Bytes\"],\n });\n */\n\t}\n}\n\n/**\n * Helper class to report if we filtered out any messages.\n */\nclass FilteredMessageAnalyzer implements IMessageAnalyzer {\n\tprivate sizeTotal = 0;\n\tprivate opsTotal = 0;\n\tprivate sizeFiltered = 0;\n\tprivate opsFiltered = 0;\n\tprivate filtered = false;\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tthis.sizeTotal += msgSize;\n\t\tthis.opsTotal++;\n\t\tif (!skipMessage) {\n\t\t\tthis.sizeFiltered += msgSize;\n\t\t\tthis.opsFiltered++;\n\t\t} else {\n\t\t\tthis.filtered = true;\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {\n\t\tif (this.filtered) {\n\t\t\tconsole.log(\n\t\t\t\t`\\nData is filtered according to --filter:messageType argument(s):\\nOp size: ${this.sizeFiltered} / ${this.sizeTotal}\\nOp count ${this.opsFiltered} / ${this.opsTotal}`,\n\t\t\t);\n\t\t}\n\t\tif (this.opsTotal === 0) {\n\t\t\tconsole.error(\"No ops were found\");\n\t\t}\n\t}\n}\n\n/**\n * Helper class to find places where we generated too many ops\n */\nclass MessageDensityAnalyzer implements IMessageAnalyzer {\n\tprivate readonly opChunk = 1000;\n\tprivate opLimit = 1;\n\tprivate size = 0;\n\tprivate timeStart = 0;\n\tprivate doctimerStart = 0;\n\tprivate readonly ranges = new Map<string, [number, number]>();\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tif (message.sequenceNumber >= this.opLimit) {\n\t\t\tif (message.sequenceNumber !== 1) {\n\t\t\t\tconst timeDiff = durationFromTime(message.timestamp - this.timeStart);\n\t\t\t\tconst opsString = `ops = [${this.opLimit - this.opChunk}, ${\n\t\t\t\t\tthis.opLimit - 1\n\t\t\t\t}]`.padEnd(26);\n\t\t\t\tconst timeString = `time = [${durationFromTime(\n\t\t\t\t\tthis.timeStart - this.doctimerStart,\n\t\t\t\t)}, ${durationFromTime(message.timestamp - this.doctimerStart)}]`;\n\t\t\t\tthis.ranges.set(`${opsString} ${timeString}`, [timeDiff, this.size]);\n\t\t\t} else {\n\t\t\t\tthis.doctimerStart = message.timestamp;\n\t\t\t}\n\t\t\tthis.opLimit += this.opChunk;\n\t\t\tthis.size = 0;\n\t\t\tthis.timeStart = message.timestamp;\n\t\t}\n\t\tif (!skipMessage) {\n\t\t\tthis.size += msgSize;\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {\n\t\tdumpStats(this.ranges, {\n\t\t\ttitle: \"Fastest 1000 op ranges\",\n\t\t\theaders: [\"Duration(s)\", \"Bytes\"],\n\t\t\torderByFirstColumn: true,\n\t\t\treverseSort: true,\n\t\t\tremoveTotals: true,\n\t\t\tlines: 3,\n\t\t});\n\t}\n}\n\n/**\n * Helper class to analyze collab window size\n */\nclass CollabWindowSizeAnalyzer implements IMessageAnalyzer {\n\tprivate maxCollabWindow = 0;\n\tprivate opSeq = 0;\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tconst value = message.sequenceNumber - message.minimumSequenceNumber;\n\t\tif (value > this.maxCollabWindow) {\n\t\t\tthis.maxCollabWindow = value;\n\t\t\tthis.opSeq = message.sequenceNumber;\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {\n\t\tconsole.log(`\\nMaximum collab window size: ${this.maxCollabWindow}, seq# ${this.opSeq}`);\n\t}\n}\n\n/**\n * Helper class to analyze frequency of summaries\n */\nclass SummaryAnalyzer implements IMessageAnalyzer {\n\tprivate lastSummaryOp = 0;\n\tprivate maxDistance = 0;\n\tprivate maxSeq = 0;\n\tprivate minDistance = Number.MAX_SAFE_INTEGER;\n\tprivate minSeq = 0;\n\tprivate maxResponse = 0;\n\tprivate maxResponseSeq = 0;\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tif (message.type === MessageType.SummaryAck) {\n\t\t\tconst distance = message.sequenceNumber - this.lastSummaryOp - 1;\n\t\t\tif (this.maxDistance < distance) {\n\t\t\t\tthis.maxDistance = distance;\n\t\t\t\tthis.maxSeq = message.sequenceNumber;\n\t\t\t}\n\t\t\tif (this.minDistance > distance) {\n\t\t\t\tthis.minDistance = distance;\n\t\t\t\tthis.minSeq = message.sequenceNumber;\n\t\t\t}\n\n\t\t\tthis.lastSummaryOp = message.sequenceNumber;\n\t\t}\n\t\tif (message.type === MessageType.SummaryAck || message.type === MessageType.SummaryNack) {\n\t\t\tconst contents: ISummaryProposal = (message.contents as ISummaryAck | ISummaryNack)\n\t\t\t\t.summaryProposal;\n\t\t\tconst distance = message.sequenceNumber - contents.summarySequenceNumber;\n\t\t\tif (distance > this.maxResponse) {\n\t\t\t\tthis.maxResponse = distance;\n\t\t\t\tthis.maxResponseSeq = message.sequenceNumber;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {\n\t\tconst distance = lastOp.sequenceNumber - this.lastSummaryOp;\n\t\tif (this.maxDistance < distance) {\n\t\t\tthis.maxDistance = distance;\n\t\t\tthis.maxSeq = lastOp.sequenceNumber + 1;\n\t\t}\n\n\t\tconsole.log(\"\");\n\t\tif (this.minDistance === Number.MAX_SAFE_INTEGER) {\n\t\t\tconsole.log(\"No summaries found in this document\");\n\t\t} else {\n\t\t\tconsole.log(\n\t\t\t\t`Maximum distance between summaries: ${this.maxDistance}, seq# ${this.maxSeq}`,\n\t\t\t);\n\t\t\tconsole.log(\n\t\t\t\t`Maximum server response for summary: ${this.maxResponse}, seq# ${this.maxResponseSeq}`,\n\t\t\t);\n\t\t\tconsole.log(\n\t\t\t\t`Minimum distance between summaries: ${this.minDistance}, seq# ${this.minSeq}`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Helper class to dump messages to console\n */\nclass MessageDumper implements IMessageAnalyzer {\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tif (!skipMessage) {\n\t\t\tconsole.log(JSON.stringify(message, undefined, 2));\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {}\n}\n\nexport async function printMessageStats(\n\tgenerator, // AsyncGenerator<ISequencedDocumentMessage[]>,\n\tdumpMessageStats: boolean,\n\tdumpMessages: boolean,\n\tmessageTypeFilter: Set<string> = new Set<string>(),\n) {\n\tlet lastMessage: ISequencedDocumentMessage | undefined;\n\n\tconst analyzers: IMessageAnalyzer[] = [\n\t\tnew FilteredMessageAnalyzer(), // Should come first\n\t\tnew SessionAnalyzer(),\n\t\tnew DataStructureAnalyzer(),\n\t\tnew MessageDensityAnalyzer(),\n\t\tnew CollabWindowSizeAnalyzer(),\n\t\tnew SummaryAnalyzer(),\n\t];\n\n\tif (dumpMessages) {\n\t\tanalyzers.push(new MessageDumper());\n\t}\n\n\tfor await (const messages of generator) {\n\t\tfor (const message of messages as ISequencedDocumentMessage[]) {\n\t\t\tconst msgSize = JSON.stringify(message).length;\n\t\t\tlastMessage = message;\n\n\t\t\tconst skipMessage =\n\t\t\t\tmessageTypeFilter.size !== 0 && !messageTypeFilter.has(message.type);\n\n\t\t\tfor (const analyzer of analyzers) {\n\t\t\t\tanalyzer.processOp(message, msgSize, skipMessage);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (lastMessage !== undefined) {\n\t\tif (dumpMessageStats) {\n\t\t\tfor (const analyzer of analyzers) {\n\t\t\t\tanalyzer.reportAnalyzes(lastMessage);\n\t\t\t}\n\t\t} else {\n\t\t\t// Warn about filtered messages\n\t\t\tanalyzers[0].reportAnalyzes(lastMessage);\n\t\t}\n\t}\n\tconsole.log(\"\");\n}\n\nfunction processOp(\n\truntimeMessage: ISequencedDocumentMessage,\n\tdataType: Map<string, string>,\n\tobjectStats: Map<string, [number, number]>,\n\tmsgSize: number,\n\tdataTypeStats: Map<string, [number, number]>,\n\tmessageTypeStats: Map<string, [number, number]>,\n\tchunkMap: Map<string, { chunks: string[]; totalSize: number }>,\n) {\n\tlet type = runtimeMessage.type;\n\tlet recorded = false;\n\tlet totalMsgSize = msgSize;\n\tlet opCount = 1;\n\tif (unpackRuntimeMessage(runtimeMessage)) {\n\t\tconst messageType = runtimeMessage.type as ContainerMessageType;\n\t\tswitch (messageType) {\n\t\t\tcase ContainerMessageType.Attach: {\n\t\t\t\tconst attachMessage = runtimeMessage.contents as IAttachMessage;\n\t\t\t\tprocessDataStoreAttachOp(attachMessage, dataType);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// skip for now because these ops do not have contents\n\t\t\tcase ContainerMessageType.BlobAttach: {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// The default method to count stats should be used for GC messages.\n\t\t\tcase ContainerMessageType.GC: {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.DocumentSchemaChange: {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.ChunkedOp: {\n\t\t\t\tconst chunk = runtimeMessage.contents as IChunkedOp;\n\t\t\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\t\tif (!chunkMap.has(runtimeMessage.clientId as string)) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\t\t\tchunkMap.set(runtimeMessage.clientId as string, {\n\t\t\t\t\t\tchunks: new Array<string>(chunk.totalChunks),\n\t\t\t\t\t\ttotalSize: 0,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\t\tconst value = chunkMap.get(runtimeMessage.clientId as string);\n\t\t\t\tassert(value !== undefined, 0x2b8 /* \"Chunk should be set in map\" */);\n\t\t\t\tconst chunks = value.chunks;\n\t\t\t\tconst chunkIndex = chunk.chunkId - 1;\n\t\t\t\tif (chunks[chunkIndex] !== undefined) {\n\t\t\t\t\tthrow new Error(\"Chunk already assigned\");\n\t\t\t\t}\n\t\t\t\tchunks[chunkIndex] = chunk.contents;\n\t\t\t\tvalue.totalSize += msgSize;\n\t\t\t\tif (chunk.chunkId === chunk.totalChunks) {\n\t\t\t\t\topCount = chunk.totalChunks; // 1 op for each chunk.\n\t\t\t\t\tconst patchedMessage = Object.create(runtimeMessage);\n\t\t\t\t\tpatchedMessage.contents = chunks.join(\"\");\n\t\t\t\t\ttype = (chunk as any).originalType;\n\t\t\t\t\tpatchedMessage.type = type;\n\t\t\t\t\ttotalMsgSize = value.totalSize;\n\t\t\t\t\tchunkMap.delete(patchedMessage.clientId);\n\t\t\t\t} else {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line no-fallthrough\n\t\t\t}\n\t\t\tcase ContainerMessageType.IdAllocation:\n\t\t\tcase ContainerMessageType.FluidDataStoreOp:\n\t\t\tcase ContainerMessageType.Alias:\n\t\t\tcase ContainerMessageType.Rejoin: {\n\t\t\t\tlet envelope = runtimeMessage.contents as IEnvelope;\n\t\t\t\t// TODO: Legacy?\n\t\t\t\tif (envelope !== undefined && typeof envelope === \"string\") {\n\t\t\t\t\tenvelope = JSON.parse(envelope);\n\t\t\t\t}\n\t\t\t\tconst innerContent = envelope.contents as {\n\t\t\t\t\tcontent: any;\n\t\t\t\t\ttype: string;\n\t\t\t\t};\n\t\t\t\tconst address = envelope.address;\n\t\t\t\ttype = `${type}/${innerContent.type}`;\n\t\t\t\tswitch (innerContent.type) {\n\t\t\t\t\tcase DataStoreMessageType.Attach: {\n\t\t\t\t\t\tconst attachMessage = innerContent.content as IAttachMessage;\n\t\t\t\t\t\tlet objectType = attachMessage.type;\n\t\t\t\t\t\tif (objectType.startsWith(objectTypePrefix)) {\n\t\t\t\t\t\t\tobjectType = objectType.substring(objectTypePrefix.length);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdataType.set(getObjectId(address, attachMessage.id), objectType);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase DataStoreMessageType.ChannelOp:\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tconst innerEnvelope = innerContent.content as IEnvelope;\n\t\t\t\t\t\tconst innerContent2 = innerEnvelope.contents as {\n\t\t\t\t\t\t\ttype?: string;\n\t\t\t\t\t\t\tvalue?: any;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst objectId = getObjectId(address, innerEnvelope.address);\n\t\t\t\t\t\tincr(objectStats, objectId, totalMsgSize, opCount);\n\t\t\t\t\t\tlet objectType = dataType.get(objectId);\n\t\t\t\t\t\tif (objectType === undefined) {\n\t\t\t\t\t\t\t// Somehow we do not have data...\n\t\t\t\t\t\t\tdataType.set(objectId, objectId);\n\t\t\t\t\t\t\tobjectType = objectId;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tincr(dataTypeStats, objectType, totalMsgSize, opCount);\n\t\t\t\t\t\trecorded = true;\n\n\t\t\t\t\t\tlet subType = innerContent2.type;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tinnerContent2.type === \"set\" &&\n\t\t\t\t\t\t\ttypeof innerContent2.value === \"object\" &&\n\t\t\t\t\t\t\tinnerContent2.value !== null\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\ttype = `${type}/${subType}`;\n\t\t\t\t\t\t\tsubType = innerContent2.value.type;\n\t\t\t\t\t\t} else if (objectType === \"mergeTree\" && subType !== undefined) {\n\t\t\t\t\t\t\tconst types = [\"insert\", \"remove\", \"annotate\", \"group\"];\n\t\t\t\t\t\t\tif (types[subType] !== undefined) {\n\t\t\t\t\t\t\t\tsubType = types[subType];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (subType !== undefined) {\n\t\t\t\t\t\t\ttype = `${type}/${subType}`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttype = `${type} (${objectType})`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(messageType, \"Message type not recognized!\");\n\t\t}\n\t}\n\n\tincr(messageTypeStats, type, totalMsgSize, opCount);\n\tif (!recorded) {\n\t\t// const objectId = `${type} (system)`;\n\t\tconst objectId = `(system messages)`;\n\t\tconst objectType = objectId;\n\t\tif (dataType.get(objectId) === undefined) {\n\t\t\tdataType.set(objectId, objectId);\n\t\t}\n\t\tincr(objectStats, objectId, totalMsgSize, opCount);\n\t\tincr(dataTypeStats, objectType, totalMsgSize, opCount);\n\t}\n}\n\nfunction processDataStoreAttachOp(\n\tattachMessage: IAttachMessage | string,\n\tdataType: Map<string, string>,\n) {\n\t// dataType.set(getObjectId(attachMessage.id), attachMessage.type);\n\n\t// That's data store, and it brings a bunch of data structures.\n\t// Let's try to crack it.\n\tconst parsedAttachMessage =\n\t\ttypeof attachMessage === \"string\" ? JSON.parse(attachMessage) : attachMessage;\n\tfor (const entry of parsedAttachMessage.snapshot.entries) {\n\t\tif (entry.type === TreeEntry.Tree) {\n\t\t\tfor (const entry2 of entry.value.entries) {\n\t\t\t\tif (entry2.path === \".attributes\" && entry2.type === TreeEntry.Blob) {\n\t\t\t\t\tconst attrib = JSON.parse(entry2.value.contents);\n\t\t\t\t\tlet objectType: string = attrib.type;\n\t\t\t\t\tif (objectType.startsWith(objectTypePrefix)) {\n\t\t\t\t\t\tobjectType = objectType.substring(objectTypePrefix.length);\n\t\t\t\t\t}\n\t\t\t\t\tdataType.set(getObjectId(parsedAttachMessage.id, entry.path), objectType);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction reportOpenSessions(\n\tlastOpTimestamp: number,\n\tsessionsInProgress: Map<string, ActiveSession>,\n\tsessions: Map<string, [number, number]>,\n\tusers: Map<string, [number, number]>,\n) {\n\tconst activeSessions = new Map<string, [number, number]>();\n\n\tfor (const [clientId, ses] of sessionsInProgress) {\n\t\tconst sessionInfo = ses.leave(lastOpTimestamp);\n\t\tif (clientId !== noClientName) {\n\t\t\tconst sessionName = `${clientId} (${sessionInfo.email})`;\n\t\t\tconst sessionPayload: [number, number] = [\n\t\t\t\tdurationFromTime(sessionInfo.duration),\n\t\t\t\tsessionInfo.opCount,\n\t\t\t];\n\t\t\tsessions.set(sessionName, sessionPayload);\n\t\t\tactiveSessions.set(sessionName, sessionPayload);\n\t\t} else {\n\t\t\tsessions.set(`Full file lifespan (noClient messages)`, [\n\t\t\t\tdurationFromTime(sessionInfo.duration),\n\t\t\t\tsessionInfo.opCount,\n\t\t\t]);\n\t\t}\n\t\tincr(users, sessionInfo.email, sessionInfo.opCount);\n\t}\n\n\tif (activeSessions.size > 0) {\n\t\tdumpStats(activeSessions, {\n\t\t\ttitle: \"Active sessions\",\n\t\t\theaders: [\"Duration\", \"Op count\"],\n\t\t\tlines: 6,\n\t\t\torderByFirstColumn: true,\n\t\t\tremoveTotals: true,\n\t\t});\n\t}\n}\n\nfunction calcChannelStats(\n\tdataType: Map<string, string>,\n\tobjectStats: Map<string, [number, number]>,\n) {\n\tconst channelStats = new Map<string, [number, number]>();\n\tfor (const [objectId, type] of dataType) {\n\t\tlet value = objectStats.get(objectId);\n\t\tif (value === undefined) {\n\t\t\tvalue = [0, 0];\n\t\t}\n\t\tif (type === objectId) {\n\t\t\tchannelStats.set(`${objectId}`, value);\n\t\t} else {\n\t\t\tchannelStats.set(`${objectId} (${type})`, value);\n\t\t}\n\t}\n\treturn channelStats;\n}\n\nfunction processQuorumMessages(\n\tmessage: ISequencedDocumentMessage,\n\tskipMessage: boolean,\n\tsessionsInProgress: Map<string, ActiveSession>,\n\tsessions: Map<string, [number, number]>,\n\tusers: Map<string, [number, number]>,\n) {\n\tlet session: ActiveSession | undefined;\n\tconst dataString = (message as any).data;\n\tif (message.type === \"join\") {\n\t\tconst data = JSON.parse(dataString);\n\t\tsession = ActiveSession.create(data.detail.user.id, message);\n\t\tsessionsInProgress.set(data.clientId, session);\n\t} else if (message.type === \"leave\") {\n\t\tconst clientId = JSON.parse(dataString);\n\t\tsession = sessionsInProgress.get(clientId);\n\t\tsessionsInProgress.delete(clientId);\n\t\tassert(!!session, 0x1b7 /* \"Bad session state for processing quorum messages\" */);\n\t\tif (session !== undefined) {\n\t\t\tif (!skipMessage) {\n\t\t\t\tsession.reportOp(message.timestamp);\n\t\t\t}\n\t\t\tconst sessionInfo: ISessionInfo = session.leave(message.timestamp);\n\t\t\tsessions.set(`${clientId} (${sessionInfo.email})`, [\n\t\t\t\tdurationFromTime(sessionInfo.duration),\n\t\t\t\tsessionInfo.opCount,\n\t\t\t]);\n\t\t\tincr(users, sessionInfo.email, sessionInfo.opCount);\n\t\t\tsession = undefined; // Do not record it second time\n\t\t}\n\t} else {\n\t\t// message.clientId can be null\n\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\tsession = sessionsInProgress.get(message.clientId as string);\n\t\tif (session === undefined) {\n\t\t\tsession = sessionsInProgress.get(noClientName);\n\t\t\tassert(!!session, 0x1b8 /* \"Bad session state for processing quorum messages\" */);\n\t\t}\n\t}\n\treturn session;\n}\n\nconst durationFromTime = (time: number): number => Math.floor(time / 1000);\n"]}
1
+ {"version":3,"file":"fluidAnalyzeMessages.js","sourceRoot":"","sources":["../src/fluidAnalyzeMessages.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yEAIoD;AACpD,kEAA8E;AAC9E,iEAA0E;AAC1E,+EAO8C;AAG9C,MAAM,YAAY,GAAG,WAAW,CAAC;AACjC,MAAM,gBAAgB,GAAG,oCAAoC,CAAC;AAE9D,SAAS,IAAI,CAAC,GAAkC,EAAE,GAAW,EAAE,IAAY,EAAE,KAAK,GAAG,CAAC;IACrF,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS,EAAE;QACxB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;KAC5B;SAAM;QACN,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;QAClB,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;QACjB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KACpB;AACF,CAAC;AAcD;;GAEG;AACH,MAAM,aAAa;IACX,MAAM,CAAC,MAAM,CAAC,KAAa,EAAE,OAAkC;QACrE,OAAO,IAAI,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAID,YACkB,KAAa,EACb,YAAuC;QADvC,UAAK,GAAL,KAAK,CAAQ;QACb,iBAAY,GAAZ,YAAY,CAA2B;QAJjD,YAAO,GAAG,CAAC,CAAC;IAKjB,CAAC;IAEG,QAAQ,CAAC,SAAiB;QAChC,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;IAEM,KA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AkB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACpC,IAAA,iBAAM,EAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAClF,IAAI,OAAO,KAAK,SAAS,EAAE;YAC1B,IAAI,CAAC,WAAW,EAAE;gBACjB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;aACpC;YACD,MAAM,WAAW,GAAiB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACnE,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,KAAK,WAAW,CAAC,KAAK,GAAG,EAAE;gBAClD,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC;gBACtC,WAAW,CAAC,OAAO;aACnB,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;YACpD,OAAO,GAAG,SAAS,CAAC,CAAC,+BAA+B;SACpD;KACD;SAAM;QACN,+BAA+B;QAC/B,+FAA+F;QAC/F,4EAA4E;QAC5E,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,QAAkB,CAAC,CAAC;QAC7D,IAAI,OAAO,KAAK,SAAS,EAAE;YAC1B,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAC/C,IAAA,iBAAM,EAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,wDAAwD,CAAC,CAAC;SAClF;KACD;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tContainerMessageType,\n\tIChunkedOp,\n\tunpackRuntimeMessage,\n} from \"@fluidframework/container-runtime/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { DataStoreMessageType } from \"@fluidframework/datastore/internal\";\nimport {\n\tISequencedDocumentMessage,\n\tISummaryAck,\n\tISummaryNack,\n\tISummaryProposal,\n\tMessageType,\n\tTreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport { IAttachMessage, IEnvelope } from \"@fluidframework/runtime-definitions/internal\";\n\nconst noClientName = \"No Client\";\nconst objectTypePrefix = \"https://graph.microsoft.com/types/\";\n\nfunction incr(map: Map<string, [number, number]>, key: string, size: number, count = 1) {\n\tconst value = map.get(key);\n\tif (value === undefined) {\n\t\tmap.set(key, [count, size]);\n\t} else {\n\t\tvalue[0] += count;\n\t\tvalue[1] += size;\n\t\tmap.set(key, value);\n\t}\n}\n\ninterface ISessionInfo {\n\tstartSeq: number;\n\topCount: number;\n\temail: string;\n\tduration: number;\n}\n\ninterface IMessageAnalyzer {\n\tprocessOp(op: ISequencedDocumentMessage, msgSize: number, filteredOutOp: boolean): void;\n\treportAnalyzes(lastOp: ISequencedDocumentMessage): void;\n}\n\n/**\n * Helper class to track session statistics\n */\nclass ActiveSession {\n\tpublic static create(email: string, message: ISequencedDocumentMessage) {\n\t\treturn new ActiveSession(email, message);\n\t}\n\n\tprivate opCount = 0;\n\n\tconstructor(\n\t\tprivate readonly email: string,\n\t\tprivate readonly startMessage: ISequencedDocumentMessage,\n\t) {}\n\n\tpublic reportOp(timestamp: number) {\n\t\tthis.opCount++;\n\t}\n\n\tpublic leave(timestamp: number): ISessionInfo {\n\t\treturn {\n\t\t\topCount: this.opCount,\n\t\t\temail: this.email,\n\t\t\tstartSeq: this.startMessage.sequenceNumber,\n\t\t\tduration: timestamp - this.startMessage.timestamp,\n\t\t};\n\t}\n}\n\n// Format a number separating 3 digits by comma\nexport const formatNumber = (num: number): string =>\n\t// eslint-disable-next-line unicorn/no-unsafe-regex\n\tnum.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n\nfunction dumpStats(\n\tmap: Map<string, [number, number]>,\n\tprops: {\n\t\ttitle: string;\n\t\theaders: [string, string];\n\t\tlines?: number;\n\t\torderByFirstColumn?: boolean;\n\t\treverseColumnsInUI?: boolean;\n\t\tremoveTotals?: boolean;\n\t\treverseSort?: boolean;\n\t},\n) {\n\tconst fieldSizes = [10, 14];\n\tconst nameLength = 72;\n\tconst fieldsLength = fieldSizes[0] + fieldSizes[1] + 1;\n\tlet headers = props.headers;\n\n\tlet recordsToShow = props.lines ?? 10;\n\tif (map.size !== recordsToShow && props.removeTotals === undefined && recordsToShow > 1) {\n\t\trecordsToShow--;\n\t}\n\n\tlet sorted: [string, [number, number]][];\n\tconst sortIndex = props.orderByFirstColumn === true ? 0 : 1;\n\tlet add: string;\n\tif (props.reverseSort !== undefined) {\n\t\tsorted = [...map.entries()].sort((a, b) => a[1][sortIndex] - b[1][sortIndex]);\n\t\tadd = \"↑\";\n\t} else {\n\t\tsorted = [...map.entries()].sort((a, b) => b[1][sortIndex] - a[1][sortIndex]);\n\t\tadd = \"↓\";\n\t}\n\theaders[sortIndex] = `${headers[sortIndex]} ${add}`;\n\n\tif (props.reverseColumnsInUI !== undefined) {\n\t\theaders = [headers[1], headers[0]];\n\t\tconst sorted2: [string, [number, number]][] = [];\n\t\tfor (const [name, [count, size]] of sorted) {\n\t\t\tsorted2.push([name, [size, count]]);\n\t\t}\n\t\tsorted = sorted2;\n\t}\n\n\tlet totalCount = 0;\n\tlet sizeTotal = 0;\n\n\tprops.title = `${props.title} (${sorted.length})`;\n\tconst header0 = headers[0].padStart(fieldSizes[0]);\n\tlet overflow = header0.length - fieldSizes[0];\n\tconsole.log(\n\t\t`\\n\\n${props.title.padEnd(nameLength)} │ ${header0} ${headers[1].padStart(\n\t\t\tfieldSizes[1] - overflow,\n\t\t)}`,\n\t);\n\n\tconsole.log(`${\"─\".repeat(nameLength + 1)}┼${\"─\".repeat(fieldsLength + 1)}`);\n\tlet index = 0;\n\tlet allOtherCount = 0;\n\tlet allOtherSize = 0;\n\tfor (const [name, [count, size]] of sorted) {\n\t\tindex++;\n\t\ttotalCount += count;\n\t\tsizeTotal += size;\n\t\tif (index <= recordsToShow) {\n\t\t\tconst item = name.padEnd(nameLength);\n\t\t\toverflow = item.length - nameLength;\n\t\t\tconst col1 = formatNumber(count).padStart(fieldSizes[0] - overflow);\n\t\t\toverflow += col1.length - fieldSizes[0];\n\t\t\tconst col2 = formatNumber(size).padStart(fieldSizes[1] - overflow);\n\t\t\tconsole.log(`${item} │ ${col1} ${col2}`);\n\t\t} else {\n\t\t\tallOtherCount += count;\n\t\t\tallOtherSize += size;\n\t\t}\n\t}\n\n\tif (props.removeTotals === undefined) {\n\t\tif (allOtherCount || allOtherSize) {\n\t\t\tconsole.log(\n\t\t\t\t`${`All Others (${sorted.length - recordsToShow})`.padEnd(\n\t\t\t\t\tnameLength,\n\t\t\t\t)} │ ${formatNumber(allOtherCount).padStart(fieldSizes[0])} ${formatNumber(\n\t\t\t\t\tallOtherSize,\n\t\t\t\t).padStart(fieldSizes[1])}`,\n\t\t\t);\n\t\t}\n\t\tconsole.log(`${\"─\".repeat(nameLength + 1)}┼${\"─\".repeat(fieldsLength + 1)}`);\n\t\tconsole.log(\n\t\t\t`${\"Total\".padEnd(nameLength)} │ ${formatNumber(totalCount).padStart(\n\t\t\t\tfieldSizes[0],\n\t\t\t)} ${formatNumber(sizeTotal).padStart(fieldSizes[1])}`,\n\t\t);\n\t}\n}\n\nconst getObjectId = (dataStoreId: string, id: string) => `[${dataStoreId}]/${id}`;\n\n/**\n * Analyzer for sessions\n */\nclass SessionAnalyzer implements IMessageAnalyzer {\n\tprivate readonly sessionsInProgress = new Map<string, ActiveSession>();\n\tprivate readonly sessions = new Map<string, [number, number]>();\n\tprivate readonly users = new Map<string, [number, number]>();\n\n\tprivate first = true;\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tif (this.first) {\n\t\t\tthis.first = false;\n\t\t\t// Start of the road.\n\t\t\tconst noNameSession = ActiveSession.create(noClientName, message);\n\t\t\tthis.sessionsInProgress.set(noClientName, noNameSession);\n\t\t}\n\t\tconst session = processQuorumMessages(\n\t\t\tmessage,\n\t\t\tskipMessage,\n\t\t\tthis.sessionsInProgress,\n\t\t\tthis.sessions,\n\t\t\tthis.users,\n\t\t);\n\t\tif (!skipMessage && session) {\n\t\t\tsession.reportOp(message.timestamp);\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {\n\t\t// Close any open sessions\n\t\treportOpenSessions(lastOp.timestamp, this.sessionsInProgress, this.sessions, this.users);\n\t\tdumpStats(this.users, {\n\t\t\ttitle: \"Users\",\n\t\t\theaders: [\"Sessions\", \"Op count\"],\n\t\t\treverseColumnsInUI: true,\n\t\t\tlines: 6,\n\t\t});\n\t\tdumpStats(this.sessions, {\n\t\t\ttitle: \"Sessions\",\n\t\t\theaders: [\"Duration(s)\", \"Op count\"],\n\t\t\treverseColumnsInUI: true,\n\t\t\tlines: 6,\n\t\t});\n\t\tdumpStats(this.sessions, {\n\t\t\ttitle: \"Sessions\",\n\t\t\theaders: [\"Duration(s)\", \"Op count\"],\n\t\t\torderByFirstColumn: true,\n\t\t\treverseColumnsInUI: true,\n\t\t\tremoveTotals: true,\n\t\t\tlines: 5,\n\t\t});\n\t}\n}\n\n/**\n * Analyzer for data structures\n */\nclass DataStructureAnalyzer implements IMessageAnalyzer {\n\tprivate readonly messageTypeStats = new Map<string, [number, number]>();\n\tprivate readonly dataType = new Map<string, string>();\n\tprivate readonly dataTypeStats = new Map<string, [number, number]>();\n\tprivate readonly objectStats = new Map<string, [number, number]>();\n\t// eslint-disable-next-line @typescript-eslint/member-delimiter-style\n\tprivate readonly chunkMap = new Map<string, { chunks: string[]; totalSize: number }>();\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tif (!skipMessage) {\n\t\t\tprocessOp(\n\t\t\t\tmessage,\n\t\t\t\tthis.dataType,\n\t\t\t\tthis.objectStats,\n\t\t\t\tmsgSize,\n\t\t\t\tthis.dataTypeStats,\n\t\t\t\tthis.messageTypeStats,\n\t\t\t\tthis.chunkMap,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {\n\t\tdumpStats(this.messageTypeStats, {\n\t\t\ttitle: \"Message Type\",\n\t\t\theaders: [\"Op count\", \"Bytes\"],\n\t\t\tlines: 20,\n\t\t});\n\t\tdumpStats(calcChannelStats(this.dataType, this.objectStats), {\n\t\t\ttitle: \"Channel name\",\n\t\t\theaders: [\"Op count\", \"Bytes\"],\n\t\t\tlines: 7,\n\t\t});\n\t\t/*\n dumpStats(this.dataTypeStats, {\n title: \"Channel type\",\n headers: [\"Op count\", \"Bytes\"],\n });\n */\n\t}\n}\n\n/**\n * Helper class to report if we filtered out any messages.\n */\nclass FilteredMessageAnalyzer implements IMessageAnalyzer {\n\tprivate sizeTotal = 0;\n\tprivate opsTotal = 0;\n\tprivate sizeFiltered = 0;\n\tprivate opsFiltered = 0;\n\tprivate filtered = false;\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tthis.sizeTotal += msgSize;\n\t\tthis.opsTotal++;\n\t\tif (!skipMessage) {\n\t\t\tthis.sizeFiltered += msgSize;\n\t\t\tthis.opsFiltered++;\n\t\t} else {\n\t\t\tthis.filtered = true;\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {\n\t\tif (this.filtered) {\n\t\t\tconsole.log(\n\t\t\t\t`\\nData is filtered according to --filter:messageType argument(s):\\nOp size: ${this.sizeFiltered} / ${this.sizeTotal}\\nOp count ${this.opsFiltered} / ${this.opsTotal}`,\n\t\t\t);\n\t\t}\n\t\tif (this.opsTotal === 0) {\n\t\t\tconsole.error(\"No ops were found\");\n\t\t}\n\t}\n}\n\n/**\n * Helper class to find places where we generated too many ops\n */\nclass MessageDensityAnalyzer implements IMessageAnalyzer {\n\tprivate readonly opChunk = 1000;\n\tprivate opLimit = 1;\n\tprivate size = 0;\n\tprivate timeStart = 0;\n\tprivate doctimerStart = 0;\n\tprivate readonly ranges = new Map<string, [number, number]>();\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tif (message.sequenceNumber >= this.opLimit) {\n\t\t\tif (message.sequenceNumber !== 1) {\n\t\t\t\tconst timeDiff = durationFromTime(message.timestamp - this.timeStart);\n\t\t\t\tconst opsString = `ops = [${this.opLimit - this.opChunk}, ${\n\t\t\t\t\tthis.opLimit - 1\n\t\t\t\t}]`.padEnd(26);\n\t\t\t\tconst timeString = `time = [${durationFromTime(\n\t\t\t\t\tthis.timeStart - this.doctimerStart,\n\t\t\t\t)}, ${durationFromTime(message.timestamp - this.doctimerStart)}]`;\n\t\t\t\tthis.ranges.set(`${opsString} ${timeString}`, [timeDiff, this.size]);\n\t\t\t} else {\n\t\t\t\tthis.doctimerStart = message.timestamp;\n\t\t\t}\n\t\t\tthis.opLimit += this.opChunk;\n\t\t\tthis.size = 0;\n\t\t\tthis.timeStart = message.timestamp;\n\t\t}\n\t\tif (!skipMessage) {\n\t\t\tthis.size += msgSize;\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {\n\t\tdumpStats(this.ranges, {\n\t\t\ttitle: \"Fastest 1000 op ranges\",\n\t\t\theaders: [\"Duration(s)\", \"Bytes\"],\n\t\t\torderByFirstColumn: true,\n\t\t\treverseSort: true,\n\t\t\tremoveTotals: true,\n\t\t\tlines: 3,\n\t\t});\n\t}\n}\n\n/**\n * Helper class to analyze collab window size\n */\nclass CollabWindowSizeAnalyzer implements IMessageAnalyzer {\n\tprivate maxCollabWindow = 0;\n\tprivate opSeq = 0;\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tconst value = message.sequenceNumber - message.minimumSequenceNumber;\n\t\tif (value > this.maxCollabWindow) {\n\t\t\tthis.maxCollabWindow = value;\n\t\t\tthis.opSeq = message.sequenceNumber;\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {\n\t\tconsole.log(`\\nMaximum collab window size: ${this.maxCollabWindow}, seq# ${this.opSeq}`);\n\t}\n}\n\n/**\n * Helper class to analyze frequency of summaries\n */\nclass SummaryAnalyzer implements IMessageAnalyzer {\n\tprivate lastSummaryOp = 0;\n\tprivate maxDistance = 0;\n\tprivate maxSeq = 0;\n\tprivate minDistance = Number.MAX_SAFE_INTEGER;\n\tprivate minSeq = 0;\n\tprivate maxResponse = 0;\n\tprivate maxResponseSeq = 0;\n\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tif (message.type === MessageType.SummaryAck) {\n\t\t\tconst distance = message.sequenceNumber - this.lastSummaryOp - 1;\n\t\t\tif (this.maxDistance < distance) {\n\t\t\t\tthis.maxDistance = distance;\n\t\t\t\tthis.maxSeq = message.sequenceNumber;\n\t\t\t}\n\t\t\tif (this.minDistance > distance) {\n\t\t\t\tthis.minDistance = distance;\n\t\t\t\tthis.minSeq = message.sequenceNumber;\n\t\t\t}\n\n\t\t\tthis.lastSummaryOp = message.sequenceNumber;\n\t\t}\n\t\tif (message.type === MessageType.SummaryAck || message.type === MessageType.SummaryNack) {\n\t\t\tconst contents: ISummaryProposal = (message.contents as ISummaryAck | ISummaryNack)\n\t\t\t\t.summaryProposal;\n\t\t\tconst distance = message.sequenceNumber - contents.summarySequenceNumber;\n\t\t\tif (distance > this.maxResponse) {\n\t\t\t\tthis.maxResponse = distance;\n\t\t\t\tthis.maxResponseSeq = message.sequenceNumber;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {\n\t\tconst distance = lastOp.sequenceNumber - this.lastSummaryOp;\n\t\tif (this.maxDistance < distance) {\n\t\t\tthis.maxDistance = distance;\n\t\t\tthis.maxSeq = lastOp.sequenceNumber + 1;\n\t\t}\n\n\t\tconsole.log(\"\");\n\t\tif (this.minDistance === Number.MAX_SAFE_INTEGER) {\n\t\t\tconsole.log(\"No summaries found in this document\");\n\t\t} else {\n\t\t\tconsole.log(\n\t\t\t\t`Maximum distance between summaries: ${this.maxDistance}, seq# ${this.maxSeq}`,\n\t\t\t);\n\t\t\tconsole.log(\n\t\t\t\t`Maximum server response for summary: ${this.maxResponse}, seq# ${this.maxResponseSeq}`,\n\t\t\t);\n\t\t\tconsole.log(\n\t\t\t\t`Minimum distance between summaries: ${this.minDistance}, seq# ${this.minSeq}`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Helper class to dump messages to console\n */\nclass MessageDumper implements IMessageAnalyzer {\n\tpublic processOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tmsgSize: number,\n\t\tskipMessage: boolean,\n\t): void {\n\t\tif (!skipMessage) {\n\t\t\tconsole.log(JSON.stringify(message, undefined, 2));\n\t\t}\n\t}\n\n\tpublic reportAnalyzes(lastOp: ISequencedDocumentMessage): void {}\n}\n\nexport async function printMessageStats(\n\tgenerator, // AsyncGenerator<ISequencedDocumentMessage[]>,\n\tdumpMessageStats: boolean,\n\tdumpMessages: boolean,\n\tmessageTypeFilter: Set<string> = new Set<string>(),\n) {\n\tlet lastMessage: ISequencedDocumentMessage | undefined;\n\n\tconst analyzers: IMessageAnalyzer[] = [\n\t\tnew FilteredMessageAnalyzer(), // Should come first\n\t\tnew SessionAnalyzer(),\n\t\tnew DataStructureAnalyzer(),\n\t\tnew MessageDensityAnalyzer(),\n\t\tnew CollabWindowSizeAnalyzer(),\n\t\tnew SummaryAnalyzer(),\n\t];\n\n\tif (dumpMessages) {\n\t\tanalyzers.push(new MessageDumper());\n\t}\n\n\tfor await (const messages of generator) {\n\t\tfor (const message of messages as ISequencedDocumentMessage[]) {\n\t\t\tconst msgSize = JSON.stringify(message).length;\n\t\t\tlastMessage = message;\n\n\t\t\tconst skipMessage =\n\t\t\t\tmessageTypeFilter.size !== 0 && !messageTypeFilter.has(message.type);\n\n\t\t\tfor (const analyzer of analyzers) {\n\t\t\t\tanalyzer.processOp(message, msgSize, skipMessage);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (lastMessage !== undefined) {\n\t\tif (dumpMessageStats) {\n\t\t\tfor (const analyzer of analyzers) {\n\t\t\t\tanalyzer.reportAnalyzes(lastMessage);\n\t\t\t}\n\t\t} else {\n\t\t\t// Warn about filtered messages\n\t\t\tanalyzers[0].reportAnalyzes(lastMessage);\n\t\t}\n\t}\n\tconsole.log(\"\");\n}\n\nfunction processOp(\n\truntimeMessage: ISequencedDocumentMessage,\n\tdataType: Map<string, string>,\n\tobjectStats: Map<string, [number, number]>,\n\tmsgSize: number,\n\tdataTypeStats: Map<string, [number, number]>,\n\tmessageTypeStats: Map<string, [number, number]>,\n\tchunkMap: Map<string, { chunks: string[]; totalSize: number }>,\n) {\n\tlet type = runtimeMessage.type;\n\tlet recorded = false;\n\tlet totalMsgSize = msgSize;\n\tlet opCount = 1;\n\tif (unpackRuntimeMessage(runtimeMessage)) {\n\t\tconst messageType = runtimeMessage.type as ContainerMessageType;\n\t\tswitch (messageType) {\n\t\t\tcase ContainerMessageType.Attach: {\n\t\t\t\tconst attachMessage = runtimeMessage.contents as IAttachMessage;\n\t\t\t\tprocessDataStoreAttachOp(attachMessage, dataType);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// skip for now because these ops do not have contents\n\t\t\tcase ContainerMessageType.BlobAttach: {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// The default method to count stats should be used for GC messages.\n\t\t\tcase ContainerMessageType.GC: {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.DocumentSchemaChange: {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.ChunkedOp: {\n\t\t\t\tconst chunk = runtimeMessage.contents as IChunkedOp;\n\t\t\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\t\tif (!chunkMap.has(runtimeMessage.clientId as string)) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\t\t\tchunkMap.set(runtimeMessage.clientId as string, {\n\t\t\t\t\t\tchunks: new Array<string>(chunk.totalChunks),\n\t\t\t\t\t\ttotalSize: 0,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\t\t\tconst value = chunkMap.get(runtimeMessage.clientId as string);\n\t\t\t\tassert(value !== undefined, 0x2b8 /* \"Chunk should be set in map\" */);\n\t\t\t\tconst chunks = value.chunks;\n\t\t\t\tconst chunkIndex = chunk.chunkId - 1;\n\t\t\t\tif (chunks[chunkIndex] !== undefined) {\n\t\t\t\t\tthrow new Error(\"Chunk already assigned\");\n\t\t\t\t}\n\t\t\t\tchunks[chunkIndex] = chunk.contents;\n\t\t\t\tvalue.totalSize += msgSize;\n\t\t\t\tif (chunk.chunkId === chunk.totalChunks) {\n\t\t\t\t\topCount = chunk.totalChunks; // 1 op for each chunk.\n\t\t\t\t\tconst patchedMessage = Object.create(runtimeMessage);\n\t\t\t\t\tpatchedMessage.contents = chunks.join(\"\");\n\t\t\t\t\ttype = (chunk as any).originalType;\n\t\t\t\t\tpatchedMessage.type = type;\n\t\t\t\t\ttotalMsgSize = value.totalSize;\n\t\t\t\t\tchunkMap.delete(patchedMessage.clientId);\n\t\t\t\t} else {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line no-fallthrough\n\t\t\t}\n\t\t\tcase ContainerMessageType.IdAllocation:\n\t\t\tcase ContainerMessageType.FluidDataStoreOp:\n\t\t\tcase ContainerMessageType.Alias:\n\t\t\tcase ContainerMessageType.Rejoin: {\n\t\t\t\tlet envelope = runtimeMessage.contents as IEnvelope;\n\t\t\t\t// TODO: Legacy?\n\t\t\t\tif (envelope !== undefined && typeof envelope === \"string\") {\n\t\t\t\t\tenvelope = JSON.parse(envelope);\n\t\t\t\t}\n\t\t\t\tconst innerContent = envelope.contents as {\n\t\t\t\t\tcontent: any;\n\t\t\t\t\ttype: string;\n\t\t\t\t};\n\t\t\t\tconst address = envelope.address;\n\t\t\t\ttype = `${type}/${innerContent.type}`;\n\t\t\t\tswitch (innerContent.type) {\n\t\t\t\t\tcase DataStoreMessageType.Attach: {\n\t\t\t\t\t\tconst attachMessage = innerContent.content as IAttachMessage;\n\t\t\t\t\t\tlet objectType = attachMessage.type;\n\t\t\t\t\t\tif (objectType.startsWith(objectTypePrefix)) {\n\t\t\t\t\t\t\tobjectType = objectType.substring(objectTypePrefix.length);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdataType.set(getObjectId(address, attachMessage.id), objectType);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase DataStoreMessageType.ChannelOp:\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tconst innerEnvelope = innerContent.content as IEnvelope;\n\t\t\t\t\t\tconst innerContent2 = innerEnvelope.contents as {\n\t\t\t\t\t\t\ttype?: string;\n\t\t\t\t\t\t\tvalue?: any;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tconst objectId = getObjectId(address, innerEnvelope.address);\n\t\t\t\t\t\tincr(objectStats, objectId, totalMsgSize, opCount);\n\t\t\t\t\t\tlet objectType = dataType.get(objectId);\n\t\t\t\t\t\tif (objectType === undefined) {\n\t\t\t\t\t\t\t// Somehow we do not have data...\n\t\t\t\t\t\t\tdataType.set(objectId, objectId);\n\t\t\t\t\t\t\tobjectType = objectId;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tincr(dataTypeStats, objectType, totalMsgSize, opCount);\n\t\t\t\t\t\trecorded = true;\n\n\t\t\t\t\t\tlet subType = innerContent2.type;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tinnerContent2.type === \"set\" &&\n\t\t\t\t\t\t\ttypeof innerContent2.value === \"object\" &&\n\t\t\t\t\t\t\tinnerContent2.value !== null\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\ttype = `${type}/${subType}`;\n\t\t\t\t\t\t\tsubType = innerContent2.value.type;\n\t\t\t\t\t\t} else if (objectType === \"mergeTree\" && subType !== undefined) {\n\t\t\t\t\t\t\tconst types = [\"insert\", \"remove\", \"annotate\", \"group\"];\n\t\t\t\t\t\t\tif (types[subType] !== undefined) {\n\t\t\t\t\t\t\t\tsubType = types[subType];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (subType !== undefined) {\n\t\t\t\t\t\t\ttype = `${type}/${subType}`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttype = `${type} (${objectType})`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tunreachableCase(messageType, \"Message type not recognized!\");\n\t\t}\n\t}\n\n\tincr(messageTypeStats, type, totalMsgSize, opCount);\n\tif (!recorded) {\n\t\t// const objectId = `${type} (system)`;\n\t\tconst objectId = `(system messages)`;\n\t\tconst objectType = objectId;\n\t\tif (dataType.get(objectId) === undefined) {\n\t\t\tdataType.set(objectId, objectId);\n\t\t}\n\t\tincr(objectStats, objectId, totalMsgSize, opCount);\n\t\tincr(dataTypeStats, objectType, totalMsgSize, opCount);\n\t}\n}\n\nfunction processDataStoreAttachOp(\n\tattachMessage: IAttachMessage | string,\n\tdataType: Map<string, string>,\n) {\n\t// dataType.set(getObjectId(attachMessage.id), attachMessage.type);\n\n\t// That's data store, and it brings a bunch of data structures.\n\t// Let's try to crack it.\n\tconst parsedAttachMessage =\n\t\ttypeof attachMessage === \"string\" ? JSON.parse(attachMessage) : attachMessage;\n\tfor (const entry of parsedAttachMessage.snapshot.entries) {\n\t\tif (entry.type === TreeEntry.Tree) {\n\t\t\tfor (const entry2 of entry.value.entries) {\n\t\t\t\tif (entry2.path === \".attributes\" && entry2.type === TreeEntry.Blob) {\n\t\t\t\t\tconst attrib = JSON.parse(entry2.value.contents);\n\t\t\t\t\tlet objectType: string = attrib.type;\n\t\t\t\t\tif (objectType.startsWith(objectTypePrefix)) {\n\t\t\t\t\t\tobjectType = objectType.substring(objectTypePrefix.length);\n\t\t\t\t\t}\n\t\t\t\t\tdataType.set(getObjectId(parsedAttachMessage.id, entry.path), objectType);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction reportOpenSessions(\n\tlastOpTimestamp: number,\n\tsessionsInProgress: Map<string, ActiveSession>,\n\tsessions: Map<string, [number, number]>,\n\tusers: Map<string, [number, number]>,\n) {\n\tconst activeSessions = new Map<string, [number, number]>();\n\n\tfor (const [clientId, ses] of sessionsInProgress) {\n\t\tconst sessionInfo = ses.leave(lastOpTimestamp);\n\t\tif (clientId !== noClientName) {\n\t\t\tconst sessionName = `${clientId} (${sessionInfo.email})`;\n\t\t\tconst sessionPayload: [number, number] = [\n\t\t\t\tdurationFromTime(sessionInfo.duration),\n\t\t\t\tsessionInfo.opCount,\n\t\t\t];\n\t\t\tsessions.set(sessionName, sessionPayload);\n\t\t\tactiveSessions.set(sessionName, sessionPayload);\n\t\t} else {\n\t\t\tsessions.set(`Full file lifespan (noClient messages)`, [\n\t\t\t\tdurationFromTime(sessionInfo.duration),\n\t\t\t\tsessionInfo.opCount,\n\t\t\t]);\n\t\t}\n\t\tincr(users, sessionInfo.email, sessionInfo.opCount);\n\t}\n\n\tif (activeSessions.size > 0) {\n\t\tdumpStats(activeSessions, {\n\t\t\ttitle: \"Active sessions\",\n\t\t\theaders: [\"Duration\", \"Op count\"],\n\t\t\tlines: 6,\n\t\t\torderByFirstColumn: true,\n\t\t\tremoveTotals: true,\n\t\t});\n\t}\n}\n\nfunction calcChannelStats(\n\tdataType: Map<string, string>,\n\tobjectStats: Map<string, [number, number]>,\n) {\n\tconst channelStats = new Map<string, [number, number]>();\n\tfor (const [objectId, type] of dataType) {\n\t\tlet value = objectStats.get(objectId);\n\t\tif (value === undefined) {\n\t\t\tvalue = [0, 0];\n\t\t}\n\t\tif (type === objectId) {\n\t\t\tchannelStats.set(`${objectId}`, value);\n\t\t} else {\n\t\t\tchannelStats.set(`${objectId} (${type})`, value);\n\t\t}\n\t}\n\treturn channelStats;\n}\n\nfunction processQuorumMessages(\n\tmessage: ISequencedDocumentMessage,\n\tskipMessage: boolean,\n\tsessionsInProgress: Map<string, ActiveSession>,\n\tsessions: Map<string, [number, number]>,\n\tusers: Map<string, [number, number]>,\n) {\n\tlet session: ActiveSession | undefined;\n\tconst dataString = (message as any).data;\n\tif (message.type === \"join\") {\n\t\tconst data = JSON.parse(dataString);\n\t\tsession = ActiveSession.create(data.detail.user.id, message);\n\t\tsessionsInProgress.set(data.clientId, session);\n\t} else if (message.type === \"leave\") {\n\t\tconst clientId = JSON.parse(dataString);\n\t\tsession = sessionsInProgress.get(clientId);\n\t\tsessionsInProgress.delete(clientId);\n\t\tassert(!!session, 0x1b7 /* \"Bad session state for processing quorum messages\" */);\n\t\tif (session !== undefined) {\n\t\t\tif (!skipMessage) {\n\t\t\t\tsession.reportOp(message.timestamp);\n\t\t\t}\n\t\t\tconst sessionInfo: ISessionInfo = session.leave(message.timestamp);\n\t\t\tsessions.set(`${clientId} (${sessionInfo.email})`, [\n\t\t\t\tdurationFromTime(sessionInfo.duration),\n\t\t\t\tsessionInfo.opCount,\n\t\t\t]);\n\t\t\tincr(users, sessionInfo.email, sessionInfo.opCount);\n\t\t\tsession = undefined; // Do not record it second time\n\t\t}\n\t} else {\n\t\t// message.clientId can be null\n\t\t// TODO: Verify whether this should be able to handle server-generated ops (with null clientId)\n\t\t// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n\t\tsession = sessionsInProgress.get(message.clientId as string);\n\t\tif (session === undefined) {\n\t\t\tsession = sessionsInProgress.get(noClientName);\n\t\t\tassert(!!session, 0x1b8 /* \"Bad session state for processing quorum messages\" */);\n\t\t}\n\t}\n\treturn session;\n}\n\nconst durationFromTime = (time: number): number => Math.floor(time / 1000);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fluidFetch.js","sourceRoot":"","sources":["../src/fluidFetch.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,4CAAoB;AACpB,gDAAwB;AACxB,yEAA4F;AAC5F,2DAA6E;AAC7E,2DAAqE;AACrE,mEAA6D;AAC7D,uEAAwF;AACxF,mEAA6D;AAE7D,KAAK,UAAU,iBAAiB,CAAC,MAAc,EAAE,IAAa;IAC7D,MAAM,eAAe,GAAG,MAAM,IAAA,kCAAc,EAAC,MAAM,CAAC,CAAC;IACrD,MAAM,OAAO,GACZ,gCAAY,KAAK,SAAS;QACzB,CAAC,CAAC,IAAI,KAAK,SAAS;YACnB,CAAC,CAAC,GAAG,gCAAY,IAAI,IAAI,EAAE;YAC3B,CAAC,CAAC,gCAAY;QACf,CAAC,CAAC,SAAS,CAAC;IACd,IAAI,OAAO,KAAK,SAAS,EAAE;QAC1B,MAAM,KAAK,GAAG,cAAI,CAAC,SAAS,CAAC,YAAE,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,cAAI,CAAC,SAAS,CAAC,YAAE,CAAC,SAAS,CAAC,CAAC;QAC/C,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG;YACZ,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,QAAQ,EAAE;YACnC,cAAc,EAAd,kCAAc;YACd,GAAG,EAAE,MAAM;SACX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AC;KACF;SAAM;QACN,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC;KACjC;AACF,CAAC,CAAC;KACD,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport fs from \"fs\";\nimport util from \"util\";\nimport { IOdspDriveItem, isOdspHostname } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport { paramSaveDir, paramURL, parseArguments } from \"./fluidFetchArgs.js\";\nimport { connectionInfo, fluidFetchInit } from \"./fluidFetchInit.js\";\nimport { fluidFetchMessages } from \"./fluidFetchMessages.js\";\nimport { getSharepointFiles, getSingleSharePointFile } from \"./fluidFetchSharePoint.js\";\nimport { fluidFetchSnapshot } from \"./fluidFetchSnapshot.js\";\n\nasync function fluidFetchOneFile(urlStr: string, name?: string) {\n\tconst documentService = await fluidFetchInit(urlStr);\n\tconst saveDir =\n\t\tparamSaveDir !== undefined\n\t\t\t? name !== undefined\n\t\t\t\t? `${paramSaveDir}/${name}`\n\t\t\t\t: paramSaveDir\n\t\t\t: undefined;\n\tif (saveDir !== undefined) {\n\t\tconst mkdir = util.promisify(fs.mkdir);\n\t\tconst writeFile = util.promisify(fs.writeFile);\n\t\tawait mkdir(saveDir, { recursive: true });\n\t\tconst info = {\n\t\t\tcreationDate: new Date().toString(),\n\t\t\tconnectionInfo,\n\t\t\turl: urlStr,\n\t\t};\n\t\tawait writeFile(`${saveDir}/info.json`, JSON.stringify(info, undefined, 2));\n\t}\n\n\tawait fluidFetchSnapshot(documentService, saveDir);\n\tawait fluidFetchMessages(documentService, saveDir);\n}\n\nasync function tryFluidFetchOneSharePointFile(server: string, driveItem: IOdspDriveItem) {\n\tconst { path, name, driveId, itemId } = driveItem;\n\tconsole.log(`File: ${path}/${name}`);\n\tawait fluidFetchOneFile(`https://${server}/_api/v2.1/drives/${driveId}/items/${itemId}`, name);\n}\n\nfunction getSharePointSpecificDriveItem(url: URL): { driveId: string; itemId: string } | undefined {\n\tif (url.searchParams.has(\"driveId\") && url.searchParams.has(\"itemId\")) {\n\t\treturn {\n\t\t\tdriveId: url.searchParams.get(\"driveId\") as string,\n\t\t\titemId: url.searchParams.get(\"itemId\") as string,\n\t\t};\n\t}\n}\n\nfunction getSharepointServerRelativePathFromURL(url: URL) {\n\tif (url.pathname.startsWith(\"/_api/v2.1/drives/\")) {\n\t\treturn undefined;\n\t}\n\n\tconst hostnameParts = url.hostname.split(\".\");\n\tconst suffix = hostnameParts[0].endsWith(\"-my\")\n\t\t? \"/_layouts/15/onedrive.aspx\"\n\t\t: \"/forms/allitems.aspx\";\n\n\tlet sitePath = url.pathname;\n\tif (url.searchParams.has(\"id\")) {\n\t\tsitePath = url.searchParams.get(\"id\") as string;\n\t} else if (url.searchParams.has(\"RootFolder\")) {\n\t\tsitePath = url.searchParams.get(\"RootFolder\") as string;\n\t} else if (url.pathname.toLowerCase().endsWith(suffix)) {\n\t\tsitePath = sitePath.substr(0, url.pathname.length - suffix.length);\n\t}\n\n\treturn decodeURI(sitePath);\n}\n\nasync function fluidFetchMain() {\n\tif (paramURL === undefined) {\n\t\treturn;\n\t}\n\n\tconst url = new URL(paramURL);\n\tconst server = url.hostname;\n\tif (isOdspHostname(server)) {\n\t\t// See if the url already has the specific item\n\t\tconst driveItem = getSharePointSpecificDriveItem(url);\n\t\tif (driveItem) {\n\t\t\tconst file = await getSingleSharePointFile(server, driveItem.driveId, driveItem.itemId);\n\t\t\tawait tryFluidFetchOneSharePointFile(server, file);\n\t\t\treturn;\n\t\t}\n\n\t\t// See if the url given represent a sharepoint directory\n\t\tconst serverRelativePath = getSharepointServerRelativePathFromURL(url);\n\t\tif (serverRelativePath !== undefined) {\n\t\t\tconst files = await getSharepointFiles(server, serverRelativePath, false);\n\t\t\tfor (const file of files) {\n\t\t\t\tif (file.name.endsWith(\".b\") || file.name.endsWith(\".fluid\")) {\n\t\t\t\t\tawait tryFluidFetchOneSharePointFile(server, file);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t}\n\n\treturn fluidFetchOneFile(paramURL);\n}\n\nparseArguments();\n\n// eslint-disable-next-line @typescript-eslint/no-floating-promises\nfluidFetchMain()\n\t.catch((error: Error) => {\n\t\tif (error instanceof Error) {\n\t\t\tlet extraMsg = \"\";\n\t\t\tfor (const key of Object.keys(error)) {\n\t\t\t\t// error[key] might have circular structure\n\t\t\t\ttry {\n\t\t\t\t\tif (key !== \"message\" && key !== \"stack\") {\n\t\t\t\t\t\textraMsg += `\\n${key}: ${JSON.stringify(error[key], undefined, 2)}`;\n\t\t\t\t\t}\n\t\t\t\t} catch (_) {}\n\t\t\t}\n\t\t\tconsole.error(`ERROR: ${error.stack}${extraMsg}`);\n\t\t} else if (typeof error === \"object\") {\n\t\t\tconsole.error(\n\t\t\t\t`ERROR: Unknown exception object\\n${JSON.stringify(error, undefined, 2)}`,\n\t\t\t);\n\t\t} else {\n\t\t\tconsole.error(`ERROR: ${error}`);\n\t\t}\n\t})\n\t.then(() => process.exit(0));\n"]}
1
+ {"version":3,"file":"fluidFetch.js","sourceRoot":"","sources":["../src/fluidFetch.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,4CAAoB;AACpB,gDAAwB;AAExB,yEAA4F;AAE5F,2DAA6E;AAC7E,2DAAqE;AACrE,mEAA6D;AAC7D,uEAAwF;AACxF,mEAA6D;AAE7D,KAAK,UAAU,iBAAiB,CAAC,MAAc,EAAE,IAAa;IAC7D,MAAM,eAAe,GAAG,MAAM,IAAA,kCAAc,EAAC,MAAM,CAAC,CAAC;IACrD,MAAM,OAAO,GACZ,gCAAY,KAAK,SAAS;QACzB,CAAC,CAAC,IAAI,KAAK,SAAS;YACnB,CAAC,CAAC,GAAG,gCAAY,IAAI,IAAI,EAAE;YAC3B,CAAC,CAAC,gCAAY;QACf,CAAC,CAAC,SAAS,C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,IAAI,KAAK,GAAG,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;iBACpE;aACD;YAAC,OAAO,CAAC,EAAE,GAAE;SACd;QACD,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,KAAK,GAAG,QAAQ,EAAE,CAAC,CAAC;KAClD;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACrC,OAAO,CAAC,KAAK,CACZ,oCAAoC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CACzE,CAAC;KACF;SAAM;QACN,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC;KACjC;AACF,CAAC,CAAC;KACD,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport fs from \"fs\";\nimport util from \"util\";\n\nimport { IOdspDriveItem, isOdspHostname } from \"@fluidframework/odsp-doclib-utils/internal\";\n\nimport { paramSaveDir, paramURL, parseArguments } from \"./fluidFetchArgs.js\";\nimport { connectionInfo, fluidFetchInit } from \"./fluidFetchInit.js\";\nimport { fluidFetchMessages } from \"./fluidFetchMessages.js\";\nimport { getSharepointFiles, getSingleSharePointFile } from \"./fluidFetchSharePoint.js\";\nimport { fluidFetchSnapshot } from \"./fluidFetchSnapshot.js\";\n\nasync function fluidFetchOneFile(urlStr: string, name?: string) {\n\tconst documentService = await fluidFetchInit(urlStr);\n\tconst saveDir =\n\t\tparamSaveDir !== undefined\n\t\t\t? name !== undefined\n\t\t\t\t? `${paramSaveDir}/${name}`\n\t\t\t\t: paramSaveDir\n\t\t\t: undefined;\n\tif (saveDir !== undefined) {\n\t\tconst mkdir = util.promisify(fs.mkdir);\n\t\tconst writeFile = util.promisify(fs.writeFile);\n\t\tawait mkdir(saveDir, { recursive: true });\n\t\tconst info = {\n\t\t\tcreationDate: new Date().toString(),\n\t\t\tconnectionInfo,\n\t\t\turl: urlStr,\n\t\t};\n\t\tawait writeFile(`${saveDir}/info.json`, JSON.stringify(info, undefined, 2));\n\t}\n\n\tawait fluidFetchSnapshot(documentService, saveDir);\n\tawait fluidFetchMessages(documentService, saveDir);\n}\n\nasync function tryFluidFetchOneSharePointFile(server: string, driveItem: IOdspDriveItem) {\n\tconst { path, name, driveId, itemId } = driveItem;\n\tconsole.log(`File: ${path}/${name}`);\n\tawait fluidFetchOneFile(`https://${server}/_api/v2.1/drives/${driveId}/items/${itemId}`, name);\n}\n\nfunction getSharePointSpecificDriveItem(url: URL): { driveId: string; itemId: string } | undefined {\n\tif (url.searchParams.has(\"driveId\") && url.searchParams.has(\"itemId\")) {\n\t\treturn {\n\t\t\tdriveId: url.searchParams.get(\"driveId\") as string,\n\t\t\titemId: url.searchParams.get(\"itemId\") as string,\n\t\t};\n\t}\n}\n\nfunction getSharepointServerRelativePathFromURL(url: URL) {\n\tif (url.pathname.startsWith(\"/_api/v2.1/drives/\")) {\n\t\treturn undefined;\n\t}\n\n\tconst hostnameParts = url.hostname.split(\".\");\n\tconst suffix = hostnameParts[0].endsWith(\"-my\")\n\t\t? \"/_layouts/15/onedrive.aspx\"\n\t\t: \"/forms/allitems.aspx\";\n\n\tlet sitePath = url.pathname;\n\tif (url.searchParams.has(\"id\")) {\n\t\tsitePath = url.searchParams.get(\"id\") as string;\n\t} else if (url.searchParams.has(\"RootFolder\")) {\n\t\tsitePath = url.searchParams.get(\"RootFolder\") as string;\n\t} else if (url.pathname.toLowerCase().endsWith(suffix)) {\n\t\tsitePath = sitePath.substr(0, url.pathname.length - suffix.length);\n\t}\n\n\treturn decodeURI(sitePath);\n}\n\nasync function fluidFetchMain() {\n\tif (paramURL === undefined) {\n\t\treturn;\n\t}\n\n\tconst url = new URL(paramURL);\n\tconst server = url.hostname;\n\tif (isOdspHostname(server)) {\n\t\t// See if the url already has the specific item\n\t\tconst driveItem = getSharePointSpecificDriveItem(url);\n\t\tif (driveItem) {\n\t\t\tconst file = await getSingleSharePointFile(server, driveItem.driveId, driveItem.itemId);\n\t\t\tawait tryFluidFetchOneSharePointFile(server, file);\n\t\t\treturn;\n\t\t}\n\n\t\t// See if the url given represent a sharepoint directory\n\t\tconst serverRelativePath = getSharepointServerRelativePathFromURL(url);\n\t\tif (serverRelativePath !== undefined) {\n\t\t\tconst files = await getSharepointFiles(server, serverRelativePath, false);\n\t\t\tfor (const file of files) {\n\t\t\t\tif (file.name.endsWith(\".b\") || file.name.endsWith(\".fluid\")) {\n\t\t\t\t\tawait tryFluidFetchOneSharePointFile(server, file);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t}\n\n\treturn fluidFetchOneFile(paramURL);\n}\n\nparseArguments();\n\n// eslint-disable-next-line @typescript-eslint/no-floating-promises\nfluidFetchMain()\n\t.catch((error: Error) => {\n\t\tif (error instanceof Error) {\n\t\t\tlet extraMsg = \"\";\n\t\t\tfor (const key of Object.keys(error)) {\n\t\t\t\t// error[key] might have circular structure\n\t\t\t\ttry {\n\t\t\t\t\tif (key !== \"message\" && key !== \"stack\") {\n\t\t\t\t\t\textraMsg += `\\n${key}: ${JSON.stringify(error[key], undefined, 2)}`;\n\t\t\t\t\t}\n\t\t\t\t} catch (_) {}\n\t\t\t}\n\t\t\tconsole.error(`ERROR: ${error.stack}${extraMsg}`);\n\t\t} else if (typeof error === \"object\") {\n\t\t\tconsole.error(\n\t\t\t\t`ERROR: Unknown exception object\\n${JSON.stringify(error, undefined, 2)}`,\n\t\t\t);\n\t\t} else {\n\t\t\tconsole.error(`ERROR: ${error}`);\n\t\t}\n\t})\n\t.then(() => process.exit(0));\n"]}
@@ -4,5 +4,5 @@
4
4
  */
5
5
  export declare let latestVersionsId: string;
6
6
  export declare let connectionInfo: any;
7
- export declare function fluidFetchInit(urlStr: string): Promise<import("@fluidframework/driver-definitions").IDocumentService | undefined>;
7
+ export declare function fluidFetchInit(urlStr: string): Promise<import("@fluidframework/driver-definitions/internal").IDocumentService | undefined>;
8
8
  //# sourceMappingURL=fluidFetchInit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fluidFetchInit.d.ts","sourceRoot":"","sources":["../src/fluidFetchInit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,eAAO,IAAI,gBAAgB,EAAE,MAAW,CAAC;AACzC,eAAO,IAAI,cAAc,EAAE,GAAG,CAAC;AAiI/B,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,sFAkBlD"}
1
+ {"version":3,"file":"fluidFetchInit.d.ts","sourceRoot":"","sources":["../src/fluidFetchInit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH,eAAO,IAAI,gBAAgB,EAAE,MAAW,CAAC;AACzC,eAAO,IAAI,cAAc,EAAE,GAAG,CAAC;AAiI/B,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,+FAkBlD"}
@@ -28,11 +28,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.fluidFetchInit = exports.connectionInfo = exports.latestVersionsId = void 0;
31
- const odsp = __importStar(require("@fluidframework/odsp-driver"));
32
- const odsp_urlresolver_1 = require("@fluidframework/odsp-urlresolver");
33
- const r11s = __importStar(require("@fluidframework/routerlicious-driver"));
34
- const routerlicious_urlresolver_1 = require("@fluidframework/routerlicious-urlresolver");
35
- const tool_utils_1 = require("@fluidframework/tool-utils");
31
+ const odsp = __importStar(require("@fluidframework/odsp-driver/internal"));
32
+ const internal_1 = require("@fluidframework/odsp-urlresolver/internal");
33
+ const r11s = __importStar(require("@fluidframework/routerlicious-driver/internal"));
34
+ const internal_2 = require("@fluidframework/routerlicious-urlresolver/internal");
35
+ const internal_3 = require("@fluidframework/tool-utils/internal");
36
36
  const fluidFetchArgs_js_1 = require("./fluidFetchArgs.js");
37
37
  const fluidFetchSharePoint_js_1 = require("./fluidFetchSharePoint.js");
38
38
  exports.latestVersionsId = "";
@@ -100,21 +100,21 @@ async function resolveUrl(url) {
100
100
  const request = { url };
101
101
  let maybeResolvedUrl;
102
102
  // Try each url resolver in turn to figure out which one the request is compatible with.
103
- maybeResolvedUrl = await new odsp_urlresolver_1.OdspUrlResolver().resolve(request);
103
+ maybeResolvedUrl = await new internal_1.OdspUrlResolver().resolve(request);
104
104
  if (maybeResolvedUrl !== undefined) {
105
105
  return {
106
106
  resolvedUrl: maybeResolvedUrl,
107
107
  serviceType: "odsp",
108
108
  };
109
109
  }
110
- maybeResolvedUrl = await new odsp_urlresolver_1.FluidAppOdspUrlResolver().resolve(request);
110
+ maybeResolvedUrl = await new internal_1.FluidAppOdspUrlResolver().resolve(request);
111
111
  if (maybeResolvedUrl !== undefined) {
112
112
  return {
113
113
  resolvedUrl: maybeResolvedUrl,
114
114
  serviceType: "odsp",
115
115
  };
116
116
  }
117
- maybeResolvedUrl = await new routerlicious_urlresolver_1.RouterliciousUrlResolver(undefined, async () => Promise.resolve(fluidFetchArgs_js_1.paramJWT), "").resolve(request);
117
+ maybeResolvedUrl = await new internal_2.RouterliciousUrlResolver(undefined, async () => Promise.resolve(fluidFetchArgs_js_1.paramJWT), "").resolve(request);
118
118
  if (maybeResolvedUrl !== undefined) {
119
119
  return {
120
120
  resolvedUrl: maybeResolvedUrl,
@@ -131,7 +131,7 @@ async function fluidFetchInit(urlStr) {
131
131
  const fluidResolvedUrl = resolvedInfo.resolvedUrl;
132
132
  if (resolvedInfo.serviceType === "odsp") {
133
133
  const odspResolvedUrl = fluidResolvedUrl;
134
- return initializeODSPCore(odspResolvedUrl, new URL(odspResolvedUrl.siteUrl).host, (0, tool_utils_1.getMicrosoftConfiguration)());
134
+ return initializeODSPCore(odspResolvedUrl, new URL(odspResolvedUrl.siteUrl).host, (0, internal_3.getMicrosoftConfiguration)());
135
135
  }
136
136
  else if (resolvedInfo.serviceType === "r11s") {
137
137
  const url = new URL(urlStr);
@@ -1 +1 @@
1
- {"version":3,"file":"fluidFetchInit.js","sourceRoot":"","sources":["../src/fluidFetchInit.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAKH,kEAAoD;AAKpD,uEAA4F;AAC5F,2EAA6D;AAC7D,yFAAqF;AACrF,2DAAuE;AACvE,2DAA8D;AAC9D,uEAA2D;AAEhD,QAAA,gBAAgB,GAAW,EAAE,CAAC;AAGzC,KAAK,UAAU,kBAAkB,CAChC,eAAiC,EACjC,MAAc,EACd,YAA2B;IAE3B,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC;IAE5C,sBAAc,GAAG;QAChB,MAAM;QACN,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,MAAM;KACZ,CAAC;IAEF,IAAI,iCAAa,EAAE;QAClB,OAAO;KACP;IAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAE9D,OAAO,CAAC,GAAG,CAAC;YACD,MAAM;YACN,OAAO;YACP,MAAM;YACN,KAAK,EAAE,CAAC,CAAC;IAEpB,MAAM,mBAAmB,GAAG,KAAK,EAAE,OAAsC,EAAE,EAAE;QAC5E,OAAO,IAAA,wCAAc,EACpB,KAAK,EAAE,eAAqC,EAAE,EAAE;YAC/C,IACC,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC;gBACjD,eAAe,CAAC,cAAc,EAC7B;gBACD,OAAO,eAAe,CAAC,cAAc,EAAE,CAAC;aACxC;YACD,OAAO,eAAe,CAAC,WAAW,CAAC;QACpC,CAAC,EACD,MAAM,EACN,YAAY,EACZ,SAAS,EACT,IAAI,CACJ,CAAC;IACH,CAAC,CAAC;IACF,qEAAqE;IACrE,MAAM,qBAAqB,GAAG,CAAC,QAAuC,EAAE,EAAE,CAAC,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,CAAC,IAAI,EACrC,IAAA,sCAAyB,GAAE,CAC3B,CAAC;KACF;SAAM,IAAI,YAAY,CAAC,WAAW,KAAK,MAAM,EAAE;QAC/C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5B,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC1C,OAAO,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;KAC9D;AACF,CAAC;AAlBD,wCAkBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl } from \"@fluidframework/driver-definitions\";\nimport { IClientConfig, IOdspAuthRequestInfo } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport * as odsp from \"@fluidframework/odsp-driver\";\nimport {\n\tIOdspResolvedUrl,\n\tOdspResourceTokenFetchOptions,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { FluidAppOdspUrlResolver, OdspUrlResolver } from \"@fluidframework/odsp-urlresolver\";\nimport * as r11s from \"@fluidframework/routerlicious-driver\";\nimport { RouterliciousUrlResolver } from \"@fluidframework/routerlicious-urlresolver\";\nimport { getMicrosoftConfiguration } from \"@fluidframework/tool-utils\";\nimport { localDataOnly, paramJWT } from \"./fluidFetchArgs.js\";\nimport { resolveWrapper } from \"./fluidFetchSharePoint.js\";\n\nexport let latestVersionsId: string = \"\";\nexport let connectionInfo: any;\n\nasync function initializeODSPCore(\n\todspResolvedUrl: IOdspResolvedUrl,\n\tserver: string,\n\tclientConfig: IClientConfig,\n) {\n\tconst { driveId, itemId } = odspResolvedUrl;\n\n\tconnectionInfo = {\n\t\tserver,\n\t\tdrive: driveId,\n\t\titem: itemId,\n\t};\n\n\tif (localDataOnly) {\n\t\treturn;\n\t}\n\n\tconst docId = await odsp.getHashedDocumentId(driveId, itemId);\n\n\tconsole.log(`Connecting to ODSP:\n server: ${server}\n drive: ${driveId}\n item: ${itemId}\n docId: ${docId}`);\n\n\tconst getStorageTokenStub = async (options: OdspResourceTokenFetchOptions) => {\n\t\treturn resolveWrapper(\n\t\t\tasync (authRequestInfo: IOdspAuthRequestInfo) => {\n\t\t\t\tif (\n\t\t\t\t\t(options.refresh || !authRequestInfo.accessToken) &&\n\t\t\t\t\tauthRequestInfo.refreshTokenFn\n\t\t\t\t) {\n\t\t\t\t\treturn authRequestInfo.refreshTokenFn();\n\t\t\t\t}\n\t\t\t\treturn authRequestInfo.accessToken;\n\t\t\t},\n\t\t\tserver,\n\t\t\tclientConfig,\n\t\t\tundefined,\n\t\t\ttrue,\n\t\t);\n\t};\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tconst getWebsocketTokenStub = (_options: OdspResourceTokenFetchOptions) => Promise.resolve(\"\");\n\tconst odspDocumentServiceFactory = new odsp.OdspDocumentServiceFactory(\n\t\tgetStorageTokenStub,\n\t\tgetWebsocketTokenStub,\n\t\tundefined,\n\t\t{\n\t\t\topsBatchSize: 20000,\n\t\t\tconcurrentOpsBatches: 4,\n\t\t},\n\t);\n\treturn odspDocumentServiceFactory.createDocumentService(odspResolvedUrl);\n}\n\nasync function initializeR11s(server: string, pathname: string, r11sResolvedUrl: IResolvedUrl) {\n\tconst path = pathname.split(\"/\");\n\tlet tenantId: string;\n\tlet documentId: string;\n\tif (server === \"localhost\" && path.length < 4) {\n\t\ttenantId = \"fluid\";\n\t\tdocumentId = path[2];\n\t} else {\n\t\ttenantId = path[2];\n\t\tdocumentId = path[3];\n\t}\n\n\t// Latest version id is the documentId for r11s\n\tlatestVersionsId = documentId;\n\n\tconnectionInfo = {\n\t\tserver,\n\t\ttenantId,\n\t\tid: documentId,\n\t};\n\n\tif (localDataOnly) {\n\t\treturn;\n\t}\n\n\tconsole.log(`Connecting to r11s: tenantId=${tenantId} id:${documentId}`);\n\tconst tokenProvider = new r11s.DefaultTokenProvider(paramJWT);\n\tconst r11sDocumentServiceFactory = new r11s.RouterliciousDocumentServiceFactory(tokenProvider);\n\treturn r11sDocumentServiceFactory.createDocumentService(r11sResolvedUrl);\n}\n\ninterface IResolvedInfo {\n\tresolvedUrl: IResolvedUrl;\n\tserviceType: \"odsp\" | \"r11s\";\n}\nasync function resolveUrl(url: string): Promise<IResolvedInfo | undefined> {\n\tconst request: IRequest = { url };\n\tlet maybeResolvedUrl: IResolvedUrl | undefined;\n\n\t// Try each url resolver in turn to figure out which one the request is compatible with.\n\tmaybeResolvedUrl = await new OdspUrlResolver().resolve(request);\n\tif (maybeResolvedUrl !== undefined) {\n\t\treturn {\n\t\t\tresolvedUrl: maybeResolvedUrl,\n\t\t\tserviceType: \"odsp\",\n\t\t};\n\t}\n\n\tmaybeResolvedUrl = await new FluidAppOdspUrlResolver().resolve(request);\n\tif (maybeResolvedUrl !== undefined) {\n\t\treturn {\n\t\t\tresolvedUrl: maybeResolvedUrl,\n\t\t\tserviceType: \"odsp\",\n\t\t};\n\t}\n\n\tmaybeResolvedUrl = await new RouterliciousUrlResolver(\n\t\tundefined,\n\t\tasync () => Promise.resolve(paramJWT),\n\t\t\"\",\n\t).resolve(request);\n\tif (maybeResolvedUrl !== undefined) {\n\t\treturn {\n\t\t\tresolvedUrl: maybeResolvedUrl,\n\t\t\tserviceType: \"r11s\",\n\t\t};\n\t}\n\n\treturn undefined;\n}\n\nexport async function fluidFetchInit(urlStr: string) {\n\tconst resolvedInfo = await resolveUrl(urlStr);\n\tif (resolvedInfo === undefined) {\n\t\tthrow new Error(`Unknown URL ${urlStr}`);\n\t}\n\tconst fluidResolvedUrl = resolvedInfo.resolvedUrl;\n\tif (resolvedInfo.serviceType === \"odsp\") {\n\t\tconst odspResolvedUrl = fluidResolvedUrl as IOdspResolvedUrl;\n\t\treturn initializeODSPCore(\n\t\t\todspResolvedUrl,\n\t\t\tnew URL(odspResolvedUrl.siteUrl).host,\n\t\t\tgetMicrosoftConfiguration(),\n\t\t);\n\t} else if (resolvedInfo.serviceType === \"r11s\") {\n\t\tconst url = new URL(urlStr);\n\t\tconst server = url.hostname.toLowerCase();\n\t\treturn initializeR11s(server, url.pathname, fluidResolvedUrl);\n\t}\n}\n"]}
1
+ {"version":3,"file":"fluidFetchInit.js","sourceRoot":"","sources":["../src/fluidFetchInit.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAKH,2EAA6D;AAK7D,wEAGmD;AACnD,oFAAsE;AACtE,iFAA8F;AAC9F,kEAAgF;AAEhF,2DAA8D;AAC9D,uEAA2D;AAEhD,QAAA,gBAAgB,GAAW,EAAE,CAAC;AAGzC,KAAK,UAAU,kBAAkB,CAChC,eAAiC,EACjC,MAAc,EACd,YAA2B;IAE3B,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC;IAE5C,sBAAc,GAAG;QAChB,MAAM;QACN,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,MAAM;KACZ,CAAC;IAEF,IAAI,iCAAa,EAAE;QAClB,OAAO;KACP;IAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAE9D,OAAO,CAAC,GAAG,CAAC;YACD,MAAM;YACN,OAAO;YACP,MAAM;YACN,KAAK,EAAE,CAAC,CAAC;IAEpB,MAAM,mBAAmB,GAAG,KAAK,EAAE,OAAsC,EAAE,EAAE;QAC5E,OAAO,IAAA,wCAAc,EACpB,KAAK,EAAE,eAAqC,EAAE,EAAE;YAC/C,IACC,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC;gBACjD,eAAe,CAAC,cAAc,EAC7B;gBACD,OAAO,eAAe,CAAC,cAAc,EAAE,CAAC;aACxC;YACD,OAAO,eAAe,CAAC,WAAW,CAAC;QACpC,CAAC,EACD,MAAM,EACN,YAAY,EACZ,SAAS,EACT,IAAI,CACJ,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gBAAoC,CAAC;QAC7D,OAAO,kBAAkB,CACxB,eAAe,EACf,IAAI,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,IAAI,EACrC,IAAA,oCAAyB,GAAE,CAC3B,CAAC;KACF;SAAM,IAAI,YAAY,CAAC,WAAW,KAAK,MAAM,EAAE;QAC/C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5B,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC1C,OAAO,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;KAC9D;AACF,CAAC;AAlBD,wCAkBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl } from \"@fluidframework/driver-definitions/internal\";\nimport { IClientConfig, IOdspAuthRequestInfo } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport * as odsp from \"@fluidframework/odsp-driver/internal\";\nimport {\n\tIOdspResolvedUrl,\n\tOdspResourceTokenFetchOptions,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\tFluidAppOdspUrlResolver,\n\tOdspUrlResolver,\n} from \"@fluidframework/odsp-urlresolver/internal\";\nimport * as r11s from \"@fluidframework/routerlicious-driver/internal\";\nimport { RouterliciousUrlResolver } from \"@fluidframework/routerlicious-urlresolver/internal\";\nimport { getMicrosoftConfiguration } from \"@fluidframework/tool-utils/internal\";\n\nimport { localDataOnly, paramJWT } from \"./fluidFetchArgs.js\";\nimport { resolveWrapper } from \"./fluidFetchSharePoint.js\";\n\nexport let latestVersionsId: string = \"\";\nexport let connectionInfo: any;\n\nasync function initializeODSPCore(\n\todspResolvedUrl: IOdspResolvedUrl,\n\tserver: string,\n\tclientConfig: IClientConfig,\n) {\n\tconst { driveId, itemId } = odspResolvedUrl;\n\n\tconnectionInfo = {\n\t\tserver,\n\t\tdrive: driveId,\n\t\titem: itemId,\n\t};\n\n\tif (localDataOnly) {\n\t\treturn;\n\t}\n\n\tconst docId = await odsp.getHashedDocumentId(driveId, itemId);\n\n\tconsole.log(`Connecting to ODSP:\n server: ${server}\n drive: ${driveId}\n item: ${itemId}\n docId: ${docId}`);\n\n\tconst getStorageTokenStub = async (options: OdspResourceTokenFetchOptions) => {\n\t\treturn resolveWrapper(\n\t\t\tasync (authRequestInfo: IOdspAuthRequestInfo) => {\n\t\t\t\tif (\n\t\t\t\t\t(options.refresh || !authRequestInfo.accessToken) &&\n\t\t\t\t\tauthRequestInfo.refreshTokenFn\n\t\t\t\t) {\n\t\t\t\t\treturn authRequestInfo.refreshTokenFn();\n\t\t\t\t}\n\t\t\t\treturn authRequestInfo.accessToken;\n\t\t\t},\n\t\t\tserver,\n\t\t\tclientConfig,\n\t\t\tundefined,\n\t\t\ttrue,\n\t\t);\n\t};\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tconst getWebsocketTokenStub = (_options: OdspResourceTokenFetchOptions) => Promise.resolve(\"\");\n\tconst odspDocumentServiceFactory = new odsp.OdspDocumentServiceFactory(\n\t\tgetStorageTokenStub,\n\t\tgetWebsocketTokenStub,\n\t\tundefined,\n\t\t{\n\t\t\topsBatchSize: 20000,\n\t\t\tconcurrentOpsBatches: 4,\n\t\t},\n\t);\n\treturn odspDocumentServiceFactory.createDocumentService(odspResolvedUrl);\n}\n\nasync function initializeR11s(server: string, pathname: string, r11sResolvedUrl: IResolvedUrl) {\n\tconst path = pathname.split(\"/\");\n\tlet tenantId: string;\n\tlet documentId: string;\n\tif (server === \"localhost\" && path.length < 4) {\n\t\ttenantId = \"fluid\";\n\t\tdocumentId = path[2];\n\t} else {\n\t\ttenantId = path[2];\n\t\tdocumentId = path[3];\n\t}\n\n\t// Latest version id is the documentId for r11s\n\tlatestVersionsId = documentId;\n\n\tconnectionInfo = {\n\t\tserver,\n\t\ttenantId,\n\t\tid: documentId,\n\t};\n\n\tif (localDataOnly) {\n\t\treturn;\n\t}\n\n\tconsole.log(`Connecting to r11s: tenantId=${tenantId} id:${documentId}`);\n\tconst tokenProvider = new r11s.DefaultTokenProvider(paramJWT);\n\tconst r11sDocumentServiceFactory = new r11s.RouterliciousDocumentServiceFactory(tokenProvider);\n\treturn r11sDocumentServiceFactory.createDocumentService(r11sResolvedUrl);\n}\n\ninterface IResolvedInfo {\n\tresolvedUrl: IResolvedUrl;\n\tserviceType: \"odsp\" | \"r11s\";\n}\nasync function resolveUrl(url: string): Promise<IResolvedInfo | undefined> {\n\tconst request: IRequest = { url };\n\tlet maybeResolvedUrl: IResolvedUrl | undefined;\n\n\t// Try each url resolver in turn to figure out which one the request is compatible with.\n\tmaybeResolvedUrl = await new OdspUrlResolver().resolve(request);\n\tif (maybeResolvedUrl !== undefined) {\n\t\treturn {\n\t\t\tresolvedUrl: maybeResolvedUrl,\n\t\t\tserviceType: \"odsp\",\n\t\t};\n\t}\n\n\tmaybeResolvedUrl = await new FluidAppOdspUrlResolver().resolve(request);\n\tif (maybeResolvedUrl !== undefined) {\n\t\treturn {\n\t\t\tresolvedUrl: maybeResolvedUrl,\n\t\t\tserviceType: \"odsp\",\n\t\t};\n\t}\n\n\tmaybeResolvedUrl = await new RouterliciousUrlResolver(\n\t\tundefined,\n\t\tasync () => Promise.resolve(paramJWT),\n\t\t\"\",\n\t).resolve(request);\n\tif (maybeResolvedUrl !== undefined) {\n\t\treturn {\n\t\t\tresolvedUrl: maybeResolvedUrl,\n\t\t\tserviceType: \"r11s\",\n\t\t};\n\t}\n\n\treturn undefined;\n}\n\nexport async function fluidFetchInit(urlStr: string) {\n\tconst resolvedInfo = await resolveUrl(urlStr);\n\tif (resolvedInfo === undefined) {\n\t\tthrow new Error(`Unknown URL ${urlStr}`);\n\t}\n\tconst fluidResolvedUrl = resolvedInfo.resolvedUrl;\n\tif (resolvedInfo.serviceType === \"odsp\") {\n\t\tconst odspResolvedUrl = fluidResolvedUrl as IOdspResolvedUrl;\n\t\treturn initializeODSPCore(\n\t\t\todspResolvedUrl,\n\t\t\tnew URL(odspResolvedUrl.siteUrl).host,\n\t\t\tgetMicrosoftConfiguration(),\n\t\t);\n\t} else if (resolvedInfo.serviceType === \"r11s\") {\n\t\tconst url = new URL(urlStr);\n\t\tconst server = url.hostname.toLowerCase();\n\t\treturn initializeR11s(server, url.pathname, fluidResolvedUrl);\n\t}\n}\n"]}
@@ -2,6 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IDocumentService } from "@fluidframework/driver-definitions";
5
+ import { IDocumentService } from "@fluidframework/driver-definitions/internal";
6
6
  export declare function fluidFetchMessages(documentService?: IDocumentService, saveDir?: string): Promise<void>;
7
7
  //# sourceMappingURL=fluidFetchMessages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fluidFetchMessages.d.ts","sourceRoot":"","sources":["../src/fluidFetchMessages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAqQtE,wBAAsB,kBAAkB,CAAC,eAAe,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,MAAM,iBAgC5F"}
1
+ {"version":3,"file":"fluidFetchMessages.d.ts","sourceRoot":"","sources":["../src/fluidFetchMessages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAsQ/E,wBAAsB,kBAAkB,CAAC,eAAe,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,MAAM,iBAgC5F"}
@@ -9,7 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.fluidFetchMessages = void 0;
11
11
  const fs_1 = __importDefault(require("fs"));
12
- const core_utils_1 = require("@fluidframework/core-utils");
12
+ const internal_1 = require("@fluidframework/core-utils/internal");
13
13
  const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
14
14
  const fluidAnalyzeMessages_js_1 = require("./fluidAnalyzeMessages.js");
15
15
  const fluidFetchArgs_js_1 = require("./fluidFetchArgs.js");
@@ -33,7 +33,7 @@ async function* loadAllSequencedMessages(documentService, dir, files) {
33
33
  const messages = JSON.parse(fileContent);
34
34
  // check if there is mismatch
35
35
  seqNumMismatch = messages[0].sequenceNumber !== lastSeq + 1;
36
- (0, core_utils_1.assert)(!seqNumMismatch, 0x1b9 /* "Unexpected value for sequence number of first message in file" */);
36
+ (0, internal_1.assert)(!seqNumMismatch, 0x1b9 /* "Unexpected value for sequence number of first message in file" */);
37
37
  lastSeq = messages[messages.length - 1].sequenceNumber;
38
38
  yield messages;
39
39
  }
@@ -103,7 +103,7 @@ async function* loadAllSequencedMessages(documentService, dir, files) {
103
103
  requests++;
104
104
  const messages = result.value;
105
105
  // Empty buckets should never be returned
106
- (0, core_utils_1.assert)(messages.length !== 0, 0x1ba /* "should not return empty buckets" */);
106
+ (0, internal_1.assert)(messages.length !== 0, 0x1ba /* "should not return empty buckets" */);
107
107
  // console.log(`Loaded ops at ${messages[0].sequenceNumber}`);
108
108
  // This parsing of message contents happens in delta manager. But when we analyze messages
109
109
  // for message stats, we skip that path. So parsing of json contents needs to happen here.
@@ -178,8 +178,8 @@ dir, files) {
178
178
  messages = messages.filter((msg) => msg.sequenceNumber >= curr);
179
179
  }
180
180
  sequencedMessages = sequencedMessages.concat(messages);
181
- (0, core_utils_1.assert)(sequencedMessages[0].sequenceNumber === curr, 0x1bb /* "Unexpected sequence number on first of messages to save" */);
182
- (0, core_utils_1.assert)(sequencedMessages[sequencedMessages.length - 1].sequenceNumber ===
181
+ (0, internal_1.assert)(sequencedMessages[0].sequenceNumber === curr, 0x1bb /* "Unexpected sequence number on first of messages to save" */);
182
+ (0, internal_1.assert)(sequencedMessages[sequencedMessages.length - 1].sequenceNumber ===
183
183
  curr + sequencedMessages.length - 1, 0x1bc /* "Unexpected sequence number on last of messages to save" */);
184
184
  }
185
185
  // Time to write it out?
@@ -191,7 +191,7 @@ dir, files) {
191
191
  fs_1.default.writeFileSync(`${dir}/messages${name}.json`, JSON.stringify(write, undefined, fluidFetchArgs_js_1.paramActualFormatting ? 0 : 2));
192
192
  // increment curr by chunk
193
193
  curr += chunk;
194
- (0, core_utils_1.assert)(sequencedMessages.length === 0 || sequencedMessages[0].sequenceNumber === curr, 0x1bd /* "Stopped writing at unexpected sequence number" */);
194
+ (0, internal_1.assert)(sequencedMessages.length === 0 || sequencedMessages[0].sequenceNumber === curr, 0x1bd /* "Stopped writing at unexpected sequence number" */);
195
195
  index++;
196
196
  }
197
197
  if (result.done === true) {