@fluidframework/tree 2.11.0 → 2.12.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 +4 -0
- package/api-report/tree.alpha.api.md +2 -2
- package/api-report/tree.beta.api.md +1 -1
- package/api-report/tree.legacy.alpha.api.md +1 -1
- package/api-report/tree.legacy.public.api.md +1 -1
- package/api-report/tree.public.api.md +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +5 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +2 -9
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/format.d.ts +0 -3
- package/dist/core/schema-stored/format.d.ts.map +1 -1
- package/dist/core/schema-stored/format.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +12 -10
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +3 -5
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/schema-view/index.d.ts +1 -1
- package/dist/core/schema-view/index.d.ts.map +1 -1
- package/dist/core/schema-view/index.js +1 -2
- package/dist/core/schema-view/index.js.map +1 -1
- package/dist/core/schema-view/view.d.ts +0 -7
- package/dist/core/schema-view/view.d.ts.map +1 -1
- package/dist/core/schema-view/view.js +1 -12
- package/dist/core/schema-view/view.js.map +1 -1
- package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.d.ts +2 -1
- package/dist/core/tree/chunk.d.ts.map +1 -0
- package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.js +2 -2
- package/dist/core/tree/chunk.js.map +1 -0
- package/dist/core/tree/index.d.ts +1 -0
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +5 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/treeTextFormat.d.ts +0 -5
- package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
- package/dist/core/tree/treeTextFormat.js.map +1 -1
- package/dist/core/tree/types.d.ts +0 -5
- package/dist/core/tree/types.d.ts.map +1 -1
- package/dist/core/tree/types.js +0 -1
- package/dist/core/tree/types.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +14 -14
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -3
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.js +2 -3
- package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js +5 -5
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/sequenceChunk.js +2 -2
- package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +13 -13
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultSchema.js +1 -0
- package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +2 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +1 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +6 -2
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +31 -5
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/modular-schema/discrepancies.d.ts +84 -24
- package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/discrepancies.js +32 -33
- package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +5 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js +0 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
- package/dist/feature-libraries/sequence-field/formatV1.d.ts +99 -99
- package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.d.ts +76 -76
- package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.d.ts +54 -54
- package/dist/feature-libraries/sequence-field/types.d.ts +0 -1
- package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/types.js.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -14
- 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/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +1 -1
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +6 -6
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +8 -12
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +25 -7
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +104 -15
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +35 -12
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +159 -127
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +13 -35
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +12 -77
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts +7 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +16 -18
- package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +2 -2
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +3 -3
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +2 -2
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -9
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +4 -16
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +38 -0
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +118 -6
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/conciseTree.js +1 -1
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +5 -1
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +14 -2
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js +53 -3
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +4 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +48 -0
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +5 -2
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/simpleSchema.d.ts +3 -1
- 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/simpleTreeIndex.js +3 -1
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +4 -4
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +8 -21
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +1 -0
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +1 -1
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/api/view.d.ts +14 -9
- package/dist/simple-tree/api/view.d.ts.map +1 -1
- package/dist/simple-tree/api/view.js +129 -40
- package/dist/simple-tree/api/view.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 +5 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +0 -15
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +0 -15
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +8 -3
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +18 -2
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +4 -0
- package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +4 -2
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +18 -13
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/util/brand.d.ts +0 -2
- package/dist/util/brand.d.ts.map +1 -1
- package/dist/util/brand.js +0 -1
- package/dist/util/brand.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/typeCheck.d.ts +0 -2
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/utils.d.ts +13 -0
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +23 -1
- package/dist/util/utils.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/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +3 -10
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/schema-stored/format.d.ts +0 -3
- package/lib/core/schema-stored/format.d.ts.map +1 -1
- package/lib/core/schema-stored/format.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +12 -10
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +3 -5
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/schema-view/index.d.ts +1 -1
- package/lib/core/schema-view/index.d.ts.map +1 -1
- package/lib/core/schema-view/index.js +1 -1
- package/lib/core/schema-view/index.js.map +1 -1
- package/lib/core/schema-view/view.d.ts +0 -7
- package/lib/core/schema-view/view.d.ts.map +1 -1
- package/lib/core/schema-view/view.js +0 -11
- package/lib/core/schema-view/view.js.map +1 -1
- package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.d.ts +2 -1
- package/lib/core/tree/chunk.d.ts.map +1 -0
- package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.js +1 -1
- package/lib/core/tree/chunk.js.map +1 -0
- package/lib/core/tree/index.d.ts +1 -0
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -0
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/treeTextFormat.d.ts +0 -5
- package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
- package/lib/core/tree/treeTextFormat.js.map +1 -1
- package/lib/core/tree/types.d.ts +0 -5
- package/lib/core/tree/types.d.ts.map +1 -1
- package/lib/core/tree/types.js +0 -1
- package/lib/core/tree/types.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +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 +1 -2
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -2
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -2
- package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js +1 -1
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultSchema.js +1 -0
- package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +2 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +1 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +31 -5
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/modular-schema/discrepancies.d.ts +84 -24
- package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/discrepancies.js +25 -28
- package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.js +0 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
- package/lib/feature-libraries/sequence-field/formatV1.d.ts +99 -99
- package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.d.ts +76 -76
- package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.d.ts +54 -54
- package/lib/feature-libraries/sequence-field/types.d.ts +0 -1
- package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/types.js.map +1 -1
- package/lib/index.d.ts +4 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -3
- 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/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +1 -1
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +7 -7
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +10 -14
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +25 -7
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +105 -16
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +35 -12
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +161 -129
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +13 -35
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +12 -76
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts +7 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +16 -18
- package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +3 -3
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +3 -3
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +2 -2
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +2 -9
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +4 -16
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +38 -0
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +112 -1
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/conciseTree.js +2 -2
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +5 -1
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +14 -2
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js +50 -2
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +2 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +48 -0
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +4 -1
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/simpleSchema.d.ts +3 -1
- 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/simpleTreeIndex.js +3 -1
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +4 -4
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +5 -18
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +1 -0
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +2 -2
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/api/view.d.ts +14 -9
- package/lib/simple-tree/api/view.d.ts.map +1 -1
- package/lib/simple-tree/api/view.js +131 -42
- package/lib/simple-tree/api/view.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/leafNodeSchema.d.ts +0 -15
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +0 -15
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +8 -3
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +16 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +4 -0
- package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +4 -2
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +19 -14
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/util/brand.d.ts +0 -2
- package/lib/util/brand.d.ts.map +1 -1
- package/lib/util/brand.js +0 -1
- package/lib/util/brand.js.map +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/typeCheck.d.ts +0 -2
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/utils.d.ts +13 -0
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +21 -0
- package/lib/util/utils.js.map +1 -1
- package/package.json +22 -22
- package/src/core/index.ts +5 -1
- package/src/core/rebase/utils.ts +17 -20
- package/src/core/schema-stored/format.ts +0 -3
- package/src/core/schema-stored/schema.ts +13 -10
- package/src/core/schema-view/index.ts +0 -1
- package/src/core/schema-view/view.ts +0 -11
- package/src/{feature-libraries/chunked-forest → core/tree}/chunk.ts +4 -4
- package/src/core/tree/index.ts +8 -0
- package/src/core/tree/treeTextFormat.ts +0 -5
- package/src/core/tree/types.ts +0 -5
- package/src/feature-libraries/chunked-forest/basicChunk.ts +4 -2
- package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -1
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +2 -1
- package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +6 -2
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
- package/src/feature-libraries/chunked-forest/emptyChunk.ts +4 -2
- package/src/feature-libraries/chunked-forest/index.ts +1 -1
- package/src/feature-libraries/chunked-forest/sequenceChunk.ts +1 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +4 -1
- package/src/feature-libraries/default-schema/defaultSchema.ts +1 -0
- package/src/feature-libraries/default-schema/schemaChecker.ts +4 -1
- package/src/feature-libraries/index.ts +13 -0
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +34 -5
- package/src/feature-libraries/modular-schema/discrepancies.ts +76 -38
- package/src/feature-libraries/modular-schema/index.ts +13 -0
- package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
- package/src/feature-libraries/sequence-field/types.ts +0 -1
- package/src/index.ts +1 -29
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +1 -0
- package/src/shared-tree/schematizeTree.ts +6 -10
- package/src/shared-tree/schematizingTreeView.ts +11 -21
- package/src/shared-tree/sharedTree.ts +173 -41
- package/src/shared-tree/treeCheckout.ts +224 -175
- package/src/shared-tree-core/branch.ts +29 -122
- package/src/shared-tree-core/branchCommitEnricher.ts +19 -20
- package/src/shared-tree-core/editManager.ts +3 -8
- package/src/shared-tree-core/index.ts +2 -1
- package/src/shared-tree-core/sharedTreeCore.ts +8 -19
- package/src/shared-tree-core/transaction.ts +145 -0
- package/src/simple-tree/api/conciseTree.ts +2 -2
- package/src/simple-tree/api/create.ts +5 -1
- package/src/simple-tree/api/customTree.ts +69 -1
- package/src/simple-tree/api/index.ts +12 -2
- package/src/simple-tree/api/schemaFactory.ts +62 -1
- package/src/simple-tree/api/simpleSchema.ts +3 -1
- package/src/simple-tree/api/simpleTreeIndex.ts +2 -0
- package/src/simple-tree/api/storedSchema.ts +7 -22
- package/src/simple-tree/api/tree.ts +6 -0
- package/src/simple-tree/api/verboseTree.ts +2 -2
- package/src/simple-tree/api/view.ts +197 -51
- package/src/simple-tree/index.ts +6 -0
- package/src/simple-tree/leafNodeSchema.ts +0 -19
- package/src/simple-tree/objectNode.ts +26 -2
- package/src/simple-tree/objectNodeTypes.ts +5 -0
- package/src/simple-tree/schemaTypes.ts +7 -2
- package/src/simple-tree/toStoredSchema.ts +25 -19
- package/src/util/brand.ts +0 -2
- package/src/util/index.ts +1 -0
- package/src/util/typeCheck.ts +0 -2
- package/src/util/utils.ts +26 -0
- package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/chunk.js.map +0 -1
- package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/chunk.js.map +0 -1
|
@@ -68,27 +68,8 @@ function makeLeaf<Name extends string, const T extends ValueSchema>(
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// Leaf schema shared between all SchemaFactory instances.
|
|
71
|
-
/**
|
|
72
|
-
* @internal
|
|
73
|
-
*/
|
|
74
71
|
export const stringSchema = makeLeaf("string", ValueSchema.String);
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @internal
|
|
78
|
-
*/
|
|
79
72
|
export const numberSchema = makeLeaf("number", ValueSchema.Number);
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @internal
|
|
83
|
-
*/
|
|
84
73
|
export const booleanSchema = makeLeaf("boolean", ValueSchema.Boolean);
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* @internal
|
|
88
|
-
*/
|
|
89
74
|
export const nullSchema = makeLeaf("null", ValueSchema.Null);
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @internal
|
|
93
|
-
*/
|
|
94
75
|
export const handleSchema = makeLeaf("handle", ValueSchema.FluidHandle);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { assert, Lazy } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
|
|
9
|
-
import type { FieldKey } from "../core/index.js";
|
|
9
|
+
import type { FieldKey, SchemaPolicy } from "../core/index.js";
|
|
10
10
|
import {
|
|
11
11
|
FieldKinds,
|
|
12
12
|
type FlexTreeField,
|
|
@@ -42,7 +42,11 @@ import {
|
|
|
42
42
|
} from "./core/index.js";
|
|
43
43
|
import { mapTreeFromNodeData, type InsertableContent } from "./toMapTree.js";
|
|
44
44
|
import { type RestrictiveStringRecord, fail, type FlattenKeys } from "../util/index.js";
|
|
45
|
-
import
|
|
45
|
+
import {
|
|
46
|
+
isObjectNodeSchema,
|
|
47
|
+
type ObjectNodeSchema,
|
|
48
|
+
type ObjectNodeSchemaInternalData,
|
|
49
|
+
} from "./objectNodeTypes.js";
|
|
46
50
|
import { TreeNodeValid, type MostDerivedData } from "./treeNodeValid.js";
|
|
47
51
|
import { getUnhydratedContext } from "./createContext.js";
|
|
48
52
|
|
|
@@ -330,6 +334,7 @@ export function objectSchema<
|
|
|
330
334
|
identifier: TName,
|
|
331
335
|
info: T,
|
|
332
336
|
implicitlyConstructable: ImplicitlyConstructable,
|
|
337
|
+
allowUnknownOptionalFields: boolean,
|
|
333
338
|
): ObjectNodeSchema<TName, T, ImplicitlyConstructable> & ObjectNodeSchemaInternalData {
|
|
334
339
|
// Ensure no collisions between final set of property keys, and final set of stored keys (including those
|
|
335
340
|
// implicitly derived from property keys)
|
|
@@ -368,6 +373,7 @@ export function objectSchema<
|
|
|
368
373
|
]),
|
|
369
374
|
);
|
|
370
375
|
public static readonly identifierFieldKeys: readonly FieldKey[] = identifierFieldKeys;
|
|
376
|
+
public static readonly allowUnknownOptionalFields: boolean = allowUnknownOptionalFields;
|
|
371
377
|
|
|
372
378
|
public static override prepareInstance<T2>(
|
|
373
379
|
this: typeof TreeNodeValid<T2>,
|
|
@@ -509,3 +515,21 @@ function assertUniqueKeys<
|
|
|
509
515
|
derivedStoredKeys.add(storedKey);
|
|
510
516
|
}
|
|
511
517
|
}
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Creates a policy for allowing unknown optional fields on an object node which delegates to the policy defined
|
|
521
|
+
* on the object node's internal schema data.
|
|
522
|
+
*/
|
|
523
|
+
export function createUnknownOptionalFieldPolicy(
|
|
524
|
+
schema: ImplicitFieldSchema,
|
|
525
|
+
): SchemaPolicy["allowUnknownOptionalFields"] {
|
|
526
|
+
const context = getUnhydratedContext(schema);
|
|
527
|
+
return (identifier) => {
|
|
528
|
+
const storedSchema = context.schema.get(identifier);
|
|
529
|
+
return (
|
|
530
|
+
storedSchema !== undefined &&
|
|
531
|
+
isObjectNodeSchema(storedSchema) &&
|
|
532
|
+
storedSchema.allowUnknownOptionalFields
|
|
533
|
+
);
|
|
534
|
+
};
|
|
535
|
+
}
|
|
@@ -55,6 +55,11 @@ export interface ObjectNodeSchemaInternalData {
|
|
|
55
55
|
* Stored keys which hold identifiers.
|
|
56
56
|
*/
|
|
57
57
|
readonly identifierFieldKeys: readonly FieldKey[];
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Whether to tolerate (and preserve) additional unknown optional fields in instances of this object node.
|
|
61
|
+
*/
|
|
62
|
+
readonly allowUnknownOptionalFields: boolean;
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
export const ObjectNodeSchema = {
|
|
@@ -24,6 +24,7 @@ import type {
|
|
|
24
24
|
TreeNodeSchemaClass,
|
|
25
25
|
TreeNode,
|
|
26
26
|
TreeNodeSchemaCore,
|
|
27
|
+
TreeNodeSchemaNonClass,
|
|
27
28
|
} from "./core/index.js";
|
|
28
29
|
import type { FieldKey } from "../core/index.js";
|
|
29
30
|
import type { InsertableContent } from "./toMapTree.js";
|
|
@@ -759,15 +760,19 @@ export type InsertableTreeNodeFromAllowedTypes<TList extends AllowedTypes> =
|
|
|
759
760
|
|
|
760
761
|
/**
|
|
761
762
|
* Takes in `TreeNodeSchema[]` and returns a TypedNode union.
|
|
763
|
+
* @privateRemarks
|
|
764
|
+
* If a schema is both TreeNodeSchemaClass and TreeNodeSchemaNonClass, prefer TreeNodeSchemaClass since that includes subclasses properly.
|
|
762
765
|
* @public
|
|
763
766
|
*/
|
|
764
|
-
export type NodeFromSchema<T extends TreeNodeSchema> = T extends
|
|
767
|
+
export type NodeFromSchema<T extends TreeNodeSchema> = T extends TreeNodeSchemaClass<
|
|
765
768
|
string,
|
|
766
769
|
NodeKind,
|
|
767
770
|
infer TNode
|
|
768
771
|
>
|
|
769
772
|
? TNode
|
|
770
|
-
:
|
|
773
|
+
: T extends TreeNodeSchemaNonClass<string, NodeKind, infer TNode>
|
|
774
|
+
? TNode
|
|
775
|
+
: never;
|
|
771
776
|
|
|
772
777
|
/**
|
|
773
778
|
* Data which can be used as a node to be inserted.
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
type TreeTypeSet,
|
|
21
21
|
} from "../core/index.js";
|
|
22
22
|
import { FieldKinds, type FlexFieldKind } from "../feature-libraries/index.js";
|
|
23
|
-
import { brand, fail, isReadonlyArray } from "../util/index.js";
|
|
23
|
+
import { brand, fail, getOrCreate, isReadonlyArray } from "../util/index.js";
|
|
24
24
|
import { NodeKind, type TreeNodeSchema } from "./core/index.js";
|
|
25
25
|
import {
|
|
26
26
|
FieldKind,
|
|
@@ -33,29 +33,35 @@ import { LeafNodeSchema } from "./leafNodeSchema.js";
|
|
|
33
33
|
import { isObjectNodeSchema } from "./objectNodeTypes.js";
|
|
34
34
|
import { normalizeFlexListEager } from "./flexList.js";
|
|
35
35
|
|
|
36
|
+
const viewToStoredCache = new WeakMap<ImplicitFieldSchema, TreeStoredSchema>();
|
|
37
|
+
|
|
36
38
|
/**
|
|
37
39
|
* Converts a {@link ImplicitFieldSchema} into a {@link TreeStoredSchema}.
|
|
38
40
|
*/
|
|
39
41
|
export function toStoredSchema(root: ImplicitFieldSchema): TreeStoredSchema {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
schema.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
return getOrCreate(viewToStoredCache, root, () => {
|
|
43
|
+
const nodeSchema: Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema> = new Map();
|
|
44
|
+
walkFieldSchema(root, {
|
|
45
|
+
node(schema) {
|
|
46
|
+
if (nodeSchema.has(brand(schema.identifier))) {
|
|
47
|
+
// Use JSON.stringify to quote and escape identifier string.
|
|
48
|
+
throw new UsageError(
|
|
49
|
+
`Multiple schema encountered with the identifier ${JSON.stringify(
|
|
50
|
+
schema.identifier,
|
|
51
|
+
)}. Remove or rename them to avoid the collision.`,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
nodeSchema.set(brand(schema.identifier), getStoredSchema(schema));
|
|
55
|
+
},
|
|
56
|
+
});
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
const result: TreeStoredSchema = {
|
|
59
|
+
nodeSchema,
|
|
60
|
+
rootFieldSchema: convertField(root),
|
|
61
|
+
};
|
|
62
|
+
viewToStoredCache.set(root, result);
|
|
63
|
+
return result;
|
|
64
|
+
});
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
/**
|
package/src/util/brand.ts
CHANGED
|
@@ -18,7 +18,6 @@ import type { Covariant } from "./typeCheck.js";
|
|
|
18
18
|
* `Type 'Name1' is not assignable to type 'Name2'.`
|
|
19
19
|
*
|
|
20
20
|
* These branded types are not opaque: A `Brand<A, B>` can still be used as a `B`.
|
|
21
|
-
* @internal
|
|
22
21
|
*/
|
|
23
22
|
export type Brand<ValueType, Name> = ValueType & BrandedType<ValueType, Name>;
|
|
24
23
|
|
|
@@ -42,7 +41,6 @@ export type Brand<ValueType, Name> = ValueType & BrandedType<ValueType, Name>;
|
|
|
42
41
|
* - get nominal typing (so types produced without using this class can never be assignable to it).
|
|
43
42
|
*
|
|
44
43
|
* @sealed
|
|
45
|
-
* @internal
|
|
46
44
|
*/
|
|
47
45
|
export abstract class BrandedType<out ValueType, Name> {
|
|
48
46
|
protected _typeCheck?: Covariant<ValueType>;
|
package/src/util/index.ts
CHANGED
package/src/util/typeCheck.ts
CHANGED
package/src/util/utils.ts
CHANGED
|
@@ -537,3 +537,29 @@ export function capitalize<S extends string>(s: S): Capitalize<S> {
|
|
|
537
537
|
export function compareStrings<T extends string>(a: T, b: T): number {
|
|
538
538
|
return a > b ? 1 : a === b ? 0 : -1;
|
|
539
539
|
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Defines a property on an object that is lazily initialized and cached.
|
|
543
|
+
* @remarks This is useful for properties that are expensive to compute and it is not guaranteed that they will be accessed.
|
|
544
|
+
* This function initially defines a getter on the object, but after first read it replaces the getter with a value property.
|
|
545
|
+
* @param obj - The object on which to define the property.
|
|
546
|
+
* @param key - The key of the property to define.
|
|
547
|
+
* @param get - The function (called either once or not at all) to compute the value of the property.
|
|
548
|
+
* @returns `obj`, typed such that it has the new property.
|
|
549
|
+
* This allows for the new property to be read off of `obj` in a type-safe manner after calling this function.
|
|
550
|
+
*/
|
|
551
|
+
export function defineLazyCachedProperty<
|
|
552
|
+
T extends object,
|
|
553
|
+
K extends string | number | symbol,
|
|
554
|
+
V,
|
|
555
|
+
>(obj: T, key: K, get: () => V): typeof obj & { [P in K]: V } {
|
|
556
|
+
Reflect.defineProperty(obj, key, {
|
|
557
|
+
get() {
|
|
558
|
+
const value = get();
|
|
559
|
+
Reflect.defineProperty(obj, key, { value });
|
|
560
|
+
return value;
|
|
561
|
+
},
|
|
562
|
+
configurable: true,
|
|
563
|
+
});
|
|
564
|
+
return obj as typeof obj & { [P in K]: V };
|
|
565
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/chunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEN,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAE3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAClD;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAEhC;;;;;;;;;;OAUG;IACH,MAAM,IAAI,aAAa,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,QAAuB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,OAAO,MAA8B,CAAC;AAEhE;;GAEG;AACH,UAAU,SAAS;IAClB;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAC/C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAMtE;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,sBAAsB,EAAE,SAAS;IACvE;;;;OAIG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;;OAGG;IACH,IAAI,IAAI,aAAa,CAAC;CACtB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk.js","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/chunk.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,kDAM6B;AA8B7B;;;;GAIG;AACU,QAAA,SAAS,GAAa,uBAAY,CAAC;AAEhD;;GAEG;AACU,QAAA,WAAW,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC;AA2BhE;;GAEG;AACH,SAAgB,WAAW,CAAC,MAAmB;IAC9C,IAAA,iBAAM,EACL,MAAM,CAAC,IAAI,qCAA6B,EACxC,KAAK,CAAC,+CAA+C,CACrD,CAAC;IACF,OAAQ,MAAoB,CAAC,mBAAW,CAAC,CAAC;AAC3C,CAAC;AAND,kCAMC","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\";\n\nimport {\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype ITreeCursorSynchronous,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport type { ReferenceCounted } from \"../../util/index.js\";\n\n/**\n * Contiguous part of the tree which get stored together in some data format.\n * Copy-on-write, but optimized to be mutated in place when a chunk only has a single user (detected using reference counting).\n * This allows for efficient cloning without major performance overheads for non-cloning scenarios.\n */\nexport interface TreeChunk extends ReferenceCounted {\n\t/**\n\t * The number of nodes at the top level of this chunk.\n\t *\n\t * If this chunk is included in a field, this is the amount this chunk contributes to the length of the field.\n\t */\n\treadonly topLevelLength: number;\n\n\t/**\n\t * Creates a cursor for navigating the content of this chunk.\n\t *\n\t * Starts in \"fields\" mode in a `dummyRoot` field containing the top level nodes.\n\t *\n\t * This cursor does not own a reference to the data:\n\t * it is up to the caller of this function to ensure the cursor is not used after they release their owning ref to this chunk.\n\t *\n\t * TODO: consider starting this in \"fields\" mode above the top level\n\t * which would compose better with utilities for processing sequences of nodes.\n\t */\n\tcursor(): ChunkedCursor;\n}\n\n/**\n * The key used for the field that contains the root of chunks when not parented anywhere.\n *\n * For now this is using the document root key to ease testing/compatibility, but this may change.\n */\nexport const dummyRoot: FieldKey = rootFieldKey;\n\n/**\n * A symbol for extracting a TreeChunk from {@link ITreeCursor}.\n */\nexport const cursorChunk: unique symbol = Symbol(\"cursorChunk\");\n\n/**\n * Cursors can optionally implement this interface, allowing querying them for the chunk they are traversing.\n */\ninterface WithChunk {\n\t/**\n\t * When in nodes mode, if a value is returned, it is a TreeChunk who's top level nodes are the\n\t * chunkLength nodes starting from chunkStart.\n\t *\n\t *\n\t * @remarks\n\t * Note that there may be other tree representations with different chunk APIs and thus different ways to query them.\n\t * The chunkStart and chunkLength values thus to not uniquely apply to the chunks accessed through this field.\n\t *\n\t * TODO:\n\t * This API (including the chunk start and end on ITreeCUrsor) have some issues:\n\t * 1. There are cases where multiple possible chunks could be considered.\n\t * For example, when in a SequenceChunk, it could be returned, or the chunk within it could be.\n\t * 2. When in a location other than the root of a chunk,\n\t * it can't provide information about the containing chunk other than by allocating a new chunk that just represents that field.\n\t *\n\t * As more optimizations get implemented, this API may need to change to better address these issues.\n\t */\n\treadonly [cursorChunk]?: TreeChunk | undefined;\n}\n\n/**\n * See {@link WithChunk}.\n */\nexport function tryGetChunk(cursor: ITreeCursor): undefined | TreeChunk {\n\tassert(\n\t\tcursor.mode === CursorLocationType.Nodes,\n\t\t0x57b /* cursorChunk only accessible in nodes mode */,\n\t);\n\treturn (cursor as WithChunk)[cursorChunk];\n}\n\n/**\n * Cursor for a chunk which can be wrapped by another cursor.\n *\n * @remarks See `BasicChunkCursor` which uses this.\n */\nexport interface ChunkedCursor extends ITreeCursorSynchronous, WithChunk {\n\t/**\n\t * Checks if the cursor is in the top level nodes of the chunk.\n\t *\n\t * @returns true iff cursor is within the root field, including at a node within that field.\n\t */\n\tatChunkRoot(): boolean;\n\n\t/**\n\t * Clones the cursor to produce a new independent cursor.\n\t * Does not add any counted references to any chunks.\n\t */\n\tfork(): ChunkedCursor;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/chunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEN,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAE3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IAClD;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAEhC;;;;;;;;;;OAUG;IACH,MAAM,IAAI,aAAa,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,QAAuB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,OAAO,MAA8B,CAAC;AAEhE;;GAEG;AACH,UAAU,SAAS;IAClB;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAC/C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAMtE;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,sBAAsB,EAAE,SAAS;IACvE;;;;OAIG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;;OAGG;IACH,IAAI,IAAI,aAAa,CAAC;CACtB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunk.js","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/chunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAKN,YAAY,GACZ,MAAM,qBAAqB,CAAC;AA8B7B;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAa,YAAY,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC;AA2BhE;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAAmB;IAC9C,MAAM,CACL,MAAM,CAAC,IAAI,qCAA6B,EACxC,KAAK,CAAC,+CAA+C,CACrD,CAAC;IACF,OAAQ,MAAoB,CAAC,WAAW,CAAC,CAAC;AAC3C,CAAC","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\";\n\nimport {\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype ITreeCursor,\n\ttype ITreeCursorSynchronous,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport type { ReferenceCounted } from \"../../util/index.js\";\n\n/**\n * Contiguous part of the tree which get stored together in some data format.\n * Copy-on-write, but optimized to be mutated in place when a chunk only has a single user (detected using reference counting).\n * This allows for efficient cloning without major performance overheads for non-cloning scenarios.\n */\nexport interface TreeChunk extends ReferenceCounted {\n\t/**\n\t * The number of nodes at the top level of this chunk.\n\t *\n\t * If this chunk is included in a field, this is the amount this chunk contributes to the length of the field.\n\t */\n\treadonly topLevelLength: number;\n\n\t/**\n\t * Creates a cursor for navigating the content of this chunk.\n\t *\n\t * Starts in \"fields\" mode in a `dummyRoot` field containing the top level nodes.\n\t *\n\t * This cursor does not own a reference to the data:\n\t * it is up to the caller of this function to ensure the cursor is not used after they release their owning ref to this chunk.\n\t *\n\t * TODO: consider starting this in \"fields\" mode above the top level\n\t * which would compose better with utilities for processing sequences of nodes.\n\t */\n\tcursor(): ChunkedCursor;\n}\n\n/**\n * The key used for the field that contains the root of chunks when not parented anywhere.\n *\n * For now this is using the document root key to ease testing/compatibility, but this may change.\n */\nexport const dummyRoot: FieldKey = rootFieldKey;\n\n/**\n * A symbol for extracting a TreeChunk from {@link ITreeCursor}.\n */\nexport const cursorChunk: unique symbol = Symbol(\"cursorChunk\");\n\n/**\n * Cursors can optionally implement this interface, allowing querying them for the chunk they are traversing.\n */\ninterface WithChunk {\n\t/**\n\t * When in nodes mode, if a value is returned, it is a TreeChunk who's top level nodes are the\n\t * chunkLength nodes starting from chunkStart.\n\t *\n\t *\n\t * @remarks\n\t * Note that there may be other tree representations with different chunk APIs and thus different ways to query them.\n\t * The chunkStart and chunkLength values thus to not uniquely apply to the chunks accessed through this field.\n\t *\n\t * TODO:\n\t * This API (including the chunk start and end on ITreeCUrsor) have some issues:\n\t * 1. There are cases where multiple possible chunks could be considered.\n\t * For example, when in a SequenceChunk, it could be returned, or the chunk within it could be.\n\t * 2. When in a location other than the root of a chunk,\n\t * it can't provide information about the containing chunk other than by allocating a new chunk that just represents that field.\n\t *\n\t * As more optimizations get implemented, this API may need to change to better address these issues.\n\t */\n\treadonly [cursorChunk]?: TreeChunk | undefined;\n}\n\n/**\n * See {@link WithChunk}.\n */\nexport function tryGetChunk(cursor: ITreeCursor): undefined | TreeChunk {\n\tassert(\n\t\tcursor.mode === CursorLocationType.Nodes,\n\t\t0x57b /* cursorChunk only accessible in nodes mode */,\n\t);\n\treturn (cursor as WithChunk)[cursorChunk];\n}\n\n/**\n * Cursor for a chunk which can be wrapped by another cursor.\n *\n * @remarks See `BasicChunkCursor` which uses this.\n */\nexport interface ChunkedCursor extends ITreeCursorSynchronous, WithChunk {\n\t/**\n\t * Checks if the cursor is in the top level nodes of the chunk.\n\t *\n\t * @returns true iff cursor is within the root field, including at a node within that field.\n\t */\n\tatChunkRoot(): boolean;\n\n\t/**\n\t * Clones the cursor to produce a new independent cursor.\n\t * Does not add any counted references to any chunks.\n\t */\n\tfork(): ChunkedCursor;\n}\n"]}
|