@fluidframework/tree 2.11.0 → 2.13.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 +140 -0
- package/api-report/tree.alpha.api.md +88 -12
- package/api-report/tree.beta.api.md +23 -11
- package/api-report/tree.legacy.alpha.api.md +23 -11
- package/api-report/tree.legacy.public.api.md +23 -11
- package/api-report/tree.public.api.md +23 -11
- package/dist/alpha.d.ts +11 -0
- package/dist/beta.d.ts +2 -0
- 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/defaultEditBuilder.d.ts +10 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.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 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +6 -4
- 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/crossFieldQueries.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +8 -2
- package/dist/feature-libraries/modular-schema/crossFieldQueries.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/fieldChangeHandler.d.ts +12 -5
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +2 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
- 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/modular-schema/modularChangeFamily.d.ts +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +89 -25
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +12 -0
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +24 -4
- package/dist/feature-libraries/optional-field/optionalField.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/feature-libraries/sequence-field/utils.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +14 -5
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -14
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +2 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +2 -0
- package/dist/shared-tree/index.d.ts +3 -2
- 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 +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 +10 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +51 -12
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +31 -10
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +106 -15
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/transactionTypes.d.ts +105 -0
- package/dist/shared-tree/transactionTypes.d.ts.map +1 -0
- package/dist/shared-tree/transactionTypes.js +13 -0
- package/dist/shared-tree/transactionTypes.js.map +1 -0
- package/dist/shared-tree/treeApi.d.ts +1 -25
- package/dist/shared-tree/treeApi.d.ts.map +1 -1
- package/dist/shared-tree/treeApi.js +4 -8
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +39 -13
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +275 -128
- 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 +3 -2
- 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/jsonSchema.d.ts +6 -0
- package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/jsonSchema.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +65 -8
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +10 -4
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js +90 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
- package/dist/simple-tree/api/simpleSchema.d.ts +8 -2
- 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/simpleSchemaToJsonSchema.js +13 -10
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.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/testRecursiveDomain.d.ts +5 -5
- package/dist/simple-tree/api/tree.d.ts +61 -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/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +11 -11
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +2 -2
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +2 -1
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +10 -6
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +3 -3
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +6 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +5 -20
- 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/mapNode.d.ts +2 -2
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +2 -1
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +9 -4
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +19 -2
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +6 -2
- 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 +51 -3
- 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 +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +4 -5
- package/dist/util/index.js.map +1 -1
- package/dist/util/rangeMap.d.ts +72 -42
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +161 -151
- package/dist/util/rangeMap.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 +35 -1
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +32 -1
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +11 -0
- package/lib/beta.d.ts +2 -0
- 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/defaultEditBuilder.d.ts +10 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
- package/lib/feature-libraries/default-schema/defaultEditBuilder.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 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -2
- 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/crossFieldQueries.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +9 -3
- package/lib/feature-libraries/modular-schema/crossFieldQueries.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/fieldChangeHandler.d.ts +12 -5
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +2 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
- 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/modular-schema/modularChangeFamily.d.ts +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +89 -25
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +12 -0
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +24 -4
- package/lib/feature-libraries/optional-field/optionalField.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/feature-libraries/sequence-field/utils.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +14 -5
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/index.d.ts +4 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -4
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +2 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +2 -0
- package/lib/shared-tree/index.d.ts +3 -2
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +2 -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 +10 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +56 -17
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +31 -10
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +107 -16
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/transactionTypes.d.ts +105 -0
- package/lib/shared-tree/transactionTypes.d.ts.map +1 -0
- package/lib/shared-tree/transactionTypes.js +10 -0
- package/lib/shared-tree/transactionTypes.js.map +1 -0
- package/lib/shared-tree/treeApi.d.ts +1 -25
- package/lib/shared-tree/treeApi.d.ts.map +1 -1
- package/lib/shared-tree/treeApi.js +1 -5
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +39 -13
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +277 -130
- 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 +3 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +3 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/jsonSchema.d.ts +6 -0
- package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/jsonSchema.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +65 -8
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +9 -3
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.js +86 -0
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
- package/lib/simple-tree/api/simpleSchema.d.ts +8 -2
- 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/simpleSchemaToJsonSchema.js +14 -11
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.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/testRecursiveDomain.d.ts +5 -5
- package/lib/simple-tree/api/tree.d.ts +61 -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/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +12 -12
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +2 -2
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +2 -1
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +10 -6
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +3 -3
- 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 +5 -20
- 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/mapNode.d.ts +2 -2
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +2 -1
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +9 -4
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +17 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +6 -2
- 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 +51 -3
- 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 +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/rangeMap.d.ts +72 -42
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +159 -146
- package/lib/util/rangeMap.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 +35 -1
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +29 -0
- package/lib/util/utils.js.map +1 -1
- package/package.json +23 -23
- 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/defaultEditBuilder.ts +14 -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 -1
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +34 -5
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +9 -9
- package/src/feature-libraries/modular-schema/discrepancies.ts +76 -38
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +13 -9
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +4 -2
- package/src/feature-libraries/modular-schema/index.ts +14 -0
- package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +124 -31
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +12 -0
- package/src/feature-libraries/optional-field/optionalField.ts +34 -5
- package/src/feature-libraries/sequence-field/types.ts +0 -1
- package/src/feature-libraries/sequence-field/utils.ts +18 -7
- package/src/index.ts +12 -29
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +13 -2
- package/src/shared-tree/schematizeTree.ts +6 -10
- package/src/shared-tree/schematizingTreeView.ts +102 -23
- package/src/shared-tree/sharedTree.ts +181 -44
- package/src/shared-tree/transactionTypes.ts +125 -0
- package/src/shared-tree/treeApi.ts +1 -28
- package/src/shared-tree/treeCheckout.ts +358 -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 +13 -2
- package/src/simple-tree/api/jsonSchema.ts +7 -0
- package/src/simple-tree/api/schemaFactory.ts +91 -3
- package/src/simple-tree/api/schemaFactoryAlpha.ts +253 -0
- package/src/simple-tree/api/simpleSchema.ts +9 -2
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +22 -12
- 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 +78 -0
- package/src/simple-tree/api/verboseTree.ts +2 -2
- package/src/simple-tree/api/view.ts +197 -51
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +19 -13
- package/src/simple-tree/arrayNode.ts +7 -1
- package/src/simple-tree/core/treeNodeSchema.ts +51 -7
- package/src/simple-tree/index.ts +9 -0
- package/src/simple-tree/leafNodeSchema.ts +0 -19
- package/src/simple-tree/mapNode.ts +7 -1
- package/src/simple-tree/objectNode.ts +33 -3
- package/src/simple-tree/objectNodeTypes.ts +9 -1
- package/src/simple-tree/schemaTypes.ts +57 -3
- package/src/simple-tree/toStoredSchema.ts +25 -19
- package/src/util/brand.ts +0 -2
- package/src/util/index.ts +3 -6
- package/src/util/rangeMap.ts +199 -189
- package/src/util/typeCheck.ts +0 -2
- package/src/util/utils.ts +73 -1
- package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/chunk.js.map +0 -1
- package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
- package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
- package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -74
- package/dist/feature-libraries/memoizedIdRangeAllocator.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
- package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
- package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
- package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -71
- package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +0 -1
- package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -112
package/lib/util/rangeMap.js
CHANGED
|
@@ -4,164 +4,177 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { oob } from "@fluidframework/core-utils/internal";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* RangeMap represents a mapping from integers to values of type T or undefined.
|
|
8
|
+
* The values for a range of consecutive keys can be changed or queried in a single operation.
|
|
8
9
|
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
export class RangeMap {
|
|
11
|
+
constructor(initialEntries) {
|
|
12
|
+
this.entries = initialEntries ? [...initialEntries] : [];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Retrieves all entries from the rangeMap.
|
|
16
|
+
* @returns An array of RangeEntryResult objects, each containing the start index, length, and value of a contiguous range.
|
|
17
|
+
*/
|
|
18
|
+
getAllEntries() {
|
|
19
|
+
return this.entries;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves the value for some prefix of the query range.
|
|
23
|
+
*
|
|
24
|
+
* @param start - The first key in the query range.
|
|
25
|
+
* @param length - The length of the query range.
|
|
26
|
+
* @returns A RangeQueryResult containing the value associated with `start`,
|
|
27
|
+
* and the number of consecutive keys with that same value.
|
|
28
|
+
*/
|
|
29
|
+
get(start, length) {
|
|
30
|
+
for (const entry of this.entries) {
|
|
31
|
+
if (entry.start > start) {
|
|
32
|
+
return { value: undefined, length: Math.min(entry.start - start, length) };
|
|
33
|
+
}
|
|
34
|
+
const lastRangeKey = entry.start + entry.length - 1;
|
|
35
|
+
if (lastRangeKey >= start) {
|
|
36
|
+
const overlapLength = lastRangeKey - start + 1;
|
|
37
|
+
return { value: entry.value, length: Math.min(overlapLength, length) };
|
|
38
|
+
}
|
|
19
39
|
}
|
|
40
|
+
// There were no entries intersecting the query range, so the entire query range has undefined value.
|
|
41
|
+
return { value: undefined, length };
|
|
20
42
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Sets the value for a specified range.
|
|
45
|
+
*
|
|
46
|
+
* @param start - The first key in the range being set.
|
|
47
|
+
* @param length - The length of the range.
|
|
48
|
+
* @param value - The value to associate with the range.
|
|
49
|
+
*/
|
|
50
|
+
set(start, length, value) {
|
|
51
|
+
if (value === undefined) {
|
|
52
|
+
this.delete(start, length);
|
|
53
|
+
return;
|
|
30
54
|
}
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
55
|
+
const end = start + length - 1;
|
|
56
|
+
const newEntry = { start, length, value };
|
|
57
|
+
let iBefore = -1;
|
|
58
|
+
let iAfter = this.entries.length;
|
|
59
|
+
for (const [i, entry] of this.entries.entries()) {
|
|
60
|
+
const entryLastKey = entry.start + entry.length - 1;
|
|
61
|
+
if (entryLastKey < start) {
|
|
62
|
+
iBefore = i;
|
|
63
|
+
}
|
|
64
|
+
else if (entry.start > end) {
|
|
65
|
+
iAfter = i;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
34
68
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
* Sets the keys from `start` to `start + length - 1` to `value`.
|
|
40
|
-
*/
|
|
41
|
-
export function setInRangeMap(map, start, length, value) {
|
|
42
|
-
const end = start + length - 1;
|
|
43
|
-
const newEntry = { start, length, value };
|
|
44
|
-
let iBefore = -1;
|
|
45
|
-
let iAfter = map.length;
|
|
46
|
-
for (const [i, entry] of map.entries()) {
|
|
47
|
-
const entryLastKey = entry.start + entry.length - 1;
|
|
48
|
-
if (entryLastKey < start) {
|
|
49
|
-
iBefore = i;
|
|
69
|
+
const numOverlappingEntries = iAfter - iBefore - 1;
|
|
70
|
+
if (numOverlappingEntries === 0) {
|
|
71
|
+
this.entries.splice(iAfter, 0, newEntry);
|
|
72
|
+
return;
|
|
50
73
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
74
|
+
const iFirst = iBefore + 1;
|
|
75
|
+
const firstEntry = this.entries[iFirst] ?? oob();
|
|
76
|
+
const iLast = iAfter - 1;
|
|
77
|
+
const lastEntry = this.entries[iLast] ?? oob();
|
|
78
|
+
const lengthBeforeFirst = start - firstEntry.start;
|
|
79
|
+
const lastEntryKey = lastEntry.start + lastEntry.length - 1;
|
|
80
|
+
const lengthAfterLast = lastEntryKey - end;
|
|
81
|
+
if (lengthBeforeFirst > 0 && lengthAfterLast > 0 && iFirst === iLast) {
|
|
82
|
+
// The new entry fits in the middle of an existing entry.
|
|
83
|
+
// We replace the existing entry with:
|
|
84
|
+
// 1) the portion which comes before `newEntry`
|
|
85
|
+
// 2) `newEntry`
|
|
86
|
+
// 3) the portion which comes after `newEntry`
|
|
87
|
+
this.entries.splice(iFirst, 1, { ...firstEntry, length: lengthBeforeFirst }, newEntry, {
|
|
88
|
+
...lastEntry,
|
|
89
|
+
start: end + 1,
|
|
90
|
+
length: lengthAfterLast,
|
|
91
|
+
});
|
|
92
|
+
return;
|
|
54
93
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const iFirst = iBefore + 1;
|
|
62
|
-
const firstEntry = map[iFirst] ?? oob();
|
|
63
|
-
const iLast = iAfter - 1;
|
|
64
|
-
const lastEntry = map[iLast] ?? oob();
|
|
65
|
-
const lengthBeforeFirst = start - firstEntry.start;
|
|
66
|
-
const lastEntryKey = lastEntry.start + lastEntry.length - 1;
|
|
67
|
-
const lengthAfterLast = lastEntryKey - end;
|
|
68
|
-
if (lengthBeforeFirst > 0 && lengthAfterLast > 0 && iFirst === iLast) {
|
|
69
|
-
// The new entry fits in the middle of an existing entry.
|
|
70
|
-
// We replace the existing entry with:
|
|
71
|
-
// 1) the portion which comes before `newEntry`
|
|
72
|
-
// 2) `newEntry`
|
|
73
|
-
// 3) the portion which comes after `newEntry`
|
|
74
|
-
map.splice(iFirst, 1, { ...firstEntry, length: lengthBeforeFirst }, newEntry, {
|
|
75
|
-
...lastEntry,
|
|
76
|
-
start: end + 1,
|
|
77
|
-
length: lengthAfterLast,
|
|
78
|
-
});
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (lengthBeforeFirst > 0) {
|
|
82
|
-
map[iFirst] = { ...firstEntry, length: lengthBeforeFirst };
|
|
83
|
-
// The entry at `iFirst` is no longer overlapping with `newEntry`.
|
|
84
|
-
iBefore = iFirst;
|
|
85
|
-
}
|
|
86
|
-
if (lengthAfterLast > 0) {
|
|
87
|
-
map[iLast] = {
|
|
88
|
-
...lastEntry,
|
|
89
|
-
start: end + 1,
|
|
90
|
-
length: lengthAfterLast,
|
|
91
|
-
};
|
|
92
|
-
// The entry at `iLast` is no longer overlapping with `newEntry`.
|
|
93
|
-
iAfter = iLast;
|
|
94
|
-
}
|
|
95
|
-
const numContainedEntries = iAfter - iBefore - 1;
|
|
96
|
-
map.splice(iBefore + 1, numContainedEntries, newEntry);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Delete the keys from `start` to `start + length - 1`
|
|
100
|
-
*
|
|
101
|
-
* 1. If an entry is completely included in the deletion range, the whole entry will be deleted
|
|
102
|
-
* e.g.: map = [[1, 2], [4, 6]], delete range: [3, 6]
|
|
103
|
-
* map becomes [[1, 2]] after deletion
|
|
104
|
-
* (Note: the notation [a, b] represents start = a, end = b for simpler visiualization, instead of `b`
|
|
105
|
-
* representing the length)
|
|
106
|
-
*
|
|
107
|
-
* 2. If an entry is partially overlapped with the deletion range, the start or end point will be shifted
|
|
108
|
-
* e.g.: map = [[1, 2], [4, 6]], delete range: [2, 4]
|
|
109
|
-
* map becomes [[1, 1], [5, 6]] after deletion
|
|
110
|
-
*
|
|
111
|
-
* 3. If an entry completely includes the deletion range, the original entry may be split into two.
|
|
112
|
-
* e.g.: map = [[1, 6]], delete range: [2, 4]
|
|
113
|
-
* map becomes [[1, 1], [5, 6]]
|
|
114
|
-
*
|
|
115
|
-
* TODO: We may find ways to mitigate the code duplication between set and delete, and we need to better
|
|
116
|
-
* document the API. AB#7413
|
|
117
|
-
*/
|
|
118
|
-
export function deleteFromRangeMap(map, start, length) {
|
|
119
|
-
const end = start + length - 1;
|
|
120
|
-
let iBefore = -1;
|
|
121
|
-
let iAfter = map.length;
|
|
122
|
-
for (const [i, entry] of map.entries()) {
|
|
123
|
-
const entryLastKey = entry.start + entry.length - 1;
|
|
124
|
-
if (entryLastKey < start) {
|
|
125
|
-
iBefore = i;
|
|
94
|
+
if (lengthBeforeFirst > 0) {
|
|
95
|
+
this.entries[iFirst] = { ...firstEntry, length: lengthBeforeFirst };
|
|
96
|
+
// The entry at `iFirst` is no longer overlapping with `newEntry`.
|
|
97
|
+
iBefore = iFirst;
|
|
126
98
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
99
|
+
if (lengthAfterLast > 0) {
|
|
100
|
+
this.entries[iLast] = {
|
|
101
|
+
...lastEntry,
|
|
102
|
+
start: end + 1,
|
|
103
|
+
length: lengthAfterLast,
|
|
104
|
+
};
|
|
105
|
+
// The entry at `iLast` is no longer overlapping with `newEntry`.
|
|
106
|
+
iAfter = iLast;
|
|
130
107
|
}
|
|
108
|
+
const numContainedEntries = iAfter - iBefore - 1;
|
|
109
|
+
this.entries.splice(iBefore + 1, numContainedEntries, newEntry);
|
|
131
110
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Deletes values within a specified range, updating or removing existing entries.
|
|
113
|
+
*
|
|
114
|
+
* 1. If an entry is completely included in the deletion range, the whole entry will be deleted
|
|
115
|
+
* e.g.: map = [[1, 2], [4, 6]], delete range: [3, 6]
|
|
116
|
+
* map becomes [[1, 2]] after deletion
|
|
117
|
+
* (Note: the notation [a, b] represents start = a, end = b for simpler visualization, instead of `b`
|
|
118
|
+
* representing the length)
|
|
119
|
+
*
|
|
120
|
+
* 2. If an entry is partially overlapped with the deletion range, the start or end point will be shifted
|
|
121
|
+
* e.g.: map = [[1, 2], [4, 6]], delete range: [2, 4]
|
|
122
|
+
* map becomes [[1, 1], [5, 6]] after deletion
|
|
123
|
+
*
|
|
124
|
+
* 3. If an entry completely includes the deletion range, the original entry may be split into two.
|
|
125
|
+
* e.g.: map = [[1, 6]], delete range: [2, 4]
|
|
126
|
+
* map becomes [[1, 1], [5, 6]]
|
|
127
|
+
*
|
|
128
|
+
* @param start - The start of the range to delete (inclusive).
|
|
129
|
+
* @param length - The length of the range to delete.
|
|
130
|
+
*/
|
|
131
|
+
delete(start, length) {
|
|
132
|
+
const end = start + length - 1;
|
|
133
|
+
let iBefore = -1;
|
|
134
|
+
let iAfter = this.entries.length;
|
|
135
|
+
for (const [i, entry] of this.entries.entries()) {
|
|
136
|
+
const entryLastKey = entry.start + entry.length - 1;
|
|
137
|
+
if (entryLastKey < start) {
|
|
138
|
+
iBefore = i;
|
|
139
|
+
}
|
|
140
|
+
else if (entry.start > end) {
|
|
141
|
+
iAfter = i;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const numOverlappingEntries = iAfter - iBefore - 1;
|
|
146
|
+
if (numOverlappingEntries === 0) {
|
|
147
|
+
// No entry will be removed
|
|
148
|
+
return;
|
|
147
149
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
const iFirst = iBefore + 1;
|
|
151
|
+
const iLast = iAfter - 1;
|
|
152
|
+
for (let i = iFirst; i <= iLast; ++i) {
|
|
153
|
+
const entry = this.entries[i] ?? oob();
|
|
154
|
+
const entryLastKey = entry.start + entry.length - 1;
|
|
155
|
+
let isDirty = false;
|
|
156
|
+
if (entry.start >= start && entryLastKey <= end) {
|
|
157
|
+
// If the entry lies within the range to be deleted, remove it
|
|
158
|
+
this.entries.splice(i, 1);
|
|
155
159
|
}
|
|
156
|
-
|
|
157
|
-
//
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
else {
|
|
161
|
+
// If the entry partially or completely overlaps with the range to be deleted
|
|
162
|
+
if (entry.start < start) {
|
|
163
|
+
// Update the endpoint and length of the portion before the range to be deleted
|
|
164
|
+
const lengthBefore = start - entry.start;
|
|
165
|
+
this.entries[i] = { ...entry, length: lengthBefore };
|
|
166
|
+
isDirty = true;
|
|
167
|
+
}
|
|
168
|
+
if (entryLastKey > end) {
|
|
169
|
+
// Update the startpoint and length of the portion after the range to be deleted
|
|
170
|
+
const newStart = end + 1;
|
|
171
|
+
const newLength = entryLastKey - end;
|
|
172
|
+
this.entries.splice(isDirty ? i + 1 : i, isDirty ? 0 : 1, {
|
|
173
|
+
start: newStart,
|
|
174
|
+
length: newLength,
|
|
175
|
+
value: entry.value,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
165
178
|
}
|
|
166
179
|
}
|
|
167
180
|
}
|
package/lib/util/rangeMap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rangeMap.js","sourceRoot":"","sources":["../../src/util/rangeMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAgC1D;;GAEG;AACH,MAAM,UAAU,eAAe,CAC9B,GAAgB,EAChB,KAAa,EACb,MAAc;IAEd,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QACzB,IAAI,KAAK,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC;YACzB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;QAC5E,CAAC;QAED,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QACpD,IAAI,YAAY,IAAI,KAAK,EAAE,CAAC;YAC3B,+BAA+B;YAC/B,MAAM,aAAa,GAAG,YAAY,GAAG,KAAK,GAAG,CAAC,CAAC;YAC/C,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC;QACxE,CAAC;IACF,CAAC;IAED,qGAAqG;IACrG,OAAO,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CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { oob } from \"@fluidframework/core-utils/internal\";\n\n/**\n * A map keyed on integers allowing reading and writing contiguous ranges of integer keys.\n *\n * TODO: We should avoid the direct exposure of RangeEntry. AB#7414\n */\nexport type RangeMap<T> = RangeEntry<T>[];\n\nexport interface RangeEntry<T> {\n\tstart: number;\n\tlength: number;\n\tvalue: T;\n}\n\n/**\n * The result of a query about a range of keys.\n */\nexport interface RangeQueryResult<T> {\n\t/**\n\t * The value of the first key in the query range.\n\t */\n\tvalue: T | undefined;\n\n\t/**\n\t * The length of the prefix of the query range which have the same value.\n\t * For example, if a RangeMap has the same value for keys 5, 6, and 7,\n\t * a query about the range [5, 10] would give a result with length 3.\n\t */\n\tlength: number;\n}\n\n/**\n * See comments on `RangeQueryResult`.\n */\nexport function getFromRangeMap<T>(\n\tmap: RangeMap<T>,\n\tstart: number,\n\tlength: number,\n): RangeQueryResult<T> {\n\tfor (const range of map) {\n\t\tif (range.start > start) {\n\t\t\treturn { value: undefined, length: Math.min(range.start - start, length) };\n\t\t}\n\n\t\tconst lastRangeKey = range.start + range.length - 1;\n\t\tif (lastRangeKey >= start) {\n\t\t\t// This range contains `start`.\n\t\t\tconst overlapLength = lastRangeKey - start + 1;\n\t\t\treturn { value: range.value, length: Math.min(overlapLength, length) };\n\t\t}\n\t}\n\n\t// There were no entries intersecting the query range, so the entire query range has undefined value.\n\treturn { value: undefined, length };\n}\n\nexport function getFirstEntryFromRangeMap<T>(\n\tmap: RangeMap<T>,\n\tstart: number,\n\tlength: number,\n): RangeEntry<T> | undefined {\n\tconst lastQueryKey = start + length - 1;\n\tfor (const range of map) {\n\t\tif (range.start > lastQueryKey) {\n\t\t\t// We've passed the end of the query range.\n\t\t\tbreak;\n\t\t}\n\n\t\tconst lastRangeKey = range.start + range.length - 1;\n\t\tif (lastRangeKey >= start) {\n\t\t\treturn range;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Sets the keys from `start` to `start + length - 1` to `value`.\n */\nexport function setInRangeMap<T>(\n\tmap: RangeMap<T>,\n\tstart: number,\n\tlength: number,\n\tvalue: T,\n): void {\n\tconst end = start + length - 1;\n\tconst newEntry: RangeEntry<T> = { start, length, value };\n\n\tlet iBefore = -1;\n\tlet iAfter = map.length;\n\tfor (const [i, entry] of map.entries()) {\n\t\tconst entryLastKey = entry.start + entry.length - 1;\n\t\tif (entryLastKey < start) {\n\t\t\tiBefore = i;\n\t\t} else if (entry.start > end) {\n\t\t\tiAfter = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst numOverlappingEntries = iAfter - iBefore - 1;\n\tif (numOverlappingEntries === 0) {\n\t\tmap.splice(iAfter, 0, newEntry);\n\t\treturn;\n\t}\n\n\tconst iFirst = iBefore + 1;\n\tconst firstEntry = map[iFirst] ?? oob();\n\tconst iLast = iAfter - 1;\n\tconst lastEntry = map[iLast] ?? oob();\n\tconst lengthBeforeFirst = start - firstEntry.start;\n\tconst lastEntryKey = lastEntry.start + lastEntry.length - 1;\n\tconst lengthAfterLast = lastEntryKey - end;\n\n\tif (lengthBeforeFirst > 0 && lengthAfterLast > 0 && iFirst === iLast) {\n\t\t// The new entry fits in the middle of an existing entry.\n\t\t// We replace the existing entry with:\n\t\t// 1) the portion which comes before `newEntry`\n\t\t// 2) `newEntry`\n\t\t// 3) the portion which comes after `newEntry`\n\t\tmap.splice(iFirst, 1, { ...firstEntry, length: lengthBeforeFirst }, newEntry, {\n\t\t\t...lastEntry,\n\t\t\tstart: end + 1,\n\t\t\tlength: lengthAfterLast,\n\t\t});\n\t\treturn;\n\t}\n\n\tif (lengthBeforeFirst > 0) {\n\t\tmap[iFirst] = { ...firstEntry, length: lengthBeforeFirst };\n\n\t\t// The entry at `iFirst` is no longer overlapping with `newEntry`.\n\t\tiBefore = iFirst;\n\t}\n\n\tif (lengthAfterLast > 0) {\n\t\tmap[iLast] = {\n\t\t\t...lastEntry,\n\t\t\tstart: end + 1,\n\t\t\tlength: lengthAfterLast,\n\t\t};\n\n\t\t// The entry at `iLast` is no longer overlapping with `newEntry`.\n\t\tiAfter = iLast;\n\t}\n\n\tconst numContainedEntries = iAfter - iBefore - 1;\n\tmap.splice(iBefore + 1, numContainedEntries, newEntry);\n}\n\n/**\n * Delete the keys from `start` to `start + length - 1`\n *\n * 1. If an entry is completely included in the deletion range, the whole entry will be deleted\n * e.g.: map = [[1, 2], [4, 6]], delete range: [3, 6]\n * map becomes [[1, 2]] after deletion\n * (Note: the notation [a, b] represents start = a, end = b for simpler visiualization, instead of `b`\n * representing the length)\n *\n * 2. If an entry is partially overlapped with the deletion range, the start or end point will be shifted\n * e.g.: map = [[1, 2], [4, 6]], delete range: [2, 4]\n * map becomes [[1, 1], [5, 6]] after deletion\n *\n * 3. If an entry completely includes the deletion range, the original entry may be split into two.\n * e.g.: map = [[1, 6]], delete range: [2, 4]\n * map becomes [[1, 1], [5, 6]]\n *\n * TODO: We may find ways to mitigate the code duplication between set and delete, and we need to better\n * document the API. AB#7413\n */\nexport function deleteFromRangeMap<T>(map: RangeMap<T>, start: number, length: number): void {\n\tconst end = start + length - 1;\n\n\tlet iBefore = -1;\n\tlet iAfter = map.length;\n\n\tfor (const [i, entry] of map.entries()) {\n\t\tconst entryLastKey = entry.start + entry.length - 1;\n\t\tif (entryLastKey < start) {\n\t\t\tiBefore = i;\n\t\t} else if (entry.start > end) {\n\t\t\tiAfter = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tconst numOverlappingEntries = iAfter - iBefore - 1;\n\n\tif (numOverlappingEntries === 0) {\n\t\t// No entry will be removed\n\t\treturn;\n\t}\n\n\tconst iFirst = iBefore + 1;\n\tconst iLast = iAfter - 1;\n\n\t// Update or remove the overlapping entries\n\tfor (let i = iFirst; i <= iLast; ++i) {\n\t\tconst entry = map[i] ?? oob();\n\t\tconst entryLastKey = entry.start + entry.length - 1;\n\t\tlet isDirty = false;\n\n\t\t// If the entry lies within the range to be deleted, remove it\n\t\tif (entry.start >= start && entryLastKey <= end) {\n\t\t\tmap.splice(i, 1);\n\t\t} else {\n\t\t\t// If the entry partially or completely overlaps with the range to be deleted\n\t\t\tif (entry.start < start) {\n\t\t\t\t// Update the endpoint and length of the portion before the range to be deleted\n\t\t\t\tconst lengthBefore = start - entry.start;\n\t\t\t\tmap[i] = { ...entry, length: lengthBefore };\n\t\t\t\tisDirty = true;\n\t\t\t}\n\n\t\t\tif (entryLastKey > end) {\n\t\t\t\t// Update the startpoint and length of the portion after the range to be deleted\n\t\t\t\tconst newStart = end + 1;\n\t\t\t\tconst newLength = entryLastKey - end;\n\t\t\t\tmap.splice(isDirty ? i + 1 : i, isDirty ? 0 : 1, {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tlength: newLength,\n\t\t\t\t\tvalue: entry.value,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rangeMap.js","sourceRoot":"","sources":["../../src/util/rangeMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAE1D;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAGpB,YAAmB,cAAgC;QAClD,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACI,aAAa;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAED;;;;;;;OAOG;IACI,GAAG,CAAC,KAAa,EAAE,MAAc;QACvC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClC,IAAI,KAAK,CAAC,KAAK,GAAG,KAAK,EAAE,CAAC;gBACzB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CA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CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;wBACzD,KAAK,EAAE,QAAQ;wBACf,MAAM,EAAE,SAAS;wBACjB,KAAK,EAAE,KAAK,CAAC,KAAK;qBAClB,CAAC,CAAC;gBACJ,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { oob } from \"@fluidframework/core-utils/internal\";\n\n/**\n * RangeMap represents a mapping from integers to values of type T or undefined.\n * The values for a range of consecutive keys can be changed or queried in a single operation.\n */\nexport class RangeMap<T> {\n\tprivate readonly entries: RangeEntry<T>[];\n\n\tpublic constructor(initialEntries?: RangeEntry<T>[]) {\n\t\tthis.entries = initialEntries ? [...initialEntries] : [];\n\t}\n\n\t/**\n\t * Retrieves all entries from the rangeMap.\n\t * @returns An array of RangeEntryResult objects, each containing the start index, length, and value of a contiguous range.\n\t */\n\tpublic getAllEntries(): readonly RangeQueryResult<T>[] {\n\t\treturn this.entries;\n\t}\n\n\t/**\n\t * Retrieves the value for some prefix of the query range.\n\t *\n\t * @param start - The first key in the query range.\n\t * @param length - The length of the query range.\n\t * @returns A RangeQueryResult containing the value associated with `start`,\n\t * and the number of consecutive keys with that same value.\n\t */\n\tpublic get(start: number, length: number): RangeQueryResult<T> {\n\t\tfor (const entry of this.entries) {\n\t\t\tif (entry.start > start) {\n\t\t\t\treturn { value: undefined, length: Math.min(entry.start - start, length) };\n\t\t\t}\n\n\t\t\tconst lastRangeKey = entry.start + entry.length - 1;\n\t\t\tif (lastRangeKey >= start) {\n\t\t\t\tconst overlapLength = lastRangeKey - start + 1;\n\t\t\t\treturn { value: entry.value, length: Math.min(overlapLength, length) };\n\t\t\t}\n\t\t}\n\n\t\t// There were no entries intersecting the query range, so the entire query range has undefined value.\n\t\treturn { value: undefined, length };\n\t}\n\n\t/**\n\t * Sets the value for a specified range.\n\t *\n\t * @param start - The first key in the range being set.\n\t * @param length - The length of the range.\n\t * @param value - The value to associate with the range.\n\t */\n\tpublic set(start: number, length: number, value: T | undefined): void {\n\t\tif (value === undefined) {\n\t\t\tthis.delete(start, length);\n\t\t\treturn;\n\t\t}\n\n\t\tconst end = start + length - 1;\n\t\tconst newEntry: RangeEntry<T> = { start, length, value };\n\n\t\tlet iBefore = -1;\n\t\tlet iAfter = this.entries.length;\n\t\tfor (const [i, entry] of this.entries.entries()) {\n\t\t\tconst entryLastKey = entry.start + entry.length - 1;\n\t\t\tif (entryLastKey < start) {\n\t\t\t\tiBefore = i;\n\t\t\t} else if (entry.start > end) {\n\t\t\t\tiAfter = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tconst numOverlappingEntries = iAfter - iBefore - 1;\n\t\tif (numOverlappingEntries === 0) {\n\t\t\tthis.entries.splice(iAfter, 0, newEntry);\n\t\t\treturn;\n\t\t}\n\n\t\tconst iFirst = iBefore + 1;\n\t\tconst firstEntry = this.entries[iFirst] ?? oob();\n\t\tconst iLast = iAfter - 1;\n\t\tconst lastEntry = this.entries[iLast] ?? oob();\n\t\tconst lengthBeforeFirst = start - firstEntry.start;\n\t\tconst lastEntryKey = lastEntry.start + lastEntry.length - 1;\n\t\tconst lengthAfterLast = lastEntryKey - end;\n\n\t\tif (lengthBeforeFirst > 0 && lengthAfterLast > 0 && iFirst === iLast) {\n\t\t\t// The new entry fits in the middle of an existing entry.\n\t\t\t// We replace the existing entry with:\n\t\t\t// 1) the portion which comes before `newEntry`\n\t\t\t// 2) `newEntry`\n\t\t\t// 3) the portion which comes after `newEntry`\n\t\t\tthis.entries.splice(iFirst, 1, { ...firstEntry, length: lengthBeforeFirst }, newEntry, {\n\t\t\t\t...lastEntry,\n\t\t\t\tstart: end + 1,\n\t\t\t\tlength: lengthAfterLast,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (lengthBeforeFirst > 0) {\n\t\t\tthis.entries[iFirst] = { ...firstEntry, length: lengthBeforeFirst };\n\t\t\t// The entry at `iFirst` is no longer overlapping with `newEntry`.\n\t\t\tiBefore = iFirst;\n\t\t}\n\n\t\tif (lengthAfterLast > 0) {\n\t\t\tthis.entries[iLast] = {\n\t\t\t\t...lastEntry,\n\t\t\t\tstart: end + 1,\n\t\t\t\tlength: lengthAfterLast,\n\t\t\t};\n\n\t\t\t// The entry at `iLast` is no longer overlapping with `newEntry`.\n\t\t\tiAfter = iLast;\n\t\t}\n\n\t\tconst numContainedEntries = iAfter - iBefore - 1;\n\t\tthis.entries.splice(iBefore + 1, numContainedEntries, newEntry);\n\t}\n\n\t/**\n\t * Deletes values within a specified range, updating or removing existing entries.\n\t *\n\t * 1. If an entry is completely included in the deletion range, the whole entry will be deleted\n\t * e.g.: map = [[1, 2], [4, 6]], delete range: [3, 6]\n\t * map becomes [[1, 2]] after deletion\n\t * (Note: the notation [a, b] represents start = a, end = b for simpler visualization, instead of `b`\n\t * representing the length)\n\t *\n\t * 2. If an entry is partially overlapped with the deletion range, the start or end point will be shifted\n\t * e.g.: map = [[1, 2], [4, 6]], delete range: [2, 4]\n\t * map becomes [[1, 1], [5, 6]] after deletion\n\t *\n\t * 3. If an entry completely includes the deletion range, the original entry may be split into two.\n\t * e.g.: map = [[1, 6]], delete range: [2, 4]\n\t * map becomes [[1, 1], [5, 6]]\n\t *\n\t * @param start - The start of the range to delete (inclusive).\n\t * @param length - The length of the range to delete.\n\t */\n\tpublic delete(start: number, length: number): void {\n\t\tconst end = start + length - 1;\n\n\t\tlet iBefore = -1;\n\t\tlet iAfter = this.entries.length;\n\n\t\tfor (const [i, entry] of this.entries.entries()) {\n\t\t\tconst entryLastKey = entry.start + entry.length - 1;\n\t\t\tif (entryLastKey < start) {\n\t\t\t\tiBefore = i;\n\t\t\t} else if (entry.start > end) {\n\t\t\t\tiAfter = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tconst numOverlappingEntries = iAfter - iBefore - 1;\n\n\t\tif (numOverlappingEntries === 0) {\n\t\t\t// No entry will be removed\n\t\t\treturn;\n\t\t}\n\n\t\tconst iFirst = iBefore + 1;\n\t\tconst iLast = iAfter - 1;\n\n\t\tfor (let i = iFirst; i <= iLast; ++i) {\n\t\t\tconst entry = this.entries[i] ?? oob();\n\t\t\tconst entryLastKey = entry.start + entry.length - 1;\n\t\t\tlet isDirty = false;\n\n\t\t\tif (entry.start >= start && entryLastKey <= end) {\n\t\t\t\t// If the entry lies within the range to be deleted, remove it\n\t\t\t\tthis.entries.splice(i, 1);\n\t\t\t} else {\n\t\t\t\t// If the entry partially or completely overlaps with the range to be deleted\n\t\t\t\tif (entry.start < start) {\n\t\t\t\t\t// Update the endpoint and length of the portion before the range to be deleted\n\t\t\t\t\tconst lengthBefore = start - entry.start;\n\t\t\t\t\tthis.entries[i] = { ...entry, length: lengthBefore };\n\t\t\t\t\tisDirty = true;\n\t\t\t\t}\n\n\t\t\t\tif (entryLastKey > end) {\n\t\t\t\t\t// Update the startpoint and length of the portion after the range to be deleted\n\t\t\t\t\tconst newStart = end + 1;\n\t\t\t\t\tconst newLength = entryLastKey - end;\n\t\t\t\t\tthis.entries.splice(isDirty ? i + 1 : i, isDirty ? 0 : 1, {\n\t\t\t\t\t\tstart: newStart,\n\t\t\t\t\t\tlength: newLength,\n\t\t\t\t\t\tvalue: entry.value,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Represents a contiguous range of values in the RangeMap.\n * This interface is used internally and should not be exposed to consumers.\n */\ninterface RangeEntry<T> {\n\t/**\n\t * The starting index of the range (inclusive).\n\t */\n\treadonly start: number;\n\n\t/**\n\t * The length of the range.\n\t */\n\treadonly length: number;\n\n\t/**\n\t * The value associated with this range.\n\t */\n\treadonly value: T;\n}\n\n/**\n * Describes the result of a range query, including the value and length of the matching prefix.\n */\nexport interface RangeQueryResult<T> {\n\t/**\n\t * The value of the first key in the query range.\n\t * If no matching range is found, this will be undefined.\n\t */\n\treadonly value: T | undefined;\n\n\t/**\n\t * The length of the prefix of the query range which has the same value.\n\t * For example, if a RangeMap has the same value for keys 5, 6, and 7,\n\t * a query about the range [5, 10] would give a result with length 3.\n\t */\n\treadonly length: number;\n}\n"]}
|
package/lib/util/typeCheck.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeCheck.d.ts","sourceRoot":"","sources":["../../src/util/typeCheck.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,WAAW;CAAG;AAE/B;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa,CAAC,EAAE,CAAC,CAAC;IAClC,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;CACnC;AAED
|
|
1
|
+
{"version":3,"file":"typeCheck.d.ts","sourceRoot":"","sources":["../../src/util/typeCheck.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,WAAW;CAAG;AAE/B;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa,CAAC,EAAE,CAAC,CAAC;IAClC,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS,CAAC,GAAG,CAAC,CAAC;IAC/B,qBAAqB,CAAC,EAAE,CAAC,CAAC;CAC1B;A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;AAEvF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,CAAC,IAAI,cAAc,CAChE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACrB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeCheck.js","sourceRoot":"","sources":["../../src/util/typeCheck.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Normally we would put tests in the test directory.\n// However in this case,\n// it's important that the tests are run with the same compiler settings this library is being used with,\n// since this library does not work for some configurations (ex: with strictNullChecks disabled).\n// Since the tests don't generate any JS: they only produce types,\n// importing them here gets us the validation of the compiler settings we want, with no JS size overhead.\nexport type { EnforceTypeCheckTests } from \"./typeCheckTests.js\";\n\n/**\n * Utilities for manipulating the typescript typechecker.\n *\n * @remarks\n * While it appears the the variance parts of this library are made obsolete by TypeScript 4.7's explicit variance annotations,\n * many cases still type check with incorrect variance even when using the explicit annotations,\n * and are fixed by using the patterns in this library.\n *\n * TypeScript uses structural typing if there are no private or protected members,\n * and variance of generic type parameters depends on their usages.\n * Thus when trying to constrain code by adding extra type information,\n * it often fails to actually constrain as desired, and these utilities can help with those cases.\n *\n * This library is designed so that the desired variance can be documented in a way that is easy to read, concise,\n * and allows easy navigation to documentation explaining what is being done\n * for readers who are not familiar with this library.\n * Additionally it constrains the types so the undesired usage patterns will not compile,\n * and will give somewhat intelligible errors.\n *\n * Additionally this library provides the tools needed to test that the type constraints are working as expected,\n * or test any other similar typing constraints in an application.\n *\n * This library assumes you are compiling with --strictFunctionTypes:\n * (Covariance and Contravariance is explained along with how these helpers cause it in typescript at this link)\n * {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-6.html#strict-function-types}.\n * If compiled with a TypeScript configuration that is not strict enough for these features to work,\n * the test suite should fail to build.\n *\n * Classes in TypeScript by default allow all assignments:\n * its only though adding members that any type constraints actually get applied.\n * This library provides types that can be used on a protected member of a class to add the desired constraints.\n *\n * Typical usages (use one field like this at the top of a class):\n * ```typescript\n * protected _typeCheck!: MakeNominal;\n * protected _typeCheck?: Contravariant<T>;\n * protected _typeCheck?: Covariant<T>;\n * protected _typeCheck?: Invariant<T>;\n * protected _typeCheck?: Contravariant<T> & Invariant<K>;\n * ```\n *\n * See tests for examples.\n *\n * Note that all of these cause nominal typing.\n * If constraints on generic type parameter variance are desired, but nominal typing is not,\n * these types can be used on a public field. This case also works with interfaces.\n *\n * Be aware that other members of your type might apply further constraints\n * (ex: you might try and write a Contravariant<T> class, but it ends up being Invariant<T> due to a field of type T).\n *\n * Be aware of TypeScript Bug:\n * {@link https://github.com/microsoft/TypeScript/issues/36906}.\n * This bug is why the fields here are protected not private.\n * Note that this bug is closed as a duplicate of {@link https://github.com/microsoft/TypeScript/issues/20979}\n * which was closed because fixing it would be too large of a breaking change.\n * Thus we expect this bug to be part of TypeScript for the forseeable future.\n */\n\n/**\n * Use this as the type of a protected field to cause a type to use nominal typing instead of structural.\n *\n * @remarks\n * Using nominal typing in this way prevents assignment of objects which are not instances of this class to values of this class's type.\n * Classes which are used with \"instanceof\", or are supposed to be instantiated in particular ways (not just made with object literals)\n * can use this to prevent undesired assignments.\n * @example\n * ```typescript\n * protected _typeCheck!: MakeNominal;\n * ```\n * @privateRemarks\n * See: {@link https://dev.azure.com/intentional/intent/_wiki/wikis/NP%20Platform/7146/Nominal-vs-Structural-Types}\n * @sealed @public\n */\nexport interface MakeNominal {}\n\n/**\n * Constrain generic type parameters to Contravariant.\n *\n * @example\n *\n * ```typescript\n * protected _typeCheck?: Contravariant<T>;\n * ```\n */\nexport interface Contravariant<in T> {\n\t_removeCovariance?: (_: T) => void;\n}\n\n/**\n * Constrain generic type parameters to Covariant.\n *\n * @example\n *\n * ```typescript\n * protected _typeCheck?: Covariant<T>;\n * ```\n
|
|
1
|
+
{"version":3,"file":"typeCheck.js","sourceRoot":"","sources":["../../src/util/typeCheck.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Normally we would put tests in the test directory.\n// However in this case,\n// it's important that the tests are run with the same compiler settings this library is being used with,\n// since this library does not work for some configurations (ex: with strictNullChecks disabled).\n// Since the tests don't generate any JS: they only produce types,\n// importing them here gets us the validation of the compiler settings we want, with no JS size overhead.\nexport type { EnforceTypeCheckTests } from \"./typeCheckTests.js\";\n\n/**\n * Utilities for manipulating the typescript typechecker.\n *\n * @remarks\n * While it appears the the variance parts of this library are made obsolete by TypeScript 4.7's explicit variance annotations,\n * many cases still type check with incorrect variance even when using the explicit annotations,\n * and are fixed by using the patterns in this library.\n *\n * TypeScript uses structural typing if there are no private or protected members,\n * and variance of generic type parameters depends on their usages.\n * Thus when trying to constrain code by adding extra type information,\n * it often fails to actually constrain as desired, and these utilities can help with those cases.\n *\n * This library is designed so that the desired variance can be documented in a way that is easy to read, concise,\n * and allows easy navigation to documentation explaining what is being done\n * for readers who are not familiar with this library.\n * Additionally it constrains the types so the undesired usage patterns will not compile,\n * and will give somewhat intelligible errors.\n *\n * Additionally this library provides the tools needed to test that the type constraints are working as expected,\n * or test any other similar typing constraints in an application.\n *\n * This library assumes you are compiling with --strictFunctionTypes:\n * (Covariance and Contravariance is explained along with how these helpers cause it in typescript at this link)\n * {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-6.html#strict-function-types}.\n * If compiled with a TypeScript configuration that is not strict enough for these features to work,\n * the test suite should fail to build.\n *\n * Classes in TypeScript by default allow all assignments:\n * its only though adding members that any type constraints actually get applied.\n * This library provides types that can be used on a protected member of a class to add the desired constraints.\n *\n * Typical usages (use one field like this at the top of a class):\n * ```typescript\n * protected _typeCheck!: MakeNominal;\n * protected _typeCheck?: Contravariant<T>;\n * protected _typeCheck?: Covariant<T>;\n * protected _typeCheck?: Invariant<T>;\n * protected _typeCheck?: Contravariant<T> & Invariant<K>;\n * ```\n *\n * See tests for examples.\n *\n * Note that all of these cause nominal typing.\n * If constraints on generic type parameter variance are desired, but nominal typing is not,\n * these types can be used on a public field. This case also works with interfaces.\n *\n * Be aware that other members of your type might apply further constraints\n * (ex: you might try and write a Contravariant<T> class, but it ends up being Invariant<T> due to a field of type T).\n *\n * Be aware of TypeScript Bug:\n * {@link https://github.com/microsoft/TypeScript/issues/36906}.\n * This bug is why the fields here are protected not private.\n * Note that this bug is closed as a duplicate of {@link https://github.com/microsoft/TypeScript/issues/20979}\n * which was closed because fixing it would be too large of a breaking change.\n * Thus we expect this bug to be part of TypeScript for the forseeable future.\n */\n\n/**\n * Use this as the type of a protected field to cause a type to use nominal typing instead of structural.\n *\n * @remarks\n * Using nominal typing in this way prevents assignment of objects which are not instances of this class to values of this class's type.\n * Classes which are used with \"instanceof\", or are supposed to be instantiated in particular ways (not just made with object literals)\n * can use this to prevent undesired assignments.\n * @example\n * ```typescript\n * protected _typeCheck!: MakeNominal;\n * ```\n * @privateRemarks\n * See: {@link https://dev.azure.com/intentional/intent/_wiki/wikis/NP%20Platform/7146/Nominal-vs-Structural-Types}\n * @sealed @public\n */\nexport interface MakeNominal {}\n\n/**\n * Constrain generic type parameters to Contravariant.\n *\n * @example\n *\n * ```typescript\n * protected _typeCheck?: Contravariant<T>;\n * ```\n */\nexport interface Contravariant<in T> {\n\t_removeCovariance?: (_: T) => void;\n}\n\n/**\n * Constrain generic type parameters to Covariant.\n *\n * @example\n *\n * ```typescript\n * protected _typeCheck?: Covariant<T>;\n * ```\n */\nexport interface Covariant<out T> {\n\t_removeContravariance?: T;\n}\n\n/**\n * Constrain generic type parameters to Invariant.\n *\n * @example\n *\n * ```typescript\n * protected _typeCheck?: Invariant<T>;\n * ```\n */\nexport interface Invariant<in out T> extends Contravariant<T>, Covariant<T> {}\n\n/**\n * Compile time assert that X is True.\n * To use, simply define a type:\n * `type _check = requireTrue<your type check>;`\n */\nexport type requireTrue<_X extends true> = true;\n\n/**\n * Compile time assert that X is False.\n * To use, simply define a type:\n * `type _check = requireFalse<your type check>;`\n */\nexport type requireFalse<_X extends false> = true;\n\n/**\n * Returns a type parameter that is true iff Source is assignable to Destination.\n *\n * @privateRemarks\n * Use of [] in the extends clause prevents unions from being distributed over this conditional and returning `boolean` in some cases.\n * @see {@link https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types | distributive-conditional-types} for details.\n */\nexport type isAssignableTo<Source, Destination> = [Source] extends [Destination]\n\t? true\n\t: false;\n\n/**\n * Returns a type parameter that is true iff Subset is a strict subset of Superset.\n */\nexport type isStrictSubset<Subset, Superset> = isAssignableTo<Subset, Superset> extends false\n\t? false\n\t: isAssignableTo<Superset, Subset> extends true\n\t\t? false\n\t\t: true;\n\n/**\n * Returns a type parameter that is true iff A and B are assignable to each other, and neither is any.\n * This is useful for checking if the output of a type meta-function is the expected type.\n */\nexport type areSafelyAssignable<A, B> = eitherIsAny<A, B> extends true\n\t? false\n\t: isAssignableTo<A, B> extends true\n\t\t? isAssignableTo<B, A>\n\t\t: false;\n\n/**\n * Returns a type parameter that is true iff A is any or B is any.\n */\nexport type eitherIsAny<A, B> = true extends isAny<A> | isAny<B> ? true : false;\n\n/**\n * Returns a type parameter that is true iff T is any.\n *\n * @privateRemarks\n * Only `never` is assignable to `never` (`any` isn't),\n * but `any` distributes over the `extends` here while nothing else should.\n * This can be used to detect `any`.\n */\nexport type isAny<T> = boolean extends (T extends never ? true : false) ? true : false;\n\n/**\n * Compile time assert that A is assignable to (extends) B.\n * To use, simply define a type:\n * `type _check = requireAssignableTo<T, Expected>;`\n */\nexport type requireAssignableTo<_A extends B, B> = true;\n\n/**\n * Returns a type parameter that is true iff the `Keys` union includes all the keys of `T`.\n *\n * @remarks\n * This does not handle when the T has an index signature permitting keys like `string` which\n * TypeScript cannot omit members from.\n *\n * @example\n * ```ts\n * type _check = requireTrue<areOnlyKeys<{a: number, b: number}, 'a' | 'b'>> // true`\n * type _check = requireTrue<areOnlyKeys<{a: number, b: number}, 'a'>> // false`\n * ```\n */\nexport type areOnlyKeys<T, Keys extends keyof T> = isAssignableTo<\n\tRecord<string, never>,\n\tOmit<Required<T>, Keys>\n>;\n"]}
|
package/lib/util/utils.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface MapGetSet<K, V> {
|
|
|
11
11
|
set(key: K, value: V): void;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Make all transitive properties in T readonly
|
|
14
|
+
* Make all transitive properties in `T` readonly
|
|
15
15
|
*/
|
|
16
16
|
export type RecursiveReadonly<T> = {
|
|
17
17
|
readonly [P in keyof T]: RecursiveReadonly<T[P]>;
|
|
@@ -295,4 +295,38 @@ export declare function capitalize<S extends string>(s: S): Capitalize<S>;
|
|
|
295
295
|
* Compares strings lexically to form a strict partial ordering.
|
|
296
296
|
*/
|
|
297
297
|
export declare function compareStrings<T extends string>(a: T, b: T): number;
|
|
298
|
+
/**
|
|
299
|
+
* Defines a property on an object that is lazily initialized and cached.
|
|
300
|
+
* @remarks This is useful for properties that are expensive to compute and it is not guaranteed that they will be accessed.
|
|
301
|
+
* This function initially defines a getter on the object, but after first read it replaces the getter with a value property.
|
|
302
|
+
* @param obj - The object on which to define the property.
|
|
303
|
+
* @param key - The key of the property to define.
|
|
304
|
+
* @param get - The function (called either once or not at all) to compute the value of the property.
|
|
305
|
+
* @returns `obj`, typed such that it has the new property.
|
|
306
|
+
* This allows for the new property to be read off of `obj` in a type-safe manner after calling this function.
|
|
307
|
+
*/
|
|
308
|
+
export declare function defineLazyCachedProperty<T extends object, K extends string | number | symbol, V>(obj: T, key: K, get: () => V): typeof obj & {
|
|
309
|
+
[P in K]: V;
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Copies a given property from one object to another if and only if the property is defined.
|
|
313
|
+
* @param source - The object to copy the property from.
|
|
314
|
+
* If `source` is undefined or does not have the property defined, then this function will do nothing.
|
|
315
|
+
* @param property - The property to copy.
|
|
316
|
+
* @param destination - The object to copy the property to.
|
|
317
|
+
* @remarks This function is useful for copying properties from one object to another while minimizing the presence of `undefined` values.
|
|
318
|
+
* If `property` is not present on `source` - or if `property` is present, but has a value of `undefined` - then this function will not modify `destination`.
|
|
319
|
+
* This is different from doing `destination.foo = source.foo`, which would define a `"foo"` property on `destination` with the value `undefined`.
|
|
320
|
+
*
|
|
321
|
+
* If the type of `source` is known to have `property`, then this function asserts that the type of `destination` has `property` as well after the call.
|
|
322
|
+
*
|
|
323
|
+
* This function first reads the property value (if present) from `source` and then sets it on `destination`, as opposed to e.g. directly copying the property descriptor.
|
|
324
|
+
* @privateRemarks The first overload of this function allows auto-complete to suggest property names from `source`, but by having the second overload we still allow for arbitrary property names.
|
|
325
|
+
*/
|
|
326
|
+
export declare function copyPropertyIfDefined<S extends object, K extends keyof S, D extends object>(source: S | undefined, property: K, destination: D): asserts destination is K extends keyof S ? D & {
|
|
327
|
+
[P in K]: S[K];
|
|
328
|
+
} : D;
|
|
329
|
+
export declare function copyPropertyIfDefined<S extends object, K extends string | number | symbol, D extends object>(source: S | undefined, property: K, destination: D): asserts destination is K extends keyof S ? D & {
|
|
330
|
+
[P in K]: S[K];
|
|
331
|
+
} : D;
|
|
298
332
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/util/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/util/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,eAAe,MAAM,yBAAyB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,EAAE,CAAC;IAC9B,GAAG,CAAC,GAAG,EA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,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,SAAS,MAAM,EAC1F,MAAM,EAAE,CAAC,GAAG,SAAS,EACrB,QAAQ,EAAE,CAAC,EACX,WAAW,EAAE,CAAC,GACZ,OAAO,CAAC,WAAW,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG;KAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,CAAC,CAAC;AACzE,wBAAgB,qBAAqB,CACpC,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAClC,CAAC,SAAS,MAAM,EAEhB,MAAM,EAAE,CAAC,GAAG,SAAS,EACrB,QAAQ,EAAE,CAAC,EACX,WAAW,EAAE,CAAC,GACZ,OAAO,CAAC,WAAW,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG;KAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,CAAC,CAAC"}
|
package/lib/util/utils.js
CHANGED
|
@@ -322,4 +322,33 @@ export function capitalize(s) {
|
|
|
322
322
|
export function compareStrings(a, b) {
|
|
323
323
|
return a > b ? 1 : a === b ? 0 : -1;
|
|
324
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* Defines a property on an object that is lazily initialized and cached.
|
|
327
|
+
* @remarks This is useful for properties that are expensive to compute and it is not guaranteed that they will be accessed.
|
|
328
|
+
* This function initially defines a getter on the object, but after first read it replaces the getter with a value property.
|
|
329
|
+
* @param obj - The object on which to define the property.
|
|
330
|
+
* @param key - The key of the property to define.
|
|
331
|
+
* @param get - The function (called either once or not at all) to compute the value of the property.
|
|
332
|
+
* @returns `obj`, typed such that it has the new property.
|
|
333
|
+
* This allows for the new property to be read off of `obj` in a type-safe manner after calling this function.
|
|
334
|
+
*/
|
|
335
|
+
export function defineLazyCachedProperty(obj, key, get) {
|
|
336
|
+
Reflect.defineProperty(obj, key, {
|
|
337
|
+
get() {
|
|
338
|
+
const value = get();
|
|
339
|
+
Reflect.defineProperty(obj, key, { value });
|
|
340
|
+
return value;
|
|
341
|
+
},
|
|
342
|
+
configurable: true,
|
|
343
|
+
});
|
|
344
|
+
return obj;
|
|
345
|
+
}
|
|
346
|
+
export function copyPropertyIfDefined(source, property, destination) {
|
|
347
|
+
if (source !== undefined) {
|
|
348
|
+
const value = source[property];
|
|
349
|
+
if (value !== undefined) {
|
|
350
|
+
destination[property] = value;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
325
354
|
//# sourceMappingURL=utils.js.map
|