@fluidframework/tree 2.23.0 → 2.30.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 +38 -0
- package/api-report/tree.alpha.api.md +28 -12
- package/dist/alpha.d.ts +6 -0
- package/dist/core/forest/editableForest.d.ts +1 -14
- package/dist/core/forest/editableForest.d.ts.map +1 -1
- package/dist/core/forest/editableForest.js +1 -28
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/forest/forest.d.ts +16 -3
- package/dist/core/forest/forest.d.ts.map +1 -1
- package/dist/core/forest/forest.js +4 -1
- package/dist/core/forest/forest.js.map +1 -1
- package/dist/core/forest/index.d.ts +1 -1
- package/dist/core/forest/index.d.ts.map +1 -1
- package/dist/core/forest/index.js +1 -2
- package/dist/core/forest/index.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +8 -3
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +12 -5
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/delta.d.ts +8 -23
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +3 -3
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +2 -2
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/index.d.ts +2 -2
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +2 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/pathTree.d.ts +54 -1
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js +8 -1
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +7 -5
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +19 -9
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +5 -23
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +8 -5
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +5 -3
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +10 -7
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -0
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +5 -2
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.d.ts → schemaBasedEncode.d.ts} +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.js → schemaBasedEncode.js} +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +3 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +3 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -14
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -6
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -0
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +3 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +21 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js +57 -0
- package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -0
- package/dist/feature-libraries/deltaUtils.js +1 -1
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +5 -5
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -2
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +5 -4
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +9 -6
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -5
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +2 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +9 -7
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/initializeForest.d.ts +18 -0
- package/dist/feature-libraries/initializeForest.d.ts.map +1 -0
- package/dist/feature-libraries/initializeForest.js +35 -0
- package/dist/feature-libraries/initializeForest.js.map +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -5
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +9 -15
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/node-identifier/index.d.ts +8 -0
- package/dist/feature-libraries/node-identifier/index.d.ts.map +1 -0
- package/dist/feature-libraries/node-identifier/index.js +16 -0
- package/dist/feature-libraries/node-identifier/index.js.map +1 -0
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts +22 -0
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -0
- package/dist/feature-libraries/{node-key/mockNodeKeyManager.js → node-identifier/mockNodeIdentifierManager.js} +18 -18
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifier.d.ts +38 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifier.d.ts.map +1 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifier.js +26 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts +37 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +48 -0
- package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -0
- package/dist/feature-libraries/object-forest/objectForest.d.ts +2 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +6 -2
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +1 -1
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.d.ts +3 -3
- package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +3 -18
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +2 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +3 -2
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +1 -0
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +11 -7
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts +1 -2
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/treeApiAlpha.d.ts +6 -31
- package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeApiAlpha.js +3 -18
- package/dist/shared-tree/treeApiAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.js +1 -1
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/simple-tree/api/conciseTree.d.ts +8 -2
- package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/conciseTree.js +10 -1
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +3 -3
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +42 -12
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js +30 -2
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +4 -3
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +6 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +12 -9
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +16 -26
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +7 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +9 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts +19 -0
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -0
- package/dist/simple-tree/api/schemaFromSimple.js +60 -0
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -0
- package/dist/simple-tree/api/simpleSchema.d.ts +3 -0
- package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +11 -5
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +11 -2
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +2 -17
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +15 -15
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts +16 -25
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +15 -10
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +2 -2
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/flexList.d.ts +4 -5
- package/dist/simple-tree/flexList.d.ts.map +1 -1
- package/dist/simple-tree/flexList.js +1 -14
- package/dist/simple-tree/flexList.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +7 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +2 -0
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +34 -2
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +55 -2
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toMapTree.d.ts +4 -4
- package/dist/simple-tree/toMapTree.d.ts.map +1 -1
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +1 -5
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts +7 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +13 -5
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/util/cloneWithReplacements.d.ts +21 -0
- package/dist/util/cloneWithReplacements.d.ts.map +1 -0
- package/dist/util/cloneWithReplacements.js +38 -0
- package/dist/util/cloneWithReplacements.js.map +1 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +3 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/referenceCounting.d.ts +18 -0
- package/dist/util/referenceCounting.d.ts.map +1 -1
- package/dist/util/referenceCounting.js.map +1 -1
- package/lib/alpha.d.ts +6 -0
- package/lib/core/forest/editableForest.d.ts +1 -14
- package/lib/core/forest/editableForest.d.ts.map +1 -1
- package/lib/core/forest/editableForest.js +0 -26
- package/lib/core/forest/editableForest.js.map +1 -1
- package/lib/core/forest/forest.d.ts +16 -3
- package/lib/core/forest/forest.d.ts.map +1 -1
- package/lib/core/forest/forest.js +4 -1
- package/lib/core/forest/forest.js.map +1 -1
- package/lib/core/forest/index.d.ts +1 -1
- package/lib/core/forest/index.d.ts.map +1 -1
- package/lib/core/forest/index.js +1 -1
- package/lib/core/forest/index.js.map +1 -1
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +8 -3
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +12 -5
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/delta.d.ts +8 -23
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +3 -3
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +2 -2
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/index.d.ts +2 -2
- 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/pathTree.d.ts +54 -1
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js +6 -0
- package/lib/core/tree/pathTree.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +7 -5
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +19 -9
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +5 -23
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +8 -5
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +5 -3
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +11 -8
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -0
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +6 -3
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.d.ts → schemaBasedEncode.d.ts} +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.js → schemaBasedEncode.js} +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +3 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +3 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -14
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -6
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -0
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +1 -0
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +21 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js +53 -0
- package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -0
- package/lib/feature-libraries/deltaUtils.js +1 -1
- package/lib/feature-libraries/deltaUtils.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +5 -5
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -2
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +5 -4
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +11 -8
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -7
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +2 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +2 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/initializeForest.d.ts +18 -0
- package/lib/feature-libraries/initializeForest.d.ts.map +1 -0
- package/lib/feature-libraries/initializeForest.js +31 -0
- package/lib/feature-libraries/initializeForest.js.map +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -5
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +10 -16
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/node-identifier/index.d.ts +8 -0
- package/lib/feature-libraries/node-identifier/index.d.ts.map +1 -0
- package/lib/feature-libraries/node-identifier/index.js +8 -0
- package/lib/feature-libraries/node-identifier/index.js.map +1 -0
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts +22 -0
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -0
- package/lib/feature-libraries/{node-key/mockNodeKeyManager.js → node-identifier/mockNodeIdentifierManager.js} +16 -16
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifier.d.ts +38 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifier.d.ts.map +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifier.js +22 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts +37 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +43 -0
- package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -0
- package/lib/feature-libraries/object-forest/objectForest.d.ts +2 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +6 -2
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +1 -1
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.d.ts +3 -3
- package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +5 -20
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +3 -2
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +1 -0
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +9 -6
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts +1 -2
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/treeApiAlpha.d.ts +6 -31
- package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeApiAlpha.js +3 -18
- package/lib/shared-tree/treeApiAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.js +2 -2
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts +8 -2
- package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/conciseTree.js +9 -1
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +3 -3
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +42 -12
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js +29 -2
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +4 -3
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +4 -3
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +12 -9
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +14 -23
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +7 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +9 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts +19 -0
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -0
- package/lib/simple-tree/api/schemaFromSimple.js +56 -0
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -0
- package/lib/simple-tree/api/simpleSchema.d.ts +3 -0
- package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +11 -5
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +12 -3
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +4 -19
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +15 -15
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts +16 -25
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +14 -10
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +2 -2
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/flexList.d.ts +4 -5
- package/lib/simple-tree/flexList.d.ts.map +1 -1
- package/lib/simple-tree/flexList.js +0 -12
- package/lib/simple-tree/flexList.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +2 -0
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +34 -2
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +54 -3
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toMapTree.d.ts +4 -4
- package/lib/simple-tree/toMapTree.d.ts.map +1 -1
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +3 -7
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts +7 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +13 -5
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/util/cloneWithReplacements.d.ts +21 -0
- package/lib/util/cloneWithReplacements.d.ts.map +1 -0
- package/lib/util/cloneWithReplacements.js +34 -0
- package/lib/util/cloneWithReplacements.js.map +1 -0
- package/lib/util/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/lib/util/index.js.map +1 -1
- package/lib/util/referenceCounting.d.ts +18 -0
- package/lib/util/referenceCounting.d.ts.map +1 -1
- package/lib/util/referenceCounting.js.map +1 -1
- package/package.json +22 -22
- package/src/core/forest/editableForest.ts +1 -52
- package/src/core/forest/forest.ts +17 -2
- package/src/core/forest/index.ts +0 -1
- package/src/core/index.ts +4 -2
- package/src/core/tree/anchorSet.ts +41 -10
- package/src/core/tree/delta.ts +8 -25
- package/src/core/tree/deltaUtil.ts +5 -5
- package/src/core/tree/index.ts +4 -1
- package/src/core/tree/pathTree.ts +72 -1
- package/src/core/tree/visitDelta.ts +38 -17
- package/src/core/tree/visitorUtils.ts +22 -36
- package/src/feature-libraries/chunked-forest/basicChunk.ts +1 -1
- package/src/feature-libraries/chunked-forest/chunkTree.ts +19 -8
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +9 -4
- package/src/feature-libraries/chunked-forest/codec/README.md +3 -3
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +3 -2
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +21 -38
- package/src/feature-libraries/default-schema/index.ts +2 -0
- package/src/feature-libraries/default-schema/mappedEditBuilder.ts +68 -0
- package/src/feature-libraries/deltaUtils.ts +1 -1
- package/src/feature-libraries/flex-tree/context.ts +4 -4
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -2
- package/src/feature-libraries/flex-tree/lazyField.ts +19 -10
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +5 -9
- package/src/feature-libraries/index.ts +10 -8
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +2 -2
- package/src/feature-libraries/initializeForest.ts +55 -0
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +12 -28
- package/src/feature-libraries/node-identifier/README.md +11 -0
- package/src/feature-libraries/node-identifier/index.ts +17 -0
- package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +59 -0
- package/src/feature-libraries/node-identifier/nodeIdentifier.ts +50 -0
- package/src/feature-libraries/node-identifier/nodeIdentifierManager.ts +95 -0
- package/src/feature-libraries/object-forest/objectForest.ts +10 -3
- package/src/feature-libraries/treeCursorUtils.ts +1 -1
- package/src/index.ts +17 -10
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/checkoutFlexTreeView.ts +2 -2
- package/src/shared-tree/independentView.ts +5 -29
- package/src/shared-tree/index.ts +1 -0
- package/src/shared-tree/schematizeTree.ts +3 -2
- package/src/shared-tree/schematizingTreeView.ts +3 -3
- package/src/shared-tree/sharedTree.ts +13 -9
- package/src/shared-tree/sharedTreeChangeFamily.ts +0 -1
- package/src/shared-tree/sharedTreeEditBuilder.ts +5 -11
- package/src/shared-tree/treeApiAlpha.ts +15 -78
- package/src/shared-tree/treeCheckout.ts +2 -2
- package/src/simple-tree/api/conciseTree.ts +25 -8
- package/src/simple-tree/api/create.ts +3 -3
- package/src/simple-tree/api/customTree.ts +59 -16
- package/src/simple-tree/api/index.ts +10 -1
- package/src/simple-tree/api/schemaFactory.ts +18 -32
- package/src/simple-tree/api/schemaFactoryAlpha.ts +12 -0
- package/src/simple-tree/api/schemaFromSimple.ts +68 -0
- package/src/simple-tree/api/simpleSchema.ts +10 -0
- package/src/simple-tree/api/tree.ts +13 -8
- package/src/simple-tree/api/treeNodeApi.ts +4 -17
- package/src/simple-tree/api/typesUnsafe.ts +15 -15
- package/src/simple-tree/api/verboseTree.ts +43 -55
- package/src/simple-tree/core/unhydratedFlexTree.ts +2 -2
- package/src/simple-tree/flexList.ts +4 -14
- package/src/simple-tree/index.ts +6 -0
- package/src/simple-tree/objectNode.ts +3 -0
- package/src/simple-tree/schemaTypes.ts +70 -4
- package/src/simple-tree/toMapTree.ts +6 -6
- package/src/simple-tree/toStoredSchema.ts +3 -6
- package/src/simple-tree/treeNodeValid.ts +16 -5
- package/src/util/cloneWithReplacements.ts +41 -0
- package/src/util/index.ts +2 -0
- package/src/util/referenceCounting.ts +18 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +0 -1
- package/dist/feature-libraries/node-key/index.d.ts +0 -8
- package/dist/feature-libraries/node-key/index.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/index.js +0 -16
- package/dist/feature-libraries/node-key/index.js.map +0 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.d.ts +0 -22
- package/dist/feature-libraries/node-key/mockNodeKeyManager.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +0 -1
- package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -38
- package/dist/feature-libraries/node-key/nodeKey.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/nodeKey.js +0 -26
- package/dist/feature-libraries/node-key/nodeKey.js.map +0 -1
- package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -37
- package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +0 -1
- package/dist/feature-libraries/node-key/nodeKeyManager.js +0 -48
- package/dist/feature-libraries/node-key/nodeKeyManager.js.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +0 -1
- package/lib/feature-libraries/node-key/index.d.ts +0 -8
- package/lib/feature-libraries/node-key/index.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/index.js +0 -8
- package/lib/feature-libraries/node-key/index.js.map +0 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.d.ts +0 -22
- package/lib/feature-libraries/node-key/mockNodeKeyManager.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +0 -1
- package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -38
- package/lib/feature-libraries/node-key/nodeKey.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/nodeKey.js +0 -22
- package/lib/feature-libraries/node-key/nodeKey.js.map +0 -1
- package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -37
- package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +0 -1
- package/lib/feature-libraries/node-key/nodeKeyManager.js +0 -43
- package/lib/feature-libraries/node-key/nodeKeyManager.js.map +0 -1
- package/src/feature-libraries/node-key/README.md +0 -11
- package/src/feature-libraries/node-key/index.ts +0 -17
- package/src/feature-libraries/node-key/mockNodeKeyManager.ts +0 -54
- package/src/feature-libraries/node-key/nodeKey.ts +0 -47
- package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -93
- /package/src/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.ts → schemaBasedEncode.ts} +0 -0
|
@@ -64,6 +64,8 @@ export abstract class TreeNodeValid<TInput> extends TreeNode {
|
|
|
64
64
|
/**
|
|
65
65
|
* Schema classes can override to provide a callback that is called once when the first node is constructed.
|
|
66
66
|
* This is a good place to perform extra validation and cache schema derived data needed for the implementation of the node.
|
|
67
|
+
* @remarks
|
|
68
|
+
* It is valid to dereference LazyItem schema references in this function (or anything that runs after it).
|
|
67
69
|
*/
|
|
68
70
|
protected static oneTimeSetup<T>(this: typeof TreeNodeValid<T>): Context {
|
|
69
71
|
fail(0xae5 /* Missing oneTimeSetup */);
|
|
@@ -146,7 +148,7 @@ export abstract class TreeNodeValid<TInput> extends TreeNode {
|
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
/**
|
|
149
|
-
*
|
|
151
|
+
* See {@link TreeNodeSchemaCore.createFromInsertable}.
|
|
150
152
|
*/
|
|
151
153
|
public static createFromInsertable<TInput, TOut, TThis extends new (args: TInput) => TOut>(
|
|
152
154
|
this: TThis,
|
|
@@ -155,13 +157,22 @@ export abstract class TreeNodeValid<TInput> extends TreeNode {
|
|
|
155
157
|
return new this(input);
|
|
156
158
|
}
|
|
157
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Idempotent initialization function that pre-caches data and can dereference lazy schema references.
|
|
162
|
+
*/
|
|
163
|
+
public static oneTimeInitialize(
|
|
164
|
+
this: typeof TreeNodeValid & TreeNodeSchema,
|
|
165
|
+
): Required<MostDerivedData> {
|
|
166
|
+
const cache = this.markMostDerived();
|
|
167
|
+
cache.oneTimeInitialized ??= this.oneTimeSetup();
|
|
168
|
+
// TypeScript fails to narrow the type of `oneTimeInitialized` to `Context` here, so use a cast:
|
|
169
|
+
return cache as MostDerivedData & { oneTimeInitialized: Context };
|
|
170
|
+
}
|
|
171
|
+
|
|
158
172
|
public constructor(input: TInput | InternalTreeNode) {
|
|
159
173
|
super(privateToken);
|
|
160
174
|
const schema = this.constructor as typeof TreeNodeValid & TreeNodeSchema;
|
|
161
|
-
const cache = schema.
|
|
162
|
-
if (cache.oneTimeInitialized === undefined) {
|
|
163
|
-
cache.oneTimeInitialized = schema.oneTimeSetup();
|
|
164
|
-
}
|
|
175
|
+
const cache = schema.oneTimeInitialize();
|
|
165
176
|
|
|
166
177
|
if (isTreeNode(input)) {
|
|
167
178
|
// TODO: update this once we have better support for deep-copying and move operations.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Like `JSON.stringify`, but returns a clone instead of stringifying the result.
|
|
8
|
+
*
|
|
9
|
+
* @remarks Only considers enumerable own properties with string keys.
|
|
10
|
+
*
|
|
11
|
+
* @param root - Data to clone.
|
|
12
|
+
* @param rootKey - The key to pass to replacer for the root.
|
|
13
|
+
* @param replacer - Like `JSON.stringify`'s replacer: called for every value while walking data. Unlike `JSON.stringify`'s replacer, this
|
|
14
|
+
* returns a wrapper around the value with a "clone" flag to indicate if the clone should recurse into that object (true) or use it as is (false).
|
|
15
|
+
* @returns A clone of `root`.
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
export function cloneWithReplacements(
|
|
19
|
+
root: unknown,
|
|
20
|
+
rootKey: string,
|
|
21
|
+
replacer: (key: string, value: unknown) => { clone: boolean; value: unknown },
|
|
22
|
+
): unknown {
|
|
23
|
+
const { clone, value } = replacer(rootKey, root);
|
|
24
|
+
if (clone === false) {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (root === null || typeof root !== "object") {
|
|
29
|
+
return root;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (Array.isArray(root)) {
|
|
33
|
+
return root.map((item, index) => cloneWithReplacements(item, index.toString(), replacer));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const result: Record<string, unknown> = {};
|
|
37
|
+
for (const [key, field] of Object.entries(root)) {
|
|
38
|
+
result[key] = cloneWithReplacements(field, key, replacer);
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
package/src/util/index.ts
CHANGED
|
@@ -5,9 +5,26 @@
|
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* An object which counts the number of users / references to it.
|
|
10
|
+
* @remarks
|
|
11
|
+
* This implements the [Reference counting](https://en.wikipedia.org/wiki/Reference_counting) pattern.
|
|
12
|
+
* Getting the reference count correct is difficult in TypeScript and great care must be used.
|
|
13
|
+
* Because of this, this interface should not be used in the public API.
|
|
14
|
+
*/
|
|
8
15
|
export interface ReferenceCounted {
|
|
16
|
+
/**
|
|
17
|
+
* Called to increase the reference count tracked by this object.
|
|
18
|
+
* @remarks
|
|
19
|
+
* When a user of this object allows something else to use it,
|
|
20
|
+
* this should be called.
|
|
21
|
+
*/
|
|
9
22
|
referenceAdded(): void;
|
|
10
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Called to decrease the reference count tracked by this object.
|
|
25
|
+
* @remarks
|
|
26
|
+
* When a user of this object will no longer use it, this should be called.
|
|
27
|
+
*/
|
|
11
28
|
referenceRemoved(): void;
|
|
12
29
|
|
|
13
30
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemaBasedEncoding.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/schemaBasedEncoding.ts"],"names":[],"mappings":"AAAA;;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
|
|
1
|
-
{"version":3,"file":"schemaBasedEncoding.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/schemaBasedEncoding.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAE9E,qDAUgC;AAChC,qDAA8C;AAG9C,+DAS+B;AAE/B,2CAA2F;AAC3F,iDAA2C;AAG3C;;;;;GAKG;AACH,SAAgB,sBAAsB,CACrC,MAA8B,EAC9B,MAAwB,EACxB,UAAsB,EACtB,YAA2B;IAE3B,OAAO,IAAA,sCAAgB,EAAC,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;AAC/E,CAAC;AAPD,wDAOC;AAED,SAAgB,UAAU,CACzB,MAA8B,EAC9B,MAAwB,EACxB,YAA2B;IAE3B,MAAM,KAAK,GAAiB,IAAI,kCAAY,CAC3C,CAAC,YAAyB,EAAE,UAAoC,EAAE,EAAE,CACnE,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,EACrD,CAAC,WAAuB,EAAE,KAA4B,EAAE,EAAE,CACzD,WAAW,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,EAC/C,MAAM,CAAC,UAAU,EACjB,YAAY,CACZ,CAAC;IACF,OAAO,KAAK,CAAC;AACd,CAAC;AAdD,gCAcC;AAED;;GAEG;AACH,SAAgB,WAAW,CAC1B,WAAuB,EACvB,KAA4B,EAC5B,KAAmB,EACnB,YAAoC;IAEpC,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAA,eAAI,EAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACtF,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,WAAW,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,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gCAUC;AAED,SAAS,oBAAoB,CAAC,MAA+B;IAC5D,QAAQ,MAAM,EAAE,CAAC;QAChB,KAAK,SAAS;YACb,OAAO,KAAK,CAAC;QACd,KAAK,sBAAW,CAAC,MAAM,CAAC;QACxB,KAAK,sBAAW,CAAC,MAAM,CAAC;QACxB,KAAK,sBAAW,CAAC,OAAO,CAAC;QACzB,KAAK,sBAAW,CAAC,WAAW;YAC3B,OAAO,IAAI,CAAC;QACb,KAAK,sBAAW,CAAC,IAAI;YACpB,OAAO,CAAC,IAAI,CAAC,CAAC;QACf;YACC,IAAA,0BAAe,EAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\ttype StoredSchemaCollection,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\tValueSchema,\n\tMultiplicity,\n\tidentifierFieldKindIdentifier,\n} from \"../../../core/index.js\";\nimport { fail } from \"../../../util/index.js\";\nimport type { FullSchemaPolicy } from \"../../modular-schema/index.js\";\n\nimport {\n\tEncoderCache,\n\ttype FieldEncoder,\n\ttype FieldShaper,\n\ttype KeyedFieldEncoder,\n\ttype TreeShaper,\n\tanyNodeEncoder,\n\tasFieldEncoder,\n\tcompressedEncode,\n} from \"./compressedEncode.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport { type EncodedFieldBatch, type EncodedValueShape, SpecialField } from \"./format.js\";\nimport { NodeShape } from \"./nodeShape.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\n/**\n * Encode data from `fieldBatch` in into an `EncodedChunk`.\n *\n * Optimized for encoded size and encoding performance.\n * TODO: This function should eventually also take in the root FieldSchema to more efficiently compress the nodes.\n */\nexport function schemaCompressedEncode(\n\tschema: StoredSchemaCollection,\n\tpolicy: FullSchemaPolicy,\n\tfieldBatch: FieldBatch,\n\tidCompressor: IIdCompressor,\n): EncodedFieldBatch {\n\treturn compressedEncode(fieldBatch, buildCache(schema, policy, idCompressor));\n}\n\nexport function buildCache(\n\tschema: StoredSchemaCollection,\n\tpolicy: FullSchemaPolicy,\n\tidCompressor: IIdCompressor,\n): EncoderCache {\n\tconst cache: EncoderCache = new EncoderCache(\n\t\t(fieldHandler: FieldShaper, schemaName: TreeNodeSchemaIdentifier) =>\n\t\t\ttreeShaper(schema, policy, fieldHandler, schemaName),\n\t\t(treeHandler: TreeShaper, field: TreeFieldStoredSchema) =>\n\t\t\tfieldShaper(treeHandler, field, cache, schema),\n\t\tpolicy.fieldKinds,\n\t\tidCompressor,\n\t);\n\treturn cache;\n}\n\n/**\n * Selects shapes to use to encode fields.\n */\nexport function fieldShaper(\n\ttreeHandler: TreeShaper,\n\tfield: TreeFieldStoredSchema,\n\tcache: EncoderCache,\n\tstoredSchema: StoredSchemaCollection,\n): FieldEncoder {\n\tconst kind = cache.fieldShapes.get(field.kind) ?? fail(0xb52 /* missing FieldKind */);\n\tconst type = oneFromSet(field.types);\n\tconst nodeEncoder = type !== undefined ? treeHandler.shapeFromTree(type) : anyNodeEncoder;\n\tif (kind.multiplicity === Multiplicity.Single) {\n\t\tif (field.kind === identifierFieldKindIdentifier) {\n\t\t\tassert(type !== undefined, 0x999 /* field type must be defined in identifier field */);\n\t\t\tconst nodeSchema = storedSchema.nodeSchema.get(type);\n\t\t\tassert(nodeSchema !== undefined, 0x99a /* nodeSchema must be defined */);\n\t\t\tassert(\n\t\t\t\tnodeSchema instanceof LeafNodeStoredSchema,\n\t\t\t\t0x99b /* nodeSchema must be LeafNodeStoredSchema */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\tnodeSchema.leafValue === ValueSchema.String,\n\t\t\t\t0x99c /* identifier field can only be type string */,\n\t\t\t);\n\t\t\tconst identifierNodeEncoder = new NodeShape(\n\t\t\t\ttype,\n\t\t\t\tSpecialField.Identifier,\n\t\t\t\t[],\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\treturn asFieldEncoder(identifierNodeEncoder);\n\t\t}\n\t\treturn asFieldEncoder(nodeEncoder);\n\t} else {\n\t\treturn cache.nestedArray(nodeEncoder);\n\t}\n}\n\n/**\n * Selects shapes to use to encode trees.\n */\nexport function treeShaper(\n\tfullSchema: StoredSchemaCollection,\n\tpolicy: FullSchemaPolicy,\n\tfieldHandler: FieldShaper,\n\tschemaName: TreeNodeSchemaIdentifier,\n): NodeShape {\n\tconst schema =\n\t\tfullSchema.nodeSchema.get(schemaName) ?? fail(0xb53 /* missing node schema */);\n\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\t// TODO:Performance:\n\t\t// consider moving some optional and sequence fields to extra fields if they are commonly empty\n\t\t// to reduce encoded size.\n\n\t\tconst objectNodeFields: KeyedFieldEncoder[] = [];\n\t\tfor (const [key, field] of schema.objectNodeFields ?? []) {\n\t\t\tobjectNodeFields.push({ key, shape: fieldHandler.shapeFromField(field) });\n\t\t}\n\n\t\tconst shape = new NodeShape(schemaName, false, objectNodeFields, undefined);\n\t\treturn shape;\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\tconst shape = new NodeShape(\n\t\t\tschemaName,\n\t\t\tvalueShapeFromSchema(schema.leafValue),\n\t\t\t[],\n\t\t\tundefined,\n\t\t);\n\t\treturn shape;\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tconst shape = new NodeShape(\n\t\t\tschemaName,\n\t\t\tfalse,\n\t\t\t[],\n\t\t\tfieldHandler.shapeFromField(schema.mapFields),\n\t\t);\n\t\treturn shape;\n\t}\n\tfail(0xb54 /* unsupported node kind */);\n}\n\nexport function oneFromSet<T>(set: ReadonlySet<T> | undefined): T | undefined {\n\tif (set === undefined) {\n\t\treturn undefined;\n\t}\n\tif (set.size !== 1) {\n\t\treturn undefined;\n\t}\n\tfor (const item of set) {\n\t\treturn item;\n\t}\n}\n\nfunction valueShapeFromSchema(schema: ValueSchema | undefined): undefined | EncodedValueShape {\n\tswitch (schema) {\n\t\tcase undefined:\n\t\t\treturn false;\n\t\tcase ValueSchema.Number:\n\t\tcase ValueSchema.String:\n\t\tcase ValueSchema.Boolean:\n\t\tcase ValueSchema.FluidHandle:\n\t\t\treturn true;\n\t\tcase ValueSchema.Null:\n\t\t\treturn [null];\n\t\tdefault:\n\t\t\tunreachableCase(schema);\n\t}\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
export { MockNodeKeyManager } from "./mockNodeKeyManager.js";
|
|
6
|
-
export { compareLocalNodeKeys, type LocalNodeKey, type StableNodeKey, nodeKeyTreeIdentifier, } from "./nodeKey.js";
|
|
7
|
-
export { createNodeKeyManager, isStableNodeKey, type NodeKeyManager, } from "./nodeKeyManager.js";
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACN,oBAAoB,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,qBAAqB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,KAAK,cAAc,GACnB,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.isStableNodeKey = exports.createNodeKeyManager = exports.nodeKeyTreeIdentifier = exports.compareLocalNodeKeys = exports.MockNodeKeyManager = void 0;
|
|
8
|
-
var mockNodeKeyManager_js_1 = require("./mockNodeKeyManager.js");
|
|
9
|
-
Object.defineProperty(exports, "MockNodeKeyManager", { enumerable: true, get: function () { return mockNodeKeyManager_js_1.MockNodeKeyManager; } });
|
|
10
|
-
var nodeKey_js_1 = require("./nodeKey.js");
|
|
11
|
-
Object.defineProperty(exports, "compareLocalNodeKeys", { enumerable: true, get: function () { return nodeKey_js_1.compareLocalNodeKeys; } });
|
|
12
|
-
Object.defineProperty(exports, "nodeKeyTreeIdentifier", { enumerable: true, get: function () { return nodeKey_js_1.nodeKeyTreeIdentifier; } });
|
|
13
|
-
var nodeKeyManager_js_1 = require("./nodeKeyManager.js");
|
|
14
|
-
Object.defineProperty(exports, "createNodeKeyManager", { enumerable: true, get: function () { return nodeKeyManager_js_1.createNodeKeyManager; } });
|
|
15
|
-
Object.defineProperty(exports, "isStableNodeKey", { enumerable: true, get: function () { return nodeKeyManager_js_1.isStableNodeKey; } });
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA;AAC3B,2CAKsB;AAJrB,kHAAA,oBAAoB,OAAA;AAGpB,mHAAA,qBAAqB,OAAA;AAEtB,yDAI6B;AAH5B,yHAAA,oBAAoB,OAAA;AACpB,oHAAA,eAAe,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { MockNodeKeyManager } from \"./mockNodeKeyManager.js\";\nexport {\n\tcompareLocalNodeKeys,\n\ttype LocalNodeKey,\n\ttype StableNodeKey,\n\tnodeKeyTreeIdentifier,\n} from \"./nodeKey.js\";\nexport {\n\tcreateNodeKeyManager,\n\tisStableNodeKey,\n\ttype NodeKeyManager,\n} from \"./nodeKeyManager.js\";\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { StableId } from "@fluidframework/id-compressor";
|
|
6
|
-
import type { LocalNodeKey, StableNodeKey } from "./nodeKey.js";
|
|
7
|
-
import { type NodeKeyManager } from "./nodeKeyManager.js";
|
|
8
|
-
/**
|
|
9
|
-
* Mock {@link NodeKeyManager} that generates deterministic {@link StableNodeKey}s and {@link LocalNodeKey}s.
|
|
10
|
-
* @remarks This is useful for test environments because it will always yield the same keys in the same order.
|
|
11
|
-
* It should not be used for production environments for the same reason; the {@link StableNodeKey}s are not universally unique.
|
|
12
|
-
*/
|
|
13
|
-
export declare class MockNodeKeyManager implements NodeKeyManager {
|
|
14
|
-
private count;
|
|
15
|
-
generateStableNodeKey(): StableNodeKey;
|
|
16
|
-
generateLocalNodeKey(): LocalNodeKey;
|
|
17
|
-
localizeNodeKey(key: StableNodeKey): LocalNodeKey;
|
|
18
|
-
stabilizeNodeKey(key: LocalNodeKey): StableNodeKey;
|
|
19
|
-
tryLocalizeNodeKey(key: string): LocalNodeKey | undefined;
|
|
20
|
-
getId(offset: number): StableId;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=mockNodeKeyManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mockNodeKeyManager.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/mockNodeKeyManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAA4B,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAExF,OAAO,KAAK,EAAE,YAAY,EAAE,aA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CAAC,CAAC;IAClD,CAAC;IAEM,kBAAkB,CAAC,GAAW;QACpC,IAAI,CAAC,IAAA,mCAAe,EAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,0BAA0B,CAAC,EAAE,CAAC;YAC1E,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5D,OAAO,YAAY,GAAG,IAAI,CAAC,KAAK;YAC/B,CAAC,CAAC,IAAA,gBAAK,EAAC,YAAwC,CAAC;YACjD,CAAC,CAAC,SAAS,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,MAAc;QAC1B,IAAA,iBAAM,EAAC,MAAM,IAAI,CAAC,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACjE,IAAA,iBAAM,EAAC,MAAM,GAAG,mBAAmB,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACpF,OAAO,IAAA,2BAAgB,EACtB,2BAA2B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAC9E,CAAC;IACH,CAAC;CACD;AApCD,gDAoCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { SessionSpaceCompressedId, StableId } from \"@fluidframework/id-compressor\";\nimport { assertIsStableId } from \"@fluidframework/id-compressor/internal\";\nimport type { LocalNodeKey, StableNodeKey } from \"./nodeKey.js\";\nimport { isStableNodeKey, type NodeKeyManager } from \"./nodeKeyManager.js\";\nimport { brand, extractFromOpaque, fail } from \"../../util/index.js\";\n\n/**\n * Mock {@link NodeKeyManager} that generates deterministic {@link StableNodeKey}s and {@link LocalNodeKey}s.\n * @remarks This is useful for test environments because it will always yield the same keys in the same order.\n * It should not be used for production environments for the same reason; the {@link StableNodeKey}s are not universally unique.\n */\nexport class MockNodeKeyManager implements NodeKeyManager {\n\tprivate count = 0;\n\n\tpublic generateStableNodeKey(): StableNodeKey {\n\t\treturn brand(this.getId(this.count++));\n\t}\n\n\tpublic generateLocalNodeKey(): LocalNodeKey {\n\t\treturn this.localizeNodeKey(this.generateStableNodeKey());\n\t}\n\n\tpublic localizeNodeKey(key: StableNodeKey): LocalNodeKey {\n\t\treturn this.tryLocalizeNodeKey(key) ?? fail(0xb26 /* Key is not compressible */);\n\t}\n\n\tpublic stabilizeNodeKey(key: LocalNodeKey): StableNodeKey {\n\t\treturn brand(this.getId(extractFromOpaque(key)));\n\t}\n\n\tpublic tryLocalizeNodeKey(key: string): LocalNodeKey | undefined {\n\t\tif (!isStableNodeKey(key) || !key.startsWith(\"a110ca7e-add1-4000-8000-\")) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst localNodeKey = Number.parseInt(key.substring(24), 16);\n\t\treturn localNodeKey < this.count\n\t\t\t? brand(localNodeKey as SessionSpaceCompressedId)\n\t\t\t: undefined;\n\t}\n\n\tpublic getId(offset: number): StableId {\n\t\tassert(offset >= 0, 0x6e7 /* UUID offset may not be negative */);\n\t\tassert(offset < 281_474_976_710_656, 0x6e8 /* UUID offset must be at most 16^12 */);\n\t\treturn assertIsStableId(\n\t\t\t`a110ca7e-add1-4000-8000-${Math.round(offset).toString(16).padStart(12, \"0\")}`,\n\t\t);\n\t}\n}\n"]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { SessionSpaceCompressedId, StableId } from "@fluidframework/id-compressor";
|
|
6
|
-
import type { TreeNodeSchemaIdentifier } from "../../core/index.js";
|
|
7
|
-
import { type Brand, type Opaque } from "../../util/index.js";
|
|
8
|
-
/**
|
|
9
|
-
* A key which uniquely identifies a node in the tree within this session.
|
|
10
|
-
* @remarks {@link LocalNodeKey}s must not be serialized and stored as data without first being converted into a {@link StableNodeKey}.
|
|
11
|
-
* They are local to the current session and equivalent nodes in another session will not necessarily have the same {@link LocalNodeKey}.
|
|
12
|
-
* However, they are otherwise preferential to use over {@link StableNodeKey}s as they are much smaller.
|
|
13
|
-
* For example, they are more efficient than {@link StableNodeKey}s when used as keys in a map.
|
|
14
|
-
* {@link LocalNodeKey}s may be compared or equated via {@link compareLocalNodeKeys}.
|
|
15
|
-
*/
|
|
16
|
-
export interface LocalNodeKey extends Opaque<Brand<SessionSpaceCompressedId, "Local Node Key">> {
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* A UUID which identifies a node in the tree.
|
|
20
|
-
* This key is universally unique and stable forever; therefore it is safe to persist as data in a SharedTree or other DDS/database.
|
|
21
|
-
* When not persisted or serialized, it is preferable to use a {@link LocalNodeKey} instead for better performance.
|
|
22
|
-
*/
|
|
23
|
-
export type StableNodeKey = Brand<StableId, "Stable Node Key">;
|
|
24
|
-
/**
|
|
25
|
-
* Compares two {@link LocalNodeKey}s.
|
|
26
|
-
* All {@link LocalNodeKey}s retrieved from a single SharedTree client can be totally ordered using this comparator.
|
|
27
|
-
* @param a - the first key to compare
|
|
28
|
-
* @param b - the second key to compare
|
|
29
|
-
* @returns `0` if `a` and `b` are the same key, otherwise `-1` if `a` is ordered before `b` or `1` if `a` is ordered after `b`.
|
|
30
|
-
*/
|
|
31
|
-
export declare function compareLocalNodeKeys(a: LocalNodeKey, b: LocalNodeKey): -1 | 0 | 1;
|
|
32
|
-
/**
|
|
33
|
-
* The TreeNodeSchemaIdentifier for node keys.
|
|
34
|
-
* @privateRemarks TODO: Come up with a unified and collision-resistant naming schema for types defined by the system.
|
|
35
|
-
* For now, we'll use `__` to reduce the change of collision, since this is what other internal properties use in Fluid.
|
|
36
|
-
*/
|
|
37
|
-
export declare const nodeKeyTreeIdentifier: TreeNodeSchemaIdentifier;
|
|
38
|
-
//# sourceMappingURL=nodeKey.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeKey.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKey.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAExF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,MAAM,EAAS,MAAM,qBAAqB,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,WAAW,YAChB,SAAQ,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE,gBAAgB,CAAC,CAAC;CAAG;AAErE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAE/D;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAEjF;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,wBAEnC,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.nodeKeyTreeIdentifier = exports.compareLocalNodeKeys = void 0;
|
|
8
|
-
const index_js_1 = require("../../util/index.js");
|
|
9
|
-
/**
|
|
10
|
-
* Compares two {@link LocalNodeKey}s.
|
|
11
|
-
* All {@link LocalNodeKey}s retrieved from a single SharedTree client can be totally ordered using this comparator.
|
|
12
|
-
* @param a - the first key to compare
|
|
13
|
-
* @param b - the second key to compare
|
|
14
|
-
* @returns `0` if `a` and `b` are the same key, otherwise `-1` if `a` is ordered before `b` or `1` if `a` is ordered after `b`.
|
|
15
|
-
*/
|
|
16
|
-
function compareLocalNodeKeys(a, b) {
|
|
17
|
-
return a === b ? 0 : a > b ? 1 : -1;
|
|
18
|
-
}
|
|
19
|
-
exports.compareLocalNodeKeys = compareLocalNodeKeys;
|
|
20
|
-
/**
|
|
21
|
-
* The TreeNodeSchemaIdentifier for node keys.
|
|
22
|
-
* @privateRemarks TODO: Come up with a unified and collision-resistant naming schema for types defined by the system.
|
|
23
|
-
* For now, we'll use `__` to reduce the change of collision, since this is what other internal properties use in Fluid.
|
|
24
|
-
*/
|
|
25
|
-
exports.nodeKeyTreeIdentifier = (0, index_js_1.brand)("com.fluidframework.nodeKey.NodeKey");
|
|
26
|
-
//# sourceMappingURL=nodeKey.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeKey.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKey.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,kDAAqE;AAoBrE;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,CAAe,EAAE,CAAe;IACpE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAFD,oDAEC;AAED;;;;GAIG;AACU,QAAA,qBAAqB,GAA6B,IAAA,gBAAK,EACnE,oCAAoC,CACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionSpaceCompressedId, StableId } from \"@fluidframework/id-compressor\";\n\nimport type { TreeNodeSchemaIdentifier } from \"../../core/index.js\";\nimport { type Brand, type Opaque, brand } from \"../../util/index.js\";\n\n/**\n * A key which uniquely identifies a node in the tree within this session.\n * @remarks {@link LocalNodeKey}s must not be serialized and stored as data without first being converted into a {@link StableNodeKey}.\n * They are local to the current session and equivalent nodes in another session will not necessarily have the same {@link LocalNodeKey}.\n * However, they are otherwise preferential to use over {@link StableNodeKey}s as they are much smaller.\n * For example, they are more efficient than {@link StableNodeKey}s when used as keys in a map.\n * {@link LocalNodeKey}s may be compared or equated via {@link compareLocalNodeKeys}.\n */\nexport interface LocalNodeKey\n\textends Opaque<Brand<SessionSpaceCompressedId, \"Local Node Key\">> {}\n\n/**\n * A UUID which identifies a node in the tree.\n * This key is universally unique and stable forever; therefore it is safe to persist as data in a SharedTree or other DDS/database.\n * When not persisted or serialized, it is preferable to use a {@link LocalNodeKey} instead for better performance.\n */\nexport type StableNodeKey = Brand<StableId, \"Stable Node Key\">;\n\n/**\n * Compares two {@link LocalNodeKey}s.\n * All {@link LocalNodeKey}s retrieved from a single SharedTree client can be totally ordered using this comparator.\n * @param a - the first key to compare\n * @param b - the second key to compare\n * @returns `0` if `a` and `b` are the same key, otherwise `-1` if `a` is ordered before `b` or `1` if `a` is ordered after `b`.\n */\nexport function compareLocalNodeKeys(a: LocalNodeKey, b: LocalNodeKey): -1 | 0 | 1 {\n\treturn a === b ? 0 : a > b ? 1 : -1;\n}\n\n/**\n * The TreeNodeSchemaIdentifier for node keys.\n * @privateRemarks TODO: Come up with a unified and collision-resistant naming schema for types defined by the system.\n * For now, we'll use `__` to reduce the change of collision, since this is what other internal properties use in Fluid.\n */\nexport const nodeKeyTreeIdentifier: TreeNodeSchemaIdentifier = brand(\n\t\"com.fluidframework.nodeKey.NodeKey\",\n);\n"]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
6
|
-
import type { LocalNodeKey, StableNodeKey } from "./nodeKey.js";
|
|
7
|
-
/**
|
|
8
|
-
* An object which handles the generation of node keys as well as conversion between their two types ({@link StableNodeKey} and {@link LocalNodeKey}).
|
|
9
|
-
*/
|
|
10
|
-
export interface NodeKeyManager {
|
|
11
|
-
/**
|
|
12
|
-
* Generate a {@link StableNodeKey}.
|
|
13
|
-
*/
|
|
14
|
-
generateLocalNodeKey(): LocalNodeKey;
|
|
15
|
-
/**
|
|
16
|
-
* Convert the given {@link StableNodeKey} into its {@link LocalNodeKey} form.
|
|
17
|
-
*/
|
|
18
|
-
localizeNodeKey(key: StableNodeKey): LocalNodeKey;
|
|
19
|
-
/**
|
|
20
|
-
* Convert the given {@link LocalNodeKey} into its {@link StableNodeKey} form.
|
|
21
|
-
*/
|
|
22
|
-
stabilizeNodeKey(key: LocalNodeKey): StableNodeKey;
|
|
23
|
-
/**
|
|
24
|
-
* Attempts to recompress a StableNodeKey.
|
|
25
|
-
* @param key - The key that is attempted to recompress.
|
|
26
|
-
* @returns The `LocalNodeKey` associated with `key` or undefined if the key was not generated by any session known to this compressor.
|
|
27
|
-
*/
|
|
28
|
-
tryLocalizeNodeKey(key: string): LocalNodeKey | undefined;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Creates a {@link NodeKeyManager} from the given {@link IIdCompressor}.
|
|
32
|
-
* @param idCompressor - the compressor to use for key generation, compression, and decompression.
|
|
33
|
-
* If undefined, then attempts to generate or convert keys will throw an error.
|
|
34
|
-
*/
|
|
35
|
-
export declare function createNodeKeyManager(idCompressor?: IIdCompressor | undefined): NodeKeyManager;
|
|
36
|
-
export declare function isStableNodeKey(key: string): key is StableNodeKey;
|
|
37
|
-
//# sourceMappingURL=nodeKeyManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeKeyManager.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKeyManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAKnE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,oBAAoB,IAAI,YAAY,CAAC;IAErC;;OAEG;IACH,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,YAAY,CAAC;IAElD;;OAEG;IACH,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,aAAa,CAAC;IAEnD;;;;OAIG;IACH,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC;CAC1D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,YAAY,CAAC,EAAE,aAAa,GAAG,SAAS,GACtC,cAAc,CAyChB;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,aAAa,CAEjE"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.isStableNodeKey = exports.createNodeKeyManager = void 0;
|
|
8
|
-
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
-
const internal_2 = require("@fluidframework/id-compressor/internal");
|
|
10
|
-
const index_js_1 = require("../../util/index.js");
|
|
11
|
-
/**
|
|
12
|
-
* Creates a {@link NodeKeyManager} from the given {@link IIdCompressor}.
|
|
13
|
-
* @param idCompressor - the compressor to use for key generation, compression, and decompression.
|
|
14
|
-
* If undefined, then attempts to generate or convert keys will throw an error.
|
|
15
|
-
*/
|
|
16
|
-
function createNodeKeyManager(idCompressor) {
|
|
17
|
-
return {
|
|
18
|
-
generateLocalNodeKey: () => {
|
|
19
|
-
(0, internal_1.assert)(idCompressor !== undefined, 0x6e4 /* Runtime IdCompressor must be available to generate local node keys */);
|
|
20
|
-
return (0, index_js_1.brand)(idCompressor.generateCompressedId());
|
|
21
|
-
},
|
|
22
|
-
localizeNodeKey: (key) => {
|
|
23
|
-
(0, internal_1.assert)(idCompressor !== undefined, 0x6e5 /* Runtime IdCompressor must be available to convert node keys */);
|
|
24
|
-
return (0, index_js_1.brand)(idCompressor.recompress(key));
|
|
25
|
-
},
|
|
26
|
-
stabilizeNodeKey: (key) => {
|
|
27
|
-
(0, internal_1.assert)(idCompressor !== undefined, 0x6e6 /* Runtime IdCompressor must be available to convert node keys */);
|
|
28
|
-
return (0, index_js_1.brand)(
|
|
29
|
-
// TODO: The assert below is required for type safety but is maybe slow
|
|
30
|
-
(0, internal_2.assertIsStableId)(idCompressor.decompress((0, index_js_1.extractFromOpaque)(key))));
|
|
31
|
-
},
|
|
32
|
-
tryLocalizeNodeKey: (key) => {
|
|
33
|
-
(0, internal_1.assert)(idCompressor !== undefined, 0x6e9 /* Runtime IdCompressor must be available to convert node keys */);
|
|
34
|
-
if (isStableNodeKey(key)) {
|
|
35
|
-
const compressedKey = idCompressor.tryRecompress(key);
|
|
36
|
-
if (compressedKey !== undefined) {
|
|
37
|
-
return (0, index_js_1.brand)(compressedKey);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
exports.createNodeKeyManager = createNodeKeyManager;
|
|
44
|
-
function isStableNodeKey(key) {
|
|
45
|
-
return (0, internal_2.isStableId)(key);
|
|
46
|
-
}
|
|
47
|
-
exports.isStableNodeKey = isStableNodeKey;
|
|
48
|
-
//# sourceMappingURL=nodeKeyManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeKeyManager.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKeyManager.ts"],"names":[],"mappings":";AAAA;;;GA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e,CAAC,GAAW;IAC1C,OAAO,IAAA,qBAAU,EAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAFD,0CAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { assertIsStableId, isStableId } from \"@fluidframework/id-compressor/internal\";\n\nimport { brand, extractFromOpaque } from \"../../util/index.js\";\n\nimport type { LocalNodeKey, StableNodeKey } from \"./nodeKey.js\";\n\n/**\n * An object which handles the generation of node keys as well as conversion between their two types ({@link StableNodeKey} and {@link LocalNodeKey}).\n */\nexport interface NodeKeyManager {\n\t/**\n\t * Generate a {@link StableNodeKey}.\n\t */\n\tgenerateLocalNodeKey(): LocalNodeKey;\n\n\t/**\n\t * Convert the given {@link StableNodeKey} into its {@link LocalNodeKey} form.\n\t */\n\tlocalizeNodeKey(key: StableNodeKey): LocalNodeKey;\n\n\t/**\n\t * Convert the given {@link LocalNodeKey} into its {@link StableNodeKey} form.\n\t */\n\tstabilizeNodeKey(key: LocalNodeKey): StableNodeKey;\n\n\t/**\n\t * Attempts to recompress a StableNodeKey.\n\t * @param key - The key that is attempted to recompress.\n\t * @returns The `LocalNodeKey` associated with `key` or undefined if the key was not generated by any session known to this compressor.\n\t */\n\ttryLocalizeNodeKey(key: string): LocalNodeKey | undefined;\n}\n\n/**\n * Creates a {@link NodeKeyManager} from the given {@link IIdCompressor}.\n * @param idCompressor - the compressor to use for key generation, compression, and decompression.\n * If undefined, then attempts to generate or convert keys will throw an error.\n */\nexport function createNodeKeyManager(\n\tidCompressor?: IIdCompressor | undefined,\n): NodeKeyManager {\n\treturn {\n\t\tgenerateLocalNodeKey: () => {\n\t\t\tassert(\n\t\t\t\tidCompressor !== undefined,\n\t\t\t\t0x6e4 /* Runtime IdCompressor must be available to generate local node keys */,\n\t\t\t);\n\t\t\treturn brand(idCompressor.generateCompressedId());\n\t\t},\n\n\t\tlocalizeNodeKey: (key: StableNodeKey) => {\n\t\t\tassert(\n\t\t\t\tidCompressor !== undefined,\n\t\t\t\t0x6e5 /* Runtime IdCompressor must be available to convert node keys */,\n\t\t\t);\n\t\t\treturn brand(idCompressor.recompress(key));\n\t\t},\n\n\t\tstabilizeNodeKey: (key: LocalNodeKey) => {\n\t\t\tassert(\n\t\t\t\tidCompressor !== undefined,\n\t\t\t\t0x6e6 /* Runtime IdCompressor must be available to convert node keys */,\n\t\t\t);\n\t\t\treturn brand(\n\t\t\t\t// TODO: The assert below is required for type safety but is maybe slow\n\t\t\t\tassertIsStableId(idCompressor.decompress(extractFromOpaque(key))),\n\t\t\t);\n\t\t},\n\t\ttryLocalizeNodeKey: (key: string) => {\n\t\t\tassert(\n\t\t\t\tidCompressor !== undefined,\n\t\t\t\t0x6e9 /* Runtime IdCompressor must be available to convert node keys */,\n\t\t\t);\n\t\t\tif (isStableNodeKey(key)) {\n\t\t\t\tconst compressedKey = idCompressor.tryRecompress(key);\n\t\t\t\tif (compressedKey !== undefined) {\n\t\t\t\t\treturn brand(compressedKey);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n}\n\nexport function isStableNodeKey(key: string): key is StableNodeKey {\n\treturn isStableId(key);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemaBasedEncoding.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/schemaBasedEncoding.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAIN,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAI7B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,EACN,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,KAAK,UAAU,EAIf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,KAAK,iBAAiB,EAAwC,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,aAAa,GACzB,iBAAiB,CAEnB;AAED,wBAAgB,UAAU,CACzB,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,gBAAgB,EACxB,YAAY,EAAE,aAAa,GACzB,YAAY,CAUd;AAED;;GAEG;AACH,wBAAgB,WAAW,CAC1B,WAAW,EAAE,UAAU,EACvB,KAAK,EAAE,qBAAqB,EAC5B,KAAK,EAAE,YAAY,EACnB,YAAY,EAAE,sBAAsB,GAClC,YAAY,CA6Bd;AAED;;GAEG;AACH,wBAAgB,UAAU,CACzB,UAAU,EAAE,sBAAsB,EAClC,MAAM,EAAE,gBAAgB,EACxB,YAAY,EAAE,WAAW,EACzB,UAAU,EAAE,wBAAwB,GAClC,SAAS,CAoCX;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,CAU5E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemaBasedEncoding.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/schemaBasedEncoding.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EACN,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EAItB,WAAW,EACX,YAAY,EACZ,6BAA6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KAAK,SAAS;YACb,OAAO,KAAK,CAAC;QACd,KAAK,WAAW,CAAC,MAAM,CAAC;QACxB,KAAK,WAAW,CAAC,MAAM,CAAC;QACxB,KAAK,WAAW,CAAC,OAAO,CAAC;QACzB,KAAK,WAAW,CAAC,WAAW;YAC3B,OAAO,IAAI,CAAC;QACb,KAAK,WAAW,CAAC,IAAI;YACpB,OAAO,CAAC,IAAI,CAAC,CAAC;QACf;YACC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\ttype StoredSchemaCollection,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\tValueSchema,\n\tMultiplicity,\n\tidentifierFieldKindIdentifier,\n} from \"../../../core/index.js\";\nimport { fail } from \"../../../util/index.js\";\nimport type { FullSchemaPolicy } from \"../../modular-schema/index.js\";\n\nimport {\n\tEncoderCache,\n\ttype FieldEncoder,\n\ttype FieldShaper,\n\ttype KeyedFieldEncoder,\n\ttype TreeShaper,\n\tanyNodeEncoder,\n\tasFieldEncoder,\n\tcompressedEncode,\n} from \"./compressedEncode.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport { type EncodedFieldBatch, type EncodedValueShape, SpecialField } from \"./format.js\";\nimport { NodeShape } from \"./nodeShape.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\n/**\n * Encode data from `fieldBatch` in into an `EncodedChunk`.\n *\n * Optimized for encoded size and encoding performance.\n * TODO: This function should eventually also take in the root FieldSchema to more efficiently compress the nodes.\n */\nexport function schemaCompressedEncode(\n\tschema: StoredSchemaCollection,\n\tpolicy: FullSchemaPolicy,\n\tfieldBatch: FieldBatch,\n\tidCompressor: IIdCompressor,\n): EncodedFieldBatch {\n\treturn compressedEncode(fieldBatch, buildCache(schema, policy, idCompressor));\n}\n\nexport function buildCache(\n\tschema: StoredSchemaCollection,\n\tpolicy: FullSchemaPolicy,\n\tidCompressor: IIdCompressor,\n): EncoderCache {\n\tconst cache: EncoderCache = new EncoderCache(\n\t\t(fieldHandler: FieldShaper, schemaName: TreeNodeSchemaIdentifier) =>\n\t\t\ttreeShaper(schema, policy, fieldHandler, schemaName),\n\t\t(treeHandler: TreeShaper, field: TreeFieldStoredSchema) =>\n\t\t\tfieldShaper(treeHandler, field, cache, schema),\n\t\tpolicy.fieldKinds,\n\t\tidCompressor,\n\t);\n\treturn cache;\n}\n\n/**\n * Selects shapes to use to encode fields.\n */\nexport function fieldShaper(\n\ttreeHandler: TreeShaper,\n\tfield: TreeFieldStoredSchema,\n\tcache: EncoderCache,\n\tstoredSchema: StoredSchemaCollection,\n): FieldEncoder {\n\tconst kind = cache.fieldShapes.get(field.kind) ?? fail(0xb52 /* missing FieldKind */);\n\tconst type = oneFromSet(field.types);\n\tconst nodeEncoder = type !== undefined ? treeHandler.shapeFromTree(type) : anyNodeEncoder;\n\tif (kind.multiplicity === Multiplicity.Single) {\n\t\tif (field.kind === identifierFieldKindIdentifier) {\n\t\t\tassert(type !== undefined, 0x999 /* field type must be defined in identifier field */);\n\t\t\tconst nodeSchema = storedSchema.nodeSchema.get(type);\n\t\t\tassert(nodeSchema !== undefined, 0x99a /* nodeSchema must be defined */);\n\t\t\tassert(\n\t\t\t\tnodeSchema instanceof LeafNodeStoredSchema,\n\t\t\t\t0x99b /* nodeSchema must be LeafNodeStoredSchema */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\tnodeSchema.leafValue === ValueSchema.String,\n\t\t\t\t0x99c /* identifier field can only be type string */,\n\t\t\t);\n\t\t\tconst identifierNodeEncoder = new NodeShape(\n\t\t\t\ttype,\n\t\t\t\tSpecialField.Identifier,\n\t\t\t\t[],\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\treturn asFieldEncoder(identifierNodeEncoder);\n\t\t}\n\t\treturn asFieldEncoder(nodeEncoder);\n\t} else {\n\t\treturn cache.nestedArray(nodeEncoder);\n\t}\n}\n\n/**\n * Selects shapes to use to encode trees.\n */\nexport function treeShaper(\n\tfullSchema: StoredSchemaCollection,\n\tpolicy: FullSchemaPolicy,\n\tfieldHandler: FieldShaper,\n\tschemaName: TreeNodeSchemaIdentifier,\n): NodeShape {\n\tconst schema =\n\t\tfullSchema.nodeSchema.get(schemaName) ?? fail(0xb53 /* missing node schema */);\n\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\t// TODO:Performance:\n\t\t// consider moving some optional and sequence fields to extra fields if they are commonly empty\n\t\t// to reduce encoded size.\n\n\t\tconst objectNodeFields: KeyedFieldEncoder[] = [];\n\t\tfor (const [key, field] of schema.objectNodeFields ?? []) {\n\t\t\tobjectNodeFields.push({ key, shape: fieldHandler.shapeFromField(field) });\n\t\t}\n\n\t\tconst shape = new NodeShape(schemaName, false, objectNodeFields, undefined);\n\t\treturn shape;\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\tconst shape = new NodeShape(\n\t\t\tschemaName,\n\t\t\tvalueShapeFromSchema(schema.leafValue),\n\t\t\t[],\n\t\t\tundefined,\n\t\t);\n\t\treturn shape;\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tconst shape = new NodeShape(\n\t\t\tschemaName,\n\t\t\tfalse,\n\t\t\t[],\n\t\t\tfieldHandler.shapeFromField(schema.mapFields),\n\t\t);\n\t\treturn shape;\n\t}\n\tfail(0xb54 /* unsupported node kind */);\n}\n\nexport function oneFromSet<T>(set: ReadonlySet<T> | undefined): T | undefined {\n\tif (set === undefined) {\n\t\treturn undefined;\n\t}\n\tif (set.size !== 1) {\n\t\treturn undefined;\n\t}\n\tfor (const item of set) {\n\t\treturn item;\n\t}\n}\n\nfunction valueShapeFromSchema(schema: ValueSchema | undefined): undefined | EncodedValueShape {\n\tswitch (schema) {\n\t\tcase undefined:\n\t\t\treturn false;\n\t\tcase ValueSchema.Number:\n\t\tcase ValueSchema.String:\n\t\tcase ValueSchema.Boolean:\n\t\tcase ValueSchema.FluidHandle:\n\t\t\treturn true;\n\t\tcase ValueSchema.Null:\n\t\t\treturn [null];\n\t\tdefault:\n\t\t\tunreachableCase(schema);\n\t}\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
export { MockNodeKeyManager } from "./mockNodeKeyManager.js";
|
|
6
|
-
export { compareLocalNodeKeys, type LocalNodeKey, type StableNodeKey, nodeKeyTreeIdentifier, } from "./nodeKey.js";
|
|
7
|
-
export { createNodeKeyManager, isStableNodeKey, type NodeKeyManager, } from "./nodeKeyManager.js";
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACN,oBAAoB,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,qBAAqB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,KAAK,cAAc,GACnB,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
export { MockNodeKeyManager } from "./mockNodeKeyManager.js";
|
|
6
|
-
export { compareLocalNodeKeys, nodeKeyTreeIdentifier, } from "./nodeKey.js";
|
|
7
|
-
export { createNodeKeyManager, isStableNodeKey, } from "./nodeKeyManager.js";
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACN,oBAAoB,EAGpB,qBAAqB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,oBAAoB,EACpB,eAAe,GAEf,MAAM,qBAAqB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { MockNodeKeyManager } from \"./mockNodeKeyManager.js\";\nexport {\n\tcompareLocalNodeKeys,\n\ttype LocalNodeKey,\n\ttype StableNodeKey,\n\tnodeKeyTreeIdentifier,\n} from \"./nodeKey.js\";\nexport {\n\tcreateNodeKeyManager,\n\tisStableNodeKey,\n\ttype NodeKeyManager,\n} from \"./nodeKeyManager.js\";\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { StableId } from "@fluidframework/id-compressor";
|
|
6
|
-
import type { LocalNodeKey, StableNodeKey } from "./nodeKey.js";
|
|
7
|
-
import { type NodeKeyManager } from "./nodeKeyManager.js";
|
|
8
|
-
/**
|
|
9
|
-
* Mock {@link NodeKeyManager} that generates deterministic {@link StableNodeKey}s and {@link LocalNodeKey}s.
|
|
10
|
-
* @remarks This is useful for test environments because it will always yield the same keys in the same order.
|
|
11
|
-
* It should not be used for production environments for the same reason; the {@link StableNodeKey}s are not universally unique.
|
|
12
|
-
*/
|
|
13
|
-
export declare class MockNodeKeyManager implements NodeKeyManager {
|
|
14
|
-
private count;
|
|
15
|
-
generateStableNodeKey(): StableNodeKey;
|
|
16
|
-
generateLocalNodeKey(): LocalNodeKey;
|
|
17
|
-
localizeNodeKey(key: StableNodeKey): LocalNodeKey;
|
|
18
|
-
stabilizeNodeKey(key: LocalNodeKey): StableNodeKey;
|
|
19
|
-
tryLocalizeNodeKey(key: string): LocalNodeKey | undefined;
|
|
20
|
-
getId(offset: number): StableId;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=mockNodeKeyManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mockNodeKeyManager.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/mockNodeKeyManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAA4B,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAExF,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG3E;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,cAAc;IACxD,OAAO,CAAC,KAAK,CAAK;IAEX,qBAAqB,IAAI,aAAa;IAItC,oBAAoB,IAAI,YAAY;IAIpC,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,YAAY;IAIjD,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,aAAa;IAIlD,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAUzD,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ;CAOtC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mockNodeKeyManager.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/mockNodeKeyManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,C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MAAM,CAAC,MAAM,GAAG,mBAAmB,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACpF,OAAO,gBAAgB,CACtB,2BAA2B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAC9E,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { SessionSpaceCompressedId, StableId } from \"@fluidframework/id-compressor\";\nimport { assertIsStableId } from \"@fluidframework/id-compressor/internal\";\nimport type { LocalNodeKey, StableNodeKey } from \"./nodeKey.js\";\nimport { isStableNodeKey, type NodeKeyManager } from \"./nodeKeyManager.js\";\nimport { brand, extractFromOpaque, fail } from \"../../util/index.js\";\n\n/**\n * Mock {@link NodeKeyManager} that generates deterministic {@link StableNodeKey}s and {@link LocalNodeKey}s.\n * @remarks This is useful for test environments because it will always yield the same keys in the same order.\n * It should not be used for production environments for the same reason; the {@link StableNodeKey}s are not universally unique.\n */\nexport class MockNodeKeyManager implements NodeKeyManager {\n\tprivate count = 0;\n\n\tpublic generateStableNodeKey(): StableNodeKey {\n\t\treturn brand(this.getId(this.count++));\n\t}\n\n\tpublic generateLocalNodeKey(): LocalNodeKey {\n\t\treturn this.localizeNodeKey(this.generateStableNodeKey());\n\t}\n\n\tpublic localizeNodeKey(key: StableNodeKey): LocalNodeKey {\n\t\treturn this.tryLocalizeNodeKey(key) ?? fail(0xb26 /* Key is not compressible */);\n\t}\n\n\tpublic stabilizeNodeKey(key: LocalNodeKey): StableNodeKey {\n\t\treturn brand(this.getId(extractFromOpaque(key)));\n\t}\n\n\tpublic tryLocalizeNodeKey(key: string): LocalNodeKey | undefined {\n\t\tif (!isStableNodeKey(key) || !key.startsWith(\"a110ca7e-add1-4000-8000-\")) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst localNodeKey = Number.parseInt(key.substring(24), 16);\n\t\treturn localNodeKey < this.count\n\t\t\t? brand(localNodeKey as SessionSpaceCompressedId)\n\t\t\t: undefined;\n\t}\n\n\tpublic getId(offset: number): StableId {\n\t\tassert(offset >= 0, 0x6e7 /* UUID offset may not be negative */);\n\t\tassert(offset < 281_474_976_710_656, 0x6e8 /* UUID offset must be at most 16^12 */);\n\t\treturn assertIsStableId(\n\t\t\t`a110ca7e-add1-4000-8000-${Math.round(offset).toString(16).padStart(12, \"0\")}`,\n\t\t);\n\t}\n}\n"]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { SessionSpaceCompressedId, StableId } from "@fluidframework/id-compressor";
|
|
6
|
-
import type { TreeNodeSchemaIdentifier } from "../../core/index.js";
|
|
7
|
-
import { type Brand, type Opaque } from "../../util/index.js";
|
|
8
|
-
/**
|
|
9
|
-
* A key which uniquely identifies a node in the tree within this session.
|
|
10
|
-
* @remarks {@link LocalNodeKey}s must not be serialized and stored as data without first being converted into a {@link StableNodeKey}.
|
|
11
|
-
* They are local to the current session and equivalent nodes in another session will not necessarily have the same {@link LocalNodeKey}.
|
|
12
|
-
* However, they are otherwise preferential to use over {@link StableNodeKey}s as they are much smaller.
|
|
13
|
-
* For example, they are more efficient than {@link StableNodeKey}s when used as keys in a map.
|
|
14
|
-
* {@link LocalNodeKey}s may be compared or equated via {@link compareLocalNodeKeys}.
|
|
15
|
-
*/
|
|
16
|
-
export interface LocalNodeKey extends Opaque<Brand<SessionSpaceCompressedId, "Local Node Key">> {
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* A UUID which identifies a node in the tree.
|
|
20
|
-
* This key is universally unique and stable forever; therefore it is safe to persist as data in a SharedTree or other DDS/database.
|
|
21
|
-
* When not persisted or serialized, it is preferable to use a {@link LocalNodeKey} instead for better performance.
|
|
22
|
-
*/
|
|
23
|
-
export type StableNodeKey = Brand<StableId, "Stable Node Key">;
|
|
24
|
-
/**
|
|
25
|
-
* Compares two {@link LocalNodeKey}s.
|
|
26
|
-
* All {@link LocalNodeKey}s retrieved from a single SharedTree client can be totally ordered using this comparator.
|
|
27
|
-
* @param a - the first key to compare
|
|
28
|
-
* @param b - the second key to compare
|
|
29
|
-
* @returns `0` if `a` and `b` are the same key, otherwise `-1` if `a` is ordered before `b` or `1` if `a` is ordered after `b`.
|
|
30
|
-
*/
|
|
31
|
-
export declare function compareLocalNodeKeys(a: LocalNodeKey, b: LocalNodeKey): -1 | 0 | 1;
|
|
32
|
-
/**
|
|
33
|
-
* The TreeNodeSchemaIdentifier for node keys.
|
|
34
|
-
* @privateRemarks TODO: Come up with a unified and collision-resistant naming schema for types defined by the system.
|
|
35
|
-
* For now, we'll use `__` to reduce the change of collision, since this is what other internal properties use in Fluid.
|
|
36
|
-
*/
|
|
37
|
-
export declare const nodeKeyTreeIdentifier: TreeNodeSchemaIdentifier;
|
|
38
|
-
//# sourceMappingURL=nodeKey.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeKey.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKey.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAExF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,MAAM,EAAS,MAAM,qBAAqB,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,WAAW,YAChB,SAAQ,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE,gBAAgB,CAAC,CAAC;CAAG;AAErE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAE/D;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAEjF;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,wBAEnC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { brand } from "../../util/index.js";
|
|
6
|
-
/**
|
|
7
|
-
* Compares two {@link LocalNodeKey}s.
|
|
8
|
-
* All {@link LocalNodeKey}s retrieved from a single SharedTree client can be totally ordered using this comparator.
|
|
9
|
-
* @param a - the first key to compare
|
|
10
|
-
* @param b - the second key to compare
|
|
11
|
-
* @returns `0` if `a` and `b` are the same key, otherwise `-1` if `a` is ordered before `b` or `1` if `a` is ordered after `b`.
|
|
12
|
-
*/
|
|
13
|
-
export function compareLocalNodeKeys(a, b) {
|
|
14
|
-
return a === b ? 0 : a > b ? 1 : -1;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* The TreeNodeSchemaIdentifier for node keys.
|
|
18
|
-
* @privateRemarks TODO: Come up with a unified and collision-resistant naming schema for types defined by the system.
|
|
19
|
-
* For now, we'll use `__` to reduce the change of collision, since this is what other internal properties use in Fluid.
|
|
20
|
-
*/
|
|
21
|
-
export const nodeKeyTreeIdentifier = brand("com.fluidframework.nodeKey.NodeKey");
|
|
22
|
-
//# sourceMappingURL=nodeKey.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeKey.js","sourceRoot":"","sources":["../../../src/feature-libraries/node-key/nodeKey.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAA2B,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAoBrE;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,CAAe,EAAE,CAAe;IACpE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA6B,KAAK,CACnE,oCAAoC,CACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { SessionSpaceCompressedId, StableId } from \"@fluidframework/id-compressor\";\n\nimport type { TreeNodeSchemaIdentifier } from \"../../core/index.js\";\nimport { type Brand, type Opaque, brand } from \"../../util/index.js\";\n\n/**\n * A key which uniquely identifies a node in the tree within this session.\n * @remarks {@link LocalNodeKey}s must not be serialized and stored as data without first being converted into a {@link StableNodeKey}.\n * They are local to the current session and equivalent nodes in another session will not necessarily have the same {@link LocalNodeKey}.\n * However, they are otherwise preferential to use over {@link StableNodeKey}s as they are much smaller.\n * For example, they are more efficient than {@link StableNodeKey}s when used as keys in a map.\n * {@link LocalNodeKey}s may be compared or equated via {@link compareLocalNodeKeys}.\n */\nexport interface LocalNodeKey\n\textends Opaque<Brand<SessionSpaceCompressedId, \"Local Node Key\">> {}\n\n/**\n * A UUID which identifies a node in the tree.\n * This key is universally unique and stable forever; therefore it is safe to persist as data in a SharedTree or other DDS/database.\n * When not persisted or serialized, it is preferable to use a {@link LocalNodeKey} instead for better performance.\n */\nexport type StableNodeKey = Brand<StableId, \"Stable Node Key\">;\n\n/**\n * Compares two {@link LocalNodeKey}s.\n * All {@link LocalNodeKey}s retrieved from a single SharedTree client can be totally ordered using this comparator.\n * @param a - the first key to compare\n * @param b - the second key to compare\n * @returns `0` if `a` and `b` are the same key, otherwise `-1` if `a` is ordered before `b` or `1` if `a` is ordered after `b`.\n */\nexport function compareLocalNodeKeys(a: LocalNodeKey, b: LocalNodeKey): -1 | 0 | 1 {\n\treturn a === b ? 0 : a > b ? 1 : -1;\n}\n\n/**\n * The TreeNodeSchemaIdentifier for node keys.\n * @privateRemarks TODO: Come up with a unified and collision-resistant naming schema for types defined by the system.\n * For now, we'll use `__` to reduce the change of collision, since this is what other internal properties use in Fluid.\n */\nexport const nodeKeyTreeIdentifier: TreeNodeSchemaIdentifier = brand(\n\t\"com.fluidframework.nodeKey.NodeKey\",\n);\n"]}
|