@fluidframework/tree 2.4.0-297027 → 2.4.0-299374
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/.dependency-cruiser-known-violations.json +0 -14
- package/.vscode/settings.json +9 -1
- package/api-report/tree.alpha.api.md +178 -21
- package/api-report/tree.beta.api.md +46 -21
- package/api-report/tree.legacy.alpha.api.md +46 -21
- package/api-report/tree.legacy.public.api.md +46 -21
- package/api-report/tree.public.api.md +46 -21
- package/dist/alpha.d.ts +29 -1
- package/dist/beta.d.ts +2 -0
- package/dist/codec/codec.d.ts +4 -4
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/noopValidator.d.ts +1 -1
- package/dist/codec/noopValidator.js +1 -1
- package/dist/codec/noopValidator.js.map +1 -1
- package/dist/core/change-family/changeFamily.d.ts +2 -2
- package/dist/core/change-family/changeFamily.d.ts.map +1 -1
- package/dist/core/change-family/changeFamily.js.map +1 -1
- package/dist/core/change-family/editBuilder.d.ts +3 -2
- package/dist/core/change-family/editBuilder.d.ts.map +1 -1
- package/dist/core/change-family/editBuilder.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +2 -1
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/utils.js +1 -1
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +159 -2
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +54 -12
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/external-utilities/typeboxValidator.d.ts +1 -1
- package/dist/external-utilities/typeboxValidator.js +1 -1
- package/dist/external-utilities/typeboxValidator.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +4 -3
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +41 -30
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -6
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +4 -0
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +38 -6
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +0 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +46 -49
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/mitigatedChangeFamily.js +4 -4
- package/dist/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +12 -8
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +179 -60
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts +10 -9
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +9 -7
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -10
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -8
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +32 -20
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.d.ts +6 -1
- package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +25 -9
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +17 -16
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +19 -11
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/dist/feature-libraries/treeCompressionUtils.d.ts +1 -1
- package/dist/feature-libraries/treeCompressionUtils.js +1 -1
- package/dist/feature-libraries/treeCompressionUtils.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/internalTypes.d.ts +2 -2
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/legacy.d.ts +2 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +2 -0
- package/dist/shared-tree/index.d.ts +2 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +5 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +1 -14
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +24 -9
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +21 -9
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +4 -4
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts +2 -2
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js +15 -11
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/treeApi.d.ts +6 -6
- package/dist/shared-tree/treeApi.d.ts.map +1 -1
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +4 -3
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +2 -3
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +10 -11
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts +5 -5
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js +4 -4
- package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +1 -1
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +2 -2
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/conciseTree.d.ts +29 -0
- package/dist/simple-tree/api/conciseTree.d.ts.map +1 -0
- package/dist/simple-tree/api/conciseTree.js +25 -0
- package/dist/simple-tree/api/conciseTree.js.map +1 -0
- package/dist/simple-tree/api/customTree.d.ts +44 -0
- package/dist/simple-tree/api/customTree.d.ts.map +1 -0
- package/dist/simple-tree/api/customTree.js +63 -0
- package/dist/simple-tree/api/customTree.js.map +1 -0
- package/dist/simple-tree/api/index.d.ts +7 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +5 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +41 -26
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +43 -15
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +1 -2
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +8 -8
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -2
- 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/storedSchema.d.ts +78 -0
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -0
- package/dist/simple-tree/api/storedSchema.js +107 -0
- package/dist/simple-tree/api/storedSchema.js.map +1 -0
- package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
- package/dist/simple-tree/api/tree.d.ts +12 -3
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +5 -5
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/{typesUnsafe.d.ts → api/typesUnsafe.d.ts} +58 -10
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -0
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -0
- package/dist/simple-tree/api/verboseTree.d.ts +6 -20
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +10 -48
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +14 -3
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +1 -2
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +1 -1
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +2 -1
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +9 -0
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +14 -1
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +6 -5
- 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/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +3 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/core/withType.d.ts +3 -1
- package/dist/simple-tree/core/withType.d.ts.map +1 -1
- package/dist/simple-tree/core/withType.js.map +1 -1
- package/dist/simple-tree/flexList.d.ts.map +1 -0
- package/dist/simple-tree/flexList.js.map +1 -0
- package/dist/simple-tree/index.d.ts +6 -7
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +5 -3
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +2 -3
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +3 -4
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +60 -7
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +11 -6
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
- package/dist/simple-tree/toFlexSchema.js +13 -15
- package/dist/simple-tree/toFlexSchema.js.map +1 -1
- package/dist/simple-tree/toMapTree.d.ts +4 -2
- package/dist/simple-tree/toMapTree.d.ts.map +1 -1
- package/dist/simple-tree/toMapTree.js +3 -3
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +2 -1
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/treeFactory.d.ts +1 -0
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +1 -0
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/utils.d.ts +10 -8
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js.map +1 -1
- package/docs/main/detached-trees.md +8 -8
- package/lib/alpha.d.ts +29 -1
- package/lib/beta.d.ts +2 -0
- package/lib/codec/codec.d.ts +4 -4
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/noopValidator.d.ts +1 -1
- package/lib/codec/noopValidator.js +1 -1
- package/lib/codec/noopValidator.js.map +1 -1
- package/lib/core/change-family/changeFamily.d.ts +2 -2
- package/lib/core/change-family/changeFamily.d.ts.map +1 -1
- package/lib/core/change-family/changeFamily.js.map +1 -1
- package/lib/core/change-family/editBuilder.d.ts +3 -2
- package/lib/core/change-family/editBuilder.d.ts.map +1 -1
- package/lib/core/change-family/editBuilder.js.map +1 -1
- package/lib/core/rebase/changeRebaser.d.ts +2 -1
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.js.map +1 -1
- package/lib/core/rebase/utils.js +1 -1
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +159 -2
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +54 -12
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/external-utilities/typeboxValidator.d.ts +1 -1
- package/lib/external-utilities/typeboxValidator.js +1 -1
- package/lib/external-utilities/typeboxValidator.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +4 -3
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +41 -30
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +4 -6
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +4 -0
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +36 -5
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +0 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +0 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/mitigatedChangeFamily.js +4 -4
- package/lib/feature-libraries/mitigatedChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +12 -8
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +180 -61
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts +10 -9
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +9 -7
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -10
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -8
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +32 -20
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.d.ts +6 -1
- package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +25 -9
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +17 -16
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +19 -11
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/lib/feature-libraries/treeCompressionUtils.d.ts +1 -1
- package/lib/feature-libraries/treeCompressionUtils.js +1 -1
- package/lib/feature-libraries/treeCompressionUtils.js.map +1 -1
- package/lib/index.d.ts +6 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/internalTypes.d.ts +2 -2
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/legacy.d.ts +2 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +2 -0
- package/lib/shared-tree/index.d.ts +2 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +2 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +2 -15
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +24 -9
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +20 -9
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +4 -4
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts +2 -2
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js +15 -11
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/treeApi.d.ts +6 -6
- package/lib/shared-tree/treeApi.d.ts.map +1 -1
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +5 -4
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +2 -3
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +11 -12
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts +5 -5
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.js +4 -4
- package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +2 -2
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +2 -2
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts +29 -0
- package/lib/simple-tree/api/conciseTree.d.ts.map +1 -0
- package/lib/simple-tree/api/conciseTree.js +21 -0
- package/lib/simple-tree/api/conciseTree.js.map +1 -0
- package/lib/simple-tree/api/customTree.d.ts +44 -0
- package/lib/simple-tree/api/customTree.d.ts.map +1 -0
- package/lib/simple-tree/api/customTree.js +59 -0
- package/lib/simple-tree/api/customTree.js.map +1 -0
- package/lib/simple-tree/api/index.d.ts +7 -2
- 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/schemaCreationUtilities.d.ts +41 -26
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +43 -15
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +1 -2
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +1 -1
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -2
- 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/storedSchema.d.ts +78 -0
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -0
- package/lib/simple-tree/api/storedSchema.js +101 -0
- package/lib/simple-tree/api/storedSchema.js.map +1 -0
- package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
- package/lib/simple-tree/api/tree.d.ts +12 -3
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +3 -3
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/{typesUnsafe.d.ts → api/typesUnsafe.d.ts} +58 -10
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -0
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -0
- package/lib/simple-tree/api/verboseTree.d.ts +6 -20
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +11 -49
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +14 -3
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +1 -2
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +1 -1
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +1 -1
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +9 -0
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +12 -0
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +6 -5
- 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/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +3 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/core/withType.d.ts +3 -1
- package/lib/simple-tree/core/withType.d.ts.map +1 -1
- package/lib/simple-tree/core/withType.js.map +1 -1
- package/lib/simple-tree/flexList.d.ts.map +1 -0
- package/lib/simple-tree/flexList.js.map +1 -0
- package/lib/simple-tree/index.d.ts +6 -7
- 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/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +1 -2
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +1 -2
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +60 -7
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +6 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
- package/lib/simple-tree/toFlexSchema.js +1 -3
- package/lib/simple-tree/toFlexSchema.js.map +1 -1
- package/lib/simple-tree/toMapTree.d.ts +4 -2
- package/lib/simple-tree/toMapTree.d.ts.map +1 -1
- package/lib/simple-tree/toMapTree.js +3 -3
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +2 -1
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/treeFactory.d.ts +1 -0
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +1 -0
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/utils.d.ts +10 -8
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js.map +1 -1
- package/package.json +44 -27
- package/src/codec/codec.ts +4 -4
- package/src/codec/noopValidator.ts +1 -1
- package/src/core/change-family/changeFamily.ts +5 -2
- package/src/core/change-family/editBuilder.ts +3 -2
- package/src/core/rebase/changeRebaser.ts +6 -1
- package/src/core/rebase/utils.ts +1 -1
- package/src/core/tree/anchorSet.ts +63 -13
- package/src/external-utilities/typeboxValidator.ts +1 -1
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +92 -47
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +7 -7
- package/src/feature-libraries/flex-tree/lazyField.ts +44 -7
- package/src/feature-libraries/index.ts +0 -10
- package/src/feature-libraries/mitigatedChangeFamily.ts +11 -4
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +1 -0
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +218 -175
- package/src/feature-libraries/optional-field/optionalField.ts +21 -17
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +2 -10
- package/src/feature-libraries/sequence-field/compose.ts +67 -58
- package/src/feature-libraries/sequence-field/invert.ts +30 -6
- package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +65 -19
- package/src/feature-libraries/treeCompressionUtils.ts +1 -1
- package/src/index.ts +26 -6
- package/src/internalTypes.ts +4 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +5 -0
- package/src/shared-tree/schematizingTreeView.ts +7 -16
- package/src/shared-tree/sharedTree.ts +55 -23
- package/src/shared-tree/sharedTreeChangeFamily.ts +5 -1
- package/src/shared-tree/sharedTreeEditBuilder.ts +23 -12
- package/src/shared-tree/treeApi.ts +19 -9
- package/src/shared-tree/treeCheckout.ts +7 -6
- package/src/shared-tree-core/branch.ts +11 -14
- package/src/shared-tree-core/defaultResubmitMachine.ts +4 -4
- package/src/shared-tree-core/editManager.ts +2 -1
- package/src/shared-tree-core/sharedTreeCore.ts +4 -2
- package/src/simple-tree/api/conciseTree.ts +58 -0
- package/src/simple-tree/api/customTree.ts +119 -0
- package/src/simple-tree/api/index.ts +39 -1
- package/src/simple-tree/api/schemaCreationUtilities.ts +55 -36
- package/src/simple-tree/api/schemaFactory.ts +4 -6
- package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -2
- package/src/simple-tree/api/storedSchema.ts +126 -0
- package/src/simple-tree/api/tree.ts +24 -2
- package/src/simple-tree/api/treeNodeApi.ts +3 -8
- package/src/simple-tree/{typesUnsafe.ts → api/typesUnsafe.ts} +95 -21
- package/src/simple-tree/api/verboseTree.ts +21 -76
- package/src/simple-tree/arrayNode.ts +35 -15
- package/src/simple-tree/core/index.ts +1 -0
- package/src/simple-tree/core/treeNodeKernel.ts +13 -0
- package/src/simple-tree/core/treeNodeSchema.ts +7 -5
- package/src/simple-tree/core/unhydratedFlexTree.ts +6 -1
- package/src/simple-tree/core/withType.ts +10 -1
- package/src/simple-tree/index.ts +41 -21
- package/src/simple-tree/mapNode.ts +1 -1
- package/src/simple-tree/objectNode.ts +1 -1
- package/src/simple-tree/schemaTypes.ts +70 -11
- package/src/simple-tree/toFlexSchema.ts +1 -3
- package/src/simple-tree/toMapTree.ts +7 -4
- package/src/simple-tree/treeNodeValid.ts +2 -1
- package/src/treeFactory.ts +1 -0
- package/src/util/utils.ts +10 -8
- package/dist/feature-libraries/flex-tree/unboxed.d.ts +0 -12
- package/dist/feature-libraries/flex-tree/unboxed.d.ts.map +0 -1
- package/dist/feature-libraries/flex-tree/unboxed.js +0 -20
- package/dist/feature-libraries/flex-tree/unboxed.js.map +0 -1
- package/dist/feature-libraries/typed-schema/flexList.d.ts.map +0 -1
- package/dist/feature-libraries/typed-schema/flexList.js.map +0 -1
- package/dist/feature-libraries/typed-schema/index.d.ts +0 -7
- package/dist/feature-libraries/typed-schema/index.d.ts.map +0 -1
- package/dist/feature-libraries/typed-schema/index.js +0 -12
- package/dist/feature-libraries/typed-schema/index.js.map +0 -1
- package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -14
- package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +0 -1
- package/dist/feature-libraries/typed-schema/typedTreeSchema.js +0 -7
- package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +0 -1
- package/dist/simple-tree/proxyBinding.d.ts +0 -15
- package/dist/simple-tree/proxyBinding.d.ts.map +0 -1
- package/dist/simple-tree/proxyBinding.js +0 -22
- package/dist/simple-tree/proxyBinding.js.map +0 -1
- package/dist/simple-tree/typesUnsafe.d.ts.map +0 -1
- package/dist/simple-tree/typesUnsafe.js.map +0 -1
- package/lib/feature-libraries/flex-tree/unboxed.d.ts +0 -12
- package/lib/feature-libraries/flex-tree/unboxed.d.ts.map +0 -1
- package/lib/feature-libraries/flex-tree/unboxed.js +0 -16
- package/lib/feature-libraries/flex-tree/unboxed.js.map +0 -1
- package/lib/feature-libraries/typed-schema/flexList.d.ts.map +0 -1
- package/lib/feature-libraries/typed-schema/flexList.js.map +0 -1
- package/lib/feature-libraries/typed-schema/index.d.ts +0 -7
- package/lib/feature-libraries/typed-schema/index.d.ts.map +0 -1
- package/lib/feature-libraries/typed-schema/index.js +0 -6
- package/lib/feature-libraries/typed-schema/index.js.map +0 -1
- package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +0 -14
- package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +0 -1
- package/lib/feature-libraries/typed-schema/typedTreeSchema.js +0 -6
- package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +0 -1
- package/lib/simple-tree/proxyBinding.d.ts +0 -15
- package/lib/simple-tree/proxyBinding.d.ts.map +0 -1
- package/lib/simple-tree/proxyBinding.js +0 -18
- package/lib/simple-tree/proxyBinding.js.map +0 -1
- package/lib/simple-tree/typesUnsafe.d.ts.map +0 -1
- package/lib/simple-tree/typesUnsafe.js.map +0 -1
- package/src/feature-libraries/flex-tree/unboxed.ts +0 -24
- package/src/feature-libraries/typed-schema/README.md +0 -6
- package/src/feature-libraries/typed-schema/index.ts +0 -16
- package/src/feature-libraries/typed-schema/typedTreeSchema.ts +0 -14
- package/src/simple-tree/proxyBinding.ts +0 -20
- /package/dist/simple-tree/{typesUnsafe.js → api/typesUnsafe.js} +0 -0
- /package/dist/{feature-libraries/typed-schema → simple-tree}/flexList.d.ts +0 -0
- /package/dist/{feature-libraries/typed-schema → simple-tree}/flexList.js +0 -0
- /package/lib/simple-tree/{typesUnsafe.js → api/typesUnsafe.js} +0 -0
- /package/lib/{feature-libraries/typed-schema → simple-tree}/flexList.d.ts +0 -0
- /package/lib/{feature-libraries/typed-schema → simple-tree}/flexList.js +0 -0
- /package/src/simple-tree/{ProxyBinding.md → core/TreeNodeBinding.md} +0 -0
- /package/src/{feature-libraries/typed-schema → simple-tree}/flexList.ts +0 -0
package/src/simple-tree/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ export {
|
|
|
22
22
|
tryDisposeTreeNode,
|
|
23
23
|
HydratedContext,
|
|
24
24
|
SimpleContextSlot,
|
|
25
|
+
getOrCreateInnerNode,
|
|
25
26
|
} from "./core/index.js";
|
|
26
27
|
export {
|
|
27
28
|
type ITree,
|
|
@@ -40,7 +41,6 @@ export {
|
|
|
40
41
|
enumFromStrings,
|
|
41
42
|
singletonSchema,
|
|
42
43
|
typedObjectValues,
|
|
43
|
-
type EmptyObject,
|
|
44
44
|
test_RecursiveObject,
|
|
45
45
|
test_RecursiveObject_base,
|
|
46
46
|
test_RecursiveObjectPojoMode,
|
|
@@ -67,7 +67,36 @@ export {
|
|
|
67
67
|
type JsonLeafSchemaType,
|
|
68
68
|
getJsonSchema,
|
|
69
69
|
getSimpleSchema,
|
|
70
|
+
type VerboseTreeNode,
|
|
71
|
+
type EncodeOptions,
|
|
72
|
+
type ParseOptions,
|
|
73
|
+
type VerboseTree,
|
|
74
|
+
extractPersistedSchema,
|
|
75
|
+
comparePersistedSchema,
|
|
76
|
+
type ConciseTree,
|
|
77
|
+
comparePersistedSchemaInternal,
|
|
70
78
|
ViewSchema,
|
|
79
|
+
type Unenforced,
|
|
80
|
+
type FieldHasDefaultUnsafe,
|
|
81
|
+
type ObjectFromSchemaRecordUnsafe,
|
|
82
|
+
type TreeObjectNodeUnsafe,
|
|
83
|
+
type TreeFieldFromImplicitFieldUnsafe,
|
|
84
|
+
type TreeNodeFromImplicitAllowedTypesUnsafe,
|
|
85
|
+
type FieldSchemaUnsafe,
|
|
86
|
+
type InsertableTreeNodeFromImplicitAllowedTypesUnsafe,
|
|
87
|
+
type TreeArrayNodeUnsafe,
|
|
88
|
+
type TreeMapNodeUnsafe,
|
|
89
|
+
type InsertableObjectFromSchemaRecordUnsafe,
|
|
90
|
+
type InsertableTreeFieldFromImplicitFieldUnsafe,
|
|
91
|
+
type InsertableTypedNodeUnsafe,
|
|
92
|
+
type NodeBuilderDataUnsafe,
|
|
93
|
+
type NodeFromSchemaUnsafe,
|
|
94
|
+
type ReadonlyMapInlined,
|
|
95
|
+
type TreeNodeSchemaClassUnsafe,
|
|
96
|
+
type TreeNodeSchemaUnsafe,
|
|
97
|
+
type AllowedTypesUnsafe,
|
|
98
|
+
type TreeNodeSchemaNonClassUnsafe,
|
|
99
|
+
type TreeViewAlpha,
|
|
71
100
|
} from "./api/index.js";
|
|
72
101
|
export {
|
|
73
102
|
type NodeFromSchema,
|
|
@@ -89,34 +118,19 @@ export {
|
|
|
89
118
|
normalizeFieldSchema,
|
|
90
119
|
type ApplyKind,
|
|
91
120
|
type FieldSchemaMetadata,
|
|
121
|
+
type InsertableField,
|
|
122
|
+
type Insertable,
|
|
123
|
+
type UnsafeUnknownSchema,
|
|
92
124
|
} from "./schemaTypes.js";
|
|
93
|
-
export { getOrCreateInnerNode } from "./proxyBinding.js";
|
|
94
|
-
export type {
|
|
95
|
-
FieldHasDefaultUnsafe,
|
|
96
|
-
ObjectFromSchemaRecordUnsafe,
|
|
97
|
-
TreeObjectNodeUnsafe,
|
|
98
|
-
TreeFieldFromImplicitFieldUnsafe,
|
|
99
|
-
TreeNodeFromImplicitAllowedTypesUnsafe,
|
|
100
|
-
FieldSchemaUnsafe,
|
|
101
|
-
InsertableTreeNodeFromImplicitAllowedTypesUnsafe,
|
|
102
|
-
TreeArrayNodeUnsafe,
|
|
103
|
-
TreeMapNodeUnsafe,
|
|
104
|
-
InsertableObjectFromSchemaRecordUnsafe,
|
|
105
|
-
InsertableTreeFieldFromImplicitFieldUnsafe,
|
|
106
|
-
InsertableTypedNodeUnsafe,
|
|
107
|
-
NodeBuilderDataUnsafe,
|
|
108
|
-
NodeFromSchemaUnsafe,
|
|
109
|
-
ReadonlyMapInlined,
|
|
110
|
-
} from "./typesUnsafe.js";
|
|
111
125
|
export {
|
|
112
126
|
getTreeNodeForField,
|
|
113
127
|
prepareContentForHydration,
|
|
114
128
|
} from "./proxies.js";
|
|
115
|
-
|
|
116
129
|
export {
|
|
117
130
|
TreeArrayNode,
|
|
118
131
|
IterableTreeArrayContent,
|
|
119
132
|
type TreeArrayNodeBase,
|
|
133
|
+
type ReadonlyArrayNode,
|
|
120
134
|
} from "./arrayNode.js";
|
|
121
135
|
export {
|
|
122
136
|
type FieldHasDefault,
|
|
@@ -126,7 +140,12 @@ export {
|
|
|
126
140
|
setField,
|
|
127
141
|
} from "./objectNode.js";
|
|
128
142
|
export type { TreeMapNode, MapNodeInsertableData } from "./mapNode.js";
|
|
129
|
-
export {
|
|
143
|
+
export {
|
|
144
|
+
mapTreeFromNodeData,
|
|
145
|
+
type InsertableContent,
|
|
146
|
+
type FactoryContent,
|
|
147
|
+
type FactoryContentObject,
|
|
148
|
+
} from "./toMapTree.js";
|
|
130
149
|
export { toStoredSchema, getStoredSchema } from "./toFlexSchema.js";
|
|
131
150
|
export {
|
|
132
151
|
numberSchema,
|
|
@@ -135,3 +154,4 @@ export {
|
|
|
135
154
|
handleSchema,
|
|
136
155
|
nullSchema,
|
|
137
156
|
} from "./leafNodeSchema.js";
|
|
157
|
+
export type { LazyItem, FlexList, FlexListToUnion, ExtractItemType } from "./flexList.js";
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
getSchemaAndPolicy,
|
|
12
12
|
} from "../feature-libraries/index.js";
|
|
13
13
|
import { getTreeNodeForField, prepareContentForHydration } from "./proxies.js";
|
|
14
|
-
import { getOrCreateInnerNode } from "./proxyBinding.js";
|
|
15
14
|
import {
|
|
16
15
|
createFieldSchema,
|
|
17
16
|
FieldKind,
|
|
@@ -33,6 +32,7 @@ import {
|
|
|
33
32
|
typeSchemaSymbol,
|
|
34
33
|
type Context,
|
|
35
34
|
UnhydratedFlexTreeNode,
|
|
35
|
+
getOrCreateInnerNode,
|
|
36
36
|
} from "./core/index.js";
|
|
37
37
|
import {
|
|
38
38
|
mapTreeFromNodeData,
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
getSchemaAndPolicy,
|
|
17
17
|
} from "../feature-libraries/index.js";
|
|
18
18
|
import { getTreeNodeForField, prepareContentForHydration } from "./proxies.js";
|
|
19
|
-
import { getOrCreateInnerNode } from "./proxyBinding.js";
|
|
20
19
|
import {
|
|
21
20
|
type ImplicitFieldSchema,
|
|
22
21
|
getStoredKey,
|
|
@@ -39,6 +38,7 @@ import {
|
|
|
39
38
|
type TreeNode,
|
|
40
39
|
type Context,
|
|
41
40
|
UnhydratedFlexTreeNode,
|
|
41
|
+
getOrCreateInnerNode,
|
|
42
42
|
} from "./core/index.js";
|
|
43
43
|
import { mapTreeFromNodeData, type InsertableContent } from "./toMapTree.js";
|
|
44
44
|
import { type RestrictiveStringRecord, fail, type FlattenKeys } from "../util/index.js";
|
|
@@ -7,21 +7,18 @@ import type { ErasedType, IFluidHandle } from "@fluidframework/core-interfaces";
|
|
|
7
7
|
import { Lazy } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
type LazyItem,
|
|
12
|
-
type NodeKeyManager,
|
|
13
|
-
isLazy,
|
|
14
|
-
type FlexListToUnion,
|
|
15
|
-
} from "../feature-libraries/index.js";
|
|
10
|
+
import type { NodeKeyManager } from "../feature-libraries/index.js";
|
|
16
11
|
import { type MakeNominal, brand, isReadonlyArray } from "../util/index.js";
|
|
17
12
|
import type {
|
|
18
13
|
Unhydrated,
|
|
19
14
|
NodeKind,
|
|
20
15
|
TreeNodeSchema,
|
|
21
16
|
TreeNodeSchemaClass,
|
|
17
|
+
TreeNode,
|
|
22
18
|
} from "./core/index.js";
|
|
23
19
|
import type { FieldKey } from "../core/index.js";
|
|
24
20
|
import type { InsertableContent } from "./toMapTree.js";
|
|
21
|
+
import { isLazy, type FlexListToUnion, type LazyItem } from "./flexList.js";
|
|
25
22
|
|
|
26
23
|
/**
|
|
27
24
|
* Returns true if the given schema is a {@link TreeNodeSchemaClass}, or otherwise false if it is a {@link TreeNodeSchemaNonClass}.
|
|
@@ -29,7 +26,7 @@ import type { InsertableContent } from "./toMapTree.js";
|
|
|
29
26
|
export function isTreeNodeSchemaClass<
|
|
30
27
|
Name extends string,
|
|
31
28
|
Kind extends NodeKind,
|
|
32
|
-
TNode,
|
|
29
|
+
TNode extends TreeNode | TreeLeafValue,
|
|
33
30
|
TBuild,
|
|
34
31
|
ImplicitlyConstructable extends boolean,
|
|
35
32
|
Info,
|
|
@@ -385,7 +382,17 @@ export type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;
|
|
|
385
382
|
export type ImplicitFieldSchema = FieldSchema | ImplicitAllowedTypes;
|
|
386
383
|
|
|
387
384
|
/**
|
|
388
|
-
* Converts ImplicitFieldSchema to
|
|
385
|
+
* Converts an `ImplicitFieldSchema` to a property type suitable for reading a field with this that schema.
|
|
386
|
+
*
|
|
387
|
+
* @typeparam TSchema - When non-exact schema are provided this errors on the side of returning too general of a type (a conservative union of all possibilities).
|
|
388
|
+
* This is ideal for "output APIs" - i.e. it converts the schema type to the runtime type that a user will _read_ from the tree.
|
|
389
|
+
* Examples of such "non-exact" schema include `ImplicitFieldSchema`, `ImplicitAllowedTypes`, and TypeScript unions of schema types.
|
|
390
|
+
* @privateRemarks
|
|
391
|
+
* TODO:
|
|
392
|
+
* There are two known problematic usages of this type (which produce invalid/unsound results when given non-specific schema):
|
|
393
|
+
* 1. setters for fields (on object nodes the Tree.view.root).
|
|
394
|
+
* 2. Indirectly in InsertableTreeFieldFromImplicitField via InsertableTypedNode including NodeFromSchema.
|
|
395
|
+
* These cases should be mitigated by introducing a way to detect inexact schema and special casing them in these two places.
|
|
389
396
|
* @public
|
|
390
397
|
*/
|
|
391
398
|
export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> =
|
|
@@ -393,7 +400,7 @@ export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = Fie
|
|
|
393
400
|
? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind, false>
|
|
394
401
|
: TSchema extends ImplicitAllowedTypes
|
|
395
402
|
? TreeNodeFromImplicitAllowedTypes<TSchema>
|
|
396
|
-
:
|
|
403
|
+
: TreeNode | TreeLeafValue | undefined;
|
|
397
404
|
|
|
398
405
|
/**
|
|
399
406
|
* Type of content that can be inserted into the tree for a field of the given schema.
|
|
@@ -405,7 +412,55 @@ export type InsertableTreeFieldFromImplicitField<
|
|
|
405
412
|
? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypes<Types>, Kind, true>
|
|
406
413
|
: TSchema extends ImplicitAllowedTypes
|
|
407
414
|
? InsertableTreeNodeFromImplicitAllowedTypes<TSchema>
|
|
408
|
-
:
|
|
415
|
+
: never;
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* {@inheritdoc (UnsafeUnknownSchema:type)}
|
|
419
|
+
* @alpha
|
|
420
|
+
*/
|
|
421
|
+
export const UnsafeUnknownSchema: unique symbol = Symbol("UnsafeUnknownSchema");
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* A special type which can be provided to some APIs as the schema type parameter when schema cannot easily be provided at compile time and an unsafe (instead of disabled) editing API is desired.
|
|
425
|
+
* @remarks
|
|
426
|
+
* When used this means the TypeScript typing should error on the side of completeness (allow all inputs that could be valid).
|
|
427
|
+
* This introduces the risk that out of schema data could be allowed at compile time, and only error at runtime.
|
|
428
|
+
*
|
|
429
|
+
* @privateRemarks
|
|
430
|
+
* This only applies to APIs which input data which is expected to be in schema, since APIs outputting have easy mechanisms to do so in a type safe way even when the schema is unknown.
|
|
431
|
+
* In most cases that amounts to returning `TreeNode | TreeLeafValue`.
|
|
432
|
+
*
|
|
433
|
+
* This can be contrasted with the default behavior of TypeScript, which is to require the intersection of the possible types for input APIs,
|
|
434
|
+
* which for unknown schema defining input trees results in the `never` type.
|
|
435
|
+
*
|
|
436
|
+
* Any APIs which use this must produce UsageErrors when out of schema data is encountered, and never produce unrecoverable errors,
|
|
437
|
+
* or silently accept invalid data.
|
|
438
|
+
* This is currently only type exported from the package: the symbol is just used as a way to get a named type.
|
|
439
|
+
* @alpha
|
|
440
|
+
*/
|
|
441
|
+
export type UnsafeUnknownSchema = typeof UnsafeUnknownSchema;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Content which could be inserted into a tree.
|
|
445
|
+
* @remarks
|
|
446
|
+
* Extended version of {@link InsertableTreeNodeFromImplicitAllowedTypes} that also allows {@link (UnsafeUnknownSchema:type)}.
|
|
447
|
+
* @alpha
|
|
448
|
+
*/
|
|
449
|
+
export type Insertable<TSchema extends ImplicitAllowedTypes | UnsafeUnknownSchema> =
|
|
450
|
+
TSchema extends ImplicitAllowedTypes
|
|
451
|
+
? InsertableTreeNodeFromImplicitAllowedTypes<TSchema>
|
|
452
|
+
: InsertableContent;
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Content which could be inserted into a field within a tree.
|
|
456
|
+
* @remarks
|
|
457
|
+
* Extended version of {@link InsertableTreeFieldFromImplicitField} that also allows {@link (UnsafeUnknownSchema:type)}.
|
|
458
|
+
* @alpha
|
|
459
|
+
*/
|
|
460
|
+
export type InsertableField<TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> =
|
|
461
|
+
TSchema extends ImplicitFieldSchema
|
|
462
|
+
? InsertableTreeFieldFromImplicitField<TSchema>
|
|
463
|
+
: InsertableContent | undefined;
|
|
409
464
|
|
|
410
465
|
/**
|
|
411
466
|
* Suitable for output.
|
|
@@ -457,6 +512,10 @@ export type NodeFromSchema<T extends TreeNodeSchema> = T extends TreeNodeSchema<
|
|
|
457
512
|
/**
|
|
458
513
|
* Data which can be used as a node to be inserted.
|
|
459
514
|
* Either an unhydrated node, or content to build a new node.
|
|
515
|
+
* @privateRemarks
|
|
516
|
+
* TODO:
|
|
517
|
+
* This should behave contravariantly, but it uses NodeFromSchema which behaves covariantly.
|
|
518
|
+
* This results in unsoundness where when the schema is less specific, more types are allowed instead of less.
|
|
460
519
|
* @public
|
|
461
520
|
*/
|
|
462
521
|
export type InsertableTypedNode<T extends TreeNodeSchema> =
|
|
@@ -475,7 +534,7 @@ export type InsertableTypedNode<T extends TreeNodeSchema> =
|
|
|
475
534
|
export type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<
|
|
476
535
|
string,
|
|
477
536
|
NodeKind,
|
|
478
|
-
|
|
537
|
+
TreeNode | TreeLeafValue,
|
|
479
538
|
infer TBuild
|
|
480
539
|
>
|
|
481
540
|
? TBuild
|
|
@@ -20,9 +20,6 @@ import {
|
|
|
20
20
|
type TreeTypeSet,
|
|
21
21
|
} from "../core/index.js";
|
|
22
22
|
import { FieldKinds, type FlexFieldKind } from "../feature-libraries/index.js";
|
|
23
|
-
// TODO: once flex schema is gone, this code can move into simple-tree
|
|
24
|
-
// eslint-disable-next-line import/no-internal-modules
|
|
25
|
-
import { normalizeFlexListEager } from "../feature-libraries/typed-schema/index.js";
|
|
26
23
|
import { brand, fail, isReadonlyArray } from "../util/index.js";
|
|
27
24
|
import { NodeKind, type TreeNodeSchema } from "./core/index.js";
|
|
28
25
|
import {
|
|
@@ -34,6 +31,7 @@ import {
|
|
|
34
31
|
import { walkFieldSchema } from "./walkFieldSchema.js";
|
|
35
32
|
import { LeafNodeSchema } from "./leafNodeSchema.js";
|
|
36
33
|
import { isObjectNodeSchema } from "./objectNodeTypes.js";
|
|
34
|
+
import { normalizeFlexListEager } from "./flexList.js";
|
|
37
35
|
|
|
38
36
|
/**
|
|
39
37
|
* Converts a {@link ImplicitFieldSchema} into a {@link TreeStoredSchema}.
|
|
@@ -262,14 +262,14 @@ function mapValueWithFallbacks(
|
|
|
262
262
|
// Our serialized data format does not support -0.
|
|
263
263
|
// Map such input to +0.
|
|
264
264
|
return 0;
|
|
265
|
-
} else if (
|
|
265
|
+
} else if (!Number.isFinite(value)) {
|
|
266
266
|
// Our serialized data format does not support NaN nor +/-∞.
|
|
267
267
|
// If the schema supports `null`, fall back to that. Otherwise, throw.
|
|
268
268
|
// This is intended to match JSON's behavior for such values.
|
|
269
269
|
if (allowedTypes.has(nullSchema)) {
|
|
270
270
|
return null;
|
|
271
271
|
} else {
|
|
272
|
-
throw new
|
|
272
|
+
throw new UsageError(`Received unsupported numeric value: ${value}.`);
|
|
273
273
|
}
|
|
274
274
|
} else {
|
|
275
275
|
return value;
|
|
@@ -287,7 +287,7 @@ function mapValueWithFallbacks(
|
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
default:
|
|
290
|
-
throw new
|
|
290
|
+
throw new UsageError(`Received unsupported leaf value: ${value}.`);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
|
|
@@ -726,6 +726,7 @@ function tryGetInnerNode(target: unknown): InnerNode | undefined {
|
|
|
726
726
|
* Content which can be used to build a node.
|
|
727
727
|
* @remarks
|
|
728
728
|
* Can contain unhydrated nodes, but can not be an unhydrated node at the root.
|
|
729
|
+
* @system @alpha
|
|
729
730
|
*/
|
|
730
731
|
export type FactoryContent =
|
|
731
732
|
| IFluidHandle
|
|
@@ -744,12 +745,14 @@ export type FactoryContent =
|
|
|
744
745
|
* Can contain unhydrated nodes, but can not be an unhydrated node at the root.
|
|
745
746
|
*
|
|
746
747
|
* Supports object and map nodes.
|
|
748
|
+
* @system @alpha
|
|
747
749
|
*/
|
|
748
|
-
type FactoryContentObject = {
|
|
750
|
+
export type FactoryContentObject = {
|
|
749
751
|
readonly [P in string]?: InsertableContent;
|
|
750
752
|
};
|
|
751
753
|
|
|
752
754
|
/**
|
|
753
755
|
* Content which can be inserted into a tree.
|
|
756
|
+
* @system @alpha
|
|
754
757
|
*/
|
|
755
758
|
export type InsertableContent = Unhydrated<TreeNode> | FactoryContent;
|
|
@@ -18,11 +18,12 @@ import {
|
|
|
18
18
|
type Context,
|
|
19
19
|
type UnhydratedFlexTreeNode,
|
|
20
20
|
} from "./core/index.js";
|
|
21
|
-
import { type FlexTreeNode, isFlexTreeNode
|
|
21
|
+
import { type FlexTreeNode, isFlexTreeNode } from "../feature-libraries/index.js";
|
|
22
22
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
23
23
|
import { fail } from "../util/index.js";
|
|
24
24
|
|
|
25
25
|
import { getSimpleNodeSchemaFromInnerNode } from "./core/index.js";
|
|
26
|
+
import { markEager } from "./flexList.js";
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* Class which all {@link TreeNode}s must extend.
|
package/src/treeFactory.ts
CHANGED
|
@@ -81,6 +81,7 @@ export const SharedTree = configuredSharedTree({});
|
|
|
81
81
|
* });
|
|
82
82
|
* ```
|
|
83
83
|
* @privateRemarks
|
|
84
|
+
* This should be legacy, but has to be internal due to limitations of API tagging preventing it from being both alpha and alpha+legacy.
|
|
84
85
|
* TODO:
|
|
85
86
|
* Expose Ajv validator for better error message quality somehow.
|
|
86
87
|
* Maybe as part of a test utils or dev-tool package?
|
package/src/util/utils.ts
CHANGED
|
@@ -219,9 +219,10 @@ export function count(iterable: Iterable<unknown>): number {
|
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
221
|
* Use for Json compatible data.
|
|
222
|
-
*
|
|
223
|
-
*
|
|
222
|
+
* @remarks
|
|
223
|
+
* This does not robustly forbid non json comparable data via type checking,
|
|
224
224
|
* but instead mostly restricts access to it.
|
|
225
|
+
* @alpha
|
|
225
226
|
*/
|
|
226
227
|
export type JsonCompatible =
|
|
227
228
|
| string
|
|
@@ -234,16 +235,17 @@ export type JsonCompatible =
|
|
|
234
235
|
|
|
235
236
|
/**
|
|
236
237
|
* Use for Json object compatible data.
|
|
237
|
-
*
|
|
238
|
-
*
|
|
238
|
+
* @remarks
|
|
239
|
+
* This does not robustly forbid non json comparable data via type checking,
|
|
239
240
|
* but instead mostly restricts access to it.
|
|
241
|
+
* @alpha
|
|
240
242
|
*/
|
|
241
243
|
export type JsonCompatibleObject = { [P in string]?: JsonCompatible };
|
|
242
244
|
|
|
243
245
|
/**
|
|
244
246
|
* Use for readonly view of Json compatible data.
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
+
* @remarks
|
|
248
|
+
* This does not robustly forbid non json comparable data via type checking,
|
|
247
249
|
* but instead mostly restricts access to it.
|
|
248
250
|
*/
|
|
249
251
|
export type JsonCompatibleReadOnly =
|
|
@@ -257,8 +259,8 @@ export type JsonCompatibleReadOnly =
|
|
|
257
259
|
|
|
258
260
|
/**
|
|
259
261
|
* Use for readonly view of Json compatible data.
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
+
* @remarks
|
|
263
|
+
* This does not robustly forbid non json comparable data via type checking,
|
|
262
264
|
* but instead mostly restricts access to it.
|
|
263
265
|
*/
|
|
264
266
|
export type JsonCompatibleReadOnlyObject = { readonly [P in string]?: JsonCompatibleReadOnly };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { ITreeSubscriptionCursor } from "../../core/index.js";
|
|
6
|
-
import type { Context } from "./context.js";
|
|
7
|
-
import type { FlexTreeUnknownUnboxed } from "./flexTreeTypes.js";
|
|
8
|
-
/**
|
|
9
|
-
* Returns the flex tree node, of the value if it has one.
|
|
10
|
-
*/
|
|
11
|
-
export declare function unboxedFlexNode(context: Context, cursor: ITreeSubscriptionCursor): FlexTreeUnknownUnboxed;
|
|
12
|
-
//# sourceMappingURL=unboxed.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unboxed.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGjE;;GAEG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,uBAAuB,GAC7B,sBAAsB,CAMxB"}
|
|
@@ -1,20 +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.unboxedFlexNode = void 0;
|
|
8
|
-
const lazyNode_js_1 = require("./lazyNode.js");
|
|
9
|
-
/**
|
|
10
|
-
* Returns the flex tree node, of the value if it has one.
|
|
11
|
-
*/
|
|
12
|
-
function unboxedFlexNode(context, cursor) {
|
|
13
|
-
const value = cursor.value;
|
|
14
|
-
if (value !== undefined) {
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
return (0, lazyNode_js_1.makeTree)(context, cursor);
|
|
18
|
-
}
|
|
19
|
-
exports.unboxedFlexNode = unboxedFlexNode;
|
|
20
|
-
//# sourceMappingURL=unboxed.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unboxed.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,+CAAyC;AAEzC;;GAEG;AACH,SAAgB,eAAe,CAC9B,OAAgB,EAChB,MAA+B;IAE/B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,IAAA,sBAAQ,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAClC,CAAC;AATD,0CASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITreeSubscriptionCursor } from \"../../core/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport type { FlexTreeUnknownUnboxed } from \"./flexTreeTypes.js\";\nimport { makeTree } from \"./lazyNode.js\";\n\n/**\n * Returns the flex tree node, of the value if it has one.\n */\nexport function unboxedFlexNode(\n\tcontext: Context,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeUnknownUnboxed {\n\tconst value = cursor.value;\n\tif (value !== undefined) {\n\t\treturn value;\n\t}\n\treturn makeTree(context, cursor);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flexList.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/flexList.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,gFAAgF;AAChF,wBAAgB,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,MAAM,IAAI,CAErE;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CASpC;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,CAAC,IAAI,GAAG,OAAO,IAAI,SAAS,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;AAEjE;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAQ7D;AAED;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,CAAC,IAAI,GAAG,OAAO,IAAI,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,IAAI,SAAS,QAAQ,IAAI,IAAI,SAAS,MAAM,MAAM,MAAM,GACjF,MAAM,GACN,IAAI,CAAC;AAER;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,QAAQ,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flexList.js","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/flexList.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iDAAiD;AACjD,MAAM,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAU/C,gFAAgF;AAChF,SAAgB,MAAM,CAAO,IAAoB;IAChD,OAAO,OAAO,IAAI,KAAK,UAAU,IAAK,IAA6B,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;AAC7F,CAAC;AAFD,wBAEC;AAED;;;;;;GAMG;AACH,SAAgB,SAAS,CAAI,CAAI;IAChC,OAAO,MAAM,CAAC,CAAC,CAAC;QACf,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,aAAa,EAAE;YACxC,KAAK,EAAE,IAAI;YACX,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;SACf,CAAC;QACH,CAAC,CAAC,CAAC,CAAC;AACN,CAAC;AATD,8BASC;AAcD;;GAEG;AACH,SAAgB,sBAAsB,CAAI,CAAc;IACvD,MAAM,IAAI,GAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAkB,EAAE,EAAE;QAC9C,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACnB,OAAO,KAAK,EAAE,CAAC;QAChB,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACb,CAAC;AARD,wDAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/** A symbol used to identify a `MarkedEager`. */\nconst flexListEager = Symbol(\"FlexList Eager\");\n\n/**\n * An object that has been marked as eager (as opposed to lazy) when used as an item in a `FlexList`.\n * It will be considered to be an eager item in a `FlexList` even if it is a function.\n */\ninterface MarkedEager {\n\t[flexListEager]: true;\n}\n\n/** Returns true iff the given item is a function and is not a `MarkedEager`. */\nexport function isLazy<Item>(item: LazyItem<Item>): item is () => Item {\n\treturn typeof item === \"function\" && (item as Partial<MarkedEager>)[flexListEager] !== true;\n}\n\n/**\n * Mark the given object as an eager item in a `FlexList`.\n * @remarks\n * This only has an effect on function objects that would otherwise be considered to be lazy items in a `FlexList`.\n * @param t - The object to mark as eager.\n * @returns `t`, marked as eager if applicable.\n */\nexport function markEager<T>(t: T): T {\n\treturn isLazy(t)\n\t\t? Object.defineProperty(t, flexListEager, {\n\t\t\t\tvalue: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\twritable: false,\n\t\t\t})\n\t\t: t;\n}\n\n/**\n * A flexible way to list values.\n * Each item in the list can either be an \"eager\" **value** or a \"lazy\" **function that returns a value** (the latter allows cyclic references to work).\n * @privateRemarks\n * By default, items that are of type `\"function\"` will be considered lazy and all other items will be considered eager.\n * To force a `\"function\"` item to be treated as an eager item, call `markEager` before putting it in the list.\n * This is necessary e.g. when the eager list items are function types and the lazy items are functions that _return_ function types.\n * `FlexList`s are processed by `normalizeFlexList` and `normalizeFlexListEager`.\n * @system @public\n */\nexport type FlexList<Item = unknown> = readonly LazyItem<Item>[];\n\n/**\n * Given a `FlexList` of eager and lazy items, return an equivalent list where all items are eager.\n */\nexport function normalizeFlexListEager<T>(t: FlexList<T>): T[] {\n\tconst data: T[] = t.map((value: LazyItem<T>) => {\n\t\tif (isLazy(value)) {\n\t\t\treturn value();\n\t\t}\n\t\treturn value;\n\t});\n\treturn data;\n}\n\n/**\n * An \"eager\" or \"lazy\" Item in a `FlexList`.\n * Lazy items are wrapped in a function to allow referring to themselves before they are declared.\n * This makes recursive and co-recursive items possible.\n * @public\n */\nexport type LazyItem<Item = unknown> = Item | (() => Item);\n\n/**\n * Get the `Item` type from a `LazyItem<Item>`.\n * @system @public\n */\nexport type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result\n\t? Result\n\t: Item;\n\n/**\n * Normalize FlexList type to a union.\n * @system @public\n */\nexport type FlexListToUnion<TList extends FlexList> = ExtractItemType<TList[number]>;\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
export { type Unenforced } from "./typedTreeSchema.js";
|
|
6
|
-
export { type FlexList, markEager, type LazyItem, isLazy, type FlexListToUnion, type ExtractItemType, normalizeFlexListEager, } from "./flexList.js";
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EACN,KAAK,QAAQ,EACb,SAAS,EACT,KAAK,QAAQ,EACb,MAAM,EACN,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,sBAAsB,GACtB,MAAM,eAAe,CAAC"}
|
|
@@ -1,12 +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.normalizeFlexListEager = exports.isLazy = exports.markEager = void 0;
|
|
8
|
-
var flexList_js_1 = require("./flexList.js");
|
|
9
|
-
Object.defineProperty(exports, "markEager", { enumerable: true, get: function () { return flexList_js_1.markEager; } });
|
|
10
|
-
Object.defineProperty(exports, "isLazy", { enumerable: true, get: function () { return flexList_js_1.isLazy; } });
|
|
11
|
-
Object.defineProperty(exports, "normalizeFlexListEager", { enumerable: true, get: function () { return flexList_js_1.normalizeFlexListEager; } });
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,6CAQuB;AANtB,wGAAA,SAAS,OAAA;AAET,qGAAA,MAAM,OAAA;AAGN,qHAAA,sBAAsB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { type Unenforced } from \"./typedTreeSchema.js\";\n\nexport {\n\ttype FlexList,\n\tmarkEager,\n\ttype LazyItem,\n\tisLazy,\n\ttype FlexListToUnion,\n\ttype ExtractItemType,\n\tnormalizeFlexListEager,\n} from \"./flexList.js\";\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* A placeholder to use in {@link https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-constraints | extends constraints} when using the real type breaks compilation of some recursive types due to {@link https://github.com/microsoft/TypeScript/issues/55758 | a design limitation of TypeScript}.
|
|
7
|
-
*
|
|
8
|
-
* These extends constraints only serve as documentation:
|
|
9
|
-
* to avoid breaking compilation, this type has to not actually enforce anything, and thus is just `unknown`.
|
|
10
|
-
* Therefore the type safety is the responsibility of the user of the API.
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
export type Unenforced<_DesiredExtendsConstraint> = unknown;
|
|
14
|
-
//# sourceMappingURL=typedTreeSchema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typedTreeSchema.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/typedTreeSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,CAAC,yBAAyB,IAAI,OAAO,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typedTreeSchema.js","sourceRoot":"","sources":["../../../src/feature-libraries/typed-schema/typedTreeSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A placeholder to use in {@link https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-constraints | extends constraints} when using the real type breaks compilation of some recursive types due to {@link https://github.com/microsoft/TypeScript/issues/55758 | a design limitation of TypeScript}.\n *\n * These extends constraints only serve as documentation:\n * to avoid breaking compilation, this type has to not actually enforce anything, and thus is just `unknown`.\n * Therefore the type safety is the responsibility of the user of the API.\n * @public\n */\nexport type Unenforced<_DesiredExtendsConstraint> = unknown;\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { InnerNode, TreeNode } from "./core/index.js";
|
|
6
|
-
/**
|
|
7
|
-
* Retrieves the flex node associated with the given target via {@link setInnerNode}.
|
|
8
|
-
* @remarks
|
|
9
|
-
* For {@link Unhydrated} nodes, this returns the MapTreeNode.
|
|
10
|
-
*
|
|
11
|
-
* For hydrated nodes it returns a FlexTreeNode backed by the forest.
|
|
12
|
-
* Note that for "marinated" nodes, this FlexTreeNode exists and returns it: it does not return the MapTreeNode which is the current InnerNode.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getOrCreateInnerNode(treeNode: TreeNode, allowFreed?: boolean): InnerNode;
|
|
15
|
-
//# sourceMappingURL=proxyBinding.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proxyBinding.d.ts","sourceRoot":"","sources":["../../src/simple-tree/proxyBinding.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3D;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,UAAQ,GAAG,SAAS,CAGtF"}
|
|
@@ -1,22 +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.getOrCreateInnerNode = void 0;
|
|
8
|
-
const index_js_1 = require("./core/index.js");
|
|
9
|
-
/**
|
|
10
|
-
* Retrieves the flex node associated with the given target via {@link setInnerNode}.
|
|
11
|
-
* @remarks
|
|
12
|
-
* For {@link Unhydrated} nodes, this returns the MapTreeNode.
|
|
13
|
-
*
|
|
14
|
-
* For hydrated nodes it returns a FlexTreeNode backed by the forest.
|
|
15
|
-
* Note that for "marinated" nodes, this FlexTreeNode exists and returns it: it does not return the MapTreeNode which is the current InnerNode.
|
|
16
|
-
*/
|
|
17
|
-
function getOrCreateInnerNode(treeNode, allowFreed = false) {
|
|
18
|
-
const kernel = (0, index_js_1.getKernel)(treeNode);
|
|
19
|
-
return kernel.getOrCreateInnerNode(allowFreed);
|
|
20
|
-
}
|
|
21
|
-
exports.getOrCreateInnerNode = getOrCreateInnerNode;
|
|
22
|
-
//# sourceMappingURL=proxyBinding.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proxyBinding.js","sourceRoot":"","sources":["../../src/simple-tree/proxyBinding.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,8CAA4C;AAE5C;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAAC,QAAkB,EAAE,UAAU,GAAG,KAAK;IAC1E,MAAM,MAAM,GAAG,IAAA,oBAAS,EAAC,QAAQ,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAChD,CAAC;AAHD,oDAGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { InnerNode, TreeNode } from \"./core/index.js\";\nimport { getKernel } from \"./core/index.js\";\n\n/**\n * Retrieves the flex node associated with the given target via {@link setInnerNode}.\n * @remarks\n * For {@link Unhydrated} nodes, this returns the MapTreeNode.\n *\n * For hydrated nodes it returns a FlexTreeNode backed by the forest.\n * Note that for \"marinated\" nodes, this FlexTreeNode exists and returns it: it does not return the MapTreeNode which is the current InnerNode.\n */\nexport function getOrCreateInnerNode(treeNode: TreeNode, allowFreed = false): InnerNode {\n\tconst kernel = getKernel(treeNode);\n\treturn kernel.getOrCreateInnerNode(allowFreed);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typesUnsafe.d.ts","sourceRoot":"","sources":["../../src/simple-tree/typesUnsafe.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,KAAK,EACX,YAAY,EACZ,SAAS,EACT,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,gCAAgC,EAChC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACX,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAcvE;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,CACvC,CAAC,SAAS,UAAU,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,CAAC,IAC/D;IACH,CAAC,UAAU,QAAQ,IAAI,MAAM,CAAC,GAAG,gCAAgC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CAC9E,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,CAC/B,CAAC,SAAS,UAAU,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,CAAC,EAClE,QAAQ,SAAS,MAAM,GAAG,MAAM,IAC7B,QAAQ,GAAG,4BAA4B,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;AAErF;;;;;GAKG;AACH,MAAM,MAAM,gCAAgC,CAAC,OAAO,SAAS,UAAU,CAAC,mBAAmB,CAAC,IAC3F,OAAO,SAAS,iBAAiB,CAAC,MAAM,IAAI,EAAE,MAAM,KAAK,CAAC,GACvD,SAAS,CAAC,sCAAsC,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,GACrE,OAAO,SAAS,oBAAoB,GACnC,sCAAsC,CAAC,OAAO,CAAC,GAC/C,OAAO,CAAC;AAEb;;;;;GAKG;AACH,MAAM,MAAM,sCAAsC,CACjD,OAAO,SAAS,UAAU,CAAC,oBAAoB,CAAC,IAC7C,OAAO,SAAS,oBAAoB,GACrC,gCAAgC,CAAC,OAAO,CAAC,GACzC,OAAO,SAAS,cAAc,GAC7B,cAAc,CAAC,OAAO,CAAC,GACvB,OAAO,SAAS,YAAY,GAC3B,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GACxC,OAAO,CAAC;AAEb;;;;;GAKG;AACH,MAAM,MAAM,gDAAgD,CAC3D,OAAO,SAAS,UAAU,CAAC,oBAAoB,CAAC,IAC7C,OAAO,SAAS,YAAY,GAC7B,yBAAyB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GACnD,yBAAyB,CAAC,OAAO,CAAC,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,UAAU,CAAC,cAAc,CAAC,IAAI;IAC3E,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,GACnC,CAAC,CAAC,SAAS;QAAE,uBAAuB,EAAE,IAAI,CAAA;KAAE,GAAG,qBAAqB,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;CAClF,CAAC,YAAY,CAAC,CAAC;AAEhB;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,UAAU,CAAC,cAAc,CAAC,IACpE,CAAC,SAAS,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC,GAAG,KAAK,GAAG,KAAK,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,UAAU,CAAC,cAAc,CAAC,IACrE,CAAC,SAAS,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC;AAEpF;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB,CAAC,aAAa,SAAS,UAAU,CAAC,oBAAoB,CAAC,CAC1F,SAAQ,iBAAiB,CACxB,sCAAsC,CAAC,aAAa,CAAC,EACrD,gDAAgD,CAAC,aAAa,CAAC,EAC/D,aAAa,CACb;CAAG;AAEL;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,UAAU,CAAC,oBAAoB,CAAC,CAC5E,SAAQ,kBAAkB,CAAC,MAAM,EAAE,CAAC,CAAC,EACpC,QAAQ;IACT;;OAEG;IACH,GAAG,CACF,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,gDAAgD,CAAC,CAAC,CAAC,GAAG,SAAS,GACpE,IAAI,CAAC;IAER;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,oBAAoB,CAAC;IAChF,iDAAiD;IACjD,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,EAAE,sCAAsC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtF;;OAEG;IACH,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,EAAE,sCAAsC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE5E;;OAEG;IACH,IAAI,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAE5B;;OAEG;IACH,MAAM,IAAI,gBAAgB,CAAC,sCAAsC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtE,OAAO,CACN,UAAU,EAAE,CACX,KAAK,EAAE,sCAAsC,CAAC,CAAC,CAAC,EAChD,GAAG,EAAE,CAAC,EACN,GAAG,EAAE,WAAW,CAAC,CAAC,EAAE,sCAAsC,CAAC,CAAC,CAAC,CAAC,KAC1D,IAAI,EACT,OAAO,CAAC,EAAE,GAAG,GACX,IAAI,CAAC;IACR,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,sCAAsC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACnE,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,UAAU,CAAC,mBAAmB,CAAC,IAC1E,CAAC,SAAS,iBAAiB,CAC1B,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,UAAU,EACzC,UAAU,CAAC,oBAAoB,CAAC,CAChC,GACE,IAAI,GACJ,KAAK,CAAC;AAEV;;;;;GAKG;AACH,MAAM,MAAM,sCAAsC,CACjD,CAAC,SAAS,UAAU,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,CAAC,IAC/D;IAEH,QAAQ,EAAE,QAAQ,IAAI,MAAM,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,KAAK,GAC9E,QAAQ,GACR,KAAK,GAAG,0CAA0C,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CAClE,GAAG;IAGH,QAAQ,EAAE,QAAQ,IAAI,MAAM,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,SAAS,IAAI,GAC7E,QAAQ,GACR,KAAK,CAAC,CAAC,EAAE,0CAA0C,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CACnE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,0CAA0C,CACrD,OAAO,SAAS,UAAU,CAAC,mBAAmB,CAAC,IAC5C,OAAO,SAAS,iBAAiB,CAAC,MAAM,IAAI,EAAE,MAAM,KAAK,CAAC,GAC3D,SAAS,CAAC,gDAAgD,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAC9E,gDAAgD,CAAC,OAAO,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB,CACjC,GAAG,CAAC,IAAI,SAAS,SAAS,EAC1B,GAAG,CAAC,KAAK,SAAS,UAAU,CAAC,oBAAoB,CAAC,CACjD,SAAQ,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;CACrD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typesUnsafe.js","sourceRoot":"","sources":["../../src/simple-tree/typesUnsafe.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAuRH,sDAAsD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FlexListToUnion, Unenforced } from \"../feature-libraries/index.js\";\nimport type { RestrictiveStringRecord, _InlineTrick } from \"../util/index.js\";\n\nimport type {\n\tAllowedTypes,\n\tApplyKind,\n\tFieldKind,\n\tFieldSchema,\n\tImplicitAllowedTypes,\n\tImplicitFieldSchema,\n\tNodeFromSchema,\n\tTreeNodeFromImplicitAllowedTypes,\n} from \"./schemaTypes.js\";\nimport type {\n\tNodeKind,\n\tTreeNodeSchema,\n\tWithType,\n\tTreeNode,\n\tUnhydrated,\n} from \"./core/index.js\";\nimport type { TreeArrayNodeBase, TreeArrayNode } from \"./arrayNode.js\";\n\n/*\n * TODO:\n * Below are a bunch of \"unsafe\" versions of types from \"schemaTypes.ts\".\n * These types duplicate the ones in \"schemaTypes.ts\", except with some of the extends clauses unenforced.\n * This is not great for type safety or maintainability.\n * Eventually it would be great to do at least one of the following:\n * 1. Find a way to avoid needing these entirely, possibly by improving TSC's recursive type support.\n * 2. Deduplicate the safe and unsafe types (possibly by having the safe one call the unsafe ones, or some other trick).\n * 3. Add type tests that check that the two copies of these types produce identical results.\n */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * {@link Unenforced} version of `ObjectFromSchemaRecord`.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type ObjectFromSchemaRecordUnsafe<\n\tT extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>,\n> = {\n\t-readonly [Property in keyof T]: TreeFieldFromImplicitFieldUnsafe<T[Property]>;\n};\n\n/**\n * {@link Unenforced} version of {@link TreeObjectNode}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type TreeObjectNodeUnsafe<\n\tT extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>,\n\tTypeName extends string = string,\n> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object>;\n\n/**\n * {@link Unenforced} version of {@link TreeFieldFromImplicitField}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> =\n\tTSchema extends FieldSchemaUnsafe<infer Kind, infer Types>\n\t\t? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, false>\n\t\t: TSchema extends ImplicitAllowedTypes\n\t\t\t? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema>\n\t\t\t: unknown;\n\n/**\n * {@link Unenforced} version of {@link TreeNodeFromImplicitAllowedTypes}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type TreeNodeFromImplicitAllowedTypesUnsafe<\n\tTSchema extends Unenforced<ImplicitAllowedTypes>,\n> = TSchema extends ImplicitAllowedTypes\n\t? TreeNodeFromImplicitAllowedTypes<TSchema>\n\t: TSchema extends TreeNodeSchema\n\t\t? NodeFromSchema<TSchema>\n\t\t: TSchema extends AllowedTypes\n\t\t\t? NodeFromSchema<FlexListToUnion<TSchema>>\n\t\t\t: unknown;\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<\n\tTSchema extends Unenforced<ImplicitAllowedTypes>,\n> = TSchema extends AllowedTypes\n\t? InsertableTypedNodeUnsafe<FlexListToUnion<TSchema>>\n\t: InsertableTypedNodeUnsafe<TSchema>;\n\n/**\n * {@link Unenforced} version of {@link InsertableTypedNode}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type InsertableTypedNodeUnsafe<T extends Unenforced<TreeNodeSchema>> = [\n\t| Unhydrated<NodeFromSchemaUnsafe<T>>\n\t| (T extends { implicitlyConstructable: true } ? NodeBuilderDataUnsafe<T> : never),\n][_InlineTrick];\n\n/**\n * {@link Unenforced} version of {@link NodeFromSchema}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> =\n\tT extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeNodeFromImplicitAllowedTypes}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> =\n\tT extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;\n\n/**\n * {@link Unenforced} version of {@link (TreeArrayNode:interface)}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @sealed @public\n */\nexport interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>>\n\textends TreeArrayNodeBase<\n\t\tTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>,\n\t\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>,\n\t\tTreeArrayNode\n\t> {}\n\n/**\n * {@link Unenforced} version of {@link TreeMapNode}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @sealed @public\n */\nexport interface TreeMapNodeUnsafe<T extends Unenforced<ImplicitAllowedTypes>>\n\textends ReadonlyMapInlined<string, T>,\n\t\tTreeNode {\n\t/**\n\t * {@inheritdoc TreeMapNode.set}\n\t */\n\tset(\n\t\tkey: string,\n\t\tvalue: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T> | undefined,\n\t): void;\n\n\t/**\n\t * {@inheritdoc TreeMapNode.delete}\n\t */\n\tdelete(key: string): void;\n}\n\n/**\n * Copy of TypeScript's ReadonlyMap, but with `TreeNodeFromImplicitAllowedTypesUnsafe<T>` inlined into it.\n * Using this instead of ReadonlyMap in TreeMapNodeUnsafe is necessary to make recursive map schema not generate compile errors in the d.ts files when exported.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @privateRemarks\n * This is the same as `ReadonlyMap<K, TreeNodeFromImplicitAllowedTypesUnsafe<T>>` (Checked in test),\n * except that it avoids the above mentioned compile error.\n * Authored by manually inlining ReadonlyMap from from the TypeScript lib which can be found by navigating to the definition of `ReadonlyMap`.\n * @system @sealed @public\n */\nexport interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes>> {\n\t/** Returns an iterable of entries in the map. */\n\t[Symbol.iterator](): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t */\n\tentries(): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;\n\n\t/**\n\t * Returns an iterable of keys in the map\n\t */\n\tkeys(): IterableIterator<K>;\n\n\t/**\n\t * Returns an iterable of values in the map\n\t */\n\tvalues(): IterableIterator<TreeNodeFromImplicitAllowedTypesUnsafe<T>>;\n\n\tforEach(\n\t\tcallbackfn: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypesUnsafe<T>,\n\t\t\tkey: K,\n\t\t\tmap: ReadonlyMap<K, TreeNodeFromImplicitAllowedTypesUnsafe<T>>,\n\t\t) => void,\n\t\tthisArg?: any,\n\t): void;\n\tget(key: K): TreeNodeFromImplicitAllowedTypesUnsafe<T> | undefined;\n\thas(key: K): boolean;\n\treadonly size: number;\n}\n\n/**\n * {@link Unenforced} version of `FieldHasDefault`.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @sealed @public\n */\nexport type FieldHasDefaultUnsafe<T extends Unenforced<ImplicitFieldSchema>> =\n\tT extends FieldSchemaUnsafe<\n\t\tFieldKind.Optional | FieldKind.Identifier,\n\t\tUnenforced<ImplicitAllowedTypes>\n\t>\n\t\t? true\n\t\t: false;\n\n/**\n * {@link Unenforced} version of `InsertableObjectFromSchemaRecord`.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type InsertableObjectFromSchemaRecordUnsafe<\n\tT extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>,\n> = {\n\t// Field might not have a default, so make it required:\n\treadonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false\n\t\t? Property\n\t\t: never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;\n} & {\n\t// Field might have a default, so allow optional.\n\t// Note that if the field could be either, this returns boolean, causing both fields to exist, resulting in required.\n\treadonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends true\n\t\t? Property\n\t\t: never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;\n};\n\n/**\n * {@link Unenforced} version of {@link InsertableTreeFieldFromImplicitField}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @system @public\n */\nexport type InsertableTreeFieldFromImplicitFieldUnsafe<\n\tTSchema extends Unenforced<ImplicitFieldSchema>,\n> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types>\n\t? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true>\n\t: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>;\n\n/**\n * {@link Unenforced} version of {@link FieldSchema}.\n * @remarks\n * Do note use this type directly: its only needed in the implementation of generic logic which define recursive schema, not when using recursive schema.\n * @public\n */\nexport interface FieldSchemaUnsafe<\n\tout Kind extends FieldKind,\n\tout Types extends Unenforced<ImplicitAllowedTypes>,\n> extends FieldSchema<Kind, any> {\n\t/**\n\t * {@inheritDoc FieldSchema.kind}\n\t */\n\treadonly kind: Kind;\n\t/**\n\t * {@inheritDoc FieldSchema.allowedTypes}\n\t */\n\treadonly allowedTypes: Types;\n\t/**\n\t * {@inheritDoc FieldSchema.allowedTypeSet}\n\t */\n\treadonly allowedTypeSet: ReadonlySet<TreeNodeSchema>;\n}\n\n/* eslint-enable @typescript-eslint/no-explicit-any */\n"]}
|