@fluidframework/tree 2.61.0 → 2.62.0-356644
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/api-report/tree.alpha.api.md +3 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/utils.d.ts +10 -0
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +20 -1
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +2 -2
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +12 -2
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +71 -33
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +13 -7
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +114 -84
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +3 -0
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchIdCodec.d.ts +11 -0
- package/dist/shared-tree-core/branchIdCodec.d.ts.map +1 -0
- package/dist/shared-tree-core/branchIdCodec.js +18 -0
- package/dist/shared-tree-core/branchIdCodec.js.map +1 -0
- package/dist/shared-tree-core/editManager.d.ts +33 -63
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +437 -290
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +7 -96
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +17 -0
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -0
- package/dist/shared-tree-core/editManagerCodecsCommons.js +139 -0
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -0
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts +16 -0
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -0
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js +39 -0
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -0
- package/dist/shared-tree-core/editManagerCodecsV5.d.ts +16 -0
- package/dist/shared-tree-core/editManagerCodecsV5.d.ts.map +1 -0
- package/dist/shared-tree-core/editManagerCodecsV5.js +58 -0
- package/dist/shared-tree-core/editManagerCodecsV5.js.map +1 -0
- package/dist/shared-tree-core/{editManagerFormat.d.ts → editManagerFormatCommons.d.ts} +31 -7
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -0
- package/dist/shared-tree-core/{editManagerFormat.js → editManagerFormatCommons.js} +13 -12
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -0
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +31 -0
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -0
- package/dist/shared-tree-core/editManagerFormatV1toV4.js +24 -0
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -0
- package/dist/shared-tree-core/editManagerFormatV5.d.ts +62 -0
- package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +1 -0
- package/dist/shared-tree-core/editManagerFormatV5.js +20 -0
- package/dist/shared-tree-core/editManagerFormatV5.js.map +1 -0
- package/dist/shared-tree-core/index.d.ts +3 -3
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +11 -0
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -0
- package/dist/shared-tree-core/messageCodecV1ToV4.js +59 -0
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -0
- package/dist/shared-tree-core/messageCodecV5.d.ts +11 -0
- package/dist/shared-tree-core/messageCodecV5.d.ts.map +1 -0
- package/dist/shared-tree-core/messageCodecV5.js +78 -0
- package/dist/shared-tree-core/messageCodecV5.js.map +1 -0
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +16 -47
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/{messageFormat.d.ts → messageFormatV1ToV4.d.ts} +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -0
- package/dist/shared-tree-core/{messageFormat.js → messageFormatV1ToV4.js} +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -0
- package/dist/shared-tree-core/messageFormatV5.d.ts +42 -0
- package/dist/shared-tree-core/messageFormatV5.d.ts.map +1 -0
- package/dist/shared-tree-core/messageFormatV5.js +20 -0
- package/dist/shared-tree-core/messageFormatV5.js.map +1 -0
- package/dist/shared-tree-core/messageTypes.d.ts +12 -2
- package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/dist/shared-tree-core/messageTypes.js.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.d.ts +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +18 -5
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +175 -56
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +10 -0
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/utils.d.ts +10 -0
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +18 -0
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +2 -2
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +12 -2
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +72 -34
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +13 -7
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +115 -85
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +3 -0
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchIdCodec.d.ts +11 -0
- package/lib/shared-tree-core/branchIdCodec.d.ts.map +1 -0
- package/lib/shared-tree-core/branchIdCodec.js +13 -0
- package/lib/shared-tree-core/branchIdCodec.js.map +1 -0
- package/lib/shared-tree-core/editManager.d.ts +33 -63
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +437 -290
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +4 -93
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +17 -0
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -0
- package/lib/shared-tree-core/editManagerCodecsCommons.js +134 -0
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -0
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts +16 -0
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -0
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +35 -0
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -0
- package/lib/shared-tree-core/editManagerCodecsV5.d.ts +16 -0
- package/lib/shared-tree-core/editManagerCodecsV5.d.ts.map +1 -0
- package/lib/shared-tree-core/editManagerCodecsV5.js +54 -0
- package/lib/shared-tree-core/editManagerCodecsV5.js.map +1 -0
- package/lib/shared-tree-core/{editManagerFormat.d.ts → editManagerFormatCommons.d.ts} +31 -7
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -0
- package/lib/shared-tree-core/{editManagerFormat.js → editManagerFormatCommons.js} +10 -11
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -0
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +31 -0
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -0
- package/lib/shared-tree-core/editManagerFormatV1toV4.js +20 -0
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -0
- package/lib/shared-tree-core/editManagerFormatV5.d.ts +62 -0
- package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +1 -0
- package/lib/shared-tree-core/editManagerFormatV5.js +16 -0
- package/lib/shared-tree-core/editManagerFormatV5.js.map +1 -0
- package/lib/shared-tree-core/index.d.ts +3 -3
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +11 -0
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -0
- package/lib/shared-tree-core/messageCodecV1ToV4.js +55 -0
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -0
- package/lib/shared-tree-core/messageCodecV5.d.ts +11 -0
- package/lib/shared-tree-core/messageCodecV5.d.ts.map +1 -0
- package/lib/shared-tree-core/messageCodecV5.js +74 -0
- package/lib/shared-tree-core/messageCodecV5.js.map +1 -0
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +17 -48
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/{messageFormat.d.ts → messageFormatV1ToV4.d.ts} +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -0
- package/lib/shared-tree-core/{messageFormat.js → messageFormatV1ToV4.js} +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -0
- package/lib/shared-tree-core/messageFormatV5.d.ts +42 -0
- package/lib/shared-tree-core/messageFormatV5.d.ts.map +1 -0
- package/lib/shared-tree-core/messageFormatV5.js +16 -0
- package/lib/shared-tree-core/messageFormatV5.js.map +1 -0
- package/lib/shared-tree-core/messageTypes.d.ts +12 -2
- package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/lib/shared-tree-core/messageTypes.js.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.d.ts +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +18 -5
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +176 -57
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +10 -0
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/package.json +20 -20
- package/src/core/index.ts +1 -0
- package/src/core/rebase/index.ts +1 -0
- package/src/core/rebase/utils.ts +27 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/schematizingTreeView.ts +2 -2
- package/src/shared-tree/sharedTree.ts +103 -46
- package/src/shared-tree/treeCheckout.ts +147 -98
- package/src/shared-tree-core/branch.ts +7 -0
- package/src/shared-tree-core/branchIdCodec.ts +28 -0
- package/src/shared-tree-core/editManager.ts +709 -437
- package/src/shared-tree-core/editManagerCodecs.ts +4 -164
- package/src/shared-tree-core/editManagerCodecsCommons.ts +236 -0
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +108 -0
- package/src/shared-tree-core/editManagerCodecsV5.ts +150 -0
- package/src/shared-tree-core/{editManagerFormat.ts → editManagerFormatCommons.ts} +17 -13
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +42 -0
- package/src/shared-tree-core/editManagerFormatV5.ts +35 -0
- package/src/shared-tree-core/index.ts +3 -1
- package/src/shared-tree-core/messageCodecV1ToV4.ts +101 -0
- package/src/shared-tree-core/messageCodecV5.ts +128 -0
- package/src/shared-tree-core/messageCodecs.ts +16 -85
- package/src/shared-tree-core/messageFormatV5.ts +50 -0
- package/src/shared-tree-core/messageTypes.ts +15 -2
- package/src/shared-tree-core/sequenceIdUtils.ts +1 -1
- package/src/shared-tree-core/sharedTreeCore.ts +270 -84
- package/src/simple-tree/api/tree.ts +15 -0
- package/dist/shared-tree-core/editManagerFormat.d.ts.map +0 -1
- package/dist/shared-tree-core/editManagerFormat.js.map +0 -1
- package/dist/shared-tree-core/messageFormat.d.ts.map +0 -1
- package/dist/shared-tree-core/messageFormat.js.map +0 -1
- package/lib/shared-tree-core/editManagerFormat.d.ts.map +0 -1
- package/lib/shared-tree-core/editManagerFormat.js.map +0 -1
- package/lib/shared-tree-core/messageFormat.d.ts.map +0 -1
- package/lib/shared-tree-core/messageFormat.js.map +0 -1
- /package/src/shared-tree-core/{messageFormat.ts → messageFormatV1ToV4.ts} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { IFluidLoadable, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
7
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import { assert, fail, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
|
|
9
9
|
import type { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
10
10
|
import type { IIdCompressor, SessionId } from "@fluidframework/id-compressor";
|
|
@@ -42,13 +42,13 @@ import {
|
|
|
42
42
|
breakingClass,
|
|
43
43
|
} from "../util/index.js";
|
|
44
44
|
|
|
45
|
-
import type { SharedTreeBranch } from "./branch.js";
|
|
45
|
+
import type { BranchId, SharedTreeBranch } from "./branch.js";
|
|
46
46
|
import { BranchCommitEnricher } from "./branchCommitEnricher.js";
|
|
47
47
|
import { type ChangeEnricherReadonlyCheckout, NoOpChangeEnricher } from "./changeEnricher.js";
|
|
48
48
|
import { DefaultResubmitMachine } from "./defaultResubmitMachine.js";
|
|
49
49
|
import { EditManager, minimumPossibleSequenceNumber } from "./editManager.js";
|
|
50
50
|
import { makeEditManagerCodec } from "./editManagerCodecs.js";
|
|
51
|
-
import type { SeqNumber } from "./
|
|
51
|
+
import type { SeqNumber } from "./editManagerFormatCommons.js";
|
|
52
52
|
import { EditManagerSummarizer } from "./editManagerSummarizer.js";
|
|
53
53
|
import { type MessageEncodingContext, makeMessageCodec } from "./messageCodecs.js";
|
|
54
54
|
import type { DecodedMessage } from "./messageTypes.js";
|
|
@@ -98,8 +98,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
98
98
|
MessageEncodingContext
|
|
99
99
|
>;
|
|
100
100
|
|
|
101
|
-
private readonly
|
|
102
|
-
public readonly commitEnricher: BranchCommitEnricher<TChange>;
|
|
101
|
+
private readonly enrichers: Map<BranchId, EnricherState<TChange>> = new Map();
|
|
103
102
|
|
|
104
103
|
public readonly mintRevisionTag: () => RevisionTag;
|
|
105
104
|
|
|
@@ -120,10 +119,10 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
120
119
|
public readonly submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,
|
|
121
120
|
logger: ITelemetryBaseLogger | undefined,
|
|
122
121
|
summarizables: readonly Summarizable[],
|
|
123
|
-
changeFamily: ChangeFamily<TEditor, TChange>,
|
|
122
|
+
protected readonly changeFamily: ChangeFamily<TEditor, TChange>,
|
|
124
123
|
options: ICodecOptions,
|
|
125
124
|
formatOptions: ExplicitCoreCodecVersions,
|
|
126
|
-
|
|
125
|
+
protected readonly idCompressor: IIdCompressor,
|
|
127
126
|
schema: TreeStoredSchemaRepository,
|
|
128
127
|
schemaPolicy: SchemaPolicy,
|
|
129
128
|
resubmitMachine?: ResubmitMachine<TChange>,
|
|
@@ -154,17 +153,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
154
153
|
rebaseLogger,
|
|
155
154
|
);
|
|
156
155
|
|
|
157
|
-
this.
|
|
158
|
-
if (this.detachedRevision === undefined) {
|
|
159
|
-
// Commit enrichment is only necessary for changes that will be submitted as ops, and changes issued while detached are not submitted.
|
|
160
|
-
this.commitEnricher.processChange(change);
|
|
161
|
-
}
|
|
162
|
-
if (change.type === "append") {
|
|
163
|
-
for (const commit of change.newCommits) {
|
|
164
|
-
this.submitCommit(commit, this.schemaAndPolicy, false);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
});
|
|
156
|
+
this.registerSharedBranch("main");
|
|
168
157
|
|
|
169
158
|
const revisionTagCodec = new RevisionTagCodec(idCompressor);
|
|
170
159
|
const editManagerCodec = makeEditManagerCodec(
|
|
@@ -194,15 +183,11 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
194
183
|
formatOptions.message,
|
|
195
184
|
);
|
|
196
185
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
changeFamily.rebaser.invert(change, true, this.mintRevisionTag()),
|
|
203
|
-
changeEnricher,
|
|
204
|
-
);
|
|
205
|
-
this.commitEnricher = new BranchCommitEnricher(changeFamily.rebaser, changeEnricher);
|
|
186
|
+
this.registerSharedBranchForEditing(
|
|
187
|
+
"main",
|
|
188
|
+
enricher ?? new NoOpChangeEnricher(),
|
|
189
|
+
resubmitMachine,
|
|
190
|
+
);
|
|
206
191
|
}
|
|
207
192
|
|
|
208
193
|
// TODO: SharedObject's merging of the two summary methods into summarizeCore is not what we want here:
|
|
@@ -245,7 +230,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
245
230
|
|
|
246
231
|
public async loadCore(services: IChannelStorageService): Promise<void> {
|
|
247
232
|
assert(
|
|
248
|
-
this.
|
|
233
|
+
this.getLocalBranch().getHead() === this.editManager.getTrunkHead("main"),
|
|
249
234
|
0xaaa /* All local changes should be applied to the trunk before loading from summary */,
|
|
250
235
|
);
|
|
251
236
|
const [editManagerSummarizer, ...summarizables] = this.summarizables;
|
|
@@ -259,8 +244,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
259
244
|
// First, finish loading the edit manager so that we can inspect the sequence numbers of the commits on the trunk.
|
|
260
245
|
await loadEditManager;
|
|
261
246
|
|
|
262
|
-
const
|
|
263
|
-
const latestDetachedSequenceNumber = this.editManager.getSequenceNumber(head);
|
|
247
|
+
const latestDetachedSequenceNumber = this.editManager.getLatestSequenceNumber();
|
|
264
248
|
// When we load a summary for a tree that was never attached,
|
|
265
249
|
// latestDetachedSequenceNumber is either undefined (no commits in summary) or negative (all commits in summary were made while detached).
|
|
266
250
|
// We only need to update `this.detachedRevision` in the latter case.
|
|
@@ -273,6 +257,21 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
273
257
|
}
|
|
274
258
|
}
|
|
275
259
|
|
|
260
|
+
private registerSharedBranch(branchId: BranchId): void {
|
|
261
|
+
this.editManager.getLocalBranch(branchId).events.on("beforeChange", (change) => {
|
|
262
|
+
if (change.type === "append") {
|
|
263
|
+
if (this.detachedRevision === undefined) {
|
|
264
|
+
// Commit enrichment is only necessary for changes that will be submitted as ops, and changes issued while detached are not submitted.
|
|
265
|
+
this.getCommitEnricher(branchId).processChange(change);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
for (const commit of change.newCommits) {
|
|
269
|
+
this.submitCommit(branchId, commit, this.schemaAndPolicy, false);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
276
275
|
private async loadSummarizable(
|
|
277
276
|
summarizable: Summarizable,
|
|
278
277
|
services: IChannelStorageService,
|
|
@@ -290,6 +289,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
290
289
|
* and may differ from `commit` due to enrichments like detached tree refreshers.
|
|
291
290
|
*/
|
|
292
291
|
protected submitCommit(
|
|
292
|
+
branchId: BranchId,
|
|
293
293
|
commit: GraphCommit<TChange>,
|
|
294
294
|
schemaAndPolicy: ClonableSchemaAndPolicy,
|
|
295
295
|
isResubmit: boolean,
|
|
@@ -301,7 +301,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
301
301
|
|
|
302
302
|
const enrichedCommit =
|
|
303
303
|
this.detachedRevision === undefined && !isResubmit
|
|
304
|
-
? this.
|
|
304
|
+
? this.getCommitEnricher(branchId).enrich(commit)
|
|
305
305
|
: commit;
|
|
306
306
|
|
|
307
307
|
// Edits submitted before the first attach are treated as sequenced because they will be included
|
|
@@ -319,22 +319,40 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
319
319
|
this.editManager.advanceMinimumSequenceNumber(newRevision, false);
|
|
320
320
|
return undefined;
|
|
321
321
|
}
|
|
322
|
-
|
|
322
|
+
|
|
323
|
+
this.submitMessage(
|
|
323
324
|
{
|
|
325
|
+
type: "commit",
|
|
324
326
|
commit: enrichedCommit,
|
|
325
327
|
sessionId: this.editManager.localSessionId,
|
|
328
|
+
branchId,
|
|
326
329
|
},
|
|
327
|
-
|
|
328
|
-
idCompressor: this.idCompressor,
|
|
329
|
-
schema: schemaAndPolicy,
|
|
330
|
-
},
|
|
330
|
+
schemaAndPolicy,
|
|
331
331
|
);
|
|
332
|
-
|
|
332
|
+
|
|
333
|
+
this.getResubmitMachine(branchId).onCommitSubmitted(enrichedCommit);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
protected submitBranchCreation(branchId: BranchId): void {
|
|
337
|
+
this.submitMessage(
|
|
338
|
+
{ type: "branch", sessionId: this.editManager.localSessionId, branchId },
|
|
339
|
+
this.schemaAndPolicy,
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
private submitMessage(
|
|
344
|
+
message: DecodedMessage<TChange>,
|
|
345
|
+
schemaAndPolicy: ClonableSchemaAndPolicy,
|
|
346
|
+
): void {
|
|
347
|
+
const encodedMessage = this.messageCodec.encode(message, {
|
|
348
|
+
idCompressor: this.idCompressor,
|
|
349
|
+
schema: schemaAndPolicy,
|
|
350
|
+
});
|
|
351
|
+
this.submitLocalMessage(encodedMessage, {
|
|
333
352
|
// Clone the schema to ensure that during resubmit the schema has not been mutated by later changes
|
|
334
353
|
schema: schemaAndPolicy.schema.clone(),
|
|
335
354
|
policy: schemaAndPolicy.policy,
|
|
336
355
|
});
|
|
337
|
-
this.resubmitMachine.onCommitSubmitted(enrichedCommit);
|
|
338
356
|
}
|
|
339
357
|
|
|
340
358
|
/**
|
|
@@ -344,43 +362,113 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
344
362
|
const { envelope, local, messagesContent } = messagesCollection;
|
|
345
363
|
const commits: GraphCommit<TChange>[] = [];
|
|
346
364
|
let messagesSessionId: SessionId | undefined;
|
|
365
|
+
let branchId: BranchId | undefined;
|
|
366
|
+
|
|
367
|
+
const processBunch = (branch: BranchId): void => {
|
|
368
|
+
assert(messagesSessionId !== undefined, 0xada /* Messages must have a session ID */);
|
|
369
|
+
this.processCommits(
|
|
370
|
+
messagesSessionId,
|
|
371
|
+
brand(envelope.sequenceNumber),
|
|
372
|
+
brand(envelope.referenceSequenceNumber),
|
|
373
|
+
local,
|
|
374
|
+
branch,
|
|
375
|
+
commits,
|
|
376
|
+
);
|
|
377
|
+
|
|
378
|
+
commits.length = 0;
|
|
379
|
+
};
|
|
347
380
|
|
|
348
381
|
// Get a list of all the commits from the messages.
|
|
349
382
|
for (const messageContent of messagesContent) {
|
|
350
383
|
// Empty context object is passed in, as our decode function is schema-agnostic.
|
|
351
|
-
const
|
|
384
|
+
const message = this.messageCodec.decode(messageContent.contents, {
|
|
352
385
|
idCompressor: this.idCompressor,
|
|
353
386
|
});
|
|
354
|
-
commits.push(commit);
|
|
355
387
|
|
|
356
388
|
if (messagesSessionId !== undefined) {
|
|
357
389
|
assert(
|
|
358
|
-
messagesSessionId === sessionId,
|
|
390
|
+
messagesSessionId === message.sessionId,
|
|
359
391
|
0xad9 /* All messages in a bunch must have the same session ID */,
|
|
360
392
|
);
|
|
361
393
|
}
|
|
362
|
-
messagesSessionId = sessionId;
|
|
394
|
+
messagesSessionId = message.sessionId;
|
|
395
|
+
|
|
396
|
+
const type = message.type;
|
|
397
|
+
switch (type) {
|
|
398
|
+
case "commit": {
|
|
399
|
+
if (branchId !== undefined && message.branchId !== branchId) {
|
|
400
|
+
processBunch(branchId);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
branchId = message.branchId;
|
|
404
|
+
commits.push(message.commit);
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
case "branch": {
|
|
408
|
+
if (branchId !== undefined) {
|
|
409
|
+
processBunch(branchId);
|
|
410
|
+
}
|
|
411
|
+
this.editManager.sequenceBranchCreation(
|
|
412
|
+
messagesSessionId,
|
|
413
|
+
brand(envelope.referenceSequenceNumber),
|
|
414
|
+
message.branchId,
|
|
415
|
+
);
|
|
416
|
+
|
|
417
|
+
this.registerSharedBranch(message.branchId);
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
default:
|
|
421
|
+
unreachableCase(type);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (branchId !== undefined) {
|
|
426
|
+
processBunch(branchId);
|
|
363
427
|
}
|
|
364
428
|
|
|
365
|
-
|
|
429
|
+
this.editManager.advanceMinimumSequenceNumber(brand(envelope.minimumSequenceNumber));
|
|
430
|
+
}
|
|
366
431
|
|
|
432
|
+
private processCommits(
|
|
433
|
+
sessionId: SessionId,
|
|
434
|
+
sequenceNumber: SeqNumber,
|
|
435
|
+
referenceSequenceNumber: SeqNumber,
|
|
436
|
+
isLocal: boolean,
|
|
437
|
+
branchId: BranchId,
|
|
438
|
+
commits: readonly GraphCommit<TChange>[],
|
|
439
|
+
): void {
|
|
367
440
|
this.editManager.addSequencedChanges(
|
|
368
441
|
commits,
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
442
|
+
sessionId,
|
|
443
|
+
sequenceNumber,
|
|
444
|
+
referenceSequenceNumber,
|
|
445
|
+
branchId,
|
|
372
446
|
);
|
|
373
447
|
|
|
374
448
|
// Update the resubmit machine for each commit applied.
|
|
375
|
-
for (const _ of
|
|
376
|
-
this.
|
|
449
|
+
for (const _ of commits) {
|
|
450
|
+
this.tryGetResubmitMachine(branchId)?.onSequencedCommitApplied(isLocal);
|
|
377
451
|
}
|
|
378
|
-
|
|
379
|
-
this.editManager.advanceMinimumSequenceNumber(brand(envelope.minimumSequenceNumber));
|
|
380
452
|
}
|
|
381
453
|
|
|
382
454
|
public getLocalBranch(): SharedTreeBranch<TEditor, TChange> {
|
|
383
|
-
return this.editManager.
|
|
455
|
+
return this.editManager.getLocalBranch("main");
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
public createSharedBranch(): string {
|
|
459
|
+
const branchId = this.idCompressor.generateCompressedId();
|
|
460
|
+
this.addBranch(branchId);
|
|
461
|
+
this.submitBranchCreation(branchId);
|
|
462
|
+
return this.idCompressor.decompress(branchId);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
protected addBranch(branchId: BranchId): void {
|
|
466
|
+
this.editManager.addBranch(branchId);
|
|
467
|
+
this.registerSharedBranch(branchId);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
public getSharedBranch(branchId: BranchId): SharedTreeBranch<TEditor, TChange> {
|
|
471
|
+
return this.editManager.getLocalBranch(branchId);
|
|
384
472
|
}
|
|
385
473
|
|
|
386
474
|
public didAttach(): void {
|
|
@@ -389,52 +477,150 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
|
|
|
389
477
|
|
|
390
478
|
public reSubmitCore(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {
|
|
391
479
|
// Empty context object is passed in, as our decode function is schema-agnostic.
|
|
392
|
-
const {
|
|
393
|
-
commit: { revision },
|
|
394
|
-
} = this.messageCodec.decode(this.serializer.decode(content), {
|
|
480
|
+
const message = this.messageCodec.decode(this.serializer.decode(content), {
|
|
395
481
|
idCompressor: this.idCompressor,
|
|
396
482
|
});
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
483
|
+
|
|
484
|
+
const type = message.type;
|
|
485
|
+
switch (type) {
|
|
486
|
+
case "commit": {
|
|
487
|
+
const {
|
|
488
|
+
commit: { revision },
|
|
489
|
+
branchId,
|
|
490
|
+
} = message;
|
|
491
|
+
|
|
492
|
+
const resubmitMachine = this.getResubmitMachine(branchId);
|
|
493
|
+
// If a resubmit phase is not already in progress, then this must be the first commit of a new resubmit phase.
|
|
494
|
+
if (resubmitMachine.isInResubmitPhase === false) {
|
|
495
|
+
const localCommits = this.editManager.getLocalCommits(branchId);
|
|
496
|
+
const revisionIndex = localCommits.findIndex((c) => c.revision === revision);
|
|
497
|
+
assert(revisionIndex >= 0, 0xbdb /* revision must exist in local commits */);
|
|
498
|
+
const toResubmit = localCommits.slice(revisionIndex);
|
|
499
|
+
resubmitMachine.prepareForResubmit(toResubmit);
|
|
500
|
+
}
|
|
501
|
+
assert(
|
|
502
|
+
isClonableSchemaPolicy(localOpMetadata),
|
|
503
|
+
0x95e /* Local metadata must contain schema and policy. */,
|
|
504
|
+
);
|
|
505
|
+
assert(
|
|
506
|
+
resubmitMachine.isInResubmitPhase !== false,
|
|
507
|
+
0x984 /* Invalid resubmit outside of resubmit phase */,
|
|
508
|
+
);
|
|
509
|
+
const enrichedCommit = resubmitMachine.peekNextCommit();
|
|
510
|
+
this.submitCommit(branchId, enrichedCommit, localOpMetadata, true);
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
case "branch": {
|
|
514
|
+
this.submitBranchCreation(message.branchId);
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
default:
|
|
518
|
+
unreachableCase(type);
|
|
404
519
|
}
|
|
405
|
-
assert(
|
|
406
|
-
isClonableSchemaPolicy(localOpMetadata),
|
|
407
|
-
0x95e /* Local metadata must contain schema and policy. */,
|
|
408
|
-
);
|
|
409
|
-
assert(
|
|
410
|
-
this.resubmitMachine.isInResubmitPhase !== false,
|
|
411
|
-
0x984 /* Invalid resubmit outside of resubmit phase */,
|
|
412
|
-
);
|
|
413
|
-
const enrichedCommit = this.resubmitMachine.peekNextCommit();
|
|
414
|
-
this.submitCommit(enrichedCommit, localOpMetadata, true);
|
|
415
520
|
}
|
|
521
|
+
|
|
416
522
|
public rollback(content: JsonCompatibleReadOnly, localOpMetadata: unknown): void {
|
|
417
523
|
// Empty context object is passed in, as our decode function is schema-agnostic.
|
|
418
|
-
const {
|
|
419
|
-
commit: { revision },
|
|
420
|
-
} = this.messageCodec.decode(this.serializer.decode(content), {
|
|
524
|
+
const message = this.messageCodec.decode(this.serializer.decode(content), {
|
|
421
525
|
idCompressor: this.idCompressor,
|
|
422
526
|
});
|
|
423
|
-
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
527
|
+
|
|
528
|
+
const type = message.type;
|
|
529
|
+
switch (type) {
|
|
530
|
+
case "commit": {
|
|
531
|
+
const {
|
|
532
|
+
commit: { revision },
|
|
533
|
+
branchId,
|
|
534
|
+
} = message;
|
|
535
|
+
const branch = this.editManager.getLocalBranch(branchId);
|
|
536
|
+
const head = branch.getHead();
|
|
537
|
+
assert(head.revision === revision, "Can only rollback latest commit");
|
|
538
|
+
const newHead = head.parent ?? fail("must have parent");
|
|
539
|
+
branch.removeAfter(newHead);
|
|
540
|
+
this.getResubmitMachine(branchId).onCommitRollback(head);
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
543
|
+
case "branch": {
|
|
544
|
+
this.editManager.removeBranch(message.branchId);
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
default:
|
|
548
|
+
unreachableCase(type);
|
|
549
|
+
}
|
|
429
550
|
}
|
|
430
551
|
|
|
431
552
|
public applyStashedOp(content: JsonCompatibleReadOnly): void {
|
|
432
553
|
// Empty context object is passed in, as our decode function is schema-agnostic.
|
|
433
|
-
const {
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
|
|
554
|
+
const message = this.messageCodec.decode(this.serializer.decode(content), {
|
|
555
|
+
idCompressor: this.idCompressor,
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
const type = message.type;
|
|
559
|
+
switch (type) {
|
|
560
|
+
case "commit": {
|
|
561
|
+
const {
|
|
562
|
+
commit: { revision, change },
|
|
563
|
+
branchId,
|
|
564
|
+
} = message;
|
|
565
|
+
this.editManager.getLocalBranch(branchId).apply({ change, revision });
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
case "branch": {
|
|
569
|
+
this.editManager.addBranch(message.branchId);
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
default:
|
|
573
|
+
unreachableCase(type);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
protected registerSharedBranchForEditing(
|
|
578
|
+
branchId: BranchId,
|
|
579
|
+
enricher: ChangeEnricherReadonlyCheckout<TChange>,
|
|
580
|
+
resubmitMachine?: ResubmitMachine<TChange>,
|
|
581
|
+
): void {
|
|
582
|
+
const changeEnricher = enricher ?? new NoOpChangeEnricher();
|
|
583
|
+
const commitEnricher = new BranchCommitEnricher(this.changeFamily.rebaser, changeEnricher);
|
|
584
|
+
assert(!this.enrichers.has(branchId), "Branch already registered");
|
|
585
|
+
this.enrichers.set(branchId, {
|
|
586
|
+
enricher: commitEnricher,
|
|
587
|
+
resubmitMachine:
|
|
588
|
+
resubmitMachine ??
|
|
589
|
+
new DefaultResubmitMachine(
|
|
590
|
+
(change: TaggedChange<TChange>) =>
|
|
591
|
+
this.changeFamily.rebaser.invert(change, true, this.mintRevisionTag()),
|
|
592
|
+
changeEnricher,
|
|
593
|
+
),
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
private getResubmitMachine(branchId: BranchId): ResubmitMachine<TChange> {
|
|
598
|
+
return this.getEnricherState(branchId).resubmitMachine;
|
|
437
599
|
}
|
|
600
|
+
|
|
601
|
+
private tryGetResubmitMachine(branchId: BranchId): ResubmitMachine<TChange> | undefined {
|
|
602
|
+
return this.tryGetEnricherState(branchId)?.resubmitMachine;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
public getCommitEnricher(branchId: BranchId): BranchCommitEnricher<TChange> {
|
|
606
|
+
return this.getEnricherState(branchId).enricher;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
private getEnricherState(branchId: BranchId): EnricherState<TChange> {
|
|
610
|
+
return (
|
|
611
|
+
this.tryGetEnricherState(branchId) ??
|
|
612
|
+
fail("Expected to have a resubmit machine for this branch")
|
|
613
|
+
);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
private tryGetEnricherState(branchId: BranchId): EnricherState<TChange> | undefined {
|
|
617
|
+
return this.enrichers.get(branchId);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
interface EnricherState<TChange> {
|
|
622
|
+
readonly enricher: BranchCommitEnricher<TChange>;
|
|
623
|
+
readonly resubmitMachine: ResubmitMachine<TChange>;
|
|
438
624
|
}
|
|
439
625
|
|
|
440
626
|
function isClonableSchemaPolicy(
|
|
@@ -99,6 +99,21 @@ export interface ITreeAlpha extends ITree {
|
|
|
99
99
|
* To get the schema using property keys, use {@link getSimpleSchema} on the view schema.
|
|
100
100
|
*/
|
|
101
101
|
exportSimpleSchema(): SimpleTreeSchema;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Creates a fork of the current state of the main branch.
|
|
105
|
+
* This new branch will be shared with and editable by all clients.
|
|
106
|
+
*/
|
|
107
|
+
createSharedBranch(): string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns a view of the tree on the specified shared branch, using the provided schema.
|
|
111
|
+
* See {@link ViewableTree.viewWith}.
|
|
112
|
+
*/
|
|
113
|
+
viewSharedBranchWith<TRoot extends ImplicitFieldSchema>(
|
|
114
|
+
branchId: string,
|
|
115
|
+
config: TreeViewConfiguration<TRoot>,
|
|
116
|
+
): TreeView<TRoot>;
|
|
102
117
|
}
|
|
103
118
|
|
|
104
119
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editManagerFormat.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAA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AAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CACvE,CAAC,CAAC;AASH,MAAM,eAAe,GAAG,CAA+B,OAAqB,EAAE,EAAE,CAC/E,cAAI,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAkBtE,MAAM,oBAAoB,GAAG,CAA+B,OAAqB,EAAE,EAAE,CACpF,cAAI,CAAC,MAAM,CACV;IACC,IAAI,EAAE,4BAAiB;IACvB,OAAO,EAAE,cAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CACpC,EACD,iBAAiB,CACjB,CAAC;AAQI,MAAM,kBAAkB,GAAG,CAA+B,OAAqB,EAAE,EAAE,CACzF,cAAI,CAAC,MAAM,CACV;IACC,OAAO,EAAE,cAAI,CAAC,KAAK,CAAC;QACnB,cAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACf,cAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACf,cAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACf,cAAI,CAAC,OAAO,CAAC,CAAC,CAAC;KACf,CAAC;IACF,KAAK,EAAE,cAAI,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAC3C,QAAQ,EAAE,cAAI,CAAC,KAAK,CAAC,cAAI,CAAC,KAAK,CAAC,CAAC,0BAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CAClF,EACD,iBAAiB,CACjB,CAAC;AAbU,QAAA,kBAAkB,sBAa5B;AAEH,oEAAoE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport { type ObjectOptions, type Static, type TSchema, Type } from \"@sinclair/typebox\";\n\nimport {\n\ttype EncodedRevisionTag,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n\tSessionIdSchema,\n} from \"../core/index.js\";\nimport { type Brand, brandedNumberType } from \"../util/index.js\";\n\n/**\n * Contains a single change to the `SharedTree` and associated metadata.\n *\n * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.\n * If this is an encoded format, clarify the difference between it and EncodedCommit.\n */\nexport interface Commit<TChangeset> {\n\treadonly revision: RevisionTag;\n\treadonly change: TChangeset;\n\t/** An identifier representing the session/user/client that made this commit */\n\treadonly sessionId: SessionId;\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type EncodedCommit<TChangeset> = {\n\treadonly revision: EncodedRevisionTag;\n\treadonly change: TChangeset;\n\treadonly sessionId: SessionId;\n};\n\nconst noAdditionalProps: ObjectOptions = { additionalProperties: false };\n\n// Many of the return types in this module are intentionally derived, rather than explicitly specified.\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n\nconst CommitBase = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object({\n\t\trevision: RevisionTagSchema,\n\t\tchange: tChange,\n\t\tsessionId: SessionIdSchema,\n\t});\n/**\n * @privateRemarks Commits are generally encoded from `GraphCommit`s, which often contain extra data.\n * This `noAdditionalProps` is especially important in that light.\n */\nconst Commit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Composite([CommitBase(tChange)], noAdditionalProps);\n\nexport type SeqNumber = Brand<number, \"edit-manager.SeqNumber\">;\nconst SeqNumber = brandedNumberType<SeqNumber>({ multipleOf: 1 });\n\nconst SequenceId = Type.Object({\n\tsequenceNumber: SeqNumber,\n\tindexInBatch: Type.Optional(Type.Number({ multipleOf: 1, minimum: 0 })),\n});\n\nexport type SequenceId = Static<typeof SequenceId>;\n\n/**\n * A commit with a sequence number but no parentage; used for serializing the `EditManager` into a summary\n */\nexport interface SequencedCommit<TChangeset> extends Commit<TChangeset>, SequenceId {}\n\nconst SequencedCommit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Composite([CommitBase(tChange), SequenceId], noAdditionalProps);\n\n/**\n * A branch off of the trunk for use in summaries.\n *\n * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.\n * If this is an encoded format, use EncodedCommit instead of Commit or clarify that Commit is also an encoded format.\n */\nexport interface SummarySessionBranch<TChangeset> {\n\treadonly base: RevisionTag;\n\treadonly commits: Commit<TChangeset>[];\n}\n\nexport interface EncodedSummarySessionBranch<TChangeset> {\n\treadonly base: EncodedRevisionTag;\n\treadonly commits: Commit<TChangeset>[];\n}\n\nconst SummarySessionBranch = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object(\n\t\t{\n\t\t\tbase: RevisionTagSchema,\n\t\t\tcommits: Type.Array(Commit(tChange)),\n\t\t},\n\t\tnoAdditionalProps,\n\t);\n\nexport interface EncodedEditManager<TChangeset> {\n\treadonly trunk: readonly Readonly<SequencedCommit<TChangeset>>[];\n\treadonly branches: readonly [SessionId, Readonly<EncodedSummarySessionBranch<TChangeset>>][];\n\treadonly version: 1 | 2 | 3 | 4;\n}\n\nexport const EncodedEditManager = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object(\n\t\t{\n\t\t\tversion: Type.Union([\n\t\t\t\tType.Literal(1),\n\t\t\t\tType.Literal(2),\n\t\t\t\tType.Literal(3),\n\t\t\t\tType.Literal(4),\n\t\t\t]),\n\t\t\ttrunk: Type.Array(SequencedCommit(tChange)),\n\t\t\tbranches: Type.Array(Type.Tuple([SessionIdSchema, SummarySessionBranch(tChange)])),\n\t\t},\n\t\tnoAdditionalProps,\n\t);\n\n/* eslint-enable @typescript-eslint/explicit-function-return-type */\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messageFormat.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/messageFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,KAAK,kBAAkB,EAAsC,MAAM,kBAAkB,CAAC;AAC/F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;IAE3C;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC1B;AAID,eAAO,MAAM,OAAO,0CAA2C,YAAY;;;;;EAMxE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messageFormat.js","sourceRoot":"","sources":["../../src/shared-tree-core/messageFormat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+CAAuD;AAEvD,+CAA+F;AA6B/F,wCAAwC;AACxC,4EAA4E;AACrE,MAAM,OAAO,GAAG,CAA+B,OAAqB,EAAE,EAAE,CAC9E,cAAI,CAAC,MAAM,CAAC;IACX,QAAQ,EAAE,4BAAiB;IAC3B,YAAY,EAAE,0BAAe;IAC7B,SAAS,EAAE,OAAO;IAClB,OAAO,EAAE,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC;CACrC,CAAC,CAAC;AANS,QAAA,OAAO,WAMhB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport { type TSchema, Type } from \"@sinclair/typebox\";\n\nimport { type EncodedRevisionTag, RevisionTagSchema, SessionIdSchema } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\n/**\n * The format of messages that SharedTree sends and receives.\n */\nexport interface Message {\n\t/**\n\t * The revision tag for the change in this message\n\t */\n\treadonly revision: EncodedRevisionTag;\n\t/**\n\t * The stable ID that identifies the originator of the message.\n\t */\n\treadonly originatorId: SessionId;\n\t/**\n\t * The changeset to be applied.\n\t */\n\treadonly changeset: JsonCompatibleReadOnly;\n\n\t/**\n\t * The version of the message. This controls how the message is encoded.\n\t *\n\t * This was not set historically and was added before making any breaking changes to the format.\n\t * For that reason, absence of a 'version' field is synonymous with version 1.\n\t */\n\treadonly version?: number;\n}\n\n// Return type is intentionally derived.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport const Message = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object({\n\t\trevision: RevisionTagSchema,\n\t\toriginatorId: SessionIdSchema,\n\t\tchangeset: tChange,\n\t\tversion: Type.Optional(Type.Number()),\n\t});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editManagerFormat.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/editManagerFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAsB,KAAK,MAAM,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAC;AAExF,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAGhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,KAAK,EAAqB,MAAM,kBAAkB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,MAAM,CAAC,UAAU;IACjC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,EAAE,SAAS,CA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AqB,EAAE,EAAE,CACpF,IAAI,CAAC,MAAM,CACV;IACC,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CACpC,EACD,iBAAiB,CACjB,CAAC;AAQH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAA+B,OAAqB,EAAE,EAAE,CACzF,IAAI,CAAC,MAAM,CACV;IACC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;KACf,CAAC;IACF,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAC3C,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CAClF,EACD,iBAAiB,CACjB,CAAC;AAEH,oEAAoE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport { type ObjectOptions, type Static, type TSchema, Type } from \"@sinclair/typebox\";\n\nimport {\n\ttype EncodedRevisionTag,\n\ttype RevisionTag,\n\tRevisionTagSchema,\n\tSessionIdSchema,\n} from \"../core/index.js\";\nimport { type Brand, brandedNumberType } from \"../util/index.js\";\n\n/**\n * Contains a single change to the `SharedTree` and associated metadata.\n *\n * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.\n * If this is an encoded format, clarify the difference between it and EncodedCommit.\n */\nexport interface Commit<TChangeset> {\n\treadonly revision: RevisionTag;\n\treadonly change: TChangeset;\n\t/** An identifier representing the session/user/client that made this commit */\n\treadonly sessionId: SessionId;\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type EncodedCommit<TChangeset> = {\n\treadonly revision: EncodedRevisionTag;\n\treadonly change: TChangeset;\n\treadonly sessionId: SessionId;\n};\n\nconst noAdditionalProps: ObjectOptions = { additionalProperties: false };\n\n// Many of the return types in this module are intentionally derived, rather than explicitly specified.\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n\nconst CommitBase = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object({\n\t\trevision: RevisionTagSchema,\n\t\tchange: tChange,\n\t\tsessionId: SessionIdSchema,\n\t});\n/**\n * @privateRemarks Commits are generally encoded from `GraphCommit`s, which often contain extra data.\n * This `noAdditionalProps` is especially important in that light.\n */\nconst Commit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Composite([CommitBase(tChange)], noAdditionalProps);\n\nexport type SeqNumber = Brand<number, \"edit-manager.SeqNumber\">;\nconst SeqNumber = brandedNumberType<SeqNumber>({ multipleOf: 1 });\n\nconst SequenceId = Type.Object({\n\tsequenceNumber: SeqNumber,\n\tindexInBatch: Type.Optional(Type.Number({ multipleOf: 1, minimum: 0 })),\n});\n\nexport type SequenceId = Static<typeof SequenceId>;\n\n/**\n * A commit with a sequence number but no parentage; used for serializing the `EditManager` into a summary\n */\nexport interface SequencedCommit<TChangeset> extends Commit<TChangeset>, SequenceId {}\n\nconst SequencedCommit = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Composite([CommitBase(tChange), SequenceId], noAdditionalProps);\n\n/**\n * A branch off of the trunk for use in summaries.\n *\n * TODO: if this type is not used in the encoded format, move it out of this file, and stop using it in EncodedEditManager.\n * If this is an encoded format, use EncodedCommit instead of Commit or clarify that Commit is also an encoded format.\n */\nexport interface SummarySessionBranch<TChangeset> {\n\treadonly base: RevisionTag;\n\treadonly commits: Commit<TChangeset>[];\n}\n\nexport interface EncodedSummarySessionBranch<TChangeset> {\n\treadonly base: EncodedRevisionTag;\n\treadonly commits: Commit<TChangeset>[];\n}\n\nconst SummarySessionBranch = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object(\n\t\t{\n\t\t\tbase: RevisionTagSchema,\n\t\t\tcommits: Type.Array(Commit(tChange)),\n\t\t},\n\t\tnoAdditionalProps,\n\t);\n\nexport interface EncodedEditManager<TChangeset> {\n\treadonly trunk: readonly Readonly<SequencedCommit<TChangeset>>[];\n\treadonly branches: readonly [SessionId, Readonly<EncodedSummarySessionBranch<TChangeset>>][];\n\treadonly version: 1 | 2 | 3 | 4;\n}\n\nexport const EncodedEditManager = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object(\n\t\t{\n\t\t\tversion: Type.Union([\n\t\t\t\tType.Literal(1),\n\t\t\t\tType.Literal(2),\n\t\t\t\tType.Literal(3),\n\t\t\t\tType.Literal(4),\n\t\t\t]),\n\t\t\ttrunk: Type.Array(SequencedCommit(tChange)),\n\t\t\tbranches: Type.Array(Type.Tuple([SessionIdSchema, SummarySessionBranch(tChange)])),\n\t\t},\n\t\tnoAdditionalProps,\n\t);\n\n/* eslint-enable @typescript-eslint/explicit-function-return-type */\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messageFormat.d.ts","sourceRoot":"","sources":["../../src/shared-tree-core/messageFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,EAAQ,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,KAAK,kBAAkB,EAAsC,MAAM,kBAAkB,CAAC;AAC/F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;IAE3C;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC1B;AAID,eAAO,MAAM,OAAO,0CAA2C,YAAY;;;;;EAMxE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messageFormat.js","sourceRoot":"","sources":["../../src/shared-tree-core/messageFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAgB,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAA2B,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AA6B/F,wCAAwC;AACxC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,OAAO,GAAG,CAA+B,OAAqB,EAAE,EAAE,CAC9E,IAAI,CAAC,MAAM,CAAC;IACX,QAAQ,EAAE,iBAAiB;IAC3B,YAAY,EAAE,eAAe;IAC7B,SAAS,EAAE,OAAO;IAClB,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;CACrC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionId } from \"@fluidframework/id-compressor\";\nimport { type TSchema, Type } from \"@sinclair/typebox\";\n\nimport { type EncodedRevisionTag, RevisionTagSchema, SessionIdSchema } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\n/**\n * The format of messages that SharedTree sends and receives.\n */\nexport interface Message {\n\t/**\n\t * The revision tag for the change in this message\n\t */\n\treadonly revision: EncodedRevisionTag;\n\t/**\n\t * The stable ID that identifies the originator of the message.\n\t */\n\treadonly originatorId: SessionId;\n\t/**\n\t * The changeset to be applied.\n\t */\n\treadonly changeset: JsonCompatibleReadOnly;\n\n\t/**\n\t * The version of the message. This controls how the message is encoded.\n\t *\n\t * This was not set historically and was added before making any breaking changes to the format.\n\t * For that reason, absence of a 'version' field is synonymous with version 1.\n\t */\n\treadonly version?: number;\n}\n\n// Return type is intentionally derived.\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport const Message = <ChangeSchema extends TSchema>(tChange: ChangeSchema) =>\n\tType.Object({\n\t\trevision: RevisionTagSchema,\n\t\toriginatorId: SessionIdSchema,\n\t\tchangeset: tChange,\n\t\tversion: Type.Optional(Type.Number()),\n\t});\n"]}
|
|
File without changes
|