@fluid-experimental/tree 0.59.3000 → 0.59.3003

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 (36) hide show
  1. package/dist/SharedTree.d.ts +30 -89
  2. package/dist/SharedTree.d.ts.map +1 -1
  3. package/dist/SharedTree.js +58 -93
  4. package/dist/SharedTree.js.map +1 -1
  5. package/dist/SharedTreeEncoder.d.ts +1 -1
  6. package/dist/SharedTreeEncoder.d.ts.map +1 -1
  7. package/dist/SharedTreeEncoder.js.map +1 -1
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js.map +1 -1
  11. package/lib/SharedTree.d.ts +30 -89
  12. package/lib/SharedTree.d.ts.map +1 -1
  13. package/lib/SharedTree.js +59 -94
  14. package/lib/SharedTree.js.map +1 -1
  15. package/lib/SharedTreeEncoder.d.ts +1 -1
  16. package/lib/SharedTreeEncoder.d.ts.map +1 -1
  17. package/lib/SharedTreeEncoder.js.map +1 -1
  18. package/lib/index.d.ts +1 -1
  19. package/lib/index.d.ts.map +1 -1
  20. package/lib/index.js.map +1 -1
  21. package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -1
  22. package/lib/test/fuzz/SharedTreeFuzzTests.js +1 -3
  23. package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -1
  24. package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
  25. package/lib/test/utilities/SharedTreeTests.js +50 -27
  26. package/lib/test/utilities/SharedTreeTests.js.map +1 -1
  27. package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -1
  28. package/lib/test/utilities/SharedTreeVersioningTests.js +19 -19
  29. package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -1
  30. package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
  31. package/lib/test/utilities/TestUtilities.js +6 -4
  32. package/lib/test/utilities/TestUtilities.js.map +1 -1
  33. package/package.json +15 -15
  34. package/src/SharedTree.ts +46 -195
  35. package/src/SharedTreeEncoder.ts +1 -1
  36. package/src/index.ts +0 -4
@@ -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, AttributionId } from './Identifiers';
10
+ import { EditId, NodeId, StableNodeId } 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,68 +15,15 @@ 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
- }
74
18
  /**
75
19
  * Factory for SharedTree.
76
20
  * Includes history in the summary.
77
21
  * @public
78
22
  */
79
23
  export declare class SharedTreeFactory implements IChannelFactory {
24
+ private readonly writeFormat;
25
+ private readonly summarizeHistory;
26
+ private expensiveValidation;
80
27
  /**
81
28
  * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
82
29
  */
@@ -85,16 +32,18 @@ export declare class SharedTreeFactory implements IChannelFactory {
85
32
  * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
86
33
  */
87
34
  static Attributes: IChannelAttributes;
88
- private readonly args;
89
35
  /**
90
36
  * Get a factory for SharedTree to register with the data store.
91
37
  * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
92
38
  * documentation](../docs/Write-Format.md) for more information.
93
- * @param options - Configuration options for this tree
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.
94
42
  * @returns A factory that creates `SharedTree`s and loads them from storage.
95
43
  */
96
- constructor(...args: SharedTreeArgs<WriteFormat.v0_0_2>);
97
- constructor(...args: SharedTreeArgs<WriteFormat.v0_1_1>);
44
+ constructor(writeFormat: WriteFormat, summarizeHistory?: false | {
45
+ uploadEditChunks: boolean;
46
+ }, expensiveValidation?: boolean);
98
47
  /**
99
48
  * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
100
49
  */
@@ -112,7 +61,7 @@ export declare class SharedTreeFactory implements IChannelFactory {
112
61
  * @param runtime - data store runtime that owns the new SharedTree
113
62
  * @param id - optional name for the SharedTree
114
63
  */
115
- create(runtime: IFluidDataStoreRuntime, id: string): SharedTree;
64
+ create(runtime: IFluidDataStoreRuntime, id: string, expensiveValidation?: boolean): SharedTree;
116
65
  private createSharedTree;
117
66
  }
118
67
  /**
@@ -192,30 +141,33 @@ export declare type SequencedEditAppliedHandler = (args: SequencedEditAppliedEve
192
141
  */
193
142
  export declare class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeIdContext {
194
143
  private writeFormat;
144
+ private readonly expensiveValidation;
195
145
  /**
196
146
  * Create a new SharedTree. It will contain the default value (see initialTree).
197
147
  */
198
148
  static create(runtime: IFluidDataStoreRuntime, id?: string): SharedTree;
199
149
  /**
200
150
  * 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.
201
160
  * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in.
202
161
  * This format may be updated to a newer (supported) version at runtime if a collaborating shared-tree
203
162
  * that was initialized with a newer write version connects to the session. Care must be taken when changing this value,
204
163
  * as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version
205
164
  * written.
206
165
  * See [the write format documentation](../docs/Write-Format.md) for more information.
207
- * @param options - Configuration options for this tree
208
166
  * @returns A factory that creates `SharedTree`s and loads them from storage.
209
167
  */
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;
168
+ static getFactory(writeFormat: WriteFormat, summarizeHistory?: false | {
169
+ uploadEditChunks: boolean;
170
+ }): SharedTreeFactory;
219
171
  private idCompressor;
220
172
  private readonly idNormalizer;
221
173
  private interner;
@@ -243,22 +195,18 @@ export declare class SharedTree extends SharedObject<ISharedTreeEvents> implemen
243
195
  private readonly processSequencedEditResult;
244
196
  private summarizeHistory;
245
197
  private uploadEditChunks;
246
- private getHistoryPolicy;
247
198
  /**
248
- * Create a new SharedTree.
199
+ * Create a new SharedTreeFactory.
249
200
  * @param runtime - The runtime the SharedTree will be associated with
250
201
  * @param id - Unique ID for the SharedTree
251
202
  * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
252
203
  * documentation](../docs/Write-Format.md) for more information.
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).
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.
261
206
  */
207
+ constructor(runtime: IFluidDataStoreRuntime, id: string, writeFormat: WriteFormat, summarizeHistory?: false | {
208
+ uploadEditChunks: boolean;
209
+ }, expensiveValidation?: boolean);
262
210
  getWriteFormat(): WriteFormat;
263
211
  /**
264
212
  * Re-computes currentIsOldest and emits an event if it has changed.
@@ -320,13 +268,6 @@ export declare class SharedTree extends SharedObject<ISharedTreeEvents> implemen
320
268
  * @public
321
269
  */
322
270
  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;
330
271
  /**
331
272
  * @returns the edit history of the tree.
332
273
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"SharedTree.d.ts","sourceRoot":"","sources":["../src/SharedTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,QAAQ,EACR,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAEN,gBAAgB,EAChB,mBAA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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"}
@@ -27,15 +27,25 @@ const ChangeTypes_1 = require("./ChangeTypes");
27
27
  const id_compressor_1 = require("./id-compressor");
28
28
  const IdConversion_1 = require("./IdConversion");
29
29
  const StringInterner_1 = require("./StringInterner");
30
- const UuidUtilities_1 = require("./UuidUtilities");
31
30
  /**
32
31
  * Factory for SharedTree.
33
32
  * Includes history in the summary.
34
33
  * @public
35
34
  */
36
35
  class SharedTreeFactory {
37
- constructor(...args) {
38
- this.args = args;
36
+ /**
37
+ * Get a factory for SharedTree to register with the data store.
38
+ * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
39
+ * documentation](../docs/Write-Format.md) for more information.
40
+ * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
41
+ * See the [breaking change migration documentation](docs/Breaking-Change-Migration) for more details on this scheme.
42
+ * @param expensiveValidation - Enables expensive asserts on SharedTree.
43
+ * @returns A factory that creates `SharedTree`s and loads them from storage.
44
+ */
45
+ constructor(writeFormat, summarizeHistory = false, expensiveValidation = false) {
46
+ this.writeFormat = writeFormat;
47
+ this.summarizeHistory = summarizeHistory;
48
+ this.expensiveValidation = expensiveValidation;
39
49
  }
40
50
  /**
41
51
  * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
@@ -62,21 +72,15 @@ class SharedTreeFactory {
62
72
  * @param runtime - data store runtime that owns the new SharedTree
63
73
  * @param id - optional name for the SharedTree
64
74
  */
65
- create(runtime, id) {
75
+ create(runtime, id, expensiveValidation = false) {
76
+ this.expensiveValidation = expensiveValidation;
66
77
  const sharedTree = this.createSharedTree(runtime, id);
67
78
  sharedTree.initializeLocal();
68
79
  return sharedTree;
69
80
  }
70
81
  createSharedTree(runtime, id) {
71
- const [writeFormat] = this.args;
72
- switch (writeFormat) {
73
- case persisted_types_1.WriteFormat.v0_0_2:
74
- return new SharedTree(runtime, id, ...this.args);
75
- case persisted_types_1.WriteFormat.v0_1_1:
76
- return new SharedTree(runtime, id, ...this.args);
77
- default:
78
- (0, Common_1.fail)('Unknown write format');
79
- }
82
+ const sharedTree = new SharedTree(runtime, id, this.writeFormat, this.summarizeHistory, this.expensiveValidation);
83
+ return sharedTree;
80
84
  }
81
85
  }
82
86
  exports.SharedTreeFactory = SharedTreeFactory;
@@ -106,9 +110,20 @@ const sharedTreeTelemetryProperties = { all: { isSharedTreeEvent: true } };
106
110
  * @public
107
111
  */
108
112
  class SharedTree extends shared_object_base_1.SharedObject {
109
- constructor(runtime, id, writeFormat, options = {}) {
113
+ /**
114
+ * Create a new SharedTreeFactory.
115
+ * @param runtime - The runtime the SharedTree will be associated with
116
+ * @param id - Unique ID for the SharedTree
117
+ * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
118
+ * documentation](../docs/Write-Format.md) for more information.
119
+ * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
120
+ * @param expensiveValidation - Enable expensive asserts.
121
+ */
122
+ constructor(runtime, id, writeFormat, summarizeHistory = false, expensiveValidation = false) {
110
123
  super(id, runtime, SharedTreeFactory.Attributes);
111
124
  this.writeFormat = writeFormat;
125
+ this.expensiveValidation = expensiveValidation;
126
+ this.idCompressor = new id_compressor_1.IdCompressor((0, id_compressor_1.createSessionId)(), persisted_types_1.reservedIdCount);
112
127
  this.idNormalizer = {
113
128
  tree: this,
114
129
  get localSessionId() {
@@ -151,9 +166,8 @@ class SharedTree extends shared_object_base_1.SharedObject {
151
166
  }
152
167
  }
153
168
  };
154
- const historyPolicy = this.getHistoryPolicy(options);
155
- this.summarizeHistory = historyPolicy.summarizeHistory;
156
- this.uploadEditChunks = historyPolicy.uploadEditChunks;
169
+ this.summarizeHistory = summarizeHistory === false ? false : true;
170
+ this.uploadEditChunks = summarizeHistory === false ? false : summarizeHistory.uploadEditChunks;
157
171
  // This code is somewhat duplicated from OldestClientObserver because it currently depends on the container runtime
158
172
  // which SharedTree does not have access to.
159
173
  // TODO:#55900: Get rid of copy-pasted OldestClientObserver code
@@ -165,12 +179,11 @@ class SharedTree extends shared_object_base_1.SharedObject {
165
179
  runtime.on('disconnected', this.updateOldest);
166
180
  this.logger = telemetry_utils_1.ChildLogger.create(runtime.logger, 'SharedTree', sharedTreeTelemetryProperties);
167
181
  this.sequencedEditAppliedLogger = telemetry_utils_1.ChildLogger.create(this.logger, 'SequencedEditApplied', sharedTreeTelemetryProperties);
168
- const attributionId = options.attributionId;
169
- this.idCompressor = new id_compressor_1.IdCompressor((0, id_compressor_1.createSessionId)(), persisted_types_1.reservedIdCount, attributionId);
170
182
  const { editLog, cachingLogViewer } = this.initializeNewEditLogFromSummary({
171
183
  editChunks: [],
172
184
  editIds: [],
173
- }, undefined, this.idCompressor, this.processEditResult, this.processSequencedEditResult, persisted_types_1.WriteFormat.v0_1_1);
185
+ }, undefined, this.idCompressor, // TODO: Attribution info
186
+ this.processEditResult, this.processSequencedEditResult, persisted_types_1.WriteFormat.v0_1_1);
174
187
  this.editLog = editLog;
175
188
  this.cachingLogViewer = cachingLogViewer;
176
189
  this.encoder_0_0_2 = new SharedTreeEncoder_1.SharedTreeEncoder_0_0_2(this.summarizeHistory);
@@ -182,39 +195,31 @@ class SharedTree extends shared_object_base_1.SharedObject {
182
195
  static create(runtime, id) {
183
196
  return runtime.createChannel(id, SharedTreeFactory.Type);
184
197
  }
185
- static getFactory(...args) {
186
- const [writeFormat] = args;
198
+ /**
199
+ * Get a factory for SharedTree to register with the data store.
200
+ * @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
201
+ *
202
+ * On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
203
+ * `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
204
+ *
205
+ * The technical limitations here relate to clients with mixed versions collaborating.
206
+ * In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
207
+ * See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
208
+ * See docs/Breaking-Change-Migration for more details on the consensus scheme.
209
+ * @param writeFormat - Determines the format version the SharedTree will write ops and summaries in.
210
+ * This format may be updated to a newer (supported) version at runtime if a collaborating shared-tree
211
+ * that was initialized with a newer write version connects to the session. Care must be taken when changing this value,
212
+ * as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version
213
+ * written.
214
+ * See [the write format documentation](../docs/Write-Format.md) for more information.
215
+ * @returns A factory that creates `SharedTree`s and loads them from storage.
216
+ */
217
+ static getFactory(writeFormat, summarizeHistory = false) {
187
218
  // On 0.1.1 documents, due to current code limitations, all clients MUST agree on the value of `summarizeHistory`.
188
219
  // Note that this means staged rollout changing this value should not be attempted.
189
220
  // It is possible to update shared-tree to correctly handle such a staged rollout, but that hasn't been implemented.
190
221
  // See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
191
- switch (writeFormat) {
192
- case persisted_types_1.WriteFormat.v0_0_2:
193
- return new SharedTreeFactory(...args);
194
- case persisted_types_1.WriteFormat.v0_1_1:
195
- return new SharedTreeFactory(...args);
196
- default:
197
- (0, Common_1.fail)('Unknown write format');
198
- }
199
- }
200
- /**
201
- * The UUID used for attribution of nodes created by this SharedTree. All shared trees with a write format of 0.1.1 or
202
- * greater have a unique attribution ID which may be configured in the constructor. All other shared trees (i.e. those
203
- * with a write format of 0.0.2) use the nil UUID as their attribution ID.
204
- * @public
205
- */
206
- get attributionId() {
207
- switch (this.writeFormat) {
208
- case persisted_types_1.WriteFormat.v0_0_2:
209
- return UuidUtilities_1.nilUuid;
210
- default: {
211
- const { attributionId } = this.idCompressor;
212
- if (attributionId === persisted_types_1.ghostSessionId) {
213
- return UuidUtilities_1.nilUuid;
214
- }
215
- return attributionId;
216
- }
217
- }
222
+ return new SharedTreeFactory(writeFormat, summarizeHistory);
218
223
  }
219
224
  /**
220
225
  * Viewer for trees defined by editLog. This allows access to views of the tree at different revisions (various points in time).
@@ -222,27 +227,6 @@ class SharedTree extends shared_object_base_1.SharedObject {
222
227
  get logViewer() {
223
228
  return this.cachingLogViewer;
224
229
  }
225
- getHistoryPolicy(options) {
226
- var _a;
227
- const noCompatOptions = options;
228
- if (typeof noCompatOptions.summarizeHistory === 'object') {
229
- return {
230
- summarizeHistory: true,
231
- uploadEditChunks: noCompatOptions.summarizeHistory.uploadEditChunks,
232
- };
233
- }
234
- else {
235
- return {
236
- summarizeHistory: (_a = noCompatOptions.summarizeHistory) !== null && _a !== void 0 ? _a : false,
237
- uploadEditChunks: false,
238
- };
239
- }
240
- }
241
- /**
242
- * The write format version currently used by this `SharedTree`. This is always initialized to the write format
243
- * passed to the tree's constructor, but it may automatically upgrade over time (e.g. when connected to another
244
- * SharedTree with a higher write format, or when loading a summary with a higher write format).
245
- */
246
230
  getWriteFormat() {
247
231
  return this.writeFormat;
248
232
  }
@@ -339,25 +323,6 @@ class SharedTree extends shared_object_base_1.SharedObject {
339
323
  tryConvertToNodeId(id) {
340
324
  return this.idCompressor.tryRecompress(id);
341
325
  }
342
- /**
343
- * Returns the attribution ID associated with the SharedTree that generated the given node ID. This is generally only useful for clients
344
- * 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
345
- * `attributionId` of the tree.
346
- * @public
347
- */
348
- attributeNodeId(id) {
349
- switch (this.writeFormat) {
350
- case persisted_types_1.WriteFormat.v0_0_2:
351
- return UuidUtilities_1.nilUuid;
352
- default: {
353
- const attributionId = this.idCompressor.attributeId(id);
354
- if (attributionId === persisted_types_1.ghostSessionId) {
355
- return UuidUtilities_1.nilUuid;
356
- }
357
- return attributionId;
358
- }
359
- }
360
- }
361
326
  /**
362
327
  * @returns the edit history of the tree.
363
328
  * @public
@@ -504,7 +469,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
504
469
  let convertedSummary;
505
470
  switch (loadedSummaryVersion) {
506
471
  case persisted_types_1.WriteFormat.v0_0_2:
507
- convertedSummary = this.encoder_0_0_2.decodeSummary(summary, this.attributionId);
472
+ convertedSummary = this.encoder_0_0_2.decodeSummary(summary);
508
473
  break;
509
474
  case persisted_types_1.WriteFormat.v0_1_1: {
510
475
  const typedSummary = summary;
@@ -515,7 +480,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
515
480
  this.uploadEditChunks = loadedSummaryIncludesHistory;
516
481
  this.encoder_0_1_1 = new SharedTreeEncoder_1.SharedTreeEncoder_0_1_1(this.summarizeHistory);
517
482
  }
518
- convertedSummary = this.encoder_0_1_1.decodeSummary(summary, this.attributionId);
483
+ convertedSummary = this.encoder_0_1_1.decodeSummary(summary); // TODO:#461: pass attribution info
519
484
  break;
520
485
  }
521
486
  default:
@@ -803,7 +768,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
803
768
  this.interner = new StringInterner_1.MutableStringInterner([InitialTree_1.initialTree.definition]);
804
769
  const oldIdCompressor = this.idCompressor;
805
770
  // Create the IdCompressor that will be used after the upgrade
806
- const newIdCompressor = new id_compressor_1.IdCompressor((0, id_compressor_1.createSessionId)(), persisted_types_1.reservedIdCount, this.attributionId);
771
+ const newIdCompressor = new id_compressor_1.IdCompressor((0, id_compressor_1.createSessionId)(), persisted_types_1.reservedIdCount); // TODO: attribution info
807
772
  const newContext = (0, NodeIdUtilities_1.getNodeIdContext)(newIdCompressor);
808
773
  // Generate all local IDs in the new compressor that were in the old compressor and preserve their UUIDs.
809
774
  // This will allow the client to continue to use local IDs that were allocated pre-upgrade
@@ -817,7 +782,7 @@ class SharedTree extends shared_object_base_1.SharedObject {
817
782
  }
818
783
  };
819
784
  // Construct a temporary "ghost" compressor which is used to generate final IDs that will be consistent across all upgrading clients
820
- const ghostIdCompressor = new id_compressor_1.IdCompressor(persisted_types_1.ghostSessionId, persisted_types_1.reservedIdCount);
785
+ const ghostIdCompressor = new id_compressor_1.IdCompressor(persisted_types_1.ghostSessionId, persisted_types_1.reservedIdCount); // TODO: attribution info
821
786
  const ghostContext = (0, NodeIdUtilities_1.getNodeIdContext)(ghostIdCompressor);
822
787
  if (this.summarizeHistory) {
823
788
  // All clients have the full history, and can therefore all "generate" the same final IDs for every ID in the history