@fluidframework/tree 2.3.1 → 2.4.0-297027
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/api-report/tree.alpha.api.md +77 -38
- package/api-report/tree.beta.api.md +50 -30
- package/api-report/tree.legacy.alpha.api.md +50 -30
- package/api-report/tree.legacy.public.api.md +50 -30
- package/api-report/tree.public.api.md +50 -30
- package/dist/alpha.d.ts +7 -0
- package/dist/beta.d.ts +4 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +1 -0
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +8 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +7 -0
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +9 -0
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +1 -2
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +2 -2
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +13 -2
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexTypes.d.ts +1 -1
- package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
- package/dist/feature-libraries/editableTreeBinder.d.ts +3 -230
- package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
- package/dist/feature-libraries/editableTreeBinder.js +1 -539
- package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +7 -14
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +3 -3
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -16
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +2 -3
- package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyEntity.js +1 -2
- package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +10 -15
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +18 -20
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts +4 -5
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +13 -23
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/flex-tree/utilities.js +1 -1
- package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +4 -7
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +5 -31
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +7 -0
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +61 -17
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +3 -0
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV1.d.ts +18 -18
- package/dist/feature-libraries/sequence-field/formatV2.d.ts +18 -18
- package/dist/feature-libraries/sequence-field/formatV3.d.ts +27 -27
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +1 -4
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/typed-schema/flexList.d.ts +1 -46
- package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/flexList.js +1 -13
- package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
- package/dist/feature-libraries/typed-schema/index.d.ts +2 -4
- package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/index.js +1 -19
- package/dist/feature-libraries/typed-schema/index.js.map +1 -1
- package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -212
- package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/typedTreeSchema.js +0 -266
- package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/internalTypes.d.ts +1 -1
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/legacy.d.ts +4 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +4 -0
- package/dist/shared-tree/checkoutFlexTreeView.d.ts +3 -3
- package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.js +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +3 -3
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +2 -3
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +1 -40
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +2 -11
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +9 -7
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +19 -8
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +19 -2
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +10 -2
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +71 -41
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +116 -84
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +8 -11
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +12 -15
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +1 -1
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +11 -13
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.d.ts +3 -3
- package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.js +1 -1
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.d.ts +2 -2
- package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -1
- 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 +13 -14
- 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 +14 -8
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +21 -2
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +3 -3
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/simpleSchema.d.ts +18 -10
- 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.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +30 -17
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +16 -6
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +4 -4
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +8 -6
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +6 -10
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/{lib/feature-libraries/typed-schema → dist/simple-tree/api}/view.d.ts +4 -11
- package/dist/simple-tree/api/view.d.ts.map +1 -0
- package/dist/{feature-libraries/typed-schema → simple-tree/api}/view.js +9 -9
- package/dist/simple-tree/api/view.js.map +1 -0
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -2
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +11 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +147 -14
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +32 -20
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/context.d.ts +55 -0
- package/dist/simple-tree/core/context.d.ts.map +1 -0
- package/dist/simple-tree/core/context.js +60 -0
- package/dist/simple-tree/core/context.js.map +1 -0
- package/dist/simple-tree/core/getOrCreateNode.d.ts +15 -0
- package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -0
- package/dist/simple-tree/core/getOrCreateNode.js +36 -0
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -0
- package/dist/simple-tree/core/index.d.ts +7 -3
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +16 -7
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/schemaCaching.d.ts +5 -13
- package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
- package/dist/simple-tree/core/schemaCaching.js +16 -45
- package/dist/simple-tree/core/schemaCaching.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +29 -7
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +94 -58
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +24 -0
- 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/core/types.d.ts +0 -5
- package/dist/simple-tree/core/types.d.ts.map +1 -1
- package/dist/simple-tree/core/types.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +139 -0
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -0
- package/dist/{feature-libraries/flex-map-tree/mapTreeNode.js → simple-tree/core/unhydratedFlexTree.js} +112 -132
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -0
- package/dist/simple-tree/{walkSchema.d.ts → core/walkSchema.d.ts} +8 -4
- package/dist/simple-tree/core/walkSchema.d.ts.map +1 -0
- package/dist/simple-tree/core/walkSchema.js +34 -0
- package/dist/simple-tree/core/walkSchema.js.map +1 -0
- package/dist/simple-tree/createContext.d.ts +11 -0
- package/dist/simple-tree/createContext.d.ts.map +1 -0
- package/dist/simple-tree/createContext.js +25 -0
- package/dist/simple-tree/createContext.js.map +1 -0
- package/dist/simple-tree/index.d.ts +4 -5
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +7 -7
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +1 -0
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +1 -2
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts +4 -4
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +9 -5
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +8 -8
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +33 -14
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +7 -3
- package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/proxies.d.ts +1 -2
- package/dist/simple-tree/proxies.d.ts.map +1 -1
- package/dist/simple-tree/proxies.js +6 -22
- package/dist/simple-tree/proxies.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +44 -4
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +10 -0
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toFlexSchema.d.ts +6 -36
- package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
- package/dist/simple-tree/toFlexSchema.js +58 -142
- package/dist/simple-tree/toFlexSchema.js.map +1 -1
- package/dist/simple-tree/toMapTree.d.ts.map +1 -1
- package/dist/simple-tree/toMapTree.js +2 -2
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts +13 -5
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +19 -10
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/typesUnsafe.d.ts +4 -4
- package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/walkFieldSchema.d.ts +11 -0
- package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -0
- package/dist/simple-tree/walkFieldSchema.js +17 -0
- package/dist/simple-tree/walkFieldSchema.js.map +1 -0
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/typeUtils.d.ts +14 -45
- package/dist/util/typeUtils.d.ts.map +1 -1
- package/dist/util/typeUtils.js.map +1 -1
- package/lib/alpha.d.ts +7 -0
- package/lib/beta.d.ts +4 -0
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +1 -0
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +6 -0
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +7 -0
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +9 -0
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +1 -2
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +2 -2
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +13 -2
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexTypes.d.ts +1 -1
- package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
- package/lib/feature-libraries/editableTreeBinder.d.ts +3 -230
- package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
- package/lib/feature-libraries/editableTreeBinder.js +1 -532
- package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +7 -14
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +3 -3
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -16
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +2 -3
- package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.js +1 -2
- package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +10 -15
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +18 -20
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts +4 -5
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +13 -23
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/flex-tree/utilities.js +1 -1
- package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +4 -7
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +4 -6
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +7 -0
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +62 -18
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +3 -0
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV1.d.ts +18 -18
- package/lib/feature-libraries/sequence-field/formatV2.d.ts +18 -18
- package/lib/feature-libraries/sequence-field/formatV3.d.ts +27 -27
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +2 -5
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/typed-schema/flexList.d.ts +1 -46
- package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/flexList.js +0 -11
- package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
- package/lib/feature-libraries/typed-schema/index.d.ts +2 -4
- package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/index.js +0 -3
- package/lib/feature-libraries/typed-schema/index.js.map +1 -1
- package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -212
- package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -253
- package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/internalTypes.d.ts +1 -1
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/legacy.d.ts +4 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +4 -0
- package/lib/shared-tree/checkoutFlexTreeView.d.ts +3 -3
- package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.js +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +3 -3
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -2
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +1 -40
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +1 -9
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +9 -7
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +22 -11
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +19 -2
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +10 -3
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +71 -41
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +118 -86
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +8 -11
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +12 -15
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +1 -1
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +14 -16
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.d.ts +3 -3
- package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.js +1 -1
- package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/getSimpleSchema.d.ts +2 -2
- package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -1
- 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 +13 -14
- 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 +14 -8
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +21 -2
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +3 -3
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/simpleSchema.d.ts +18 -10
- 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.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +31 -18
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +16 -6
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +4 -4
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +10 -8
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +6 -10
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/{dist/feature-libraries/typed-schema → lib/simple-tree/api}/view.d.ts +4 -11
- package/lib/simple-tree/api/view.d.ts.map +1 -0
- package/lib/{feature-libraries/typed-schema → simple-tree/api}/view.js +9 -9
- package/lib/simple-tree/api/view.js.map +1 -0
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +2 -2
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +11 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +147 -14
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +37 -25
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/context.d.ts +55 -0
- package/lib/simple-tree/core/context.d.ts.map +1 -0
- package/lib/simple-tree/core/context.js +55 -0
- package/lib/simple-tree/core/context.js.map +1 -0
- package/lib/simple-tree/core/getOrCreateNode.d.ts +15 -0
- package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -0
- package/lib/simple-tree/core/getOrCreateNode.js +32 -0
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -0
- package/lib/simple-tree/core/index.d.ts +7 -3
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +6 -2
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/schemaCaching.d.ts +5 -13
- package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
- package/lib/simple-tree/core/schemaCaching.js +13 -39
- package/lib/simple-tree/core/schemaCaching.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +29 -7
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +89 -54
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +24 -0
- 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/core/types.d.ts +0 -5
- package/lib/simple-tree/core/types.d.ts.map +1 -1
- package/lib/simple-tree/core/types.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +139 -0
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -0
- package/lib/{feature-libraries/flex-map-tree/mapTreeNode.js → simple-tree/core/unhydratedFlexTree.js} +110 -128
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -0
- package/lib/simple-tree/{walkSchema.d.ts → core/walkSchema.d.ts} +8 -4
- package/lib/simple-tree/core/walkSchema.d.ts.map +1 -0
- package/lib/simple-tree/core/walkSchema.js +29 -0
- package/lib/simple-tree/core/walkSchema.js.map +1 -0
- package/lib/simple-tree/createContext.d.ts +11 -0
- package/lib/simple-tree/createContext.d.ts.map +1 -0
- package/lib/simple-tree/createContext.js +21 -0
- package/lib/simple-tree/createContext.js.map +1 -0
- package/lib/simple-tree/index.d.ts +4 -5
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +3 -4
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +1 -0
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +3 -4
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/mapNode.d.ts +4 -4
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +12 -8
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +8 -8
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +36 -17
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +7 -3
- package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/proxies.d.ts +1 -2
- package/lib/simple-tree/proxies.d.ts.map +1 -1
- package/lib/simple-tree/proxies.js +7 -22
- package/lib/simple-tree/proxies.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +44 -4
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +10 -0
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toFlexSchema.d.ts +6 -36
- package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
- package/lib/simple-tree/toFlexSchema.js +61 -142
- package/lib/simple-tree/toFlexSchema.js.map +1 -1
- package/lib/simple-tree/toMapTree.d.ts.map +1 -1
- package/lib/simple-tree/toMapTree.js +4 -4
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts +13 -5
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +21 -12
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/typesUnsafe.d.ts +4 -4
- package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/walkFieldSchema.d.ts +11 -0
- package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -0
- package/lib/simple-tree/walkFieldSchema.js +13 -0
- package/lib/simple-tree/walkFieldSchema.js.map +1 -0
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/typeUtils.d.ts +14 -45
- package/lib/util/typeUtils.d.ts.map +1 -1
- package/lib/util/typeUtils.js.map +1 -1
- package/package.json +41 -22
- package/src/core/index.ts +1 -0
- package/src/core/rebase/index.ts +1 -0
- package/src/core/rebase/types.ts +11 -0
- package/src/core/schema-stored/schema.ts +18 -0
- package/src/core/tree/anchorSet.ts +3 -4
- package/src/core/tree/detachedFieldIndex.ts +14 -3
- package/src/core/tree/detachedFieldIndexTypes.ts +1 -1
- package/src/feature-libraries/editableTreeBinder.ts +2 -915
- package/src/feature-libraries/flex-tree/context.ts +7 -20
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -18
- package/src/feature-libraries/flex-tree/lazyEntity.ts +1 -4
- package/src/feature-libraries/flex-tree/lazyField.ts +22 -78
- package/src/feature-libraries/flex-tree/lazyNode.ts +24 -39
- package/src/feature-libraries/flex-tree/utilities.ts +1 -1
- package/src/feature-libraries/index.ts +3 -71
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +97 -10
- package/src/feature-libraries/sequence-field/compose.ts +3 -0
- package/src/feature-libraries/sequence-field/utils.ts +2 -4
- package/src/feature-libraries/typed-schema/flexList.ts +3 -84
- package/src/feature-libraries/typed-schema/index.ts +1 -33
- package/src/feature-libraries/typed-schema/typedTreeSchema.ts +0 -458
- package/src/index.ts +7 -0
- package/src/internalTypes.ts +0 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/checkoutFlexTreeView.ts +3 -3
- package/src/shared-tree/index.ts +4 -8
- package/src/shared-tree/schematizeTree.ts +2 -56
- package/src/shared-tree/schematizingTreeView.ts +38 -15
- package/src/shared-tree/sharedTree.ts +36 -8
- package/src/shared-tree/treeCheckout.ts +225 -128
- package/src/shared-tree-core/branch.ts +15 -26
- package/src/simple-tree/api/create.ts +18 -20
- package/src/simple-tree/api/getJsonSchema.ts +3 -3
- package/src/simple-tree/api/getSimpleSchema.ts +2 -2
- package/src/simple-tree/api/index.ts +2 -0
- package/src/simple-tree/api/jsonSchema.ts +19 -17
- package/src/simple-tree/api/schemaFactory.ts +53 -18
- package/src/simple-tree/api/schemaFactoryRecursive.ts +3 -6
- package/src/simple-tree/api/simpleSchema.ts +20 -10
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +40 -19
- package/src/simple-tree/api/tree.ts +20 -9
- package/src/simple-tree/api/treeNodeApi.ts +12 -10
- package/src/simple-tree/api/verboseTree.ts +6 -12
- package/src/{feature-libraries/typed-schema → simple-tree/api}/view.ts +9 -22
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +18 -4
- package/src/simple-tree/arrayNode.ts +202 -53
- package/src/simple-tree/core/context.ts +78 -0
- package/src/simple-tree/core/getOrCreateNode.ts +38 -0
- package/src/simple-tree/core/index.ts +11 -7
- package/src/simple-tree/core/schemaCaching.ts +13 -50
- package/src/simple-tree/core/treeNodeKernel.ts +117 -78
- package/src/simple-tree/core/treeNodeSchema.ts +35 -1
- package/src/simple-tree/core/types.ts +0 -5
- package/src/{feature-libraries/flex-map-tree/mapTreeNode.ts → simple-tree/core/unhydratedFlexTree.ts} +167 -210
- package/src/simple-tree/{walkSchema.ts → core/walkSchema.ts} +12 -34
- package/src/simple-tree/createContext.ts +24 -0
- package/src/simple-tree/index.ts +6 -2
- package/src/simple-tree/leafNodeSchema.ts +3 -9
- package/src/simple-tree/mapNode.ts +20 -17
- package/src/simple-tree/objectNode.ts +63 -38
- package/src/simple-tree/objectNodeTypes.ts +8 -5
- package/src/simple-tree/proxies.ts +8 -26
- package/src/simple-tree/schemaTypes.ts +55 -5
- package/src/simple-tree/toFlexSchema.ts +71 -204
- package/src/simple-tree/toMapTree.ts +5 -5
- package/src/simple-tree/treeNodeValid.ts +28 -22
- package/src/simple-tree/typesUnsafe.ts +4 -4
- package/src/simple-tree/walkFieldSchema.ts +19 -0
- package/src/util/index.ts +1 -5
- package/src/util/typeUtils.ts +14 -56
- package/dist/feature-libraries/fieldGenerator.d.ts +0 -43
- package/dist/feature-libraries/fieldGenerator.d.ts.map +0 -1
- package/dist/feature-libraries/fieldGenerator.js +0 -13
- package/dist/feature-libraries/fieldGenerator.js.map +0 -1
- package/dist/feature-libraries/flex-map-tree/index.d.ts +0 -6
- package/dist/feature-libraries/flex-map-tree/index.d.ts.map +0 -1
- package/dist/feature-libraries/flex-map-tree/index.js +0 -14
- package/dist/feature-libraries/flex-map-tree/index.js.map +0 -1
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -157
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +0 -1
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +0 -1
- package/dist/feature-libraries/storedToViewSchema.d.ts +0 -17
- package/dist/feature-libraries/storedToViewSchema.d.ts.map +0 -1
- package/dist/feature-libraries/storedToViewSchema.js +0 -67
- package/dist/feature-libraries/storedToViewSchema.js.map +0 -1
- package/dist/feature-libraries/typed-schema/schemaCollection.d.ts +0 -58
- package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +0 -1
- package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -160
- package/dist/feature-libraries/typed-schema/schemaCollection.js.map +0 -1
- package/dist/feature-libraries/typed-schema/typeUtils.d.ts +0 -15
- package/dist/feature-libraries/typed-schema/typeUtils.d.ts.map +0 -1
- package/dist/feature-libraries/typed-schema/typeUtils.js +0 -14
- package/dist/feature-libraries/typed-schema/typeUtils.js.map +0 -1
- package/dist/feature-libraries/typed-schema/view.d.ts.map +0 -1
- package/dist/feature-libraries/typed-schema/view.js.map +0 -1
- package/dist/simple-tree/getSimpleFieldSchema.d.ts +0 -14
- package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +0 -1
- package/dist/simple-tree/getSimpleFieldSchema.js +0 -29
- package/dist/simple-tree/getSimpleFieldSchema.js.map +0 -1
- package/dist/simple-tree/walkSchema.d.ts.map +0 -1
- package/dist/simple-tree/walkSchema.js +0 -49
- package/dist/simple-tree/walkSchema.js.map +0 -1
- package/lib/feature-libraries/fieldGenerator.d.ts +0 -43
- package/lib/feature-libraries/fieldGenerator.d.ts.map +0 -1
- package/lib/feature-libraries/fieldGenerator.js +0 -12
- package/lib/feature-libraries/fieldGenerator.js.map +0 -1
- package/lib/feature-libraries/flex-map-tree/index.d.ts +0 -6
- package/lib/feature-libraries/flex-map-tree/index.d.ts.map +0 -1
- package/lib/feature-libraries/flex-map-tree/index.js +0 -6
- package/lib/feature-libraries/flex-map-tree/index.js.map +0 -1
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +0 -157
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +0 -1
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +0 -1
- package/lib/feature-libraries/storedToViewSchema.d.ts +0 -17
- package/lib/feature-libraries/storedToViewSchema.d.ts.map +0 -1
- package/lib/feature-libraries/storedToViewSchema.js +0 -62
- package/lib/feature-libraries/storedToViewSchema.js.map +0 -1
- package/lib/feature-libraries/typed-schema/schemaCollection.d.ts +0 -58
- package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +0 -1
- package/lib/feature-libraries/typed-schema/schemaCollection.js +0 -153
- package/lib/feature-libraries/typed-schema/schemaCollection.js.map +0 -1
- package/lib/feature-libraries/typed-schema/typeUtils.d.ts +0 -15
- package/lib/feature-libraries/typed-schema/typeUtils.d.ts.map +0 -1
- package/lib/feature-libraries/typed-schema/typeUtils.js +0 -10
- package/lib/feature-libraries/typed-schema/typeUtils.js.map +0 -1
- package/lib/feature-libraries/typed-schema/view.d.ts.map +0 -1
- package/lib/feature-libraries/typed-schema/view.js.map +0 -1
- package/lib/simple-tree/getSimpleFieldSchema.d.ts +0 -14
- package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +0 -1
- package/lib/simple-tree/getSimpleFieldSchema.js +0 -25
- package/lib/simple-tree/getSimpleFieldSchema.js.map +0 -1
- package/lib/simple-tree/walkSchema.d.ts.map +0 -1
- package/lib/simple-tree/walkSchema.js +0 -43
- package/lib/simple-tree/walkSchema.js.map +0 -1
- package/src/feature-libraries/fieldGenerator.ts +0 -47
- package/src/feature-libraries/flex-map-tree/index.ts +0 -14
- package/src/feature-libraries/storedToViewSchema.ts +0 -100
- package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -254
- package/src/feature-libraries/typed-schema/typeUtils.ts +0 -29
- package/src/simple-tree/getSimpleFieldSchema.ts +0 -36
|
@@ -7,7 +7,6 @@ import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
|
7
7
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
8
|
|
|
9
9
|
import type { ITreeCursorSynchronous, SchemaAndPolicy } from "../../core/index.js";
|
|
10
|
-
import { fail } from "../../util/index.js";
|
|
11
10
|
import type {
|
|
12
11
|
TreeLeafValue,
|
|
13
12
|
ImplicitFieldSchema,
|
|
@@ -16,19 +15,20 @@ import type {
|
|
|
16
15
|
FieldSchema,
|
|
17
16
|
FieldKind,
|
|
18
17
|
} from "../schemaTypes.js";
|
|
19
|
-
import
|
|
18
|
+
import {
|
|
19
|
+
getOrCreateNodeFromInnerNode,
|
|
20
|
+
UnhydratedFlexTreeNode,
|
|
21
|
+
type Unhydrated,
|
|
22
|
+
} from "../core/index.js";
|
|
20
23
|
import {
|
|
21
24
|
cursorForMapTreeNode,
|
|
22
25
|
defaultSchemaPolicy,
|
|
23
26
|
FieldKinds,
|
|
24
|
-
intoStoredSchema,
|
|
25
27
|
mapTreeFromCursor,
|
|
26
|
-
UnhydratedContext,
|
|
27
28
|
type NodeKeyManager,
|
|
28
29
|
} from "../../feature-libraries/index.js";
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import { toFlexSchema } from "../toFlexSchema.js";
|
|
30
|
+
import { isFieldInSchema } from "../../feature-libraries/index.js";
|
|
31
|
+
import { toStoredSchema } from "../toFlexSchema.js";
|
|
32
32
|
import { inSchemaOrThrow, mapTreeFromNodeData, type InsertableContent } from "../toMapTree.js";
|
|
33
33
|
import {
|
|
34
34
|
applySchemaToParserOptions,
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
type VerboseTree,
|
|
38
38
|
type VerboseTreeNode,
|
|
39
39
|
} from "./verboseTree.js";
|
|
40
|
+
import { getUnhydratedContext } from "../createContext.js";
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
* Construct tree content that is compatible with the field defined by the provided `schema`.
|
|
@@ -78,11 +79,11 @@ export function cursorFromInsertable<TSchema extends ImplicitFieldSchema>(
|
|
|
78
79
|
):
|
|
79
80
|
| ITreeCursorSynchronous
|
|
80
81
|
| (TSchema extends FieldSchema<FieldKind.Optional> ? undefined : never) {
|
|
81
|
-
const
|
|
82
|
+
const storedSchema = toStoredSchema(schema);
|
|
82
83
|
const schemaValidationPolicy: SchemaAndPolicy = {
|
|
83
84
|
policy: defaultSchemaPolicy,
|
|
84
85
|
// TODO: optimize: This isn't the most efficient operation since its not cached, and has to convert all the schema.
|
|
85
|
-
schema:
|
|
86
|
+
schema: storedSchema,
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
const mapTree = mapTreeFromNodeData(
|
|
@@ -93,7 +94,7 @@ export function cursorFromInsertable<TSchema extends ImplicitFieldSchema>(
|
|
|
93
94
|
);
|
|
94
95
|
if (mapTree === undefined) {
|
|
95
96
|
assert(
|
|
96
|
-
|
|
97
|
+
storedSchema.rootFieldSchema.kind === FieldKinds.optional.identifier,
|
|
97
98
|
0xa10 /* missing non-optional field */,
|
|
98
99
|
);
|
|
99
100
|
return undefined as TSchema extends FieldSchema<FieldKind.Optional> ? undefined : never;
|
|
@@ -149,17 +150,17 @@ export function createFromCursor<TSchema extends ImplicitFieldSchema>(
|
|
|
149
150
|
cursor: ITreeCursorSynchronous | undefined,
|
|
150
151
|
): Unhydrated<TreeFieldFromImplicitField<TSchema>> {
|
|
151
152
|
const mapTrees = cursor === undefined ? [] : [mapTreeFromCursor(cursor)];
|
|
152
|
-
const
|
|
153
|
+
const context = getUnhydratedContext(schema);
|
|
154
|
+
const flexSchema = context.flexContext.schema;
|
|
153
155
|
|
|
154
156
|
const schemaValidationPolicy: SchemaAndPolicy = {
|
|
155
157
|
policy: defaultSchemaPolicy,
|
|
156
|
-
|
|
157
|
-
schema: intoStoredSchema(flexSchema),
|
|
158
|
+
schema: context.flexContext.schema,
|
|
158
159
|
};
|
|
159
160
|
|
|
160
161
|
const maybeError = isFieldInSchema(
|
|
161
162
|
mapTrees,
|
|
162
|
-
flexSchema.rootFieldSchema
|
|
163
|
+
flexSchema.rootFieldSchema,
|
|
163
164
|
schemaValidationPolicy,
|
|
164
165
|
);
|
|
165
166
|
inSchemaOrThrow(maybeError);
|
|
@@ -171,14 +172,11 @@ export function createFromCursor<TSchema extends ImplicitFieldSchema>(
|
|
|
171
172
|
// Length asserted above, so this is safe. This assert is done instead of checking for undefined after indexing to ensure a length greater than 1 also errors.
|
|
172
173
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
173
174
|
const mapTree = mapTrees[0]!;
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
new UnhydratedContext(flexSchema),
|
|
177
|
-
rootSchema,
|
|
175
|
+
const mapTreeNode = UnhydratedFlexTreeNode.getOrCreate(
|
|
176
|
+
getUnhydratedContext(schema),
|
|
178
177
|
mapTree,
|
|
179
178
|
);
|
|
180
179
|
|
|
181
|
-
|
|
182
|
-
const result = getOrCreateNodeFromFlexTreeNode(mapTreeNode);
|
|
180
|
+
const result = getOrCreateNodeFromInnerNode(mapTreeNode);
|
|
183
181
|
return result as Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
184
182
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { JsonTreeSchema } from "./jsonSchema.js";
|
|
7
|
-
import type {
|
|
7
|
+
import type { ImplicitFieldSchema } from "../schemaTypes.js";
|
|
8
8
|
import { toJsonSchema } from "./simpleSchemaToJsonSchema.js";
|
|
9
9
|
import { getSimpleSchema } from "./getSimpleSchema.js";
|
|
10
10
|
import { getOrCreate } from "../../util/index.js";
|
|
@@ -53,7 +53,7 @@ const jsonSchemaCache = new WeakMap<TreeNodeSchema, JsonTreeSchema>();
|
|
|
53
53
|
* "required": ["foo"],
|
|
54
54
|
* },
|
|
55
55
|
* },
|
|
56
|
-
* "
|
|
56
|
+
* "$ref": "#/$defs/com.myapp.MyObject",
|
|
57
57
|
* }
|
|
58
58
|
* ```
|
|
59
59
|
*
|
|
@@ -62,7 +62,7 @@ const jsonSchemaCache = new WeakMap<TreeNodeSchema, JsonTreeSchema>();
|
|
|
62
62
|
*
|
|
63
63
|
* @alpha
|
|
64
64
|
*/
|
|
65
|
-
export function getJsonSchema(schema:
|
|
65
|
+
export function getJsonSchema(schema: ImplicitFieldSchema): JsonTreeSchema {
|
|
66
66
|
return getOrCreate(jsonSchemaCache, schema, () => {
|
|
67
67
|
const simpleSchema = getSimpleSchema(schema);
|
|
68
68
|
return toJsonSchema(simpleSchema);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { getOrCreate } from "../../util/index.js";
|
|
7
7
|
import type { TreeNodeSchema } from "../core/index.js";
|
|
8
|
-
import type {
|
|
8
|
+
import type { ImplicitFieldSchema } from "../schemaTypes.js";
|
|
9
9
|
import type { SimpleTreeSchema } from "./simpleSchema.js";
|
|
10
10
|
import { toSimpleTreeSchema } from "./viewSchemaToSimpleSchema.js";
|
|
11
11
|
|
|
@@ -64,6 +64,6 @@ const simpleSchemaCache = new WeakMap<TreeNodeSchema, SimpleTreeSchema>();
|
|
|
64
64
|
* @privateRemarks In the future, we may wish to move this to a more discoverable API location.
|
|
65
65
|
* For now, while still an experimental API, it is surfaced as a free function.
|
|
66
66
|
*/
|
|
67
|
-
export function getSimpleSchema(schema:
|
|
67
|
+
export function getSimpleSchema(schema: ImplicitFieldSchema): SimpleTreeSchema {
|
|
68
68
|
return getOrCreate(simpleSchemaCache, schema, () => toSimpleTreeSchema(schema));
|
|
69
69
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export {
|
|
7
7
|
type ITree,
|
|
8
8
|
type TreeView,
|
|
9
|
+
type ViewableTree,
|
|
9
10
|
type TreeViewEvents,
|
|
10
11
|
TreeViewConfiguration,
|
|
11
12
|
type ITreeViewConfiguration,
|
|
@@ -44,6 +45,7 @@ export {
|
|
|
44
45
|
} from "./jsonSchema.js";
|
|
45
46
|
export { getJsonSchema } from "./getJsonSchema.js";
|
|
46
47
|
export { getSimpleSchema } from "./getSimpleSchema.js";
|
|
48
|
+
export { ViewSchema } from "./view.js";
|
|
47
49
|
|
|
48
50
|
export { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from "./treeApiBeta.js";
|
|
49
51
|
|
|
@@ -103,18 +103,10 @@ export interface JsonObjectNodeSchema extends JsonNodeSchemaBase<NodeKind.Object
|
|
|
103
103
|
export interface JsonArrayNodeSchema extends JsonNodeSchemaBase<NodeKind.Array, "array"> {
|
|
104
104
|
/**
|
|
105
105
|
* The kinds of items allowed under the array.
|
|
106
|
-
* @remarks Always represented via references to {@link JsonTreeSchema.$defs}.
|
|
107
106
|
*
|
|
108
107
|
* @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-items}.
|
|
109
108
|
*/
|
|
110
|
-
readonly items:
|
|
111
|
-
/**
|
|
112
|
-
* The kinds of items allowed under the array.
|
|
113
|
-
* @remarks Always represented via references to {@link JsonTreeSchema.$defs}.
|
|
114
|
-
* @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-anyof}.
|
|
115
|
-
*/
|
|
116
|
-
anyOf: JsonSchemaRef[];
|
|
117
|
-
};
|
|
109
|
+
readonly items: JsonFieldSchema;
|
|
118
110
|
}
|
|
119
111
|
|
|
120
112
|
/**
|
|
@@ -191,14 +183,24 @@ export type JsonNodeSchema =
|
|
|
191
183
|
* @sealed
|
|
192
184
|
* @alpha
|
|
193
185
|
*/
|
|
194
|
-
export
|
|
186
|
+
export type JsonFieldSchema = {
|
|
195
187
|
/**
|
|
196
|
-
*
|
|
197
|
-
* @remarks
|
|
198
|
-
* @see {@link https://json-schema.org/draft/2020-12/json-schema-
|
|
188
|
+
* Description of the field.
|
|
189
|
+
* @remarks Derived from {@link FieldSchemaMetadata.description}.
|
|
190
|
+
* @see {@link https://json-schema.org/draft/2020-12/json-schema-validation#name-title-and-description}
|
|
199
191
|
*/
|
|
200
|
-
readonly
|
|
201
|
-
}
|
|
192
|
+
readonly description?: string | undefined;
|
|
193
|
+
} & (
|
|
194
|
+
| {
|
|
195
|
+
/**
|
|
196
|
+
* The kinds of items allowed under the field, for polymorphic types.
|
|
197
|
+
* @remarks Always represented via references to {@link JsonTreeSchema.$defs}.
|
|
198
|
+
* @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-anyof}.
|
|
199
|
+
*/
|
|
200
|
+
readonly anyOf: JsonSchemaRef[];
|
|
201
|
+
}
|
|
202
|
+
| JsonSchemaRef
|
|
203
|
+
);
|
|
202
204
|
|
|
203
205
|
/**
|
|
204
206
|
* {@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} representation of a tree schema.
|
|
@@ -221,10 +223,10 @@ export interface JsonFieldSchema {
|
|
|
221
223
|
* @sealed
|
|
222
224
|
* @alpha
|
|
223
225
|
*/
|
|
224
|
-
export
|
|
226
|
+
export type JsonTreeSchema = JsonFieldSchema & {
|
|
225
227
|
/**
|
|
226
228
|
* The set of definitions reachable from this schema's root.
|
|
227
229
|
* @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-schema-re-use-with-defs}
|
|
228
230
|
*/
|
|
229
231
|
readonly $defs: Record<JsonSchemaId, JsonNodeSchema>;
|
|
230
|
-
}
|
|
232
|
+
};
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
isLazy,
|
|
19
19
|
} from "../../feature-libraries/index.js";
|
|
20
20
|
import {
|
|
21
|
-
type
|
|
21
|
+
type RestrictiveStringRecord,
|
|
22
22
|
getOrCreate,
|
|
23
23
|
isReadonlyArray,
|
|
24
24
|
} from "../../util/index.js";
|
|
@@ -48,6 +48,8 @@ import type {
|
|
|
48
48
|
WithType,
|
|
49
49
|
TreeNodeSchema,
|
|
50
50
|
TreeNodeSchemaClass,
|
|
51
|
+
TreeNodeSchemaNonClass,
|
|
52
|
+
TreeNodeSchemaBoth,
|
|
51
53
|
} from "../core/index.js";
|
|
52
54
|
import { type TreeArrayNode, arraySchema } from "../arrayNode.js";
|
|
53
55
|
import {
|
|
@@ -291,7 +293,7 @@ export class SchemaFactory<
|
|
|
291
293
|
*/
|
|
292
294
|
public object<
|
|
293
295
|
const Name extends TName,
|
|
294
|
-
const T extends
|
|
296
|
+
const T extends RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
295
297
|
>(
|
|
296
298
|
name: Name,
|
|
297
299
|
fields: T,
|
|
@@ -331,7 +333,7 @@ export class SchemaFactory<
|
|
|
331
333
|
*/
|
|
332
334
|
public map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(
|
|
333
335
|
allowedTypes: T,
|
|
334
|
-
):
|
|
336
|
+
): TreeNodeSchemaNonClass<
|
|
335
337
|
ScopedSchemaName<TScope, `Map<${string}>`>,
|
|
336
338
|
NodeKind.Map,
|
|
337
339
|
TreeMapNode<T> & WithType<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map>,
|
|
@@ -362,6 +364,12 @@ export class SchemaFactory<
|
|
|
362
364
|
T
|
|
363
365
|
>;
|
|
364
366
|
|
|
367
|
+
/**
|
|
368
|
+
* @privateRemarks
|
|
369
|
+
* This should return `TreeNodeSchemaBoth`, however TypeScript gives an error if one of the overloads implicitly up-casts the return type of the implementation.
|
|
370
|
+
* This seems like a TypeScript bug getting variance backwards for overload return types since it's erroring when the relation between the overload
|
|
371
|
+
* and the implementation is type safe, and forcing an unsafe typing instead.
|
|
372
|
+
*/
|
|
365
373
|
public map<const T extends ImplicitAllowedTypes>(
|
|
366
374
|
nameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),
|
|
367
375
|
allowedTypes?: T,
|
|
@@ -379,7 +387,7 @@ export class SchemaFactory<
|
|
|
379
387
|
false,
|
|
380
388
|
true,
|
|
381
389
|
) as TreeNodeSchema,
|
|
382
|
-
) as
|
|
390
|
+
) as TreeNodeSchemaBoth<
|
|
383
391
|
string,
|
|
384
392
|
NodeKind.Map,
|
|
385
393
|
TreeMapNode<T>,
|
|
@@ -388,7 +396,16 @@ export class SchemaFactory<
|
|
|
388
396
|
T
|
|
389
397
|
>;
|
|
390
398
|
}
|
|
391
|
-
|
|
399
|
+
// To actually have type safety, assign to the type this method should return before implicitly upcasting when returning.
|
|
400
|
+
const out: TreeNodeSchemaBoth<
|
|
401
|
+
string,
|
|
402
|
+
NodeKind.Map,
|
|
403
|
+
TreeMapNode<T>,
|
|
404
|
+
MapNodeInsertableData<T>,
|
|
405
|
+
true,
|
|
406
|
+
T
|
|
407
|
+
> = this.namedMap(nameOrAllowedTypes as TName, allowedTypes, true, true);
|
|
408
|
+
return out;
|
|
392
409
|
}
|
|
393
410
|
|
|
394
411
|
/**
|
|
@@ -405,7 +422,7 @@ export class SchemaFactory<
|
|
|
405
422
|
allowedTypes: T,
|
|
406
423
|
customizable: boolean,
|
|
407
424
|
implicitlyConstructable: ImplicitlyConstructable,
|
|
408
|
-
):
|
|
425
|
+
): TreeNodeSchemaBoth<
|
|
409
426
|
ScopedSchemaName<TScope, Name>,
|
|
410
427
|
NodeKind.Map,
|
|
411
428
|
TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,
|
|
@@ -457,7 +474,7 @@ export class SchemaFactory<
|
|
|
457
474
|
*/
|
|
458
475
|
public array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(
|
|
459
476
|
allowedTypes: T,
|
|
460
|
-
):
|
|
477
|
+
): TreeNodeSchemaNonClass<
|
|
461
478
|
ScopedSchemaName<TScope, `Array<${string}>`>,
|
|
462
479
|
NodeKind.Array,
|
|
463
480
|
TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array>,
|
|
@@ -490,6 +507,10 @@ export class SchemaFactory<
|
|
|
490
507
|
T
|
|
491
508
|
>;
|
|
492
509
|
|
|
510
|
+
/**
|
|
511
|
+
* @privateRemarks
|
|
512
|
+
* This should return TreeNodeSchemaBoth: see note on "map" implementation for details.
|
|
513
|
+
*/
|
|
493
514
|
public array<const T extends ImplicitAllowedTypes>(
|
|
494
515
|
nameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),
|
|
495
516
|
allowedTypes?: T,
|
|
@@ -515,7 +536,15 @@ export class SchemaFactory<
|
|
|
515
536
|
T
|
|
516
537
|
>;
|
|
517
538
|
}
|
|
518
|
-
|
|
539
|
+
const out: TreeNodeSchemaBoth<
|
|
540
|
+
ScopedSchemaName<TScope, string>,
|
|
541
|
+
NodeKind.Array,
|
|
542
|
+
TreeArrayNode<T>,
|
|
543
|
+
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
544
|
+
true,
|
|
545
|
+
T
|
|
546
|
+
> = this.namedArray(nameOrAllowedTypes as TName, allowedTypes, true, true);
|
|
547
|
+
return out;
|
|
519
548
|
}
|
|
520
549
|
|
|
521
550
|
/**
|
|
@@ -536,7 +565,7 @@ export class SchemaFactory<
|
|
|
536
565
|
allowedTypes: T,
|
|
537
566
|
customizable: boolean,
|
|
538
567
|
implicitlyConstructable: ImplicitlyConstructable,
|
|
539
|
-
):
|
|
568
|
+
): TreeNodeSchemaBoth<
|
|
540
569
|
ScopedSchemaName<TScope, Name>,
|
|
541
570
|
NodeKind.Array,
|
|
542
571
|
TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, string>, NodeKind.Array>,
|
|
@@ -552,11 +581,14 @@ export class SchemaFactory<
|
|
|
552
581
|
*
|
|
553
582
|
* @param t - The types allowed under the field.
|
|
554
583
|
* @param props - Optional properties to associate with the field.
|
|
584
|
+
*
|
|
585
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
586
|
+
* See {@link FieldSchemaMetadata.custom}.
|
|
555
587
|
*/
|
|
556
|
-
public optional<const T extends ImplicitAllowedTypes>(
|
|
588
|
+
public optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
557
589
|
t: T,
|
|
558
|
-
props?: Omit<FieldProps
|
|
559
|
-
): FieldSchema<FieldKind.Optional, T> {
|
|
590
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
591
|
+
): FieldSchema<FieldKind.Optional, T, TCustomMetadata> {
|
|
560
592
|
const defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {
|
|
561
593
|
return undefined;
|
|
562
594
|
});
|
|
@@ -575,11 +607,14 @@ export class SchemaFactory<
|
|
|
575
607
|
* @remarks
|
|
576
608
|
* Fields are required by default, but this API can be used to make the required nature explicit in the schema,
|
|
577
609
|
* and allows associating custom {@link FieldProps | properties} with the field.
|
|
610
|
+
*
|
|
611
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
612
|
+
* See {@link FieldSchemaMetadata.custom}.
|
|
578
613
|
*/
|
|
579
|
-
public required<const T extends ImplicitAllowedTypes>(
|
|
614
|
+
public required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
580
615
|
t: T,
|
|
581
|
-
props?: Omit<FieldProps
|
|
582
|
-
): FieldSchema<FieldKind.Required, T> {
|
|
616
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
617
|
+
): FieldSchema<FieldKind.Required, T, TCustomMetadata> {
|
|
583
618
|
return createFieldSchema(FieldKind.Required, t, props);
|
|
584
619
|
}
|
|
585
620
|
|
|
@@ -656,12 +691,12 @@ export class SchemaFactory<
|
|
|
656
691
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
657
692
|
public objectRecursive<
|
|
658
693
|
const Name extends TName,
|
|
659
|
-
const T extends Unenforced<
|
|
694
|
+
const T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>,
|
|
660
695
|
>(name: Name, t: T) {
|
|
661
696
|
type TScopedName = ScopedSchemaName<TScope, Name>;
|
|
662
697
|
return this.object(
|
|
663
698
|
name,
|
|
664
|
-
t as T &
|
|
699
|
+
t as T & RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
665
700
|
) as unknown as TreeNodeSchemaClass<
|
|
666
701
|
TScopedName,
|
|
667
702
|
NodeKind.Object,
|
|
@@ -754,7 +789,7 @@ export class SchemaFactory<
|
|
|
754
789
|
>;
|
|
755
790
|
},
|
|
756
791
|
// Ideally this would be included, but doing so breaks recursive types.
|
|
757
|
-
// |
|
|
792
|
+
// | RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>,
|
|
758
793
|
false,
|
|
759
794
|
T
|
|
760
795
|
>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { Unenforced } from "../../feature-libraries/index.js";
|
|
7
|
-
import type {
|
|
7
|
+
import type { RestrictiveStringRecord } from "../../util/index.js";
|
|
8
8
|
import type { InsertableObjectFromSchemaRecord } from "../objectNode.js";
|
|
9
9
|
|
|
10
10
|
import {
|
|
@@ -131,10 +131,7 @@ export type ValidateRecursiveSchema<
|
|
|
131
131
|
// TInsertable: What can be passed to the constructor. This should be enough to catch most issues with incorrect schema.
|
|
132
132
|
// These match whats defined in the recursive methods on `SchemaFactory` except they do not use `Unenforced`.
|
|
133
133
|
{
|
|
134
|
-
[NodeKind.Object]: T["info"] extends
|
|
135
|
-
string,
|
|
136
|
-
ImplicitFieldSchema
|
|
137
|
-
>
|
|
134
|
+
[NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema>
|
|
138
135
|
? InsertableObjectFromSchemaRecord<T["info"]>
|
|
139
136
|
: unknown;
|
|
140
137
|
[NodeKind.Array]: T["info"] extends ImplicitAllowedTypes
|
|
@@ -148,7 +145,7 @@ export type ValidateRecursiveSchema<
|
|
|
148
145
|
false,
|
|
149
146
|
// Info: What's passed to the method to create the schema. Constraining these here should be about as effective as if the actual constraints existed on the actual method itself.
|
|
150
147
|
{
|
|
151
|
-
[NodeKind.Object]:
|
|
148
|
+
[NodeKind.Object]: RestrictiveStringRecord<ImplicitFieldSchema>;
|
|
152
149
|
[NodeKind.Array]: ImplicitAllowedTypes;
|
|
153
150
|
[NodeKind.Map]: ImplicitAllowedTypes;
|
|
154
151
|
}[T["kind"]]
|
|
@@ -99,7 +99,7 @@ export type SimpleNodeSchema =
|
|
|
99
99
|
*/
|
|
100
100
|
export interface SimpleFieldSchema {
|
|
101
101
|
/**
|
|
102
|
-
* The kind of
|
|
102
|
+
* The kind of tree field.
|
|
103
103
|
*/
|
|
104
104
|
readonly kind: FieldKind;
|
|
105
105
|
|
|
@@ -110,29 +110,39 @@ export interface SimpleFieldSchema {
|
|
|
110
110
|
* A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.
|
|
111
111
|
*/
|
|
112
112
|
readonly allowedTypes: ReadonlySet<string>;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* {@inheritDoc FieldSchemaMetadata.description}
|
|
116
|
+
*/
|
|
117
|
+
readonly description?: string | undefined;
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
/**
|
|
116
121
|
* A simplified representation of a schema for a tree.
|
|
117
122
|
*
|
|
118
|
-
* @remarks Contains the complete set of schema {@link SimpleTreeSchema.definitions} required to resolve references
|
|
119
|
-
*
|
|
123
|
+
* @remarks Contains the complete set of schema {@link SimpleTreeSchema.definitions} required to resolve references,
|
|
124
|
+
* which are represented inline with identifiers.
|
|
120
125
|
*
|
|
121
126
|
* @sealed
|
|
122
127
|
*/
|
|
123
|
-
export interface SimpleTreeSchema {
|
|
128
|
+
export interface SimpleTreeSchema extends SimpleFieldSchema {
|
|
124
129
|
/**
|
|
125
|
-
* The
|
|
126
|
-
*
|
|
127
|
-
* @remarks the keys are the schemas' {@link TreeNodeSchemaCore.identifier | identifiers}.
|
|
130
|
+
* The kind of tree field representing the root of the tree.
|
|
128
131
|
*/
|
|
129
|
-
readonly
|
|
132
|
+
readonly kind: FieldKind;
|
|
130
133
|
|
|
131
134
|
/**
|
|
132
|
-
* The types allowed under the root
|
|
135
|
+
* The types allowed under the tree root.
|
|
133
136
|
*
|
|
134
137
|
* @remarks Refers to the types by identifier.
|
|
135
|
-
* {@link SimpleTreeSchema.definitions}
|
|
138
|
+
* Can be resolved via {@link SimpleTreeSchema.definitions}.
|
|
136
139
|
*/
|
|
137
140
|
readonly allowedTypes: ReadonlySet<string>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The complete set of node schema definitions recursively referenced by the tree's {@link SimpleTreeSchema.allowedTypes}.
|
|
144
|
+
*
|
|
145
|
+
* @remarks the keys are the schemas' {@link TreeNodeSchemaCore.identifier | identifiers}.
|
|
146
|
+
*/
|
|
147
|
+
readonly definitions: ReadonlyMap<string, SimpleNodeSchema>;
|
|
138
148
|
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { unreachableCase } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { oob, 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 } from "../../util/index.js";
|
|
9
|
+
import { getOrCreate, type Mutable } from "../../util/index.js";
|
|
10
10
|
import type {
|
|
11
11
|
JsonArrayNodeSchema,
|
|
12
12
|
JsonFieldSchema,
|
|
@@ -37,15 +37,20 @@ import { NodeKind } from "../core/index.js";
|
|
|
37
37
|
export function toJsonSchema(schema: SimpleTreeSchema): JsonTreeSchema {
|
|
38
38
|
const definitions = convertDefinitions(schema.definitions);
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const allowedTypes: JsonSchemaRef[] = [];
|
|
41
41
|
for (const allowedType of schema.allowedTypes) {
|
|
42
|
-
|
|
42
|
+
allowedTypes.push(createSchemaRef(allowedType));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
return allowedTypes.length === 1
|
|
46
|
+
? {
|
|
47
|
+
...(allowedTypes[0] ?? oob()),
|
|
48
|
+
$defs: definitions,
|
|
49
|
+
}
|
|
50
|
+
: {
|
|
51
|
+
$defs: definitions,
|
|
52
|
+
anyOf: allowedTypes,
|
|
53
|
+
};
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
function convertDefinitions(
|
|
@@ -90,12 +95,14 @@ function convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSch
|
|
|
90
95
|
schema.allowedTypes.forEach((type) => {
|
|
91
96
|
allowedTypes.push(createSchemaRef(type));
|
|
92
97
|
});
|
|
98
|
+
|
|
99
|
+
const items: JsonFieldSchema =
|
|
100
|
+
allowedTypes.length === 1 ? allowedTypes[0] ?? oob() : { anyOf: allowedTypes };
|
|
101
|
+
|
|
93
102
|
return {
|
|
94
103
|
type: "array",
|
|
95
104
|
_treeNodeSchemaKind: NodeKind.Array,
|
|
96
|
-
items
|
|
97
|
-
anyOf: allowedTypes,
|
|
98
|
-
},
|
|
105
|
+
items,
|
|
99
106
|
};
|
|
100
107
|
}
|
|
101
108
|
|
|
@@ -130,14 +137,25 @@ function convertObjectNodeSchema(schema: SimpleObjectNodeSchema): JsonObjectNode
|
|
|
130
137
|
const properties: Record<string, JsonFieldSchema> = {};
|
|
131
138
|
const required: string[] = [];
|
|
132
139
|
for (const [key, value] of Object.entries(schema.fields)) {
|
|
133
|
-
const
|
|
140
|
+
const allowedTypes: JsonSchemaRef[] = [];
|
|
134
141
|
for (const allowedType of value.allowedTypes) {
|
|
135
|
-
|
|
142
|
+
allowedTypes.push(createSchemaRef(allowedType));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const output: Mutable<JsonFieldSchema> =
|
|
146
|
+
allowedTypes.length === 1
|
|
147
|
+
? allowedTypes[0] ?? oob()
|
|
148
|
+
: {
|
|
149
|
+
anyOf: allowedTypes,
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// Don't include "description" property at all if it's not present in the input.
|
|
153
|
+
if (value.description !== undefined) {
|
|
154
|
+
output.description = value.description;
|
|
136
155
|
}
|
|
137
156
|
|
|
138
|
-
properties[key] =
|
|
139
|
-
|
|
140
|
-
};
|
|
157
|
+
properties[key] = output;
|
|
158
|
+
|
|
141
159
|
if (value.kind === FieldKind.Required) {
|
|
142
160
|
required.push(key);
|
|
143
161
|
}
|
|
@@ -160,9 +178,12 @@ function convertMapNodeSchema(schema: SimpleMapNodeSchema): JsonMapNodeSchema {
|
|
|
160
178
|
type: "object",
|
|
161
179
|
_treeNodeSchemaKind: NodeKind.Map,
|
|
162
180
|
patternProperties: {
|
|
163
|
-
"^.*$":
|
|
164
|
-
|
|
165
|
-
|
|
181
|
+
"^.*$":
|
|
182
|
+
allowedTypes.length === 1
|
|
183
|
+
? allowedTypes[0] ?? oob()
|
|
184
|
+
: {
|
|
185
|
+
anyOf: allowedTypes,
|
|
186
|
+
},
|
|
166
187
|
},
|
|
167
188
|
};
|
|
168
189
|
}
|
|
@@ -16,21 +16,19 @@ import {
|
|
|
16
16
|
FieldKind,
|
|
17
17
|
} from "../schemaTypes.js";
|
|
18
18
|
import { NodeKind, type TreeNodeSchema } from "../core/index.js";
|
|
19
|
-
import {
|
|
19
|
+
import { toStoredSchema } from "../toFlexSchema.js";
|
|
20
20
|
import { LeafNodeSchema } from "../leafNodeSchema.js";
|
|
21
21
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
22
22
|
import { isObjectNodeSchema, type ObjectNodeSchema } from "../objectNodeTypes.js";
|
|
23
23
|
import { markSchemaMostDerived } from "./schemaFactory.js";
|
|
24
24
|
import { fail, getOrCreate } from "../../util/index.js";
|
|
25
25
|
import type { MakeNominal } from "../../util/index.js";
|
|
26
|
-
import { walkFieldSchema } from "../
|
|
26
|
+
import { walkFieldSchema } from "../walkFieldSchema.js";
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
30
|
-
* Allows storing and collaboratively editing schema-aware hierarchial data.
|
|
31
|
-
* @sealed @public
|
|
28
|
+
* A tree from which a {@link TreeView} can be created.
|
|
29
|
+
* @system @sealed @public
|
|
32
30
|
*/
|
|
33
|
-
export interface
|
|
31
|
+
export interface ViewableTree {
|
|
34
32
|
/**
|
|
35
33
|
* Returns a {@link TreeView} using the provided schema.
|
|
36
34
|
* If the stored schema is compatible with the view schema specified by `config`,
|
|
@@ -68,6 +66,14 @@ export interface ITree extends IFluidLoadable {
|
|
|
68
66
|
): TreeView<TRoot>;
|
|
69
67
|
}
|
|
70
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Channel for a Fluid Tree DDS.
|
|
71
|
+
* @remarks
|
|
72
|
+
* Allows storing and collaboratively editing schema-aware hierarchial data.
|
|
73
|
+
* @sealed @public
|
|
74
|
+
*/
|
|
75
|
+
export interface ITree extends ViewableTree, IFluidLoadable {}
|
|
76
|
+
|
|
71
77
|
/**
|
|
72
78
|
* Options when constructing a tree view.
|
|
73
79
|
* @public
|
|
@@ -181,7 +187,7 @@ export interface ITreeViewConfiguration<
|
|
|
181
187
|
}
|
|
182
188
|
|
|
183
189
|
/**
|
|
184
|
-
* Configuration for {@link
|
|
190
|
+
* Configuration for {@link ViewableTree.viewWith}.
|
|
185
191
|
* @sealed @public
|
|
186
192
|
*/
|
|
187
193
|
export class TreeViewConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema>
|
|
@@ -236,7 +242,7 @@ export class TreeViewConfiguration<TSchema extends ImplicitFieldSchema = Implici
|
|
|
236
242
|
}
|
|
237
243
|
|
|
238
244
|
// Eagerly perform this conversion to surface errors sooner.
|
|
239
|
-
|
|
245
|
+
toStoredSchema(config.schema);
|
|
240
246
|
}
|
|
241
247
|
}
|
|
242
248
|
|
|
@@ -411,6 +417,11 @@ export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposab
|
|
|
411
417
|
* Events for the tree.
|
|
412
418
|
*/
|
|
413
419
|
readonly events: Listenable<TreeViewEvents>;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* The view schema used by this TreeView.
|
|
423
|
+
*/
|
|
424
|
+
readonly schema: TSchema;
|
|
414
425
|
}
|
|
415
426
|
|
|
416
427
|
/**
|