@fluidframework/tree 2.116.0-416006 → 2.116.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -0
- package/README.md +5 -3
- package/api-report/tree.alpha.api.md +4 -2
- package/api-report/tree.beta.api.md +1 -1
- package/api-report/tree.legacy.beta.api.md +1 -1
- package/dist/codec/codec.d.ts +6 -6
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +3 -3
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +3 -3
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/core/forest/editableForest.d.ts +2 -0
- package/dist/core/forest/editableForest.d.ts.map +1 -1
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +2 -2
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +24 -3
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +24 -6
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +30 -6
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +146 -54
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts +2 -1
- package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -1
- package/dist/feature-libraries/comparison-forest/comparisonForest.js +87 -70
- package/dist/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +5 -0
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +127 -107
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryTypes.d.ts +2 -2
- package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/modular-schema/invert.js +1 -1
- package/dist/feature-libraries/modular-schema/invert.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +2 -11
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts +11 -16
- package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js +10 -3
- package/dist/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +34 -13
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +1 -1
- package/dist/feature-libraries/sequence-field/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/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +2 -4
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +30 -5
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +8 -8
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +25 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +24 -0
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +21 -10
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +48 -16
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts +2 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +3 -2
- package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/dist/shared-tree-core/changeEnricher.d.ts +3 -2
- package/dist/shared-tree-core/changeEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/changeEnricher.js.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts +9 -1
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js +7 -2
- package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +2 -2
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +2 -2
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +2 -2
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +2 -2
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +11 -2
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +11 -8
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/summaryTypes.d.ts +2 -2
- package/dist/shared-tree-core/summaryTypes.d.ts.map +1 -1
- package/dist/shared-tree-core/summaryTypes.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +2 -2
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.d.ts +5 -1
- package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +10 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +19 -2
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/tableSchema.d.ts +1 -1
- package/dist/tableSchema.js +1 -1
- package/dist/tableSchema.js.map +1 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +1 -1
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/breakable.d.ts +14 -2
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +9 -1
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/compressedIds.d.ts +2 -2
- package/dist/util/compressedIds.d.ts.map +1 -1
- package/dist/util/compressedIds.js +1 -6
- package/dist/util/compressedIds.js.map +1 -1
- package/lib/codec/codec.d.ts +6 -6
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +3 -3
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +3 -3
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/core/forest/editableForest.d.ts +2 -0
- package/lib/core/forest/editableForest.d.ts.map +1 -1
- package/lib/core/forest/editableForest.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/tree/index.d.ts +1 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +24 -3
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +22 -4
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +30 -6
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +146 -56
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts +2 -1
- package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -1
- package/lib/feature-libraries/comparison-forest/comparisonForest.js +88 -70
- package/lib/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +5 -0
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +129 -108
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/summaryTypes.d.ts +2 -2
- package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/modular-schema/invert.js +2 -2
- package/lib/feature-libraries/modular-schema/invert.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +2 -11
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts +11 -16
- package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js +10 -3
- package/lib/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +35 -14
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +2 -2
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +1 -1
- package/lib/feature-libraries/sequence-field/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/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +3 -5
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +30 -5
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +8 -8
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +25 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +24 -0
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +21 -10
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +48 -16
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts +2 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +3 -2
- package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/lib/shared-tree-core/changeEnricher.d.ts +3 -2
- package/lib/shared-tree-core/changeEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/changeEnricher.js.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts +9 -1
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.js +7 -2
- package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +2 -2
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +2 -2
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +2 -2
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +2 -2
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +11 -2
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +11 -8
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/summaryTypes.d.ts +2 -2
- package/lib/shared-tree-core/summaryTypes.d.ts.map +1 -1
- package/lib/shared-tree-core/summaryTypes.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +2 -2
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.d.ts +5 -1
- package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
- package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +10 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +19 -2
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/tableSchema.d.ts +1 -1
- package/lib/tableSchema.js +1 -1
- package/lib/tableSchema.js.map +1 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +1 -1
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/breakable.d.ts +14 -2
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +9 -1
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/compressedIds.d.ts +2 -2
- package/lib/util/compressedIds.d.ts.map +1 -1
- package/lib/util/compressedIds.js +1 -6
- package/lib/util/compressedIds.js.map +1 -1
- package/package.json +27 -27
- package/src/codec/codec.ts +7 -7
- package/src/codec/versioned/codec.ts +5 -5
- package/src/core/forest/editableForest.ts +2 -0
- package/src/core/index.ts +1 -1
- package/src/core/tree/index.ts +1 -1
- package/src/core/tree/visitorUtils.ts +37 -12
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +214 -59
- package/src/feature-libraries/comparison-forest/comparisonForest.ts +6 -1
- package/src/feature-libraries/detachedFieldIndexSummarizer.ts +2 -2
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +10 -0
- package/src/feature-libraries/forest-summary/summaryTypes.ts +2 -2
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +1 -1
- package/src/feature-libraries/modular-schema/invert.ts +2 -2
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2 -23
- package/src/feature-libraries/modular-schema/modularChangeUtils.ts +12 -21
- package/src/feature-libraries/object-forest/objectForest.ts +48 -14
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +3 -3
- package/src/feature-libraries/sequence-field/rebase.ts +2 -2
- package/src/feature-libraries/sequence-field/utils.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +5 -12
- package/src/shared-tree/sharedTree.ts +41 -10
- package/src/shared-tree/sharedTreeChangeCodecs.ts +2 -2
- package/src/shared-tree/sharedTreeChangeEnricher.ts +25 -1
- package/src/shared-tree/treeCheckout.ts +45 -16
- package/src/shared-tree-core/branchCommitEnricher.ts +6 -2
- package/src/shared-tree-core/changeEnricher.ts +7 -2
- package/src/shared-tree-core/defaultResubmitMachine.ts +5 -0
- package/src/shared-tree-core/editManager.ts +2 -4
- package/src/shared-tree-core/editManagerCodecs.ts +2 -2
- package/src/shared-tree-core/editManagerSummarizer.ts +3 -3
- package/src/shared-tree-core/messageCodecs.ts +2 -2
- package/src/shared-tree-core/sharedTreeCore.ts +29 -11
- package/src/shared-tree-core/summaryTypes.ts +2 -2
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +1 -1
- package/src/simple-tree/api/storedSchema.ts +2 -2
- package/src/simple-tree/api/treeChangeEvents.ts +5 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +15 -0
- package/src/simple-tree/node-kinds/map/mapNode.ts +23 -2
- package/src/tableSchema.ts +1 -1
- package/src/treeFactory.ts +0 -1
- package/src/util/breakable.ts +9 -1
- package/src/util/compressedIds.ts +7 -13
|
@@ -28,12 +28,16 @@ export class BranchCommitEnricher<TChange> {
|
|
|
28
28
|
/**
|
|
29
29
|
* Process the given commits for later {@link BranchCommitEnricher.retrieveChange | retrieval}.
|
|
30
30
|
* @param commits - The commits to prepare.
|
|
31
|
+
* @param forceValidation - Attempt to {@link SharedTreeOptions.validateCommitsOnFirstSubmission|validate} commits before submission in order to fail (throw) locally rather than risk corrupting persisted data.
|
|
31
32
|
*/
|
|
32
|
-
public prepareChanges(
|
|
33
|
+
public prepareChanges(
|
|
34
|
+
commits: readonly GraphCommit<TChange>[],
|
|
35
|
+
forceValidation: boolean,
|
|
36
|
+
): void {
|
|
33
37
|
if (hasSome(commits)) {
|
|
34
38
|
const startingState = commits[0].parent;
|
|
35
39
|
assert(startingState !== undefined, 0xcc1 /* New commits must have a parent. */);
|
|
36
|
-
const enrichedCommits = this.enricher.enrich(startingState, commits);
|
|
40
|
+
const enrichedCommits = this.enricher.enrich(startingState, commits, forceValidation);
|
|
37
41
|
for (const [index, commit] of commits.entries()) {
|
|
38
42
|
const enrichedCommit = enrichedCommits[index];
|
|
39
43
|
assert(enrichedCommit !== undefined, 0xcc2 /* Missing enriched commit. */);
|
|
@@ -13,7 +13,12 @@ export interface ChangeEnricher<TChange> {
|
|
|
13
13
|
* Runs a batch of change enrichments.
|
|
14
14
|
* @param context - The branch head after which the `changes` would apply.
|
|
15
15
|
* @param changes - The changes to be enriched.
|
|
16
|
-
* @
|
|
16
|
+
* @param forceValidation - Attempt to validate enriched changes before submission in order to fail (throw) locally rather than risk corrupting persisted data.
|
|
17
|
+
* See {@link SharedTreeOptions.validateCommitsOnFirstSubmission} and {@link SharedTreeOptions.validateRebasedCommitsBeforeResubmission}.
|
|
17
18
|
*/
|
|
18
|
-
enrich(
|
|
19
|
+
enrich(
|
|
20
|
+
context: GraphCommit<TChange>,
|
|
21
|
+
changes: readonly TaggedChange<TChange>[],
|
|
22
|
+
forceValidation: boolean,
|
|
23
|
+
): TChange[];
|
|
19
24
|
}
|
|
@@ -37,6 +37,10 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
|
|
|
37
37
|
* commits are applied and automatically rebased).
|
|
38
38
|
*/
|
|
39
39
|
private readonly enricher: ChangeEnricher<TChange>,
|
|
40
|
+
/**
|
|
41
|
+
* Attempt to {@link SharedTreeOptions.validateRebasedCommitsBeforeResubmission|validate} commits before resubmission in order to fail (throw) locally rather than risk corrupting persisted data.
|
|
42
|
+
*/
|
|
43
|
+
private readonly forceValidation: boolean,
|
|
40
44
|
) {}
|
|
41
45
|
|
|
42
46
|
public onCommitSubmitted(commit: GraphCommit<TChange>): void {
|
|
@@ -95,6 +99,7 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
|
|
|
95
99
|
const enriched = this.enricher.enrich(
|
|
96
100
|
startingState,
|
|
97
101
|
newCommits.slice(0, staleChanges.length),
|
|
102
|
+
this.forceValidation,
|
|
98
103
|
);
|
|
99
104
|
for (const [index, { pending, newCommit }] of staleChanges.entries()) {
|
|
100
105
|
const enrichedChange = enriched[index];
|
|
@@ -351,8 +351,7 @@ export class EditManager<
|
|
|
351
351
|
// Only the last trimmed commit, which is the new trunk base, should remain accessible.
|
|
352
352
|
for (const commit of trimmedCommits.slice(0, -1)) {
|
|
353
353
|
Reflect.defineProperty(commit, "change", {
|
|
354
|
-
get: () =>
|
|
355
|
-
assert(false, 0xa5e /* Should not access 'change' property of an evicted commit */),
|
|
354
|
+
get: () => fail(0xa5e /* Should not access 'change' property of an evicted commit */),
|
|
356
355
|
});
|
|
357
356
|
Reflect.defineProperty(commit, "revision", {
|
|
358
357
|
get: () =>
|
|
@@ -362,8 +361,7 @@ export class EditManager<
|
|
|
362
361
|
),
|
|
363
362
|
});
|
|
364
363
|
Reflect.defineProperty(commit, "parent", {
|
|
365
|
-
get: () =>
|
|
366
|
-
assert(false, 0xa60 /* Should not access 'parent' property of an evicted commit */),
|
|
364
|
+
get: () => fail(0xa60 /* Should not access 'parent' property of an evicted commit */),
|
|
367
365
|
});
|
|
368
366
|
}
|
|
369
367
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { OldestSupportedClientVersion } from "@fluidframework/runtime-definitions/internal";
|
|
7
7
|
import { lowestMinVersionForCollab } from "@fluidframework/runtime-utils/internal";
|
|
8
8
|
|
|
9
9
|
import {
|
|
@@ -132,7 +132,7 @@ export function makeEditManagerCodecBuilder<TChangeset>(): VersionDispatchingCod
|
|
|
132
132
|
* with the provided change codec tree as a child.
|
|
133
133
|
*/
|
|
134
134
|
export function getCodecTreeForEditManagerFormatWithChange(
|
|
135
|
-
clientVersion:
|
|
135
|
+
clientVersion: OldestSupportedClientVersion,
|
|
136
136
|
changeFormat: CodecTree,
|
|
137
137
|
): CodecTree {
|
|
138
138
|
const builder = makeEditManagerCodecBuilder();
|
|
@@ -10,7 +10,7 @@ import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
|
10
10
|
import type {
|
|
11
11
|
IExperimentalIncrementalSummaryContext,
|
|
12
12
|
ITelemetryContext,
|
|
13
|
-
|
|
13
|
+
OldestSupportedClientVersion,
|
|
14
14
|
} from "@fluidframework/runtime-definitions/internal";
|
|
15
15
|
import type { SummaryTreeBuilder } from "@fluidframework/runtime-utils/internal";
|
|
16
16
|
|
|
@@ -59,7 +59,7 @@ const supportedVersions = new Set<EditManagerSummaryFormatVersion>([
|
|
|
59
59
|
* Returns the summary version to use as per the given minimum version for collab.
|
|
60
60
|
*/
|
|
61
61
|
function minVersionToEditManagerSummaryFormatVersion(
|
|
62
|
-
version:
|
|
62
|
+
version: OldestSupportedClientVersion,
|
|
63
63
|
): EditManagerSummaryFormatVersion {
|
|
64
64
|
// Currently, version 2 is written which adds metadata blob to the summary.
|
|
65
65
|
return EditManagerSummaryFormatVersion.v2;
|
|
@@ -87,7 +87,7 @@ export class EditManagerSummarizer<TChangeset, TChangeProcessingContext>
|
|
|
87
87
|
EditManagerDecodingContext
|
|
88
88
|
>,
|
|
89
89
|
private readonly idCompressor: IIdCompressor,
|
|
90
|
-
minVersionForCollab:
|
|
90
|
+
minVersionForCollab: OldestSupportedClientVersion,
|
|
91
91
|
private readonly schemaAndPolicy?: SchemaAndPolicy,
|
|
92
92
|
/** See {@link IdentifierHealingConfig}. */
|
|
93
93
|
private readonly healing?: IdentifierHealingConfig,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
7
|
-
import type {
|
|
7
|
+
import type { OldestSupportedClientVersion } from "@fluidframework/runtime-definitions/internal";
|
|
8
8
|
import { lowestMinVersionForCollab } from "@fluidframework/runtime-utils/internal";
|
|
9
9
|
|
|
10
10
|
import {
|
|
@@ -143,7 +143,7 @@ export function makeMessageCodecBuilder<TChangeset>(): VersionDispatchingCodecBu
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
export function getCodecTreeForMessageFormatWithChange(
|
|
146
|
-
clientVersion:
|
|
146
|
+
clientVersion: OldestSupportedClientVersion,
|
|
147
147
|
changeFormat: CodecTree,
|
|
148
148
|
): CodecTree {
|
|
149
149
|
const builder = makeMessageCodecBuilder();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { IFluidLoadable
|
|
6
|
+
import type { IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
7
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";
|
|
@@ -84,6 +84,15 @@ export interface SharedTreeCoreOptionsInternal extends CodecWriteOptions {
|
|
|
84
84
|
* {@inheritDoc SharedTreeOptions.retainHistory}
|
|
85
85
|
*/
|
|
86
86
|
readonly retainHistory?: boolean;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* {@inheritDoc SharedTreeOptions.validateCommitsOnFirstSubmission}
|
|
90
|
+
*/
|
|
91
|
+
readonly validateCommitsOnFirstSubmission?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* {@inheritDoc SharedTreeOptions.validateRebasedCommitsBeforeResubmission}
|
|
94
|
+
*/
|
|
95
|
+
readonly validateRebasedCommitsBeforeResubmission?: boolean;
|
|
87
96
|
}
|
|
88
97
|
|
|
89
98
|
export interface EnrichmentConfig<TChange> {
|
|
@@ -152,10 +161,9 @@ export class SharedTreeCore<
|
|
|
152
161
|
public readonly sharedObject: IChannelView & IFluidLoadable,
|
|
153
162
|
public readonly serializer: IFluidSerializer,
|
|
154
163
|
public readonly submitLocalMessage: (content: unknown, localOpMetadata?: unknown) => void,
|
|
155
|
-
logger: ITelemetryBaseLogger | undefined,
|
|
156
164
|
summarizables: readonly Summarizable[],
|
|
157
165
|
protected readonly changeFamily: ChangeFamily<TEditor, TChange, TChangeProcessingContext>,
|
|
158
|
-
|
|
166
|
+
private readonly coreOptions: SharedTreeCoreOptionsInternal,
|
|
159
167
|
changeFormatVersionForEditManager: DependentFormatVersion<EditManagerFormatVersion>,
|
|
160
168
|
changeFormatVersionForMessage: DependentFormatVersion<MessageFormatVersion>,
|
|
161
169
|
protected readonly idCompressor: IIdCompressor,
|
|
@@ -166,7 +174,7 @@ export class SharedTreeCore<
|
|
|
166
174
|
) {
|
|
167
175
|
super(
|
|
168
176
|
summarizablesTreeKey,
|
|
169
|
-
minVersionToSharedTreeSummaryFormatVersion(
|
|
177
|
+
minVersionToSharedTreeSummaryFormatVersion(coreOptions.minVersionForCollab),
|
|
170
178
|
supportedSharedTreeSummaryFormatVersions,
|
|
171
179
|
true /* supportPreVersioningFormat */,
|
|
172
180
|
);
|
|
@@ -176,6 +184,8 @@ export class SharedTreeCore<
|
|
|
176
184
|
policy: schemaPolicy,
|
|
177
185
|
};
|
|
178
186
|
|
|
187
|
+
const logger = breaker.logger;
|
|
188
|
+
|
|
179
189
|
const rebaseLogger = createChildLogger({
|
|
180
190
|
logger,
|
|
181
191
|
namespace: "Rebase",
|
|
@@ -194,14 +204,14 @@ export class SharedTreeCore<
|
|
|
194
204
|
this.mintRevisionTag,
|
|
195
205
|
(branchId) => this.registerSharedBranch(branchId),
|
|
196
206
|
rebaseLogger,
|
|
197
|
-
|
|
207
|
+
coreOptions.retainHistory ?? false,
|
|
198
208
|
);
|
|
199
209
|
|
|
200
210
|
this.registerSharedBranch("main");
|
|
201
211
|
|
|
202
212
|
const revisionTagCodec = new RevisionTagCodec(idCompressor);
|
|
203
213
|
const editManagerCodec = makeEditManagerCodecBuilder<TChange>().build({
|
|
204
|
-
...
|
|
214
|
+
...coreOptions,
|
|
205
215
|
changeCodecs: this.editManager.changeFamily.codecs,
|
|
206
216
|
dependentChangeFormatVersion: changeFormatVersionForEditManager,
|
|
207
217
|
revisionTagCodec,
|
|
@@ -211,9 +221,9 @@ export class SharedTreeCore<
|
|
|
211
221
|
this.editManager,
|
|
212
222
|
editManagerCodec,
|
|
213
223
|
this.idCompressor,
|
|
214
|
-
|
|
224
|
+
coreOptions.minVersionForCollab,
|
|
215
225
|
this.schemaAndPolicy,
|
|
216
|
-
|
|
226
|
+
coreOptions.healUnresolvableIdentifiersOnDecode === true
|
|
217
227
|
? { sharedObjectId: sharedObject.id, logger }
|
|
218
228
|
: undefined,
|
|
219
229
|
),
|
|
@@ -225,7 +235,7 @@ export class SharedTreeCore<
|
|
|
225
235
|
);
|
|
226
236
|
|
|
227
237
|
this.messageCodec = makeMessageCodecBuilder<TChange>().build({
|
|
228
|
-
...
|
|
238
|
+
...coreOptions,
|
|
229
239
|
changeCodecs: changeFamily.codecs,
|
|
230
240
|
dependentChangeFormatVersion: changeFormatVersionForMessage,
|
|
231
241
|
revisionTagCodec: new RevisionTagCodec(idCompressor),
|
|
@@ -335,7 +345,10 @@ export class SharedTreeCore<
|
|
|
335
345
|
if (change.type === "append") {
|
|
336
346
|
if (this.detachedRevision === undefined) {
|
|
337
347
|
// Commit enrichment is only necessary for changes that will be submitted as ops, and changes issued while detached are not submitted.
|
|
338
|
-
this.getCommitEnricher(branchId).prepareChanges(
|
|
348
|
+
this.getCommitEnricher(branchId).prepareChanges(
|
|
349
|
+
change.newCommits,
|
|
350
|
+
this.coreOptions.validateCommitsOnFirstSubmission ?? false,
|
|
351
|
+
);
|
|
339
352
|
}
|
|
340
353
|
|
|
341
354
|
for (const commit of change.newCommits) {
|
|
@@ -681,7 +694,12 @@ export class SharedTreeCore<
|
|
|
681
694
|
assert(!this.enrichers.has(branchId), 0xc6d /* Branch already registered */);
|
|
682
695
|
this.enrichers.set(branchId, {
|
|
683
696
|
enricher: commitEnricher,
|
|
684
|
-
resubmitMachine:
|
|
697
|
+
resubmitMachine:
|
|
698
|
+
resubmitMachine ??
|
|
699
|
+
new DefaultResubmitMachine(
|
|
700
|
+
enricher,
|
|
701
|
+
this.coreOptions.validateRebasedCommitsBeforeResubmission ?? false,
|
|
702
|
+
),
|
|
685
703
|
});
|
|
686
704
|
}
|
|
687
705
|
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
IExperimentalIncrementalSummaryContext,
|
|
9
9
|
ISummaryTreeWithStats,
|
|
10
10
|
ITelemetryContext,
|
|
11
|
-
|
|
11
|
+
OldestSupportedClientVersion,
|
|
12
12
|
} from "@fluidframework/runtime-definitions/internal";
|
|
13
13
|
|
|
14
14
|
// TODO: Organize this to be adjacent to persisted types.
|
|
@@ -115,7 +115,7 @@ export const supportedSharedTreeSummaryFormatVersions =
|
|
|
115
115
|
* Returns the summary version to use as per the given minimum version for collab.
|
|
116
116
|
*/
|
|
117
117
|
export function minVersionToSharedTreeSummaryFormatVersion(
|
|
118
|
-
version:
|
|
118
|
+
version: OldestSupportedClientVersion,
|
|
119
119
|
): SharedTreeSummaryFormatVersion {
|
|
120
120
|
// Currently, version 2 is written which adds metadata blob to the summary.
|
|
121
121
|
return SharedTreeSummaryFormatVersion.v2;
|
|
@@ -313,7 +313,7 @@ export interface SnapshotSchemaCompatibilityOptions {
|
|
|
313
313
|
* Such applications can set this to the oldest version currently deployed,
|
|
314
314
|
* then rely on {@link snapshotSchemaCompatibility} to verify that no schema changes are made which would break collaboration with that (or newer) versions.
|
|
315
315
|
*
|
|
316
|
-
* This is the same approach used by {@link @fluidframework/runtime-definitions#
|
|
316
|
+
* This is the same approach used by {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}
|
|
317
317
|
* except that type is specifically for use with the version of the Fluid Framework client packages,
|
|
318
318
|
* and this corresponds to whatever versioning scheme is used with {@link SnapshotSchemaCompatibilityOptions.version}.
|
|
319
319
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { OldestSupportedClientVersion } from "@fluidframework/runtime-definitions/internal";
|
|
7
7
|
|
|
8
8
|
import { FormatValidatorNoOp, type ICodecOptions } from "../../codec/index.js";
|
|
9
9
|
import { schemaCodecBuilder } from "../../feature-libraries/index.js";
|
|
@@ -50,7 +50,7 @@ import type { SchemaCompatibilityStatus } from "./tree.js";
|
|
|
50
50
|
*/
|
|
51
51
|
export function extractPersistedSchema(
|
|
52
52
|
schema: ImplicitFieldSchema,
|
|
53
|
-
minVersionForCollab:
|
|
53
|
+
minVersionForCollab: OldestSupportedClientVersion,
|
|
54
54
|
includeStaged: (upgrade: SchemaUpgrade) => boolean,
|
|
55
55
|
): JsonCompatible {
|
|
56
56
|
const stored = toStoredSchema(schema, {
|
|
@@ -66,7 +66,11 @@ export interface TreeChangeEvents {
|
|
|
66
66
|
* node, or when the node has to be updated due to resolution of a merge conflict
|
|
67
67
|
* (for example a previously applied local change might be undone, then reapplied differently or not at all).
|
|
68
68
|
*
|
|
69
|
-
*
|
|
69
|
+
* Event ordering: when multiple nodes are directly changed in a single batch,
|
|
70
|
+
* events fire in the order nodes were first edited. At each node, `nodeChanged` fires before `treeChanged`.
|
|
71
|
+
* When only a leaf node changes, this naturally produces bottom-up ordering
|
|
72
|
+
* (leaf events first, then ancestor `treeChanged` propagating up).
|
|
73
|
+
* See `treeChangeEventOrdering.spec.ts` for comprehensive ordering tests.
|
|
70
74
|
*/
|
|
71
75
|
nodeChanged(unstable?: unknown): void;
|
|
72
76
|
|
|
@@ -910,6 +910,21 @@ function createArrayNodeProxy(
|
|
|
910
910
|
return proxyTarget.constructor;
|
|
911
911
|
}
|
|
912
912
|
|
|
913
|
+
// If the property is a function on Array.prototype but not on the dispatch target,
|
|
914
|
+
// return a function that throws a descriptive TypeError when called.
|
|
915
|
+
if (
|
|
916
|
+
typeof key === "string" &&
|
|
917
|
+
!(key in dispatchTarget) &&
|
|
918
|
+
key in Array.prototype &&
|
|
919
|
+
typeof (Array.prototype as unknown as Record<string, unknown>)[key] === "function"
|
|
920
|
+
) {
|
|
921
|
+
return () => {
|
|
922
|
+
throw new TypeError(
|
|
923
|
+
`ArrayNode does not support '${key}'. Use the ArrayNode API (e.g., insertAt, removeAt, moveToIndex, splice).`,
|
|
924
|
+
);
|
|
925
|
+
};
|
|
926
|
+
}
|
|
927
|
+
|
|
913
928
|
// Pass the proxy as the receiver here, so that any methods on
|
|
914
929
|
// the prototype receive `proxy` as `this`.
|
|
915
930
|
return Reflect.get(dispatchTarget, key, receiver) as unknown;
|
|
@@ -277,6 +277,27 @@ const handler: ProxyHandler<TreeMapNodeAlpha<any>> = {
|
|
|
277
277
|
getPrototypeOf: () => {
|
|
278
278
|
return Map.prototype;
|
|
279
279
|
},
|
|
280
|
+
get: (target, key, receiver) => {
|
|
281
|
+
const value = Reflect.get(target, key, receiver) as unknown;
|
|
282
|
+
if (value !== undefined) {
|
|
283
|
+
return value;
|
|
284
|
+
}
|
|
285
|
+
// If the property is a function on Map.prototype but not on the target,
|
|
286
|
+
// return a function that throws a descriptive TypeError when called.
|
|
287
|
+
if (
|
|
288
|
+
typeof key === "string" &&
|
|
289
|
+
!(key in target) &&
|
|
290
|
+
key in Map.prototype &&
|
|
291
|
+
typeof (Map.prototype as unknown as Record<string, unknown>)[key] === "function"
|
|
292
|
+
) {
|
|
293
|
+
return () => {
|
|
294
|
+
throw new TypeError(
|
|
295
|
+
`MapNode does not support '${key}'. Use the MapNode API (e.g., set, get, delete, keys, values, entries).`,
|
|
296
|
+
);
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
return value;
|
|
300
|
+
},
|
|
280
301
|
};
|
|
281
302
|
|
|
282
303
|
abstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends TreeNodeValid<
|
|
@@ -322,9 +343,9 @@ abstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends T
|
|
|
322
343
|
public has(key: string): boolean {
|
|
323
344
|
return this.innerNode.tryGetField(brand(key)) !== undefined;
|
|
324
345
|
}
|
|
325
|
-
public keys(): IterableIterator<string> {
|
|
346
|
+
public *keys(): IterableIterator<string> {
|
|
326
347
|
const node = this.innerNode;
|
|
327
|
-
|
|
348
|
+
yield* node.keys();
|
|
328
349
|
}
|
|
329
350
|
public set(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T>): this {
|
|
330
351
|
const kernel = getKernel(this);
|
package/src/tableSchema.ts
CHANGED
|
@@ -1590,7 +1590,7 @@ function removeRangeFromArray<TNodeSchema extends ImplicitAllowedTypes>(
|
|
|
1590
1590
|
*
|
|
1591
1591
|
* Also note: these APIs leverage `SharedTree` functionality that was added in version `2.80.0`,
|
|
1592
1592
|
* which is not compatible with previous versions of this library.
|
|
1593
|
-
* To ensure safe collaboration, you will need to configure the {@link @fluidframework/runtime-definitions#
|
|
1593
|
+
* To ensure safe collaboration, you will need to configure the {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}
|
|
1594
1594
|
* for the Fluid Runtime and/or `SharedTree` to at least `2.80.0`.
|
|
1595
1595
|
* To set this minimum version for `SharedTree`, use {@link configuredSharedTreeBeta}.
|
|
1596
1596
|
*
|
package/src/treeFactory.ts
CHANGED
package/src/util/breakable.ts
CHANGED
|
@@ -10,6 +10,10 @@ import { UsageError, type TelemetryLoggerExt } from "@fluidframework/telemetry-u
|
|
|
10
10
|
* An object which can enter a "broken" state where trying to use it is a UsageError.
|
|
11
11
|
* @remarks
|
|
12
12
|
* Use {@link WithBreakable} to apply this to another object.
|
|
13
|
+
*
|
|
14
|
+
* A common pattern is to pass a single breaker to all code which shares mutable state and thus could be put into an invalidate state together.
|
|
15
|
+
* Thus a breaker often represents a scope for or dependency on mutable state which also forms a scope for fault isolation.
|
|
16
|
+
* As such a scope can have issues (if it couldn't it would need a breaker), an optional {@link Breakable.logger} is included which can be used to log telemetry within this scope.
|
|
13
17
|
* @sealed
|
|
14
18
|
*/
|
|
15
19
|
export class Breakable {
|
|
@@ -26,7 +30,11 @@ export class Breakable {
|
|
|
26
30
|
* Optional logger for telemetry.
|
|
27
31
|
* @remarks
|
|
28
32
|
* When provided, subsystems that have access to a Breakable can use this logger to emit telemetry
|
|
29
|
-
* without requiring additional plumbing.
|
|
33
|
+
* without requiring additional plumbing of a logger which also corresponds to the same scope/context of this Breakable.
|
|
34
|
+
*
|
|
35
|
+
* Currently, Breakable itself does not eagerly log breakages into the logger, but we may want to change that in the future.
|
|
36
|
+
* Instead it is assumed that fatal errors will result in exceptions logged through other means,
|
|
37
|
+
* and the logger here is exposed for users of breaker to log telemetry as desired (for example reporting non-fatal errors or other telemetry).
|
|
30
38
|
*/
|
|
31
39
|
public readonly logger?: TelemetryLoggerExt,
|
|
32
40
|
) {}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { LogLevel, type ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
7
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
7
|
import type {
|
|
9
8
|
IIdCompressor,
|
|
@@ -12,6 +11,7 @@ import type {
|
|
|
12
11
|
SessionSpaceCompressedId,
|
|
13
12
|
} from "@fluidframework/id-compressor";
|
|
14
13
|
import { isFinalId, isStableId } from "@fluidframework/id-compressor/internal";
|
|
14
|
+
import type { TelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
15
15
|
import { v5 as uuidV5 } from "uuid";
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -172,7 +172,7 @@ export interface IdentifierHealingConfig {
|
|
|
172
172
|
* Optional logger used by {@link forceDecodeEncodedIdWithoutSession} to record telemetry
|
|
173
173
|
* when the heal-on-decode recovery path is taken (a non-final identifier is healed).
|
|
174
174
|
*/
|
|
175
|
-
readonly logger?:
|
|
175
|
+
readonly logger?: TelemetryLoggerExt;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
@@ -207,17 +207,11 @@ export function forceDecodeEncodedIdWithoutSession(
|
|
|
207
207
|
// `id` is a non-final op-space compressed id.
|
|
208
208
|
if (healing !== undefined) {
|
|
209
209
|
const healed = uuidV5(`${healing.sharedObjectId}|${id}`, healingNamespace);
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
// This telemetry should be very low-volume (and possibly never happen at all),
|
|
216
|
-
// as should only occur when loading documents that were corrupted by a now fixed bug and have not been re-summarized since healing was added.
|
|
217
|
-
// It is useful for monitoring and diagnosing for this to be reported in the same cases in which the error case would be reported,
|
|
218
|
-
// which is the essential level.
|
|
219
|
-
LogLevel.essential,
|
|
220
|
-
);
|
|
210
|
+
// This telemetry should be very low-volume (and possibly never happen at all),
|
|
211
|
+
// as should only occur when loading documents that were corrupted by a now fixed bug and have not been re-summarized since healing was added.
|
|
212
|
+
// It is useful for monitoring and diagnosing for this to be reported in the same cases in which the error case would be reported,
|
|
213
|
+
// which is the essential level.
|
|
214
|
+
healing.logger?.sendTelemetryEvent({ eventName: "HealUnresolvableIdentifierOnDecode" });
|
|
221
215
|
return healed;
|
|
222
216
|
}
|
|
223
217
|
throw new Error(
|