@fluid-experimental/tree 2.81.1 → 2.82.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 (43) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-report/experimental-tree.alpha.api.md +0 -3
  3. package/biome.jsonc +1 -1
  4. package/dist/ChangeTypes.d.ts +23 -5
  5. package/dist/ChangeTypes.d.ts.map +1 -1
  6. package/dist/ChangeTypes.js +23 -5
  7. package/dist/ChangeTypes.js.map +1 -1
  8. package/dist/Checkout.d.ts +7 -3
  9. package/dist/Checkout.d.ts.map +1 -1
  10. package/dist/Checkout.js +7 -3
  11. package/dist/Checkout.js.map +1 -1
  12. package/dist/Common.d.ts.map +1 -1
  13. package/dist/Common.js +2 -0
  14. package/dist/Common.js.map +1 -1
  15. package/dist/LogViewer.d.ts.map +1 -1
  16. package/dist/LogViewer.js +3 -1
  17. package/dist/LogViewer.js.map +1 -1
  18. package/dist/id-compressor/AppendOnlySortedMap.d.ts +21 -21
  19. package/dist/id-compressor/AppendOnlySortedMap.js +21 -21
  20. package/dist/id-compressor/AppendOnlySortedMap.js.map +1 -1
  21. package/lib/ChangeTypes.d.ts +23 -5
  22. package/lib/ChangeTypes.d.ts.map +1 -1
  23. package/lib/ChangeTypes.js +23 -5
  24. package/lib/ChangeTypes.js.map +1 -1
  25. package/lib/Checkout.d.ts +7 -3
  26. package/lib/Checkout.d.ts.map +1 -1
  27. package/lib/Checkout.js +7 -3
  28. package/lib/Checkout.js.map +1 -1
  29. package/lib/Common.d.ts.map +1 -1
  30. package/lib/Common.js +2 -0
  31. package/lib/Common.js.map +1 -1
  32. package/lib/LogViewer.d.ts.map +1 -1
  33. package/lib/LogViewer.js +3 -1
  34. package/lib/LogViewer.js.map +1 -1
  35. package/lib/id-compressor/AppendOnlySortedMap.d.ts +21 -21
  36. package/lib/id-compressor/AppendOnlySortedMap.js +21 -21
  37. package/lib/id-compressor/AppendOnlySortedMap.js.map +1 -1
  38. package/package.json +24 -24
  39. package/src/ChangeTypes.ts +23 -5
  40. package/src/Checkout.ts +7 -3
  41. package/src/Common.ts +4 -3
  42. package/src/LogViewer.ts +1 -0
  43. package/src/id-compressor/AppendOnlySortedMap.ts +21 -21
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluid-experimental/tree
2
2
 
3
+ ## 2.82.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.81.0
4
8
 
5
9
  Dependency updates only.
@@ -134,16 +134,13 @@ export abstract class Checkout extends EventEmitterWithErrorHandling<ICheckoutEv
134
134
  // (undocumented)
135
135
  applyEdit(...changes: readonly Change[]): EditId;
136
136
  closeEdit(): EditId;
137
- // (undocumented)
138
137
  get currentView(): TreeView;
139
138
  dispose(error?: Error): void;
140
139
  // (undocumented)
141
140
  disposed: boolean;
142
141
  protected emitChange(): void;
143
- // (undocumented)
144
142
  getEditStatus(): EditStatus;
145
143
  protected handleNewEdit(id: EditId, result: ValidEditingResult): void;
146
- // (undocumented)
147
144
  hasOpenEdit(): boolean;
148
145
  protected hintKnownEditingResult(edit: Edit<ChangeInternal>, result: ValidEditingResult): void;
149
146
  protected abstract get latestCommittedView(): RevisionView;
package/biome.jsonc CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3
- "extends": ["../../../biome.jsonc"],
3
+ "extends": "//",
4
4
  "formatter": {
5
5
  "lineWidth": 120
6
6
  },
@@ -176,15 +176,21 @@ export declare const Change: {
176
176
  constraint: (toConstrain: StableRange, effect: ConstraintEffect, identityHash?: UuidString, length?: number, contentHash?: UuidString, parentNode?: NodeId, label?: TraitLabel) => Constraint;
177
177
  /** Helpers for making high-level composite operations */
178
178
  /**
179
- * @returns a change that deletes the supplied part of the tree.
179
+ * Deletes a range of nodes from the tree.
180
+ *
181
+ * @returns A change that deletes the supplied part of the tree.
180
182
  */
181
183
  delete: (stableRange: StableRange) => Change;
182
184
  /**
183
- * @returns changes that insert 'nodes' into the specified location in the tree.
185
+ * Inserts nodes into the tree at the specified location.
186
+ *
187
+ * @returns The changes that insert 'nodes' into the specified location in the tree.
184
188
  */
185
189
  insertTree: (nodes: BuildNode | TreeNodeSequence<BuildNode>, destination: StablePlace) => Change[];
186
190
  /**
187
- * @returns changes that moves the specified content to a new location in the tree.
191
+ * Moves nodes from one location to another in the tree.
192
+ *
193
+ * @returns The changes that moves the specified content to a new location in the tree.
188
194
  */
189
195
  move: (source: StableRange, destination: StablePlace) => Change[];
190
196
  };
@@ -263,18 +269,26 @@ export interface StableRange {
263
269
  */
264
270
  export declare const StablePlace: {
265
271
  /**
272
+ * Creates a stable place representing the location directly before a node.
273
+ *
266
274
  * @returns The location directly before `node`.
267
275
  */
268
276
  before: (node: NodeData<NodeId> | NodeId) => StablePlace;
269
277
  /**
278
+ * Creates a stable place representing the location directly after a node.
279
+ *
270
280
  * @returns The location directly after `node`.
271
281
  */
272
282
  after: (node: NodeData<NodeId> | NodeId) => StablePlace;
273
283
  /**
284
+ * Creates a stable place representing the location at the start of a trait.
285
+ *
274
286
  * @returns The location at the start of `trait`.
275
287
  */
276
288
  atStartOf: (trait: TraitLocation) => StablePlace;
277
289
  /**
290
+ * Creates a stable place representing the location at the end of a trait.
291
+ *
278
292
  * @returns The location at the end of `trait`.
279
293
  */
280
294
  atEndOf: (trait: TraitLocation) => StablePlace;
@@ -296,12 +310,16 @@ export declare const StableRange: {
296
310
  to: (end: StablePlace) => StableRange;
297
311
  };
298
312
  /**
299
- * @returns a `StableRange` which contains only the provided `node`.
313
+ * Creates a `StableRange` which contains only the provided `node`.
314
+ *
315
+ * @remarks
300
316
  * Both the start and end `StablePlace` objects used to anchor this `StableRange` are in terms of the passed in node.
301
317
  */
302
318
  only: (node: NodeData<NodeId> | NodeId) => StableRange;
303
319
  /**
304
- * @returns a `StableRange` which contains everything in the trait.
320
+ * Creates a `StableRange` which contains everything in the trait.
321
+ *
322
+ * @remarks
305
323
  * This is anchored using the provided `trait`, and is independent of the actual contents of the trait:
306
324
  * it does not use sibling anchoring.
307
325
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ChangeTypes.d.ts","sourceRoot":"","sources":["../src/ChangeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEzG;;;GAGG;AACH,MAAM,WAAW,iBAAiB,CAAC,MAAM;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACjB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;KACtE,CAAC;CACF;AAED;;;GAGG;AACH,oBAAY,UAAU;IACrB,MAAM,IAAA;IACN,MAAM,IAAA;IACN,KAAK,IAAA;IACL,QAAQ,IAAA;IACR,UAAU,IAAA;CACV;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,CAAC;AAErE;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,MAAM,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAc,SAAQ,iBAAiB,CAAC,SAAS,CAAC;IAClE,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,g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AAED;;;;;;GAMG;AAGH;;GAEG;AACH,eAAO,MAAM,WAAW;IACvB;;;;OAIG;mBACY,SAAS,MAAM,CAAC,GAAG,MAAM,KAAG,WAAW;IAItD;;;;OAIG;kBACW,SAAS,MAAM,CAAC,GAAG,MAAM,KAAG,WAAW;IAIrD;;;;OAIG;uBACgB,aAAa,KAAG,WAAW;IAI9C;;;;OAIG;qBACc,aAAa,KAAG,WAAW;CAI5C,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,WAAW;IACvB;;;;;;;;OAQG;kBACW,WAAW,KAAG;QAAE,EAAE,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,WAAW,CAAA;KAAE;IAerE;;;;;OAKG;iBACU,SAAS,MAAM,CAAC,GAAG,MAAM,KAAG,WAAW;IAIpD;;;;;;OAMG;iBACU,aAAa,KAAG,WAAW;CAIxC,CAAC"}
@@ -64,18 +64,24 @@ exports.Change = {
64
64
  }),
65
65
  /** Helpers for making high-level composite operations */
66
66
  /**
67
- * @returns a change that deletes the supplied part of the tree.
67
+ * Deletes a range of nodes from the tree.
68
+ *
69
+ * @returns A change that deletes the supplied part of the tree.
68
70
  */
69
71
  delete: (stableRange) => exports.Change.detach(stableRange),
70
72
  /**
71
- * @returns changes that insert 'nodes' into the specified location in the tree.
73
+ * Inserts nodes into the tree at the specified location.
74
+ *
75
+ * @returns The changes that insert 'nodes' into the specified location in the tree.
72
76
  */
73
77
  insertTree: (nodes, destination) => {
74
78
  const build = exports.Change.build(nodes, 0);
75
79
  return [build, exports.Change.insert(build.destination, destination)];
76
80
  },
77
81
  /**
78
- * @returns changes that moves the specified content to a new location in the tree.
82
+ * Moves nodes from one location to another in the tree.
83
+ *
84
+ * @returns The changes that moves the specified content to a new location in the tree.
79
85
  */
80
86
  move: (source, destination) => {
81
87
  const detach = exports.Change.detach(source, 0);
@@ -95,6 +101,8 @@ exports.Change = {
95
101
  */
96
102
  exports.StablePlace = {
97
103
  /**
104
+ * Creates a stable place representing the location directly before a node.
105
+ *
98
106
  * @returns The location directly before `node`.
99
107
  */
100
108
  before: (node) => ({
@@ -102,6 +110,8 @@ exports.StablePlace = {
102
110
  referenceSibling: (0, NodeIdUtilities_js_1.getNodeId)(node),
103
111
  }),
104
112
  /**
113
+ * Creates a stable place representing the location directly after a node.
114
+ *
105
115
  * @returns The location directly after `node`.
106
116
  */
107
117
  after: (node) => ({
@@ -109,6 +119,8 @@ exports.StablePlace = {
109
119
  referenceSibling: (0, NodeIdUtilities_js_1.getNodeId)(node),
110
120
  }),
111
121
  /**
122
+ * Creates a stable place representing the location at the start of a trait.
123
+ *
112
124
  * @returns The location at the start of `trait`.
113
125
  */
114
126
  atStartOf: (trait) => ({
@@ -116,6 +128,8 @@ exports.StablePlace = {
116
128
  referenceTrait: trait,
117
129
  }),
118
130
  /**
131
+ * Creates a stable place representing the location at the end of a trait.
132
+ *
119
133
  * @returns The location at the end of `trait`.
120
134
  */
121
135
  atEndOf: (trait) => ({
@@ -147,7 +161,9 @@ exports.StableRange = {
147
161
  },
148
162
  }),
149
163
  /**
150
- * @returns a `StableRange` which contains only the provided `node`.
164
+ * Creates a `StableRange` which contains only the provided `node`.
165
+ *
166
+ * @remarks
151
167
  * Both the start and end `StablePlace` objects used to anchor this `StableRange` are in terms of the passed in node.
152
168
  */
153
169
  only: (node) => ({
@@ -155,7 +171,9 @@ exports.StableRange = {
155
171
  end: exports.StablePlace.after(node),
156
172
  }),
157
173
  /**
158
- * @returns a `StableRange` which contains everything in the trait.
174
+ * Creates a `StableRange` which contains everything in the trait.
175
+ *
176
+ * @remarks
159
177
  * This is anchored using the provided `trait`, and is independent of the actual contents of the trait:
160
178
  * it does not use sibling anchoring.
161
179
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ChangeTypes.js","sourceRoot":"","sources":["../src/ChangeTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,2CAAiD;AAEjD,6DAAiD;AAEjD,yDAAyG;AAYzG;;;GAGG;AAC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AAC;QAChD,IAAI,EAAE,eAAI,CAAC,MAAM;QACjB,cAAc,EAAE,KAAK;KACrB,CAAC;CACF,CAAC;AAEF,oGAAoG;AACpG;;GAEG;AACU,QAAA,WAAW,GAAG;IAC1B;;;;;;;;OAQG;IACH,IAAI,EAAE,CAAC,KAAkB,EAA6C,EAAE,CAAC,CAAC;QACzE,EAAE,EAAE,CAAC,GAAgB,EAAe,EAAE;YACrC,IAAI,KAAK,CAAC,cAAc,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC;gBAChD,IAAA,iBAAM,EACL,KAAK,CAAC,cAAc,CAAC,MAAM,KAAK,GAAG,CAAC,cAAc,CAAC,MAAM,EACzD,KAAK,CAAC,wEAAwE,CAC9E,CAAC;gBACF,IAAA,iBAAM,EACL,KAAK,CAAC,cAAc,CAAC,KAAK,KAAK,GAAG,CAAC,cAAc,CAAC,KAAK,EACvD,KAAK,CAAC,wEAAwE,CAC9E,CAAC;YACH,CAAC;YACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QACvB,CAAC;KACD,CAAC;IACF;;;OAGG;IACH,IAAI,EAAE,CAAC,IAA+B,EAAe,EAAE,CAAC,CAAC;QACxD,KAAK,EAAE,mBAAW,CAAC,MAAM,CAAC,IAAI,CAAC;QAC/B,GAAG,EAAE,mBAAW,CAAC,KAAK,CAAC,IAAI,CAAC;KAC5B,CAAC;IACF;;;;OAIG;IACH,GAAG,EAAE,CAAC,KAAoB,EAAe,EAAE,CAAC,CAAC;QAC5C,KAAK,EAAE,mBAAW,CAAC,SAAS,CAAC,KAAK,CAAC;QACnC,GAAG,EAAE,mBAAW,CAAC,OAAO,CAAC,KAAK,CAAC;KAC/B,CAAC;CACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/core-utils/internal';\n\nimport { assertNotUndefined } from './Common.js';\nimport { NodeId, TraitLabel, UuidString } from './Identifiers.js';\nimport { getNodeId } from './NodeIdUtilities.js';\nimport { TraitLocation } from './TreeView.js';\nimport { ConstraintEffect, NodeData, Payload, Side, TreeNodeSequence } from './persisted-types/index.js';\n\n/**\n * An object which may have traits with children of the given type underneath it\n * @alpha\n */\nexport interface HasVariadicTraits<TChild> {\n\treadonly traits?: {\n\t\treadonly [key: string]: TChild | TreeNodeSequence<TChild> | undefined;\n\t};\n}\n\n/**\n * The type of a Change\n * @alpha\n */\nexport enum ChangeType {\n\tInsert,\n\tDetach,\n\tBuild,\n\tSetValue,\n\tConstraint,\n}\n\n/**\n * A change that composes an Edit.\n *\n * @remarks\n *\n * `Change` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n *\n * @example\n *\n * ```typescript\n * Change.insert(sourceId, destination)\n * ```\n * @alpha\n */\nexport type Change = Insert | Detach | Build | SetValue | Constraint;\n\n/**\n * Node or a detached sequence of nodes (referred to by a detached sequence ID) for use in a Build change.\n * See `BuildTreeNode` for more.\n * @alpha\n */\nexport type BuildNode = BuildTreeNode | number;\n\n/**\n * Node for use in a Build change, which is composed of a definition describing what this nodes type, an identifier identifying this node\n * within the tree, and a payload containing an opaque serializable piece of data.\n * An identifier can be provided explicitly if the node must be referred to before the results of the `Change` containing this\n * BuildTreeNode can be observed. If `identifier` is not supplied, one will be generated for it in an especially efficient manner\n * that allows for compact storage and transmission and thus this property should be omitted if convenient.\n * See the SharedTree readme for more on the tree format.\n * @alpha\n */\nexport interface BuildTreeNode extends HasVariadicTraits<BuildNode> {\n\tdefinition: string;\n\tidentifier?: NodeId;\n\tpayload?: Payload;\n}\n\n/**\n * Constructs a sequence of nodes, associates it with the supplied ID, and stores it for use in later changes.\n * Does not modify the document.\n *\n * Valid if (transitively) all DetachedSequenceId are used according to their rules (use here counts as a destination),\n * and all Nodes' identifiers are previously unused.\n * @alpha\n */\nexport interface Build {\n\treadonly destination: number;\n\treadonly source: BuildNode | TreeNodeSequence<BuildNode>;\n\treadonly type: typeof ChangeType.Build;\n}\n\n/**\n * Inserts a sequence of nodes at the specified destination.\n * The source can be constructed either by a Build (used to insert new nodes) or a Detach (amounts to a \"move\" operation).\n * @alpha\n */\nexport interface Insert {\n\treadonly destination: StablePlace;\n\treadonly source: number;\n\treadonly type: typeof ChangeType.Insert;\n}\n\n/**\n * Removes a sequence of nodes from the tree.\n * If a destination is specified, the detached sequence is associated with that ID and held for possible reuse\n * by later changes in this same Edit (such as by an Insert).\n * A Detach without a destination is a deletion of the specified sequence, as is a Detach with a destination that is not used later.\n * @alpha\n */\nexport interface Detach {\n\treadonly destination?: number;\n\treadonly source: StableRange;\n\treadonly type: typeof ChangeType.Detach;\n}\n\n/**\n * Modifies the payload of a node.\n * @alpha\n */\nexport interface SetValue {\n\treadonly nodeToModify: NodeId;\n\t/**\n\t * Sets or clears the payload.\n\t * To improve ease of forwards compatibility, an explicit `null` value is used to represent the clearing of a payload.\n\t * SetValue may use `undefined` in future API versions to mean \"don't change the payload\" (which is useful if e.g. other\n\t * fields are added to SetValue that can be changed without altering the payload)\n\t */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\treadonly payload: Payload | null;\n\treadonly type: typeof ChangeType.SetValue;\n}\n\n/**\n * A set of constraints on the validity of an Edit.\n * A Constraint is used to detect when an Edit, due to other concurrent edits, may have unintended effects or merge in\n * non-semantic ways. It is processed in order like any other Change in an Edit. It can cause an edit to fail if the\n * various constraints are not met at the time of evaluation (ex: the parentNode has changed due to concurrent editing).\n * Does not modify the document.\n * @alpha\n */\nexport interface Constraint {\n\t/**\n\t * Selects a sequence of nodes which will be checked against the constraints specified by the optional fields.\n\t * If `toConstrain` is invalid, it will be treated like a constraint being unmet.\n\t * Depending on `effect` this may or may not make the Edit invalid.\n\t *\n\t * When a constraint is not met, the effects is specified by `effect`.\n\t */\n\treadonly toConstrain: StableRange;\n\n\t/**\n\t * Require that the identities of all the nodes in toConstrain hash to this value.\n\t * Hash is order dependent.\n\t * TODO: implement and specify exact hash function.\n\t *\n\t * This is an efficient (O(1) space) way to constrain a sequence of nodes to have specific identities.\n\t */\n\treadonly identityHash?: UuidString;\n\n\t/**\n\t * Require that the number of nodes in toConstrain is this value.\n\t */\n\treadonly length?: number;\n\n\t/**\n\t * Require that the contents of all of the nodes in toConstrain hash to this value.\n\t * Hash is an order dependant deep hash, which includes all subtree content recursively.\n\t * TODO: implement and specify exact hash function.\n\t *\n\t * This is an efficient (O(1) space) way to constrain a sequence of nodes have exact values (transitively).\n\t */\n\treadonly contentHash?: UuidString;\n\n\t/**\n\t * Require that parent under which toConstrain is located has this identifier.\n\t */\n\treadonly parentNode?: NodeId;\n\n\t/**\n\t * Require that the trait under which toConstrain is located has this label.\n\t */\n\treadonly label?: TraitLabel;\n\n\t/**\n\t * What to do if a constraint is not met.\n\t */\n\treadonly effect: ConstraintEffect;\n\n\t/**\n\t * Marker for which kind of Change this is.\n\t */\n\treadonly type: typeof ChangeType.Constraint;\n}\n\n// Note: Documentation of this constant is merged with documentation of the `Change` interface.\n/**\n * @alpha\n */\nexport const Change = {\n\tbuild: (source: BuildNode | TreeNodeSequence<BuildNode>, destination: number): Build => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Build,\n\t}),\n\n\tinsert: (source: number, destination: StablePlace): Insert => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Insert,\n\t}),\n\n\tdetach: (source: StableRange, destination?: number): Detach => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Detach,\n\t}),\n\n\tsetPayload: (nodeToModify: NodeId, payload: Payload): SetValue => ({\n\t\tnodeToModify,\n\t\tpayload,\n\t\ttype: ChangeType.SetValue,\n\t}),\n\n\tclearPayload: (nodeToModify: NodeId): SetValue => ({\n\t\tnodeToModify,\n\t\t// Rationale: 'undefined' is reserved for future use (see 'SetValue' interface above.)\n\t\tpayload: null,\n\t\ttype: ChangeType.SetValue,\n\t}),\n\n\tconstraint: (\n\t\ttoConstrain: StableRange,\n\t\teffect: ConstraintEffect,\n\t\tidentityHash?: UuidString,\n\t\tlength?: number,\n\t\tcontentHash?: UuidString,\n\t\tparentNode?: NodeId,\n\t\tlabel?: TraitLabel\n\t): Constraint => ({\n\t\ttoConstrain,\n\t\teffect,\n\t\tidentityHash,\n\t\tlength,\n\t\tcontentHash,\n\t\tparentNode,\n\t\tlabel,\n\t\ttype: ChangeType.Constraint,\n\t}),\n\n\t/** Helpers for making high-level composite operations */\n\n\t/**\n\t * @returns a change that deletes the supplied part of the tree.\n\t */\n\tdelete: (stableRange: StableRange): Change => Change.detach(stableRange),\n\n\t/**\n\t * @returns changes that insert 'nodes' into the specified location in the tree.\n\t */\n\tinsertTree: (nodes: BuildNode | TreeNodeSequence<BuildNode>, destination: StablePlace): Change[] => {\n\t\tconst build = Change.build(nodes, 0);\n\t\treturn [build, Change.insert(build.destination, destination)];\n\t},\n\n\t/**\n\t * @returns changes that moves the specified content to a new location in the tree.\n\t */\n\tmove: (source: StableRange, destination: StablePlace): Change[] => {\n\t\tconst detach = Change.detach(source, 0);\n\t\treturn [detach, Change.insert(assertNotUndefined(detach.destination), destination)];\n\t},\n};\n\n/**\n * A location in a trait.\n * This is NOT the location of a node, but a location where a node could be inserted:\n * it is next to a sibling or at one end of the trait.\n *\n * To be well formed, either `sibling` or `trait` must be defined, but not both.\n *\n * Any given insertion location can be described by two `StablePlace` objects, one with `Side.After` and one with `Side.Before`.\n * For example, in a trait containing two strings \"foo\" and \"bar\", there are 6 different `StablePlace`s corresponding to 3 locations in the\n * trait a new node could be inserted: at the start, before \"foo\", after \"foo\", before \"bar\", after \"bar\", and at the end.\n * Neither of the two ways to specify the same location are considered to be after each other.\n *\n * The anchor (`referenceSibling` or `referenceTrait`) used for a particular `StablePlace` can have an impact in collaborative scenarios.\n *\n * `StablePlace` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n *\n * @example\n *\n * ```typescript\n * StablePlace.before(node)\n * StablePlace.atStartOf(trait)\n * ```\n * @alpha\n */\nexport interface StablePlace {\n\t/**\n\t * Where this StablePlace is relative to the sibling (if specified), or an end of the trait (if no sibling specified).\n\t * If 'After' and there is no sibling, this StablePlace is after the front of the trait.\n\t * If 'Before' and there is no sibling, this StablePlace is before the back of the trait.\n\t */\n\treadonly side: Side;\n\n\t/**\n\t * The sibling to which this 'StablePlace' is anchored (by 'side').\n\t * If specified, referenceTrait must be unspecified.\n\t */\n\treadonly referenceSibling?: NodeId;\n\n\t/**\n\t * The trait to which this 'StablePlace' is anchored (by 'side').\n\t * If specified, referenceSibling must be unspecified.\n\t */\n\treadonly referenceTrait?: TraitLocation;\n}\n\n/**\n * Specifies the range of nodes from `start` to `end` within a trait.\n * Valid iff start and end are valid and are within the same trait and the start does not occur after the end in the trait.\n *\n * See {@link (StablePlace:interface)} for what it means for a place to be \"after\" another place.\n *\n * @remarks\n *\n * `StableRange` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n *\n * @example\n *\n * ```typescript\n * StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))\n * ```\n * @alpha\n */\nexport interface StableRange {\n\treadonly start: StablePlace;\n\treadonly end: StablePlace;\n}\n\n/**\n * The remainder of this file consists of ergonomic factory methods for persisted types, or common combinations thereof (e.g. \"Move\" as a\n * combination of a \"Detach\" change and an \"Insert\" change).\n *\n * None of these helpers are persisted in documents, and therefore changes to their semantics need only follow standard semantic versioning\n * practices.\n */\n\n// Note: Documentation of this constant is merged with documentation of the `StablePlace` interface.\n/**\n * @alpha\n */\nexport const StablePlace = {\n\t/**\n\t * @returns The location directly before `node`.\n\t */\n\tbefore: (node: NodeData<NodeId> | NodeId): StablePlace => ({\n\t\tside: Side.Before,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * @returns The location directly after `node`.\n\t */\n\tafter: (node: NodeData<NodeId> | NodeId): StablePlace => ({\n\t\tside: Side.After,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * @returns The location at the start of `trait`.\n\t */\n\tatStartOf: (trait: TraitLocation): StablePlace => ({\n\t\tside: Side.After,\n\t\treferenceTrait: trait,\n\t}),\n\t/**\n\t * @returns The location at the end of `trait`.\n\t */\n\tatEndOf: (trait: TraitLocation): StablePlace => ({\n\t\tside: Side.Before,\n\t\treferenceTrait: trait,\n\t}),\n};\n\n// Note: Documentation of this constant is merged with documentation of the `StableRange` interface.\n/**\n * @alpha\n */\nexport const StableRange = {\n\t/**\n\t * Factory for producing a `StableRange` from a start `StablePlace` to an end `StablePlace`.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))\n\t * ```\n\t */\n\tfrom: (start: StablePlace): { to: (end: StablePlace) => StableRange } => ({\n\t\tto: (end: StablePlace): StableRange => {\n\t\t\tif (start.referenceTrait && end.referenceTrait) {\n\t\t\t\tassert(\n\t\t\t\t\tstart.referenceTrait.parent === end.referenceTrait.parent,\n\t\t\t\t\t0x5fe /* StableRange must be constructed with endpoints from the same trait */\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tstart.referenceTrait.label === end.referenceTrait.label,\n\t\t\t\t\t0x5ff /* StableRange must be constructed with endpoints from the same trait */\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { start, end };\n\t\t},\n\t}),\n\t/**\n\t * @returns a `StableRange` which contains only the provided `node`.\n\t * Both the start and end `StablePlace` objects used to anchor this `StableRange` are in terms of the passed in node.\n\t */\n\tonly: (node: NodeData<NodeId> | NodeId): StableRange => ({\n\t\tstart: StablePlace.before(node),\n\t\tend: StablePlace.after(node),\n\t}),\n\t/**\n\t * @returns a `StableRange` which contains everything in the trait.\n\t * This is anchored using the provided `trait`, and is independent of the actual contents of the trait:\n\t * it does not use sibling anchoring.\n\t */\n\tall: (trait: TraitLocation): StableRange => ({\n\t\tstart: StablePlace.atStartOf(trait),\n\t\tend: StablePlace.atEndOf(trait),\n\t}),\n};\n"]}
1
+ {"version":3,"file":"ChangeTypes.js","sourceRoot":"","sources":["../src/ChangeTypes.ts"],"names":[],"mappings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ved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from '@fluidframework/core-utils/internal';\n\nimport { assertNotUndefined } from './Common.js';\nimport { NodeId, TraitLabel, UuidString } from './Identifiers.js';\nimport { getNodeId } from './NodeIdUtilities.js';\nimport { TraitLocation } from './TreeView.js';\nimport { ConstraintEffect, NodeData, Payload, Side, TreeNodeSequence } from './persisted-types/index.js';\n\n/**\n * An object which may have traits with children of the given type underneath it\n * @alpha\n */\nexport interface HasVariadicTraits<TChild> {\n\treadonly traits?: {\n\t\treadonly [key: string]: TChild | TreeNodeSequence<TChild> | undefined;\n\t};\n}\n\n/**\n * The type of a Change\n * @alpha\n */\nexport enum ChangeType {\n\tInsert,\n\tDetach,\n\tBuild,\n\tSetValue,\n\tConstraint,\n}\n\n/**\n * A change that composes an Edit.\n *\n * @remarks\n *\n * `Change` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n *\n * @example\n *\n * ```typescript\n * Change.insert(sourceId, destination)\n * ```\n * @alpha\n */\nexport type Change = Insert | Detach | Build | SetValue | Constraint;\n\n/**\n * Node or a detached sequence of nodes (referred to by a detached sequence ID) for use in a Build change.\n * See `BuildTreeNode` for more.\n * @alpha\n */\nexport type BuildNode = BuildTreeNode | number;\n\n/**\n * Node for use in a Build change, which is composed of a definition describing what this nodes type, an identifier identifying this node\n * within the tree, and a payload containing an opaque serializable piece of data.\n * An identifier can be provided explicitly if the node must be referred to before the results of the `Change` containing this\n * BuildTreeNode can be observed. If `identifier` is not supplied, one will be generated for it in an especially efficient manner\n * that allows for compact storage and transmission and thus this property should be omitted if convenient.\n * See the SharedTree readme for more on the tree format.\n * @alpha\n */\nexport interface BuildTreeNode extends HasVariadicTraits<BuildNode> {\n\tdefinition: string;\n\tidentifier?: NodeId;\n\tpayload?: Payload;\n}\n\n/**\n * Constructs a sequence of nodes, associates it with the supplied ID, and stores it for use in later changes.\n * Does not modify the document.\n *\n * Valid if (transitively) all DetachedSequenceId are used according to their rules (use here counts as a destination),\n * and all Nodes' identifiers are previously unused.\n * @alpha\n */\nexport interface Build {\n\treadonly destination: number;\n\treadonly source: BuildNode | TreeNodeSequence<BuildNode>;\n\treadonly type: typeof ChangeType.Build;\n}\n\n/**\n * Inserts a sequence of nodes at the specified destination.\n * The source can be constructed either by a Build (used to insert new nodes) or a Detach (amounts to a \"move\" operation).\n * @alpha\n */\nexport interface Insert {\n\treadonly destination: StablePlace;\n\treadonly source: number;\n\treadonly type: typeof ChangeType.Insert;\n}\n\n/**\n * Removes a sequence of nodes from the tree.\n * If a destination is specified, the detached sequence is associated with that ID and held for possible reuse\n * by later changes in this same Edit (such as by an Insert).\n * A Detach without a destination is a deletion of the specified sequence, as is a Detach with a destination that is not used later.\n * @alpha\n */\nexport interface Detach {\n\treadonly destination?: number;\n\treadonly source: StableRange;\n\treadonly type: typeof ChangeType.Detach;\n}\n\n/**\n * Modifies the payload of a node.\n * @alpha\n */\nexport interface SetValue {\n\treadonly nodeToModify: NodeId;\n\t/**\n\t * Sets or clears the payload.\n\t * To improve ease of forwards compatibility, an explicit `null` value is used to represent the clearing of a payload.\n\t * SetValue may use `undefined` in future API versions to mean \"don't change the payload\" (which is useful if e.g. other\n\t * fields are added to SetValue that can be changed without altering the payload)\n\t */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\treadonly payload: Payload | null;\n\treadonly type: typeof ChangeType.SetValue;\n}\n\n/**\n * A set of constraints on the validity of an Edit.\n * A Constraint is used to detect when an Edit, due to other concurrent edits, may have unintended effects or merge in\n * non-semantic ways. It is processed in order like any other Change in an Edit. It can cause an edit to fail if the\n * various constraints are not met at the time of evaluation (ex: the parentNode has changed due to concurrent editing).\n * Does not modify the document.\n * @alpha\n */\nexport interface Constraint {\n\t/**\n\t * Selects a sequence of nodes which will be checked against the constraints specified by the optional fields.\n\t * If `toConstrain` is invalid, it will be treated like a constraint being unmet.\n\t * Depending on `effect` this may or may not make the Edit invalid.\n\t *\n\t * When a constraint is not met, the effects is specified by `effect`.\n\t */\n\treadonly toConstrain: StableRange;\n\n\t/**\n\t * Require that the identities of all the nodes in toConstrain hash to this value.\n\t * Hash is order dependent.\n\t * TODO: implement and specify exact hash function.\n\t *\n\t * This is an efficient (O(1) space) way to constrain a sequence of nodes to have specific identities.\n\t */\n\treadonly identityHash?: UuidString;\n\n\t/**\n\t * Require that the number of nodes in toConstrain is this value.\n\t */\n\treadonly length?: number;\n\n\t/**\n\t * Require that the contents of all of the nodes in toConstrain hash to this value.\n\t * Hash is an order dependant deep hash, which includes all subtree content recursively.\n\t * TODO: implement and specify exact hash function.\n\t *\n\t * This is an efficient (O(1) space) way to constrain a sequence of nodes have exact values (transitively).\n\t */\n\treadonly contentHash?: UuidString;\n\n\t/**\n\t * Require that parent under which toConstrain is located has this identifier.\n\t */\n\treadonly parentNode?: NodeId;\n\n\t/**\n\t * Require that the trait under which toConstrain is located has this label.\n\t */\n\treadonly label?: TraitLabel;\n\n\t/**\n\t * What to do if a constraint is not met.\n\t */\n\treadonly effect: ConstraintEffect;\n\n\t/**\n\t * Marker for which kind of Change this is.\n\t */\n\treadonly type: typeof ChangeType.Constraint;\n}\n\n// Note: Documentation of this constant is merged with documentation of the `Change` interface.\n/**\n * @alpha\n */\nexport const Change = {\n\tbuild: (source: BuildNode | TreeNodeSequence<BuildNode>, destination: number): Build => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Build,\n\t}),\n\n\tinsert: (source: number, destination: StablePlace): Insert => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Insert,\n\t}),\n\n\tdetach: (source: StableRange, destination?: number): Detach => ({\n\t\tdestination,\n\t\tsource,\n\t\ttype: ChangeType.Detach,\n\t}),\n\n\tsetPayload: (nodeToModify: NodeId, payload: Payload): SetValue => ({\n\t\tnodeToModify,\n\t\tpayload,\n\t\ttype: ChangeType.SetValue,\n\t}),\n\n\tclearPayload: (nodeToModify: NodeId): SetValue => ({\n\t\tnodeToModify,\n\t\t// Rationale: 'undefined' is reserved for future use (see 'SetValue' interface above.)\n\t\tpayload: null,\n\t\ttype: ChangeType.SetValue,\n\t}),\n\n\tconstraint: (\n\t\ttoConstrain: StableRange,\n\t\teffect: ConstraintEffect,\n\t\tidentityHash?: UuidString,\n\t\tlength?: number,\n\t\tcontentHash?: UuidString,\n\t\tparentNode?: NodeId,\n\t\tlabel?: TraitLabel\n\t): Constraint => ({\n\t\ttoConstrain,\n\t\teffect,\n\t\tidentityHash,\n\t\tlength,\n\t\tcontentHash,\n\t\tparentNode,\n\t\tlabel,\n\t\ttype: ChangeType.Constraint,\n\t}),\n\n\t/** Helpers for making high-level composite operations */\n\n\t/**\n\t * Deletes a range of nodes from the tree.\n\t *\n\t * @returns A change that deletes the supplied part of the tree.\n\t */\n\tdelete: (stableRange: StableRange): Change => Change.detach(stableRange),\n\n\t/**\n\t * Inserts nodes into the tree at the specified location.\n\t *\n\t * @returns The changes that insert 'nodes' into the specified location in the tree.\n\t */\n\tinsertTree: (nodes: BuildNode | TreeNodeSequence<BuildNode>, destination: StablePlace): Change[] => {\n\t\tconst build = Change.build(nodes, 0);\n\t\treturn [build, Change.insert(build.destination, destination)];\n\t},\n\n\t/**\n\t * Moves nodes from one location to another in the tree.\n\t *\n\t * @returns The changes that moves the specified content to a new location in the tree.\n\t */\n\tmove: (source: StableRange, destination: StablePlace): Change[] => {\n\t\tconst detach = Change.detach(source, 0);\n\t\treturn [detach, Change.insert(assertNotUndefined(detach.destination), destination)];\n\t},\n};\n\n/**\n * A location in a trait.\n * This is NOT the location of a node, but a location where a node could be inserted:\n * it is next to a sibling or at one end of the trait.\n *\n * To be well formed, either `sibling` or `trait` must be defined, but not both.\n *\n * Any given insertion location can be described by two `StablePlace` objects, one with `Side.After` and one with `Side.Before`.\n * For example, in a trait containing two strings \"foo\" and \"bar\", there are 6 different `StablePlace`s corresponding to 3 locations in the\n * trait a new node could be inserted: at the start, before \"foo\", after \"foo\", before \"bar\", after \"bar\", and at the end.\n * Neither of the two ways to specify the same location are considered to be after each other.\n *\n * The anchor (`referenceSibling` or `referenceTrait`) used for a particular `StablePlace` can have an impact in collaborative scenarios.\n *\n * `StablePlace` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n *\n * @example\n *\n * ```typescript\n * StablePlace.before(node)\n * StablePlace.atStartOf(trait)\n * ```\n * @alpha\n */\nexport interface StablePlace {\n\t/**\n\t * Where this StablePlace is relative to the sibling (if specified), or an end of the trait (if no sibling specified).\n\t * If 'After' and there is no sibling, this StablePlace is after the front of the trait.\n\t * If 'Before' and there is no sibling, this StablePlace is before the back of the trait.\n\t */\n\treadonly side: Side;\n\n\t/**\n\t * The sibling to which this 'StablePlace' is anchored (by 'side').\n\t * If specified, referenceTrait must be unspecified.\n\t */\n\treadonly referenceSibling?: NodeId;\n\n\t/**\n\t * The trait to which this 'StablePlace' is anchored (by 'side').\n\t * If specified, referenceSibling must be unspecified.\n\t */\n\treadonly referenceTrait?: TraitLocation;\n}\n\n/**\n * Specifies the range of nodes from `start` to `end` within a trait.\n * Valid iff start and end are valid and are within the same trait and the start does not occur after the end in the trait.\n *\n * See {@link (StablePlace:interface)} for what it means for a place to be \"after\" another place.\n *\n * @remarks\n *\n * `StableRange` objects can be conveniently constructed with the helper methods exported on a constant of the same name.\n *\n * @example\n *\n * ```typescript\n * StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))\n * ```\n * @alpha\n */\nexport interface StableRange {\n\treadonly start: StablePlace;\n\treadonly end: StablePlace;\n}\n\n/**\n * The remainder of this file consists of ergonomic factory methods for persisted types, or common combinations thereof (e.g. \"Move\" as a\n * combination of a \"Detach\" change and an \"Insert\" change).\n *\n * None of these helpers are persisted in documents, and therefore changes to their semantics need only follow standard semantic versioning\n * practices.\n */\n\n// Note: Documentation of this constant is merged with documentation of the `StablePlace` interface.\n/**\n * @alpha\n */\nexport const StablePlace = {\n\t/**\n\t * Creates a stable place representing the location directly before a node.\n\t *\n\t * @returns The location directly before `node`.\n\t */\n\tbefore: (node: NodeData<NodeId> | NodeId): StablePlace => ({\n\t\tside: Side.Before,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * Creates a stable place representing the location directly after a node.\n\t *\n\t * @returns The location directly after `node`.\n\t */\n\tafter: (node: NodeData<NodeId> | NodeId): StablePlace => ({\n\t\tside: Side.After,\n\t\treferenceSibling: getNodeId(node),\n\t}),\n\t/**\n\t * Creates a stable place representing the location at the start of a trait.\n\t *\n\t * @returns The location at the start of `trait`.\n\t */\n\tatStartOf: (trait: TraitLocation): StablePlace => ({\n\t\tside: Side.After,\n\t\treferenceTrait: trait,\n\t}),\n\t/**\n\t * Creates a stable place representing the location at the end of a trait.\n\t *\n\t * @returns The location at the end of `trait`.\n\t */\n\tatEndOf: (trait: TraitLocation): StablePlace => ({\n\t\tside: Side.Before,\n\t\treferenceTrait: trait,\n\t}),\n};\n\n// Note: Documentation of this constant is merged with documentation of the `StableRange` interface.\n/**\n * @alpha\n */\nexport const StableRange = {\n\t/**\n\t * Factory for producing a `StableRange` from a start `StablePlace` to an end `StablePlace`.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))\n\t * ```\n\t */\n\tfrom: (start: StablePlace): { to: (end: StablePlace) => StableRange } => ({\n\t\tto: (end: StablePlace): StableRange => {\n\t\t\tif (start.referenceTrait && end.referenceTrait) {\n\t\t\t\tassert(\n\t\t\t\t\tstart.referenceTrait.parent === end.referenceTrait.parent,\n\t\t\t\t\t0x5fe /* StableRange must be constructed with endpoints from the same trait */\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tstart.referenceTrait.label === end.referenceTrait.label,\n\t\t\t\t\t0x5ff /* StableRange must be constructed with endpoints from the same trait */\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { start, end };\n\t\t},\n\t}),\n\t/**\n\t * Creates a `StableRange` which contains only the provided `node`.\n\t *\n\t * @remarks\n\t * Both the start and end `StablePlace` objects used to anchor this `StableRange` are in terms of the passed in node.\n\t */\n\tonly: (node: NodeData<NodeId> | NodeId): StableRange => ({\n\t\tstart: StablePlace.before(node),\n\t\tend: StablePlace.after(node),\n\t}),\n\t/**\n\t * Creates a `StableRange` which contains everything in the trait.\n\t *\n\t * @remarks\n\t * This is anchored using the provided `trait`, and is independent of the actual contents of the trait:\n\t * it does not use sibling anchoring.\n\t */\n\tall: (trait: TraitLocation): StableRange => ({\n\t\tstart: StablePlace.atStartOf(trait),\n\t\tend: StablePlace.atEndOf(trait),\n\t}),\n};\n"]}
@@ -104,12 +104,14 @@ export declare abstract class Checkout extends EventEmitterWithErrorHandling<ICh
104
104
  disposed: boolean;
105
105
  protected constructor(tree: SharedTree, currentView: RevisionView, onEditCommitted: EditCommittedHandler);
106
106
  /**
107
- * @returns the current view of the tree, including the result of changes applied so far during an edit.
107
+ * Gets the current view of the tree, including the result of changes applied so far during an edit.
108
+ *
109
+ * @remarks
108
110
  * Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.
109
111
  */
110
112
  get currentView(): TreeView;
111
113
  /**
112
- * @returns true iff there is an open edit.
114
+ * Whether there is currently an open edit operation.
113
115
  */
114
116
  hasOpenEdit(): boolean;
115
117
  /**
@@ -186,7 +188,9 @@ export declare abstract class Checkout extends EventEmitterWithErrorHandling<ICh
186
188
  */
187
189
  abortEdit(): void;
188
190
  /**
189
- * @returns the {@link EditStatus} of the current edit.
191
+ * Gets the {@link EditStatus} of the current edit.
192
+ *
193
+ * @remarks
190
194
  * Has no side effects.
191
195
  * Can only be called if an edit is open.
192
196
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Checkout.d.ts","sourceRoot":"","sources":["../src/Checkout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,WAAW,EAA4B,MAAM,iCAAiC,CAAC;AAErG,OAAO,EAEN,6BAA6B,EAE7B,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAI1C,OAAO,EAAE,MAA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G,IAAI;IAC9C,YAAY,CAAC,GAAG,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IASxD;;;;OAIG;IACH,SAAS,CAAC,uBAAuB,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,GAAG,UAAU;IACjF,SAAS,CAAC,uBAAuB,CAAC,GAAG,OAAO,EAAE,SAAS,cAAc,EAAE,GAAG,UAAU;IAWpF;;;OAGG;IACI,SAAS,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM;IAC7C,SAAS,CAAC,GAAG,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM;IAQvD;;;;OAIG;IACI,YAAY,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS;IAC5D,YAAY,CAAC,GAAG,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS;IAgBtE;;;;;;;;;;;;OAYG;IACI,iBAAiB,IAAI,oBAAoB,CAAC,KAAK,GAAG,oBAAoB,CAAC,OAAO;IAuBrF;;;OAGG;IACI,SAAS,IAAI,IAAI;IAOxB;;;;;;OAMG;IACI,aAAa,IAAI,UAAU;IAQlC;;;OAGG;IACI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAYnC;;;;OAIG;IACH,SAAS,CAAC,UAAU,IAAI,IAAI;IAU5B;;OAEG;aACa,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAEtD;;;OAGG;aACa,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAErD;;;OAGG;IACI,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;CAUnC"}
package/dist/Checkout.js CHANGED
@@ -80,14 +80,16 @@ class Checkout extends internal_2.EventEmitterWithErrorHandling {
80
80
  this.tree.on(EventTypes_js_1.SharedTreeEvent.EditCommitted, this.editCommittedHandler);
81
81
  }
82
82
  /**
83
- * @returns the current view of the tree, including the result of changes applied so far during an edit.
83
+ * Gets the current view of the tree, including the result of changes applied so far during an edit.
84
+ *
85
+ * @remarks
84
86
  * Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.
85
87
  */
86
88
  get currentView() {
87
89
  return this.currentEdit?.view ?? this.latestCommittedView;
88
90
  }
89
91
  /**
90
- * @returns true iff there is an open edit.
92
+ * Whether there is currently an open edit operation.
91
93
  */
92
94
  hasOpenEdit() {
93
95
  return this.currentEdit !== undefined;
@@ -251,7 +253,9 @@ class Checkout extends internal_2.EventEmitterWithErrorHandling {
251
253
  this.emitChange();
252
254
  }
253
255
  /**
254
- * @returns the {@link EditStatus} of the current edit.
256
+ * Gets the {@link EditStatus} of the current edit.
257
+ *
258
+ * @remarks
255
259
  * Has no side effects.
256
260
  * Can only be called if an edit is open.
257
261
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Checkout.js","sourceRoot":"","sources":["../src/Checkout.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,uEAIkD;AAGlD,2CAAsF;AACtF,yDAA+C;AAC/C,mDAAkD;AAElD,iDAAkD;AAGlD,qEAAsH;AAEtH,yDAA8E;AAE9E;;;GAGG;AACH,IAAY,aAMX;AAND,WAAY,aAAa;IACxB;;;OAGG;IACH,0CAAyB,CAAA;AAC1B,CAAC,EANW,aAAa,6BAAb,aAAa,QAMxB;AAUD;;;GAGG;AACH,IAAY,oBAiBX;AAjBD,WAAY,oBAAoB;IAC/B;;;;OAIG;IACH,yEAAS,CAAA;IACT;;;;OAIG;IACH,qEAAO,CAAA;IACP;;OAEG;IACH,iEAAK,CAAA;AACN,CAAC,EAjBW,oBAAoB,oCAApB,oBAAoB,QAiB/B;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAsB,QAAS,SAAQ,wCAA8C;IA4CpF,YAAsB,IAAgB,EAAE,WAAyB,EAAE,eAAqC;QACvG,KAAK,CAAC,CAAC,MAAM,EAAE,KAAc,EAAE,EAAE;YAChC,IAAI,CAAC,IAAI,CAAC,I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CAAC;QACxD,CAAC;IACF,CAAC;IAaD;;;OAGG;IACI,OAAO,CAAC,KAAa;QAC3B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO;QACR,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,6BAA6B;QAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,+BAAe,CAAC,aAAa,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACzE,CAAC;CACD;AAtWD,4BAsWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, IErrorEvent, ITelemetryBaseProperties } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\tITelemetryLoggerExt,\n\tEventEmitterWithErrorHandling,\n\tcreateChildLogger,\n} from '@fluidframework/telemetry-utils/internal';\n\nimport { Change } from './ChangeTypes.js';\nimport { RestOrArray, assertWithMessage, fail, unwrapRestOrArray } from './Common.js';\nimport { newEditId } from './EditUtilities.js';\nimport { SharedTreeEvent } from './EventTypes.js';\nimport { EditId } from './Identifiers.js';\nimport { CachingLogViewer } from './LogViewer.js';\nimport { RevisionView } from './RevisionView.js';\nimport { EditCommittedHandler, SharedTree } from './SharedTree.js';\nimport { EditingResult, GenericTransaction, TransactionInternal, ValidEditingResult } from './TransactionInternal.js';\nimport { TreeView } from './TreeView.js';\nimport { ChangeInternal, Edit, EditStatus } from './persisted-types/index.js';\n\n/**\n * An event emitted by a `Checkout` to indicate a state change. See {@link ICheckoutEvents} for event argument information.\n * @alpha\n */\nexport enum CheckoutEvent {\n\t/**\n\t * `currentView` has changed.\n\t * Passed a before and after TreeView.\n\t */\n\tViewChange = 'viewChange',\n}\n\n/**\n * Events which may be emitted by `Checkout`. See {@link CheckoutEvent} for documentation of event semantics.\n * @alpha\n */\nexport interface ICheckoutEvents extends IErrorEvent {\n\t(event: 'viewChange', listener: (before: TreeView, after: TreeView) => void);\n}\n\n/**\n * The result of validation of an Edit.\n * @alpha\n */\nexport enum EditValidationResult {\n\t/**\n\t * The edit contained one or more malformed changes (e.g. was missing required fields such as `id`),\n\t * or contained a sequence of changes that could not possibly be applied sequentially without error\n\t * (e.g. an edit which tries to insert the same detached node twice).\n\t */\n\tMalformed,\n\t/**\n\t * The edit is well-formed but cannot be applied to the current view, generally because concurrent changes\n\t * caused one or more merge conflicts.\n\t * For example, the edit refers to the `StablePlace` after node `C`, but `C` has since been deleted.\n\t */\n\tInvalid,\n\t/**\n\t * The edit is well-formed and can be applied to the current view.\n\t */\n\tValid,\n}\n\n/**\n * A mutable Checkout of a SharedTree, allowing viewing and interactive transactional editing.\n * Provides {@link https://en.wikipedia.org/wiki/Snapshot_isolation | snapshot-isolation} while editing.\n *\n * A Checkout always shows a consistent sequence of versions of the SharedTree, but it may skip intermediate versions, and may fall behind.\n * In this case consistent means the sequence of versions could occur with fully synchronous shared tree access,\n * though the timing of sequenced edits arriving to the Checkout may be later than they actually arrive in the SharedTree.\n * Specifically no sequenced edits will arrive during an ongoing edit (to implement snapshot isolation):\n * they will be applied asynchronously some time after the ongoing edit is ended.\n *\n * Events emitted by `Checkout` are documented in {@link CheckoutEvent}.\n * Exceptions thrown during event handling will be emitted as error events, which are automatically surfaced as error events on the\n * `SharedTree` used at construction time.\n * @alpha\n */\nexport abstract class Checkout extends EventEmitterWithErrorHandling<ICheckoutEvents> implements IDisposable {\n\t/**\n\t * The view of the latest committed revision.\n\t * Does not include changes from any open edits.\n\t *\n\t * When this changes, emitChange must be called.\n\t */\n\tprotected abstract get latestCommittedView(): RevisionView;\n\n\t/**\n\t * The last view for which invalidation was sent.\n\t * Updated by emitChange.\n\t */\n\tprivate previousView: TreeView;\n\n\t/**\n\t * A handler for 'committedEdit' SharedTreeEvent\n\t */\n\tprivate readonly editCommittedHandler: EditCommittedHandler;\n\n\t/**\n\t * The shared tree this checkout views/edits.\n\t */\n\tpublic readonly tree: SharedTree;\n\n\t/**\n\t * `tree`'s log viewer as a CachingLogViewer if it is one, otherwise undefined.\n\t * Used for optimizations if provided.\n\t */\n\tprivate readonly cachingLogViewer?: CachingLogViewer;\n\n\t/**\n\t * Holds the state required to manage the currently open edit.\n\t * Undefined if there is currently not an open edit.\n\t *\n\t * Since `currentView` exposes the the intermediate state from this edit,\n\t * operations that modify `currentEdit.view` must call `emitChange` to handle invalidation.\n\t */\n\tprivate currentEdit?: GenericTransaction;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic disposed: boolean = false;\n\n\tprotected constructor(tree: SharedTree, currentView: RevisionView, onEditCommitted: EditCommittedHandler) {\n\t\tsuper((_event, error: unknown) => {\n\t\t\tthis.tree.emit('error', error);\n\t\t});\n\t\tthis.tree = tree;\n\t\tthis.logger = createChildLogger({ logger: this.tree.logger, namespace: 'Checkout' });\n\t\tif (tree.logViewer instanceof CachingLogViewer) {\n\t\t\tthis.cachingLogViewer = tree.logViewer;\n\t\t}\n\t\tthis.previousView = currentView;\n\t\tthis.editCommittedHandler = onEditCommitted;\n\n\t\t// If there is an ongoing edit, emitChange will no-op, which is fine.\n\t\tthis.tree.on(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n\n\t/**\n\t * @returns the current view of the tree, including the result of changes applied so far during an edit.\n\t * Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.\n\t */\n\tpublic get currentView(): TreeView {\n\t\treturn this.currentEdit?.view ?? this.latestCommittedView;\n\t}\n\n\t/**\n\t * @returns true iff there is an open edit.\n\t */\n\tpublic hasOpenEdit(): boolean {\n\t\treturn this.currentEdit !== undefined;\n\t}\n\n\t/**\n\t * Opens a new edit operation.\n\t * Changes accumulate in the edit via calls to `applyChanges()`.\n\t */\n\tpublic openEdit(): void {\n\t\tassert(this.currentEdit === undefined, 0x600 /* An edit is already open. */);\n\t\tthis.currentEdit = TransactionInternal.factory(this.latestCommittedView);\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation and commits it to the history.\n\t *\n\t * Malformed edits are considered an error, and will assert:\n\t * All named detached sequences must have been used or the Edit is malformed.\n\t *\n\t * @returns the `id` of the committed edit\n\t */\n\tpublic closeEdit(): EditId {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x601 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tassert(\n\t\t\tcurrentEdit.failure === undefined,\n\t\t\t0x66d /* Cannot close a transaction that has already failed. Use abortEdit instead. */\n\t\t);\n\n\t\tconst editingResult = currentEdit.close();\n\t\tthis.validateChangesApplied(editingResult);\n\t\tconst id: EditId = newEditId();\n\t\tthis.handleNewEdit(id, editingResult);\n\t\treturn id;\n\t}\n\n\tprivate validateChangesApplied(result: EditingResult): asserts result is ValidEditingResult;\n\tprivate validateChangesApplied(result: {\n\t\tstatus: EditStatus;\n\t\tfailure: TransactionInternal.Failure | undefined;\n\t}): asserts result is { status: EditStatus.Applied; failure: undefined };\n\tprivate validateChangesApplied(\n\t\tresult: EditingResult | { status: EditStatus; failure: TransactionInternal.Failure | undefined }\n\t): void {\n\t\tif (result.status === EditStatus.Applied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { failure } = result as { failure: TransactionInternal.Failure };\n\t\tconst additionalProps: ITelemetryBaseProperties = {};\n\t\tswitch (failure.kind) {\n\t\t\tcase TransactionInternal.FailureKind.BadPlace:\n\t\t\t\tadditionalProps.placeFailure = failure.placeFailure;\n\t\t\t\tbreak;\n\t\t\tcase TransactionInternal.FailureKind.BadRange: {\n\t\t\t\tconst { rangeFailure } = failure;\n\t\t\t\tif (typeof rangeFailure === 'string') {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure;\n\t\t\t\t} else {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure.kind;\n\t\t\t\t\tadditionalProps.rangeEndpointFailure = rangeFailure.placeFailure;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.logger.sendErrorEvent({\n\t\t\teventName: 'FailedLocalEdit',\n\t\t\tstatus: result.status === 0 ? 'Malformed' : 'Invalid',\n\t\t\tfailureKind: failure.kind,\n\t\t\t...additionalProps,\n\t\t});\n\t\tfail('Locally constructed edits must be well-formed and valid.');\n\t}\n\n\t/**\n\t * Inform the Checkout that a particular edit is know to have a specific result when applied to a particular TreeView.\n\t * This may be used as a caching hint to avoid recomputation.\n\t */\n\tprotected hintKnownEditingResult(edit: Edit<ChangeInternal>, result: ValidEditingResult): void {\n\t\t// As an optimization, inform logViewer of this editing result so it can reuse it if applied to the same before revision.\n\t\tthis.cachingLogViewer?.setKnownEditingResult(edit, result);\n\t}\n\n\t/**\n\t * Take any needed action between when an edit is completed.\n\t * Usually this will include submitting it to a SharedTree.\n\t *\n\t * Override this to customize.\n\t */\n\tprotected handleNewEdit(id: EditId, result: ValidEditingResult): void {\n\t\tconst edit: Edit<ChangeInternal> = { id, changes: result.changes };\n\n\t\tthis.hintKnownEditingResult(edit, result);\n\n\t\t// Since external edits could have been applied while currentEdit was pending,\n\t\t// do not use the produced view: just go to the newest revision\n\t\t// (which processLocalEdit will do, including invalidation).\n\t\tthis.tree.applyEditInternal(edit);\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tpublic applyChanges(changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: RestOrArray<Change>): void {\n\t\tassert(this.currentEdit !== undefined, 0x602 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tthis.validateChangesApplied({ status, failure: this.currentEdit.failure });\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tprotected tryApplyChangesInternal(changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: RestOrArray<ChangeInternal>): EditStatus {\n\t\tassert(this.currentEdit !== undefined, 0x603 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray);\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t}\n\t\treturn status;\n\t}\n\n\t/**\n\t * Convenience helper for applying an edit containing the given changes.\n\t * Opens an edit, applies the given changes, and closes the edit. See (`openEdit()`/`applyChanges()`/`closeEdit()`).\n\t */\n\tpublic applyEdit(changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: RestOrArray<Change>): EditId {\n\t\tthis.openEdit();\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tthis.applyChanges(changeArray);\n\t\treturn this.closeEdit();\n\t}\n\n\t/**\n\t * Apply an edit, if valid, otherwise does nothing (the edit is not added to the history).\n\t * If the edit applied, its changes will be immediately visible on this checkout, though it still may end up invalid once sequenced due to concurrent edits.\n\t * @returns The EditId if the edit was valid and thus applied, and undefined if it was invalid and thus not applied.\n\t */\n\tpublic tryApplyEdit(changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: RestOrArray<Change>): EditId | undefined {\n\t\tthis.openEdit();\n\n\t\tassert(this.currentEdit !== undefined, 0x604 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t\treturn this.closeEdit();\n\t\t}\n\n\t\tthis.abortEdit();\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Rebases the ongoing edit to the latest revision loaded by this 'Checkout'.\n\t *\n\t * If the rebase succeeds (none of the changes in the ongoing edit became invalid), the ongoing edit will remain open and the current\n\t * view will reflect those changes.\n\t *\n\t * If the rebase fails (changes become invalid), the ongoing edit will be aborted and\n\t * currentView will return to showing the newest committed revision as it always does when there is no ongoing edit.\n\t *\n\t * Must only be called during an open edit.\n\t *\n\t * @returns The result of the rebase.\n\t */\n\tpublic rebaseCurrentEdit(): EditValidationResult.Valid | EditValidationResult.Invalid {\n\t\tassert(this.currentEdit !== undefined, 0x605 /* An edit is not open. */);\n\t\tassert(this.currentEdit.status === EditStatus.Applied, 0x606 /* Local edits should always be valid. */);\n\t\t// When closed, the result might indicate Malformed due to unused detached entities.\n\t\t// This is not an error, as the edit was still open and can still use those entities.\n\t\tconst priorResults = this.currentEdit.close();\n\t\tconst rebasedEdit = TransactionInternal.factory(this.latestCommittedView).applyChanges(priorResults.changes);\n\t\tassert(\n\t\t\trebasedEdit.status !== EditStatus.Malformed,\n\t\t\t0x607 /* Malformed changes should have been caught on original application. */\n\t\t);\n\t\tlet status: EditValidationResult.Valid | EditValidationResult.Invalid;\n\t\tif (rebasedEdit.status === EditStatus.Invalid) {\n\t\t\tstatus = EditValidationResult.Invalid;\n\t\t\tthis.currentEdit = undefined;\n\t\t} else {\n\t\t\tstatus = EditValidationResult.Valid;\n\t\t\tthis.currentEdit = rebasedEdit;\n\t\t}\n\t\tthis.emitChange();\n\t\treturn status;\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation without committing it to the history.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic abortEdit(): void {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x608 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * @returns the {@link EditStatus} of the current edit.\n\t * Has no side effects.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic getEditStatus(): EditStatus {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x609 /* An edit is not open. */);\n\t\t// TODO: could this ever be anything other than 'Applied'\n\t\t// TODO: shouldn't this be an EditValidationResult since 'Applied' does not indicate the edit has been applied?\n\t\treturn currentEdit.status;\n\t}\n\n\t/**\n\t * Reverts a collection of edits.\n\t * @param editIds - the edits to revert\n\t */\n\tpublic revert(editId: EditId): void {\n\t\tassertWithMessage(this.currentEdit !== undefined);\n\t\tconst index = this.tree.edits.getIndexOfId(editId);\n\t\tconst edit =\n\t\t\tthis.tree.edits.tryGetEditAtIndex(index) ?? fail('Edit with the specified ID does not exist in memory');\n\t\tconst before = this.tree.logViewer.getRevisionViewInMemory(index);\n\t\tconst changes = this.tree.revertChanges(edit.changes, before);\n\t\tif (changes !== undefined) {\n\t\t\tthis.tryApplyChangesInternal(changes);\n\t\t}\n\t}\n\n\t/**\n\t * Send invalidation message for all changes since last call to emitChange.\n\t * This must be called every time `currentView` could have changed.\n\t * It is ok to make excessive calls to this: change notifications will be cheaply de-duplicated.\n\t */\n\tprotected emitChange(): void {\n\t\tconst current = this.currentView;\n\t\tconst previous = this.previousView;\n\t\tif (!previous.hasEqualForest(current, true)) {\n\t\t\t// Set previousView before calling emit to make reentrant case work (where the event handler causes an edit).\n\t\t\tthis.previousView = current;\n\t\t\tthis.emit(CheckoutEvent.ViewChange, previous, current);\n\t\t}\n\t}\n\n\t/**\n\t * @returns a Promise which completes after all currently known edits are available in this checkout.\n\t */\n\tpublic abstract waitForPendingUpdates(): Promise<void>;\n\n\t/**\n\t * @returns a Promise which completes after edits that were closed on this checkout (before calling this) have been\n\t * submitted to Fluid. This does NOT wait for the Fluid service to ack them\n\t */\n\tpublic abstract waitForEditsToSubmit(): Promise<void>;\n\n\t/**\n\t * release all unmanaged resources\n\t * e.g. unregister event listeners\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\n\t\t// remove registered listener\n\t\tthis.tree.off(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n}\n"]}
1
+ {"version":3,"file":"Checkout.js","sourceRoot":"","sources":["../src/Checkout.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,uEAIkD;AAGlD,2CAAsF;AACtF,yDAA+C;AAC/C,mDAAkD;AAElD,iDAAkD;AAGlD,qEAAsH;AAEtH,yDAA8E;AAE9E;;;GAGG;AACH,IAAY,aAMX;AAND,WAAY,aAAa;IACxB;;;OAGG;IACH,0CAAyB,CAAA;AAC1B,CAAC,EANW,aAAa,6BAAb,aAAa,QAMxB;AAUD;;;GAGG;AACH,IAAY,oBAiBX;AAjBD,WAAY,oBAAoB;IAC/B;;;;OAIG;IACH,yEAAS,CAAA;IACT;;;;OAIG;IACH,qEAAO,CAAA;IACP;;OAEG;IACH,iEAAK,CAAA;AACN,CAAC,EAjBW,oBAAoB,oCAApB,oBAAoB,QAiB/B;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAsB,QAAS,SAAQ,wCAA8C;IA4CpF,YAAsB,IAAgB,EAAE,WAAyB,EAAE,eAAqC;QACvG,KAAK,CAAC,CAAC,MAAM,EAAE,KAAc,EAAE,EAAE;YAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QALG,aAAQ,GAAY,KAAK,CAAC;QAMhC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,IAAA,4BAAiB,EAAC,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;QACrF,IA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C,CAAC;IACzE,CAAC;CACD;AA1WD,4BA0WC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, IErrorEvent, ITelemetryBaseProperties } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\tITelemetryLoggerExt,\n\tEventEmitterWithErrorHandling,\n\tcreateChildLogger,\n} from '@fluidframework/telemetry-utils/internal';\n\nimport { Change } from './ChangeTypes.js';\nimport { RestOrArray, assertWithMessage, fail, unwrapRestOrArray } from './Common.js';\nimport { newEditId } from './EditUtilities.js';\nimport { SharedTreeEvent } from './EventTypes.js';\nimport { EditId } from './Identifiers.js';\nimport { CachingLogViewer } from './LogViewer.js';\nimport { RevisionView } from './RevisionView.js';\nimport { EditCommittedHandler, SharedTree } from './SharedTree.js';\nimport { EditingResult, GenericTransaction, TransactionInternal, ValidEditingResult } from './TransactionInternal.js';\nimport { TreeView } from './TreeView.js';\nimport { ChangeInternal, Edit, EditStatus } from './persisted-types/index.js';\n\n/**\n * An event emitted by a `Checkout` to indicate a state change. See {@link ICheckoutEvents} for event argument information.\n * @alpha\n */\nexport enum CheckoutEvent {\n\t/**\n\t * `currentView` has changed.\n\t * Passed a before and after TreeView.\n\t */\n\tViewChange = 'viewChange',\n}\n\n/**\n * Events which may be emitted by `Checkout`. See {@link CheckoutEvent} for documentation of event semantics.\n * @alpha\n */\nexport interface ICheckoutEvents extends IErrorEvent {\n\t(event: 'viewChange', listener: (before: TreeView, after: TreeView) => void);\n}\n\n/**\n * The result of validation of an Edit.\n * @alpha\n */\nexport enum EditValidationResult {\n\t/**\n\t * The edit contained one or more malformed changes (e.g. was missing required fields such as `id`),\n\t * or contained a sequence of changes that could not possibly be applied sequentially without error\n\t * (e.g. an edit which tries to insert the same detached node twice).\n\t */\n\tMalformed,\n\t/**\n\t * The edit is well-formed but cannot be applied to the current view, generally because concurrent changes\n\t * caused one or more merge conflicts.\n\t * For example, the edit refers to the `StablePlace` after node `C`, but `C` has since been deleted.\n\t */\n\tInvalid,\n\t/**\n\t * The edit is well-formed and can be applied to the current view.\n\t */\n\tValid,\n}\n\n/**\n * A mutable Checkout of a SharedTree, allowing viewing and interactive transactional editing.\n * Provides {@link https://en.wikipedia.org/wiki/Snapshot_isolation | snapshot-isolation} while editing.\n *\n * A Checkout always shows a consistent sequence of versions of the SharedTree, but it may skip intermediate versions, and may fall behind.\n * In this case consistent means the sequence of versions could occur with fully synchronous shared tree access,\n * though the timing of sequenced edits arriving to the Checkout may be later than they actually arrive in the SharedTree.\n * Specifically no sequenced edits will arrive during an ongoing edit (to implement snapshot isolation):\n * they will be applied asynchronously some time after the ongoing edit is ended.\n *\n * Events emitted by `Checkout` are documented in {@link CheckoutEvent}.\n * Exceptions thrown during event handling will be emitted as error events, which are automatically surfaced as error events on the\n * `SharedTree` used at construction time.\n * @alpha\n */\nexport abstract class Checkout extends EventEmitterWithErrorHandling<ICheckoutEvents> implements IDisposable {\n\t/**\n\t * The view of the latest committed revision.\n\t * Does not include changes from any open edits.\n\t *\n\t * When this changes, emitChange must be called.\n\t */\n\tprotected abstract get latestCommittedView(): RevisionView;\n\n\t/**\n\t * The last view for which invalidation was sent.\n\t * Updated by emitChange.\n\t */\n\tprivate previousView: TreeView;\n\n\t/**\n\t * A handler for 'committedEdit' SharedTreeEvent\n\t */\n\tprivate readonly editCommittedHandler: EditCommittedHandler;\n\n\t/**\n\t * The shared tree this checkout views/edits.\n\t */\n\tpublic readonly tree: SharedTree;\n\n\t/**\n\t * `tree`'s log viewer as a CachingLogViewer if it is one, otherwise undefined.\n\t * Used for optimizations if provided.\n\t */\n\tprivate readonly cachingLogViewer?: CachingLogViewer;\n\n\t/**\n\t * Holds the state required to manage the currently open edit.\n\t * Undefined if there is currently not an open edit.\n\t *\n\t * Since `currentView` exposes the the intermediate state from this edit,\n\t * operations that modify `currentEdit.view` must call `emitChange` to handle invalidation.\n\t */\n\tprivate currentEdit?: GenericTransaction;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic disposed: boolean = false;\n\n\tprotected constructor(tree: SharedTree, currentView: RevisionView, onEditCommitted: EditCommittedHandler) {\n\t\tsuper((_event, error: unknown) => {\n\t\t\tthis.tree.emit('error', error);\n\t\t});\n\t\tthis.tree = tree;\n\t\tthis.logger = createChildLogger({ logger: this.tree.logger, namespace: 'Checkout' });\n\t\tif (tree.logViewer instanceof CachingLogViewer) {\n\t\t\tthis.cachingLogViewer = tree.logViewer;\n\t\t}\n\t\tthis.previousView = currentView;\n\t\tthis.editCommittedHandler = onEditCommitted;\n\n\t\t// If there is an ongoing edit, emitChange will no-op, which is fine.\n\t\tthis.tree.on(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n\n\t/**\n\t * Gets the current view of the tree, including the result of changes applied so far during an edit.\n\t *\n\t * @remarks\n\t * Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.\n\t */\n\tpublic get currentView(): TreeView {\n\t\treturn this.currentEdit?.view ?? this.latestCommittedView;\n\t}\n\n\t/**\n\t * Whether there is currently an open edit operation.\n\t */\n\tpublic hasOpenEdit(): boolean {\n\t\treturn this.currentEdit !== undefined;\n\t}\n\n\t/**\n\t * Opens a new edit operation.\n\t * Changes accumulate in the edit via calls to `applyChanges()`.\n\t */\n\tpublic openEdit(): void {\n\t\tassert(this.currentEdit === undefined, 0x600 /* An edit is already open. */);\n\t\tthis.currentEdit = TransactionInternal.factory(this.latestCommittedView);\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation and commits it to the history.\n\t *\n\t * Malformed edits are considered an error, and will assert:\n\t * All named detached sequences must have been used or the Edit is malformed.\n\t *\n\t * @returns the `id` of the committed edit\n\t */\n\tpublic closeEdit(): EditId {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x601 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tassert(\n\t\t\tcurrentEdit.failure === undefined,\n\t\t\t0x66d /* Cannot close a transaction that has already failed. Use abortEdit instead. */\n\t\t);\n\n\t\tconst editingResult = currentEdit.close();\n\t\tthis.validateChangesApplied(editingResult);\n\t\tconst id: EditId = newEditId();\n\t\tthis.handleNewEdit(id, editingResult);\n\t\treturn id;\n\t}\n\n\tprivate validateChangesApplied(result: EditingResult): asserts result is ValidEditingResult;\n\tprivate validateChangesApplied(result: {\n\t\tstatus: EditStatus;\n\t\tfailure: TransactionInternal.Failure | undefined;\n\t}): asserts result is { status: EditStatus.Applied; failure: undefined };\n\tprivate validateChangesApplied(\n\t\tresult: EditingResult | { status: EditStatus; failure: TransactionInternal.Failure | undefined }\n\t): void {\n\t\tif (result.status === EditStatus.Applied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { failure } = result as { failure: TransactionInternal.Failure };\n\t\tconst additionalProps: ITelemetryBaseProperties = {};\n\t\tswitch (failure.kind) {\n\t\t\tcase TransactionInternal.FailureKind.BadPlace:\n\t\t\t\tadditionalProps.placeFailure = failure.placeFailure;\n\t\t\t\tbreak;\n\t\t\tcase TransactionInternal.FailureKind.BadRange: {\n\t\t\t\tconst { rangeFailure } = failure;\n\t\t\t\tif (typeof rangeFailure === 'string') {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure;\n\t\t\t\t} else {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure.kind;\n\t\t\t\t\tadditionalProps.rangeEndpointFailure = rangeFailure.placeFailure;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.logger.sendErrorEvent({\n\t\t\teventName: 'FailedLocalEdit',\n\t\t\tstatus: result.status === 0 ? 'Malformed' : 'Invalid',\n\t\t\tfailureKind: failure.kind,\n\t\t\t...additionalProps,\n\t\t});\n\t\tfail('Locally constructed edits must be well-formed and valid.');\n\t}\n\n\t/**\n\t * Inform the Checkout that a particular edit is know to have a specific result when applied to a particular TreeView.\n\t * This may be used as a caching hint to avoid recomputation.\n\t */\n\tprotected hintKnownEditingResult(edit: Edit<ChangeInternal>, result: ValidEditingResult): void {\n\t\t// As an optimization, inform logViewer of this editing result so it can reuse it if applied to the same before revision.\n\t\tthis.cachingLogViewer?.setKnownEditingResult(edit, result);\n\t}\n\n\t/**\n\t * Take any needed action between when an edit is completed.\n\t * Usually this will include submitting it to a SharedTree.\n\t *\n\t * Override this to customize.\n\t */\n\tprotected handleNewEdit(id: EditId, result: ValidEditingResult): void {\n\t\tconst edit: Edit<ChangeInternal> = { id, changes: result.changes };\n\n\t\tthis.hintKnownEditingResult(edit, result);\n\n\t\t// Since external edits could have been applied while currentEdit was pending,\n\t\t// do not use the produced view: just go to the newest revision\n\t\t// (which processLocalEdit will do, including invalidation).\n\t\tthis.tree.applyEditInternal(edit);\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tpublic applyChanges(changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: RestOrArray<Change>): void {\n\t\tassert(this.currentEdit !== undefined, 0x602 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tthis.validateChangesApplied({ status, failure: this.currentEdit.failure });\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tprotected tryApplyChangesInternal(changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: RestOrArray<ChangeInternal>): EditStatus {\n\t\tassert(this.currentEdit !== undefined, 0x603 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray);\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t}\n\t\treturn status;\n\t}\n\n\t/**\n\t * Convenience helper for applying an edit containing the given changes.\n\t * Opens an edit, applies the given changes, and closes the edit. See (`openEdit()`/`applyChanges()`/`closeEdit()`).\n\t */\n\tpublic applyEdit(changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: RestOrArray<Change>): EditId {\n\t\tthis.openEdit();\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tthis.applyChanges(changeArray);\n\t\treturn this.closeEdit();\n\t}\n\n\t/**\n\t * Apply an edit, if valid, otherwise does nothing (the edit is not added to the history).\n\t * If the edit applied, its changes will be immediately visible on this checkout, though it still may end up invalid once sequenced due to concurrent edits.\n\t * @returns The EditId if the edit was valid and thus applied, and undefined if it was invalid and thus not applied.\n\t */\n\tpublic tryApplyEdit(changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: RestOrArray<Change>): EditId | undefined {\n\t\tthis.openEdit();\n\n\t\tassert(this.currentEdit !== undefined, 0x604 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t\treturn this.closeEdit();\n\t\t}\n\n\t\tthis.abortEdit();\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Rebases the ongoing edit to the latest revision loaded by this 'Checkout'.\n\t *\n\t * If the rebase succeeds (none of the changes in the ongoing edit became invalid), the ongoing edit will remain open and the current\n\t * view will reflect those changes.\n\t *\n\t * If the rebase fails (changes become invalid), the ongoing edit will be aborted and\n\t * currentView will return to showing the newest committed revision as it always does when there is no ongoing edit.\n\t *\n\t * Must only be called during an open edit.\n\t *\n\t * @returns The result of the rebase.\n\t */\n\tpublic rebaseCurrentEdit(): EditValidationResult.Valid | EditValidationResult.Invalid {\n\t\tassert(this.currentEdit !== undefined, 0x605 /* An edit is not open. */);\n\t\tassert(this.currentEdit.status === EditStatus.Applied, 0x606 /* Local edits should always be valid. */);\n\t\t// When closed, the result might indicate Malformed due to unused detached entities.\n\t\t// This is not an error, as the edit was still open and can still use those entities.\n\t\tconst priorResults = this.currentEdit.close();\n\t\tconst rebasedEdit = TransactionInternal.factory(this.latestCommittedView).applyChanges(priorResults.changes);\n\t\tassert(\n\t\t\trebasedEdit.status !== EditStatus.Malformed,\n\t\t\t0x607 /* Malformed changes should have been caught on original application. */\n\t\t);\n\t\tlet status: EditValidationResult.Valid | EditValidationResult.Invalid;\n\t\tif (rebasedEdit.status === EditStatus.Invalid) {\n\t\t\tstatus = EditValidationResult.Invalid;\n\t\t\tthis.currentEdit = undefined;\n\t\t} else {\n\t\t\tstatus = EditValidationResult.Valid;\n\t\t\tthis.currentEdit = rebasedEdit;\n\t\t}\n\t\tthis.emitChange();\n\t\treturn status;\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation without committing it to the history.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic abortEdit(): void {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x608 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * Gets the {@link EditStatus} of the current edit.\n\t *\n\t * @remarks\n\t * Has no side effects.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic getEditStatus(): EditStatus {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x609 /* An edit is not open. */);\n\t\t// TODO: could this ever be anything other than 'Applied'\n\t\t// TODO: shouldn't this be an EditValidationResult since 'Applied' does not indicate the edit has been applied?\n\t\treturn currentEdit.status;\n\t}\n\n\t/**\n\t * Reverts a collection of edits.\n\t * @param editIds - the edits to revert\n\t */\n\tpublic revert(editId: EditId): void {\n\t\tassertWithMessage(this.currentEdit !== undefined);\n\t\tconst index = this.tree.edits.getIndexOfId(editId);\n\t\tconst edit =\n\t\t\tthis.tree.edits.tryGetEditAtIndex(index) ?? fail('Edit with the specified ID does not exist in memory');\n\t\tconst before = this.tree.logViewer.getRevisionViewInMemory(index);\n\t\tconst changes = this.tree.revertChanges(edit.changes, before);\n\t\tif (changes !== undefined) {\n\t\t\tthis.tryApplyChangesInternal(changes);\n\t\t}\n\t}\n\n\t/**\n\t * Send invalidation message for all changes since last call to emitChange.\n\t * This must be called every time `currentView` could have changed.\n\t * It is ok to make excessive calls to this: change notifications will be cheaply de-duplicated.\n\t */\n\tprotected emitChange(): void {\n\t\tconst current = this.currentView;\n\t\tconst previous = this.previousView;\n\t\tif (!previous.hasEqualForest(current, true)) {\n\t\t\t// Set previousView before calling emit to make reentrant case work (where the event handler causes an edit).\n\t\t\tthis.previousView = current;\n\t\t\tthis.emit(CheckoutEvent.ViewChange, previous, current);\n\t\t}\n\t}\n\n\t/**\n\t * @returns a Promise which completes after all currently known edits are available in this checkout.\n\t */\n\tpublic abstract waitForPendingUpdates(): Promise<void>;\n\n\t/**\n\t * @returns a Promise which completes after edits that were closed on this checkout (before calling this) have been\n\t * submitted to Fluid. This does NOT wait for the Fluid service to ack them\n\t */\n\tpublic abstract waitForEditsToSubmit(): Promise<void>;\n\n\t/**\n\t * release all unmanaged resources\n\t * e.g. unregister event listeners\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\n\t\t// remove registered listener\n\t\tthis.tree.off(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Common.d.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,GAAG,SAAS,gBAAgB,CAAC,EAAE,CAAC,EACnE,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,GAAG,GACT,KAAK,IAAI,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,CAEhC;AACD;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,SAAS,gBAAgB,CAAC,EAAE,CAAC,EAC5D,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,GAAG,GACT,KAAK,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAE7C;AAED;;;;GAIG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,SAAS,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AAE3D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAEtG"}
package/dist/Common.js CHANGED
@@ -316,6 +316,8 @@ function setPropertyIfDefined(value, destination, property) {
316
316
  }
317
317
  exports.setPropertyIfDefined = setPropertyIfDefined;
318
318
  /**
319
+ * Returns an object indicating that iteration should break due to finding a difference.
320
+ *
319
321
  * @example
320
322
  *
321
323
  * ```typescript