@fluidframework/merge-tree 1.1.0 → 1.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.
@@ -7,14 +7,31 @@ import { IMergeTreeGroupMsg, IMergeTreeOp, MergeTreeDeltaType } from "./ops";
7
7
  import { PropertySet } from "./properties";
8
8
  import { ISegment } from "./mergeTree";
9
9
  export declare type MergeTreeDeltaOperationType = typeof MergeTreeDeltaType.ANNOTATE | typeof MergeTreeDeltaType.INSERT | typeof MergeTreeDeltaType.REMOVE;
10
+ /**
11
+ * Enum-like constant defining the types of "maintenance" events on a merge tree.
12
+ * Maintenance events correspond to structural segment changes or acks of pending segments.
13
+ *
14
+ * Note: these values are assigned negative integers to avoid clashing with `MergeTreeDeltaType`.
15
+ */
10
16
  export declare const MergeTreeMaintenanceType: {
17
+ /**
18
+ * Notification that a segment "append" has occurred, i.e. two adjacent segments have been merged.
19
+ * BEWARE: `deltaSegments` on the corresponding event will contain both the merged segment and the latter
20
+ * segment, pre-merge.
21
+ * For example, if the merge tree originally had two adjacent segments [A][B] and called A.append(B) to get
22
+ * segment [AB], `deltaSegments` would contain [AB] and [B].
23
+ */
11
24
  readonly APPEND: -1;
25
+ /**
26
+ * Notification that a segment has been split in two.
27
+ * `deltaSegments` on the corresponding event will contain the resulting two segments.
28
+ */
12
29
  readonly SPLIT: -2;
13
30
  /**
14
- * Notification that a segment has been unlinked from the MergeTree. This occurs during
15
- * Zamboni when:
16
- *
17
- * b) The segment's tracking collection is empty (e.g., not being tracked for undo/redo).
31
+ * Notification that a segment has been unlinked (i.e. removed) from the MergeTree.
32
+ * This occurs on leaf segments during Zamboni when the segment's tracking collection is empty
33
+ * (e.g., not being tracked for undo/redo).
34
+ * It also occurs on internal merge tree segments when re-packing children to maintain tree balancing invariants.
18
35
  */
19
36
  readonly UNLINK: -3;
20
37
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mergeTreeDeltaCallback.d.ts","sourceRoot":"","sources":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,WAAW,sBAAsB;IACnC,OAAO,EAAE,QAAQ,CAAC;IAClB,cAAc,CAAC,EAAE,WAAW,CAAC;CAChC;AAED,MAAM,WAAW,qBAAqB;IAClC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,yBAAyB,CAAC;CACzD;AAED,MAAM,WAAW,4BAA4B;IACzC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACnC;AAED,oBAAY,sBAAsB,GAC9B,CAAC,MAAM,EAAE,qBAAqB,EAAE,SAAS,EAAE,2BAA2B,KAAK,IAAI,CAAC;AAGpF,MAAM,WAAW,iCAAkC,SAAQ,2BAA2B,CAAC,wBAAwB,CAAC;CAAI;AAEpH,oBAAY,4BAA4B,GACpC,CAAC,eAAe,EAAE,iCAAiC,EAAE,MAAM,EAAE,qBAAqB,GAAG,SAAS,KAAK,IAAI,CAAC"}
@@ -2,15 +2,31 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- // Note: Assigned negative integers to avoid clashing with MergeTreeDeltaType
5
+ /**
6
+ * Enum-like constant defining the types of "maintenance" events on a merge tree.
7
+ * Maintenance events correspond to structural segment changes or acks of pending segments.
8
+ *
9
+ * Note: these values are assigned negative integers to avoid clashing with `MergeTreeDeltaType`.
10
+ */
6
11
  export const MergeTreeMaintenanceType = {
12
+ /**
13
+ * Notification that a segment "append" has occurred, i.e. two adjacent segments have been merged.
14
+ * BEWARE: `deltaSegments` on the corresponding event will contain both the merged segment and the latter
15
+ * segment, pre-merge.
16
+ * For example, if the merge tree originally had two adjacent segments [A][B] and called A.append(B) to get
17
+ * segment [AB], `deltaSegments` would contain [AB] and [B].
18
+ */
7
19
  APPEND: -1,
20
+ /**
21
+ * Notification that a segment has been split in two.
22
+ * `deltaSegments` on the corresponding event will contain the resulting two segments.
23
+ */
8
24
  SPLIT: -2,
9
25
  /**
10
- * Notification that a segment has been unlinked from the MergeTree. This occurs during
11
- * Zamboni when:
12
- *
13
- * b) The segment's tracking collection is empty (e.g., not being tracked for undo/redo).
26
+ * Notification that a segment has been unlinked (i.e. removed) from the MergeTree.
27
+ * This occurs on leaf segments during Zamboni when the segment's tracking collection is empty
28
+ * (e.g., not being tracked for undo/redo).
29
+ * It also occurs on internal merge tree segments when re-packing children to maintain tree balancing invariants.
14
30
  */
15
31
  UNLINK: -3,
16
32
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mergeTreeDeltaCallback.js","sourceRoot":"","sources":["../src/mergeTreeDeltaCallback.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACpC,MAAM,EAAE,CAAC,CAAC;IACV,KAAK,EAAE,CAAC,CAAC;IACT;;;;;OAKG;IACH,MAAM,EAAE,CAAC,CAAC;IACV;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC;CACV,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IMergeTreeGroupMsg,\n IMergeTreeOp,\n MergeTreeDeltaType,\n} from \"./ops\";\nimport { PropertySet } from \"./properties\";\nimport { ISegment } from \"./mergeTree\";\n\nexport type MergeTreeDeltaOperationType =\n typeof MergeTreeDeltaType.ANNOTATE | typeof MergeTreeDeltaType.INSERT | typeof MergeTreeDeltaType.REMOVE;\n\n// Note: Assigned negative integers to avoid clashing with MergeTreeDeltaType\nexport const MergeTreeMaintenanceType = {\n APPEND: -1,\n SPLIT: -2,\n /**\n * Notification that a segment has been unlinked from the MergeTree. This occurs during\n * Zamboni when:\n *\n * b) The segment's tracking collection is empty (e.g., not being tracked for undo/redo).\n */\n UNLINK: -3,\n /**\n * Notification that a local change has been acknowledged by the server.\n * This means that it has made the round trip to the server and has had a sequence number assigned.\n */\n ACKNOWLEDGED: -4,\n} as const;\nexport type MergeTreeMaintenanceType = typeof MergeTreeMaintenanceType[keyof typeof MergeTreeMaintenanceType];\n\nexport type MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType | MergeTreeMaintenanceType;\n\n// eslint-disable-next-line max-len\nexport interface IMergeTreeDeltaCallbackArgs<TOperationType extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType> {\n readonly operation: TOperationType;\n readonly deltaSegments: IMergeTreeSegmentDelta[];\n}\n\nexport interface IMergeTreeSegmentDelta {\n segment: ISegment;\n propertyDeltas?: PropertySet;\n}\n\nexport interface IMergeTreeDeltaOpArgs {\n /**\n * The group op which contains the operation\n * if there operation is part of a group op.\n */\n readonly groupOp?: IMergeTreeGroupMsg;\n /**\n * The merge tree operation\n */\n readonly op: IMergeTreeOp;\n /**\n * Get the sequence message, should only be null if the\n * Delta op args are for an unacked local change\n */\n readonly sequencedMessage?: ISequencedDocumentMessage;\n}\n\nexport interface IMergeTreeClientSequenceArgs {\n readonly clientId: number;\n readonly referenceSequenceNumber: number;\n readonly sequenceNumber: number;\n}\n\nexport type MergeTreeDeltaCallback =\n (opArgs: IMergeTreeDeltaOpArgs, deltaArgs: IMergeTreeDeltaCallbackArgs) => void;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IMergeTreeMaintenanceCallbackArgs extends IMergeTreeDeltaCallbackArgs<MergeTreeMaintenanceType> { }\n\nexport type MergeTreeMaintenanceCallback =\n (MaintenanceArgs: IMergeTreeMaintenanceCallbackArgs, opArgs: IMergeTreeDeltaOpArgs | undefined) => void;\n"]}
1
+ {"version":3,"file":"mergeTreeDeltaCallback.js","sourceRoot":"","sources":["../src/mergeTreeDeltaCallback.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACpC;;;;;;OAMG;IACH,MAAM,EAAE,CAAC,CAAC;IACV;;;OAGG;IACH,KAAK,EAAE,CAAC,CAAC;IACT;;;;;OAKG;IACH,MAAM,EAAE,CAAC,CAAC;IACV;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC;CACV,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IMergeTreeGroupMsg,\n IMergeTreeOp,\n MergeTreeDeltaType,\n} from \"./ops\";\nimport { PropertySet } from \"./properties\";\nimport { ISegment } from \"./mergeTree\";\n\nexport type MergeTreeDeltaOperationType =\n typeof MergeTreeDeltaType.ANNOTATE | typeof MergeTreeDeltaType.INSERT | typeof MergeTreeDeltaType.REMOVE;\n\n/**\n * Enum-like constant defining the types of \"maintenance\" events on a merge tree.\n * Maintenance events correspond to structural segment changes or acks of pending segments.\n *\n * Note: these values are assigned negative integers to avoid clashing with `MergeTreeDeltaType`.\n */\nexport const MergeTreeMaintenanceType = {\n /**\n * Notification that a segment \"append\" has occurred, i.e. two adjacent segments have been merged.\n * BEWARE: `deltaSegments` on the corresponding event will contain both the merged segment and the latter\n * segment, pre-merge.\n * For example, if the merge tree originally had two adjacent segments [A][B] and called A.append(B) to get\n * segment [AB], `deltaSegments` would contain [AB] and [B].\n */\n APPEND: -1,\n /**\n * Notification that a segment has been split in two.\n * `deltaSegments` on the corresponding event will contain the resulting two segments.\n */\n SPLIT: -2,\n /**\n * Notification that a segment has been unlinked (i.e. removed) from the MergeTree.\n * This occurs on leaf segments during Zamboni when the segment's tracking collection is empty\n * (e.g., not being tracked for undo/redo).\n * It also occurs on internal merge tree segments when re-packing children to maintain tree balancing invariants.\n */\n UNLINK: -3,\n /**\n * Notification that a local change has been acknowledged by the server.\n * This means that it has made the round trip to the server and has had a sequence number assigned.\n */\n ACKNOWLEDGED: -4,\n} as const;\nexport type MergeTreeMaintenanceType = typeof MergeTreeMaintenanceType[keyof typeof MergeTreeMaintenanceType];\n\nexport type MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType | MergeTreeMaintenanceType;\n\n// eslint-disable-next-line max-len\nexport interface IMergeTreeDeltaCallbackArgs<TOperationType extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType> {\n readonly operation: TOperationType;\n readonly deltaSegments: IMergeTreeSegmentDelta[];\n}\n\nexport interface IMergeTreeSegmentDelta {\n segment: ISegment;\n propertyDeltas?: PropertySet;\n}\n\nexport interface IMergeTreeDeltaOpArgs {\n /**\n * The group op which contains the operation\n * if there operation is part of a group op.\n */\n readonly groupOp?: IMergeTreeGroupMsg;\n /**\n * The merge tree operation\n */\n readonly op: IMergeTreeOp;\n /**\n * Get the sequence message, should only be null if the\n * Delta op args are for an unacked local change\n */\n readonly sequencedMessage?: ISequencedDocumentMessage;\n}\n\nexport interface IMergeTreeClientSequenceArgs {\n readonly clientId: number;\n readonly referenceSequenceNumber: number;\n readonly sequenceNumber: number;\n}\n\nexport type MergeTreeDeltaCallback =\n (opArgs: IMergeTreeDeltaOpArgs, deltaArgs: IMergeTreeDeltaCallbackArgs) => void;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IMergeTreeMaintenanceCallbackArgs extends IMergeTreeDeltaCallbackArgs<MergeTreeMaintenanceType> { }\n\nexport type MergeTreeMaintenanceCallback =\n (MaintenanceArgs: IMergeTreeMaintenanceCallbackArgs, opArgs: IMergeTreeDeltaOpArgs | undefined) => void;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/merge-tree",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Merge tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -61,23 +61,23 @@
61
61
  "dependencies": {
62
62
  "@fluidframework/common-definitions": "^0.20.1",
63
63
  "@fluidframework/common-utils": "^0.32.1",
64
- "@fluidframework/container-definitions": "^1.1.0",
65
- "@fluidframework/container-utils": "^1.1.0",
66
- "@fluidframework/core-interfaces": "^1.1.0",
67
- "@fluidframework/datastore-definitions": "^1.1.0",
64
+ "@fluidframework/container-definitions": "^1.2.0",
65
+ "@fluidframework/container-utils": "^1.2.0",
66
+ "@fluidframework/core-interfaces": "^1.2.0",
67
+ "@fluidframework/datastore-definitions": "^1.2.0",
68
68
  "@fluidframework/protocol-definitions": "^0.1028.2000",
69
- "@fluidframework/runtime-definitions": "^1.1.0",
70
- "@fluidframework/runtime-utils": "^1.1.0",
71
- "@fluidframework/shared-object-base": "^1.1.0",
72
- "@fluidframework/telemetry-utils": "^1.1.0"
69
+ "@fluidframework/runtime-definitions": "^1.2.0",
70
+ "@fluidframework/runtime-utils": "^1.2.0",
71
+ "@fluidframework/shared-object-base": "^1.2.0",
72
+ "@fluidframework/telemetry-utils": "^1.2.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@fluidframework/build-common": "^0.24.0",
76
76
  "@fluidframework/build-tools": "^0.2.74327",
77
77
  "@fluidframework/eslint-config-fluid": "^0.28.2000",
78
- "@fluidframework/merge-tree-previous": "npm:@fluidframework/merge-tree@^1.0.0",
79
- "@fluidframework/mocha-test-setup": "^1.1.0",
80
- "@fluidframework/test-runtime-utils": "^1.1.0",
78
+ "@fluidframework/merge-tree-previous": "npm:@fluidframework/merge-tree@1.1.0",
79
+ "@fluidframework/mocha-test-setup": "^1.2.0",
80
+ "@fluidframework/test-runtime-utils": "^1.2.0",
81
81
  "@microsoft/api-extractor": "^7.22.2",
82
82
  "@rushstack/eslint-config": "^2.5.1",
83
83
  "@types/diff": "^3.5.1",
@@ -98,11 +98,7 @@
98
98
  "typescript-formatter": "7.1.0"
99
99
  },
100
100
  "typeValidation": {
101
- "version": "1.1.0",
102
- "broken": {
103
- "ClassDeclaration_Client": {
104
- "forwardCompat": false
105
- }
106
- }
101
+ "version": "1.2.0",
102
+ "broken": {}
107
103
  }
108
104
  }
package/src/client.ts CHANGED
@@ -803,9 +803,15 @@ export class Client {
803
803
  case MergeTreeDeltaType.INSERT:
804
804
  assert(segment.seq === UnassignedSequenceNumber,
805
805
  0x037 /* "Segment already has assigned sequence number" */);
806
+ let segInsertOp = segment;
807
+ if (typeof resetOp.seg === "object" && resetOp.seg.props !== undefined) {
808
+ segInsertOp = segment.clone();
809
+ segInsertOp.properties = resetOp.seg.props;
810
+ }
806
811
  newOp = createInsertSegmentOp(
807
812
  segmentPosition,
808
- segment);
813
+ segInsertOp,
814
+ );
809
815
  break;
810
816
 
811
817
  case MergeTreeDeltaType.REMOVE:
package/src/mergeTree.ts CHANGED
@@ -2549,8 +2549,9 @@ export class MergeTree {
2549
2549
  client: Client,
2550
2550
  ): LocalReferencePosition {
2551
2551
  if (isRemoved(segment)) {
2552
- if (!refTypeIncludesFlag(refType, ReferenceType.SlideOnRemove)) {
2553
- throw new UsageError("Can only create SlideOnRemove local reference position on a removed segment");
2552
+ if (!refTypeIncludesFlag(refType, ReferenceType.SlideOnRemove | ReferenceType.Transient)) {
2553
+ throw new UsageError(
2554
+ "Can only create SlideOnRemove or Transient local reference position on a removed segment");
2554
2555
  }
2555
2556
  }
2556
2557
  const localRefs = segment.localRefs ?? new LocalReferenceCollection(segment);
@@ -15,15 +15,31 @@ import { ISegment } from "./mergeTree";
15
15
  export type MergeTreeDeltaOperationType =
16
16
  typeof MergeTreeDeltaType.ANNOTATE | typeof MergeTreeDeltaType.INSERT | typeof MergeTreeDeltaType.REMOVE;
17
17
 
18
- // Note: Assigned negative integers to avoid clashing with MergeTreeDeltaType
18
+ /**
19
+ * Enum-like constant defining the types of "maintenance" events on a merge tree.
20
+ * Maintenance events correspond to structural segment changes or acks of pending segments.
21
+ *
22
+ * Note: these values are assigned negative integers to avoid clashing with `MergeTreeDeltaType`.
23
+ */
19
24
  export const MergeTreeMaintenanceType = {
25
+ /**
26
+ * Notification that a segment "append" has occurred, i.e. two adjacent segments have been merged.
27
+ * BEWARE: `deltaSegments` on the corresponding event will contain both the merged segment and the latter
28
+ * segment, pre-merge.
29
+ * For example, if the merge tree originally had two adjacent segments [A][B] and called A.append(B) to get
30
+ * segment [AB], `deltaSegments` would contain [AB] and [B].
31
+ */
20
32
  APPEND: -1,
33
+ /**
34
+ * Notification that a segment has been split in two.
35
+ * `deltaSegments` on the corresponding event will contain the resulting two segments.
36
+ */
21
37
  SPLIT: -2,
22
38
  /**
23
- * Notification that a segment has been unlinked from the MergeTree. This occurs during
24
- * Zamboni when:
25
- *
26
- * b) The segment's tracking collection is empty (e.g., not being tracked for undo/redo).
39
+ * Notification that a segment has been unlinked (i.e. removed) from the MergeTree.
40
+ * This occurs on leaf segments during Zamboni when the segment's tracking collection is empty
41
+ * (e.g., not being tracked for undo/redo).
42
+ * It also occurs on internal merge tree segments when re-packing children to maintain tree balancing invariants.
27
43
  */
28
44
  UNLINK: -3,
29
45
  /**