@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.
- package/dist/SharedTree.d.ts +30 -89
- package/dist/SharedTree.d.ts.map +1 -1
- package/dist/SharedTree.js +58 -93
- package/dist/SharedTree.js.map +1 -1
- package/dist/SharedTreeEncoder.d.ts +1 -1
- package/dist/SharedTreeEncoder.d.ts.map +1 -1
- package/dist/SharedTreeEncoder.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/lib/SharedTree.d.ts +30 -89
- package/lib/SharedTree.d.ts.map +1 -1
- package/lib/SharedTree.js +59 -94
- package/lib/SharedTree.js.map +1 -1
- package/lib/SharedTreeEncoder.d.ts +1 -1
- package/lib/SharedTreeEncoder.d.ts.map +1 -1
- package/lib/SharedTreeEncoder.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.d.ts.map +1 -1
- package/lib/test/fuzz/SharedTreeFuzzTests.js +1 -3
- package/lib/test/fuzz/SharedTreeFuzzTests.js.map +1 -1
- package/lib/test/utilities/SharedTreeTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeTests.js +50 -27
- package/lib/test/utilities/SharedTreeTests.js.map +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.d.ts.map +1 -1
- package/lib/test/utilities/SharedTreeVersioningTests.js +19 -19
- package/lib/test/utilities/SharedTreeVersioningTests.js.map +1 -1
- package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
- package/lib/test/utilities/TestUtilities.js +6 -4
- package/lib/test/utilities/TestUtilities.js.map +1 -1
- package/package.json +15 -15
- package/src/SharedTree.ts +46 -195
- package/src/SharedTreeEncoder.ts +1 -1
- package/src/index.ts +0 -4
package/src/SharedTree.ts
CHANGED
|
@@ -27,15 +27,7 @@ import { ChildLogger, ITelemetryLoggerPropertyBags, PerformanceEvent } from '@fl
|
|
|
27
27
|
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
28
28
|
import { assert, assertNotUndefined, fail, copyPropertyIfDefined, noop } from './Common';
|
|
29
29
|
import { EditHandle, EditLog, getNumberOfHandlesFromEditLogSummary, OrderedEditSet } from './EditLog';
|
|
30
|
-
import {
|
|
31
|
-
EditId,
|
|
32
|
-
NodeId,
|
|
33
|
-
StableNodeId,
|
|
34
|
-
DetachedSequenceId,
|
|
35
|
-
OpSpaceNodeId,
|
|
36
|
-
isDetachedSequenceId,
|
|
37
|
-
AttributionId,
|
|
38
|
-
} from './Identifiers';
|
|
30
|
+
import { EditId, NodeId, StableNodeId, DetachedSequenceId, OpSpaceNodeId, isDetachedSequenceId } from './Identifiers';
|
|
39
31
|
import { initialTree } from './InitialTree';
|
|
40
32
|
import {
|
|
41
33
|
CachingLogViewer,
|
|
@@ -96,75 +88,6 @@ import { TransactionInternal } from './TransactionInternal';
|
|
|
96
88
|
import { IdCompressor, createSessionId } from './id-compressor';
|
|
97
89
|
import { convertEditIds } from './IdConversion';
|
|
98
90
|
import { MutableStringInterner } from './StringInterner';
|
|
99
|
-
import { nilUuid } from './UuidUtilities';
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* The write format and associated options used to construct a `SharedTree`
|
|
103
|
-
* @public
|
|
104
|
-
*/
|
|
105
|
-
export type SharedTreeArgs<WF extends WriteFormat = WriteFormat> = [writeFormat: WF, options?: SharedTreeOptions<WF>];
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* The type of shared tree options for a given write format
|
|
109
|
-
* @public
|
|
110
|
-
*/
|
|
111
|
-
export type SharedTreeOptions<
|
|
112
|
-
WF extends WriteFormat,
|
|
113
|
-
HistoryCompatibility extends 'Forwards' | 'None' = 'Forwards'
|
|
114
|
-
> = Omit<
|
|
115
|
-
WF extends WriteFormat.v0_0_2
|
|
116
|
-
? SharedTreeOptions_0_0_2
|
|
117
|
-
: WF extends WriteFormat.v0_1_1
|
|
118
|
-
? SharedTreeOptions_0_1_1
|
|
119
|
-
: never,
|
|
120
|
-
HistoryCompatibility extends 'Forwards' ? 'summarizeHistory' : never
|
|
121
|
-
>;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Configuration options for a SharedTree with write format 0.0.2
|
|
125
|
-
* @public
|
|
126
|
-
*/
|
|
127
|
-
export interface SharedTreeOptions_0_0_2 {
|
|
128
|
-
/**
|
|
129
|
-
* Determines if the history is included in summaries.
|
|
130
|
-
*
|
|
131
|
-
* Warning: enabling history summarization incurs a permanent cost in the document. It is not possible to disable history summarization
|
|
132
|
-
* later once it has been enabled, and thus the history cannot be safely deleted.
|
|
133
|
-
*
|
|
134
|
-
* On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
|
|
135
|
-
* `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
|
|
136
|
-
*
|
|
137
|
-
* The technical limitations here relate to clients with mixed versions collaborating.
|
|
138
|
-
* In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
|
|
139
|
-
* See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
|
|
140
|
-
* See docs/Breaking-Change-Migration for more details on the consensus scheme.
|
|
141
|
-
*/
|
|
142
|
-
summarizeHistory?: boolean;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Configuration options for a SharedTree with write format 0.1.1
|
|
147
|
-
* @public
|
|
148
|
-
*/
|
|
149
|
-
export interface SharedTreeOptions_0_1_1 {
|
|
150
|
-
/**
|
|
151
|
-
* Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
|
|
152
|
-
*
|
|
153
|
-
* Warning: enabling history summarization incurs a permanent cost in the document. It is not possible to disable history summarization
|
|
154
|
-
* later once it has been enabled, and thus the history cannot be safely deleted.
|
|
155
|
-
*
|
|
156
|
-
* On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
|
|
157
|
-
* `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
|
|
158
|
-
*
|
|
159
|
-
* The technical limitations here relate to clients with mixed versions collaborating.
|
|
160
|
-
* In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
|
|
161
|
-
* See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
|
|
162
|
-
* See docs/Breaking-Change-Migration for more details on the consensus scheme.
|
|
163
|
-
*/
|
|
164
|
-
summarizeHistory?: false | { uploadEditChunks: boolean };
|
|
165
|
-
/** a UUID that identifies the user of this tree; all node IDs generated by this tree will be associated with this UUID */
|
|
166
|
-
attributionId?: AttributionId;
|
|
167
|
-
}
|
|
168
91
|
|
|
169
92
|
/**
|
|
170
93
|
* Factory for SharedTree.
|
|
@@ -186,20 +109,20 @@ export class SharedTreeFactory implements IChannelFactory {
|
|
|
186
109
|
packageVersion: '0.1',
|
|
187
110
|
};
|
|
188
111
|
|
|
189
|
-
private readonly args: SharedTreeArgs;
|
|
190
|
-
|
|
191
112
|
/**
|
|
192
113
|
* Get a factory for SharedTree to register with the data store.
|
|
193
114
|
* @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
|
|
194
115
|
* documentation](../docs/Write-Format.md) for more information.
|
|
195
|
-
* @param
|
|
116
|
+
* @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
|
|
117
|
+
* See the [breaking change migration documentation](docs/Breaking-Change-Migration) for more details on this scheme.
|
|
118
|
+
* @param expensiveValidation - Enables expensive asserts on SharedTree.
|
|
196
119
|
* @returns A factory that creates `SharedTree`s and loads them from storage.
|
|
197
120
|
*/
|
|
198
|
-
constructor(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
121
|
+
constructor(
|
|
122
|
+
private readonly writeFormat: WriteFormat,
|
|
123
|
+
private readonly summarizeHistory: false | { uploadEditChunks: boolean } = false,
|
|
124
|
+
private expensiveValidation = false
|
|
125
|
+
) {}
|
|
203
126
|
|
|
204
127
|
/**
|
|
205
128
|
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
|
|
@@ -234,22 +157,22 @@ export class SharedTreeFactory implements IChannelFactory {
|
|
|
234
157
|
* @param runtime - data store runtime that owns the new SharedTree
|
|
235
158
|
* @param id - optional name for the SharedTree
|
|
236
159
|
*/
|
|
237
|
-
public create(runtime: IFluidDataStoreRuntime, id: string): SharedTree {
|
|
160
|
+
public create(runtime: IFluidDataStoreRuntime, id: string, expensiveValidation: boolean = false): SharedTree {
|
|
161
|
+
this.expensiveValidation = expensiveValidation;
|
|
238
162
|
const sharedTree = this.createSharedTree(runtime, id);
|
|
239
163
|
sharedTree.initializeLocal();
|
|
240
164
|
return sharedTree;
|
|
241
165
|
}
|
|
242
166
|
|
|
243
167
|
private createSharedTree(runtime: IFluidDataStoreRuntime, id: string): SharedTree {
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
168
|
+
const sharedTree = new SharedTree(
|
|
169
|
+
runtime,
|
|
170
|
+
id,
|
|
171
|
+
this.writeFormat,
|
|
172
|
+
this.summarizeHistory,
|
|
173
|
+
this.expensiveValidation
|
|
174
|
+
);
|
|
175
|
+
return sharedTree;
|
|
253
176
|
}
|
|
254
177
|
}
|
|
255
178
|
|
|
@@ -358,56 +281,35 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
358
281
|
|
|
359
282
|
/**
|
|
360
283
|
* Get a factory for SharedTree to register with the data store.
|
|
284
|
+
* @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
|
|
285
|
+
*
|
|
286
|
+
* On 0.1.1 documents, due to current code limitations, this parameter is only impactful for newly created documents.
|
|
287
|
+
* `SharedTree`s which load existing documents will summarize history if and only if the loaded summary included history.
|
|
288
|
+
*
|
|
289
|
+
* The technical limitations here relate to clients with mixed versions collaborating.
|
|
290
|
+
* In the future we may allow modification of whether or not a particular document saves history, but only via a consensus mechanism.
|
|
291
|
+
* See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
|
|
292
|
+
* See docs/Breaking-Change-Migration for more details on the consensus scheme.
|
|
361
293
|
* @param writeFormat - Determines the format version the SharedTree will write ops and summaries in.
|
|
362
294
|
* This format may be updated to a newer (supported) version at runtime if a collaborating shared-tree
|
|
363
295
|
* that was initialized with a newer write version connects to the session. Care must be taken when changing this value,
|
|
364
296
|
* as a staged rollout must of occurred such that all collaborating clients must have the code to read at least the version
|
|
365
297
|
* written.
|
|
366
298
|
* See [the write format documentation](../docs/Write-Format.md) for more information.
|
|
367
|
-
* @param options - Configuration options for this tree
|
|
368
299
|
* @returns A factory that creates `SharedTree`s and loads them from storage.
|
|
369
300
|
*/
|
|
370
|
-
public static getFactory(
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
public static getFactory(...args: SharedTreeArgs): SharedTreeFactory {
|
|
375
|
-
const [writeFormat] = args;
|
|
301
|
+
public static getFactory(
|
|
302
|
+
writeFormat: WriteFormat,
|
|
303
|
+
summarizeHistory: false | { uploadEditChunks: boolean } = false
|
|
304
|
+
): SharedTreeFactory {
|
|
376
305
|
// On 0.1.1 documents, due to current code limitations, all clients MUST agree on the value of `summarizeHistory`.
|
|
377
306
|
// Note that this means staged rollout changing this value should not be attempted.
|
|
378
307
|
// It is possible to update shared-tree to correctly handle such a staged rollout, but that hasn't been implemented.
|
|
379
308
|
// See the skipped test in SharedTreeFuzzTests.ts for more details on this issue.
|
|
380
|
-
|
|
381
|
-
case WriteFormat.v0_0_2:
|
|
382
|
-
return new SharedTreeFactory(...(args as SharedTreeArgs<WriteFormat.v0_0_2>));
|
|
383
|
-
case WriteFormat.v0_1_1:
|
|
384
|
-
return new SharedTreeFactory(...(args as SharedTreeArgs<WriteFormat.v0_1_1>));
|
|
385
|
-
default:
|
|
386
|
-
fail('Unknown write format');
|
|
387
|
-
}
|
|
309
|
+
return new SharedTreeFactory(writeFormat, summarizeHistory);
|
|
388
310
|
}
|
|
389
311
|
|
|
390
|
-
|
|
391
|
-
* The UUID used for attribution of nodes created by this SharedTree. All shared trees with a write format of 0.1.1 or
|
|
392
|
-
* greater have a unique attribution ID which may be configured in the constructor. All other shared trees (i.e. those
|
|
393
|
-
* with a write format of 0.0.2) use the nil UUID as their attribution ID.
|
|
394
|
-
* @public
|
|
395
|
-
*/
|
|
396
|
-
public get attributionId(): AttributionId {
|
|
397
|
-
switch (this.writeFormat) {
|
|
398
|
-
case WriteFormat.v0_0_2:
|
|
399
|
-
return nilUuid;
|
|
400
|
-
default: {
|
|
401
|
-
const { attributionId } = this.idCompressor;
|
|
402
|
-
if (attributionId === ghostSessionId) {
|
|
403
|
-
return nilUuid;
|
|
404
|
-
}
|
|
405
|
-
return attributionId;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
private idCompressor: IdCompressor;
|
|
312
|
+
private idCompressor: IdCompressor = new IdCompressor(createSessionId(), reservedIdCount);
|
|
411
313
|
private readonly idNormalizer: NodeIdNormalizer<OpSpaceNodeId> & { tree: SharedTree } = {
|
|
412
314
|
tree: this,
|
|
413
315
|
get localSessionId() {
|
|
@@ -473,46 +375,25 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
473
375
|
private summarizeHistory: boolean;
|
|
474
376
|
private uploadEditChunks: boolean;
|
|
475
377
|
|
|
476
|
-
private getHistoryPolicy(options: SharedTreeOptions<WriteFormat, 'Forwards' | 'None'>): {
|
|
477
|
-
summarizeHistory: boolean;
|
|
478
|
-
uploadEditChunks: boolean;
|
|
479
|
-
} {
|
|
480
|
-
const noCompatOptions = options as SharedTreeOptions<WriteFormat, 'None'>;
|
|
481
|
-
if (typeof noCompatOptions.summarizeHistory === 'object') {
|
|
482
|
-
return {
|
|
483
|
-
summarizeHistory: true,
|
|
484
|
-
uploadEditChunks: noCompatOptions.summarizeHistory.uploadEditChunks,
|
|
485
|
-
};
|
|
486
|
-
} else {
|
|
487
|
-
return {
|
|
488
|
-
summarizeHistory: noCompatOptions.summarizeHistory ?? false,
|
|
489
|
-
uploadEditChunks: false,
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
|
|
494
378
|
/**
|
|
495
|
-
* Create a new
|
|
379
|
+
* Create a new SharedTreeFactory.
|
|
496
380
|
* @param runtime - The runtime the SharedTree will be associated with
|
|
497
381
|
* @param id - Unique ID for the SharedTree
|
|
498
382
|
* @param writeFormat - Determines the format version the SharedTree will write ops and summaries in. See [the write format
|
|
499
383
|
* documentation](../docs/Write-Format.md) for more information.
|
|
500
|
-
* @param
|
|
384
|
+
* @param summarizeHistory - Determines if the history is included in summaries and if edit chunks are uploaded when they are full.
|
|
385
|
+
* @param expensiveValidation - Enable expensive asserts.
|
|
501
386
|
*/
|
|
502
|
-
public constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_0_2>);
|
|
503
|
-
|
|
504
|
-
public constructor(runtime: IFluidDataStoreRuntime, id: string, ...args: SharedTreeArgs<WriteFormat.v0_1_1>);
|
|
505
|
-
|
|
506
387
|
public constructor(
|
|
507
388
|
runtime: IFluidDataStoreRuntime,
|
|
508
389
|
id: string,
|
|
509
390
|
private writeFormat: WriteFormat,
|
|
510
|
-
|
|
391
|
+
summarizeHistory: false | { uploadEditChunks: boolean } = false,
|
|
392
|
+
private readonly expensiveValidation = false
|
|
511
393
|
) {
|
|
512
394
|
super(id, runtime, SharedTreeFactory.Attributes);
|
|
513
|
-
|
|
514
|
-
this.
|
|
515
|
-
this.uploadEditChunks = historyPolicy.uploadEditChunks;
|
|
395
|
+
this.summarizeHistory = summarizeHistory === false ? false : true;
|
|
396
|
+
this.uploadEditChunks = summarizeHistory === false ? false : summarizeHistory.uploadEditChunks;
|
|
516
397
|
|
|
517
398
|
// This code is somewhat duplicated from OldestClientObserver because it currently depends on the container runtime
|
|
518
399
|
// which SharedTree does not have access to.
|
|
@@ -531,15 +412,13 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
531
412
|
sharedTreeTelemetryProperties
|
|
532
413
|
);
|
|
533
414
|
|
|
534
|
-
const attributionId = (options as SharedTreeOptions<WriteFormat.v0_1_1>).attributionId;
|
|
535
|
-
this.idCompressor = new IdCompressor(createSessionId(), reservedIdCount, attributionId);
|
|
536
415
|
const { editLog, cachingLogViewer } = this.initializeNewEditLogFromSummary(
|
|
537
416
|
{
|
|
538
417
|
editChunks: [],
|
|
539
418
|
editIds: [],
|
|
540
419
|
},
|
|
541
420
|
undefined,
|
|
542
|
-
this.idCompressor,
|
|
421
|
+
this.idCompressor, // TODO: Attribution info
|
|
543
422
|
this.processEditResult,
|
|
544
423
|
this.processSequencedEditResult,
|
|
545
424
|
WriteFormat.v0_1_1
|
|
@@ -550,11 +429,6 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
550
429
|
this.encoder_0_1_1 = new SharedTreeEncoder_0_1_1(this.summarizeHistory);
|
|
551
430
|
}
|
|
552
431
|
|
|
553
|
-
/**
|
|
554
|
-
* The write format version currently used by this `SharedTree`. This is always initialized to the write format
|
|
555
|
-
* passed to the tree's constructor, but it may automatically upgrade over time (e.g. when connected to another
|
|
556
|
-
* SharedTree with a higher write format, or when loading a summary with a higher write format).
|
|
557
|
-
*/
|
|
558
432
|
public getWriteFormat(): WriteFormat {
|
|
559
433
|
return this.writeFormat;
|
|
560
434
|
}
|
|
@@ -681,26 +555,6 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
681
555
|
return this.idCompressor.tryRecompress(id) as NodeId | undefined;
|
|
682
556
|
}
|
|
683
557
|
|
|
684
|
-
/**
|
|
685
|
-
* Returns the attribution ID associated with the SharedTree that generated the given node ID. This is generally only useful for clients
|
|
686
|
-
* 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
|
|
687
|
-
* `attributionId` of the tree.
|
|
688
|
-
* @public
|
|
689
|
-
*/
|
|
690
|
-
public attributeNodeId(id: NodeId): AttributionId {
|
|
691
|
-
switch (this.writeFormat) {
|
|
692
|
-
case WriteFormat.v0_0_2:
|
|
693
|
-
return nilUuid;
|
|
694
|
-
default: {
|
|
695
|
-
const attributionId = this.idCompressor.attributeId(id);
|
|
696
|
-
if (attributionId === ghostSessionId) {
|
|
697
|
-
return nilUuid;
|
|
698
|
-
}
|
|
699
|
-
return attributionId;
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
|
|
704
558
|
/**
|
|
705
559
|
* @returns the edit history of the tree.
|
|
706
560
|
* @public
|
|
@@ -890,10 +744,7 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
890
744
|
let convertedSummary: SummaryContents;
|
|
891
745
|
switch (loadedSummaryVersion) {
|
|
892
746
|
case WriteFormat.v0_0_2:
|
|
893
|
-
convertedSummary = this.encoder_0_0_2.decodeSummary(
|
|
894
|
-
summary as SharedTreeSummary_0_0_2,
|
|
895
|
-
this.attributionId
|
|
896
|
-
);
|
|
747
|
+
convertedSummary = this.encoder_0_0_2.decodeSummary(summary as SharedTreeSummary_0_0_2);
|
|
897
748
|
break;
|
|
898
749
|
case WriteFormat.v0_1_1: {
|
|
899
750
|
const typedSummary = summary as SharedTreeSummary;
|
|
@@ -905,7 +756,7 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
905
756
|
this.encoder_0_1_1 = new SharedTreeEncoder_0_1_1(this.summarizeHistory);
|
|
906
757
|
}
|
|
907
758
|
|
|
908
|
-
convertedSummary = this.encoder_0_1_1.decodeSummary(summary as SharedTreeSummary
|
|
759
|
+
convertedSummary = this.encoder_0_1_1.decodeSummary(summary as SharedTreeSummary); // TODO:#461: pass attribution info
|
|
909
760
|
break;
|
|
910
761
|
}
|
|
911
762
|
default:
|
|
@@ -1264,7 +1115,7 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
1264
1115
|
this.interner = new MutableStringInterner([initialTree.definition]);
|
|
1265
1116
|
const oldIdCompressor = this.idCompressor;
|
|
1266
1117
|
// Create the IdCompressor that will be used after the upgrade
|
|
1267
|
-
const newIdCompressor = new IdCompressor(createSessionId(), reservedIdCount
|
|
1118
|
+
const newIdCompressor = new IdCompressor(createSessionId(), reservedIdCount); // TODO: attribution info
|
|
1268
1119
|
const newContext = getNodeIdContext(newIdCompressor);
|
|
1269
1120
|
// Generate all local IDs in the new compressor that were in the old compressor and preserve their UUIDs.
|
|
1270
1121
|
// This will allow the client to continue to use local IDs that were allocated pre-upgrade
|
|
@@ -1279,7 +1130,7 @@ export class SharedTree extends SharedObject<ISharedTreeEvents> implements NodeI
|
|
|
1279
1130
|
}
|
|
1280
1131
|
};
|
|
1281
1132
|
// Construct a temporary "ghost" compressor which is used to generate final IDs that will be consistent across all upgrading clients
|
|
1282
|
-
const ghostIdCompressor = new IdCompressor(ghostSessionId, reservedIdCount);
|
|
1133
|
+
const ghostIdCompressor = new IdCompressor(ghostSessionId, reservedIdCount); // TODO: attribution info
|
|
1283
1134
|
const ghostContext = getNodeIdContext(ghostIdCompressor);
|
|
1284
1135
|
if (this.summarizeHistory) {
|
|
1285
1136
|
// All clients have the full history, and can therefore all "generate" the same final IDs for every ID in the history
|
package/src/SharedTreeEncoder.ts
CHANGED
|
@@ -159,7 +159,7 @@ export class SharedTreeEncoder_0_1_1 {
|
|
|
159
159
|
idCompressor: serializedIdCompressor,
|
|
160
160
|
version,
|
|
161
161
|
}: SharedTreeSummary,
|
|
162
|
-
attributionId
|
|
162
|
+
attributionId?: AttributionId
|
|
163
163
|
): SummaryContents {
|
|
164
164
|
assert(version === WriteFormat.v0_1_1, `Invalid summary version to decode: ${version}, expected: 0.1.1`);
|
|
165
165
|
assert(typeof editHistory === 'object', '0.1.1 summary encountered with non-object edit history.');
|
package/src/index.ts
CHANGED