@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
package/src/util/index.ts
CHANGED
|
@@ -94,13 +94,9 @@ export {
|
|
|
94
94
|
export { ReferenceCountedBase, type ReferenceCounted } from "./referenceCounting.js";
|
|
95
95
|
|
|
96
96
|
export type {
|
|
97
|
-
AllowOptional,
|
|
98
|
-
RequiredFields,
|
|
99
|
-
OptionalFields,
|
|
100
97
|
_RecursiveTrick,
|
|
101
|
-
AllowOptionalNotFlattened,
|
|
102
98
|
RestrictiveReadonlyRecord,
|
|
103
|
-
|
|
99
|
+
RestrictiveStringRecord,
|
|
104
100
|
_InlineTrick,
|
|
105
101
|
FlattenKeys,
|
|
106
102
|
} from "./typeUtils.js";
|
package/src/util/typeUtils.ts
CHANGED
|
@@ -14,52 +14,6 @@
|
|
|
14
14
|
*/
|
|
15
15
|
export type FlattenKeys<T> = [{ [Property in keyof T]: T[Property] }][_InlineTrick];
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Remove all fields which permit undefined from `T`.
|
|
19
|
-
*/
|
|
20
|
-
export type RequiredFields<T> = [
|
|
21
|
-
{
|
|
22
|
-
[P in keyof T as undefined extends T[P] ? never : P]: T[P];
|
|
23
|
-
},
|
|
24
|
-
][_InlineTrick];
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Extract fields which permit undefined but can also hold other types.
|
|
28
|
-
*/
|
|
29
|
-
export type OptionalFields<T> = [
|
|
30
|
-
{
|
|
31
|
-
[P in keyof T as undefined extends T[P]
|
|
32
|
-
? T[P] extends undefined
|
|
33
|
-
? never
|
|
34
|
-
: P
|
|
35
|
-
: never]?: T[P];
|
|
36
|
-
},
|
|
37
|
-
][_InlineTrick];
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Converts properties of an object which permit undefined into optional properties.
|
|
41
|
-
* Removes fields which only allow undefined.
|
|
42
|
-
*
|
|
43
|
-
* @remarks
|
|
44
|
-
* This version does not flatten the resulting type.
|
|
45
|
-
* This version exists because some cases recursive types need to avoid this
|
|
46
|
-
* flattening since it causes complication issues.
|
|
47
|
-
*
|
|
48
|
-
* See also `AllowOptional`.
|
|
49
|
-
*/
|
|
50
|
-
// export type AllowOptionalNotFlattened<T> = [RequiredFields<T> & OptionalFields<T>][_InlineTrick];
|
|
51
|
-
export type AllowOptionalNotFlattened<T> = [
|
|
52
|
-
RequiredFields<T> & OptionalFields<T>,
|
|
53
|
-
][_InlineTrick];
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Converts properties of an object which permit undefined into optional properties.
|
|
57
|
-
* Removes fields which only allow undefined.
|
|
58
|
-
*/
|
|
59
|
-
export type AllowOptional<T> = [
|
|
60
|
-
FlattenKeys<RequiredFields<T> & OptionalFields<T>>,
|
|
61
|
-
][_InlineTrick];
|
|
62
|
-
|
|
63
17
|
/**
|
|
64
18
|
* Use for trick to "inline" generic types.
|
|
65
19
|
*
|
|
@@ -157,9 +111,15 @@ export type _RecursiveTrick = never;
|
|
|
157
111
|
* Alternative to the built in Record type which does not permit unexpected members,
|
|
158
112
|
* and is readonly.
|
|
159
113
|
*
|
|
114
|
+
* @remarks
|
|
115
|
+
* This does not work correctly when `K` is more specific than `string` or `symbol`.
|
|
116
|
+
* For example `{a: 5}` is not assignable to `RestrictiveReadonlyRecord<"a",: number>`
|
|
117
|
+
*
|
|
160
118
|
* @privateRemarks
|
|
161
119
|
* `number` is not allowed as a key here since doing so causes the compiler to reject recursive schema.
|
|
162
120
|
* The cause for this is unclear, but empirically it was the case when this comment was written.
|
|
121
|
+
*
|
|
122
|
+
* @deprecated Use a more robust / specific type instead. This type never worked as intended.
|
|
163
123
|
* @public
|
|
164
124
|
*/
|
|
165
125
|
export type RestrictiveReadonlyRecord<K extends symbol | string, T> = {
|
|
@@ -167,15 +127,13 @@ export type RestrictiveReadonlyRecord<K extends symbol | string, T> = {
|
|
|
167
127
|
};
|
|
168
128
|
|
|
169
129
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
130
|
+
* Alternative to the built-in `Record<string, T>` type which is readonly and does not permit symbols.
|
|
172
131
|
* @remarks
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* In these cases `TInput` can be replaced with `Assume<TInput, TAssumeToBe>` to allow compilation of the generic code.
|
|
176
|
-
* When the generic code is parameterized with a concrete type, if that type actually does extend `TAssumeToBe`,
|
|
177
|
-
* it will behave like `TInput` was used directly.
|
|
132
|
+
* It would be nice if `keyof RestrictiveStringRecord<T>` returned string, but it does not: use `keyof RestrictiveStringRecord<T> & string` instead.
|
|
133
|
+
* @system @public
|
|
178
134
|
*/
|
|
179
|
-
export type
|
|
180
|
-
|
|
181
|
-
|
|
135
|
+
export type RestrictiveStringRecord<T> = {
|
|
136
|
+
readonly [P in string]: T;
|
|
137
|
+
} & {
|
|
138
|
+
readonly [P in symbol]?: never;
|
|
139
|
+
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { FieldKey, MapTree, TreeFieldStoredSchema } from "../core/index.js";
|
|
6
|
-
import type { FlexTreeSchema } from "./typed-schema/index.js";
|
|
7
|
-
/**
|
|
8
|
-
* Information needed to interpret a subtree described by {@link ContextuallyTypedNodeData} and {@link ContextuallyTypedFieldData}.
|
|
9
|
-
* TODO:
|
|
10
|
-
* Currently being exposed at the package level which also requires us to export MapTree at the package level.
|
|
11
|
-
* Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.
|
|
12
|
-
*/
|
|
13
|
-
export interface TreeDataContext {
|
|
14
|
-
/**
|
|
15
|
-
* Schema for the document which the tree will be used in.
|
|
16
|
-
*/
|
|
17
|
-
readonly schema: FlexTreeSchema;
|
|
18
|
-
/**
|
|
19
|
-
* Procedural data generator for fields.
|
|
20
|
-
* Fields which provide generators here can be omitted in the input contextually typed data.
|
|
21
|
-
*
|
|
22
|
-
* @remarks
|
|
23
|
-
* TODO:
|
|
24
|
-
* For implementers of this which are not pure (like identifier generation),
|
|
25
|
-
* order of invocation should be made consistent and documented.
|
|
26
|
-
* This will be important for identifier elision optimizations in tree encoding for session based identifier generation.
|
|
27
|
-
*/
|
|
28
|
-
fieldSource?(key: FieldKey, schema: TreeFieldStoredSchema): undefined | FieldGenerator;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Generates field content for a MapTree on demand.
|
|
32
|
-
* TODO:
|
|
33
|
-
* Currently being exposed at the package level which also requires us to export MapTree at the package level.
|
|
34
|
-
* Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.
|
|
35
|
-
*/
|
|
36
|
-
export type FieldGenerator = () => MapTree[];
|
|
37
|
-
/**
|
|
38
|
-
* Information needed to interpret a subtree described by {@link ContextuallyTypedNodeData} and {@link ContextuallyTypedFieldData}.
|
|
39
|
-
* TODO:
|
|
40
|
-
* Currently being exposed at the package level which also requires us to export MapTree at the package level.
|
|
41
|
-
* Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.
|
|
42
|
-
*/
|
|
43
|
-
//# sourceMappingURL=fieldGenerator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fieldGenerator.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/fieldGenerator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAEhC;;;;;;;;;OASG;IACH,WAAW,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,qBAAqB,GAAG,SAAS,GAAG,cAAc,CAAC;CACvF;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,EAAE,CAAC;AAC7C;;;;;GAKG"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
/**
|
|
8
|
-
* Information needed to interpret a subtree described by {@link ContextuallyTypedNodeData} and {@link ContextuallyTypedFieldData}.
|
|
9
|
-
* TODO:
|
|
10
|
-
* Currently being exposed at the package level which also requires us to export MapTree at the package level.
|
|
11
|
-
* Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.
|
|
12
|
-
*/
|
|
13
|
-
//# sourceMappingURL=fieldGenerator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fieldGenerator.js","sourceRoot":"","sources":["../../src/feature-libraries/fieldGenerator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAsCH;;;;;GAKG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FieldKey, MapTree, TreeFieldStoredSchema } from \"../core/index.js\";\n\nimport type { FlexTreeSchema } from \"./typed-schema/index.js\";\n\n/**\n * Information needed to interpret a subtree described by {@link ContextuallyTypedNodeData} and {@link ContextuallyTypedFieldData}.\n * TODO:\n * Currently being exposed at the package level which also requires us to export MapTree at the package level.\n * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.\n */\nexport interface TreeDataContext {\n\t/**\n\t * Schema for the document which the tree will be used in.\n\t */\n\treadonly schema: FlexTreeSchema;\n\n\t/**\n\t * Procedural data generator for fields.\n\t * Fields which provide generators here can be omitted in the input contextually typed data.\n\t *\n\t * @remarks\n\t * TODO:\n\t * For implementers of this which are not pure (like identifier generation),\n\t * order of invocation should be made consistent and documented.\n\t * This will be important for identifier elision optimizations in tree encoding for session based identifier generation.\n\t */\n\tfieldSource?(key: FieldKey, schema: TreeFieldStoredSchema): undefined | FieldGenerator;\n}\n\n/**\n * Generates field content for a MapTree on demand.\n * TODO:\n * Currently being exposed at the package level which also requires us to export MapTree at the package level.\n * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.\n */\nexport type FieldGenerator = () => MapTree[];\n/**\n * Information needed to interpret a subtree described by {@link ContextuallyTypedNodeData} and {@link ContextuallyTypedFieldData}.\n * TODO:\n * Currently being exposed at the package level which also requires us to export MapTree at the package level.\n * Refactor the FieldGenerator to use JsonableTree instead of MapTree, and convert them internally.\n */\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
export { type MapTreeNode, type MapTreeSequenceField, isMapTreeNode, isMapTreeSequenceField, getOrCreateMapTreeNode, tryGetMapTreeNode, UnhydratedContext, } from "./mapTreeNode.js";
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-map-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.UnhydratedContext = exports.tryGetMapTreeNode = exports.getOrCreateMapTreeNode = exports.isMapTreeSequenceField = exports.isMapTreeNode = void 0;
|
|
8
|
-
var mapTreeNode_js_1 = require("./mapTreeNode.js");
|
|
9
|
-
Object.defineProperty(exports, "isMapTreeNode", { enumerable: true, get: function () { return mapTreeNode_js_1.isMapTreeNode; } });
|
|
10
|
-
Object.defineProperty(exports, "isMapTreeSequenceField", { enumerable: true, get: function () { return mapTreeNode_js_1.isMapTreeSequenceField; } });
|
|
11
|
-
Object.defineProperty(exports, "getOrCreateMapTreeNode", { enumerable: true, get: function () { return mapTreeNode_js_1.getOrCreateMapTreeNode; } });
|
|
12
|
-
Object.defineProperty(exports, "tryGetMapTreeNode", { enumerable: true, get: function () { return mapTreeNode_js_1.tryGetMapTreeNode; } });
|
|
13
|
-
Object.defineProperty(exports, "UnhydratedContext", { enumerable: true, get: function () { return mapTreeNode_js_1.UnhydratedContext; } });
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-map-tree/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mDAQ0B;AALzB,+GAAA,aAAa,OAAA;AACb,wHAAA,sBAAsB,OAAA;AACtB,wHAAA,sBAAsB,OAAA;AACtB,mHAAA,iBAAiB,OAAA;AACjB,mHAAA,iBAAiB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype MapTreeNode,\n\ttype MapTreeSequenceField,\n\tisMapTreeNode,\n\tisMapTreeSequenceField,\n\tgetOrCreateMapTreeNode,\n\ttryGetMapTreeNode,\n\tUnhydratedContext,\n} from \"./mapTreeNode.js\";\n"]}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { type AnchorNode, type ExclusiveMapTree, type FieldKey, type FieldUpPath, type MapTree, type TreeFieldStoredSchema, type TreeNodeSchemaIdentifier, type TreeStoredSchema, type Value } from "../../core/index.js";
|
|
6
|
-
import { type FlexTreeContext, FlexTreeEntityKind, type FlexTreeField, type FlexTreeNode, type FlexTreeSequenceField, type FlexTreeTypedField, flexTreeMarker, type FlexTreeHydratedContext } from "../flex-tree/index.js";
|
|
7
|
-
import { FlexFieldSchema, type FlexTreeNodeSchema, type FlexTreeSchema } from "../typed-schema/index.js";
|
|
8
|
-
import type { FlexFieldKind } from "../modular-schema/index.js";
|
|
9
|
-
import { type SequenceFieldEditBuilder } from "../default-schema/index.js";
|
|
10
|
-
/**
|
|
11
|
-
* A readonly {@link FlexTreeNode} which wraps a {@link MapTree}.
|
|
12
|
-
* @remarks Reading data from the MapTreeNode will read the corresponding data from the {@link MapTree}.
|
|
13
|
-
* Create a `MapTreeNode` by calling {@link getOrCreateMapTreeNode}.
|
|
14
|
-
*/
|
|
15
|
-
export interface MapTreeNode extends FlexTreeNode {
|
|
16
|
-
readonly mapTree: MapTree;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Checks if the given {@link FlexTreeNode} is a {@link MapTreeNode}.
|
|
20
|
-
*/
|
|
21
|
-
export declare function isMapTreeNode(flexNode: FlexTreeNode): flexNode is MapTreeNode;
|
|
22
|
-
/**
|
|
23
|
-
* Checks if the given {@link FlexTreeField} is a {@link MapTreeSequenceField}.
|
|
24
|
-
*/
|
|
25
|
-
export declare function isMapTreeSequenceField(field: FlexTreeSequenceField | FlexTreeField): field is MapTreeSequenceField;
|
|
26
|
-
/**
|
|
27
|
-
* An unhydrated {@link FlexTreeSequenceField}, which has additional editing capabilities.
|
|
28
|
-
* @remarks When doing a removal edit, a {@link MapTreeSequenceField}'s `editor` returns ownership of the removed {@link ExclusiveMapTree}s to the caller.
|
|
29
|
-
*/
|
|
30
|
-
export interface MapTreeSequenceField extends FlexTreeSequenceField {
|
|
31
|
-
readonly editor: MapTreeSequenceFieldEditBuilder;
|
|
32
|
-
}
|
|
33
|
-
interface MapTreeSequenceFieldEditBuilder extends SequenceFieldEditBuilder<ExclusiveMapTree[]> {
|
|
34
|
-
/**
|
|
35
|
-
* Issues a change which removes `count` elements starting at the given `index`.
|
|
36
|
-
* @param index - The index of the first removed element.
|
|
37
|
-
* @param count - The number of elements to remove.
|
|
38
|
-
* @returns the MapTrees that were removed
|
|
39
|
-
*/
|
|
40
|
-
remove(index: number, count: number): ExclusiveMapTree[];
|
|
41
|
-
}
|
|
42
|
-
/** A node's parent field and its index in that field */
|
|
43
|
-
interface LocationInField {
|
|
44
|
-
readonly parent: MapTreeField;
|
|
45
|
-
readonly index: number;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* A readonly implementation of {@link FlexTreeNode} which wraps a {@link MapTree}.
|
|
49
|
-
* @remarks Any methods that would mutate the node will fail,
|
|
50
|
-
* as will the querying of data specific to the {@link LazyTreeNode} implementation (e.g. {@link FlexTreeNode.context}).
|
|
51
|
-
* MapTreeNodes are unconditionally cached -
|
|
52
|
-
* when retrieved via {@link getOrCreateNode}, the same {@link MapTree} object will always produce the same `MapTreeNode` object.
|
|
53
|
-
*/
|
|
54
|
-
export declare class EagerMapTreeNode implements MapTreeNode {
|
|
55
|
-
readonly context: UnhydratedContext;
|
|
56
|
-
readonly flexSchema: FlexTreeNodeSchema;
|
|
57
|
-
/** The underlying {@link MapTree} that this `MapTreeNode` reads its data from */
|
|
58
|
-
readonly mapTree: ExclusiveMapTree;
|
|
59
|
-
private location;
|
|
60
|
-
get schema(): TreeNodeSchemaIdentifier;
|
|
61
|
-
readonly [flexTreeMarker]: FlexTreeEntityKind.Node;
|
|
62
|
-
/**
|
|
63
|
-
* Create a new MapTreeNode.
|
|
64
|
-
* @param location - the parentage of this node, if it is being created underneath an existing node and field, or undefined if not
|
|
65
|
-
* @remarks This class (and its subclasses) should not be directly constructed outside of this module.
|
|
66
|
-
* Instead, use {@link getOrCreateNode} to create a MapTreeNode from a {@link MapTree}.
|
|
67
|
-
* A `MapTreeNode` may never be constructed more than once for the same {@link MapTree} object.
|
|
68
|
-
* Instead, it should always be acquired via {@link getOrCreateNode}.
|
|
69
|
-
*/
|
|
70
|
-
constructor(context: UnhydratedContext, flexSchema: FlexTreeNodeSchema,
|
|
71
|
-
/** The underlying {@link MapTree} that this `MapTreeNode` reads its data from */
|
|
72
|
-
mapTree: ExclusiveMapTree, location?: LocationInField);
|
|
73
|
-
get type(): TreeNodeSchemaIdentifier;
|
|
74
|
-
/**
|
|
75
|
-
* Set this node's parentage (see {@link FlexTreeNode.parentField}).
|
|
76
|
-
* @remarks The node may be given a parent if it has none, or may have its parent removed (by passing `undefined`).
|
|
77
|
-
* However, a node with a parent may not be directly re-assigned a different parent.
|
|
78
|
-
* That likely indicates either an attempted multi-parenting or an attempt to "move" the node, neither of which are supported.
|
|
79
|
-
* Removing a node's parent twice in a row is also not supported, as it likely indicates a bug.
|
|
80
|
-
*/
|
|
81
|
-
adoptBy(parent: undefined): void;
|
|
82
|
-
adoptBy(parent: MapTreeField, index: number): void;
|
|
83
|
-
/**
|
|
84
|
-
* The field this tree is in, and the index within that field.
|
|
85
|
-
* @remarks If this node is unparented, this method will return the special {@link unparentedLocation} as the parent.
|
|
86
|
-
*/
|
|
87
|
-
get parentField(): LocationInField;
|
|
88
|
-
is(schema: FlexTreeNodeSchema): boolean;
|
|
89
|
-
tryGetField(key: FieldKey): EagerMapTreeField | undefined;
|
|
90
|
-
getBoxed(key: string): FlexTreeField;
|
|
91
|
-
boxedIterator(): IterableIterator<FlexTreeField>;
|
|
92
|
-
keys(): IterableIterator<FieldKey>;
|
|
93
|
-
get value(): Value;
|
|
94
|
-
get anchorNode(): AnchorNode;
|
|
95
|
-
private walkTree;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Implementation of `FlexTreeContext`.
|
|
99
|
-
*
|
|
100
|
-
* @remarks An editor is required to edit the FlexTree.
|
|
101
|
-
*/
|
|
102
|
-
export declare class UnhydratedContext implements FlexTreeContext {
|
|
103
|
-
readonly flexSchema: FlexTreeSchema;
|
|
104
|
-
readonly schema: TreeStoredSchema;
|
|
105
|
-
/**
|
|
106
|
-
* @param flexSchema - Schema to use when working with the tree.
|
|
107
|
-
*/
|
|
108
|
-
constructor(flexSchema: FlexTreeSchema);
|
|
109
|
-
isHydrated(): this is FlexTreeHydratedContext;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* A readonly {@link FlexTreeField} which wraps an array of {@link MapTrees}.
|
|
113
|
-
* @remarks Reading data from the MapTreeField will read the corresponding data from the {@link MapTree}s.
|
|
114
|
-
* Create a `MapTreeField` by calling {@link getOrCreateField}.
|
|
115
|
-
*/
|
|
116
|
-
interface MapTreeField extends FlexTreeField {
|
|
117
|
-
readonly mapTrees: readonly MapTree[];
|
|
118
|
-
}
|
|
119
|
-
declare class EagerMapTreeField implements MapTreeField {
|
|
120
|
-
readonly context: UnhydratedContext;
|
|
121
|
-
readonly flexSchema: FlexFieldSchema;
|
|
122
|
-
readonly key: FieldKey;
|
|
123
|
-
readonly parent: EagerMapTreeNode;
|
|
124
|
-
[flexTreeMarker]: FlexTreeEntityKind.Field;
|
|
125
|
-
get schema(): TreeFieldStoredSchema;
|
|
126
|
-
constructor(context: UnhydratedContext, flexSchema: FlexFieldSchema, key: FieldKey, parent: EagerMapTreeNode);
|
|
127
|
-
get mapTrees(): readonly ExclusiveMapTree[];
|
|
128
|
-
get length(): number;
|
|
129
|
-
is<TKind2 extends FlexFieldKind>(kind: TKind2): this is FlexTreeTypedField<TKind2>;
|
|
130
|
-
boxedIterator(): IterableIterator<FlexTreeNode>;
|
|
131
|
-
boxedAt(index: number): FlexTreeNode | undefined;
|
|
132
|
-
/**
|
|
133
|
-
* Mutate this field.
|
|
134
|
-
* @param edit - A function which receives the current `MapTree`s that comprise the contents of the field so that it may be mutated.
|
|
135
|
-
* The function may mutate the array in place or return a new array.
|
|
136
|
-
* If a new array is returned then it will be used as the new contents of the field, otherwise the original array will be continue to be used.
|
|
137
|
-
* @remarks All edits to the field (i.e. mutations of the field's MapTrees) should be directed through this function.
|
|
138
|
-
* This function ensures that the parent MapTree has no empty fields (which is an invariant of `MapTree`) after the mutation.
|
|
139
|
-
*/
|
|
140
|
-
protected edit(edit: (mapTrees: ExclusiveMapTree[]) => void | ExclusiveMapTree[]): void;
|
|
141
|
-
getFieldPath(): FieldUpPath;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* If there exists a {@link EagerMapTreeNode} for the given {@link MapTree}, returns it, otherwise returns `undefined`.
|
|
145
|
-
* @remarks {@link EagerMapTreeNode | MapTreeNodes} are created via {@link getOrCreateNode}.
|
|
146
|
-
*/
|
|
147
|
-
export declare function tryGetMapTreeNode(mapTree: MapTree): MapTreeNode | undefined;
|
|
148
|
-
/**
|
|
149
|
-
* Create a {@link EagerMapTreeNode} that wraps the given {@link MapTree}, or get the node that already exists for that {@link MapTree} if there is one.
|
|
150
|
-
* @param nodeSchema - the {@link FlexTreeNodeSchema | schema} that the node conforms to
|
|
151
|
-
* @param mapTree - the {@link MapTree} containing the data for this node.
|
|
152
|
-
* @remarks It must conform to the `nodeSchema`.
|
|
153
|
-
*/
|
|
154
|
-
export declare function getOrCreateMapTreeNode(context: UnhydratedContext, nodeSchema: FlexTreeNodeSchema, mapTree: ExclusiveMapTree): EagerMapTreeNode;
|
|
155
|
-
export declare function unsupportedUsageError(message?: string): Error;
|
|
156
|
-
export {};
|
|
157
|
-
//# sourceMappingURL=mapTreeNode.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapTreeNode.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-map-tree/mapTreeNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,KAAK,UAAU,EAEf,KAAK,gBAAgB,EACrB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,KAAK,EACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,KAAK,eAAe,EACpB,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,YAAY,EAGjB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAEvB,cAAc,EAEd,KAAK,uBAAuB,EAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEN,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAGN,KAAK,wBAAwB,EAC7B,MAAM,4BAA4B,CAAC;AAIpC;;;;GAIG;AACH,MAAM,WAAW,WAAY,SAAQ,YAAY;IAChD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,YAAY,GAAG,QAAQ,IAAI,WAAW,CAE7E;AAED;;GAEG;A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AAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACtF,CAAC;AAED,4CAA4C;AAE5C,SAAgB,qBAAqB,CAAC,OAAgB;IACrD,OAAO,IAAI,qBAAU,CACpB,GACC,OAAO,IAAI,WACZ,4EAA4E,CAC5E,CAAC;AACH,CAAC;AAND,sDAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype AnchorNode,\n\tEmptyKey,\n\ttype ExclusiveMapTree,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype MapTree,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeStoredSchema,\n\ttype Value,\n} from \"../../core/index.js\";\nimport { brand, fail, getOrCreate, isReadonlyArray, mapIterable } from \"../../util/index.js\";\nimport {\n\ttype FlexTreeContext,\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeSequenceField,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeUnknownUnboxed,\n\tflexTreeMarker,\n\tindexForAt,\n\ttype FlexTreeHydratedContext,\n} from \"../flex-tree/index.js\";\nimport {\n\ttype FlexAllowedTypes,\n\tFlexFieldSchema,\n\ttype FlexTreeNodeSchema,\n\ttype FlexTreeSchema,\n\tintoStoredSchemaCollection,\n\tisLazy,\n} from \"../typed-schema/index.js\";\nimport type { FlexFieldKind } from \"../modular-schema/index.js\";\nimport {\n\tdefaultSchemaPolicy,\n\tFieldKinds,\n\ttype SequenceFieldEditBuilder,\n} from \"../default-schema/index.js\";\n\n// #region Nodes\n\n/**\n * A readonly {@link FlexTreeNode} which wraps a {@link MapTree}.\n * @remarks Reading data from the MapTreeNode will read the corresponding data from the {@link MapTree}.\n * Create a `MapTreeNode` by calling {@link getOrCreateMapTreeNode}.\n */\nexport interface MapTreeNode extends FlexTreeNode {\n\treadonly mapTree: MapTree;\n}\n\n/**\n * Checks if the given {@link FlexTreeNode} is a {@link MapTreeNode}.\n */\nexport function isMapTreeNode(flexNode: FlexTreeNode): flexNode is MapTreeNode {\n\treturn flexNode instanceof EagerMapTreeNode;\n}\n\n/**\n * Checks if the given {@link FlexTreeField} is a {@link MapTreeSequenceField}.\n */\nexport function isMapTreeSequenceField(\n\tfield: FlexTreeSequenceField | FlexTreeField,\n): field is MapTreeSequenceField {\n\treturn field instanceof EagerMapTreeSequenceField;\n}\n\n/**\n * An unhydrated {@link FlexTreeSequenceField}, which has additional editing capabilities.\n * @remarks When doing a removal edit, a {@link MapTreeSequenceField}'s `editor` returns ownership of the removed {@link ExclusiveMapTree}s to the caller.\n */\nexport interface MapTreeSequenceField extends FlexTreeSequenceField {\n\treadonly editor: MapTreeSequenceFieldEditBuilder;\n}\n\ninterface MapTreeSequenceFieldEditBuilder\n\textends SequenceFieldEditBuilder<ExclusiveMapTree[]> {\n\t/**\n\t * Issues a change which removes `count` elements starting at the given `index`.\n\t * @param index - The index of the first removed element.\n\t * @param count - The number of elements to remove.\n\t * @returns the MapTrees that were removed\n\t */\n\tremove(index: number, count: number): ExclusiveMapTree[];\n}\n\n/** A node's parent field and its index in that field */\ninterface LocationInField {\n\treadonly parent: MapTreeField;\n\treadonly index: number;\n}\n\n/**\n * A readonly implementation of {@link FlexTreeNode} which wraps a {@link MapTree}.\n * @remarks Any methods that would mutate the node will fail,\n * as will the querying of data specific to the {@link LazyTreeNode} implementation (e.g. {@link FlexTreeNode.context}).\n * MapTreeNodes are unconditionally cached -\n * when retrieved via {@link getOrCreateNode}, the same {@link MapTree} object will always produce the same `MapTreeNode` object.\n */\nexport class EagerMapTreeNode implements MapTreeNode {\n\tpublic get schema(): TreeNodeSchemaIdentifier {\n\t\treturn this.flexSchema.name;\n\t}\n\n\tpublic readonly [flexTreeMarker] = FlexTreeEntityKind.Node as const;\n\n\t/**\n\t * Create a new MapTreeNode.\n\t * @param location - the parentage of this node, if it is being created underneath an existing node and field, or undefined if not\n\t * @remarks This class (and its subclasses) should not be directly constructed outside of this module.\n\t * Instead, use {@link getOrCreateNode} to create a MapTreeNode from a {@link MapTree}.\n\t * A `MapTreeNode` may never be constructed more than once for the same {@link MapTree} object.\n\t * Instead, it should always be acquired via {@link getOrCreateNode}.\n\t */\n\tpublic constructor(\n\t\tpublic readonly context: UnhydratedContext,\n\t\tpublic readonly flexSchema: FlexTreeNodeSchema,\n\t\t/** The underlying {@link MapTree} that this `MapTreeNode` reads its data from */\n\t\tpublic readonly mapTree: ExclusiveMapTree,\n\t\tprivate location = unparentedLocation,\n\t) {\n\t\tassert(!nodeCache.has(mapTree), 0x98b /* A node already exists for the given MapTree */);\n\t\tnodeCache.set(mapTree, this);\n\n\t\t// Fully demand the tree to ensure that parent pointers are present and accurate on all nodes.\n\t\t// When a MapTreeNode is constructed, its MapTree may contain nodes (anywhere below) that map (via the `nodeCache`) to pre-existing MapTreeNodes.\n\t\t// Put another way, for a given MapTree, some ancestor MapTreeNode can be created after any number of its descendant MapTreeNodes already exist.\n\t\t// In such a case, the spine of nodes between the descendant and ancestor need to exist in order for the ancestor to be able to walk upwards via the `parentField` property.\n\t\t// This needs to happen for all MapTreeNodes that are descendants of the ancestor MapTreeNode.\n\t\t// Demanding the entire tree is overkill to solve this problem since not all descendant MapTree nodes will have corresponding MapTreeNodes.\n\t\t// However, demanding the full tree also lets us eagerly validate that there are no duplicate MapTrees (i.e. same MapTree object) anywhere in the tree.\n\t\tthis.walkTree();\n\t}\n\n\tpublic get type(): TreeNodeSchemaIdentifier {\n\t\treturn this.flexSchema.name;\n\t}\n\n\t/**\n\t * Set this node's parentage (see {@link FlexTreeNode.parentField}).\n\t * @remarks The node may be given a parent if it has none, or may have its parent removed (by passing `undefined`).\n\t * However, a node with a parent may not be directly re-assigned a different parent.\n\t * That likely indicates either an attempted multi-parenting or an attempt to \"move\" the node, neither of which are supported.\n\t * Removing a node's parent twice in a row is also not supported, as it likely indicates a bug.\n\t */\n\tpublic adoptBy(parent: undefined): void;\n\tpublic adoptBy(parent: MapTreeField, index: number): void;\n\tpublic adoptBy(parent: MapTreeField | undefined, index?: number): void {\n\t\tif (parent !== undefined) {\n\t\t\tassert(\n\t\t\t\tthis.location === unparentedLocation,\n\t\t\t\t0x98c /* Node may not be adopted if it already has a parent */,\n\t\t\t);\n\t\t\tassert(index !== undefined, 0xa08 /* Expected index */);\n\t\t\tthis.location = { parent, index };\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tthis.location !== unparentedLocation,\n\t\t\t\t0xa09 /* Node may not be un-adopted if it does not have a parent */,\n\t\t\t);\n\t\t\tthis.location = unparentedLocation;\n\t\t}\n\t}\n\n\t/**\n\t * The field this tree is in, and the index within that field.\n\t * @remarks If this node is unparented, this method will return the special {@link unparentedLocation} as the parent.\n\t */\n\tpublic get parentField(): LocationInField {\n\t\treturn this.location;\n\t}\n\n\tpublic is(schema: FlexTreeNodeSchema): boolean {\n\t\treturn (schema as unknown) === this.flexSchema;\n\t}\n\n\tpublic tryGetField(key: FieldKey): EagerMapTreeField | undefined {\n\t\tconst field = this.mapTree.fields.get(key);\n\t\t// Only return the field if it is not empty, in order to fulfill the contract of `tryGetField`.\n\t\tif (field !== undefined && field.length > 0) {\n\t\t\treturn getOrCreateField(this, key, this.flexSchema.getFieldSchema(key));\n\t\t}\n\t}\n\n\tpublic getBoxed(key: string): FlexTreeField {\n\t\tconst fieldKey: FieldKey = brand(key);\n\t\treturn getOrCreateField(this, fieldKey, this.flexSchema.getFieldSchema(fieldKey));\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeField> {\n\t\treturn mapIterable(this.mapTree.fields.entries(), ([key]) =>\n\t\t\tgetOrCreateField(this, key, this.flexSchema.getFieldSchema(key)),\n\t\t);\n\t}\n\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\t// TODO: how this should handle missing defaults (and empty keys if they end up being allowed) needs to be determined.\n\t\treturn this.mapTree.fields.keys();\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this.mapTree.value;\n\t}\n\n\tpublic get anchorNode(): AnchorNode {\n\t\t// This API is relevant to `LazyTreeNode`s, but not `MapTreeNode`s.\n\t\t// TODO: Refactor the FlexTreeNode interface so that stubbing this out isn't necessary.\n\t\treturn fail(\"MapTreeNode does not implement anchorNode\");\n\t}\n\n\tprivate walkTree(): void {\n\t\tfor (const [key, mapTrees] of this.mapTree.fields) {\n\t\t\tconst field = getOrCreateField(this, key, this.flexSchema.getFieldSchema(key));\n\t\t\tfor (let index = 0; index < field.length; index++) {\n\t\t\t\tconst child = getOrCreateChild(\n\t\t\t\t\tthis.context,\n\t\t\t\t\tmapTrees[index] ?? oob(),\n\t\t\t\t\tthis.flexSchema.getFieldSchema(key).allowedTypes,\n\t\t\t\t\t{ parent: field, index },\n\t\t\t\t);\n\t\t\t\t// These next asserts detect the case where `getOrCreateChild` gets a cache hit of a different node than the one we're trying to create\n\t\t\t\tassert(child.location !== undefined, 0x98d /* Expected node to have parent */);\n\t\t\t\tassert(\n\t\t\t\t\tchild.location.parent.parent === this,\n\t\t\t\t\t0x98e /* Node may not be multi-parented */,\n\t\t\t\t);\n\t\t\t\tassert(child.location.index === index, 0x98f /* Node may not be multi-parented */);\n\t\t\t\tchild.walkTree();\n\t\t\t}\n\t\t}\n\t}\n}\n\n// #endregion Nodes\n\n/**\n * Implementation of `FlexTreeContext`.\n *\n * @remarks An editor is required to edit the FlexTree.\n */\nexport class UnhydratedContext implements FlexTreeContext {\n\tpublic readonly schema: TreeStoredSchema;\n\n\t/**\n\t * @param flexSchema - Schema to use when working with the tree.\n\t */\n\tpublic constructor(public readonly flexSchema: FlexTreeSchema) {\n\t\tthis.schema = {\n\t\t\trootFieldSchema: flexSchema.rootFieldSchema.stored,\n\t\t\t...intoStoredSchemaCollection(flexSchema),\n\t\t};\n\t}\n\n\tpublic isHydrated(): this is FlexTreeHydratedContext {\n\t\treturn false;\n\t}\n}\n\n// #region Fields\n\n/**\n * A readonly {@link FlexTreeField} which wraps an array of {@link MapTrees}.\n * @remarks Reading data from the MapTreeField will read the corresponding data from the {@link MapTree}s.\n * Create a `MapTreeField` by calling {@link getOrCreateField}.\n */\ninterface MapTreeField extends FlexTreeField {\n\treadonly mapTrees: readonly MapTree[];\n}\n\nconst emptyContext = new UnhydratedContext({\n\tadapters: {},\n\tnodeSchema: new Map(),\n\tpolicy: defaultSchemaPolicy,\n\trootFieldSchema: FlexFieldSchema.empty,\n});\n\n/**\n * A special singleton that is the implicit {@link LocationInField} of all un-parented {@link EagerMapTreeNode}s.\n * @remarks This exists because {@link EagerMapTreeNode.parentField} must return a field.\n * If a {@link EagerMapTreeNode} is created without a parent, its {@link EagerMapTreeNode.parentField} property will point to this object.\n * However, this field cannot be used in any practical way because it is empty, i.e. it does not actually contain the children that claim to be parented under it.\n * It has the \"empty\" schema and it will always contain zero children if queried.\n * Any nodes with this location will have a dummy parent index of `-1`.\n */\nconst unparentedLocation: LocationInField = {\n\tparent: {\n\t\t[flexTreeMarker]: FlexTreeEntityKind.Field as const,\n\t\tlength: 0,\n\t\tkey: EmptyKey,\n\t\tparent: undefined,\n\t\tis<TKind2 extends FlexFieldKind>(kind: TKind2) {\n\t\t\treturn this.schema.kind === kind.identifier;\n\t\t},\n\t\tboxedIterator(): IterableIterator<FlexTreeNode> {\n\t\t\treturn [].values();\n\t\t},\n\t\tboxedAt(index: number): FlexTreeNode | undefined {\n\t\t\treturn undefined;\n\t\t},\n\t\tschema: FlexFieldSchema.empty.stored,\n\t\tcontext: emptyContext,\n\t\tmapTrees: [],\n\t\tgetFieldPath() {\n\t\t\tfail(\"unsupported\");\n\t\t},\n\t},\n\tindex: -1,\n};\n\nclass EagerMapTreeField implements MapTreeField {\n\tpublic [flexTreeMarker] = FlexTreeEntityKind.Field as const;\n\n\tpublic get schema(): TreeFieldStoredSchema {\n\t\treturn this.flexSchema.stored;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly context: UnhydratedContext,\n\t\tpublic readonly flexSchema: FlexFieldSchema,\n\t\tpublic readonly key: FieldKey,\n\t\tpublic readonly parent: EagerMapTreeNode,\n\t) {\n\t\tconst fieldKeyCache = getFieldKeyCache(parent);\n\t\tassert(!fieldKeyCache.has(key), 0x990 /* A field already exists for the given MapTrees */);\n\t\tfieldKeyCache.set(key, this);\n\n\t\t// When this field is created (which only happens one time, because it is cached), all the children become parented for the first time.\n\t\t// \"Adopt\" each child by updating its parent information to point to this field.\n\t\tfor (const [i, mapTree] of this.mapTrees.entries()) {\n\t\t\tconst mapTreeNodeChild = nodeCache.get(mapTree);\n\t\t\tif (mapTreeNodeChild !== undefined) {\n\t\t\t\tif (mapTreeNodeChild.parentField !== unparentedLocation) {\n\t\t\t\t\tthrow new UsageError(\"A node may not be in more than one place in the tree\");\n\t\t\t\t}\n\t\t\t\tmapTreeNodeChild.adoptBy(this, i);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get mapTrees(): readonly ExclusiveMapTree[] {\n\t\treturn this.parent.mapTree.fields.get(this.key) ?? [];\n\t}\n\n\tpublic get length(): number {\n\t\treturn this.mapTrees.length;\n\t}\n\n\tpublic is<TKind2 extends FlexFieldKind>(kind: TKind2): this is FlexTreeTypedField<TKind2> {\n\t\treturn this.schema.kind === kind.identifier;\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeNode> {\n\t\treturn this.mapTrees\n\t\t\t.map(\n\t\t\t\t(m, index) =>\n\t\t\t\t\tgetOrCreateChild(this.context, m, this.flexSchema.allowedTypes, {\n\t\t\t\t\t\tparent: this,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t}) as FlexTreeNode,\n\t\t\t)\n\t\t\t.values();\n\t}\n\n\tpublic boxedAt(index: number): FlexTreeNode | undefined {\n\t\tconst i = indexForAt(index, this.length);\n\t\tif (i === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst m = this.mapTrees[i];\n\t\tif (m !== undefined) {\n\t\t\treturn getOrCreateChild(this.context, m, this.flexSchema.allowedTypes, {\n\t\t\t\tparent: this,\n\t\t\t\tindex: i,\n\t\t\t}) as FlexTreeNode;\n\t\t}\n\t}\n\n\t/**\n\t * Mutate this field.\n\t * @param edit - A function which receives the current `MapTree`s that comprise the contents of the field so that it may be mutated.\n\t * The function may mutate the array in place or return a new array.\n\t * If a new array is returned then it will be used as the new contents of the field, otherwise the original array will be continue to be used.\n\t * @remarks All edits to the field (i.e. mutations of the field's MapTrees) should be directed through this function.\n\t * This function ensures that the parent MapTree has no empty fields (which is an invariant of `MapTree`) after the mutation.\n\t */\n\tprotected edit(edit: (mapTrees: ExclusiveMapTree[]) => void | ExclusiveMapTree[]): void {\n\t\tconst oldMapTrees = this.parent.mapTree.fields.get(this.key) ?? [];\n\t\tconst newMapTrees = edit(oldMapTrees) ?? oldMapTrees;\n\t\tif (newMapTrees.length > 0) {\n\t\t\tthis.parent.mapTree.fields.set(this.key, newMapTrees);\n\t\t} else {\n\t\t\tthis.parent.mapTree.fields.delete(this.key);\n\t\t}\n\t}\n\n\tpublic getFieldPath(): FieldUpPath {\n\t\tthrow unsupportedUsageError(\"Editing an array\");\n\t}\n}\n\nclass EagerMapTreeOptionalField extends EagerMapTreeField implements FlexTreeOptionalField {\n\tpublic readonly editor = {\n\t\tset: (newContent: ExclusiveMapTree | undefined): void => {\n\t\t\t// If the new content is a MapTreeNode, it needs to have its parent pointer updated\n\t\t\tif (newContent !== undefined) {\n\t\t\t\tnodeCache.get(newContent)?.adoptBy(this, 0);\n\t\t\t}\n\t\t\t// If the old content is a MapTreeNode, it needs to have its parent pointer unset\n\t\t\tconst oldContent = this.mapTrees[0];\n\t\t\tif (oldContent !== undefined) {\n\t\t\t\tnodeCache.get(oldContent)?.adoptBy(undefined);\n\t\t\t}\n\n\t\t\tthis.edit((mapTrees) => {\n\t\t\t\tif (newContent !== undefined) {\n\t\t\t\t\tmapTrees[0] = newContent;\n\t\t\t\t} else {\n\t\t\t\t\tmapTrees.length = 0;\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t};\n\n\tpublic get content(): FlexTreeUnknownUnboxed | undefined {\n\t\tconst value = this.mapTrees[0];\n\t\tif (value !== undefined) {\n\t\t\treturn unboxed(this.flexSchema, value, {\n\t\t\t\tparent: this,\n\t\t\t\tindex: 0,\n\t\t\t});\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n\nclass EagerMapTreeRequiredField\n\textends EagerMapTreeOptionalField\n\timplements FlexTreeRequiredField\n{\n\tpublic override get content(): FlexTreeUnknownUnboxed {\n\t\treturn super.content ?? fail(\"Expected EagerMapTree required field to have a value\");\n\t}\n}\n\nclass EagerMapTreeSequenceField extends EagerMapTreeField implements FlexTreeSequenceField {\n\tpublic readonly editor: MapTreeSequenceFieldEditBuilder = {\n\t\tinsert: (index, newContent): void => {\n\t\t\tfor (let i = 0; i < newContent.length; i++) {\n\t\t\t\tconst c = newContent[i];\n\t\t\t\tassert(c !== undefined, 0xa0a /* Unexpected sparse array content */);\n\t\t\t\tnodeCache.get(c)?.adoptBy(this, index + i);\n\t\t\t}\n\t\t\tthis.edit((mapTrees) => {\n\t\t\t\tif (newContent.length < 1000) {\n\t\t\t\t\t// For \"smallish arrays\" (`1000` is not empirically derived), the `splice` function is appropriate...\n\t\t\t\t\tmapTrees.splice(index, 0, ...newContent);\n\t\t\t\t} else {\n\t\t\t\t\t// ...but we avoid using `splice` + spread for very large input arrays since there is a limit on how many elements can be spread (too many will overflow the stack).\n\t\t\t\t\treturn mapTrees.slice(0, index).concat(newContent, mapTrees.slice(index));\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tremove: (index, count): ExclusiveMapTree[] => {\n\t\t\tfor (let i = index; i < index + count; i++) {\n\t\t\t\tconst c = this.mapTrees[i];\n\t\t\t\tassert(c !== undefined, 0xa0b /* Unexpected sparse array */);\n\t\t\t\tnodeCache.get(c)?.adoptBy(undefined);\n\t\t\t}\n\t\t\tlet removed: ExclusiveMapTree[] | undefined;\n\t\t\tthis.edit((mapTrees) => {\n\t\t\t\tremoved = mapTrees.splice(index, count);\n\t\t\t});\n\t\t\treturn removed ?? fail(\"Expected removed to be set by edit\");\n\t\t},\n\t};\n\n\tpublic at(index: number): FlexTreeUnknownUnboxed | undefined {\n\t\tconst i = indexForAt(index, this.length);\n\t\tif (i === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn unboxed(this.flexSchema, this.mapTrees[i] ?? oob(), { parent: this, index: i });\n\t}\n\tpublic map<U>(callbackfn: (value: FlexTreeUnknownUnboxed, index: number) => U): U[] {\n\t\treturn Array.from(this, callbackfn);\n\t}\n\n\tpublic *[Symbol.iterator](): IterableIterator<FlexTreeUnknownUnboxed> {\n\t\tfor (const [i, mapTree] of this.mapTrees.entries()) {\n\t\t\tyield unboxed(this.flexSchema, mapTree, { parent: this, index: i });\n\t\t}\n\t}\n}\n\n// #endregion Fields\n\n// #region Caching and unboxing utilities\n\nconst nodeCache = new WeakMap<MapTree, EagerMapTreeNode>();\n/** Node Parent -\\> Field Key -\\> Field */\nconst fieldCache = new WeakMap<MapTreeNode, Map<FieldKey, EagerMapTreeField>>();\nfunction getFieldKeyCache(parent: MapTreeNode): WeakMap<FieldKey, EagerMapTreeField> {\n\treturn getOrCreate(fieldCache, parent, () => new Map());\n}\n\n/**\n * If there exists a {@link EagerMapTreeNode} for the given {@link MapTree}, returns it, otherwise returns `undefined`.\n * @remarks {@link EagerMapTreeNode | MapTreeNodes} are created via {@link getOrCreateNode}.\n */\nexport function tryGetMapTreeNode(mapTree: MapTree): MapTreeNode | undefined {\n\treturn nodeCache.get(mapTree);\n}\n\n/**\n * Create a {@link EagerMapTreeNode} that wraps the given {@link MapTree}, or get the node that already exists for that {@link MapTree} if there is one.\n * @param nodeSchema - the {@link FlexTreeNodeSchema | schema} that the node conforms to\n * @param mapTree - the {@link MapTree} containing the data for this node.\n * @remarks It must conform to the `nodeSchema`.\n */\nexport function getOrCreateMapTreeNode(\n\tcontext: UnhydratedContext,\n\tnodeSchema: FlexTreeNodeSchema,\n\tmapTree: ExclusiveMapTree,\n): EagerMapTreeNode {\n\treturn nodeCache.get(mapTree) ?? createNode(context, nodeSchema, mapTree, undefined);\n}\n\n/** Helper for creating a `MapTreeNode` given the parent field (e.g. when \"walking down\") */\nfunction getOrCreateChild(\n\tcontext: UnhydratedContext,\n\tmapTree: ExclusiveMapTree,\n\tallowedTypes: FlexAllowedTypes,\n\tparent: LocationInField | undefined,\n): EagerMapTreeNode {\n\tconst cached = nodeCache.get(mapTree);\n\tif (cached !== undefined) {\n\t\treturn cached;\n\t}\n\n\tassert(isReadonlyArray(allowedTypes), 0xa25 /* invalid types */);\n\tconst nodeSchema =\n\t\tallowedTypes\n\t\t\t.map((t) => (isLazy(t) ? t() : t))\n\t\t\t.find((t): t is FlexTreeNodeSchema => {\n\t\t\t\treturn t.name === mapTree.type;\n\t\t\t}) ?? fail(\"Unsupported node schema\");\n\n\treturn createNode(context, nodeSchema, mapTree, parent);\n}\n\n/** Always constructs a new node, therefore may not be called twice for the same `MapTree`. */\nfunction createNode(\n\tcontext: UnhydratedContext,\n\tnodeSchema: FlexTreeNodeSchema,\n\tmapTree: ExclusiveMapTree,\n\tparentField: LocationInField | undefined,\n): EagerMapTreeNode {\n\treturn new EagerMapTreeNode(context, nodeSchema, mapTree, parentField);\n}\n\n/** Creates a field with the given attributes, or returns a cached field if there is one */\nfunction getOrCreateField(\n\tparent: EagerMapTreeNode,\n\tkey: FieldKey,\n\tschema: FlexFieldSchema,\n): EagerMapTreeField {\n\tconst cached = getFieldKeyCache(parent).get(key);\n\tif (cached !== undefined) {\n\t\treturn cached;\n\t}\n\n\tif (\n\t\tschema.kind.identifier === FieldKinds.required.identifier ||\n\t\tschema.kind.identifier === FieldKinds.identifier.identifier\n\t) {\n\t\treturn new EagerMapTreeRequiredField(parent.context, schema, key, parent);\n\t}\n\n\tif (schema.kind.identifier === FieldKinds.optional.identifier) {\n\t\treturn new EagerMapTreeOptionalField(parent.context, schema, key, parent);\n\t}\n\n\tif (schema.kind.identifier === FieldKinds.sequence.identifier) {\n\t\treturn new EagerMapTreeSequenceField(parent.context, schema, key, parent);\n\t}\n\n\treturn new EagerMapTreeField(parent.context, schema, key, parent);\n}\n\n/** Unboxes leaf nodes to their values */\nfunction unboxed(\n\tschema: FlexFieldSchema,\n\tmapTree: ExclusiveMapTree,\n\tparent: LocationInField,\n): FlexTreeUnknownUnboxed {\n\tconst value = mapTree.value;\n\tif (value !== undefined) {\n\t\treturn value;\n\t}\n\n\treturn getOrCreateChild(parent.parent.context, mapTree, schema.allowedTypes, parent);\n}\n\n// #endregion Caching and unboxing utilities\n\nexport function unsupportedUsageError(message?: string): Error {\n\treturn new UsageError(\n\t\t`${\n\t\t\tmessage ?? \"Operation\"\n\t\t} is not supported for content that has not yet been inserted into the tree`,\n\t);\n}\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { type TreeFieldStoredSchema, type TreeNodeSchemaIdentifier, type TreeStoredSchema } from "../core/index.js";
|
|
6
|
-
import { FlexFieldSchema, type FlexTreeNodeSchema, type FlexTreeSchema } from "./typed-schema/index.js";
|
|
7
|
-
/**
|
|
8
|
-
* Creates a new view schema using the stored schema.
|
|
9
|
-
* @remarks
|
|
10
|
-
* This is really only suitable for use with code that happens to need access to things which require a view schema, but isn't actually schema aware.
|
|
11
|
-
* If the input schema came from a view schema, it will not return the same view schema, and will not be compatible:
|
|
12
|
-
* the returned TreeSchema is simply one which schematize will not object to.
|
|
13
|
-
* Assumes the schema uses the default field kinds.
|
|
14
|
-
*/
|
|
15
|
-
export declare function treeSchemaFromStoredSchema(schema: TreeStoredSchema): FlexTreeSchema;
|
|
16
|
-
export declare function fieldSchemaFromStoredSchema(schema: TreeFieldStoredSchema, map: ReadonlyMap<TreeNodeSchemaIdentifier, FlexTreeNodeSchema>): FlexFieldSchema;
|
|
17
|
-
//# sourceMappingURL=storedToViewSchema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storedToViewSchema.d.ts","sourceRoot":"","sources":["../../src/feature-libraries/storedToViewSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAIN,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAEN,eAAe,EAIf,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAEnB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,gBAAgB,GAAG,cAAc,CAoCnF;AAgBD,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,qBAAqB,EAC7B,GAAG,EAAE,WAAW,CAAC,wBAAwB,EAAE,kBAAkB,CAAC,GAC5D,eAAe,CAOjB"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.fieldSchemaFromStoredSchema = exports.treeSchemaFromStoredSchema = void 0;
|
|
8
|
-
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
-
const index_js_1 = require("../core/index.js");
|
|
10
|
-
const index_js_2 = require("../util/index.js");
|
|
11
|
-
const index_js_3 = require("./default-schema/index.js");
|
|
12
|
-
const index_js_4 = require("./typed-schema/index.js");
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new view schema using the stored schema.
|
|
15
|
-
* @remarks
|
|
16
|
-
* This is really only suitable for use with code that happens to need access to things which require a view schema, but isn't actually schema aware.
|
|
17
|
-
* If the input schema came from a view schema, it will not return the same view schema, and will not be compatible:
|
|
18
|
-
* the returned TreeSchema is simply one which schematize will not object to.
|
|
19
|
-
* Assumes the schema uses the default field kinds.
|
|
20
|
-
*/
|
|
21
|
-
function treeSchemaFromStoredSchema(schema) {
|
|
22
|
-
const map = new Map();
|
|
23
|
-
for (const [identifier, innerSchema] of schema.nodeSchema) {
|
|
24
|
-
if (innerSchema instanceof index_js_1.LeafNodeStoredSchema) {
|
|
25
|
-
map.set(identifier, new index_js_4.LeafNodeSchema({ name: "intoTypedSchema" }, identifier, innerSchema.leafValue));
|
|
26
|
-
}
|
|
27
|
-
else if (innerSchema instanceof index_js_1.MapNodeStoredSchema) {
|
|
28
|
-
map.set(identifier, index_js_4.FlexMapNodeSchema.create({ name: "intoTypedSchema" }, identifier, fieldSchemaFromStoredSchema(innerSchema.mapFields, map)));
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
(0, internal_1.assert)(innerSchema instanceof index_js_1.ObjectNodeStoredSchema, 0x882 /* unsupported node kind */);
|
|
32
|
-
const fields = new Map();
|
|
33
|
-
for (const [key, field] of innerSchema.objectNodeFields) {
|
|
34
|
-
fields.set(key, fieldSchemaFromStoredSchema(field, map));
|
|
35
|
-
}
|
|
36
|
-
const fieldsObject = mapToObject(fields);
|
|
37
|
-
map.set(identifier, index_js_4.FlexObjectNodeSchema.create({ name: "intoTypedSchema" }, identifier, fieldsObject));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
adapters: {},
|
|
42
|
-
policy: index_js_3.defaultSchemaPolicy,
|
|
43
|
-
rootFieldSchema: fieldSchemaFromStoredSchema(schema.rootFieldSchema, map),
|
|
44
|
-
nodeSchema: map,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
exports.treeSchemaFromStoredSchema = treeSchemaFromStoredSchema;
|
|
48
|
-
function mapToObject(map) {
|
|
49
|
-
const objectMap = Object.create(null);
|
|
50
|
-
for (const [key, value] of map.entries()) {
|
|
51
|
-
// This code has to be careful to avoid assigned to __proto__ or similar built in fields.
|
|
52
|
-
Object.defineProperty(objectMap, key, {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
configurable: false,
|
|
55
|
-
writable: false,
|
|
56
|
-
value,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return objectMap;
|
|
60
|
-
}
|
|
61
|
-
function fieldSchemaFromStoredSchema(schema, map) {
|
|
62
|
-
const kind = index_js_3.defaultSchemaPolicy.fieldKinds.get(schema.kind) ?? (0, index_js_2.fail)("missing field kind");
|
|
63
|
-
const types = Array.from(schema.types, (v) => () => map.get(v) ?? (0, index_js_2.fail)("missing schema"));
|
|
64
|
-
return index_js_4.FlexFieldSchema.create(kind, types);
|
|
65
|
-
}
|
|
66
|
-
exports.fieldSchemaFromStoredSchema = fieldSchemaFromStoredSchema;
|
|
67
|
-
//# sourceMappingURL=storedToViewSchema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storedToViewSchema.js","sourceRoot":"","sources":["../../src/feature-libraries/storedToViewSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,+CAO0B;AAC1B,+CAAwC;AAExC,wDAAgE;AAChE,sDASiC;AAEjC;;;;;;;GAOG;AACH,SAAgB,0BAA0B,CAAC,MAAwB;IAClE,MAAM,GAAG,GAAsD,IAAI,GAAG,EAAE,CAAC;IACzE,KAAK,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QAC3D,IAAI,WAAW,YAAY,+BAAoB,EAAE,CAAC;YACjD,GAAG,CA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KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;QAC1C,yFAAyF;QACzF,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,GAAG,EAAE;YACrC,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,KAAK;SACL,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,SAAgB,2BAA2B,CAC1C,MAA6B,EAC7B,GAA8D;IAE9D,MAAM,IAAI,GAAG,8BAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAA,eAAI,EAAC,oBAAoB,CAAC,CAAC;IAC3F,MAAM,KAAK,GAAqB,KAAK,CAAC,IAAI,CACzC,MAAM,CAAC,KAAK,EACZ,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,IAAA,eAAI,EAAC,gBAAgB,CAAC,CACjD,CAAC;IACF,OAAO,0BAAe,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AAVD,kEAUC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeStoredSchema,\n} from \"../core/index.js\";\nimport { fail } from \"../util/index.js\";\n\nimport { defaultSchemaPolicy } from \"./default-schema/index.js\";\nimport {\n\ttype FlexAllowedTypes,\n\tFlexFieldSchema,\n\ttype FlexMapFieldSchema,\n\tFlexMapNodeSchema,\n\tFlexObjectNodeSchema,\n\ttype FlexTreeNodeSchema,\n\ttype FlexTreeSchema,\n\tLeafNodeSchema,\n} from \"./typed-schema/index.js\";\n\n/**\n * Creates a new view schema using the stored schema.\n * @remarks\n * This is really only suitable for use with code that happens to need access to things which require a view schema, but isn't actually schema aware.\n * If the input schema came from a view schema, it will not return the same view schema, and will not be compatible:\n * the returned TreeSchema is simply one which schematize will not object to.\n * Assumes the schema uses the default field kinds.\n */\nexport function treeSchemaFromStoredSchema(schema: TreeStoredSchema): FlexTreeSchema {\n\tconst map: Map<TreeNodeSchemaIdentifier, FlexTreeNodeSchema> = new Map();\n\tfor (const [identifier, innerSchema] of schema.nodeSchema) {\n\t\tif (innerSchema instanceof LeafNodeStoredSchema) {\n\t\t\tmap.set(\n\t\t\t\tidentifier,\n\t\t\t\tnew LeafNodeSchema({ name: \"intoTypedSchema\" }, identifier, innerSchema.leafValue),\n\t\t\t);\n\t\t} else if (innerSchema instanceof MapNodeStoredSchema) {\n\t\t\tmap.set(\n\t\t\t\tidentifier,\n\t\t\t\tFlexMapNodeSchema.create(\n\t\t\t\t\t{ name: \"intoTypedSchema\" },\n\t\t\t\t\tidentifier,\n\t\t\t\t\tfieldSchemaFromStoredSchema(innerSchema.mapFields, map) as FlexMapFieldSchema,\n\t\t\t\t),\n\t\t\t);\n\t\t} else {\n\t\t\tassert(innerSchema instanceof ObjectNodeStoredSchema, 0x882 /* unsupported node kind */);\n\t\t\tconst fields = new Map<string, FlexFieldSchema>();\n\t\t\tfor (const [key, field] of innerSchema.objectNodeFields) {\n\t\t\t\tfields.set(key, fieldSchemaFromStoredSchema(field, map));\n\t\t\t}\n\t\t\tconst fieldsObject = mapToObject(fields);\n\t\t\tmap.set(\n\t\t\t\tidentifier,\n\t\t\t\tFlexObjectNodeSchema.create({ name: \"intoTypedSchema\" }, identifier, fieldsObject),\n\t\t\t);\n\t\t}\n\t}\n\treturn {\n\t\tadapters: {},\n\t\tpolicy: defaultSchemaPolicy,\n\t\trootFieldSchema: fieldSchemaFromStoredSchema(schema.rootFieldSchema, map),\n\t\tnodeSchema: map,\n\t};\n}\n\nfunction mapToObject<MapValue>(map: Map<string, MapValue>): Record<string, MapValue> {\n\tconst objectMap: Record<string, MapValue> = Object.create(null);\n\tfor (const [key, value] of map.entries()) {\n\t\t// This code has to be careful to avoid assigned to __proto__ or similar built in fields.\n\t\tObject.defineProperty(objectMap, key, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\twritable: false,\n\t\t\tvalue,\n\t\t});\n\t}\n\treturn objectMap;\n}\n\nexport function fieldSchemaFromStoredSchema(\n\tschema: TreeFieldStoredSchema,\n\tmap: ReadonlyMap<TreeNodeSchemaIdentifier, FlexTreeNodeSchema>,\n): FlexFieldSchema {\n\tconst kind = defaultSchemaPolicy.fieldKinds.get(schema.kind) ?? fail(\"missing field kind\");\n\tconst types: FlexAllowedTypes = Array.from(\n\t\tschema.types,\n\t\t(v) => () => map.get(v) ?? fail(\"missing schema\"),\n\t);\n\treturn FlexFieldSchema.create(kind, types);\n}\n"]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { type Adapters, type TreeAdapter } from "../../core/index.js";
|
|
6
|
-
import { type FlexFieldSchema, type SchemaCollection } from "./typedTreeSchema.js";
|
|
7
|
-
import type { Sourced } from "./view.js";
|
|
8
|
-
/**
|
|
9
|
-
* Schema data collected by a single SchemaBuilder (does not include referenced libraries).
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export interface SchemaLibraryData extends SchemaCollection {
|
|
13
|
-
readonly name: string;
|
|
14
|
-
readonly adapters: Adapters;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Mutable adapter collection which records the associated factory.
|
|
18
|
-
* See {@link Adapters}.
|
|
19
|
-
*/
|
|
20
|
-
export interface SourcedAdapters {
|
|
21
|
-
readonly tree: (Sourced & TreeAdapter)[];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Allows opting into and out of errors for some unusual schema patterns which are usually bugs.
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
export interface SchemaLintConfiguration {
|
|
28
|
-
readonly rejectForbidden: boolean;
|
|
29
|
-
readonly rejectEmpty: boolean;
|
|
30
|
-
}
|
|
31
|
-
export declare const schemaLintDefault: SchemaLintConfiguration;
|
|
32
|
-
/**
|
|
33
|
-
* Build and validate a SchemaCollection.
|
|
34
|
-
*
|
|
35
|
-
* As much as possible tries to detect anything that might be a mistake made by the schema author.
|
|
36
|
-
* This will error on some valid but probably never intended to be used patterns
|
|
37
|
-
* (like libraries with the same name, nodes which are impossible to create etc).
|
|
38
|
-
*
|
|
39
|
-
* @param name - Name of the resulting library.
|
|
40
|
-
* @param lintConfiguration - configuration for what errors to generate.
|
|
41
|
-
* @param libraries - Data to aggregate into the SchemaCollection.
|
|
42
|
-
* @param rootFieldSchema - Only validated: not included in the result.
|
|
43
|
-
*
|
|
44
|
-
* @privateRemarks
|
|
45
|
-
* This checks that input works with defaultSchemaPolicy.
|
|
46
|
-
* If support fo other policies is added, this will need to take in the policy.
|
|
47
|
-
*/
|
|
48
|
-
export declare function aggregateSchemaLibraries(name: string, lintConfiguration: SchemaLintConfiguration, libraries: Iterable<SchemaLibraryData>, rootFieldSchema?: FlexFieldSchema): SchemaLibraryData;
|
|
49
|
-
/**
|
|
50
|
-
* Returns an array of descriptions of errors in the collection.
|
|
51
|
-
*
|
|
52
|
-
* As much as possible tries to detect anything that might be a mistake made by the schema author.
|
|
53
|
-
* This will error on some valid but probably never intended to be used patterns (like never nodes).
|
|
54
|
-
*/
|
|
55
|
-
export declare function validateSchemaCollection(lintConfiguration: SchemaLintConfiguration, collection: SchemaCollection, rootFieldSchema?: FlexFieldSchema): string[];
|
|
56
|
-
export declare function validateRootField(lintConfiguration: SchemaLintConfiguration, collection: SchemaCollection, field: FlexFieldSchema, errors: string[]): void;
|
|
57
|
-
export declare function validateField(lintConfiguration: SchemaLintConfiguration, collection: SchemaCollection, field: FlexFieldSchema, describeField: () => string, errors: string[]): void;
|
|
58
|
-
//# sourceMappingURL=schemaCollection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemaCollection.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/schemaCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,WAAW,EAGhB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACN,KAAK,eAAe,EAKpB,KAAK,gBAAgB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,GAAG,WAAW,CAAC,EAAE,CAAC;CACzC;AAMD;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,iBAAiB,EAAE,uBAG/B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CACvC,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,uBAAuB,EAC1C,SAAS,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EACtC,eAAe,CAAC,EAAE,eAAe,GAC/B,iBAAiB,CAuDnB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACvC,iBAAiB,EAAE,uBAAuB,EAC1C,UA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