@fluidframework/sequence 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/.eslintrc.js +9 -12
  2. package/.mocharc.js +2 -2
  3. package/.vscode/launch.json +15 -14
  4. package/README.md +188 -179
  5. package/api-extractor.json +2 -2
  6. package/dist/defaultMap.d.ts.map +1 -1
  7. package/dist/defaultMap.js +5 -4
  8. package/dist/defaultMap.js.map +1 -1
  9. package/dist/defaultMapInterfaces.d.ts.map +1 -1
  10. package/dist/defaultMapInterfaces.js.map +1 -1
  11. package/dist/index.d.ts +2 -2
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/intervalCollection.d.ts.map +1 -1
  15. package/dist/intervalCollection.js +50 -36
  16. package/dist/intervalCollection.js.map +1 -1
  17. package/dist/intervalTree.d.ts.map +1 -1
  18. package/dist/intervalTree.js.map +1 -1
  19. package/dist/localValues.d.ts.map +1 -1
  20. package/dist/localValues.js.map +1 -1
  21. package/dist/packageVersion.d.ts +1 -1
  22. package/dist/packageVersion.js +1 -1
  23. package/dist/packageVersion.js.map +1 -1
  24. package/dist/sequence.d.ts +1 -1
  25. package/dist/sequence.d.ts.map +1 -1
  26. package/dist/sequence.js +13 -17
  27. package/dist/sequence.js.map +1 -1
  28. package/dist/sequenceDeltaEvent.d.ts.map +1 -1
  29. package/dist/sequenceDeltaEvent.js.map +1 -1
  30. package/dist/sequenceFactory.d.ts.map +1 -1
  31. package/dist/sequenceFactory.js.map +1 -1
  32. package/dist/sharedIntervalCollection.d.ts.map +1 -1
  33. package/dist/sharedIntervalCollection.js.map +1 -1
  34. package/dist/sharedSequence.d.ts.map +1 -1
  35. package/dist/sharedSequence.js +3 -3
  36. package/dist/sharedSequence.js.map +1 -1
  37. package/dist/sharedString.d.ts.map +1 -1
  38. package/dist/sharedString.js +5 -4
  39. package/dist/sharedString.js.map +1 -1
  40. package/lib/defaultMap.d.ts.map +1 -1
  41. package/lib/defaultMap.js +6 -5
  42. package/lib/defaultMap.js.map +1 -1
  43. package/lib/defaultMapInterfaces.d.ts.map +1 -1
  44. package/lib/defaultMapInterfaces.js.map +1 -1
  45. package/lib/index.d.ts +2 -2
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/index.js +2 -2
  48. package/lib/index.js.map +1 -1
  49. package/lib/intervalCollection.d.ts.map +1 -1
  50. package/lib/intervalCollection.js +50 -36
  51. package/lib/intervalCollection.js.map +1 -1
  52. package/lib/intervalTree.d.ts.map +1 -1
  53. package/lib/intervalTree.js.map +1 -1
  54. package/lib/localValues.d.ts.map +1 -1
  55. package/lib/localValues.js +1 -1
  56. package/lib/localValues.js.map +1 -1
  57. package/lib/packageVersion.d.ts +1 -1
  58. package/lib/packageVersion.js +1 -1
  59. package/lib/packageVersion.js.map +1 -1
  60. package/lib/sequence.d.ts +1 -1
  61. package/lib/sequence.d.ts.map +1 -1
  62. package/lib/sequence.js +15 -19
  63. package/lib/sequence.js.map +1 -1
  64. package/lib/sequenceDeltaEvent.d.ts.map +1 -1
  65. package/lib/sequenceDeltaEvent.js.map +1 -1
  66. package/lib/sequenceFactory.d.ts.map +1 -1
  67. package/lib/sequenceFactory.js +1 -1
  68. package/lib/sequenceFactory.js.map +1 -1
  69. package/lib/sharedIntervalCollection.d.ts.map +1 -1
  70. package/lib/sharedIntervalCollection.js.map +1 -1
  71. package/lib/sharedSequence.d.ts.map +1 -1
  72. package/lib/sharedSequence.js +4 -4
  73. package/lib/sharedSequence.js.map +1 -1
  74. package/lib/sharedString.d.ts.map +1 -1
  75. package/lib/sharedString.js +5 -4
  76. package/lib/sharedString.js.map +1 -1
  77. package/package.json +55 -55
  78. package/prettier.config.cjs +1 -1
  79. package/src/defaultMap.ts +406 -405
  80. package/src/defaultMapInterfaces.ts +120 -115
  81. package/src/index.ts +27 -17
  82. package/src/intervalCollection.ts +2198 -1997
  83. package/src/intervalTree.ts +139 -139
  84. package/src/localValues.ts +64 -73
  85. package/src/packageVersion.ts +1 -1
  86. package/src/sequence.ts +739 -694
  87. package/src/sequenceDeltaEvent.ts +143 -137
  88. package/src/sequenceFactory.ts +48 -46
  89. package/src/sharedIntervalCollection.ts +150 -136
  90. package/src/sharedSequence.ts +165 -160
  91. package/src/sharedString.ts +385 -343
  92. package/tsconfig.esnext.json +6 -6
  93. package/tsconfig.json +8 -12
  94. package/.editorconfig +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"intervalTree.d.ts","sourceRoot":"","sources":["../src/intervalTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,aAAa,EACb,MAAM,EACN,eAAe,EACf,UAAU,EACV,YAAY,EAGf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,MAAM,WAAW,qBAAqB;IAClC,MAAM,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,oBAAoB,UAAW,aAAa,WAAoC,CAAC;AAE9F;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB;;OAEG;IACH,KAAK,IAAI,SAAS,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC9B;;;;OAIG;IACH,YAAY,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACnC;;;;OAIG;IACH,UAAU,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACjC;;;OAGG;IACH,MAAM,CACF,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,EAAE,CAAC,EAAE,yBAAyB,EAC9B,QAAQ,CAAC,EAAE,MAAM,GAClB,SAAS,GAAG,SAAS,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;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,GAAG,CAAC,KAAK,EAAE,CAAC;aACvC;SACJ;IACL,CAAC;CACJ;AApFD,oCAoFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IIntegerRange,\n RBNode,\n IRBAugmentation,\n IRBMatcher,\n RedBlackTree,\n ConflictAction,\n RBNodeActions,\n} from \"@fluidframework/merge-tree\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\nexport interface AugmentedIntervalNode {\n minmax: IInterval;\n}\n\nexport const integerRangeToString = (range: IIntegerRange) => `[${range.start},${range.end})`;\n\n/**\n * Basic interval abstraction\n */\nexport interface IInterval {\n /**\n * @returns a new interval object with identical semantics.\n */\n clone(): IInterval;\n /**\n * Compares this interval to `b` with standard comparator semantics:\n * - returns -1 if this is less than `b`\n * - returns 1 if this is greater than `b`\n * - returns 0 if this is equivalent to `b`\n * @param b - Interval to compare against\n */\n compare(b: IInterval): number;\n /**\n * Compares the start endpoint of this interval to `b`'s start endpoint.\n * Standard comparator semantics apply.\n * @param b - Interval to compare against\n */\n compareStart(b: IInterval): number;\n /**\n * Compares the end endpoint of this interval to `b`'s end endpoint.\n * Standard comparator semantics apply.\n * @param b - Interval to compare against\n */\n compareEnd(b: IInterval): number;\n /**\n * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n * @internal\n */\n modify(\n label: string,\n start: number | undefined,\n end: number | undefined,\n op?: ISequencedDocumentMessage,\n localSeq?: number\n ): IInterval | undefined;\n /**\n * @returns whether this interval overlaps with `b`.\n * Since intervals are inclusive, this includes cases where endpoints are equal.\n */\n overlaps(b: IInterval): boolean;\n /**\n * Unions this interval with `b`, returning a new interval.\n * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n * intermediate values between the two intervals.\n * @internal\n */\n union(b: IInterval): IInterval;\n}\n\nconst intervalComparer = (a: IInterval, b: IInterval) => a.compare(b);\n\nexport type IntervalNode<T extends IInterval> = RBNode<T, AugmentedIntervalNode>;\n\nexport type IntervalConflictResolver<TInterval> = (a: TInterval, b: TInterval) => TInterval;\n\nexport class IntervalTree<T extends IInterval> implements IRBAugmentation<T, AugmentedIntervalNode>,\n IRBMatcher<T, AugmentedIntervalNode> {\n public intervals = new RedBlackTree<T, AugmentedIntervalNode>(intervalComparer, this);\n\n public remove(x: T) {\n this.intervals.remove(x);\n }\n\n public removeExisting(x: T) {\n this.intervals.removeExisting(x);\n }\n\n public put(x: T, conflict?: IntervalConflictResolver<T>) {\n let rbConflict: ConflictAction<T, AugmentedIntervalNode> | undefined;\n if (conflict) {\n rbConflict = (key: T, currentKey: T) => {\n const ival = conflict(key, currentKey);\n return {\n key: ival,\n };\n };\n }\n this.intervals.put(x, { minmax: x.clone() }, rbConflict);\n }\n\n public map(fn: (x: T) => void) {\n const actions: RBNodeActions<T, AugmentedIntervalNode> = {\n infix: (node) => {\n fn(node.key);\n return true;\n },\n showStructure: true,\n };\n this.intervals.walk(actions);\n }\n\n public mapUntil(fn: (X: T) => boolean) {\n const actions: RBNodeActions<T, AugmentedIntervalNode> = {\n infix: (node) => {\n return fn(node.key);\n },\n showStructure: true,\n };\n this.intervals.walk(actions);\n }\n\n public mapBackward(fn: (x: T) => void) {\n const actions: RBNodeActions<T, AugmentedIntervalNode> = {\n infix: (node) => {\n fn(node.key);\n return true;\n },\n showStructure: true,\n };\n this.intervals.walkBackward(actions);\n }\n\n // TODO: toString()\n public match(x: T) {\n return this.intervals.gather(x, this);\n }\n\n public matchNode(node: IntervalNode<T> | undefined, key: T) {\n return !!node && node.key.overlaps(key);\n }\n\n public continueSubtree(node: IntervalNode<T> | undefined, key: T) {\n return !!node && node.data.minmax.overlaps(key);\n }\n\n public update(node: IntervalNode<T>) {\n if (node.left && node.right) {\n node.data.minmax = node.key.union(\n node.left.data.minmax.union(node.right.data.minmax));\n } else {\n if (node.left) {\n node.data.minmax = node.key.union(node.left.data.minmax);\n } else if (node.right) {\n node.data.minmax = node.key.union(node.right.data.minmax);\n } else {\n node.data.minmax = node.key.clone();\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"intervalTree.js","sourceRoot":"","sources":["../src/intervalTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAQoC;AAO7B,MAAM,oBAAoB,GAAG,CAAC,KAAoB,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC;AAAjF,QAAA,oBAAoB,wBAA6D;AAuD9F,MAAM,gBAAgB,GAAG,CAAC,CAAY,EAAE,CAAY,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAMtE,MAAa,YAAY;IAAzB;QAGQ,cAAS,GAAG,IAAI,yBAAY,CAA2B,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAiFvF,CAAC;IA/EO,MAAM,CAAC,CAAI;QACjB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAEM,cAAc,CAAC,CAAI;QACzB,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;IAEM,GAAG,CAAC,CAAI,EAAE,QAAsC;QACtD,IAAI,UAAgE,CAAC;QACrE,IAAI,QAAQ,EAAE;YACb,UAAU,GAAG,CAAC,GAAM,EAAE,UAAa,EAAE,EAAE;gBACtC,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;gBACvC,OAAO;oBACN,GAAG,EAAE,IAAI;iBACT,CAAC;YACH,CAAC,CAAC;SACF;QACD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IAEM,GAAG,CAAC,EAAkB;QAC5B,MAAM,OAAO,GAA4C;YACxD,KAAK,EAAE,CAAC,IAAI,EAA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AAI,CAAC,KAAK,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;SACvF;aAAM;YACN,IAAI,IAAI,CAAC,IAAI,EAAE;gBACd,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACzD;iBAAM,IAAI,IAAI,CAAC,KAAK,EAAE;gBACtB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aAC1D;iBAAM;gBACN,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;aACpC;SACD;IACF,CAAC;CACD;AApFD,oCAoFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIIntegerRange,\n\tRBNode,\n\tIRBAugmentation,\n\tIRBMatcher,\n\tRedBlackTree,\n\tConflictAction,\n\tRBNodeActions,\n} from \"@fluidframework/merge-tree\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\nexport interface AugmentedIntervalNode {\n\tminmax: IInterval;\n}\n\nexport const integerRangeToString = (range: IIntegerRange) => `[${range.start},${range.end})`;\n\n/**\n * Basic interval abstraction\n */\nexport interface IInterval {\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t */\n\tclone(): IInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: IInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: IInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: IInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t * @internal\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t): IInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Since intervals are inclusive, this includes cases where endpoints are equal.\n\t */\n\toverlaps(b: IInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t * @internal\n\t */\n\tunion(b: IInterval): IInterval;\n}\n\nconst intervalComparer = (a: IInterval, b: IInterval) => a.compare(b);\n\nexport type IntervalNode<T extends IInterval> = RBNode<T, AugmentedIntervalNode>;\n\nexport type IntervalConflictResolver<TInterval> = (a: TInterval, b: TInterval) => TInterval;\n\nexport class IntervalTree<T extends IInterval>\n\timplements IRBAugmentation<T, AugmentedIntervalNode>, IRBMatcher<T, AugmentedIntervalNode>\n{\n\tpublic intervals = new RedBlackTree<T, AugmentedIntervalNode>(intervalComparer, this);\n\n\tpublic remove(x: T) {\n\t\tthis.intervals.remove(x);\n\t}\n\n\tpublic removeExisting(x: T) {\n\t\tthis.intervals.removeExisting(x);\n\t}\n\n\tpublic put(x: T, conflict?: IntervalConflictResolver<T>) {\n\t\tlet rbConflict: ConflictAction<T, AugmentedIntervalNode> | undefined;\n\t\tif (conflict) {\n\t\t\trbConflict = (key: T, currentKey: T) => {\n\t\t\t\tconst ival = conflict(key, currentKey);\n\t\t\t\treturn {\n\t\t\t\t\tkey: ival,\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\t\tthis.intervals.put(x, { minmax: x.clone() }, rbConflict);\n\t}\n\n\tpublic map(fn: (x: T) => void) {\n\t\tconst actions: RBNodeActions<T, AugmentedIntervalNode> = {\n\t\t\tinfix: (node) => {\n\t\t\t\tfn(node.key);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tshowStructure: true,\n\t\t};\n\t\tthis.intervals.walk(actions);\n\t}\n\n\tpublic mapUntil(fn: (X: T) => boolean) {\n\t\tconst actions: RBNodeActions<T, AugmentedIntervalNode> = {\n\t\t\tinfix: (node) => {\n\t\t\t\treturn fn(node.key);\n\t\t\t},\n\t\t\tshowStructure: true,\n\t\t};\n\t\tthis.intervals.walk(actions);\n\t}\n\n\tpublic mapBackward(fn: (x: T) => void) {\n\t\tconst actions: RBNodeActions<T, AugmentedIntervalNode> = {\n\t\t\tinfix: (node) => {\n\t\t\t\tfn(node.key);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tshowStructure: true,\n\t\t};\n\t\tthis.intervals.walkBackward(actions);\n\t}\n\n\t// TODO: toString()\n\tpublic match(x: T) {\n\t\treturn this.intervals.gather(x, this);\n\t}\n\n\tpublic matchNode(node: IntervalNode<T> | undefined, key: T) {\n\t\treturn !!node && node.key.overlaps(key);\n\t}\n\n\tpublic continueSubtree(node: IntervalNode<T> | undefined, key: T) {\n\t\treturn !!node && node.data.minmax.overlaps(key);\n\t}\n\n\tpublic update(node: IntervalNode<T>) {\n\t\tif (node.left && node.right) {\n\t\t\tnode.data.minmax = node.key.union(node.left.data.minmax.union(node.right.data.minmax));\n\t\t} else {\n\t\t\tif (node.left) {\n\t\t\t\tnode.data.minmax = node.key.union(node.left.data.minmax);\n\t\t\t} else if (node.right) {\n\t\t\t\tnode.data.minmax = node.key.union(node.right.data.minmax);\n\t\t\t} else {\n\t\t\t\tnode.data.minmax = node.key.clone();\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"localValues.d.ts","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACH,gBAAgB,EAEnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACb,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG;IAChC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAElB;;;;;OAKG;IACH,cAAc,CACV,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,YAAY,GACnB,gBAAgB,CAAC;CACvB;AAED,wBAAgB,gBAAgB,CAC5B,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,YAAY,GAAG,kBAAkB,CAM1C;AAED;;;;GAIG;AACH,qBAAa,mBAAmB,CAAC,CAAC,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;aAM7B,KAAK,EAAE,CAAC;IAAE,OAAO,CAAC,QAAQ,CAAC,SAAS;IALhE;;;;OAIG;gBACyB,KAAK,EAAE,CAAC,EAAmB,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IAG/E;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACI,cAAc,CACjB,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,YAAY,GACnB,gBAAgB;IAUnB;;;;OAIG;IACI,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC;CAQ1D"}
1
+ {"version":3,"file":"localValues.d.ts","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAoB,MAAM,oCAAoC,CAAC;AACxF,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAElB;;;;;OAKG;IACH,cAAc,CAAC,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB,CAAC;CACnF;AAED,wBAAgB,gBAAgB,CAC/B,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,YAAY,GAChB,kBAAkB,CAMpB;AAED;;;;GAIG;AACH,qBAAa,mBAAmB,CAAC,CAAC,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;aAMhC,KAAK,EAAE,CAAC;IAAE,OAAO,CAAC,QAAQ,CAAC,SAAS;IALhE;;;;OAIG;gBACyB,KAAK,EAAE,CAAC,EAAmB,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IAE/E;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACI,cAAc,CAAC,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB;IAUzF;;;;OAIG;IACI,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC;CAQvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"localValues.js","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAG4C;AAkC5C,SAAgB,gBAAgB,CAC5B,UAAuB,EACvB,UAA4B,EAC5B,IAAkB;IAClB,MAAM,KAAK,GAAG,UAAU,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC1D,OAAO;QACH,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;KAChD,CAAC;AACN,CAAC;AATD,4CASC;AAED;;;;GAIG;AACH,MAAa,mBAAmB;IAC5B;;;;OAIG;IACH,YAA4B,KAAQ,EAAmB,SAAwB;QAAnD,UAAK,GAAL,KAAK,CAAG;QAAmB,cAAS,GAAT,SAAS,CAAe;IAC/E,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,cAAc,CACjB,UAA4B,EAC5B,IAAkB;QAElB,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjE,MAAM,KAAK,GAAG,IAAA,qCAAgB,EAAC,eAAe,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QAElE,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK;SACR,CAAC;IACN,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,MAAc;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SAC3C;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AA7CD,kDA6CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n IFluidSerializer,\n serializeHandles,\n} from \"@fluidframework/shared-object-base\";\nimport {\n ISerializableValue,\n ISerializedValue,\n IValueOperation,\n IValueType,\n} from \"./defaultMapInterfaces\";\n\n/**\n * A local value to be stored in a container type DDS.\n */\nexport interface ILocalValue<T = any> {\n /**\n * Type indicator of the value stored within.\n */\n readonly type: string;\n\n /**\n * The in-memory value stored within.\n */\n readonly value: T;\n\n /**\n * Retrieve the serialized form of the value stored within.\n * @param serializer - Data store runtime's serializer\n * @param bind - Container type's handle\n * @returns The serialized form of the contained value\n */\n makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue;\n}\n\nexport function makeSerializable(\n localValue: ILocalValue,\n serializer: IFluidSerializer,\n bind: IFluidHandle): ISerializableValue {\n const value = localValue.makeSerialized(serializer, bind);\n return {\n type: value.type,\n value: value.value && JSON.parse(value.value),\n };\n}\n\n/**\n * Manages a contained value type.\n *\n * @alpha\n */\nexport class ValueTypeLocalValue<T> implements ILocalValue<T> {\n /**\n * Create a new ValueTypeLocalValue.\n * @param value - The instance of the value type stored within\n * @param valueType - The type object of the value type stored within\n */\n constructor(public readonly value: T, private readonly valueType: IValueType<T>) {\n }\n\n /**\n * {@inheritDoc ILocalValue.\"type\"}\n */\n public get type(): string {\n return this.valueType.name;\n }\n\n /**\n * {@inheritDoc ILocalValue.makeSerialized}\n */\n public makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue {\n const storedValueType = this.valueType.factory.store(this.value);\n const value = serializeHandles(storedValueType, serializer, bind);\n\n return {\n type: this.type,\n value,\n };\n }\n\n /**\n * Get the handler for a given op of this value type.\n * @param opName - The name of the operation that needs processing\n * @returns The object which can process the given op\n */\n public getOpHandler(opName: string): IValueOperation<T> {\n const handler = this.valueType.ops.get(opName);\n if (!handler) {\n throw new Error(\"Unknown type message\");\n }\n\n return handler;\n }\n}\n"]}
1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;CACD;AAzCD,kDAyCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { IFluidSerializer, serializeHandles } from \"@fluidframework/shared-object-base\";\nimport {\n\tISerializableValue,\n\tISerializedValue,\n\tIValueOperation,\n\tIValueType,\n} from \"./defaultMapInterfaces\";\n\n/**\n * A local value to be stored in a container type DDS.\n */\nexport interface ILocalValue<T = any> {\n\t/**\n\t * Type indicator of the value stored within.\n\t */\n\treadonly type: string;\n\n\t/**\n\t * The in-memory value stored within.\n\t */\n\treadonly value: T;\n\n\t/**\n\t * Retrieve the serialized form of the value stored within.\n\t * @param serializer - Data store runtime's serializer\n\t * @param bind - Container type's handle\n\t * @returns The serialized form of the contained value\n\t */\n\tmakeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue;\n}\n\nexport function makeSerializable(\n\tlocalValue: ILocalValue,\n\tserializer: IFluidSerializer,\n\tbind: IFluidHandle,\n): ISerializableValue {\n\tconst value = localValue.makeSerialized(serializer, bind);\n\treturn {\n\t\ttype: value.type,\n\t\tvalue: value.value && JSON.parse(value.value),\n\t};\n}\n\n/**\n * Manages a contained value type.\n *\n * @alpha\n */\nexport class ValueTypeLocalValue<T> implements ILocalValue<T> {\n\t/**\n\t * Create a new ValueTypeLocalValue.\n\t * @param value - The instance of the value type stored within\n\t * @param valueType - The type object of the value type stored within\n\t */\n\tconstructor(public readonly value: T, private readonly valueType: IValueType<T>) {}\n\n\t/**\n\t * {@inheritDoc ILocalValue.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn this.valueType.name;\n\t}\n\n\t/**\n\t * {@inheritDoc ILocalValue.makeSerialized}\n\t */\n\tpublic makeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue {\n\t\tconst storedValueType = this.valueType.factory.store(this.value);\n\t\tconst value = serializeHandles(storedValueType, serializer, bind);\n\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tvalue,\n\t\t};\n\t}\n\n\t/**\n\t * Get the handler for a given op of this value type.\n\t * @param opName - The name of the operation that needs processing\n\t * @returns The object which can process the given op\n\t */\n\tpublic getOpHandler(opName: string): IValueOperation<T> {\n\t\tconst handler = this.valueType.ops.get(opName);\n\t\tif (!handler) {\n\t\t\tthrow new Error(\"Unknown type message\");\n\t\t}\n\n\t\treturn handler;\n\t}\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/sequence";
8
- export declare const pkgVersion = "2.0.0-internal.3.0.2";
8
+ export declare const pkgVersion = "2.0.0-internal.3.2.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/sequence";
11
- exports.pkgVersion = "2.0.0-internal.3.0.2";
11
+ exports.pkgVersion = "2.0.0-internal.3.2.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.0.0-internal.3.0.2\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.0.0-internal.3.2.0\";\n"]}
@@ -191,7 +191,7 @@ export declare abstract class SharedSegmentSequence<T extends ISegment> extends
191
191
  * const collection = this.getIntervalCollection(key);
192
192
  * ...
193
193
  * ```
194
- */
194
+ */
195
195
  getIntervalCollectionLabels(): IterableIterator<string>;
196
196
  /**
197
197
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
@@ -1 +1 @@
1
- {"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAA0B,MAAM,8BAA8B,CAAC;AAEhF,OAAO,EACH,yBAAyB,EAE5B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,MAAM,EAKN,YAAY,EACZ,YAAY,EAGZ,kBAAkB,EAClB,YAAY,EAEZ,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,sBAAsB,EAGtB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EAE5B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACH,gBAAgB,EAGhB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAI/F,OAAO,EACH,kBA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,OAAO,EACd,eAAe,EAAE,OAAO;IA0BzB;;OAEG;IACH,SAAS,CAAC,SAAS;IAQnB;;OAEG;IACH,SAAS,CAAC,mBAAmB;IAK7B;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO;IAI/C,OAAO,CAAC,kBAAkB;IAsB1B,OAAO,CAAC,mBAAmB;IAyC3B,OAAO,CAAC,+BAA+B;IAYvC,OAAO,CAAC,YAAY;IA6BpB,OAAO,CAAC,6BAA6B;CAuBrC"}
package/dist/sequence.js CHANGED
@@ -18,7 +18,6 @@ const snapshotFileName = "header";
18
18
  const contentPath = "content";
19
19
  class SharedSegmentSequence extends shared_object_base_1.SharedObject {
20
20
  constructor(dataStoreRuntime, id, attributes, segmentFromSpec) {
21
- var _a;
22
21
  super(id, dataStoreRuntime, attributes, "fluid_sequence_");
23
22
  this.dataStoreRuntime = dataStoreRuntime;
24
23
  this.id = id;
@@ -34,13 +33,7 @@ class SharedSegmentSequence extends shared_object_base_1.SharedObject {
34
33
  this.loadedDeferred.promise.catch((error) => {
35
34
  this.logger.sendErrorEvent({ eventName: "SequenceLoadFailed" }, error);
36
35
  });
37
- const mergeTreeOptions = Object.assign({}, dataStoreRuntime.options);
38
- const configSetAttribution = (0, telemetry_utils_1.loggerToMonitoringContext)(this.logger).config.getBoolean("Fluid.Attribution.EnableOnNewFile");
39
- if (configSetAttribution !== undefined) {
40
- (_a = mergeTreeOptions.attribution) !== null && _a !== void 0 ? _a : (mergeTreeOptions.attribution = {});
41
- mergeTreeOptions.attribution.track = configSetAttribution;
42
- }
43
- this.client = new merge_tree_1.Client(segmentFromSpec, telemetry_utils_1.ChildLogger.create(this.logger, "SharedSegmentSequence.MergeTreeClient"), mergeTreeOptions);
36
+ this.client = new merge_tree_1.Client(segmentFromSpec, telemetry_utils_1.ChildLogger.create(this.logger, "SharedSegmentSequence.MergeTreeClient"), dataStoreRuntime.options);
44
37
  this.client.on("delta", (opArgs, deltaArgs) => {
45
38
  this.emit("sequenceDelta", new sequenceDeltaEvent_1.SequenceDeltaEvent(opArgs, deltaArgs, this.client), this);
46
39
  });
@@ -63,7 +56,8 @@ class SharedSegmentSequence extends shared_object_base_1.SharedObject {
63
56
  for (const key of Object.keys(r.propertyDeltas)) {
64
57
  props[key] = (_b = (_a = r.segment.properties) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : null;
65
58
  }
66
- if (lastAnnotate && lastAnnotate.pos2 === r.position &&
59
+ if (lastAnnotate &&
60
+ lastAnnotate.pos2 === r.position &&
67
61
  (0, merge_tree_1.matchProperties)(lastAnnotate.props, props)) {
68
62
  lastAnnotate.pos2 += r.segment.cachedLength;
69
63
  }
@@ -277,7 +271,7 @@ class SharedSegmentSequence extends shared_object_base_1.SharedObject {
277
271
  * const collection = this.getIntervalCollection(key);
278
272
  * ...
279
273
  * ```
280
- */
274
+ */
281
275
  getIntervalCollectionLabels() {
282
276
  return this.intervalCollections.keys();
283
277
  }
@@ -369,10 +363,10 @@ class SharedSegmentSequence extends shared_object_base_1.SharedObject {
369
363
  .then((msgs) => {
370
364
  msgs.forEach((m) => {
371
365
  const collabWindow = this.client.getCollabWindow();
372
- if (m.minimumSequenceNumber < collabWindow.minSeq
373
- || m.referenceSequenceNumber < collabWindow.minSeq
374
- || m.sequenceNumber <= collabWindow.minSeq
375
- || m.sequenceNumber <= collabWindow.currentSeq) {
366
+ if (m.minimumSequenceNumber < collabWindow.minSeq ||
367
+ m.referenceSequenceNumber < collabWindow.minSeq ||
368
+ m.sequenceNumber <= collabWindow.minSeq ||
369
+ m.sequenceNumber <= collabWindow.currentSeq) {
376
370
  throw new Error(`Invalid catchup operations in snapshot: ${JSON.stringify({
377
371
  op: {
378
372
  seq: m.sequenceNumber,
@@ -449,7 +443,9 @@ class SharedSegmentSequence extends shared_object_base_1.SharedObject {
449
443
  (0, common_utils_1.assert)(this.loadedDeferred.isCompleted, 0x074 /* "Snapshot called when not fully loaded" */);
450
444
  const minSeq = this.runtime.deltaManager.minimumSequenceNumber;
451
445
  this.processMinSequenceNumberChanged(minSeq);
452
- this.messagesSinceMSNChange.forEach((m) => { m.minimumSequenceNumber = minSeq; });
446
+ this.messagesSinceMSNChange.forEach((m) => {
447
+ m.minimumSequenceNumber = minSeq;
448
+ });
453
449
  return this.client.summarize(this.runtime, this.handle, serializer, this.messagesSinceMSNChange);
454
450
  }
455
451
  processMergeTreeMsg(rawMessage, local) {
@@ -476,8 +472,8 @@ class SharedSegmentSequence extends shared_object_base_1.SharedObject {
476
472
  }
477
473
  this.messagesSinceMSNChange.push(stashMessage);
478
474
  // Do GC every once in a while...
479
- if (this.messagesSinceMSNChange.length > 20
480
- && this.messagesSinceMSNChange[20].sequenceNumber < message.minimumSequenceNumber) {
475
+ if (this.messagesSinceMSNChange.length > 20 &&
476
+ this.messagesSinceMSNChange[20].sequenceNumber < message.minimumSequenceNumber) {
481
477
  this.processMinSequenceNumberChanged(message.minimumSequenceNumber);
482
478
  }
483
479
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sequence.js","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAgF;AAChF,qEAAyF;AACzF,+EAG8C;AAM9C,2DA0BoC;AACpC,iEAA2F;AAC3F,2EAO4C;AAI5C,6CAA0C;AAE1C,6DAI8B;AAC9B,6DAAoF;AAGpF,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAClC,MAAM,WAAW,GAAG,SAAS,CAAC;AA2C9B,MAAsB,qBAClB,SAAQ,iCAA0C;IAkElD,YACqB,gBAAwC,EAClD,EAAU,EACjB,UAA8B,EACd,eAAiD;;QAEjE,KAAK,CAAC,EAAE,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,CAAC,CAAC;QAL1C,qBAAgB,GAAhB,gBAAgB,CAAwB;QAClD,OAAE,GAAF,EAAE,CAAQ;QAED,oBAAe,GAAf,eAAe,CAAkC;QAfrE,yDAAyD;QAC/C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AC,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,gDAAgD;QAChD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE;YAC/C,MAAM,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7D,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;SACpD;IACL,CAAC;CACJ;AAxoBD,sDAwoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { Deferred, bufferToString, assert } from \"@fluidframework/common-utils\";\nimport { ChildLogger, loggerToMonitoringContext } from \"@fluidframework/telemetry-utils\";\nimport {\n ISequencedDocumentMessage,\n MessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n Client,\n createAnnotateRangeOp,\n createGroupOp,\n createInsertOp,\n createRemoveRangeOp,\n ICombiningOp,\n IJSONSegment,\n IMergeTreeAnnotateMsg,\n IMergeTreeDeltaOp,\n IMergeTreeGroupMsg,\n IMergeTreeOp,\n IMergeTreeOptions,\n IMergeTreeRemoveMsg,\n IRelativePosition,\n ISegment,\n ISegmentAction,\n LocalReferencePosition,\n matchProperties,\n MergeTreeDeltaType,\n PropertySet,\n RangeStackMap,\n ReferencePosition,\n ReferenceType,\n MergeTreeRevertibleDriver,\n SegmentGroup,\n} from \"@fluidframework/merge-tree\";\nimport { ObjectStoragePartition, SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport {\n IFluidSerializer,\n makeHandlesSerializable,\n parseHandles,\n SharedObject,\n ISharedObjectEvents,\n SummarySerializer,\n} from \"@fluidframework/shared-object-base\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\n\nimport { DefaultMap } from \"./defaultMap\";\nimport { IMapMessageLocalMetadata, IValueChanged } from \"./defaultMapInterfaces\";\nimport {\n IntervalCollection,\n SequenceInterval,\n SequenceIntervalCollectionValueType,\n} from \"./intervalCollection\";\nimport { SequenceDeltaEvent, SequenceMaintenanceEvent } from \"./sequenceDeltaEvent\";\nimport { ISharedIntervalCollection } from \"./sharedIntervalCollection\";\n\nconst snapshotFileName = \"header\";\nconst contentPath = \"content\";\n\n/**\n * Events emitted in response to changes to the sequence data.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"sequenceDelta\"\n *\n * The sequenceDelta event is emitted when segments are inserted, annotated, or removed.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n *\n * ### \"maintenance\"\n *\n * The maintenance event is emitted when segments are modified during merge-tree maintenance.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n */\nexport interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {\n (event: \"createIntervalCollection\",\n listener: (label: string, local: boolean, target: IEventThisPlaceHolder) => void);\n (event: \"sequenceDelta\", listener: (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void);\n (event: \"maintenance\",\n listener: (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void);\n}\n\nexport abstract class SharedSegmentSequence<T extends ISegment>\n extends SharedObject<ISharedSegmentSequenceEvents>\n implements ISharedIntervalCollection<SequenceInterval>, MergeTreeRevertibleDriver {\n get loaded(): Promise<void> {\n return this.loadedDeferred.promise;\n }\n\n private static createOpsFromDelta(event: SequenceDeltaEvent): IMergeTreeDeltaOp[] {\n const ops: IMergeTreeDeltaOp[] = [];\n for (const r of event.ranges) {\n switch (event.deltaOperation) {\n case MergeTreeDeltaType.ANNOTATE: {\n const lastAnnotate = ops[ops.length - 1] as IMergeTreeAnnotateMsg;\n const props = {};\n for (const key of Object.keys(r.propertyDeltas)) {\n props[key] = r.segment.properties?.[key] ?? null;\n }\n if (lastAnnotate && lastAnnotate.pos2 === r.position &&\n matchProperties(lastAnnotate.props, props)) {\n lastAnnotate.pos2 += r.segment.cachedLength;\n } else {\n ops.push(createAnnotateRangeOp(\n r.position,\n r.position + r.segment.cachedLength,\n props,\n undefined));\n }\n break;\n }\n\n case MergeTreeDeltaType.INSERT:\n ops.push(createInsertOp(\n r.position,\n r.segment.clone().toJSONObject()));\n break;\n\n case MergeTreeDeltaType.REMOVE: {\n const lastRem = ops[ops.length - 1] as IMergeTreeRemoveMsg;\n if (lastRem?.pos1 === r.position) {\n assert(lastRem.pos2 !== undefined, 0x3ff /* pos2 should not be undefined here */);\n lastRem.pos2 += r.segment.cachedLength;\n } else {\n ops.push(createRemoveRangeOp(\n r.position,\n r.position + r.segment.cachedLength));\n }\n break;\n }\n\n default:\n }\n }\n return ops;\n }\n\n protected client: Client;\n /** `Deferred` that triggers once the object is loaded */\n protected loadedDeferred = new Deferred<void>();\n // cache out going ops created when partial loading\n private readonly loadedDeferredOutgoingOps:\n [IMergeTreeOp, SegmentGroup | SegmentGroup[]][] = [];\n // cache incoming ops that arrive when partial loading\n private deferIncomingOps = true;\n private readonly loadedDeferredIncomingOps: ISequencedDocumentMessage[] = [];\n\n private messagesSinceMSNChange: ISequencedDocumentMessage[] = [];\n private readonly intervalCollections: DefaultMap<IntervalCollection<SequenceInterval>>;\n constructor(\n private readonly dataStoreRuntime: IFluidDataStoreRuntime,\n public id: string,\n attributes: IChannelAttributes,\n public readonly segmentFromSpec: (spec: IJSONSegment) => ISegment,\n ) {\n super(id, dataStoreRuntime, attributes, \"fluid_sequence_\");\n\n this.loadedDeferred.promise.catch((error) => {\n this.logger.sendErrorEvent({ eventName: \"SequenceLoadFailed\" }, error);\n });\n\n const mergeTreeOptions = {\n ...dataStoreRuntime.options as IMergeTreeOptions\n };\n\n const configSetAttribution = loggerToMonitoringContext(this.logger).config.getBoolean(\"Fluid.Attribution.EnableOnNewFile\");\n if (configSetAttribution !== undefined) {\n mergeTreeOptions.attribution ??= {};\n mergeTreeOptions.attribution.track = configSetAttribution;\n }\n\n this.client = new Client(\n segmentFromSpec,\n ChildLogger.create(this.logger, \"SharedSegmentSequence.MergeTreeClient\"),\n mergeTreeOptions);\n\n this.client.on(\"delta\", (opArgs, deltaArgs) => {\n this.emit(\"sequenceDelta\", new SequenceDeltaEvent(opArgs, deltaArgs, this.client), this);\n });\n\n this.client.on(\"maintenance\", (args, opArgs) => {\n this.emit(\"maintenance\", new SequenceMaintenanceEvent(opArgs, args, this.client), this);\n });\n\n this.intervalCollections = new DefaultMap(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n new SequenceIntervalCollectionValueType(),\n );\n }\n\n /**\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to remove\n */\n public removeRange(start: number, end: number): IMergeTreeRemoveMsg {\n const removeOp = this.client.removeRangeLocal(start, end);\n this.submitSequenceMessage(removeOp);\n return removeOp;\n }\n\n public groupOperation(groupOp: IMergeTreeGroupMsg) {\n this.client.localTransaction(groupOp);\n this.submitSequenceMessage(groupOp);\n }\n\n /**\n * Finds the segment information (i.e. segment + offset) corresponding to a character position in the SharedString.\n * If the position is past the end of the string, `segment` and `offset` on the returned object may be undefined.\n * @param pos - Character position (index) into the current local view of the SharedString.\n */\n public getContainingSegment(pos: number): { segment: T | undefined; offset: number | undefined; } {\n return this.client.getContainingSegment<T>(pos);\n }\n\n /**\n * Returns the length of the current sequence for the client\n */\n public getLength() {\n return this.client.getLength();\n }\n\n /**\n * Returns the current position of a segment, and -1 if the segment\n * does not exist in this sequence\n * @param segment - The segment to get the position of\n */\n public getPosition(segment: ISegment): number {\n return this.client.getPosition(segment);\n }\n\n /**\n * Annotates the range with the provided properties\n *\n * @param start - The inclusive start position of the range to annotate\n * @param end - The exclusive end position of the range to annotate\n * @param props - The properties to annotate the range with\n * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n *\n */\n public annotateRange(\n start: number,\n end: number,\n props: PropertySet,\n combiningOp?: ICombiningOp) {\n const annotateOp =\n this.client.annotateRangeLocal(start, end, props, combiningOp);\n if (annotateOp) {\n this.submitSequenceMessage(annotateOp);\n }\n }\n\n public getPropertiesAtPosition(pos: number) {\n return this.client.getPropertiesAtPosition(pos);\n }\n\n public getRangeExtentsOfPosition(pos: number) {\n return this.client.getRangeExtentsOfPosition(pos);\n }\n\n /**\n * Creates a `LocalReferencePosition` on this SharedString. If the refType does not include\n * ReferenceType.Transient, the returned reference will be added to the localRefs on the provided segment.\n * @param segment - Segment to add the local reference on\n * @param offset - Offset on the segment at which to place the local reference\n * @param refType - ReferenceType for the created local reference\n * @param properties - PropertySet to place on the created local reference\n */\n public createLocalReferencePosition(\n segment: T,\n offset: number,\n refType: ReferenceType,\n properties: PropertySet | undefined): LocalReferencePosition {\n return this.client.createLocalReferencePosition(\n segment,\n offset,\n refType,\n properties);\n }\n\n /**\n * Resolves a `ReferencePosition` into a character position using this client's perspective.\n */\n public localReferencePositionToPosition(lref: ReferencePosition): number {\n return this.client.localReferencePositionToPosition(lref);\n }\n\n /**\n * Removes a `LocalReferencePosition` from this SharedString.\n */\n public removeLocalReferencePosition(lref: LocalReferencePosition) {\n return this.client.removeLocalReferencePosition(lref);\n }\n\n /**\n * Resolves a remote client's position against the local sequence\n * and returns the remote client's position relative to the local\n * sequence. The client ref seq must be above the minimum sequence number\n * or the return value will be undefined.\n * Generally this method is used in conjunction with signals which provide\n * point in time values for the below parameters, and is useful for things\n * like displaying user position. It should not be used with persisted values\n * as persisted values will quickly become invalid as the remoteClientRefSeq\n * moves below the minimum sequence number\n * @param remoteClientPosition - The remote client's position to resolve\n * @param remoteClientRefSeq - The reference sequence number of the remote client\n * @param remoteClientId - The client id of the remote client\n */\n public resolveRemoteClientPosition(\n remoteClientPosition: number,\n remoteClientRefSeq: number,\n remoteClientId: string): number | undefined {\n return this.client.resolveRemoteClientPosition(\n remoteClientPosition,\n remoteClientRefSeq,\n remoteClientId,\n );\n }\n\n public submitSequenceMessage(message: IMergeTreeOp) {\n if (!this.isAttached()) {\n return;\n }\n const translated = makeHandlesSerializable(message, this.serializer, this.handle);\n const metadata = this.client.peekPendingSegmentGroups(\n message.type === MergeTreeDeltaType.GROUP ? message.ops.length : 1);\n\n // if loading isn't complete, we need to cache\n // local ops until loading is complete, and then\n // they will be resent\n if (!this.loadedDeferred.isCompleted) {\n this.loadedDeferredOutgoingOps.push(metadata ? [translated, metadata] : translated);\n } else {\n this.submitLocalMessage(translated, metadata);\n }\n }\n\n /**\n * Given a position specified relative to a marker id, lookup the marker\n * and convert the position to a character position.\n * @param relativePos - Id of marker (may be indirect) and whether position is before or after marker.\n */\n public posFromRelativePos(relativePos: IRelativePosition) {\n return this.client.posFromRelativePos(relativePos);\n }\n\n /**\n * Walk the underlying segments of the sequence.\n * The walked segments may extend beyond the range\n * if the segments cross the ranges start or end boundaries.\n * Set split range to true to ensure only segments within the\n * range are walked.\n *\n * @param handler - The function to handle each segment\n * @param start - Optional. The start of range walk.\n * @param end - Optional. The end of range walk\n * @param accum - Optional. An object that will be passed to the handler for accumulation\n * @param splitRange - Optional. Splits boundary segments on the range boundaries\n */\n public walkSegments<TClientData>(\n handler: ISegmentAction<TClientData>,\n start?: number,\n end?: number,\n accum?: TClientData,\n splitRange: boolean = false,\n ): void {\n this.client.walkSegments(handler, start, end, accum as TClientData, splitRange);\n }\n\n public getStackContext(startPos: number, rangeLabels: string[]): RangeStackMap {\n return this.client.getStackContext(startPos, rangeLabels);\n }\n\n /**\n * @returns - The most recent sequence number which has been acked by the server and processed by this\n * SharedSegmentSequence.\n */\n public getCurrentSeq() {\n return this.client.getCurrentSeq();\n }\n\n /**\n * Inserts a segment directly before a `ReferencePosition`.\n * @param refPos - The reference position to insert the segment at\n * @param segment - The segment to insert\n */\n public insertAtReferencePosition(pos: ReferencePosition, segment: T) {\n const insertOp = this.client.insertAtReferencePositionLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n /**\n * Inserts a segment\n * @param start - The position to insert the segment at\n * @param spec - The segment to inserts spec\n */\n public insertFromSpec(pos: number, spec: IJSONSegment) {\n const segment = this.segmentFromSpec(spec);\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * Retrieves the interval collection keyed on `label`. If no such interval collection exists,\n * creates one.\n */\n public getIntervalCollection(label: string): IntervalCollection<SequenceInterval> {\n return this.intervalCollections.get(label);\n }\n\n /**\n * @returns An iterable object that enumerates the IntervalCollection labels.\n *\n * @example\n * ```typescript\n * const iter = this.getIntervalCollectionKeys();\n * for (key of iter)\n * const collection = this.getIntervalCollection(key);\n * ...\n * ```\n */\n public getIntervalCollectionLabels(): IterableIterator<string> {\n return this.intervalCollections.keys();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n */\n protected summarizeCore(\n serializer: IFluidSerializer,\n telemetryContext?: ITelemetryContext,\n ): ISummaryTreeWithStats {\n const builder = new SummaryTreeBuilder();\n\n // conditionally write the interval collection blob\n // only if it has entries\n if (this.intervalCollections.size > 0) {\n builder.addBlob(snapshotFileName, this.intervalCollections.serialize(serializer));\n }\n\n builder.addWithStats(contentPath, this.summarizeMergeTree(serializer));\n\n return builder.getSummaryTree();\n }\n\n /**\n * Runs serializer over the GC data for this SharedMatrix.\n * All the IFluidHandle's represent routes to other objects.\n */\n protected processGCDataCore(serializer: SummarySerializer) {\n if (this.intervalCollections.size > 0) {\n this.intervalCollections.serialize(serializer);\n }\n\n this.client.serializeGCData(this.handle, serializer);\n }\n\n /**\n * Replace the range specified from start to end with the provided segment\n * This is done by inserting the segment at the end of the range, followed\n * by removing the contents of the range\n * For a zero or reverse range (start \\>= end), insert at end do not remove anything\n * @param start - The start of the range to replace\n * @param end - The end of the range to replace\n * @param segment - The segment that will replace the range\n */\n protected replaceRange(start: number, end: number, segment: ISegment) {\n // Insert at the max end of the range when start > end, but still remove the range later\n const insertIndex: number = Math.max(start, end);\n\n // Insert first, so local references can slide to the inserted seg if any\n const insert = this.client.insertSegmentLocal(insertIndex, segment);\n if (insert) {\n if (start < end) {\n const remove = this.client.removeRangeLocal(start, end);\n const op = remove ? createGroupOp(insert, remove) : insert;\n this.submitSequenceMessage(op);\n } else {\n this.submitSequenceMessage(insert);\n }\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onConnect}\n */\n protected onConnect() {\n // Update merge tree collaboration information with new client ID and then resend pending ops\n this.client.startOrUpdateCollaboration(this.runtime.clientId);\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n */\n protected onDisconnect() { }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n */\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n if (!this.intervalCollections.tryResubmitMessage(content, localOpMetadata as IMapMessageLocalMetadata)) {\n this.submitSequenceMessage(\n this.client.regeneratePendingOp(\n content as IMergeTreeOp,\n localOpMetadata as SegmentGroup | SegmentGroup[]));\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService) {\n if (await storage.contains(snapshotFileName)) {\n const blob = await storage.readBlob(snapshotFileName);\n const header = bufferToString(blob, \"utf8\");\n this.intervalCollections.populate(header);\n }\n\n try {\n // this will load the header, and return a promise\n // that will resolve when the body is loaded\n // and the catchup ops are available.\n const { catchupOpsP } = await this.client.load(\n this.runtime,\n new ObjectStoragePartition(storage, contentPath),\n this.serializer);\n\n // setup a promise to process the\n // catch up ops, and finishing the loading process\n const loadCatchUpOps = catchupOpsP\n .then((msgs) => {\n msgs.forEach((m) => {\n const collabWindow = this.client.getCollabWindow();\n if (m.minimumSequenceNumber < collabWindow.minSeq\n || m.referenceSequenceNumber < collabWindow.minSeq\n || m.sequenceNumber <= collabWindow.minSeq\n || m.sequenceNumber <= collabWindow.currentSeq) {\n throw new Error(`Invalid catchup operations in snapshot: ${JSON.stringify({\n op: {\n seq: m.sequenceNumber,\n minSeq: m.minimumSequenceNumber,\n refSeq: m.referenceSequenceNumber,\n },\n collabWindow: {\n seq: collabWindow.currentSeq,\n minSeq: collabWindow.minSeq,\n },\n })}`);\n }\n this.processMergeTreeMsg(m);\n });\n this.loadFinished();\n })\n .catch((error) => {\n this.loadFinished(error);\n });\n if (this.dataStoreRuntime.options?.sequenceInitializeFromHeaderOnly !== true) {\n // if we not doing partial load, await the catch up ops,\n // and the finalization of the load\n await loadCatchUpOps;\n }\n } catch (error) {\n this.loadFinished(error);\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n */\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n // if loading isn't complete, we need to cache all\n // incoming ops to be applied after loading is complete\n if (this.deferIncomingOps) {\n assert(!local, 0x072 /* \"Unexpected local op when loading not finished\" */);\n this.loadedDeferredIncomingOps.push(message);\n } else {\n assert(message.type === MessageType.Operation, 0x073 /* \"Sequence message not operation\" */);\n\n const handled = this.intervalCollections.tryProcessMessage(\n message.contents,\n local,\n message,\n localOpMetadata,\n );\n\n if (!handled) {\n this.processMergeTreeMsg(message, local);\n }\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.didAttach}\n */\n protected didAttach() {\n // If we are not local, and we've attached we need to start generating and sending ops\n // so start collaboration and provide a default client id incase we are not connected\n if (this.isAttached()) {\n this.client.startOrUpdateCollaboration(this.runtime.clientId ?? \"attached\");\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.initializeLocalCore}\n */\n protected initializeLocalCore() {\n super.initializeLocalCore();\n this.loadFinished();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n */\n protected applyStashedOp(content: any): unknown {\n return this.client.applyStashedOp(content);\n }\n\n private summarizeMergeTree(serializer: IFluidSerializer): ISummaryTreeWithStats {\n // Are we fully loaded? If not, things will go south\n assert(this.loadedDeferred.isCompleted, 0x074 /* \"Snapshot called when not fully loaded\" */);\n const minSeq = this.runtime.deltaManager.minimumSequenceNumber;\n\n this.processMinSequenceNumberChanged(minSeq);\n\n this.messagesSinceMSNChange.forEach((m) => { m.minimumSequenceNumber = minSeq; });\n\n return this.client.summarize(this.runtime, this.handle, serializer, this.messagesSinceMSNChange);\n }\n\n private processMergeTreeMsg(rawMessage: ISequencedDocumentMessage, local?: boolean) {\n const message = parseHandles(rawMessage, this.serializer);\n\n const ops: IMergeTreeDeltaOp[] = [];\n function transformOps(event: SequenceDeltaEvent) {\n ops.push(...SharedSegmentSequence.createOpsFromDelta(event));\n }\n const needsTransformation = message.referenceSequenceNumber !== message.sequenceNumber - 1;\n let stashMessage: Readonly<ISequencedDocumentMessage> = message;\n if (this.runtime.options?.newMergeTreeSnapshotFormat !== true) {\n if (needsTransformation) {\n this.on(\"sequenceDelta\", transformOps);\n }\n }\n\n this.client.applyMsg(message, local);\n\n if (this.runtime.options?.newMergeTreeSnapshotFormat !== true) {\n if (needsTransformation) {\n this.removeListener(\"sequenceDelta\", transformOps);\n // shallow clone the message as we only overwrite top level properties,\n // like referenceSequenceNumber and content only\n stashMessage = {\n ...message,\n referenceSequenceNumber: stashMessage.sequenceNumber - 1,\n contents: ops.length !== 1 ? createGroupOp(...ops) : ops[0],\n };\n }\n\n this.messagesSinceMSNChange.push(stashMessage);\n\n // Do GC every once in a while...\n if (this.messagesSinceMSNChange.length > 20\n && this.messagesSinceMSNChange[20].sequenceNumber < message.minimumSequenceNumber) {\n this.processMinSequenceNumberChanged(message.minimumSequenceNumber);\n }\n }\n }\n\n private processMinSequenceNumberChanged(minSeq: number) {\n let index = 0;\n for (; index < this.messagesSinceMSNChange.length; index++) {\n if (this.messagesSinceMSNChange[index].sequenceNumber > minSeq) {\n break;\n }\n }\n if (index !== 0) {\n this.messagesSinceMSNChange = this.messagesSinceMSNChange.slice(index);\n }\n }\n\n private loadFinished(error?: any) {\n if (!this.loadedDeferred.isCompleted) {\n // Initialize the interval collections\n this.initializeIntervalCollections();\n if (error) {\n this.loadedDeferred.reject(error);\n throw error;\n } else {\n // it is important this series remains synchronous\n // first we stop deferring incoming ops, and apply then all\n this.deferIncomingOps = false;\n for (const message of this.loadedDeferredIncomingOps) {\n this.processCore(message, false, undefined);\n }\n this.loadedDeferredIncomingOps.length = 0;\n\n // then resolve the loaded promise\n // and resubmit all the outstanding ops, as the snapshot\n // is fully loaded, and all outstanding ops are applied\n this.loadedDeferred.resolve();\n\n for (const [messageContent, opMetadata] of this.loadedDeferredOutgoingOps) {\n this.reSubmitCore(messageContent, opMetadata);\n }\n this.loadedDeferredOutgoingOps.length = 0;\n }\n }\n }\n\n private initializeIntervalCollections() {\n // Listen and initialize new SharedIntervalCollections\n this.intervalCollections.eventEmitter.on(\"create\", ({ key, previousValue }: IValueChanged, local: boolean) => {\n const intervalCollection = this.intervalCollections.get(key);\n if (!intervalCollection.attached) {\n intervalCollection.attachGraph(this.client, key);\n }\n assert(previousValue === undefined, 0x2c1 /* \"Creating an interval collection that already exists?\" */);\n this.emit(\"createIntervalCollection\", key, local, this);\n });\n\n // Initialize existing SharedIntervalCollections\n for (const key of this.intervalCollections.keys()) {\n const intervalCollection = this.intervalCollections.get(key);\n intervalCollection.attachGraph(this.client, key);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"sequence.js","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+DAAgF;AAChF,qEAA8D;AAC9D,+EAA8F;AAM9F,2DAyBoC;AACpC,iEAA2F;AAC3F,2EAO4C;AAI5C,6CAA0C;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,IAAI,CAAC,CAAC;QACzD,CAAC,CACD,CAAC;QAEF,gDAAgD;QAChD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,EAAE;YAClD,MAAM,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7D,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;SACjD;IACF,CAAC;CACD;AAlrBD,sDAkrBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { Deferred, bufferToString, assert } from \"@fluidframework/common-utils\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n\tClient,\n\tcreateAnnotateRangeOp,\n\tcreateGroupOp,\n\tcreateInsertOp,\n\tcreateRemoveRangeOp,\n\tICombiningOp,\n\tIJSONSegment,\n\tIMergeTreeAnnotateMsg,\n\tIMergeTreeDeltaOp,\n\tIMergeTreeGroupMsg,\n\tIMergeTreeOp,\n\tIMergeTreeRemoveMsg,\n\tIRelativePosition,\n\tISegment,\n\tISegmentAction,\n\tLocalReferencePosition,\n\tmatchProperties,\n\tMergeTreeDeltaType,\n\tPropertySet,\n\tRangeStackMap,\n\tReferencePosition,\n\tReferenceType,\n\tMergeTreeRevertibleDriver,\n\tSegmentGroup,\n} from \"@fluidframework/merge-tree\";\nimport { ObjectStoragePartition, SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport {\n\tIFluidSerializer,\n\tmakeHandlesSerializable,\n\tparseHandles,\n\tSharedObject,\n\tISharedObjectEvents,\n\tSummarySerializer,\n} from \"@fluidframework/shared-object-base\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\n\nimport { DefaultMap } from \"./defaultMap\";\nimport { IMapMessageLocalMetadata, IValueChanged } from \"./defaultMapInterfaces\";\nimport {\n\tIntervalCollection,\n\tSequenceInterval,\n\tSequenceIntervalCollectionValueType,\n} from \"./intervalCollection\";\nimport { SequenceDeltaEvent, SequenceMaintenanceEvent } from \"./sequenceDeltaEvent\";\nimport { ISharedIntervalCollection } from \"./sharedIntervalCollection\";\n\nconst snapshotFileName = \"header\";\nconst contentPath = \"content\";\n\n/**\n * Events emitted in response to changes to the sequence data.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"sequenceDelta\"\n *\n * The sequenceDelta event is emitted when segments are inserted, annotated, or removed.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n *\n * ### \"maintenance\"\n *\n * The maintenance event is emitted when segments are modified during merge-tree maintenance.\n *\n * #### Listener signature\n *\n * ```typescript\n * (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void\n * ```\n * - `event` - Various information on the segments that were modified.\n *\n * - `target` - The sequence itself.\n */\nexport interface ISharedSegmentSequenceEvents extends ISharedObjectEvents {\n\t(\n\t\tevent: \"createIntervalCollection\",\n\t\tlistener: (label: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\t(\n\t\tevent: \"sequenceDelta\",\n\t\tlistener: (event: SequenceDeltaEvent, target: IEventThisPlaceHolder) => void,\n\t);\n\t(\n\t\tevent: \"maintenance\",\n\t\tlistener: (event: SequenceMaintenanceEvent, target: IEventThisPlaceHolder) => void,\n\t);\n}\n\nexport abstract class SharedSegmentSequence<T extends ISegment>\n\textends SharedObject<ISharedSegmentSequenceEvents>\n\timplements ISharedIntervalCollection<SequenceInterval>, MergeTreeRevertibleDriver\n{\n\tget loaded(): Promise<void> {\n\t\treturn this.loadedDeferred.promise;\n\t}\n\n\tprivate static createOpsFromDelta(event: SequenceDeltaEvent): IMergeTreeDeltaOp[] {\n\t\tconst ops: IMergeTreeDeltaOp[] = [];\n\t\tfor (const r of event.ranges) {\n\t\t\tswitch (event.deltaOperation) {\n\t\t\t\tcase MergeTreeDeltaType.ANNOTATE: {\n\t\t\t\t\tconst lastAnnotate = ops[ops.length - 1] as IMergeTreeAnnotateMsg;\n\t\t\t\t\tconst props = {};\n\t\t\t\t\tfor (const key of Object.keys(r.propertyDeltas)) {\n\t\t\t\t\t\tprops[key] = r.segment.properties?.[key] ?? null;\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tlastAnnotate &&\n\t\t\t\t\t\tlastAnnotate.pos2 === r.position &&\n\t\t\t\t\t\tmatchProperties(lastAnnotate.props, props)\n\t\t\t\t\t) {\n\t\t\t\t\t\tlastAnnotate.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(\n\t\t\t\t\t\t\tcreateAnnotateRangeOp(\n\t\t\t\t\t\t\t\tr.position,\n\t\t\t\t\t\t\t\tr.position + r.segment.cachedLength,\n\t\t\t\t\t\t\t\tprops,\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase MergeTreeDeltaType.INSERT:\n\t\t\t\t\tops.push(createInsertOp(r.position, r.segment.clone().toJSONObject()));\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MergeTreeDeltaType.REMOVE: {\n\t\t\t\t\tconst lastRem = ops[ops.length - 1] as IMergeTreeRemoveMsg;\n\t\t\t\t\tif (lastRem?.pos1 === r.position) {\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tlastRem.pos2 !== undefined,\n\t\t\t\t\t\t\t0x3ff /* pos2 should not be undefined here */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlastRem.pos2 += r.segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tops.push(\n\t\t\t\t\t\t\tcreateRemoveRangeOp(r.position, r.position + r.segment.cachedLength),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\treturn ops;\n\t}\n\n\tprotected client: Client;\n\t/** `Deferred` that triggers once the object is loaded */\n\tprotected loadedDeferred = new Deferred<void>();\n\t// cache out going ops created when partial loading\n\tprivate readonly loadedDeferredOutgoingOps: [IMergeTreeOp, SegmentGroup | SegmentGroup[]][] =\n\t\t[];\n\t// cache incoming ops that arrive when partial loading\n\tprivate deferIncomingOps = true;\n\tprivate readonly loadedDeferredIncomingOps: ISequencedDocumentMessage[] = [];\n\n\tprivate messagesSinceMSNChange: ISequencedDocumentMessage[] = [];\n\tprivate readonly intervalCollections: DefaultMap<IntervalCollection<SequenceInterval>>;\n\tconstructor(\n\t\tprivate readonly dataStoreRuntime: IFluidDataStoreRuntime,\n\t\tpublic id: string,\n\t\tattributes: IChannelAttributes,\n\t\tpublic readonly segmentFromSpec: (spec: IJSONSegment) => ISegment,\n\t) {\n\t\tsuper(id, dataStoreRuntime, attributes, \"fluid_sequence_\");\n\n\t\tthis.loadedDeferred.promise.catch((error) => {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"SequenceLoadFailed\" }, error);\n\t\t});\n\n\t\tthis.client = new Client(\n\t\t\tsegmentFromSpec,\n\t\t\tChildLogger.create(this.logger, \"SharedSegmentSequence.MergeTreeClient\"),\n\t\t\tdataStoreRuntime.options,\n\t\t);\n\n\t\tthis.client.on(\"delta\", (opArgs, deltaArgs) => {\n\t\t\tthis.emit(\n\t\t\t\t\"sequenceDelta\",\n\t\t\t\tnew SequenceDeltaEvent(opArgs, deltaArgs, this.client),\n\t\t\t\tthis,\n\t\t\t);\n\t\t});\n\n\t\tthis.client.on(\"maintenance\", (args, opArgs) => {\n\t\t\tthis.emit(\"maintenance\", new SequenceMaintenanceEvent(opArgs, args, this.client), this);\n\t\t});\n\n\t\tthis.intervalCollections = new DefaultMap(\n\t\t\tthis.serializer,\n\t\t\tthis.handle,\n\t\t\t(op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n\t\t\tnew SequenceIntervalCollectionValueType(),\n\t\t);\n\t}\n\n\t/**\n\t * @param start - The inclusive start of the range to remove\n\t * @param end - The exclusive end of the range to remove\n\t */\n\tpublic removeRange(start: number, end: number): IMergeTreeRemoveMsg {\n\t\tconst removeOp = this.client.removeRangeLocal(start, end);\n\t\tthis.submitSequenceMessage(removeOp);\n\t\treturn removeOp;\n\t}\n\n\tpublic groupOperation(groupOp: IMergeTreeGroupMsg) {\n\t\tthis.client.localTransaction(groupOp);\n\t\tthis.submitSequenceMessage(groupOp);\n\t}\n\n\t/**\n\t * Finds the segment information (i.e. segment + offset) corresponding to a character position in the SharedString.\n\t * If the position is past the end of the string, `segment` and `offset` on the returned object may be undefined.\n\t * @param pos - Character position (index) into the current local view of the SharedString.\n\t */\n\tpublic getContainingSegment(pos: number): {\n\t\tsegment: T | undefined;\n\t\toffset: number | undefined;\n\t} {\n\t\treturn this.client.getContainingSegment<T>(pos);\n\t}\n\n\t/**\n\t * Returns the length of the current sequence for the client\n\t */\n\tpublic getLength() {\n\t\treturn this.client.getLength();\n\t}\n\n\t/**\n\t * Returns the current position of a segment, and -1 if the segment\n\t * does not exist in this sequence\n\t * @param segment - The segment to get the position of\n\t */\n\tpublic getPosition(segment: ISegment): number {\n\t\treturn this.client.getPosition(segment);\n\t}\n\n\t/**\n\t * Annotates the range with the provided properties\n\t *\n\t * @param start - The inclusive start position of the range to annotate\n\t * @param end - The exclusive end position of the range to annotate\n\t * @param props - The properties to annotate the range with\n\t * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n\t *\n\t */\n\tpublic annotateRange(\n\t\tstart: number,\n\t\tend: number,\n\t\tprops: PropertySet,\n\t\tcombiningOp?: ICombiningOp,\n\t) {\n\t\tconst annotateOp = this.client.annotateRangeLocal(start, end, props, combiningOp);\n\t\tif (annotateOp) {\n\t\t\tthis.submitSequenceMessage(annotateOp);\n\t\t}\n\t}\n\n\tpublic getPropertiesAtPosition(pos: number) {\n\t\treturn this.client.getPropertiesAtPosition(pos);\n\t}\n\n\tpublic getRangeExtentsOfPosition(pos: number) {\n\t\treturn this.client.getRangeExtentsOfPosition(pos);\n\t}\n\n\t/**\n\t * Creates a `LocalReferencePosition` on this SharedString. If the refType does not include\n\t * ReferenceType.Transient, the returned reference will be added to the localRefs on the provided segment.\n\t * @param segment - Segment to add the local reference on\n\t * @param offset - Offset on the segment at which to place the local reference\n\t * @param refType - ReferenceType for the created local reference\n\t * @param properties - PropertySet to place on the created local reference\n\t */\n\tpublic createLocalReferencePosition(\n\t\tsegment: T,\n\t\toffset: number,\n\t\trefType: ReferenceType,\n\t\tproperties: PropertySet | undefined,\n\t): LocalReferencePosition {\n\t\treturn this.client.createLocalReferencePosition(segment, offset, refType, properties);\n\t}\n\n\t/**\n\t * Resolves a `ReferencePosition` into a character position using this client's perspective.\n\t */\n\tpublic localReferencePositionToPosition(lref: ReferencePosition): number {\n\t\treturn this.client.localReferencePositionToPosition(lref);\n\t}\n\n\t/**\n\t * Removes a `LocalReferencePosition` from this SharedString.\n\t */\n\tpublic removeLocalReferencePosition(lref: LocalReferencePosition) {\n\t\treturn this.client.removeLocalReferencePosition(lref);\n\t}\n\n\t/**\n\t * Resolves a remote client's position against the local sequence\n\t * and returns the remote client's position relative to the local\n\t * sequence. The client ref seq must be above the minimum sequence number\n\t * or the return value will be undefined.\n\t * Generally this method is used in conjunction with signals which provide\n\t * point in time values for the below parameters, and is useful for things\n\t * like displaying user position. It should not be used with persisted values\n\t * as persisted values will quickly become invalid as the remoteClientRefSeq\n\t * moves below the minimum sequence number\n\t * @param remoteClientPosition - The remote client's position to resolve\n\t * @param remoteClientRefSeq - The reference sequence number of the remote client\n\t * @param remoteClientId - The client id of the remote client\n\t */\n\tpublic resolveRemoteClientPosition(\n\t\tremoteClientPosition: number,\n\t\tremoteClientRefSeq: number,\n\t\tremoteClientId: string,\n\t): number | undefined {\n\t\treturn this.client.resolveRemoteClientPosition(\n\t\t\tremoteClientPosition,\n\t\t\tremoteClientRefSeq,\n\t\t\tremoteClientId,\n\t\t);\n\t}\n\n\tpublic submitSequenceMessage(message: IMergeTreeOp) {\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\t\tconst translated = makeHandlesSerializable(message, this.serializer, this.handle);\n\t\tconst metadata = this.client.peekPendingSegmentGroups(\n\t\t\tmessage.type === MergeTreeDeltaType.GROUP ? message.ops.length : 1,\n\t\t);\n\n\t\t// if loading isn't complete, we need to cache\n\t\t// local ops until loading is complete, and then\n\t\t// they will be resent\n\t\tif (!this.loadedDeferred.isCompleted) {\n\t\t\tthis.loadedDeferredOutgoingOps.push(metadata ? [translated, metadata] : translated);\n\t\t} else {\n\t\t\tthis.submitLocalMessage(translated, metadata);\n\t\t}\n\t}\n\n\t/**\n\t * Given a position specified relative to a marker id, lookup the marker\n\t * and convert the position to a character position.\n\t * @param relativePos - Id of marker (may be indirect) and whether position is before or after marker.\n\t */\n\tpublic posFromRelativePos(relativePos: IRelativePosition) {\n\t\treturn this.client.posFromRelativePos(relativePos);\n\t}\n\n\t/**\n\t * Walk the underlying segments of the sequence.\n\t * The walked segments may extend beyond the range\n\t * if the segments cross the ranges start or end boundaries.\n\t * Set split range to true to ensure only segments within the\n\t * range are walked.\n\t *\n\t * @param handler - The function to handle each segment\n\t * @param start - Optional. The start of range walk.\n\t * @param end - Optional. The end of range walk\n\t * @param accum - Optional. An object that will be passed to the handler for accumulation\n\t * @param splitRange - Optional. Splits boundary segments on the range boundaries\n\t */\n\tpublic walkSegments<TClientData>(\n\t\thandler: ISegmentAction<TClientData>,\n\t\tstart?: number,\n\t\tend?: number,\n\t\taccum?: TClientData,\n\t\tsplitRange: boolean = false,\n\t): void {\n\t\tthis.client.walkSegments(handler, start, end, accum as TClientData, splitRange);\n\t}\n\n\tpublic getStackContext(startPos: number, rangeLabels: string[]): RangeStackMap {\n\t\treturn this.client.getStackContext(startPos, rangeLabels);\n\t}\n\n\t/**\n\t * @returns - The most recent sequence number which has been acked by the server and processed by this\n\t * SharedSegmentSequence.\n\t */\n\tpublic getCurrentSeq() {\n\t\treturn this.client.getCurrentSeq();\n\t}\n\n\t/**\n\t * Inserts a segment directly before a `ReferencePosition`.\n\t * @param refPos - The reference position to insert the segment at\n\t * @param segment - The segment to insert\n\t */\n\tpublic insertAtReferencePosition(pos: ReferencePosition, segment: T) {\n\t\tconst insertOp = this.client.insertAtReferencePositionLocal(pos, segment);\n\t\tif (insertOp) {\n\t\t\tthis.submitSequenceMessage(insertOp);\n\t\t}\n\t}\n\t/**\n\t * Inserts a segment\n\t * @param start - The position to insert the segment at\n\t * @param spec - The segment to inserts spec\n\t */\n\tpublic insertFromSpec(pos: number, spec: IJSONSegment) {\n\t\tconst segment = this.segmentFromSpec(spec);\n\t\tconst insertOp = this.client.insertSegmentLocal(pos, segment);\n\t\tif (insertOp) {\n\t\t\tthis.submitSequenceMessage(insertOp);\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the interval collection keyed on `label`. If no such interval collection exists,\n\t * creates one.\n\t */\n\tpublic getIntervalCollection(label: string): IntervalCollection<SequenceInterval> {\n\t\treturn this.intervalCollections.get(label);\n\t}\n\n\t/**\n\t * @returns An iterable object that enumerates the IntervalCollection labels.\n\t *\n\t * @example\n\t * ```typescript\n\t * const iter = this.getIntervalCollectionKeys();\n\t * for (key of iter)\n\t * const collection = this.getIntervalCollection(key);\n\t * ...\n\t * ```\n\t */\n\tpublic getIntervalCollectionLabels(): IterableIterator<string> {\n\t\treturn this.intervalCollections.keys();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t */\n\tprotected summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\n\t\t// conditionally write the interval collection blob\n\t\t// only if it has entries\n\t\tif (this.intervalCollections.size > 0) {\n\t\t\tbuilder.addBlob(snapshotFileName, this.intervalCollections.serialize(serializer));\n\t\t}\n\n\t\tbuilder.addWithStats(contentPath, this.summarizeMergeTree(serializer));\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Runs serializer over the GC data for this SharedMatrix.\n\t * All the IFluidHandle's represent routes to other objects.\n\t */\n\tprotected processGCDataCore(serializer: SummarySerializer) {\n\t\tif (this.intervalCollections.size > 0) {\n\t\t\tthis.intervalCollections.serialize(serializer);\n\t\t}\n\n\t\tthis.client.serializeGCData(this.handle, serializer);\n\t}\n\n\t/**\n\t * Replace the range specified from start to end with the provided segment\n\t * This is done by inserting the segment at the end of the range, followed\n\t * by removing the contents of the range\n\t * For a zero or reverse range (start \\>= end), insert at end do not remove anything\n\t * @param start - The start of the range to replace\n\t * @param end - The end of the range to replace\n\t * @param segment - The segment that will replace the range\n\t */\n\tprotected replaceRange(start: number, end: number, segment: ISegment) {\n\t\t// Insert at the max end of the range when start > end, but still remove the range later\n\t\tconst insertIndex: number = Math.max(start, end);\n\n\t\t// Insert first, so local references can slide to the inserted seg if any\n\t\tconst insert = this.client.insertSegmentLocal(insertIndex, segment);\n\t\tif (insert) {\n\t\t\tif (start < end) {\n\t\t\t\tconst remove = this.client.removeRangeLocal(start, end);\n\t\t\t\tconst op = remove ? createGroupOp(insert, remove) : insert;\n\t\t\t\tthis.submitSequenceMessage(op);\n\t\t\t} else {\n\t\t\t\tthis.submitSequenceMessage(insert);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onConnect}\n\t */\n\tprotected onConnect() {\n\t\t// Update merge tree collaboration information with new client ID and then resend pending ops\n\t\tthis.client.startOrUpdateCollaboration(this.runtime.clientId);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t */\n\tprotected onDisconnect() {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n\t */\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown) {\n\t\tif (\n\t\t\t!this.intervalCollections.tryResubmitMessage(\n\t\t\t\tcontent,\n\t\t\t\tlocalOpMetadata as IMapMessageLocalMetadata,\n\t\t\t)\n\t\t) {\n\t\t\tthis.submitSequenceMessage(\n\t\t\t\tthis.client.regeneratePendingOp(\n\t\t\t\t\tcontent as IMergeTreeOp,\n\t\t\t\t\tlocalOpMetadata as SegmentGroup | SegmentGroup[],\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService) {\n\t\tif (await storage.contains(snapshotFileName)) {\n\t\t\tconst blob = await storage.readBlob(snapshotFileName);\n\t\t\tconst header = bufferToString(blob, \"utf8\");\n\t\t\tthis.intervalCollections.populate(header);\n\t\t}\n\n\t\ttry {\n\t\t\t// this will load the header, and return a promise\n\t\t\t// that will resolve when the body is loaded\n\t\t\t// and the catchup ops are available.\n\t\t\tconst { catchupOpsP } = await this.client.load(\n\t\t\t\tthis.runtime,\n\t\t\t\tnew ObjectStoragePartition(storage, contentPath),\n\t\t\t\tthis.serializer,\n\t\t\t);\n\n\t\t\t// setup a promise to process the\n\t\t\t// catch up ops, and finishing the loading process\n\t\t\tconst loadCatchUpOps = catchupOpsP\n\t\t\t\t.then((msgs) => {\n\t\t\t\t\tmsgs.forEach((m) => {\n\t\t\t\t\t\tconst collabWindow = this.client.getCollabWindow();\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tm.minimumSequenceNumber < collabWindow.minSeq ||\n\t\t\t\t\t\t\tm.referenceSequenceNumber < collabWindow.minSeq ||\n\t\t\t\t\t\t\tm.sequenceNumber <= collabWindow.minSeq ||\n\t\t\t\t\t\t\tm.sequenceNumber <= collabWindow.currentSeq\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Invalid catchup operations in snapshot: ${JSON.stringify({\n\t\t\t\t\t\t\t\t\top: {\n\t\t\t\t\t\t\t\t\t\tseq: m.sequenceNumber,\n\t\t\t\t\t\t\t\t\t\tminSeq: m.minimumSequenceNumber,\n\t\t\t\t\t\t\t\t\t\trefSeq: m.referenceSequenceNumber,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcollabWindow: {\n\t\t\t\t\t\t\t\t\t\tseq: collabWindow.currentSeq,\n\t\t\t\t\t\t\t\t\t\tminSeq: collabWindow.minSeq,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t})}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.processMergeTreeMsg(m);\n\t\t\t\t\t});\n\t\t\t\t\tthis.loadFinished();\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tthis.loadFinished(error);\n\t\t\t\t});\n\t\t\tif (this.dataStoreRuntime.options?.sequenceInitializeFromHeaderOnly !== true) {\n\t\t\t\t// if we not doing partial load, await the catch up ops,\n\t\t\t\t// and the finalization of the load\n\t\t\t\tawait loadCatchUpOps;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.loadFinished(error);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\t// if loading isn't complete, we need to cache all\n\t\t// incoming ops to be applied after loading is complete\n\t\tif (this.deferIncomingOps) {\n\t\t\tassert(!local, 0x072 /* \"Unexpected local op when loading not finished\" */);\n\t\t\tthis.loadedDeferredIncomingOps.push(message);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tmessage.type === MessageType.Operation,\n\t\t\t\t0x073 /* \"Sequence message not operation\" */,\n\t\t\t);\n\n\t\t\tconst handled = this.intervalCollections.tryProcessMessage(\n\t\t\t\tmessage.contents,\n\t\t\t\tlocal,\n\t\t\t\tmessage,\n\t\t\t\tlocalOpMetadata,\n\t\t\t);\n\n\t\t\tif (!handled) {\n\t\t\t\tthis.processMergeTreeMsg(message, local);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.didAttach}\n\t */\n\tprotected didAttach() {\n\t\t// If we are not local, and we've attached we need to start generating and sending ops\n\t\t// so start collaboration and provide a default client id incase we are not connected\n\t\tif (this.isAttached()) {\n\t\t\tthis.client.startOrUpdateCollaboration(this.runtime.clientId ?? \"attached\");\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.initializeLocalCore}\n\t */\n\tprotected initializeLocalCore() {\n\t\tsuper.initializeLocalCore();\n\t\tthis.loadFinished();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(content: any): unknown {\n\t\treturn this.client.applyStashedOp(content);\n\t}\n\n\tprivate summarizeMergeTree(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\t// Are we fully loaded? If not, things will go south\n\t\tassert(\n\t\t\tthis.loadedDeferred.isCompleted,\n\t\t\t0x074 /* \"Snapshot called when not fully loaded\" */,\n\t\t);\n\t\tconst minSeq = this.runtime.deltaManager.minimumSequenceNumber;\n\n\t\tthis.processMinSequenceNumberChanged(minSeq);\n\n\t\tthis.messagesSinceMSNChange.forEach((m) => {\n\t\t\tm.minimumSequenceNumber = minSeq;\n\t\t});\n\n\t\treturn this.client.summarize(\n\t\t\tthis.runtime,\n\t\t\tthis.handle,\n\t\t\tserializer,\n\t\t\tthis.messagesSinceMSNChange,\n\t\t);\n\t}\n\n\tprivate processMergeTreeMsg(rawMessage: ISequencedDocumentMessage, local?: boolean) {\n\t\tconst message = parseHandles(rawMessage, this.serializer);\n\n\t\tconst ops: IMergeTreeDeltaOp[] = [];\n\t\tfunction transformOps(event: SequenceDeltaEvent) {\n\t\t\tops.push(...SharedSegmentSequence.createOpsFromDelta(event));\n\t\t}\n\t\tconst needsTransformation = message.referenceSequenceNumber !== message.sequenceNumber - 1;\n\t\tlet stashMessage: Readonly<ISequencedDocumentMessage> = message;\n\t\tif (this.runtime.options?.newMergeTreeSnapshotFormat !== true) {\n\t\t\tif (needsTransformation) {\n\t\t\t\tthis.on(\"sequenceDelta\", transformOps);\n\t\t\t}\n\t\t}\n\n\t\tthis.client.applyMsg(message, local);\n\n\t\tif (this.runtime.options?.newMergeTreeSnapshotFormat !== true) {\n\t\t\tif (needsTransformation) {\n\t\t\t\tthis.removeListener(\"sequenceDelta\", transformOps);\n\t\t\t\t// shallow clone the message as we only overwrite top level properties,\n\t\t\t\t// like referenceSequenceNumber and content only\n\t\t\t\tstashMessage = {\n\t\t\t\t\t...message,\n\t\t\t\t\treferenceSequenceNumber: stashMessage.sequenceNumber - 1,\n\t\t\t\t\tcontents: ops.length !== 1 ? createGroupOp(...ops) : ops[0],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.messagesSinceMSNChange.push(stashMessage);\n\n\t\t\t// Do GC every once in a while...\n\t\t\tif (\n\t\t\t\tthis.messagesSinceMSNChange.length > 20 &&\n\t\t\t\tthis.messagesSinceMSNChange[20].sequenceNumber < message.minimumSequenceNumber\n\t\t\t) {\n\t\t\t\tthis.processMinSequenceNumberChanged(message.minimumSequenceNumber);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate processMinSequenceNumberChanged(minSeq: number) {\n\t\tlet index = 0;\n\t\tfor (; index < this.messagesSinceMSNChange.length; index++) {\n\t\t\tif (this.messagesSinceMSNChange[index].sequenceNumber > minSeq) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (index !== 0) {\n\t\t\tthis.messagesSinceMSNChange = this.messagesSinceMSNChange.slice(index);\n\t\t}\n\t}\n\n\tprivate loadFinished(error?: any) {\n\t\tif (!this.loadedDeferred.isCompleted) {\n\t\t\t// Initialize the interval collections\n\t\t\tthis.initializeIntervalCollections();\n\t\t\tif (error) {\n\t\t\t\tthis.loadedDeferred.reject(error);\n\t\t\t\tthrow error;\n\t\t\t} else {\n\t\t\t\t// it is important this series remains synchronous\n\t\t\t\t// first we stop deferring incoming ops, and apply then all\n\t\t\t\tthis.deferIncomingOps = false;\n\t\t\t\tfor (const message of this.loadedDeferredIncomingOps) {\n\t\t\t\t\tthis.processCore(message, false, undefined);\n\t\t\t\t}\n\t\t\t\tthis.loadedDeferredIncomingOps.length = 0;\n\n\t\t\t\t// then resolve the loaded promise\n\t\t\t\t// and resubmit all the outstanding ops, as the snapshot\n\t\t\t\t// is fully loaded, and all outstanding ops are applied\n\t\t\t\tthis.loadedDeferred.resolve();\n\n\t\t\t\tfor (const [messageContent, opMetadata] of this.loadedDeferredOutgoingOps) {\n\t\t\t\t\tthis.reSubmitCore(messageContent, opMetadata);\n\t\t\t\t}\n\t\t\t\tthis.loadedDeferredOutgoingOps.length = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate initializeIntervalCollections() {\n\t\t// Listen and initialize new SharedIntervalCollections\n\t\tthis.intervalCollections.eventEmitter.on(\n\t\t\t\"create\",\n\t\t\t({ key, previousValue }: IValueChanged, local: boolean) => {\n\t\t\t\tconst intervalCollection = this.intervalCollections.get(key);\n\t\t\t\tif (!intervalCollection.attached) {\n\t\t\t\t\tintervalCollection.attachGraph(this.client, key);\n\t\t\t\t}\n\t\t\t\tassert(\n\t\t\t\t\tpreviousValue === undefined,\n\t\t\t\t\t0x2c1 /* \"Creating an interval collection that already exists?\" */,\n\t\t\t\t);\n\t\t\t\tthis.emit(\"createIntervalCollection\", key, local, this);\n\t\t\t},\n\t\t);\n\n\t\t// Initialize existing SharedIntervalCollections\n\t\tfor (const key of this.intervalCollections.keys()) {\n\t\t\tconst intervalCollection = this.intervalCollections.get(key);\n\t\t\tintervalCollection.attachGraph(this.client, key);\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceDeltaEvent.d.ts","sourceRoot":"","sources":["../src/sequenceDeltaEvent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,MAAM,EACN,2BAA2B,EAC3B,qBAAqB,EACrB,iCAAiC,EACjC,QAAQ,EACR,2BAA2B,EAC3B,4BAA4B,EAC5B,wBAAwB,EACxB,WAAW,EAEd,MAAM,4BAA4B,CAAC;AAEpC;;;;;;GAMG;AACH,8BAAsB,aAAa,CAAC,UAAU,SAAS,4BAA4B,GAAG,4BAA4B;aAO1F,SAAS,EAAE,2BAA2B,CAAC,UAAU,CAAC;IAClE,OAAO,CAAC,QAAQ,CAAC,eAAe;IAPpC,SAAgB,cAAc,EAAE,UAAU,CAAC;IAC3C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA0D;IACvF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAC/D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwC;gBAG1C,SAAS,EAAE,2BAA2B,CAAC,UAAU,CAAC,EACjD,eAAe,EAAE,MAAM;IA6B5C;;;OAGG;IACH,IAAW,MAAM,IAAI,SAAS,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,EAAE,CAExE;IAED;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,GAAG,SAAS,CAExC;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAE5D;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAE3D;CACJ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AAC,IAAI,CAAC,UAAU,EAAE;YAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;SACvC;QACD,OAAO,IAAI,CAAC,MAAW,CAAC;IAC5B,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n Client,\n IMergeTreeDeltaCallbackArgs,\n IMergeTreeDeltaOpArgs,\n IMergeTreeMaintenanceCallbackArgs,\n ISegment,\n MergeTreeDeltaOperationType,\n MergeTreeDeltaOperationTypes,\n MergeTreeMaintenanceType,\n PropertySet,\n SortedSegmentSet,\n} from \"@fluidframework/merge-tree\";\n\n/**\n * Base class for SequenceDeltaEvent and SequenceMaintenanceEvent.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into any future modifications performed to the underlying sequence and merge tree.\n */\nexport abstract class SequenceEvent<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {\n public readonly deltaOperation: TOperation;\n private readonly sortedRanges: Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>;\n private readonly pFirst: Lazy<ISequenceDeltaRange<TOperation>>;\n private readonly pLast: Lazy<ISequenceDeltaRange<TOperation>>;\n\n constructor(\n public readonly deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>,\n private readonly mergeTreeClient: Client,\n ) {\n assert(deltaArgs.deltaSegments.length > 0, 0x2d8 /* \"Empty change event should not be emitted.\" */);\n this.deltaOperation = deltaArgs.operation;\n\n this.sortedRanges = new Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>(\n () => {\n const set = new SortedSegmentSet<ISequenceDeltaRange<TOperation>>();\n this.deltaArgs.deltaSegments.forEach((delta) => {\n const newRange: ISequenceDeltaRange<TOperation> = {\n operation: this.deltaArgs.operation,\n position: this.mergeTreeClient.getPosition(delta.segment),\n propertyDeltas: delta.propertyDeltas ?? {},\n segment: delta.segment,\n };\n set.addOrUpdate(newRange);\n });\n return set;\n });\n\n this.pFirst = new Lazy<ISequenceDeltaRange<TOperation>>(\n () => this.sortedRanges.value.items[0],\n );\n\n this.pLast = new Lazy<ISequenceDeltaRange<TOperation>>(\n () => this.sortedRanges.value.items[this.sortedRanges.value.size - 1],\n );\n }\n\n /**\n * The in-order ranges affected by this delta.\n * These may not be continuous.\n */\n public get ranges(): readonly Readonly<ISequenceDeltaRange<TOperation>>[] {\n return this.sortedRanges.value.items;\n }\n\n /**\n * The client id of the client that made the change which caused the delta event\n */\n public get clientId(): string | undefined {\n return this.mergeTreeClient.longClientId;\n }\n\n /**\n * The first of the modified ranges.\n */\n public get first(): Readonly<ISequenceDeltaRange<TOperation>> {\n return this.pFirst.value;\n }\n\n /**\n * The last of the modified ranges.\n */\n public get last(): Readonly<ISequenceDeltaRange<TOperation>> {\n return this.pLast.value;\n }\n}\n\n/**\n * The event object returned on sequenceDelta events.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.\n *\n * For group ops, each op will get its own event, and the group op property will be set on the op args.\n *\n * Ops may get multiple events. For instance, an insert-replace will get a remove then an insert event.\n */\nexport class SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationType> {\n /**\n * Whether the event was caused by a locally-made change.\n */\n public readonly isLocal: boolean;\n\n constructor(\n public readonly opArgs: IMergeTreeDeltaOpArgs,\n deltaArgs: IMergeTreeDeltaCallbackArgs,\n mergeTreeClient: Client,\n ) {\n super(deltaArgs, mergeTreeClient);\n this.isLocal = opArgs.sequencedMessage === undefined;\n }\n}\n\n/**\n * The event object returned on maintenance events.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.\n */\nexport class SequenceMaintenanceEvent extends SequenceEvent<MergeTreeMaintenanceType> {\n constructor(\n public readonly opArgs: IMergeTreeDeltaOpArgs | undefined,\n deltaArgs: IMergeTreeMaintenanceCallbackArgs,\n mergeTreeClient: Client,\n ) {\n super(deltaArgs, mergeTreeClient);\n }\n}\n\n/**\n * A range that has changed corresponding to a segment modification.\n */\nexport interface ISequenceDeltaRange<TOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes> {\n /**\n * The type of operation that changed this range.\n * @remarks - Consuming code should typically compare this to the enum values defined in\n * `MergeTreeDeltaOperationTypes`.\n */\n operation: TOperation;\n /**\n * The index of the start of the range.\n */\n position: number;\n /**\n * The segment that corresponds to the range.\n */\n segment: ISegment;\n /**\n * Deltas object which contains all modified properties with their previous values.\n * Since `undefined` doesn't survive a round-trip through JSON serialization, the old value being absent\n * is instead encoded with `null`.\n * @remarks - This object is motivated by undo/redo scenarios, and provides a convenient \"inverse op\" to apply to\n * undo a property change.\n * @example - If a segment initially had properties `{ foo: \"1\", bar: 2 }` and it was annotated with\n * `{ foo: 3, baz: 5 }`, the corresponding event would have a `propertyDeltas` of `{ foo: \"1\", baz: null }`.\n */\n propertyDeltas: PropertySet;\n}\n\nclass Lazy<T> {\n private pValue: T | undefined;\n private pEvaluated: boolean;\n constructor(private readonly valueGenerator: () => T) {\n this.pEvaluated = false;\n }\n\n public get evaluated(): boolean {\n return this.pEvaluated;\n }\n\n public get value(): T {\n if (!this.pEvaluated) {\n this.pEvaluated = true;\n this.pValue = this.valueGenerator();\n }\n return this.pValue as T;\n }\n}\n"]}
1
+ {"version":3,"file":"sequenceDeltaEvent.js","sourceRoot":"","sources":["../src/sequenceDeltaEvent.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AACtD,2DAWoC;AAEpC;;;;;;GAMG;AACH,MAAsB,aAAa;IAQlC,YACiB,SAAkD,EACjD,eAAuB;QADxB,cAAS,GAAT,SAAS,CAAyC;QACjD,oBAAe,GAAf,eA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AAI,CAAC,eAAe,CAAC,YAAY,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IACzB,CAAC;CACD;AArED,sCAqEC;AAED;;;;;;;;;;GAUG;AACH,MAAa,kBAAmB,SAAQ,aAA0C;IAMjF,YACiB,MAA6B,EAC7C,SAAsC,EACtC,eAAuB;QAEvB,KAAK,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAJlB,WAAM,GAAN,MAAM,CAAuB;QAK7C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,gBAAgB,KAAK,SAAS,CAAC;IACtD,CAAC;CACD;AAdD,gDAcC;AAED;;;;;;GAMG;AACH,MAAa,wBAAyB,SAAQ,aAAuC;IACpF,YACiB,MAAyC,EACzD,SAA4C,EAC5C,eAAuB;QAEvB,KAAK,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAJlB,WAAM,GAAN,MAAM,CAAmC;IAK1D,CAAC;CACD;AARD,4DAQC;AAkCD,MAAM,IAAI;IAGT,YAA6B,cAAuB;QAAvB,mBAAc,GAAd,cAAc,CAAS;QACnD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IACzB,CAAC;IAED,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED,IAAW,KAAK;QACf,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;SACpC;QACD,OAAO,IAAI,CAAC,MAAW,CAAC;IACzB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n\tClient,\n\tIMergeTreeDeltaCallbackArgs,\n\tIMergeTreeDeltaOpArgs,\n\tIMergeTreeMaintenanceCallbackArgs,\n\tISegment,\n\tMergeTreeDeltaOperationType,\n\tMergeTreeDeltaOperationTypes,\n\tMergeTreeMaintenanceType,\n\tPropertySet,\n\tSortedSegmentSet,\n} from \"@fluidframework/merge-tree\";\n\n/**\n * Base class for SequenceDeltaEvent and SequenceMaintenanceEvent.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into any future modifications performed to the underlying sequence and merge tree.\n */\nexport abstract class SequenceEvent<\n\tTOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes,\n> {\n\tpublic readonly deltaOperation: TOperation;\n\tprivate readonly sortedRanges: Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>;\n\tprivate readonly pFirst: Lazy<ISequenceDeltaRange<TOperation>>;\n\tprivate readonly pLast: Lazy<ISequenceDeltaRange<TOperation>>;\n\n\tconstructor(\n\t\tpublic readonly deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>,\n\t\tprivate readonly mergeTreeClient: Client,\n\t) {\n\t\tassert(\n\t\t\tdeltaArgs.deltaSegments.length > 0,\n\t\t\t0x2d8 /* \"Empty change event should not be emitted.\" */,\n\t\t);\n\t\tthis.deltaOperation = deltaArgs.operation;\n\n\t\tthis.sortedRanges = new Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>(() => {\n\t\t\tconst set = new SortedSegmentSet<ISequenceDeltaRange<TOperation>>();\n\t\t\tthis.deltaArgs.deltaSegments.forEach((delta) => {\n\t\t\t\tconst newRange: ISequenceDeltaRange<TOperation> = {\n\t\t\t\t\toperation: this.deltaArgs.operation,\n\t\t\t\t\tposition: this.mergeTreeClient.getPosition(delta.segment),\n\t\t\t\t\tpropertyDeltas: delta.propertyDeltas ?? {},\n\t\t\t\t\tsegment: delta.segment,\n\t\t\t\t};\n\t\t\t\tset.addOrUpdate(newRange);\n\t\t\t});\n\t\t\treturn set;\n\t\t});\n\n\t\tthis.pFirst = new Lazy<ISequenceDeltaRange<TOperation>>(\n\t\t\t() => this.sortedRanges.value.items[0],\n\t\t);\n\n\t\tthis.pLast = new Lazy<ISequenceDeltaRange<TOperation>>(\n\t\t\t() => this.sortedRanges.value.items[this.sortedRanges.value.size - 1],\n\t\t);\n\t}\n\n\t/**\n\t * The in-order ranges affected by this delta.\n\t * These may not be continuous.\n\t */\n\tpublic get ranges(): readonly Readonly<ISequenceDeltaRange<TOperation>>[] {\n\t\treturn this.sortedRanges.value.items;\n\t}\n\n\t/**\n\t * The client id of the client that made the change which caused the delta event\n\t */\n\tpublic get clientId(): string | undefined {\n\t\treturn this.mergeTreeClient.longClientId;\n\t}\n\n\t/**\n\t * The first of the modified ranges.\n\t */\n\tpublic get first(): Readonly<ISequenceDeltaRange<TOperation>> {\n\t\treturn this.pFirst.value;\n\t}\n\n\t/**\n\t * The last of the modified ranges.\n\t */\n\tpublic get last(): Readonly<ISequenceDeltaRange<TOperation>> {\n\t\treturn this.pLast.value;\n\t}\n}\n\n/**\n * The event object returned on sequenceDelta events.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.\n *\n * For group ops, each op will get its own event, and the group op property will be set on the op args.\n *\n * Ops may get multiple events. For instance, an insert-replace will get a remove then an insert event.\n */\nexport class SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationType> {\n\t/**\n\t * Whether the event was caused by a locally-made change.\n\t */\n\tpublic readonly isLocal: boolean;\n\n\tconstructor(\n\t\tpublic readonly opArgs: IMergeTreeDeltaOpArgs,\n\t\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\t\tmergeTreeClient: Client,\n\t) {\n\t\tsuper(deltaArgs, mergeTreeClient);\n\t\tthis.isLocal = opArgs.sequencedMessage === undefined;\n\t}\n}\n\n/**\n * The event object returned on maintenance events.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.\n */\nexport class SequenceMaintenanceEvent extends SequenceEvent<MergeTreeMaintenanceType> {\n\tconstructor(\n\t\tpublic readonly opArgs: IMergeTreeDeltaOpArgs | undefined,\n\t\tdeltaArgs: IMergeTreeMaintenanceCallbackArgs,\n\t\tmergeTreeClient: Client,\n\t) {\n\t\tsuper(deltaArgs, mergeTreeClient);\n\t}\n}\n\n/**\n * A range that has changed corresponding to a segment modification.\n */\nexport interface ISequenceDeltaRange<\n\tTOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes,\n> {\n\t/**\n\t * The type of operation that changed this range.\n\t * @remarks - Consuming code should typically compare this to the enum values defined in\n\t * `MergeTreeDeltaOperationTypes`.\n\t */\n\toperation: TOperation;\n\t/**\n\t * The index of the start of the range.\n\t */\n\tposition: number;\n\t/**\n\t * The segment that corresponds to the range.\n\t */\n\tsegment: ISegment;\n\t/**\n\t * Deltas object which contains all modified properties with their previous values.\n\t * Since `undefined` doesn't survive a round-trip through JSON serialization, the old value being absent\n\t * is instead encoded with `null`.\n\t * @remarks - This object is motivated by undo/redo scenarios, and provides a convenient \"inverse op\" to apply to\n\t * undo a property change.\n\t * @example - If a segment initially had properties `{ foo: \"1\", bar: 2 }` and it was annotated with\n\t * `{ foo: 3, baz: 5 }`, the corresponding event would have a `propertyDeltas` of `{ foo: \"1\", baz: null }`.\n\t */\n\tpropertyDeltas: PropertySet;\n}\n\nclass Lazy<T> {\n\tprivate pValue: T | undefined;\n\tprivate pEvaluated: boolean;\n\tconstructor(private readonly valueGenerator: () => T) {\n\t\tthis.pEvaluated = false;\n\t}\n\n\tpublic get evaluated(): boolean {\n\t\treturn this.pEvaluated;\n\t}\n\n\tpublic get value(): T {\n\t\tif (!this.pEvaluated) {\n\t\t\tthis.pEvaluated = true;\n\t\t\tthis.pValue = this.valueGenerator();\n\t\t}\n\t\treturn this.pValue as T;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceFactory.d.ts","sourceRoot":"","sources":["../src/sequenceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAM/C,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,qBAAa,mBAAoB,YAAW,eAAe;IAGvD,OAAc,IAAI,SAAiD;IAEnE,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;WAEY,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,mBAAmB;IAU7D,IAAW,IAAI,WAEd;IAED,IAAW,UAAU,uBAEpB;IAED;;OAEG;IACU,IAAI,CACb,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC;IAMnD,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,YAAY;CAK5E"}
1
+ {"version":3,"file":"sequenceFactory.d.ts","sourceRoot":"","sources":["../src/sequenceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,MAAM,uCAAuC,CAAC;AAG/C,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,qBAAa,mBAAoB,YAAW,eAAe;IAG1D,OAAc,IAAI,SAAiD;IAEnE,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;WAEY,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,mBAAmB;IAc7D,IAAW,IAAI,WAEd;IAED,IAAW,UAAU,uBAEpB;IAED;;OAEG;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QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACrE,YAAY,CAAC,eAAe,EAAE,CAAC;QAC/B,OAAO,YAAY,CAAC;IACxB,CAAC;;AA9CL,kDA+CC;AA9CG,+GAA+G;AAC/G,YAAY;AACE,wBAAI,GAAG,6CAA6C,CAAC;AAE5C,8BAAU,GAAuB;IACpD,IAAI,EAAE,mBAAmB,CAAC,IAAI;IAC9B,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,2BAAU;CAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n Marker,\n TextSegment,\n} from \"@fluidframework/merge-tree\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { SharedString, SharedStringSegment } from \"./sharedString\";\n\nexport class SharedStringFactory implements IChannelFactory {\n // TODO rename back to https://graph.microsoft.com/types/mergeTree/string once paparazzi is able to dynamically\n // load code\n public static Type = \"https://graph.microsoft.com/types/mergeTree\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: SharedStringFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public static segmentFromSpec(spec: any): SharedStringSegment {\n const maybeText = TextSegment.fromJSONObject(spec);\n if (maybeText) { return maybeText; }\n\n const maybeMarker = Marker.fromJSONObject(spec);\n if (maybeMarker) { return maybeMarker; }\n\n throw new Error(`Unrecognized IJSONObject`);\n }\n\n public get type() {\n return SharedStringFactory.Type;\n }\n\n public get attributes() {\n return SharedStringFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<SharedString> {\n const sharedString = new SharedString(runtime, id, attributes);\n await sharedString.load(services);\n return sharedString;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string): SharedString {\n const sharedString = new SharedString(document, id, this.attributes);\n sharedString.initializeLocal();\n return sharedString;\n }\n}\n"]}
1
+ {"version":3,"file":"sequenceFactory.js","sourceRoot":"","sources":["../src/sequenceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,2DAAiE;AACjE,qDAA8C;AAC9C,iDAAmE;AAEnE,MAAa,mBAAmB;IAWxB,MAAM,CAAC,eAAe,CAAC,IAAS;QACtC,MAAM,SAAS,GAAG,wBAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,SAAS,EAAE;YACd,OAAO,SAAS,CAAC;SACjB;QAED,MAAM,WAAW,GAAG,mBAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,WAAW,EAAE;YAChB,OAAO,WAAW,CAAC;SACnB;QAED,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC7C,CAAC;IAED,IAAW,IAAI;QACd,OAAO,mBAAmB,CAAC,IAAI,CAAC;IACjC,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,mBAAmB,CAAC,UAAU,CAAC;IACvC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,YAAY,GAAG,IAAI,2BAAY,CAAC,OAAO,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;QAC/D,MAAM,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClC,OAAO,YAAY,CAAC;IACrB,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,YAAY,GAAG,IAAI,2BAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACrE,YAAY,CAAC,eAAe,EAAE,CAAC;QAC/B,OAAO,YAAY,CAAC;IACrB,CAAC;;AAnDF,kDAoDC;AAnDA,+GAA+G;AAC/G,YAAY;AACE,wBAAI,GAAG,6CAA6C,CAAC;AAE5C,8BAAU,GAAuB;IACvD,IAAI,EAAE,mBAAmB,CAAC,IAAI;IAC9B,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,2BAAU;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { Marker, TextSegment } from \"@fluidframework/merge-tree\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { SharedString, SharedStringSegment } from \"./sharedString\";\n\nexport class SharedStringFactory implements IChannelFactory {\n\t// TODO rename back to https://graph.microsoft.com/types/mergeTree/string once paparazzi is able to dynamically\n\t// load code\n\tpublic static Type = \"https://graph.microsoft.com/types/mergeTree\";\n\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: SharedStringFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\tpublic static segmentFromSpec(spec: any): SharedStringSegment {\n\t\tconst maybeText = TextSegment.fromJSONObject(spec);\n\t\tif (maybeText) {\n\t\t\treturn maybeText;\n\t\t}\n\n\t\tconst maybeMarker = Marker.fromJSONObject(spec);\n\t\tif (maybeMarker) {\n\t\t\treturn maybeMarker;\n\t\t}\n\n\t\tthrow new Error(`Unrecognized IJSONObject`);\n\t}\n\n\tpublic get type() {\n\t\treturn SharedStringFactory.Type;\n\t}\n\n\tpublic get attributes() {\n\t\treturn SharedStringFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<SharedString> {\n\t\tconst sharedString = new SharedString(runtime, id, attributes);\n\t\tawait sharedString.load(services);\n\t\treturn sharedString;\n\t}\n\n\tpublic create(document: IFluidDataStoreRuntime, id: string): SharedString {\n\t\tconst sharedString = new SharedString(document, id, this.attributes);\n\t\tsharedString.initializeLocal();\n\t\treturn sharedString;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sharedIntervalCollection.d.ts","sourceRoot":"","sources":["../src/sharedIntervalCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAEH,gBAAgB,EAChB,YAAY,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,QAAQ,EACR,kBAAkB,EAElB,qBAAqB,EACxB,MAAM,sBAAsB,CAAC;AAO9B;;;GAGG;AACH,qBAAa,+BAAgC,YAAW,eAAe;IACnE,gBAAuB,IAAI,gEAAgE;IAE3F,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF,IAAW,IAAI,WAEd;IAED,IAAW,UAAU,uBAEpB;IAED;;OAEG;IACU,IAAI,CACb,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAO/D,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,wBAAwB;CASvF;AAED,MAAM,WAAW,yBAAyB,CAAC,SAAS,SAAS,qBAAqB;IAC9E,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAA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