@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import type { TreeLeafValue } from "../schemaTypes.js";
|
|
5
|
+
import type { NodeSchemaMetadata, TreeLeafValue } from "../schemaTypes.js";
|
|
6
6
|
import type { InternalTreeNode, TreeNode, Unhydrated } from "./types.js";
|
|
7
7
|
/**
|
|
8
8
|
* Schema for a {@link TreeNode} or {@link TreeLeafValue}.
|
|
@@ -18,7 +18,7 @@ import type { InternalTreeNode, TreeNode, Unhydrated } from "./types.js";
|
|
|
18
18
|
* Use `Tree.schema(value)` to lookup the schema for a {@link TreeNode} or {@link TreeLeafValue}.
|
|
19
19
|
* @sealed @public
|
|
20
20
|
*/
|
|
21
|
-
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
21
|
+
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TCustomMetadata = unknown> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata>;
|
|
22
22
|
/**
|
|
23
23
|
* Schema which is not a class.
|
|
24
24
|
* @remarks
|
|
@@ -27,7 +27,7 @@ export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind =
|
|
|
27
27
|
* Non-class based schema can have issues with recursive types due to https://github.com/microsoft/TypeScript/issues/55832.
|
|
28
28
|
* @system @sealed @public
|
|
29
29
|
*/
|
|
30
|
-
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
30
|
+
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable, TCustomMetadata> & (undefined extends TConstructorExtra ? {
|
|
31
31
|
/**
|
|
32
32
|
* Constructs an {@link Unhydrated} node with this schema.
|
|
33
33
|
* @sealed
|
|
@@ -85,7 +85,7 @@ export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends No
|
|
|
85
85
|
* ```
|
|
86
86
|
* @sealed @public
|
|
87
87
|
*/
|
|
88
|
-
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
88
|
+
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable, TCustomMetadata> & (undefined extends TConstructorExtra ? {
|
|
89
89
|
/**
|
|
90
90
|
* Constructs an {@link Unhydrated} node with this schema.
|
|
91
91
|
* @remarks
|
|
@@ -107,14 +107,14 @@ export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeK
|
|
|
107
107
|
/**
|
|
108
108
|
* Internal helper for utilities that return schema which can be used in class and non class formats depending on the API exposing it.
|
|
109
109
|
*/
|
|
110
|
-
export type TreeNodeSchemaBoth<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaClass<Name, Kind, TNode, TInsertable, ImplicitlyConstructable, Info, TConstructorExtra> & TreeNodeSchemaNonClass<Name, Kind, TNode, TInsertable, ImplicitlyConstructable, Info, TConstructorExtra>;
|
|
110
|
+
export type TreeNodeSchemaBoth<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaClass<Name, Kind, TNode, TInsertable, ImplicitlyConstructable, Info, TConstructorExtra, TCustomMetadata> & TreeNodeSchemaNonClass<Name, Kind, TNode, TInsertable, ImplicitlyConstructable, Info, TConstructorExtra, TCustomMetadata>;
|
|
111
111
|
/**
|
|
112
112
|
* Data common to all tree node schema.
|
|
113
113
|
* @remarks
|
|
114
114
|
* Implementation detail of {@link TreeNodeSchema} which should be accessed instead of referring to this type directly.
|
|
115
115
|
* @sealed @public
|
|
116
116
|
*/
|
|
117
|
-
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never> {
|
|
117
|
+
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never, out TCustomMetadata = unknown> {
|
|
118
118
|
/**
|
|
119
119
|
* Unique (within a document's schema) identifier used to associate nodes with their schema.
|
|
120
120
|
* @remarks
|
|
@@ -166,6 +166,10 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
166
166
|
* @system
|
|
167
167
|
*/
|
|
168
168
|
readonly childTypes: ReadonlySet<TreeNodeSchema>;
|
|
169
|
+
/**
|
|
170
|
+
* User-provided {@link NodeSchemaMetadata} for this schema.
|
|
171
|
+
*/
|
|
172
|
+
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
169
173
|
/**
|
|
170
174
|
* Constructs an instance of this node type.
|
|
171
175
|
* @remarks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeNodeSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAA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IACL;;;;OAIG;IACH,MAAM,IAAA;IACN;;OAEG;IACH,IAAI,IAAA;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeNodeSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsQH;;;;;GAKG;AACH,IAAY,QAmBX;AAnBD,WAAY,QAAQ;IACnB;;OAEG;IACH,qCAAG,CAAA;IACH;;OAEG;IACH,yCAAK,CAAA;IACL;;;;OAIG;IACH,2CAAM,CAAA;IACN;;OAEG;IACH,uCAAI,CAAA;AACL,CAAC,EAnBW,QAAQ,wBAAR,QAAQ,QAmBnB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TreeLeafValue } from \"../schemaTypes.js\";\nimport type { InternalTreeNode, TreeNode, Unhydrated } from \"./types.js\";\n\n/**\n * Schema for a {@link TreeNode} or {@link TreeLeafValue}.\n *\n * @typeParam Name - The full (including scope) name/identifier for the schema.\n * @typeParam Kind - Which kind of node this schema is for.\n * @typeParam TNode - API for nodes that use this schema.\n * @typeParam TBuild - Data which can be used to construct an {@link Unhydrated} node of this type.\n * @typeParam Info - Data used when defining this schema.\n * @remarks\n * Captures the schema both as runtime data and compile time type information.\n * Use {@link SchemaFactory} to define schema.\n * Use `Tree.schema(value)` to lookup the schema for a {@link TreeNode} or {@link TreeLeafValue}.\n * @sealed @public\n */\nexport type TreeNodeSchema<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue,\n\tTBuild = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n> =\n\t| (TNode extends TreeNode\n\t\t\t? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>\n\t\t\t: never)\n\t| TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;\n\n/**\n * Schema which is not a class.\n * @remarks\n * This is used for schema which cannot have their instances constructed using constructors, like leaf schema.\n * @privateRemarks\n * Non-class based schema can have issues with recursive types due to https://github.com/microsoft/TypeScript/issues/55832.\n * @system @sealed @public\n */\nexport type TreeNodeSchemaNonClass<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTConstructorExtra = never,\n> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> &\n\t(undefined extends TConstructorExtra\n\t\t? {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\tcreate(data?: TInsertable | TConstructorExtra): TNode;\n\t\t\t}\n\t\t: {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\tcreate(data: TInsertable | TConstructorExtra): TNode;\n\t\t\t});\n\n/**\n * Tree node schema which is implemented using a class.\n * @remarks\n * Instances of this class are nodes in the tree.\n * This is also a constructor so that it can be subclassed.\n *\n * Using classes in this way allows introducing a named type and a named value at the same time, helping keep the runtime and compile time information together and easy to refer to un a uniform way.\n * Additionally, this works around https://github.com/microsoft/TypeScript/issues/55832 which causes similar patterns with less explicit types to infer \"any\" in the d.ts file.\n *\n * When sub-classing a a `TreeNodeSchemaClass`, some extra rules must be followed:\n *\n * - Only ever use a single class from the schema's class hierarchy within a document and its schema.\n * For example, if using {@link SchemaFactory.object} you can do:\n * ```typescript\n * // Recommended \"customizable\" object schema pattern.\n * class Good extends schemaFactory.object(\"A\", {\n * \texampleField: schemaFactory.number,\n * }) {\n * \tpublic exampleCustomMethod(): void {\n * \t\tthis.exampleField++;\n * \t}\n * }\n * ```\n * But should avoid:\n * ```typescript\n * // This by itself is ok, and opts into \"POJO mode\".\n * const base = schemaFactory.object(\"A\", {});\n * // This is a bad pattern since it leaves two classes in scope which derive from the same SchemaFactory defined class.\n * // If both get used, its an error!\n * class Invalid extends base {}\n * ```\n * - Do not modify the constructor input parameter types or values:\n * ```typescript\n * class Invalid extends schemaFactory.object(\"A\", {\n * \texampleField: schemaFactory.number,\n * }) {\n * \t// This Modifies the type of the constructor input.\n * \t// This is unsupported due to programmatic access to the constructor being used internally.\n * \tpublic constructor(a: number) {\n * \t\tsuper({ exampleField: a });\n * \t}\n * }\n * ```\n * @sealed @public\n */\nexport type TreeNodeSchemaClass<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode = TreeNode,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTConstructorExtra = never,\n> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> &\n\t(undefined extends TConstructorExtra\n\t\t? {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @remarks\n\t\t\t\t * This constructor is also used internally to construct hydrated nodes with a different parameter type.\n\t\t\t\t * Therefore, overriding this constructor with different argument types is not type-safe and is not supported.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\t// The approach suggested by the linter here is more concise, but ir break intellisense for the constructor.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t\t\t\tnew (data?: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;\n\t\t\t}\n\t\t: {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @remarks\n\t\t\t\t * This constructor is also used internally to construct hydrated nodes with a different parameter type.\n\t\t\t\t * Therefore, overriding this constructor with different argument types is not type-safe and is not supported.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\t// The approach suggested by the linter here is more concise, but ir break intellisense for the constructor.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t\t\t\tnew (data: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;\n\t\t\t});\n\n/**\n * Internal helper for utilities that return schema which can be used in class and non class formats depending on the API exposing it.\n */\nexport type TreeNodeSchemaBoth<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode = TreeNode,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTConstructorExtra = never,\n> = TreeNodeSchemaClass<\n\tName,\n\tKind,\n\tTNode,\n\tTInsertable,\n\tImplicitlyConstructable,\n\tInfo,\n\tTConstructorExtra\n> &\n\tTreeNodeSchemaNonClass<\n\t\tName,\n\t\tKind,\n\t\tTNode,\n\t\tTInsertable,\n\t\tImplicitlyConstructable,\n\t\tInfo,\n\t\tTConstructorExtra\n\t>;\n\n/**\n * Data common to all tree node schema.\n * @remarks\n * Implementation detail of {@link TreeNodeSchema} which should be accessed instead of referring to this type directly.\n * @sealed @public\n */\nexport interface TreeNodeSchemaCore<\n\tout Name extends string,\n\tout Kind extends NodeKind,\n\tout ImplicitlyConstructable extends boolean,\n\tout Info = unknown,\n\tout TInsertable = never,\n> {\n\t/**\n\t * Unique (within a document's schema) identifier used to associate nodes with their schema.\n\t * @remarks\n\t * This is used when encoding nodes, and when decoding nodes to re-associate them with the schema.\n\t * Since this decoding may happen in a different version of the application (or even a different application altogether),\n\t * this identifier should generally correspond to some specific semantics for the data (how to interpret the node with this identifier).\n\t * Any time the semantics change such that data would be misinterpreted if the old semantics were applied\n\t * (for example the units of a value are changed),\n\t * it is best practice to pick a new identifier.\n\t */\n\treadonly identifier: Name;\n\treadonly kind: Kind;\n\n\t/**\n\t * Data used to define this schema.\n\t *\n\t * @remarks\n\t * The format depends on the kind of node it is for.\n\t * For example, the \"object\" node kind could store the field schema here.\n\t */\n\treadonly info: Info;\n\n\t/**\n\t * When constructing insertable content,\n\t * data that could be passed to the node's constructor can be used instead of an {@link Unhydrated} node\n\t * iff implicitlyConstructable is true.\n\t * @privateRemarks\n\t * Currently the logic for traversing insertable content,\n\t * both to build trees and to hydrate them does not defer to the schema classes to handle the policy,\n\t * so if their constructors differ from what is supported, some cases will not work.\n\t * Setting this to false adjusts the insertable types to disallow cases which could be impacted by these inconsistencies.\n\t */\n\treadonly implicitlyConstructable: ImplicitlyConstructable;\n\n\t/**\n\t * All possible schema that a direct child of a node with this schema could have.\n\t *\n\t * Equivalently, this is also all schema directly referenced when defining this schema's allowed child types,\n\t * which is also the same as the set of schema referenced directly by the `Info` type parameter and the `info` property.\n\t * This property is simply re-exposing that information in an easier to traverse format consistent across all node kinds.\n\t * @remarks\n\t * Some kinds of nodes may have additional restrictions on children:\n\t * this set simply enumerates all directly referenced schema, and can be use to walk over all referenced schema types.\n\t *\n\t * This set cannot be used before the schema in it have been defined:\n\t * more specifically, when using lazy schema references (for example to make foreword references to schema which have not yet been defined),\n\t * users must wait until after the schema are defined to access this set.\n\t * @privateRemarks\n\t * Currently there isn't much use for this in the public API,\n\t * and it's possible this will want to be tweaked or renamed as part of a larger schema reflection API surface that might be added later.\n\t * To keep options option, this is marked `@system` for now.\n\t * @system\n\t */\n\treadonly childTypes: ReadonlySet<TreeNodeSchema>;\n\n\t/**\n\t * Constructs an instance of this node type.\n\t * @remarks\n\t * Due to TypeScript limitations, the return type of this method can not be very specific.\n\t * For {@link TreeNodeSchemaClass} prefer using the constructor directly for better typing.\n\t * For {@link TreeNodeSchemaNonClass} use `create`.\n\t *\n\t * @privateRemarks\n\t * This method signature provides a way to infer `TInsertable` without relying on the constructor, and to construct nodes from schema of unknown kind.\n\t * This makes customizations of the constructor not impact the typing of insertable content, allowing customization of the constructor,\n\t * as long as doing so only adds additional supported cases.\n\t *\n\t * This cannot be required to return `TNode`:\n\t * doing so breaks sub-classing of schema since they don't overload this method with a more specific return type.\n\t * @sealed @system\n\t */\n\tcreateFromInsertable(data: TInsertable): Unhydrated<TreeNode | TreeLeafValue>;\n}\n\n/**\n * Kind of tree node.\n * @remarks\n * More kinds may be added over time, so do not assume this is an exhaustive set.\n * @public\n */\nexport enum NodeKind {\n\t/**\n\t * A node which serves as a map, storing children under string keys.\n\t */\n\tMap,\n\t/**\n\t * A node which serves as an array, storing children in an ordered sequence.\n\t */\n\tArray,\n\t/**\n\t * A node which stores a heterogenous collection of children in named fields.\n\t * @remarks\n\t * Each field gets its own schema.\n\t */\n\tObject,\n\t/**\n\t * A node which stores a single leaf value.\n\t */\n\tLeaf,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"treeNodeSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkTH;;;;;GAKG;AACH,IAAY,QAmBX;AAnBD,WAAY,QAAQ;IACnB;;OAEG;IACH,qCAAG,CAAA;IACH;;OAEG;IACH,yCAAK,CAAA;IACL;;;;OAIG;IACH,2CAAM,CAAA;IACN;;OAEG;IACH,uCAAI,CAAA;AACL,CAAC,EAnBW,QAAQ,wBAAR,QAAQ,QAmBnB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { NodeSchemaMetadata, TreeLeafValue } from \"../schemaTypes.js\";\nimport type { InternalTreeNode, TreeNode, Unhydrated } from \"./types.js\";\n\n/**\n * Schema for a {@link TreeNode} or {@link TreeLeafValue}.\n *\n * @typeParam Name - The full (including scope) name/identifier for the schema.\n * @typeParam Kind - Which kind of node this schema is for.\n * @typeParam TNode - API for nodes that use this schema.\n * @typeParam TBuild - Data which can be used to construct an {@link Unhydrated} node of this type.\n * @typeParam Info - Data used when defining this schema.\n * @remarks\n * Captures the schema both as runtime data and compile time type information.\n * Use {@link SchemaFactory} to define schema.\n * Use `Tree.schema(value)` to lookup the schema for a {@link TreeNode} or {@link TreeLeafValue}.\n * @sealed @public\n */\nexport type TreeNodeSchema<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue,\n\tTBuild = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTCustomMetadata = unknown,\n> =\n\t| (TNode extends TreeNode\n\t\t\t? TreeNodeSchemaClass<\n\t\t\t\t\tName,\n\t\t\t\t\tKind,\n\t\t\t\t\tTNode,\n\t\t\t\t\tTBuild,\n\t\t\t\t\tImplicitlyConstructable,\n\t\t\t\t\tInfo,\n\t\t\t\t\tnever,\n\t\t\t\t\tTCustomMetadata\n\t\t\t\t>\n\t\t\t: never)\n\t| TreeNodeSchemaNonClass<\n\t\t\tName,\n\t\t\tKind,\n\t\t\tTNode,\n\t\t\tTBuild,\n\t\t\tImplicitlyConstructable,\n\t\t\tInfo,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t >;\n\n/**\n * Schema which is not a class.\n * @remarks\n * This is used for schema which cannot have their instances constructed using constructors, like leaf schema.\n * @privateRemarks\n * Non-class based schema can have issues with recursive types due to https://github.com/microsoft/TypeScript/issues/55832.\n * @system @sealed @public\n */\nexport type TreeNodeSchemaNonClass<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTConstructorExtra = never,\n\tTCustomMetadata = unknown,\n> = TreeNodeSchemaCore<\n\tName,\n\tKind,\n\tImplicitlyConstructable,\n\tInfo,\n\tTInsertable,\n\tTCustomMetadata\n> &\n\t(undefined extends TConstructorExtra\n\t\t? {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\tcreate(data?: TInsertable | TConstructorExtra): TNode;\n\t\t\t}\n\t\t: {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\tcreate(data: TInsertable | TConstructorExtra): TNode;\n\t\t\t});\n\n/**\n * Tree node schema which is implemented using a class.\n * @remarks\n * Instances of this class are nodes in the tree.\n * This is also a constructor so that it can be subclassed.\n *\n * Using classes in this way allows introducing a named type and a named value at the same time, helping keep the runtime and compile time information together and easy to refer to un a uniform way.\n * Additionally, this works around https://github.com/microsoft/TypeScript/issues/55832 which causes similar patterns with less explicit types to infer \"any\" in the d.ts file.\n *\n * When sub-classing a a `TreeNodeSchemaClass`, some extra rules must be followed:\n *\n * - Only ever use a single class from the schema's class hierarchy within a document and its schema.\n * For example, if using {@link SchemaFactory.object} you can do:\n * ```typescript\n * // Recommended \"customizable\" object schema pattern.\n * class Good extends schemaFactory.object(\"A\", {\n * \texampleField: schemaFactory.number,\n * }) {\n * \tpublic exampleCustomMethod(): void {\n * \t\tthis.exampleField++;\n * \t}\n * }\n * ```\n * But should avoid:\n * ```typescript\n * // This by itself is ok, and opts into \"POJO mode\".\n * const base = schemaFactory.object(\"A\", {});\n * // This is a bad pattern since it leaves two classes in scope which derive from the same SchemaFactory defined class.\n * // If both get used, its an error!\n * class Invalid extends base {}\n * ```\n * - Do not modify the constructor input parameter types or values:\n * ```typescript\n * class Invalid extends schemaFactory.object(\"A\", {\n * \texampleField: schemaFactory.number,\n * }) {\n * \t// This Modifies the type of the constructor input.\n * \t// This is unsupported due to programmatic access to the constructor being used internally.\n * \tpublic constructor(a: number) {\n * \t\tsuper({ exampleField: a });\n * \t}\n * }\n * ```\n * @sealed @public\n */\nexport type TreeNodeSchemaClass<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode = TreeNode,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTConstructorExtra = never,\n\tTCustomMetadata = unknown,\n> = TreeNodeSchemaCore<\n\tName,\n\tKind,\n\tImplicitlyConstructable,\n\tInfo,\n\tTInsertable,\n\tTCustomMetadata\n> &\n\t(undefined extends TConstructorExtra\n\t\t? {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @remarks\n\t\t\t\t * This constructor is also used internally to construct hydrated nodes with a different parameter type.\n\t\t\t\t * Therefore, overriding this constructor with different argument types is not type-safe and is not supported.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\t// The approach suggested by the linter here is more concise, but ir break intellisense for the constructor.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t\t\t\tnew (data?: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;\n\t\t\t}\n\t\t: {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @remarks\n\t\t\t\t * This constructor is also used internally to construct hydrated nodes with a different parameter type.\n\t\t\t\t * Therefore, overriding this constructor with different argument types is not type-safe and is not supported.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\t// The approach suggested by the linter here is more concise, but ir break intellisense for the constructor.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t\t\t\tnew (data: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;\n\t\t\t});\n\n/**\n * Internal helper for utilities that return schema which can be used in class and non class formats depending on the API exposing it.\n */\nexport type TreeNodeSchemaBoth<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode = TreeNode,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTConstructorExtra = never,\n\tTCustomMetadata = unknown,\n> = TreeNodeSchemaClass<\n\tName,\n\tKind,\n\tTNode,\n\tTInsertable,\n\tImplicitlyConstructable,\n\tInfo,\n\tTConstructorExtra,\n\tTCustomMetadata\n> &\n\tTreeNodeSchemaNonClass<\n\t\tName,\n\t\tKind,\n\t\tTNode,\n\t\tTInsertable,\n\t\tImplicitlyConstructable,\n\t\tInfo,\n\t\tTConstructorExtra,\n\t\tTCustomMetadata\n\t>;\n\n/**\n * Data common to all tree node schema.\n * @remarks\n * Implementation detail of {@link TreeNodeSchema} which should be accessed instead of referring to this type directly.\n * @sealed @public\n */\nexport interface TreeNodeSchemaCore<\n\tout Name extends string,\n\tout Kind extends NodeKind,\n\tout ImplicitlyConstructable extends boolean,\n\tout Info = unknown,\n\tout TInsertable = never,\n\tout TCustomMetadata = unknown,\n> {\n\t/**\n\t * Unique (within a document's schema) identifier used to associate nodes with their schema.\n\t * @remarks\n\t * This is used when encoding nodes, and when decoding nodes to re-associate them with the schema.\n\t * Since this decoding may happen in a different version of the application (or even a different application altogether),\n\t * this identifier should generally correspond to some specific semantics for the data (how to interpret the node with this identifier).\n\t * Any time the semantics change such that data would be misinterpreted if the old semantics were applied\n\t * (for example the units of a value are changed),\n\t * it is best practice to pick a new identifier.\n\t */\n\treadonly identifier: Name;\n\treadonly kind: Kind;\n\n\t/**\n\t * Data used to define this schema.\n\t *\n\t * @remarks\n\t * The format depends on the kind of node it is for.\n\t * For example, the \"object\" node kind could store the field schema here.\n\t */\n\treadonly info: Info;\n\n\t/**\n\t * When constructing insertable content,\n\t * data that could be passed to the node's constructor can be used instead of an {@link Unhydrated} node\n\t * iff implicitlyConstructable is true.\n\t * @privateRemarks\n\t * Currently the logic for traversing insertable content,\n\t * both to build trees and to hydrate them does not defer to the schema classes to handle the policy,\n\t * so if their constructors differ from what is supported, some cases will not work.\n\t * Setting this to false adjusts the insertable types to disallow cases which could be impacted by these inconsistencies.\n\t */\n\treadonly implicitlyConstructable: ImplicitlyConstructable;\n\n\t/**\n\t * All possible schema that a direct child of a node with this schema could have.\n\t *\n\t * Equivalently, this is also all schema directly referenced when defining this schema's allowed child types,\n\t * which is also the same as the set of schema referenced directly by the `Info` type parameter and the `info` property.\n\t * This property is simply re-exposing that information in an easier to traverse format consistent across all node kinds.\n\t * @remarks\n\t * Some kinds of nodes may have additional restrictions on children:\n\t * this set simply enumerates all directly referenced schema, and can be use to walk over all referenced schema types.\n\t *\n\t * This set cannot be used before the schema in it have been defined:\n\t * more specifically, when using lazy schema references (for example to make foreword references to schema which have not yet been defined),\n\t * users must wait until after the schema are defined to access this set.\n\t * @privateRemarks\n\t * Currently there isn't much use for this in the public API,\n\t * and it's possible this will want to be tweaked or renamed as part of a larger schema reflection API surface that might be added later.\n\t * To keep options option, this is marked `@system` for now.\n\t * @system\n\t */\n\treadonly childTypes: ReadonlySet<TreeNodeSchema>;\n\n\t/**\n\t * User-provided {@link NodeSchemaMetadata} for this schema.\n\t */\n\treadonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;\n\n\t/**\n\t * Constructs an instance of this node type.\n\t * @remarks\n\t * Due to TypeScript limitations, the return type of this method can not be very specific.\n\t * For {@link TreeNodeSchemaClass} prefer using the constructor directly for better typing.\n\t * For {@link TreeNodeSchemaNonClass} use `create`.\n\t *\n\t * @privateRemarks\n\t * This method signature provides a way to infer `TInsertable` without relying on the constructor, and to construct nodes from schema of unknown kind.\n\t * This makes customizations of the constructor not impact the typing of insertable content, allowing customization of the constructor,\n\t * as long as doing so only adds additional supported cases.\n\t *\n\t * This cannot be required to return `TNode`:\n\t * doing so breaks sub-classing of schema since they don't overload this method with a more specific return type.\n\t * @sealed @system\n\t */\n\tcreateFromInsertable(data: TInsertable): Unhydrated<TreeNode | TreeLeafValue>;\n}\n\n/**\n * Kind of tree node.\n * @remarks\n * More kinds may be added over time, so do not assume this is an exhaustive set.\n * @public\n */\nexport enum NodeKind {\n\t/**\n\t * A node which serves as a map, storing children under string keys.\n\t */\n\tMap,\n\t/**\n\t * A node which serves as an array, storing children in an ordered sequence.\n\t */\n\tArray,\n\t/**\n\t * A node which stores a heterogenous collection of children in named fields.\n\t * @remarks\n\t * Each field gets its own schema.\n\t */\n\tObject,\n\t/**\n\t * A node which stores a single leaf value.\n\t */\n\tLeaf,\n}\n"]}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { typeNameSymbol, typeSchemaSymbol, type WithType, type TreeNodeSchema, NodeKind, type TreeNodeSchemaClass, type TreeNodeSchemaNonClass, type TreeNodeSchemaCore, type TreeChangeEvents, type TreeNode, type Unhydrated, type InternalTreeNode, isTreeNode, tryDisposeTreeNode, HydratedContext, SimpleContextSlot, getOrCreateInnerNode, getKernel, } from "./core/index.js";
|
|
6
|
-
export { type ITree, type TreeView, type ViewableTree, type TreeViewEvents, TreeViewConfiguration, type ITreeViewConfiguration, type SchemaCompatibilityStatus, type ITreeConfigurationOptions, SchemaFactory, type ScopedSchemaName, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode, treeNodeApi, type TreeNodeApi, cursorFromInsertable, createFromInsertable, type NodeChangedData, TreeBeta, type TreeChangeEventsBeta, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, type SimpleNodeSchemaBase, type SimpleTreeSchema, type SimpleNodeSchema, type SimpleFieldSchema, type SimpleLeafNodeSchema, type SimpleMapNodeSchema, type SimpleArrayNodeSchema, type SimpleObjectNodeSchema, type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type JsonArrayNodeSchema, type JsonMapNodeSchema, type JsonLeafNodeSchema, type JsonSchemaRef, type JsonRefPath, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonTreeSchema, type JsonFieldSchema, type JsonLeafSchemaType, getJsonSchema, getSimpleSchema, type VerboseTreeNode, type EncodeOptions, type ParseOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, comparePersistedSchemaInternal, ViewSchema, type Unenforced, type FieldHasDefaultUnsafe, type ObjectFromSchemaRecordUnsafe, type TreeObjectNodeUnsafe, type TreeFieldFromImplicitFieldUnsafe, type TreeNodeFromImplicitAllowedTypesUnsafe, type FieldSchemaUnsafe, type InsertableTreeNodeFromImplicitAllowedTypesUnsafe, type TreeArrayNodeUnsafe, type TreeMapNodeUnsafe, type InsertableObjectFromSchemaRecordUnsafe, type InsertableTreeFieldFromImplicitFieldUnsafe, type InsertableTypedNodeUnsafe, type NodeBuilderDataUnsafe, type NodeFromSchemaUnsafe, type ReadonlyMapInlined, type TreeNodeSchemaClassUnsafe, type TreeNodeSchemaUnsafe, type AllowedTypesUnsafe, type TreeNodeSchemaNonClassUnsafe, type InsertableTreeNodeFromAllowedTypesUnsafe, type TreeViewAlpha, type TreeBranch, type TreeBranchEvents, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, } from "./api/index.js";
|
|
7
|
-
export { type NodeFromSchema, isTreeNodeSchemaClass, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type ImplicitAllowedTypes, type TreeNodeFromImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, type AllowedTypes, FieldKind, FieldSchema, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, type NodeBuilderData, type DefaultProvider, type FieldProps, normalizeFieldSchema, areFieldSchemaEqual, areImplicitFieldSchemaEqual, type ApplyKind, type FieldSchemaMetadata, type InsertableField, type Insertable, type UnsafeUnknownSchema, normalizeAllowedTypes, type ApplyKindInput, type InsertableTreeNodeFromAllowedTypes, type Input, type ReadableField, type ReadSchema, } from "./schemaTypes.js";
|
|
6
|
+
export { type ITree, type TreeView, type ViewableTree, type TreeViewEvents, TreeViewConfiguration, type ITreeViewConfiguration, type SchemaCompatibilityStatus, type ITreeConfigurationOptions, SchemaFactory, SchemaFactoryAlpha, type SchemaFactoryObjectOptions, type ScopedSchemaName, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, test_RecursiveObject, test_RecursiveObject_base, test_RecursiveObjectPojoMode, treeNodeApi, type TreeNodeApi, cursorFromInsertable, createFromInsertable, type NodeChangedData, TreeBeta, type TreeChangeEventsBeta, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, type SimpleNodeSchemaBase, type SimpleTreeSchema, type SimpleNodeSchema, type SimpleFieldSchema, type SimpleLeafNodeSchema, type SimpleMapNodeSchema, type SimpleArrayNodeSchema, type SimpleObjectNodeSchema, type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type JsonArrayNodeSchema, type JsonMapNodeSchema, type JsonLeafNodeSchema, type JsonSchemaRef, type JsonRefPath, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonTreeSchema, type JsonFieldSchema, type JsonLeafSchemaType, getJsonSchema, getSimpleSchema, type VerboseTreeNode, type EncodeOptions, type ParseOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, comparePersistedSchemaInternal, ViewSchema, type Unenforced, type FieldHasDefaultUnsafe, type ObjectFromSchemaRecordUnsafe, type TreeObjectNodeUnsafe, type TreeFieldFromImplicitFieldUnsafe, type TreeNodeFromImplicitAllowedTypesUnsafe, type FieldSchemaUnsafe, type InsertableTreeNodeFromImplicitAllowedTypesUnsafe, type TreeArrayNodeUnsafe, type TreeMapNodeUnsafe, type InsertableObjectFromSchemaRecordUnsafe, type InsertableTreeFieldFromImplicitFieldUnsafe, type InsertableTypedNodeUnsafe, type NodeBuilderDataUnsafe, type NodeFromSchemaUnsafe, type ReadonlyMapInlined, type TreeNodeSchemaClassUnsafe, type TreeNodeSchemaUnsafe, type AllowedTypesUnsafe, type TreeNodeSchemaNonClassUnsafe, type InsertableTreeNodeFromAllowedTypesUnsafe, type TreeViewAlpha, type TreeBranch, type TreeBranchEvents, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, type CustomTreeNode, type CustomTreeValue, tryStoredSchemaAsArray, } from "./api/index.js";
|
|
7
|
+
export { type NodeFromSchema, isTreeNodeSchemaClass, type ImplicitFieldSchema, type TreeFieldFromImplicitField, type ImplicitAllowedTypes, type TreeNodeFromImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, type AllowedTypes, FieldKind, FieldSchema, type InsertableTreeFieldFromImplicitField, type InsertableTypedNode, type NodeBuilderData, type DefaultProvider, type FieldProps, normalizeFieldSchema, areFieldSchemaEqual, areImplicitFieldSchemaEqual, type ApplyKind, type FieldSchemaMetadata, type InsertableField, type Insertable, type UnsafeUnknownSchema, normalizeAllowedTypes, type ApplyKindInput, type InsertableTreeNodeFromAllowedTypes, type Input, type ReadableField, type ReadSchema, type NodeSchemaOptions, type NodeSchemaMetadata, } from "./schemaTypes.js";
|
|
8
8
|
export { getTreeNodeForField, prepareContentForHydration, } from "./proxies.js";
|
|
9
9
|
export { TreeArrayNode, IterableTreeArrayContent, type ReadonlyArrayNode, } from "./arrayNode.js";
|
|
10
|
-
export { type FieldHasDefault, type InsertableObjectFromSchemaRecord, type ObjectFromSchemaRecord, type TreeObjectNode, setField, } from "./objectNode.js";
|
|
10
|
+
export { type FieldHasDefault, type InsertableObjectFromSchemaRecord, type ObjectFromSchemaRecord, type TreeObjectNode, setField, createUnknownOptionalFieldPolicy, } from "./objectNode.js";
|
|
11
11
|
export type { TreeMapNode, MapNodeInsertableData } from "./mapNode.js";
|
|
12
12
|
export { mapTreeFromNodeData, type InsertableContent, type FactoryContent, type FactoryContentObject, } from "./toMapTree.js";
|
|
13
13
|
export { toStoredSchema, getStoredSchema } from "./toStoredSchema.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAGrB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,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,gCAAgC,EACrC,KAAK,sCAAsC,EAC3C,KAAK,iBAAiB,EACtB,KAAK,gDAAgD,EACrD,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,sCAAsC,EAC3C,KAAK,0CAA0C,EAC/C,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,4BAA4B,EACjC,KAAK,wCAAwC,EAC7C,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,YAAY,EACZ,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAGrB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,aAAa,EACb,kBAAkB,EAClB,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACr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AAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EACN,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,oBAAoB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,GACV,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
exports.nullSchema = exports.handleSchema = exports.booleanSchema = exports.stringSchema = exports.numberSchema = exports.getStoredSchema = void 0;
|
|
7
|
+
exports.IterableTreeArrayContent = exports.TreeArrayNode = exports.prepareContentForHydration = exports.getTreeNodeForField = exports.normalizeAllowedTypes = exports.areImplicitFieldSchemaEqual = exports.areFieldSchemaEqual = exports.normalizeFieldSchema = exports.FieldSchema = exports.FieldKind = exports.isTreeNodeSchemaClass = exports.tryStoredSchemaAsArray = exports.customFromCursorStored = exports.asTreeViewAlpha = exports.createFromCursor = exports.conciseFromCursor = exports.verboseFromCursor = exports.cursorFromVerbose = exports.applySchemaToParserOptions = exports.tryGetSchema = exports.ViewSchema = exports.comparePersistedSchemaInternal = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.getSimpleSchema = exports.getJsonSchema = exports.createIdentifierIndex = exports.createSimpleTreeIndex = exports.TreeBeta = exports.createFromInsertable = exports.cursorFromInsertable = exports.treeNodeApi = exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.SchemaFactoryAlpha = exports.SchemaFactory = exports.TreeViewConfiguration = exports.getKernel = exports.getOrCreateInnerNode = exports.SimpleContextSlot = exports.HydratedContext = exports.tryDisposeTreeNode = exports.isTreeNode = exports.NodeKind = exports.typeSchemaSymbol = exports.typeNameSymbol = void 0;
|
|
8
|
+
exports.nullSchema = exports.handleSchema = exports.booleanSchema = exports.stringSchema = exports.numberSchema = exports.getStoredSchema = exports.toStoredSchema = exports.mapTreeFromNodeData = exports.createUnknownOptionalFieldPolicy = exports.setField = void 0;
|
|
9
9
|
var index_js_1 = require("./core/index.js");
|
|
10
10
|
Object.defineProperty(exports, "typeNameSymbol", { enumerable: true, get: function () { return index_js_1.typeNameSymbol; } });
|
|
11
11
|
Object.defineProperty(exports, "typeSchemaSymbol", { enumerable: true, get: function () { return index_js_1.typeSchemaSymbol; } });
|
|
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "getKernel", { enumerable: true, get: function ()
|
|
|
19
19
|
var index_js_2 = require("./api/index.js");
|
|
20
20
|
Object.defineProperty(exports, "TreeViewConfiguration", { enumerable: true, get: function () { return index_js_2.TreeViewConfiguration; } });
|
|
21
21
|
Object.defineProperty(exports, "SchemaFactory", { enumerable: true, get: function () { return index_js_2.SchemaFactory; } });
|
|
22
|
+
Object.defineProperty(exports, "SchemaFactoryAlpha", { enumerable: true, get: function () { return index_js_2.SchemaFactoryAlpha; } });
|
|
22
23
|
Object.defineProperty(exports, "adaptEnum", { enumerable: true, get: function () { return index_js_2.adaptEnum; } });
|
|
23
24
|
Object.defineProperty(exports, "enumFromStrings", { enumerable: true, get: function () { return index_js_2.enumFromStrings; } });
|
|
24
25
|
Object.defineProperty(exports, "singletonSchema", { enumerable: true, get: function () { return index_js_2.singletonSchema; } });
|
|
@@ -44,6 +45,8 @@ Object.defineProperty(exports, "verboseFromCursor", { enumerable: true, get: fun
|
|
|
44
45
|
Object.defineProperty(exports, "conciseFromCursor", { enumerable: true, get: function () { return index_js_2.conciseFromCursor; } });
|
|
45
46
|
Object.defineProperty(exports, "createFromCursor", { enumerable: true, get: function () { return index_js_2.createFromCursor; } });
|
|
46
47
|
Object.defineProperty(exports, "asTreeViewAlpha", { enumerable: true, get: function () { return index_js_2.asTreeViewAlpha; } });
|
|
48
|
+
Object.defineProperty(exports, "customFromCursorStored", { enumerable: true, get: function () { return index_js_2.customFromCursorStored; } });
|
|
49
|
+
Object.defineProperty(exports, "tryStoredSchemaAsArray", { enumerable: true, get: function () { return index_js_2.tryStoredSchemaAsArray; } });
|
|
47
50
|
var schemaTypes_js_1 = require("./schemaTypes.js");
|
|
48
51
|
Object.defineProperty(exports, "isTreeNodeSchemaClass", { enumerable: true, get: function () { return schemaTypes_js_1.isTreeNodeSchemaClass; } });
|
|
49
52
|
Object.defineProperty(exports, "FieldKind", { enumerable: true, get: function () { return schemaTypes_js_1.FieldKind; } });
|
|
@@ -60,6 +63,7 @@ Object.defineProperty(exports, "TreeArrayNode", { enumerable: true, get: functio
|
|
|
60
63
|
Object.defineProperty(exports, "IterableTreeArrayContent", { enumerable: true, get: function () { return arrayNode_js_1.IterableTreeArrayContent; } });
|
|
61
64
|
var objectNode_js_1 = require("./objectNode.js");
|
|
62
65
|
Object.defineProperty(exports, "setField", { enumerable: true, get: function () { return objectNode_js_1.setField; } });
|
|
66
|
+
Object.defineProperty(exports, "createUnknownOptionalFieldPolicy", { enumerable: true, get: function () { return objectNode_js_1.createUnknownOptionalFieldPolicy; } });
|
|
63
67
|
var toMapTree_js_1 = require("./toMapTree.js");
|
|
64
68
|
Object.defineProperty(exports, "mapTreeFromNodeData", { enumerable: true, get: function () { return toMapTree_js_1.mapTreeFromNodeData; } });
|
|
65
69
|
var toStoredSchema_js_1 = require("./toStoredSchema.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,4CAqByB;AApBxB,0GAAA,cAAc,OAAA;AACd,4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AAA,iBAAiB,OAAA;AACjB,6GAAA,iBAAiB,OAAA;AACjB,4GAAA,gBAAgB,OAAA;AAChB,2GAAA,eAAe,OAAA;AACf,kHAAA,sBAAsB,OAAA;AAGtB,kHAAA,sBAAsB,OAAA;AAEvB,mDAiC0B;AA/BzB,uHAAA,qBAAqB,OAAA;AAQrB,2GAAA,SAAS,OAAA;AACT,6GAAA,WAAW,OAAA;AAMX,sHAAA,oBAAoB,OAAA;AACpB,qHAAA,mBAAmB,OAAA;AACnB,6HAAA,2BAA2B,OAAA;AAM3B,uHAAA,qBAAqB,OAAA;AAStB,2CAGsB;AAFrB,iHAAA,mBAAmB,OAAA;AACnB,wHAAA,0BAA0B,OAAA;AAE3B,+CAIwB;AAHvB,6GAAA,aAAa,OAAA;AACb,wHAAA,wBAAwB,OAAA;AAGzB,iDAOyB;AAFxB,yGAAA,QAAQ,OAAA;AACR,iIAAA,gCAAgC,OAAA;AAGjC,+CAKwB;AAJvB,mHAAA,mBAAmB,OAAA;AAKpB,yDAAsE;AAA7D,mHAAA,cAAc,OAAA;AAAE,oHAAA,eAAe,OAAA;AACxC,yDAM6B;AAL5B,iHAAA,YAAY,OAAA;AACZ,iHAAA,YAAY,OAAA;AACZ,kHAAA,aAAa,OAAA;AACb,iHAAA,YAAY,OAAA;AACZ,+GAAA,UAAU,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttypeNameSymbol,\n\ttypeSchemaSymbol,\n\ttype WithType,\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype TreeNodeSchemaClass,\n\ttype TreeNodeSchemaNonClass,\n\ttype TreeNodeSchemaCore,\n\ttype TreeChangeEvents,\n\t// TreeNode is only type exported, which prevents use of the class object for unsupported use-cases like direct sub-classing and instanceof.\n\t// See docs on TreeNode for more details.\n\ttype TreeNode,\n\ttype Unhydrated,\n\ttype InternalTreeNode,\n\tisTreeNode,\n\ttryDisposeTreeNode,\n\tHydratedContext,\n\tSimpleContextSlot,\n\tgetOrCreateInnerNode,\n\tgetKernel,\n} from \"./core/index.js\";\nexport {\n\ttype ITree,\n\ttype TreeView,\n\ttype ViewableTree,\n\ttype TreeViewEvents,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype SchemaCompatibilityStatus,\n\ttype ITreeConfigurationOptions,\n\tSchemaFactory,\n\tSchemaFactoryAlpha,\n\ttype SchemaFactoryObjectOptions,\n\ttype ScopedSchemaName,\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttest_RecursiveObject,\n\ttest_RecursiveObject_base,\n\ttest_RecursiveObjectPojoMode,\n\ttreeNodeApi,\n\ttype TreeNodeApi,\n\tcursorFromInsertable,\n\tcreateFromInsertable,\n\ttype NodeChangedData,\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\ttype SimpleTreeIndex,\n\ttype IdentifierIndex,\n\tcreateSimpleTreeIndex,\n\tcreateIdentifierIndex,\n\ttype SimpleNodeSchemaBase,\n\ttype SimpleTreeSchema,\n\ttype SimpleNodeSchema,\n\ttype SimpleFieldSchema,\n\ttype SimpleLeafNodeSchema,\n\ttype SimpleMapNodeSchema,\n\ttype SimpleArrayNodeSchema,\n\ttype SimpleObjectNodeSchema,\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n\tgetJsonSchema,\n\tgetSimpleSchema,\n\ttype VerboseTreeNode,\n\ttype EncodeOptions,\n\ttype ParseOptions,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n\ttype ConciseTree,\n\tcomparePersistedSchemaInternal,\n\tViewSchema,\n\ttype Unenforced,\n\ttype FieldHasDefaultUnsafe,\n\ttype ObjectFromSchemaRecordUnsafe,\n\ttype TreeObjectNodeUnsafe,\n\ttype TreeFieldFromImplicitFieldUnsafe,\n\ttype TreeNodeFromImplicitAllowedTypesUnsafe,\n\ttype FieldSchemaUnsafe,\n\ttype InsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\ttype TreeArrayNodeUnsafe,\n\ttype TreeMapNodeUnsafe,\n\ttype InsertableObjectFromSchemaRecordUnsafe,\n\ttype InsertableTreeFieldFromImplicitFieldUnsafe,\n\ttype InsertableTypedNodeUnsafe,\n\ttype NodeBuilderDataUnsafe,\n\ttype NodeFromSchemaUnsafe,\n\ttype ReadonlyMapInlined,\n\ttype TreeNodeSchemaClassUnsafe,\n\ttype TreeNodeSchemaUnsafe,\n\ttype AllowedTypesUnsafe,\n\ttype TreeNodeSchemaNonClassUnsafe,\n\ttype InsertableTreeNodeFromAllowedTypesUnsafe,\n\ttype TreeViewAlpha,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\ttryGetSchema,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\tconciseFromCursor,\n\tcreateFromCursor,\n\tasTreeViewAlpha,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\n} from \"./api/index.js\";\nexport {\n\ttype NodeFromSchema,\n\tisTreeNodeSchemaClass,\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\ttype AllowedTypes,\n\tFieldKind,\n\tFieldSchema,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InsertableTypedNode,\n\ttype NodeBuilderData,\n\ttype DefaultProvider,\n\ttype FieldProps,\n\tnormalizeFieldSchema,\n\tareFieldSchemaEqual,\n\tareImplicitFieldSchemaEqual,\n\ttype ApplyKind,\n\ttype FieldSchemaMetadata,\n\ttype InsertableField,\n\ttype Insertable,\n\ttype UnsafeUnknownSchema,\n\tnormalizeAllowedTypes,\n\ttype ApplyKindInput,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype Input,\n\ttype ReadableField,\n\ttype ReadSchema,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaMetadata,\n} from \"./schemaTypes.js\";\nexport {\n\tgetTreeNodeForField,\n\tprepareContentForHydration,\n} from \"./proxies.js\";\nexport {\n\tTreeArrayNode,\n\tIterableTreeArrayContent,\n\ttype ReadonlyArrayNode,\n} from \"./arrayNode.js\";\nexport {\n\ttype FieldHasDefault,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype ObjectFromSchemaRecord,\n\ttype TreeObjectNode,\n\tsetField,\n\tcreateUnknownOptionalFieldPolicy,\n} from \"./objectNode.js\";\nexport type { TreeMapNode, MapNodeInsertableData } from \"./mapNode.js\";\nexport {\n\tmapTreeFromNodeData,\n\ttype InsertableContent,\n\ttype FactoryContent,\n\ttype FactoryContentObject,\n} from \"./toMapTree.js\";\nexport { toStoredSchema, getStoredSchema } from \"./toStoredSchema.js\";\nexport {\n\tnumberSchema,\n\tstringSchema,\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n} from \"./leafNodeSchema.js\";\nexport type { LazyItem, FlexList, FlexListToUnion, ExtractItemType } from \"./flexList.js\";\n"]}
|
|
@@ -24,24 +24,9 @@ export declare class LeafNodeSchema<Name extends string, const T extends ValueSc
|
|
|
24
24
|
createFromInsertable(data: TreeValue<T>): TreeValue<T>;
|
|
25
25
|
constructor(name: Name, t: T);
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export declare const
|
|
31
|
-
|
|
32
|
-
* @internal
|
|
33
|
-
*/
|
|
34
|
-
export declare const numberSchema: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never>;
|
|
35
|
-
/**
|
|
36
|
-
* @internal
|
|
37
|
-
*/
|
|
38
|
-
export declare const booleanSchema: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never>;
|
|
39
|
-
/**
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
export declare const nullSchema: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never>;
|
|
43
|
-
/**
|
|
44
|
-
* @internal
|
|
45
|
-
*/
|
|
46
|
-
export declare const handleSchema: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, import("@fluidframework/core-interfaces").IFluidHandle<unknown>, import("@fluidframework/core-interfaces").IFluidHandle<unknown>, true, unknown, never>;
|
|
27
|
+
export declare const stringSchema: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>;
|
|
28
|
+
export declare const numberSchema: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>;
|
|
29
|
+
export declare const booleanSchema: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>;
|
|
30
|
+
export declare const nullSchema: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>;
|
|
31
|
+
export declare const handleSchema: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, import("@fluidframework/core-interfaces").IFluidHandle<unknown>, import("@fluidframework/core-interfaces").IFluidHandle<unknown>, true, unknown, never, unknown>;
|
|
47
32
|
//# sourceMappingURL=leafNodeSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leafNodeSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/leafNodeSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACN,KAAK,YAAY,EAGjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,KAAK,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE7F;;;;;;;;GAQG;AACH,qBAAa,cAAc,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,CAAC,CAAC,SAAS,WAAW,CAC3E,YAAW,sBAAsB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAElF,SAAgB,UAAU,EAAE,IAAI,CAAC;IACjC,SAAgB,IAAI,iBAAiB;IACrC,SAAgB,IAAI,EAAE,CAAC,CAAC;IACxB,SAAgB,uBAAuB,OAAiB;IACxD,SAAgB,UAAU,EAAE,WAAW,CAAC,cAAc,CAAC,CAAa;IAE7D,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC;IASvD,oBAAoB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;gBAI1C,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;CAInC;AAoBD
|
|
1
|
+
{"version":3,"file":"leafNodeSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/leafNodeSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACN,KAAK,YAAY,EAGjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,KAAK,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE7F;;;;;;;;GAQG;AACH,qBAAa,cAAc,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,CAAC,CAAC,SAAS,WAAW,CAC3E,YAAW,sBAAsB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAElF,SAAgB,UAAU,EAAE,IAAI,CAAC;IACjC,SAAgB,IAAI,iBAAiB;IACrC,SAAgB,IAAI,EAAE,CAAC,CAAC;IACxB,SAAgB,uBAAuB,OAAiB;IACxD,SAAgB,UAAU,EAAE,WAAW,CAAC,cAAc,CAAC,CAAa;IAE7D,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC;IASvD,oBAAoB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;gBAI1C,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;CAInC;AAoBD,eAAO,MAAM,YAAY,wHAAyC,CAAC;AACnE,eAAO,MAAM,YAAY,wHAAyC,CAAC;AACnE,eAAO,MAAM,aAAa,2HAA2C,CAAC;AACtE,eAAO,MAAM,UAAU,kHAAqC,CAAC;AAC7D,eAAO,MAAM,YAAY,0OAA8C,CAAC"}
|
|
@@ -47,24 +47,9 @@ function makeLeaf(name, t) {
|
|
|
47
47
|
return new LeafNodeSchema(`com.fluidframework.leaf.${name}`, t);
|
|
48
48
|
}
|
|
49
49
|
// Leaf schema shared between all SchemaFactory instances.
|
|
50
|
-
/**
|
|
51
|
-
* @internal
|
|
52
|
-
*/
|
|
53
50
|
exports.stringSchema = makeLeaf("string", index_js_1.ValueSchema.String);
|
|
54
|
-
/**
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
51
|
exports.numberSchema = makeLeaf("number", index_js_1.ValueSchema.Number);
|
|
58
|
-
/**
|
|
59
|
-
* @internal
|
|
60
|
-
*/
|
|
61
52
|
exports.booleanSchema = makeLeaf("boolean", index_js_1.ValueSchema.Boolean);
|
|
62
|
-
/**
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
53
|
exports.nullSchema = makeLeaf("null", index_js_1.ValueSchema.Null);
|
|
66
|
-
/**
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
69
54
|
exports.handleSchema = makeLeaf("handle", index_js_1.ValueSchema.FluidHandle);
|
|
70
55
|
//# sourceMappingURL=leafNodeSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leafNodeSchema.js","sourceRoot":"","sources":["../../src/simple-tree/leafNodeSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,+CAA+D;AAC/D,4DAIuC;AACvC,8CAA6F;AAE7F;;;;;;;;GAQG;AACH,MAAa,cAAc;IASnB,MAAM,CAAC,IAAiC;QAC9C,IAAI,IAAA,yBAAc,EAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACzB,IAAA,iBAAM,EAAC,IAAA,4BAAiB,EAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACvE,OAAO,KAAK,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,oBAAoB,CAAC,IAAkB;QAC7C,OAAO,IAAI,CAAC;IACb,CAAC;IAED,YAAmB,IAAU,EAAE,CAAI;QAlBnB,SAAI,GAAG,mBAAQ,CAAC,IAAI,CAAC;QAErB,4BAAuB,GAAG,IAAa,CAAC;QACxC,eAAU,GAAgC,IAAI,GAAG,EAAE,CAAC;QAgBnE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,CAAC,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DAA0D;AAC7C,QAAA,YAAY,GAAG,QAAQ,CAAC,QAAQ,EAAE,sBAAW,CAAC,MAAM,CAAC,CAAC;AACtD,QAAA,YAAY,GAAG,QAAQ,CAAC,QAAQ,EAAE,sBAAW,CAAC,MAAM,CAAC,CAAC;AACtD,QAAA,aAAa,GAAG,QAAQ,CAAC,SAAS,EAAE,sBAAW,CAAC,OAAO,CAAC,CAAC;AACzD,QAAA,UAAU,GAAG,QAAQ,CAAC,MAAM,EAAE,sBAAW,CAAC,IAAI,CAAC,CAAC;AAChD,QAAA,YAAY,GAAG,QAAQ,CAAC,QAAQ,EAAE,sBAAW,CAAC,WAAW,CAAC,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 { type TreeValue, ValueSchema } from \"../core/index.js\";\nimport {\n\ttype FlexTreeNode,\n\tisFlexTreeNode,\n\tvalueSchemaAllows,\n} from \"../feature-libraries/index.js\";\nimport { NodeKind, type TreeNodeSchema, type TreeNodeSchemaNonClass } from \"./core/index.js\";\n\n/**\n * Instances of this class are schema for leaf nodes.\n * @remarks\n * Unlike other schema, leaf schema are class instances instead of classes themselves.\n * This is because the instance type (the tree node type) for leaves are not objects,\n * so those instances can't be instances of a schema based class.\n * @privateRemarks\n * This class refers to the underlying flex tree schema in its constructor, so this class can't be included in the package API.\n */\nexport class LeafNodeSchema<Name extends string, const T extends ValueSchema>\n\timplements TreeNodeSchemaNonClass<Name, NodeKind.Leaf, TreeValue<T>, TreeValue<T>>\n{\n\tpublic readonly identifier: Name;\n\tpublic readonly kind = NodeKind.Leaf;\n\tpublic readonly info: T;\n\tpublic readonly implicitlyConstructable = true as const;\n\tpublic readonly childTypes: ReadonlySet<TreeNodeSchema> = new Set();\n\n\tpublic create(data: TreeValue<T> | FlexTreeNode): TreeValue<T> {\n\t\tif (isFlexTreeNode(data)) {\n\t\t\tconst value = data.value;\n\t\t\tassert(valueSchemaAllows(this.info, value), 0x916 /* invalid value */);\n\t\t\treturn value;\n\t\t}\n\t\treturn data;\n\t}\n\n\tpublic createFromInsertable(data: TreeValue<T>): TreeValue<T> {\n\t\treturn data;\n\t}\n\n\tpublic constructor(name: Name, t: T) {\n\t\tthis.identifier = name;\n\t\tthis.info = t;\n\t}\n}\n\n/**\n * Wrapper around LeafNodeSchema's constructor that provides the return type that is desired in the package public API.\n */\nfunction makeLeaf<Name extends string, const T extends ValueSchema>(\n\tname: Name,\n\tt: T,\n): TreeNodeSchema<\n\t`com.fluidframework.leaf.${Name}`,\n\tNodeKind.Leaf,\n\tTreeValue<T>,\n\tTreeValue<T>,\n\ttrue\n> {\n\t// Names in this domain follow https://en.wikipedia.org/wiki/Reverse_domain_name_notation\n\treturn new LeafNodeSchema(`com.fluidframework.leaf.${name}`, t);\n}\n\n// Leaf schema shared between all SchemaFactory instances.\nexport const stringSchema = makeLeaf(\"string\", ValueSchema.String);\nexport const numberSchema = makeLeaf(\"number\", ValueSchema.Number);\nexport const booleanSchema = makeLeaf(\"boolean\", ValueSchema.Boolean);\nexport const nullSchema = makeLeaf(\"null\", ValueSchema.Null);\nexport const handleSchema = makeLeaf(\"handle\", ValueSchema.FluidHandle);\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { type ImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeNodeFromImplicitAllowedTypes } from "./schemaTypes.js";
|
|
5
|
+
import { type ImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type NodeSchemaMetadata, type TreeNodeFromImplicitAllowedTypes } from "./schemaTypes.js";
|
|
6
6
|
import { NodeKind, type TreeNodeSchemaBoth, type WithType, type TreeNode } from "./core/index.js";
|
|
7
7
|
import { type RestrictiveStringRecord } from "../util/index.js";
|
|
8
8
|
/**
|
|
@@ -78,7 +78,7 @@ export interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTyp
|
|
|
78
78
|
* @param base - base schema type to extend.
|
|
79
79
|
* @param useMapPrototype - should this type emulate a ES6 Map object (by faking its prototype with a proxy).
|
|
80
80
|
*/
|
|
81
|
-
export declare function mapSchema<TName extends string, const T extends ImplicitAllowedTypes, const ImplicitlyConstructable extends boolean>(identifier: TName, info: T, implicitlyConstructable: ImplicitlyConstructable, useMapPrototype: boolean): TreeNodeSchemaBoth<TName, NodeKind.Map, TreeMapNode<T> & WithType<TName, NodeKind.Map, unknown>, MapNodeInsertableData<T>, ImplicitlyConstructable, T, undefined>;
|
|
81
|
+
export declare function mapSchema<TName extends string, const T extends ImplicitAllowedTypes, const ImplicitlyConstructable extends boolean, const TCustomMetadata = unknown>(identifier: TName, info: T, implicitlyConstructable: ImplicitlyConstructable, useMapPrototype: boolean, metadata?: NodeSchemaMetadata<TCustomMetadata>): TreeNodeSchemaBoth<TName, NodeKind.Map, TreeMapNode<T> & WithType<TName, NodeKind.Map, unknown>, MapNodeInsertableData<T>, ImplicitlyConstructable, T, undefined, TCustomMetadata>;
|
|
82
82
|
/**
|
|
83
83
|
* Content which can be used to construct a Map node, explicitly or implicitly.
|
|
84
84
|
* @system @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapNode.d.ts","sourceRoot":"","sources":["../../src/simple-tree/mapNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,EAIN,KAAK,oBAAoB,EACzB,KAAK,0CAA0C,EAC/C,KAAK,gCAAgC,EACrC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGN,QAAQ,EACR,KAAK,kBAAkB,EAEvB,KAAK,QAAQ,EAGb,KAAK,QAAQ,EAMb,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAAgB,KAAK,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAK9E;;;;;;;GAOG;AACH,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AK,CAAC,eAAe,GAAG,OAAO,EAE/B,UAAU,EAAE,KAAK,EACjB,IAAI,EAAE,CAAC,EACP,uBAAuB,EAAE,uBAAuB,EAChD,eAAe,EAAE,OAAO,EACxB,QAAQ,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,sLAkE9C;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,oBAAoB,IAC7D,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,0CAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,GAC1E,uBAAuB,CAAC,0CAA0C,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -95,7 +95,7 @@ CustomMapNodeBase.kind = index_js_2.NodeKind.Map;
|
|
|
95
95
|
* @param useMapPrototype - should this type emulate a ES6 Map object (by faking its prototype with a proxy).
|
|
96
96
|
*/
|
|
97
97
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
98
|
-
function mapSchema(identifier, info, implicitlyConstructable, useMapPrototype) {
|
|
98
|
+
function mapSchema(identifier, info, implicitlyConstructable, useMapPrototype, metadata) {
|
|
99
99
|
const lazyChildTypes = new internal_1.Lazy(() => (0, schemaTypes_js_1.normalizeAllowedTypes)(info));
|
|
100
100
|
let unhydratedContext;
|
|
101
101
|
class Schema extends CustomMapNodeBase {
|
|
@@ -128,6 +128,7 @@ function mapSchema(identifier, info, implicitlyConstructable, useMapPrototype) {
|
|
|
128
128
|
Schema.identifier = identifier;
|
|
129
129
|
Schema.info = info;
|
|
130
130
|
Schema.implicitlyConstructable = implicitlyConstructable;
|
|
131
|
+
Schema.metadata = metadata;
|
|
131
132
|
const schemaErased = Schema;
|
|
132
133
|
return schemaErased;
|
|
133
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapNode.js","sourceRoot":"","sources":["../../src/simple-tree/mapNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA2D;AAC3D,4DAKuC;A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,CAAU,YAAY,CAElC,QAA2B,EAC3B,KAAS;YAET,OAAO,iCAAsB,CAAC,WAAW,CACxC,iBAAiB,EACjB,IAAA,kCAAmB,EAAC,KAAuB,EAAE,IAAuC,CAAC,CACrF,CAAC;QACH,CAAC;QAIS,MAAM,CAAU,YAAY;YACrC,MAAM,MAAM,GAAG,IAAiC,CAAC;YACjD,iBAAiB,GAAG,IAAA,uCAAoB,EAAC,MAAM,CAAC,CAAC;YACjD,OAAO,iBAAiB,CAAC;QAC1B,CAAC;QAMM,MAAM,KAAK,UAAU;YAC3B,OAAO,cAAc,CAAC,KAAK,CAAC;QAC7B,CAAC;QAED,gDAAgD;QAChD,IAAW,CAAC,yBAAc,CAAC;YAC1B,OAAO,UAAU,CAAC;QACnB,CAAC;QACD,IAAW,CAAC,2BAAgB,CAAC;YAC5B,OAAO,MAAM,CAAC,iBAAiB,EAAE,WAA6C,CAAC;QAChF,CAAC;;IAtByB,wBAAiB,GAAgC,SAAS,CAAC;IAQ9D,iBAAU,GAAG,UAAU,CAAC;IACxB,WAAI,GAAG,IAAI,CAAC;IACZ,8BAAuB,GAC7C,uBAAuB,CAAC;IAa1B,MAAM,YAAY,GAQd,MAAM,CAAC;IACX,OAAO,YAAY,CAAC;AACrB,CAAC;AAvED,8BAuEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Lazy } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype OptionalFieldEditBuilder,\n\tgetSchemaAndPolicy,\n} from \"../feature-libraries/index.js\";\nimport { getTreeNodeForField, prepareContentForHydration } from \"./proxies.js\";\nimport {\n\tcreateFieldSchema,\n\tFieldKind,\n\tnormalizeAllowedTypes,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n} from \"./schemaTypes.js\";\nimport {\n\tgetKernel,\n\ttype InnerNode,\n\tNodeKind,\n\ttype TreeNodeSchemaBoth,\n\ttype TreeNodeSchema,\n\ttype WithType,\n\t// eslint-disable-next-line import/no-deprecated\n\ttypeNameSymbol,\n\ttype TreeNode,\n\ttypeSchemaSymbol,\n\ttype Context,\n\tUnhydratedFlexTreeNode,\n\tgetOrCreateInnerNode,\n\ttype InternalTreeNode,\n} from \"./core/index.js\";\nimport {\n\tmapTreeFromNodeData,\n\ttype FactoryContent,\n\ttype InsertableContent,\n} from \"./toMapTree.js\";\nimport { brand, count, type RestrictiveStringRecord } from \"../util/index.js\";\nimport { TreeNodeValid, type MostDerivedData } from \"./treeNodeValid.js\";\nimport type { ExclusiveMapTree } from \"../core/index.js\";\nimport { getUnhydratedContext } from \"./createContext.js\";\n\n/**\n * A map of string keys to tree objects.\n *\n * @privateRemarks\n * Add support for `clear` once we have established merge semantics for it.\n *\n * @sealed @public\n */\nexport interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTypes>\n\textends ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\tTreeNode {\n\t/**\n\t * Adds or updates an entry in the map with a specified `key` and a `value`.\n\t *\n\t * @param key - The key of the element to add to the map.\n\t * @param value - The value of the element to add to the map.\n\t *\n\t * @remarks\n\t * Setting the value at a key to `undefined` is equivalent to calling {@link TreeMapNode.delete} with that key.\n\t */\n\tset(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T> | undefined): void;\n\n\t/**\n\t * Removes the specified element from this map by its `key`.\n\t *\n\t * @remarks\n\t * Note: unlike JavaScript's Map API, this method does not return a flag indicating whether or not the value was\n\t * deleted.\n\t *\n\t * @privateRemarks\n\t * Regarding the choice to not return a boolean: Since this data structure is distributed in nature, it isn't\n\t * possible to tell whether or not the item was deleted as a result of this method call. Returning a \"best guess\"\n\t * is more likely to create issues / promote bad usage patterns than offer useful information.\n\t *\n\t * @param key - The key of the element to remove from the map.\n\t */\n\tdelete(key: string): void;\n\n\t/**\n\t * Returns an iterable of keys in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the keys returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tkeys(): IterableIterator<string>;\n\n\t/**\n\t * Returns an iterable of values in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the values returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tvalues(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>>;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the entries returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tentries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]>;\n\n\t/**\n\t * Executes the provided function once per each key/value pair in this map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order in which the function is called with respect to the map's entries.\n\t * If your usage scenario depends on consistent ordering, you will need to account for this.\n\t */\n\tforEach(\n\t\tcallbackfn: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tkey: string,\n\t\t\tmap: ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\t) => void,\n\t\t// Typing inherited from `ReadonlyMap`.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tthisArg?: any,\n\t): void;\n}\n\n// TreeMapNode is invariant over schema type, so for this handler to work with all schema, the only possible type for the schema is `any`.\n// This is not ideal, but no alternatives are possible.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst handler: ProxyHandler<TreeMapNode<any>> = {\n\tgetPrototypeOf: () => {\n\t\treturn Map.prototype;\n\t},\n};\n\nabstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends TreeNodeValid<\n\tMapNodeInsertableData<T>\n> {\n\tpublic static readonly kind = NodeKind.Map;\n\n\tpublic constructor(input?: InternalTreeNode | MapNodeInsertableData<T> | undefined) {\n\t\tsuper(input ?? []);\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> {\n\t\treturn this.entries();\n\t}\n\n\tprivate get innerNode(): InnerNode {\n\t\treturn getOrCreateInnerNode(this);\n\t}\n\n\tprivate editor(key: string): OptionalFieldEditBuilder<ExclusiveMapTree> {\n\t\tconst field = this.innerNode.getBoxed(brand(key)) as FlexTreeOptionalField;\n\t\treturn field.editor;\n\t}\n\n\tpublic delete(key: string): void {\n\t\tconst field = this.innerNode.getBoxed(brand(key));\n\t\tthis.editor(key).set(undefined, field.length === 0);\n\t}\n\tpublic *entries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> {\n\t\tconst node = this.innerNode;\n\t\tfor (const key of node.keys()) {\n\t\t\tyield [\n\t\t\t\tkey,\n\t\t\t\tgetTreeNodeForField(node.getBoxed(key)) as TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\t];\n\t\t}\n\t}\n\tpublic get(key: string): TreeNodeFromImplicitAllowedTypes<T> {\n\t\tconst node = this.innerNode;\n\t\tconst field = node.getBoxed(brand(key));\n\t\treturn getTreeNodeForField(field) as TreeNodeFromImplicitAllowedTypes<T>;\n\t}\n\tpublic has(key: string): boolean {\n\t\treturn this.innerNode.tryGetField(brand(key)) !== undefined;\n\t}\n\tpublic keys(): IterableIterator<string> {\n\t\tconst node = this.innerNode;\n\t\treturn node.keys();\n\t}\n\tpublic set(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T>): this {\n\t\tconst kernel = getKernel(this);\n\t\tconst node = this.innerNode;\n\t\tconst mapTree = mapTreeFromNodeData(\n\t\t\tvalue as InsertableContent | undefined,\n\t\t\tcreateFieldSchema(FieldKind.Optional, kernel.schema.info as ImplicitAllowedTypes),\n\t\t\tnode.context.isHydrated() ? node.context.nodeKeyManager : undefined,\n\t\t\tgetSchemaAndPolicy(node),\n\t\t);\n\n\t\tconst field = node.getBoxed(brand(key));\n\t\tif (node.context.isHydrated()) {\n\t\t\tprepareContentForHydration(mapTree, node.context.checkout.forest);\n\t\t}\n\n\t\tthis.editor(key).set(mapTree, field.length === 0);\n\t\treturn this;\n\t}\n\tpublic get size(): number {\n\t\treturn count(this.innerNode.keys());\n\t}\n\tpublic *values(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\tfor (const [, value] of this.entries()) {\n\t\t\tyield value;\n\t\t}\n\t}\n\tpublic forEach<TThis extends TreeMapNode<T>>(\n\t\tthis: TThis,\n\t\tcallbackFn: (value: TreeNodeFromImplicitAllowedTypes<T>, key: string, map: TThis) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tfor (const field of getOrCreateInnerNode(this).boxedIterator()) {\n\t\t\tconst node = getTreeNodeForField(field) as TreeNodeFromImplicitAllowedTypes<T>;\n\t\t\tcallbackFn.call(thisArg, node, field.key, this);\n\t\t}\n\t}\n\t// TODO: add `clear` once we have established merge semantics for it.\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n *\n * @param base - base schema type to extend.\n * @param useMapPrototype - should this type emulate a ES6 Map object (by faking its prototype with a proxy).\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function mapSchema<\n\tTName extends string,\n\tconst T extends ImplicitAllowedTypes,\n\tconst ImplicitlyConstructable extends boolean,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n\tuseMapPrototype: boolean,\n) {\n\tconst lazyChildTypes = new Lazy(() => normalizeAllowedTypes(info));\n\n\tlet unhydratedContext: Context;\n\n\tclass Schema extends CustomMapNodeBase<T> implements TreeMapNode<T> {\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\tif (useMapPrototype) {\n\t\t\t\treturn new Proxy<Schema>(instance as Schema, handler as ProxyHandler<Schema>);\n\t\t\t}\n\t\t\treturn instance;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn UnhydratedFlexTreeNode.getOrCreate(\n\t\t\t\tunhydratedContext,\n\t\t\t\tmapTreeFromNodeData(input as FactoryContent, this as unknown as ImplicitAllowedTypes),\n\t\t\t);\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>): Context {\n\t\t\tconst schema = this as unknown as TreeNodeSchema;\n\t\t\tunhydratedContext = getUnhydratedContext(schema);\n\t\t\treturn unhydratedContext;\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn lazyChildTypes.value;\n\t\t}\n\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): typeof schemaErased {\n\t\t\treturn Schema.constructorCached?.constructor as unknown as typeof schemaErased;\n\t\t}\n\t}\n\tconst schemaErased: TreeNodeSchemaBoth<\n\t\tTName,\n\t\tNodeKind.Map,\n\t\tTreeMapNode<T> & WithType<TName, NodeKind.Map>,\n\t\tMapNodeInsertableData<T>,\n\t\tImplicitlyConstructable,\n\t\tT,\n\t\tundefined\n\t> = Schema;\n\treturn schemaErased;\n}\n\n/**\n * Content which can be used to construct a Map node, explicitly or implicitly.\n * @system @public\n */\nexport type MapNodeInsertableData<T extends ImplicitAllowedTypes> =\n\t| Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]>\n\t| RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;\n"]}
|
|
1
|
+
{"version":3,"file":"mapNode.js","sourceRoot":"","sources":["../../src/simple-tree/mapNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA2D;AAC3D,4DAKuC;AACvC,6CAA+E;AAC/E,qDAQ0B;AAC1B,8CAeyB;AACzB,iDAIwB;AACxB,+CAA8E;AAC9E,yDAAyE;AAEzE,yDAA0D;AAsF1D,0IAA0I;AAC1I,uDAAuD;AACvD,8DAA8D;AAC9D,MAAM,OAAO,GAAmC;IAC/C,cAAc,EAAE,GAAG,EAAE;QACpB,OAAO,GAAG,CAAC,SAAS,CAAC;IACtB,CAAC;CACD,CAAC;AAEF,MAAe,iBAAwD,SAAQ,gCAE9E;IAGA,YAAmB,KAA+D;QACjF,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACpB,CAAC;IAEM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;IAED,IAAY,SAAS;QACpB,OAAO,IAAA,+BAAoB,EAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAEO,MAAM,CAAC,GAAW;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAA,gBAAK,EAAC,GAAG,CAAC,CAA0B,CAAC;QAC3E,OAAO,KAAK,CAAC,MAAM,CAAC;IACrB,CAAC;IAEM,MAAM,CAAC,GAAW;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAA,gBAAK,EAAC,GAAG,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;IACrD,CAAC;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iBAA0B,CAAC;IAE/B,MAAM,MAAO,SAAQ,iBAAoB;QACjC,MAAM,CAAU,eAAe,CAErC,QAA2B,EAC3B,QAAsB;YAEtB,IAAI,eAAe,EAAE,CAAC;gBACrB,OAAO,IAAI,KAAK,CAAS,QAAkB,EAAE,OAA+B,CAAC,CAAC;YAC/E,CAAC;YACD,OAAO,QAAQ,CAAC;QACjB,CAAC;QAEM,MAAM,CAAU,YAAY,CAElC,QAA2B,EAC3B,KAAS;YAET,OAAO,iCAAsB,CAAC,WAAW,CACxC,iBAAiB,EACjB,IAAA,kCAAmB,EAAC,KAAuB,EAAE,IAAuC,CAAC,CACrF,CAAC;QACH,CAAC;QAIS,MAAM,CAAU,YAAY;YACrC,MAAM,MAAM,GAAG,IAAiC,CAAC;YACjD,iBAAiB,GAAG,IAAA,uCAAoB,EAAC,MAAM,CAAC,CAAC;YACjD,OAAO,iBAAiB,CAAC;QAC1B,CAAC;QAMM,MAAM,KAAK,UAAU;YAC3B,OAAO,cAAc,CAAC,KAAK,CAAC;QAC7B,CAAC;QAID,gDAAgD;QAChD,IAAW,CAAC,yBAAc,CAAC;YAC1B,OAAO,UAAU,CAAC;QACnB,CAAC;QACD,IAAW,CAAC,2BAAgB,CAAC;YAC5B,OAAO,MAAM,CAAC,iBAAiB,EAAE,WAA6C,CAAC;QAChF,CAAC;;IAxByB,wBAAiB,GAAgC,SAAS,CAAC;IAQ9D,iBAAU,GAAG,UAAU,CAAC;IACxB,WAAI,GAAG,IAAI,CAAC;IACZ,8BAAuB,GAC7C,uBAAuB,CAAC;IAIF,eAAQ,GAC9B,QAAQ,CAAC;IAUX,MAAM,YAAY,GASd,MAAM,CAAC;IACX,OAAO,YAAY,CAAC;AACrB,CAAC;AA5ED,8BA4EC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Lazy } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype OptionalFieldEditBuilder,\n\tgetSchemaAndPolicy,\n} from \"../feature-libraries/index.js\";\nimport { getTreeNodeForField, prepareContentForHydration } from \"./proxies.js\";\nimport {\n\tcreateFieldSchema,\n\tFieldKind,\n\tnormalizeAllowedTypes,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeSchemaMetadata,\n\ttype TreeNodeFromImplicitAllowedTypes,\n} from \"./schemaTypes.js\";\nimport {\n\tgetKernel,\n\ttype InnerNode,\n\tNodeKind,\n\ttype TreeNodeSchemaBoth,\n\ttype TreeNodeSchema,\n\ttype WithType,\n\t// eslint-disable-next-line import/no-deprecated\n\ttypeNameSymbol,\n\ttype TreeNode,\n\ttypeSchemaSymbol,\n\ttype Context,\n\tUnhydratedFlexTreeNode,\n\tgetOrCreateInnerNode,\n\ttype InternalTreeNode,\n} from \"./core/index.js\";\nimport {\n\tmapTreeFromNodeData,\n\ttype FactoryContent,\n\ttype InsertableContent,\n} from \"./toMapTree.js\";\nimport { brand, count, type RestrictiveStringRecord } from \"../util/index.js\";\nimport { TreeNodeValid, type MostDerivedData } from \"./treeNodeValid.js\";\nimport type { ExclusiveMapTree } from \"../core/index.js\";\nimport { getUnhydratedContext } from \"./createContext.js\";\n\n/**\n * A map of string keys to tree objects.\n *\n * @privateRemarks\n * Add support for `clear` once we have established merge semantics for it.\n *\n * @sealed @public\n */\nexport interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTypes>\n\textends ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\tTreeNode {\n\t/**\n\t * Adds or updates an entry in the map with a specified `key` and a `value`.\n\t *\n\t * @param key - The key of the element to add to the map.\n\t * @param value - The value of the element to add to the map.\n\t *\n\t * @remarks\n\t * Setting the value at a key to `undefined` is equivalent to calling {@link TreeMapNode.delete} with that key.\n\t */\n\tset(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T> | undefined): void;\n\n\t/**\n\t * Removes the specified element from this map by its `key`.\n\t *\n\t * @remarks\n\t * Note: unlike JavaScript's Map API, this method does not return a flag indicating whether or not the value was\n\t * deleted.\n\t *\n\t * @privateRemarks\n\t * Regarding the choice to not return a boolean: Since this data structure is distributed in nature, it isn't\n\t * possible to tell whether or not the item was deleted as a result of this method call. Returning a \"best guess\"\n\t * is more likely to create issues / promote bad usage patterns than offer useful information.\n\t *\n\t * @param key - The key of the element to remove from the map.\n\t */\n\tdelete(key: string): void;\n\n\t/**\n\t * Returns an iterable of keys in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the keys returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tkeys(): IterableIterator<string>;\n\n\t/**\n\t * Returns an iterable of values in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the values returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tvalues(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>>;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the entries returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tentries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]>;\n\n\t/**\n\t * Executes the provided function once per each key/value pair in this map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order in which the function is called with respect to the map's entries.\n\t * If your usage scenario depends on consistent ordering, you will need to account for this.\n\t */\n\tforEach(\n\t\tcallbackfn: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tkey: string,\n\t\t\tmap: ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\t) => void,\n\t\t// Typing inherited from `ReadonlyMap`.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tthisArg?: any,\n\t): void;\n}\n\n// TreeMapNode is invariant over schema type, so for this handler to work with all schema, the only possible type for the schema is `any`.\n// This is not ideal, but no alternatives are possible.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst handler: ProxyHandler<TreeMapNode<any>> = {\n\tgetPrototypeOf: () => {\n\t\treturn Map.prototype;\n\t},\n};\n\nabstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends TreeNodeValid<\n\tMapNodeInsertableData<T>\n> {\n\tpublic static readonly kind = NodeKind.Map;\n\n\tpublic constructor(input?: InternalTreeNode | MapNodeInsertableData<T> | undefined) {\n\t\tsuper(input ?? []);\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> {\n\t\treturn this.entries();\n\t}\n\n\tprivate get innerNode(): InnerNode {\n\t\treturn getOrCreateInnerNode(this);\n\t}\n\n\tprivate editor(key: string): OptionalFieldEditBuilder<ExclusiveMapTree> {\n\t\tconst field = this.innerNode.getBoxed(brand(key)) as FlexTreeOptionalField;\n\t\treturn field.editor;\n\t}\n\n\tpublic delete(key: string): void {\n\t\tconst field = this.innerNode.getBoxed(brand(key));\n\t\tthis.editor(key).set(undefined, field.length === 0);\n\t}\n\tpublic *entries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> {\n\t\tconst node = this.innerNode;\n\t\tfor (const key of node.keys()) {\n\t\t\tyield [\n\t\t\t\tkey,\n\t\t\t\tgetTreeNodeForField(node.getBoxed(key)) as TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\t];\n\t\t}\n\t}\n\tpublic get(key: string): TreeNodeFromImplicitAllowedTypes<T> {\n\t\tconst node = this.innerNode;\n\t\tconst field = node.getBoxed(brand(key));\n\t\treturn getTreeNodeForField(field) as TreeNodeFromImplicitAllowedTypes<T>;\n\t}\n\tpublic has(key: string): boolean {\n\t\treturn this.innerNode.tryGetField(brand(key)) !== undefined;\n\t}\n\tpublic keys(): IterableIterator<string> {\n\t\tconst node = this.innerNode;\n\t\treturn node.keys();\n\t}\n\tpublic set(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T>): this {\n\t\tconst kernel = getKernel(this);\n\t\tconst node = this.innerNode;\n\t\tconst mapTree = mapTreeFromNodeData(\n\t\t\tvalue as InsertableContent | undefined,\n\t\t\tcreateFieldSchema(FieldKind.Optional, kernel.schema.info as ImplicitAllowedTypes),\n\t\t\tnode.context.isHydrated() ? node.context.nodeKeyManager : undefined,\n\t\t\tgetSchemaAndPolicy(node),\n\t\t);\n\n\t\tconst field = node.getBoxed(brand(key));\n\t\tif (node.context.isHydrated()) {\n\t\t\tprepareContentForHydration(mapTree, node.context.checkout.forest);\n\t\t}\n\n\t\tthis.editor(key).set(mapTree, field.length === 0);\n\t\treturn this;\n\t}\n\tpublic get size(): number {\n\t\treturn count(this.innerNode.keys());\n\t}\n\tpublic *values(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\tfor (const [, value] of this.entries()) {\n\t\t\tyield value;\n\t\t}\n\t}\n\tpublic forEach<TThis extends TreeMapNode<T>>(\n\t\tthis: TThis,\n\t\tcallbackFn: (value: TreeNodeFromImplicitAllowedTypes<T>, key: string, map: TThis) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tfor (const field of getOrCreateInnerNode(this).boxedIterator()) {\n\t\t\tconst node = getTreeNodeForField(field) as TreeNodeFromImplicitAllowedTypes<T>;\n\t\t\tcallbackFn.call(thisArg, node, field.key, this);\n\t\t}\n\t}\n\t// TODO: add `clear` once we have established merge semantics for it.\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n *\n * @param base - base schema type to extend.\n * @param useMapPrototype - should this type emulate a ES6 Map object (by faking its prototype with a proxy).\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function mapSchema<\n\tTName extends string,\n\tconst T extends ImplicitAllowedTypes,\n\tconst ImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n\tuseMapPrototype: boolean,\n\tmetadata?: NodeSchemaMetadata<TCustomMetadata>,\n) {\n\tconst lazyChildTypes = new Lazy(() => normalizeAllowedTypes(info));\n\n\tlet unhydratedContext: Context;\n\n\tclass Schema extends CustomMapNodeBase<T> implements TreeMapNode<T> {\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\tif (useMapPrototype) {\n\t\t\t\treturn new Proxy<Schema>(instance as Schema, handler as ProxyHandler<Schema>);\n\t\t\t}\n\t\t\treturn instance;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn UnhydratedFlexTreeNode.getOrCreate(\n\t\t\t\tunhydratedContext,\n\t\t\t\tmapTreeFromNodeData(input as FactoryContent, this as unknown as ImplicitAllowedTypes),\n\t\t\t);\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>): Context {\n\t\t\tconst schema = this as unknown as TreeNodeSchema;\n\t\t\tunhydratedContext = getUnhydratedContext(schema);\n\t\t\treturn unhydratedContext;\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn lazyChildTypes.value;\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> | undefined =\n\t\t\tmetadata;\n\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): typeof schemaErased {\n\t\t\treturn Schema.constructorCached?.constructor as unknown as typeof schemaErased;\n\t\t}\n\t}\n\tconst schemaErased: TreeNodeSchemaBoth<\n\t\tTName,\n\t\tNodeKind.Map,\n\t\tTreeMapNode<T> & WithType<TName, NodeKind.Map>,\n\t\tMapNodeInsertableData<T>,\n\t\tImplicitlyConstructable,\n\t\tT,\n\t\tundefined,\n\t\tTCustomMetadata\n\t> = Schema;\n\treturn schemaErased;\n}\n\n/**\n * Content which can be used to construct a Map node, explicitly or implicitly.\n * @system @public\n */\nexport type MapNodeInsertableData<T extends ImplicitAllowedTypes> =\n\t| Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]>\n\t| RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;\n"]}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import type { FieldKey } from "../core/index.js";
|
|
5
|
+
import type { FieldKey, SchemaPolicy } from "../core/index.js";
|
|
6
6
|
import { type FlexTreeField } from "../feature-libraries/index.js";
|
|
7
|
-
import { type ImplicitFieldSchema, type TreeFieldFromImplicitField, type InsertableTreeFieldFromImplicitField, type FieldSchema, FieldKind } from "./schemaTypes.js";
|
|
7
|
+
import { type ImplicitFieldSchema, type TreeFieldFromImplicitField, type InsertableTreeFieldFromImplicitField, type FieldSchema, FieldKind, type NodeSchemaMetadata } from "./schemaTypes.js";
|
|
8
8
|
import { NodeKind, type WithType, type TreeNode } from "./core/index.js";
|
|
9
9
|
import { type InsertableContent } from "./toMapTree.js";
|
|
10
10
|
import { type RestrictiveStringRecord, type FlattenKeys } from "../util/index.js";
|
|
11
|
-
import type
|
|
11
|
+
import { type ObjectNodeSchema, type ObjectNodeSchemaInternalData } from "./objectNodeTypes.js";
|
|
12
12
|
/**
|
|
13
13
|
* Generates the properties for an ObjectNode from its field schema object.
|
|
14
14
|
* @system @public
|
|
@@ -84,5 +84,10 @@ export declare function setField(field: FlexTreeField, simpleFieldSchema: FieldS
|
|
|
84
84
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
85
85
|
* @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.
|
|
86
86
|
*/
|
|
87
|
-
export declare function objectSchema<TName extends string, const T extends RestrictiveStringRecord<ImplicitFieldSchema>, const ImplicitlyConstructable extends boolean>(identifier: TName, info: T, implicitlyConstructable: ImplicitlyConstructable): ObjectNodeSchema<TName, T, ImplicitlyConstructable> & ObjectNodeSchemaInternalData;
|
|
87
|
+
export declare function objectSchema<TName extends string, const T extends RestrictiveStringRecord<ImplicitFieldSchema>, const ImplicitlyConstructable extends boolean, const TCustomMetadata = unknown>(identifier: TName, info: T, implicitlyConstructable: ImplicitlyConstructable, allowUnknownOptionalFields: boolean, metadata?: NodeSchemaMetadata<TCustomMetadata>): ObjectNodeSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> & ObjectNodeSchemaInternalData;
|
|
88
|
+
/**
|
|
89
|
+
* Creates a policy for allowing unknown optional fields on an object node which delegates to the policy defined
|
|
90
|
+
* on the object node's internal schema data.
|
|
91
|
+
*/
|
|
92
|
+
export declare function createUnknownOptionalFieldPolicy(schema: ImplicitFieldSchema): SchemaPolicy["allowUnknownOptionalFields"];
|
|
88
93
|
//# sourceMappingURL=objectNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectNode.d.ts","sourceRoot":"","sources":["../../src/simple-tree/objectNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"objectNode.d.ts","sourceRoot":"","sources":["../../src/simple-tree/objectNode.ts"],"names":[],"mappings":"AAAA;;;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kBAAkB,CAAC,eAAe,CAAC,GAC5C,gBAAgB,CAAC,KAAK,EAAE,CAAC,EAAE,uBAAuB,EAAE,eAAe,CAAC,GACtE,4BAA4B,CA6I5B;AA0CD;;;GAGG;AACH,wBAAgB,gCAAgC,CAC/C,MAAM,EAAE,mBAAmB,GACzB,YAAY,CAAC,4BAA4B,CAAC,CAU5C"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.objectSchema = exports.setField = void 0;
|
|
7
|
+
exports.createUnknownOptionalFieldPolicy = exports.objectSchema = exports.setField = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
10
10
|
const index_js_1 = require("../feature-libraries/index.js");
|
|
@@ -13,6 +13,7 @@ const schemaTypes_js_1 = require("./schemaTypes.js");
|
|
|
13
13
|
const index_js_2 = require("./core/index.js");
|
|
14
14
|
const toMapTree_js_1 = require("./toMapTree.js");
|
|
15
15
|
const index_js_3 = require("../util/index.js");
|
|
16
|
+
const objectNodeTypes_js_1 = require("./objectNodeTypes.js");
|
|
16
17
|
const treeNodeValid_js_1 = require("./treeNodeValid.js");
|
|
17
18
|
const createContext_js_1 = require("./createContext.js");
|
|
18
19
|
/**
|
|
@@ -154,7 +155,7 @@ CustomObjectNodeBase.kind = index_js_2.NodeKind.Object;
|
|
|
154
155
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
155
156
|
* @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.
|
|
156
157
|
*/
|
|
157
|
-
function objectSchema(identifier, info, implicitlyConstructable) {
|
|
158
|
+
function objectSchema(identifier, info, implicitlyConstructable, allowUnknownOptionalFields, metadata) {
|
|
158
159
|
// Ensure no collisions between final set of property keys, and final set of stored keys (including those
|
|
159
160
|
// implicitly derived from property keys)
|
|
160
161
|
assertUniqueKeys(identifier, info);
|
|
@@ -245,10 +246,12 @@ function objectSchema(identifier, info, implicitlyConstructable) {
|
|
|
245
246
|
key,
|
|
246
247
|
]));
|
|
247
248
|
CustomObjectNode.identifierFieldKeys = identifierFieldKeys;
|
|
249
|
+
CustomObjectNode.allowUnknownOptionalFields = allowUnknownOptionalFields;
|
|
248
250
|
CustomObjectNode.constructorCached = undefined;
|
|
249
251
|
CustomObjectNode.identifier = identifier;
|
|
250
252
|
CustomObjectNode.info = info;
|
|
251
253
|
CustomObjectNode.implicitlyConstructable = implicitlyConstructable;
|
|
254
|
+
CustomObjectNode.metadata = metadata;
|
|
252
255
|
return CustomObjectNode;
|
|
253
256
|
}
|
|
254
257
|
exports.objectSchema = objectSchema;
|
|
@@ -282,4 +285,18 @@ function assertUniqueKeys(schemaName, fields) {
|
|
|
282
285
|
derivedStoredKeys.add(storedKey);
|
|
283
286
|
}
|
|
284
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Creates a policy for allowing unknown optional fields on an object node which delegates to the policy defined
|
|
290
|
+
* on the object node's internal schema data.
|
|
291
|
+
*/
|
|
292
|
+
function createUnknownOptionalFieldPolicy(schema) {
|
|
293
|
+
const context = (0, createContext_js_1.getUnhydratedContext)(schema);
|
|
294
|
+
return (identifier) => {
|
|
295
|
+
const storedSchema = context.schema.get(identifier);
|
|
296
|
+
return (storedSchema !== undefined &&
|
|
297
|
+
(0, objectNodeTypes_js_1.isObjectNodeSchema)(storedSchema) &&
|
|
298
|
+
storedSchema.allowUnknownOptionalFields);
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
exports.createUnknownOptionalFieldPolicy = createUnknownOptionalFieldPolicy;
|
|
285
302
|
//# sourceMappingURL=objectNode.js.map
|