@fluidframework/tree 2.12.0 → 2.20.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 +154 -0
- package/api-report/tree.alpha.api.md +108 -22
- package/api-report/tree.beta.api.md +31 -15
- package/api-report/tree.legacy.alpha.api.md +31 -15
- package/api-report/tree.legacy.public.api.md +31 -15
- package/api-report/tree.public.api.md +31 -15
- package/assertTagging.config.mjs +14 -0
- package/dist/alpha.d.ts +14 -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 +6 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +2 -2
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +5 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +5 -4
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +29 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.d.ts +10 -0
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +22 -1
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/tree/delta.d.ts +21 -26
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/deltaUtil.d.ts +1 -3
- package/dist/core/tree/deltaUtil.d.ts.map +1 -1
- package/dist/core/tree/deltaUtil.js +2 -14
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +1 -3
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +82 -80
- package/dist/core/tree/visitDelta.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/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/dist/feature-libraries/deltaUtils.js +13 -0
- package/dist/feature-libraries/deltaUtils.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -6
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +0 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +2 -4
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +5 -5
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +2 -3
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +30 -6
- 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.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +8 -8
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -4
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +186 -216
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +23 -20
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js +20 -0
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts +3 -3
- 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/sequence-field/moveEffectTable.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +4 -4
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.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 +50 -9
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +4 -1
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +27 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +2 -0
- package/dist/package.json +2 -1
- 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 +6 -3
- package/dist/shared-tree/index.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 +43 -0
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +44 -21
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +41 -35
- 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 +4 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +142 -23
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -0
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -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 +21 -12
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +5 -2
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/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 +5 -1
- package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +13 -10
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/testRecursiveDomain.d.ts +5 -5
- package/dist/simple-tree/api/tree.d.ts +60 -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/treeNodeApi.js +1 -1
- package/dist/simple-tree/api/treeNodeApi.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 +3 -2
- 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 +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +3 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +5 -5
- package/dist/simple-tree/leafNodeSchema.d.ts.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 +2 -2
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +2 -1
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +2 -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 +47 -1
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toMapTree.js +1 -1
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/util/bTreeUtils.d.ts +10 -0
- package/dist/util/bTreeUtils.d.ts.map +1 -0
- package/dist/util/bTreeUtils.js +52 -0
- package/dist/util/bTreeUtils.js.map +1 -0
- package/dist/util/idAllocator.d.ts +0 -2
- package/dist/util/idAllocator.d.ts.map +1 -1
- package/dist/util/idAllocator.js +0 -2
- package/dist/util/idAllocator.js.map +1 -1
- package/dist/util/index.d.ts +3 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +7 -5
- package/dist/util/index.js.map +1 -1
- package/dist/util/rangeMap.d.ts +95 -43
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +202 -148
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/utils.d.ts +26 -2
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +17 -2
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +14 -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/index.d.ts +2 -2
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +2 -2
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +5 -4
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +26 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/rebase/utils.d.ts +10 -0
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +20 -0
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/tree/delta.d.ts +21 -26
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/deltaUtil.d.ts +1 -3
- package/lib/core/tree/deltaUtil.d.ts.map +1 -1
- package/lib/core/tree/deltaUtil.js +1 -12
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +82 -80
- package/lib/core/tree/visitDelta.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/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/deltaUtils.d.ts.map +1 -1
- package/lib/feature-libraries/deltaUtils.js +13 -0
- package/lib/feature-libraries/deltaUtils.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -6
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +0 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +0 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +5 -5
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +2 -3
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +30 -6
- 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.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -4
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +158 -186
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +23 -20
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js +18 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts +3 -3
- 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/sequence-field/moveEffectTable.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +4 -4
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts +2 -3
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.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 +50 -9
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +4 -1
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +27 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- 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 +3 -2
- package/lib/shared-tree/index.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 +46 -3
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +44 -21
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +40 -34
- 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 +4 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +143 -24
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -0
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -0
- 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 +21 -12
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +5 -2
- 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 +5 -1
- package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +14 -11
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/testRecursiveDomain.d.ts +5 -5
- package/lib/simple-tree/api/tree.d.ts +60 -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/treeNodeApi.js +1 -1
- package/lib/simple-tree/api/treeNodeApi.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 +3 -2
- 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 +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +5 -5
- package/lib/simple-tree/leafNodeSchema.d.ts.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 +2 -2
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +2 -1
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +2 -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 +47 -1
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toMapTree.js +1 -1
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/util/bTreeUtils.d.ts +10 -0
- package/lib/util/bTreeUtils.d.ts.map +1 -0
- package/lib/util/bTreeUtils.js +47 -0
- package/lib/util/bTreeUtils.js.map +1 -0
- package/lib/util/idAllocator.d.ts +0 -2
- package/lib/util/idAllocator.d.ts.map +1 -1
- package/lib/util/idAllocator.js +0 -2
- package/lib/util/idAllocator.js.map +1 -1
- package/lib/util/index.d.ts +3 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +3 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/rangeMap.d.ts +95 -43
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +200 -144
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/utils.d.ts +26 -2
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +15 -1
- package/lib/util/utils.js.map +1 -1
- package/package.json +24 -24
- package/src/core/index.ts +5 -2
- package/src/core/rebase/index.ts +5 -0
- package/src/core/rebase/types.ts +33 -5
- package/src/core/rebase/utils.ts +27 -0
- package/src/core/tree/delta.ts +21 -26
- package/src/core/tree/deltaUtil.ts +1 -16
- package/src/core/tree/index.ts +0 -2
- package/src/core/tree/visitDelta.ts +108 -97
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +14 -1
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +2 -2
- package/src/feature-libraries/deltaUtils.ts +13 -0
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -6
- package/src/feature-libraries/index.ts +0 -1
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +12 -13
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +33 -9
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -4
- package/src/feature-libraries/modular-schema/index.ts +3 -0
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +12 -11
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +254 -248
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +51 -26
- package/src/feature-libraries/optional-field/optionalField.ts +37 -8
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +1 -1
- package/src/feature-libraries/sequence-field/rebase.ts +9 -3
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +3 -4
- package/src/feature-libraries/sequence-field/utils.ts +54 -11
- package/src/feature-libraries/treeCursorUtils.ts +6 -1
- package/src/index.ts +45 -6
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +16 -3
- package/src/shared-tree/schematizingTreeView.ts +91 -2
- package/src/shared-tree/sharedTree.ts +69 -44
- package/src/shared-tree/transactionTypes.ts +125 -0
- package/src/shared-tree/treeApi.ts +1 -28
- package/src/shared-tree/treeCheckout.ts +166 -25
- package/src/shared-tree-core/sharedTreeCore.ts +1 -1
- package/src/simple-tree/api/index.ts +1 -0
- package/src/simple-tree/api/jsonSchema.ts +7 -0
- package/src/simple-tree/api/schemaFactory.ts +33 -6
- package/src/simple-tree/api/schemaFactoryAlpha.ts +253 -0
- package/src/simple-tree/api/simpleSchema.ts +6 -1
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +22 -12
- package/src/simple-tree/api/tree.ts +76 -4
- package/src/simple-tree/api/treeNodeApi.ts +1 -1
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +19 -13
- package/src/simple-tree/arrayNode.ts +8 -2
- package/src/simple-tree/core/treeNodeSchema.ts +51 -7
- package/src/simple-tree/index.ts +3 -0
- package/src/simple-tree/mapNode.ts +7 -1
- package/src/simple-tree/objectNode.ts +7 -1
- package/src/simple-tree/objectNodeTypes.ts +4 -1
- package/src/simple-tree/schemaTypes.ts +50 -1
- package/src/simple-tree/toMapTree.ts +1 -1
- package/src/util/bTreeUtils.ts +60 -0
- package/src/util/idAllocator.ts +0 -2
- package/src/util/index.ts +5 -6
- package/src/util/rangeMap.ts +259 -184
- package/src/util/utils.ts +57 -4
- 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/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/lib/package.json +0 -3
- package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -112
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
createFieldSchema,
|
|
41
41
|
type DefaultProvider,
|
|
42
42
|
getDefaultProvider,
|
|
43
|
+
type NodeSchemaOptions,
|
|
43
44
|
} from "../schemaTypes.js";
|
|
44
45
|
import { inPrototypeChain } from "../core/index.js";
|
|
45
46
|
import type {
|
|
@@ -103,11 +104,15 @@ export function schemaFromValue(value: TreeValue): TreeNodeSchema {
|
|
|
103
104
|
|
|
104
105
|
/**
|
|
105
106
|
* Options when declaring an {@link SchemaFactory.object|object node}'s schema
|
|
107
|
+
*
|
|
108
|
+
* @alpha
|
|
106
109
|
*/
|
|
107
|
-
export interface SchemaFactoryObjectOptions
|
|
110
|
+
export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown>
|
|
111
|
+
extends NodeSchemaOptions<TCustomMetadata> {
|
|
108
112
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
113
|
+
* Allow nodes typed with this object node schema to contain optional fields that are not present in the schema declaration.
|
|
114
|
+
* Such nodes can come into existence either via import APIs (see remarks) or by way of collaboration with another client
|
|
115
|
+
* that has upgraded the document's schema to include those optional fields.
|
|
111
116
|
*
|
|
112
117
|
* @defaultValue `false`
|
|
113
118
|
* @remarks
|
|
@@ -149,7 +154,9 @@ export interface SchemaFactoryObjectOptions {
|
|
|
149
154
|
allowUnknownOptionalFields?: boolean;
|
|
150
155
|
}
|
|
151
156
|
|
|
152
|
-
export const defaultSchemaFactoryObjectOptions: Required<
|
|
157
|
+
export const defaultSchemaFactoryObjectOptions: Required<
|
|
158
|
+
Omit<SchemaFactoryObjectOptions, "metadata">
|
|
159
|
+
> = {
|
|
153
160
|
allowUnknownOptionalFields: false,
|
|
154
161
|
};
|
|
155
162
|
|
|
@@ -400,6 +407,8 @@ export class SchemaFactory<
|
|
|
400
407
|
/**
|
|
401
408
|
* Define a structurally typed {@link TreeNodeSchema} for a {@link TreeMapNode}.
|
|
402
409
|
*
|
|
410
|
+
* @param allowedTypes - The types that may appear as values in the map.
|
|
411
|
+
*
|
|
403
412
|
* @remarks
|
|
404
413
|
* The unique identifier for this Map is defined as a function of the provided types.
|
|
405
414
|
* It is still scoped to this SchemaBuilder, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.
|
|
@@ -436,6 +445,7 @@ export class SchemaFactory<
|
|
|
436
445
|
* Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.
|
|
437
446
|
*
|
|
438
447
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
448
|
+
* @param allowedTypes - The types that may appear as values in the map.
|
|
439
449
|
*
|
|
440
450
|
* @example
|
|
441
451
|
* ```typescript
|
|
@@ -456,6 +466,8 @@ export class SchemaFactory<
|
|
|
456
466
|
>;
|
|
457
467
|
|
|
458
468
|
/**
|
|
469
|
+
* {@link SchemaFactory.map} implementation.
|
|
470
|
+
*
|
|
459
471
|
* @privateRemarks
|
|
460
472
|
* This should return `TreeNodeSchemaBoth`, however TypeScript gives an error if one of the overloads implicitly up-casts the return type of the implementation.
|
|
461
473
|
* This seems like a TypeScript bug getting variance backwards for overload return types since it's erroring when the relation between the overload
|
|
@@ -530,12 +542,15 @@ export class SchemaFactory<
|
|
|
530
542
|
implicitlyConstructable,
|
|
531
543
|
// The current policy is customizable nodes don't get fake prototypes.
|
|
532
544
|
!customizable,
|
|
545
|
+
undefined,
|
|
533
546
|
);
|
|
534
547
|
}
|
|
535
548
|
|
|
536
549
|
/**
|
|
537
550
|
* Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.
|
|
538
551
|
*
|
|
552
|
+
* @param allowedTypes - The types that may appear in the array.
|
|
553
|
+
*
|
|
539
554
|
* @remarks
|
|
540
555
|
* The identifier for this Array is defined as a function of the provided types.
|
|
541
556
|
* It is still scoped to this SchemaFactory, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.
|
|
@@ -582,6 +597,7 @@ export class SchemaFactory<
|
|
|
582
597
|
* Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
|
|
583
598
|
*
|
|
584
599
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
600
|
+
* @param allowedTypes - The types that may appear in the array.
|
|
585
601
|
*
|
|
586
602
|
* @example
|
|
587
603
|
* ```typescript
|
|
@@ -604,6 +620,8 @@ export class SchemaFactory<
|
|
|
604
620
|
>;
|
|
605
621
|
|
|
606
622
|
/**
|
|
623
|
+
* {@link SchemaFactory.array} implementation.
|
|
624
|
+
*
|
|
607
625
|
* @privateRemarks
|
|
608
626
|
* This should return TreeNodeSchemaBoth: see note on "map" implementation for details.
|
|
609
627
|
*/
|
|
@@ -787,11 +805,20 @@ export class SchemaFactory<
|
|
|
787
805
|
* `error TS2589: Type instantiation is excessively deep and possibly infinite.`
|
|
788
806
|
* which otherwise gets reported at sometimes incorrect source locations that vary based on incremental builds.
|
|
789
807
|
*/
|
|
790
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
791
808
|
public objectRecursive<
|
|
792
809
|
const Name extends TName,
|
|
793
810
|
const T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>,
|
|
794
|
-
>(
|
|
811
|
+
>(
|
|
812
|
+
name: Name,
|
|
813
|
+
t: T,
|
|
814
|
+
): TreeNodeSchemaClass<
|
|
815
|
+
ScopedSchemaName<TScope, Name>,
|
|
816
|
+
NodeKind.Object,
|
|
817
|
+
TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,
|
|
818
|
+
object & InsertableObjectFromSchemaRecordUnsafe<T>,
|
|
819
|
+
false,
|
|
820
|
+
T
|
|
821
|
+
> {
|
|
795
822
|
type TScopedName = ScopedSchemaName<TScope, Name>;
|
|
796
823
|
return this.object(
|
|
797
824
|
name,
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
ScopedSchemaName,
|
|
8
|
+
InsertableObjectFromSchemaRecord,
|
|
9
|
+
TreeObjectNodeUnsafe,
|
|
10
|
+
InsertableObjectFromSchemaRecordUnsafe,
|
|
11
|
+
} from "../../internalTypes.js";
|
|
12
|
+
import {
|
|
13
|
+
defaultSchemaFactoryObjectOptions,
|
|
14
|
+
SchemaFactory,
|
|
15
|
+
type SchemaFactoryObjectOptions,
|
|
16
|
+
} from "./schemaFactory.js";
|
|
17
|
+
import type {
|
|
18
|
+
ImplicitAllowedTypes,
|
|
19
|
+
ImplicitFieldSchema,
|
|
20
|
+
InsertableTreeNodeFromImplicitAllowedTypes,
|
|
21
|
+
NodeSchemaOptions,
|
|
22
|
+
} from "../schemaTypes.js";
|
|
23
|
+
import { type TreeObjectNode, objectSchema } from "../objectNode.js";
|
|
24
|
+
import type { RestrictiveStringRecord } from "../../util/index.js";
|
|
25
|
+
import type { NodeKind, TreeNodeSchemaClass, WithType } from "../core/index.js";
|
|
26
|
+
import type {
|
|
27
|
+
InsertableTreeNodeFromImplicitAllowedTypesUnsafe,
|
|
28
|
+
TreeArrayNodeUnsafe,
|
|
29
|
+
TreeMapNodeUnsafe,
|
|
30
|
+
Unenforced,
|
|
31
|
+
} from "./typesUnsafe.js";
|
|
32
|
+
import { mapSchema, type MapNodeInsertableData, type TreeMapNode } from "../mapNode.js";
|
|
33
|
+
import { arraySchema, type TreeArrayNode } from "../arrayNode.js";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* {@link SchemaFactory} with additional alpha APIs.
|
|
37
|
+
*
|
|
38
|
+
* @alpha
|
|
39
|
+
* @privateRemarks
|
|
40
|
+
*
|
|
41
|
+
* Some private methods on `SchemaFactory` are intentionally duplicated here to avoid increasing their exposure to `protected`.
|
|
42
|
+
* If we were to do so, they would be exposed on the public API surface of `SchemaFactory`.
|
|
43
|
+
*/
|
|
44
|
+
export class SchemaFactoryAlpha<
|
|
45
|
+
out TScope extends string | undefined = string | undefined,
|
|
46
|
+
TName extends number | string = string,
|
|
47
|
+
> extends SchemaFactory<TScope, TName> {
|
|
48
|
+
private scoped2<Name extends TName | string>(name: Name): ScopedSchemaName<TScope, Name> {
|
|
49
|
+
return (
|
|
50
|
+
this.scope === undefined ? `${name}` : `${this.scope}.${name}`
|
|
51
|
+
) as ScopedSchemaName<TScope, Name>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.
|
|
56
|
+
*
|
|
57
|
+
* @param name - Unique identifier for this schema within this factory's scope.
|
|
58
|
+
* @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.
|
|
59
|
+
* @param options - Additional options for the schema.
|
|
60
|
+
*/
|
|
61
|
+
public override object<
|
|
62
|
+
const Name extends TName,
|
|
63
|
+
const T extends RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
64
|
+
const TCustomMetadata = unknown,
|
|
65
|
+
>(
|
|
66
|
+
name: Name,
|
|
67
|
+
fields: T,
|
|
68
|
+
options?: SchemaFactoryObjectOptions<TCustomMetadata>,
|
|
69
|
+
): TreeNodeSchemaClass<
|
|
70
|
+
ScopedSchemaName<TScope, Name>,
|
|
71
|
+
NodeKind.Object,
|
|
72
|
+
TreeObjectNode<T, ScopedSchemaName<TScope, Name>>,
|
|
73
|
+
object & InsertableObjectFromSchemaRecord<T>,
|
|
74
|
+
true,
|
|
75
|
+
T,
|
|
76
|
+
never,
|
|
77
|
+
TCustomMetadata
|
|
78
|
+
> {
|
|
79
|
+
return objectSchema(
|
|
80
|
+
this.scoped2(name),
|
|
81
|
+
fields,
|
|
82
|
+
true,
|
|
83
|
+
options?.allowUnknownOptionalFields ??
|
|
84
|
+
defaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,
|
|
85
|
+
options?.metadata,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* {@inheritdoc SchemaFactory.objectRecursive}
|
|
91
|
+
*/
|
|
92
|
+
public override objectRecursive<
|
|
93
|
+
const Name extends TName,
|
|
94
|
+
const T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>,
|
|
95
|
+
const TCustomMetadata = unknown,
|
|
96
|
+
>(
|
|
97
|
+
name: Name,
|
|
98
|
+
t: T,
|
|
99
|
+
options?: SchemaFactoryObjectOptions<TCustomMetadata>,
|
|
100
|
+
): TreeNodeSchemaClass<
|
|
101
|
+
ScopedSchemaName<TScope, Name>,
|
|
102
|
+
NodeKind.Object,
|
|
103
|
+
TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,
|
|
104
|
+
object & InsertableObjectFromSchemaRecordUnsafe<T>,
|
|
105
|
+
false,
|
|
106
|
+
T,
|
|
107
|
+
never,
|
|
108
|
+
TCustomMetadata
|
|
109
|
+
> {
|
|
110
|
+
type TScopedName = ScopedSchemaName<TScope, Name>;
|
|
111
|
+
return this.object(
|
|
112
|
+
name,
|
|
113
|
+
t as T & RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
114
|
+
options,
|
|
115
|
+
) as unknown as TreeNodeSchemaClass<
|
|
116
|
+
TScopedName,
|
|
117
|
+
NodeKind.Object,
|
|
118
|
+
TreeObjectNodeUnsafe<T, TScopedName>,
|
|
119
|
+
object & InsertableObjectFromSchemaRecordUnsafe<T>,
|
|
120
|
+
false,
|
|
121
|
+
T,
|
|
122
|
+
never,
|
|
123
|
+
TCustomMetadata
|
|
124
|
+
>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.
|
|
129
|
+
*
|
|
130
|
+
* @param name - Unique identifier for this schema within this factory's scope.
|
|
131
|
+
* @param allowedTypes - The types that may appear as values in the map.
|
|
132
|
+
* @param options - Additional options for the schema.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* class NamedMap extends factory.map("name", factory.number, {
|
|
137
|
+
* metadata: { description: "A map of numbers" }
|
|
138
|
+
* }) {}
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
public mapAlpha<
|
|
142
|
+
Name extends TName,
|
|
143
|
+
const T extends ImplicitAllowedTypes,
|
|
144
|
+
const TCustomMetadata = unknown,
|
|
145
|
+
>(
|
|
146
|
+
name: Name,
|
|
147
|
+
allowedTypes: T,
|
|
148
|
+
options?: NodeSchemaOptions<TCustomMetadata>,
|
|
149
|
+
): TreeNodeSchemaClass<
|
|
150
|
+
ScopedSchemaName<TScope, Name>,
|
|
151
|
+
NodeKind.Map,
|
|
152
|
+
TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,
|
|
153
|
+
MapNodeInsertableData<T>,
|
|
154
|
+
true,
|
|
155
|
+
T,
|
|
156
|
+
undefined,
|
|
157
|
+
TCustomMetadata
|
|
158
|
+
> {
|
|
159
|
+
return mapSchema(this.scoped2(name), allowedTypes, true, true, options?.metadata);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* {@inheritDoc SchemaFactory.objectRecursive}
|
|
164
|
+
*/
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
166
|
+
public override mapRecursive<
|
|
167
|
+
Name extends TName,
|
|
168
|
+
const T extends Unenforced<ImplicitAllowedTypes>,
|
|
169
|
+
const TCustomMetadata = unknown,
|
|
170
|
+
>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>) {
|
|
171
|
+
return this.mapAlpha(
|
|
172
|
+
name,
|
|
173
|
+
allowedTypes as T & ImplicitAllowedTypes,
|
|
174
|
+
options,
|
|
175
|
+
) as unknown as TreeNodeSchemaClass<
|
|
176
|
+
ScopedSchemaName<TScope, Name>,
|
|
177
|
+
NodeKind.Map,
|
|
178
|
+
TreeMapNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,
|
|
179
|
+
| {
|
|
180
|
+
[Symbol.iterator](): Iterator<
|
|
181
|
+
[string, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>]
|
|
182
|
+
>;
|
|
183
|
+
}
|
|
184
|
+
| {
|
|
185
|
+
readonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
186
|
+
},
|
|
187
|
+
false,
|
|
188
|
+
T,
|
|
189
|
+
undefined,
|
|
190
|
+
TCustomMetadata
|
|
191
|
+
>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
|
|
196
|
+
*
|
|
197
|
+
* @param name - Unique identifier for this schema within this factory's scope.
|
|
198
|
+
* @param allowedTypes - The types that may appear in the array.
|
|
199
|
+
* @param options - Additional options for the schema.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* class NamedArray extends factory.array("name", factory.number) {}
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
public arrayAlpha<
|
|
207
|
+
const Name extends TName,
|
|
208
|
+
const T extends ImplicitAllowedTypes,
|
|
209
|
+
const TCustomMetadata = unknown,
|
|
210
|
+
>(
|
|
211
|
+
name: Name,
|
|
212
|
+
allowedTypes: T,
|
|
213
|
+
options?: NodeSchemaOptions<TCustomMetadata>,
|
|
214
|
+
): TreeNodeSchemaClass<
|
|
215
|
+
ScopedSchemaName<TScope, Name>,
|
|
216
|
+
NodeKind.Array,
|
|
217
|
+
TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,
|
|
218
|
+
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
219
|
+
true,
|
|
220
|
+
T,
|
|
221
|
+
undefined,
|
|
222
|
+
TCustomMetadata
|
|
223
|
+
> {
|
|
224
|
+
return arraySchema(this.scoped2(name), allowedTypes, true, true, options?.metadata);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* {@inheritDoc SchemaFactory.objectRecursive}
|
|
229
|
+
*/
|
|
230
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
231
|
+
public override arrayRecursive<
|
|
232
|
+
const Name extends TName,
|
|
233
|
+
const T extends Unenforced<ImplicitAllowedTypes>,
|
|
234
|
+
const TCustomMetadata = unknown,
|
|
235
|
+
>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>) {
|
|
236
|
+
return this.arrayAlpha(
|
|
237
|
+
name,
|
|
238
|
+
allowedTypes as T & ImplicitAllowedTypes,
|
|
239
|
+
options,
|
|
240
|
+
) as unknown as TreeNodeSchemaClass<
|
|
241
|
+
ScopedSchemaName<TScope, Name>,
|
|
242
|
+
NodeKind.Array,
|
|
243
|
+
TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>,
|
|
244
|
+
{
|
|
245
|
+
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
246
|
+
},
|
|
247
|
+
false,
|
|
248
|
+
T,
|
|
249
|
+
undefined,
|
|
250
|
+
TCustomMetadata
|
|
251
|
+
>;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { ValueSchema } from "../../core/index.js";
|
|
7
7
|
import type { NodeKind } from "../core/index.js";
|
|
8
|
-
import type { FieldKind, FieldSchemaMetadata } from "../schemaTypes.js";
|
|
8
|
+
import type { FieldKind, FieldSchemaMetadata, NodeSchemaMetadata } from "../schemaTypes.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Base interface for all {@link SimpleNodeSchema} implementations.
|
|
@@ -20,6 +20,11 @@ export interface SimpleNodeSchemaBase<TNodeKind extends NodeKind> {
|
|
|
20
20
|
* @remarks can be used to type-switch between implementations.
|
|
21
21
|
*/
|
|
22
22
|
readonly kind: TNodeKind;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* {@inheritDoc NodeSchemaMetadata}
|
|
26
|
+
*/
|
|
27
|
+
readonly metadata?: NodeSchemaMetadata | undefined;
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
import { ValueSchema } from "../../core/index.js";
|
|
9
|
-
import { getOrCreate, hasSingle, type Mutable } from "../../util/index.js";
|
|
9
|
+
import { copyProperty, getOrCreate, hasSingle, type Mutable } from "../../util/index.js";
|
|
10
10
|
import type {
|
|
11
11
|
JsonArrayNodeSchema,
|
|
12
12
|
JsonFieldSchema,
|
|
@@ -100,11 +100,15 @@ function convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSch
|
|
|
100
100
|
? allowedTypes[0]
|
|
101
101
|
: { anyOf: allowedTypes };
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
const output: Mutable<JsonArrayNodeSchema> = {
|
|
104
104
|
type: "array",
|
|
105
105
|
_treeNodeSchemaKind: NodeKind.Array,
|
|
106
106
|
items,
|
|
107
107
|
};
|
|
108
|
+
|
|
109
|
+
copyProperty(schema.metadata, "description", output);
|
|
110
|
+
|
|
111
|
+
return output;
|
|
108
112
|
}
|
|
109
113
|
|
|
110
114
|
function convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema {
|
|
@@ -137,9 +141,9 @@ function convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema
|
|
|
137
141
|
function convertObjectNodeSchema(schema: SimpleObjectNodeSchema): JsonObjectNodeSchema {
|
|
138
142
|
const properties: Record<string, JsonFieldSchema> = {};
|
|
139
143
|
const required: string[] = [];
|
|
140
|
-
for (const [key,
|
|
144
|
+
for (const [key, fieldSchema] of Object.entries(schema.fields)) {
|
|
141
145
|
const allowedTypes: JsonSchemaRef[] = [];
|
|
142
|
-
for (const allowedType of
|
|
146
|
+
for (const allowedType of fieldSchema.allowedTypes) {
|
|
143
147
|
allowedTypes.push(createSchemaRef(allowedType));
|
|
144
148
|
}
|
|
145
149
|
|
|
@@ -149,24 +153,25 @@ function convertObjectNodeSchema(schema: SimpleObjectNodeSchema): JsonObjectNode
|
|
|
149
153
|
anyOf: allowedTypes,
|
|
150
154
|
};
|
|
151
155
|
|
|
152
|
-
|
|
153
|
-
if (value.metadata?.description !== undefined) {
|
|
154
|
-
output.description = value.metadata.description;
|
|
155
|
-
}
|
|
156
|
-
|
|
156
|
+
copyProperty(fieldSchema.metadata, "description", output);
|
|
157
157
|
properties[key] = output;
|
|
158
158
|
|
|
159
|
-
if (
|
|
159
|
+
if (fieldSchema.kind === FieldKind.Required) {
|
|
160
160
|
required.push(key);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
|
|
164
|
+
const transformedNode: Mutable<JsonObjectNodeSchema> = {
|
|
164
165
|
type: "object",
|
|
165
166
|
_treeNodeSchemaKind: NodeKind.Object,
|
|
166
167
|
properties,
|
|
167
168
|
required,
|
|
168
169
|
additionalProperties: false,
|
|
169
170
|
};
|
|
171
|
+
|
|
172
|
+
copyProperty(schema.metadata, "description", transformedNode);
|
|
173
|
+
|
|
174
|
+
return transformedNode;
|
|
170
175
|
}
|
|
171
176
|
|
|
172
177
|
function convertMapNodeSchema(schema: SimpleMapNodeSchema): JsonMapNodeSchema {
|
|
@@ -174,7 +179,8 @@ function convertMapNodeSchema(schema: SimpleMapNodeSchema): JsonMapNodeSchema {
|
|
|
174
179
|
schema.allowedTypes.forEach((type) => {
|
|
175
180
|
allowedTypes.push(createSchemaRef(type));
|
|
176
181
|
});
|
|
177
|
-
|
|
182
|
+
|
|
183
|
+
const output: Mutable<JsonMapNodeSchema> = {
|
|
178
184
|
type: "object",
|
|
179
185
|
_treeNodeSchemaKind: NodeKind.Map,
|
|
180
186
|
patternProperties: {
|
|
@@ -185,6 +191,10 @@ function convertMapNodeSchema(schema: SimpleMapNodeSchema): JsonMapNodeSchema {
|
|
|
185
191
|
},
|
|
186
192
|
},
|
|
187
193
|
};
|
|
194
|
+
|
|
195
|
+
copyProperty(schema.metadata, "description", output);
|
|
196
|
+
|
|
197
|
+
return output;
|
|
188
198
|
}
|
|
189
199
|
|
|
190
200
|
function createSchemaRef(schemaId: string): JsonSchemaRef {
|
|
@@ -12,9 +12,16 @@ import type {
|
|
|
12
12
|
RevertibleFactory,
|
|
13
13
|
} from "../../core/index.js";
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import type {
|
|
16
|
+
RunTransactionParams,
|
|
17
|
+
VoidTransactionCallbackStatus,
|
|
18
|
+
TransactionCallbackStatus,
|
|
19
|
+
TransactionResult,
|
|
20
|
+
TransactionResultExt,
|
|
21
|
+
// This is referenced by doc comments.
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports
|
|
23
|
+
TreeAlpha,
|
|
24
|
+
} from "../../shared-tree/index.js";
|
|
18
25
|
|
|
19
26
|
import {
|
|
20
27
|
type ImplicitFieldSchema,
|
|
@@ -35,7 +42,6 @@ import { markSchemaMostDerived } from "./schemaFactory.js";
|
|
|
35
42
|
import { fail, getOrCreate } from "../../util/index.js";
|
|
36
43
|
import type { MakeNominal } from "../../util/index.js";
|
|
37
44
|
import { walkFieldSchema } from "../walkFieldSchema.js";
|
|
38
|
-
|
|
39
45
|
/**
|
|
40
46
|
* A tree from which a {@link TreeView} can be created.
|
|
41
47
|
*
|
|
@@ -542,6 +548,72 @@ export interface TreeViewAlpha<
|
|
|
542
548
|
|
|
543
549
|
// Override the base branch method to return a typed view rather than merely a branch.
|
|
544
550
|
fork(): ReturnType<TreeBranch["fork"]> & TreeViewAlpha<TSchema>;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Run a transaction which applies one or more edits to the tree as a single atomic unit.
|
|
554
|
+
* @param transaction - The function to run as the body of the transaction.
|
|
555
|
+
* It should return a status object of {@link TransactionCallbackStatus | TransactionCallbackStatus } type.
|
|
556
|
+
* It includes a "rollback" property which may be returned as true at any point during the transaction. This will
|
|
557
|
+
* abort the transaction and discard any changes it made so far.
|
|
558
|
+
* "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
559
|
+
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
560
|
+
* @returns A result object of {@link TransactionResultExt | TransactionResultExt} type. It includes the following:
|
|
561
|
+
* - A "success" flag indicating whether the transaction was successful or not.
|
|
562
|
+
* - The success of failure value as returned by the transaction function.
|
|
563
|
+
* @remarks
|
|
564
|
+
* This API will throw an error if the constraints are not met or something unexpected happens.
|
|
565
|
+
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
566
|
+
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
567
|
+
* However, using a transaction has the following additional consequences:
|
|
568
|
+
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
569
|
+
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
570
|
+
*
|
|
571
|
+
* Local change events will be emitted for each change as the transaction is being applied.
|
|
572
|
+
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
573
|
+
*
|
|
574
|
+
* Nested transactions:
|
|
575
|
+
* This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
|
|
576
|
+
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
577
|
+
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
578
|
+
* for the outermost transaction which includes all inner transactions.
|
|
579
|
+
* - Undo will undo the outermost transaction and all inner transactions.
|
|
580
|
+
*/
|
|
581
|
+
runTransaction<TSuccessValue, TFailureValue>(
|
|
582
|
+
transaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>,
|
|
583
|
+
params?: RunTransactionParams,
|
|
584
|
+
): TransactionResultExt<TSuccessValue, TFailureValue>;
|
|
585
|
+
/**
|
|
586
|
+
* Run a transaction which applies one or more edits to the tree as a single atomic unit.
|
|
587
|
+
* @param transaction - The function to run as the body of the transaction. It may return the following:
|
|
588
|
+
* - Nothing to indicate that the body of the transaction has successfully run.
|
|
589
|
+
* - A status object of {@link VoidTransactionCallbackStatus | VoidTransactionCallbackStatus } type. It includes a "rollback" property which
|
|
590
|
+
* may be returned as true at any point during the transaction. This will abort the transaction and discard any changes it made so
|
|
591
|
+
* far. "rollback" can be set to false or left undefined to indicate that the body of the transaction has successfully run.
|
|
592
|
+
* @param params - The optional parameters for the transaction. It includes the constraints that will be checked before the transaction begins.
|
|
593
|
+
* @returns A result object of {@link TransactionResult | TransactionResult} type. It includes a "success" flag indicating whether the
|
|
594
|
+
* transaction was successful or not.
|
|
595
|
+
* @remarks
|
|
596
|
+
* This API will throw an error if the constraints are not met or something unexpected happens.
|
|
597
|
+
* All of the changes in the transaction are applied synchronously and therefore no other changes (either from this client or from a remote client) can be interleaved with those changes.
|
|
598
|
+
* Note that this is guaranteed by Fluid for any sequence of changes that are submitted synchronously, whether in a transaction or not.
|
|
599
|
+
* However, using a transaction has the following additional consequences:
|
|
600
|
+
* - If reverted (e.g. via an "undo" operation), all the changes in the transaction are reverted together.
|
|
601
|
+
* - The internal data representation of a transaction with many changes is generally smaller and more efficient than that of the changes when separate.
|
|
602
|
+
*
|
|
603
|
+
* Local change events will be emitted for each change as the transaction is being applied.
|
|
604
|
+
* If the transaction is rolled back, a corresponding change event will also be emitted for the rollback.
|
|
605
|
+
*
|
|
606
|
+
* Nested transactions:
|
|
607
|
+
* This API can be called from within the transaction callback of another runTransaction call. That will have slightly different behavior:
|
|
608
|
+
* - If the inner transaction fails, only the inner transaction will be rolled back and the outer transaction will continue.
|
|
609
|
+
* - Constraints will apply to the outermost transaction. Constraints are applied per commit and there will be one commit generated
|
|
610
|
+
* for the outermost transaction which includes all inner transactions.
|
|
611
|
+
* - Undo will undo the outermost transaction and all inner transactions.
|
|
612
|
+
*/
|
|
613
|
+
runTransaction(
|
|
614
|
+
transaction: () => VoidTransactionCallbackStatus | void,
|
|
615
|
+
params?: RunTransactionParams,
|
|
616
|
+
): TransactionResult;
|
|
545
617
|
}
|
|
546
618
|
|
|
547
619
|
/**
|
|
@@ -174,7 +174,7 @@ export const treeNodeApi: TreeNodeApi = {
|
|
|
174
174
|
changedFields,
|
|
175
175
|
(field) =>
|
|
176
176
|
nodeSchema.storedKeyToPropertyKey.get(field) ??
|
|
177
|
-
fail(
|
|
177
|
+
fail("Could not find stored key in schema."),
|
|
178
178
|
),
|
|
179
179
|
);
|
|
180
180
|
listener({ changedProperties });
|
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
SimpleTreeSchema,
|
|
21
21
|
} from "./simpleSchema.js";
|
|
22
22
|
import type { ValueSchema } from "../../core/index.js";
|
|
23
|
-
import { getOrCreate, type Mutable } from "../../util/index.js";
|
|
23
|
+
import { copyProperty, getOrCreate, type Mutable } from "../../util/index.js";
|
|
24
24
|
import { isObjectNodeSchema, type ObjectNodeSchema } from "../objectNodeTypes.js";
|
|
25
25
|
import { NodeKind, type TreeNodeSchema } from "../core/index.js";
|
|
26
26
|
|
|
@@ -41,11 +41,7 @@ export function toSimpleTreeSchema(schema: ImplicitFieldSchema): SimpleTreeSchem
|
|
|
41
41
|
definitions,
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
if (normalizedSchema.metadata !== undefined) {
|
|
46
|
-
output.metadata = normalizedSchema.metadata;
|
|
47
|
-
}
|
|
48
|
-
|
|
44
|
+
copyProperty(normalizedSchema, "metadata", output);
|
|
49
45
|
return output;
|
|
50
46
|
}
|
|
51
47
|
|
|
@@ -95,20 +91,28 @@ function leafSchemaToSimpleSchema(schema: TreeNodeSchema): SimpleLeafNodeSchema
|
|
|
95
91
|
function arraySchemaToSimpleSchema(schema: TreeNodeSchema): SimpleArrayNodeSchema {
|
|
96
92
|
const fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);
|
|
97
93
|
const allowedTypes = allowedTypesFromFieldSchema(fieldSchema);
|
|
98
|
-
|
|
94
|
+
const output: Mutable<SimpleArrayNodeSchema> = {
|
|
99
95
|
kind: NodeKind.Array,
|
|
100
96
|
allowedTypes,
|
|
101
97
|
};
|
|
98
|
+
|
|
99
|
+
copyProperty(schema, "metadata", output);
|
|
100
|
+
|
|
101
|
+
return output;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// TODO: Use a stronger type for map schemas once one is available (see object schema handler for an example).
|
|
105
105
|
function mapSchemaToSimpleSchema(schema: TreeNodeSchema): SimpleMapNodeSchema {
|
|
106
106
|
const fieldSchema = normalizeFieldSchema(schema.info as ImplicitAllowedTypes);
|
|
107
107
|
const allowedTypes = allowedTypesFromFieldSchema(fieldSchema);
|
|
108
|
-
|
|
108
|
+
const output: Mutable<SimpleMapNodeSchema> = {
|
|
109
109
|
kind: NodeKind.Map,
|
|
110
110
|
allowedTypes,
|
|
111
111
|
};
|
|
112
|
+
|
|
113
|
+
copyProperty(schema, "metadata", output);
|
|
114
|
+
|
|
115
|
+
return output;
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
function objectSchemaToSimpleSchema(schema: ObjectNodeSchema): SimpleObjectNodeSchema {
|
|
@@ -116,10 +120,15 @@ function objectSchemaToSimpleSchema(schema: ObjectNodeSchema): SimpleObjectNodeS
|
|
|
116
120
|
for (const [key, field] of schema.fields) {
|
|
117
121
|
fields[key] = fieldSchemaToSimpleSchema(field);
|
|
118
122
|
}
|
|
119
|
-
|
|
123
|
+
|
|
124
|
+
const output: Mutable<SimpleObjectNodeSchema> = {
|
|
120
125
|
kind: NodeKind.Object,
|
|
121
126
|
fields,
|
|
122
127
|
};
|
|
128
|
+
|
|
129
|
+
copyProperty(schema, "metadata", output);
|
|
130
|
+
|
|
131
|
+
return output;
|
|
123
132
|
}
|
|
124
133
|
|
|
125
134
|
/**
|
|
@@ -140,10 +149,7 @@ function fieldSchemaToSimpleSchema(schema: FieldSchema): SimpleFieldSchema {
|
|
|
140
149
|
allowedTypes,
|
|
141
150
|
};
|
|
142
151
|
|
|
143
|
-
|
|
144
|
-
if (schema.metadata !== undefined) {
|
|
145
|
-
result.metadata = schema.metadata;
|
|
146
|
-
}
|
|
152
|
+
copyProperty(schema, "metadata", result);
|
|
147
153
|
|
|
148
154
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
149
155
|
(schema as any)[simpleFieldSchemaCacheSymbol] = result;
|