@fluid-experimental/tree 0.59.4001 → 1.1.0-75972

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 (77) hide show
  1. package/dist/EditLog.d.ts.map +1 -1
  2. package/dist/EditLog.js +4 -7
  3. package/dist/EditLog.js.map +1 -1
  4. package/dist/LogViewer.d.ts.map +1 -1
  5. package/dist/LogViewer.js +1 -7
  6. package/dist/LogViewer.js.map +1 -1
  7. package/dist/SharedTree.d.ts +89 -30
  8. package/dist/SharedTree.d.ts.map +1 -1
  9. package/dist/SharedTree.js +97 -62
  10. package/dist/SharedTree.js.map +1 -1
  11. package/dist/SharedTreeEncoder.d.ts +1 -1
  12. package/dist/SharedTreeEncoder.d.ts.map +1 -1
  13. package/dist/SharedTreeEncoder.js +6 -12
  14. package/dist/SharedTreeEncoder.js.map +1 -1
  15. package/dist/TransactionInternal.d.ts.map +1 -1
  16. package/dist/TransactionInternal.js +4 -7
  17. package/dist/TransactionInternal.js.map +1 -1
  18. package/dist/id-compressor/IdCompressor.d.ts +3 -1
  19. package/dist/id-compressor/IdCompressor.d.ts.map +1 -1
  20. package/dist/id-compressor/IdCompressor.js +45 -17
  21. package/dist/id-compressor/IdCompressor.js.map +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js.map +1 -1
  25. package/lib/EditLog.d.ts.map +1 -1
  26. package/lib/EditLog.js +4 -7
  27. package/lib/EditLog.js.map +1 -1
  28. package/lib/LogViewer.d.ts.map +1 -1
  29. package/lib/LogViewer.js +1 -7
  30. package/lib/LogViewer.js.map +1 -1
  31. package/lib/SharedTree.d.ts +89 -30
  32. package/lib/SharedTree.d.ts.map +1 -1
  33. package/lib/SharedTree.js +98 -63
  34. package/lib/SharedTree.js.map +1 -1
  35. package/lib/SharedTreeEncoder.d.ts +1 -1
  36. package/lib/SharedTreeEncoder.d.ts.map +1 -1
  37. package/lib/SharedTreeEncoder.js +6 -12
  38. package/lib/SharedTreeEncoder.js.map +1 -1
  39. package/lib/TransactionInternal.d.ts.map +1 -1
  40. package/lib/TransactionInternal.js +4 -7
  41. package/lib/TransactionInternal.js.map +1 -1
  42. package/lib/id-compressor/IdCompressor.d.ts +3 -1
  43. package/lib/id-compressor/IdCompressor.d.ts.map +1 -1
  44. package/lib/id-compressor/IdCompressor.js +45 -17
  45. package/lib/id-compressor/IdCompressor.js.map +1 -1
  46. package/lib/index.d.ts +1 -1
  47. package/lib/index.d.ts.map +1 -1
  48. package/lib/index.js.map +1 -1
  49. package/lib/test/MergeHealthTelemetryHeartbeat.tests.js +1 -1
  50. package/lib/test/MergeHealthTelemetryHeartbeat.tests.js.map +1 -1
  51. package/lib/test/SessionIdNormalizer.tests.js +4 -6
  52. package/lib/test/SessionIdNormalizer.tests.js.map +1 -1
  53. package/lib/test/Summary.tests.js +3 -6
  54. package/lib/test/Summary.tests.js.map +1 -1
  55. package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -1
  56. package/lib/test/fuzz/SharedTreeFuzzTests.js +3 -1
  57. package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -1
  58. package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
  59. package/lib/test/utilities/SharedTreeTests.js +59 -60
  60. package/lib/test/utilities/SharedTreeTests.js.map +1 -1
  61. package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -1
  62. package/lib/test/utilities/SharedTreeVersioningTests.js +19 -19
  63. package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -1
  64. package/lib/test/utilities/TestNode.d.ts.map +1 -1
  65. package/lib/test/utilities/TestNode.js +2 -12
  66. package/lib/test/utilities/TestNode.js.map +1 -1
  67. package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
  68. package/lib/test/utilities/TestUtilities.js +11 -11
  69. package/lib/test/utilities/TestUtilities.js.map +1 -1
  70. package/package.json +19 -32
  71. package/src/EditLog.ts +21 -23
  72. package/src/LogViewer.ts +1 -6
  73. package/src/SharedTree.ts +200 -50
  74. package/src/SharedTreeEncoder.ts +7 -18
  75. package/src/TransactionInternal.ts +11 -13
  76. package/src/id-compressor/IdCompressor.ts +46 -15
  77. package/src/index.ts +4 -0
@@ -7,7 +7,7 @@ import { IFluidSerializer, ISharedObjectEvents, SharedObject } from '@fluidframe
7
7
  import { ITelemetryLogger, ITelemetryProperties } from '@fluidframework/common-definitions';
8
8
  import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
9
9
  import { OrderedEditSet } from './EditLog';
10
- import { EditId, NodeId, StableNodeId } from './Identifiers';
10
+ import { EditId, NodeId, StableNodeId, AttributionId } from './Identifiers';
11
11
  import { LogViewer } from './LogViewer';
12
12
  import { ReconciliationPath } from './ReconciliationPath';
13
13
  import { ChangeInternal, Edit, EditStatus, SharedTreeSummaryBase, WriteFormat, InternalizedChange } from './persisted-types';
@@ -15,15 +15,68 @@ import { NodeIdContext } from './NodeIdUtilities';
15
15
  import { RevisionView } from './RevisionView';
16
16
  import { Change } from './ChangeTypes';
17
17
  import { TransactionInternal } from './TransactionInternal';
18
+ /**
19
+ * The write format and associated options used to construct a `SharedTree`
20
+ * @public
21
+ */
22
+ export declare type SharedTreeArgs<WF extends WriteFormat = WriteFormat> = [writeFormat: WF, options?: SharedTreeOptions<WF>];
23
+ /**
24
+ * The type of shared tree options for a given write format
25
+ * @public
26
+ */
27
+ export declare type SharedTreeOptions<WF extends WriteFormat, HistoryCompatibility extends 'Forwards' | 'None' = 'Forwards'> = Omit<WF extends WriteFormat.v0_0_2 ? SharedTreeOptions_0_0_2 : WF extends WriteFormat.v0_1_1 ? SharedTreeOptions_0_1_1 : never, HistoryCompatibility extends 'Forwards' ? 'summarizeHistory' : never>;
28
+ /**
29
+ * Configuration options for a SharedTree with write format 0.0.2
30
+ * @public
31
+ */
32
+ export interface SharedTreeOptions_0_0_2 {
33
+ /**
34
+ * Determines if the history is included in summaries.
35
+ *
36
+ * Warning: enabling history summarization incurs a permanent cost in the document. It is not possible to disable history summarization
37
+ * later once it has been enabled, and thus the history cannot be safely deleted.
38
+ *
39
+ * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
40
+ * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
41
+ *
42
+ * The technical limitations here relate to clients with mixed versions collaborating.
43
+ * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
44
+ * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
45
+ * See docs/Breaking-Change-Migration for more details on the consensus scheme.
46
+ */
47
+ summarizeHistory?: boolean;
48
+ }
49
+ /**
50
+ * Configuration options for a SharedTree with write format 0.1.1
51
+ * @public
52
+ */
53
+ export interface SharedTreeOptions_0_1_1 {
54
+ /**
55
+ * Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
56
+ *
57
+ * Warning: enabling history summarization incurs a permanent cost in the document. It is not possible to disable history summarization
58
+ * later once it has been enabled, and thus the history cannot be safely deleted.
59
+ *
60
+ * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
61
+ * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
62
+ *
63
+ * The technical limitations here relate to clients with mixed versions collaborating.
64
+ * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
65
+ * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
66
+ * See docs/Breaking-Change-Migration for more details on the consensus scheme.
67
+ */
68
+ summarizeHistory?: false | {
69
+ uploadEditChunks: boolean;
70
+ };
71
+ /** a UUID that identifies the user of this tree; all node IDs generated by this tree will be associated with this UUID */
72
+ attributionId?: AttributionId;
73
+ }
18
74
  /**
19
75
  * Factory for SharedTree.
20
76
  * Includes history in the summary.
21
77
  * @public
22
78
  */
23
79
  export declare class SharedTreeFactory implements IChannelFactory {
24
- private readonly writeFormat;
25
- private readonly summarizeHistory;
26
- private expensiveValidation;
27
80
  /**
28
81
  * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
29
82
  */
@@ -32,18 +85,16 @@ export declare class SharedTreeFactory implements IChannelFactory {
32
85
  * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
33
86
  */
34
87
  static Attributes: IChannelAttributes;
88
+ private readonly args;
35
89
  /**
36
90
  * Get a factory for SharedTree to register with the data store.
37
91
  * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
38
92
  * documentation](../docs/Write-Format.md) for more information.
39
- * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
40
- * See the [breaking change migration documentation](docs/Breaking-Change-Migration) for more details on this scheme.
41
- * @param expensiveValidation - Enables expensive asserts on SharedTree.
93
+ * @param options - Configuration options for this tree
42
94
  * @returns A factory that creates `SharedTree`s and loads them from storage.
43
95
  */
44
- constructor(writeFormat: WriteFormat, summarizeHistory?: false | {
45
- uploadEditChunks: boolean;
46
- }, expensiveValidation?: boolean);
96
+ constructor(...args: SharedTreeArgs<WriteFormat.v0_0_2>);
97
+ constructor(...args: SharedTreeArgs<WriteFormat.v0_1_1>);
47
98
  /**
48
99
  * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
49
100
  */
@@ -61,7 +112,7 @@ export declare class SharedTreeFactory implements IChannelFactory {
61
112
  * @param runtime - data store runtime that owns the new SharedTree
62
113
  * @param id - optional name for the SharedTree
63
114
  */
64
- create(runtime: IFluidDataStoreRuntime, id: string, expensiveValidation?: boolean): SharedTree;
115
+ create(runtime: IFluidDataStoreRuntime, id: string): SharedTree;
65
116
  private createSharedTree;
66
117
  }
67
118
  /**
@@ -141,33 +192,30 @@ export declare type SequencedEditAppliedHandler = (args: SequencedEditAppliedEve
141
192
  */
142
193
  export declare class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeIdContext {
143
194
  private writeFormat;
144
- private readonly expensiveValidation;
145
195
  /**
146
196
  * Create a new SharedTree. It will contain the default value (see initialTree).
147
197
  */
148
198
  static create(runtime: IFluidDataStoreRuntime, id?: string): SharedTree;
149
199
  /**
150
200
  * Get a factory for SharedTree to register with the data store.
151
- * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
152
- *
153
- * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
154
- * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
155
- *
156
- * The technical limitations here relate to clients with mixed versions collaborating.
157
- * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
158
- * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
159
- * See docs/Breaking-Change-Migration for more details on the consensus scheme.
160
201
  * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in.
161
202
  * This format may be updated to a newer (supported) version at runtime if a collaborating shared-tree
162
203
  * that was initialized with a newer write version connects to the session. Care must be taken when changing this value,
163
204
  * as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version
164
205
  * written.
165
206
  * See [the write format documentation](../docs/Write-Format.md) for more information.
207
+ * @param options - Configuration options for this tree
166
208
  * @returns A factory that creates `SharedTree`s and loads them from storage.
167
209
  */
168
- static getFactory(writeFormat: WriteFormat, summarizeHistory?: false | {
169
- uploadEditChunks: boolean;
170
- }): SharedTreeFactory;
210
+ static getFactory(...args: SharedTreeArgs<WriteFormat.v0_0_2>): SharedTreeFactory;
211
+ static getFactory(...args: SharedTreeArgs<WriteFormat.v0_1_1>): SharedTreeFactory;
212
+ /**
213
+ * The UUID used for attribution of nodes created by this SharedTree. All shared trees with a write format of 0.1.1 or
214
+ * greater have a unique attribution ID which may be configured in the constructor. All other shared trees (i.e. those
215
+ * with a write format of 0.0.2) use the nil UUID as their attribution ID.
216
+ * @public
217
+ */
218
+ get attributionId(): AttributionId;
171
219
  private idCompressor;
172
220
  private readonly idNormalizer;
173
221
  private interner;
@@ -195,18 +243,22 @@ export declare class SharedTree extends SharedObject<ISharedTreeEvents> implemen
195
243
  private readonly processSequencedEditResult;
196
244
  private summarizeHistory;
197
245
  private uploadEditChunks;
246
+ private getHistoryPolicy;
198
247
  /**
199
- * Create a new SharedTreeFactory.
248
+ * Create a new SharedTree.
200
249
  * @param runtime - The runtime the SharedTree will be associated with
201
250
  * @param id - Unique ID for the SharedTree
202
251
  * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
203
252
  * documentation](../docs/Write-Format.md) for more information.
204
- * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
205
- * @param expensiveValidation - Enable expensive asserts.
253
+ * @param options - Configuration options for this tree
254
+ */
255
+ constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_0_2>);
256
+ constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_1_1>);
257
+ /**
258
+ * The write format version currently used by this `SharedTree`. This is always initialized to the write format
259
+ * passed to the tree's constructor, but it may automatically upgrade over time (e.g. when connected to another
260
+ * SharedTree with a higher write format, or when loading a summary with a higher write format).
206
261
  */
207
- constructor(runtime: IFluidDataStoreRuntime, id: string, writeFormat: WriteFormat, summarizeHistory?: false | {
208
- uploadEditChunks: boolean;
209
- }, expensiveValidation?: boolean);
210
262
  getWriteFormat(): WriteFormat;
211
263
  /**
212
264
  * Re-computes currentIsOldest and emits an event if it has changed.
@@ -268,6 +320,13 @@ export declare class SharedTree extends SharedObject<ISharedTreeEvents> implemen
268
320
  * @public
269
321
  */
270
322
  tryConvertToNodeId(id: StableNodeId): NodeId | undefined;
323
+ /**
324
+ * Returns the attribution ID associated with the SharedTree that generated the given node ID. This is generally only useful for clients
325
+ * with a write format of 0.1.1 or greater since older clients cannot be given an attribution ID and will always use the default
326
+ * `attributionId` of the tree.
327
+ * @public
328
+ */
329
+ attributeNodeId(id: NodeId): AttributionId;
271
330
  /**
272
331
  * @returns the edit history of the tree.
273
332
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"SharedTree.d.ts","sourceRoot":"","sources":["../src/SharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA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,MAAM,GAAG,MAAM,GAAG,SAAS;IAYjD;;;;;;OAMG;IACI,aAAa,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,EAAE,MAAM,EAAE,YAAY,GAAG,cAAc,EAAE,GAAG,SAAS;IAIhH;;OAEG;IACH,OAAO,CAAC,YAAY;IAyBpB,OAAO,CAAC,aAAa;IAIrB,oEAAoE;IACpE,OAAO,CAAC,QAAQ;IAQT,UAAU,IAAI,sBAAsB;IAI3C;;;;;;;;;OASG;IACH,SAAS,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI;IA6C3C,OAAO,CAAC,iBAAiB;IAKzB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;CAuB7B"}
package/lib/SharedTree.js CHANGED
@@ -8,7 +8,7 @@ import { createSingleBlobSummary, serializeHandles, SharedObject, } from '@fluid
8
8
  import { ChildLogger, PerformanceEvent } from '@fluidframework/telemetry-utils';
9
9
  import { assert, assertNotUndefined, fail, copyPropertyIfDefined, noop } from './Common';
10
10
  import { EditLog, getNumberOfHandlesFromEditLogSummary } from './EditLog';
11
- import { isDetachedSequenceId } from './Identifiers';
11
+ import { isDetachedSequenceId, } from './Identifiers';
12
12
  import { initialTree } from './InitialTree';
13
13
  import { CachingLogViewer, } from './LogViewer';
14
14
  import { deserialize, getSummaryStatistics } from './SummaryBackCompatibility';
@@ -24,25 +24,15 @@ import { ChangeType } from './ChangeTypes';
24
24
  import { IdCompressor, createSessionId } from './id-compressor';
25
25
  import { convertEditIds } from './IdConversion';
26
26
  import { MutableStringInterner } from './StringInterner';
27
+ import { nilUuid } from './UuidUtilities';
27
28
  /**
28
29
  * Factory for SharedTree.
29
30
  * Includes history in the summary.
30
31
  * @public
31
32
  */
32
33
  export class SharedTreeFactory {
33
- /**
34
- * Get a factory for SharedTree to register with the data store.
35
- * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
36
- * documentation](../docs/Write-Format.md) for more information.
37
- * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
38
- * See the [breaking change migration documentation](docs/Breaking-Change-Migration) for more details on this scheme.
39
- * @param expensiveValidation - Enables expensive asserts on SharedTree.
40
- * @returns A factory that creates `SharedTree`s and loads them from storage.
41
- */
42
- constructor(writeFormat, summarizeHistory = false, expensiveValidation = false) {
43
- this.writeFormat = writeFormat;
44
- this.summarizeHistory = summarizeHistory;
45
- this.expensiveValidation = expensiveValidation;
34
+ constructor(...args) {
35
+ this.args = args;
46
36
  }
47
37
  /**
48
38
  * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
@@ -69,15 +59,21 @@ export class SharedTreeFactory {
69
59
  * @param runtime - data store runtime that owns the new SharedTree
70
60
  * @param id - optional name for the SharedTree
71
61
  */
72
- create(runtime, id, expensiveValidation = false) {
73
- this.expensiveValidation = expensiveValidation;
62
+ create(runtime, id) {
74
63
  const sharedTree = this.createSharedTree(runtime, id);
75
64
  sharedTree.initializeLocal();
76
65
  return sharedTree;
77
66
  }
78
67
  createSharedTree(runtime, id) {
79
- const sharedTree = new SharedTree(runtime, id, this.writeFormat, this.summarizeHistory, this.expensiveValidation);
80
- return sharedTree;
68
+ const [writeFormat] = this.args;
69
+ switch (writeFormat) {
70
+ case WriteFormat.v0_0_2:
71
+ return new SharedTree(runtime, id, ...this.args);
72
+ case WriteFormat.v0_1_1:
73
+ return new SharedTree(runtime, id, ...this.args);
74
+ default:
75
+ fail('Unknown write format');
76
+ }
81
77
  }
82
78
  }
83
79
  /**
@@ -106,20 +102,9 @@ const sharedTreeTelemetryProperties = { all: { isSharedTreeEvent: true } };
106
102
  * @public
107
103
  */
108
104
  export class SharedTree extends SharedObject {
109
- /**
110
- * Create a new SharedTreeFactory.
111
- * @param runtime - The runtime the SharedTree will be associated with
112
- * @param id - Unique ID for the SharedTree
113
- * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
114
- * documentation](../docs/Write-Format.md) for more information.
115
- * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
116
- * @param expensiveValidation - Enable expensive asserts.
117
- */
118
- constructor(runtime, id, writeFormat, summarizeHistory = false, expensiveValidation = false) {
119
- super(id, runtime, SharedTreeFactory.Attributes);
105
+ constructor(runtime, id, writeFormat, options = {}) {
106
+ super(id, runtime, SharedTreeFactory.Attributes, 'fluid_sharedTree_');
120
107
  this.writeFormat = writeFormat;
121
- this.expensiveValidation = expensiveValidation;
122
- this.idCompressor = new IdCompressor(createSessionId(), reservedIdCount);
123
108
  this.idNormalizer = {
124
109
  tree: this,
125
110
  get localSessionId() {
@@ -162,8 +147,9 @@ export class SharedTree extends SharedObject {
162
147
  }
163
148
  }
164
149
  };
165
- this.summarizeHistory = summarizeHistory === false ? false : true;
166
- this.uploadEditChunks = summarizeHistory === false ? false : summarizeHistory.uploadEditChunks;
150
+ const historyPolicy = this.getHistoryPolicy(options);
151
+ this.summarizeHistory = historyPolicy.summarizeHistory;
152
+ this.uploadEditChunks = historyPolicy.uploadEditChunks;
167
153
  // This code is somewhat duplicated from OldestClientObserver because it currently depends on the container runtime
168
154
  // which SharedTree does not have access to.
169
155
  // TODO:#55900: Get rid of copy-pasted OldestClientObserver code
@@ -175,11 +161,12 @@ export class SharedTree extends SharedObject {
175
161
  runtime.on('disconnected', this.updateOldest);
176
162
  this.logger = ChildLogger.create(runtime.logger, 'SharedTree', sharedTreeTelemetryProperties);
177
163
  this.sequencedEditAppliedLogger = ChildLogger.create(this.logger, 'SequencedEditApplied', sharedTreeTelemetryProperties);
164
+ const attributionId = options.attributionId;
165
+ this.idCompressor = new IdCompressor(createSessionId(), reservedIdCount, attributionId, this.logger);
178
166
  const { editLog, cachingLogViewer } = this.initializeNewEditLogFromSummary({
179
167
  editChunks: [],
180
168
  editIds: [],
181
- }, undefined, this.idCompressor, // TODO: Attribution info
182
- this.processEditResult, this.processSequencedEditResult, WriteFormat.v0_1_1);
169
+ }, undefined, this.idCompressor, this.processEditResult, this.processSequencedEditResult, WriteFormat.v0_1_1);
183
170
  this.editLog = editLog;
184
171
  this.cachingLogViewer = cachingLogViewer;
185
172
  this.encoder_0_0_2 = new SharedTreeEncoder_0_0_2(this.summarizeHistory);
@@ -191,31 +178,39 @@ export class SharedTree extends SharedObject {
191
178
  static create(runtime, id) {
192
179
  return runtime.createChannel(id, SharedTreeFactory.Type);
193
180
  }
194
- /**
195
- * Get a factory for SharedTree to register with the data store.
196
- * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
197
- *
198
- * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
199
- * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
200
- *
201
- * The technical limitations here relate to clients with mixed versions collaborating.
202
- * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
203
- * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
204
- * See docs/Breaking-Change-Migration for more details on the consensus scheme.
205
- * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in.
206
- * This format may be updated to a newer (supported) version at runtime if a collaborating shared-tree
207
- * that was initialized with a newer write version connects to the session. Care must be taken when changing this value,
208
- * as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version
209
- * written.
210
- * See [the write format documentation](../docs/Write-Format.md) for more information.
211
- * @returns A factory that creates `SharedTree`s and loads them from storage.
212
- */
213
- static getFactory(writeFormat, summarizeHistory = false) {
181
+ static getFactory(...args) {
182
+ const [writeFormat] = args;
214
183
  // On 0.1.1 documents, due to current code limitations, all clients MUST agree on the value of `summarizeHistory`.
215
184
  // Note that this means staged rollout changing this value should not be attempted.
216
185
  // It is possible to update shared-tree to correctly handle such a staged rollout, but that hasn't been implemented.
217
186
  // See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
218
- return new SharedTreeFactory(writeFormat, summarizeHistory);
187
+ switch (writeFormat) {
188
+ case WriteFormat.v0_0_2:
189
+ return new SharedTreeFactory(...args);
190
+ case WriteFormat.v0_1_1:
191
+ return new SharedTreeFactory(...args);
192
+ default:
193
+ fail('Unknown write format');
194
+ }
195
+ }
196
+ /**
197
+ * The UUID used for attribution of nodes created by this SharedTree. All shared trees with a write format of 0.1.1 or
198
+ * greater have a unique attribution ID which may be configured in the constructor. All other shared trees (i.e. those
199
+ * with a write format of 0.0.2) use the nil UUID as their attribution ID.
200
+ * @public
201
+ */
202
+ get attributionId() {
203
+ switch (this.writeFormat) {
204
+ case WriteFormat.v0_0_2:
205
+ return nilUuid;
206
+ default: {
207
+ const { attributionId } = this.idCompressor;
208
+ if (attributionId === ghostSessionId) {
209
+ return nilUuid;
210
+ }
211
+ return attributionId;
212
+ }
213
+ }
219
214
  }
220
215
  /**
221
216
  * Viewer for trees defined by editLog. This allows access to views of the tree at different revisions (various points in time).
@@ -223,6 +218,24 @@ export class SharedTree extends SharedObject {
223
218
  get logViewer() {
224
219
  return this.cachingLogViewer;
225
220
  }
221
+ getHistoryPolicy(options) {
222
+ var _a;
223
+ const noCompatOptions = options;
224
+ return typeof noCompatOptions.summarizeHistory === 'object'
225
+ ? {
226
+ summarizeHistory: true,
227
+ uploadEditChunks: noCompatOptions.summarizeHistory.uploadEditChunks,
228
+ }
229
+ : {
230
+ summarizeHistory: (_a = noCompatOptions.summarizeHistory) !== null && _a !== void 0 ? _a : false,
231
+ uploadEditChunks: false,
232
+ };
233
+ }
234
+ /**
235
+ * The write format version currently used by this `SharedTree`. This is always initialized to the write format
236
+ * passed to the tree's constructor, but it may automatically upgrade over time (e.g. when connected to another
237
+ * SharedTree with a higher write format, or when loading a summary with a higher write format).
238
+ */
226
239
  getWriteFormat() {
227
240
  return this.writeFormat;
228
241
  }
@@ -319,6 +332,25 @@ export class SharedTree extends SharedObject {
319
332
  tryConvertToNodeId(id) {
320
333
  return this.idCompressor.tryRecompress(id);
321
334
  }
335
+ /**
336
+ * Returns the attribution ID associated with the SharedTree that generated the given node ID. This is generally only useful for clients
337
+ * with a write format of 0.1.1 or greater since older clients cannot be given an attribution ID and will always use the default
338
+ * `attributionId` of the tree.
339
+ * @public
340
+ */
341
+ attributeNodeId(id) {
342
+ switch (this.writeFormat) {
343
+ case WriteFormat.v0_0_2:
344
+ return nilUuid;
345
+ default: {
346
+ const attributionId = this.idCompressor.attributeId(id);
347
+ if (attributionId === ghostSessionId) {
348
+ return nilUuid;
349
+ }
350
+ return attributionId;
351
+ }
352
+ }
353
+ }
322
354
  /**
323
355
  * @returns the edit history of the tree.
324
356
  * @public
@@ -465,7 +497,7 @@ export class SharedTree extends SharedObject {
465
497
  let convertedSummary;
466
498
  switch (loadedSummaryVersion) {
467
499
  case WriteFormat.v0_0_2:
468
- convertedSummary = this.encoder_0_0_2.decodeSummary(summary);
500
+ convertedSummary = this.encoder_0_0_2.decodeSummary(summary, this.attributionId);
469
501
  break;
470
502
  case WriteFormat.v0_1_1: {
471
503
  const typedSummary = summary;
@@ -476,7 +508,7 @@ export class SharedTree extends SharedObject {
476
508
  this.uploadEditChunks = loadedSummaryIncludesHistory;
477
509
  this.encoder_0_1_1 = new SharedTreeEncoder_0_1_1(this.summarizeHistory);
478
510
  }
479
- convertedSummary = this.encoder_0_1_1.decodeSummary(summary); // TODO:#461: pass attribution info
511
+ convertedSummary = this.encoder_0_1_1.decodeSummary(summary, this.attributionId);
480
512
  break;
481
513
  }
482
514
  default:
@@ -618,9 +650,12 @@ export class SharedTree extends SharedObject {
618
650
  const typedMessage = message;
619
651
  this.cachingLogViewer.setMinimumSequenceNumber(typedMessage.minimumSequenceNumber);
620
652
  const op = typedMessage.contents;
653
+ if (op.version === undefined) {
654
+ // Back-compat: some legacy documents may contain trailing ops with an unstamped version; normalize them.
655
+ op.version = WriteFormat.v0_0_2;
656
+ }
621
657
  const { type, version } = op;
622
- const resolvedVersion = version !== null && version !== void 0 ? version : WriteFormat.v0_0_2;
623
- const sameVersion = resolvedVersion === this.writeFormat;
658
+ const sameVersion = version === this.writeFormat;
624
659
  // Edit and handle ops should only be processed if they're the same version as the tree write version.
625
660
  // Update ops should only be processed if they're not the same version.
626
661
  if (sameVersion) {
@@ -651,7 +686,7 @@ export class SharedTree extends SharedObject {
651
686
  else if (type === SharedTreeOpType.Update) {
652
687
  this.processVersionUpdate(op.version);
653
688
  }
654
- else if (compareSummaryFormatVersions(resolvedVersion, this.writeFormat) === 1) {
689
+ else if (compareSummaryFormatVersions(version, this.writeFormat) === 1) {
655
690
  // An op version newer than our current version should not be received. If this happens, either an
656
691
  // incorrect op version has been written or an update op was skipped.
657
692
  const error = 'Newer op version received by a client that has yet to be updated.';
@@ -764,7 +799,7 @@ export class SharedTree extends SharedObject {
764
799
  this.interner = new MutableStringInterner([initialTree.definition]);
765
800
  const oldIdCompressor = this.idCompressor;
766
801
  // Create the IdCompressor that will be used after the upgrade
767
- const newIdCompressor = new IdCompressor(createSessionId(), reservedIdCount); // TODO: attribution info
802
+ const newIdCompressor = new IdCompressor(createSessionId(), reservedIdCount, this.attributionId, this.logger);
768
803
  const newContext = getNodeIdContext(newIdCompressor);
769
804
  // Generate all local IDs in the new compressor that were in the old compressor and preserve their UUIDs.
770
805
  // This will allow the client to continue to use local IDs that were allocated pre-upgrade
@@ -778,7 +813,7 @@ export class SharedTree extends SharedObject {
778
813
  }
779
814
  };
780
815
  // Construct a temporary "ghost" compressor which is used to generate final IDs that will be consistent across all upgrading clients
781
- const ghostIdCompressor = new IdCompressor(ghostSessionId, reservedIdCount); // TODO: attribution info
816
+ const ghostIdCompressor = new IdCompressor(ghostSessionId, reservedIdCount);
782
817
  const ghostContext = getNodeIdContext(ghostIdCompressor);
783
818
  if (this.summarizeHistory) {
784
819
  // All clients have the full history, and can therefore all "generate" the same final IDs for every ID in the history