@fluidframework/tree 2.21.0 → 2.23.0-323641
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +1 -0
- package/api-report/tree.alpha.api.md +29 -4
- package/api-report/tree.beta.api.md +29 -4
- package/api-report/tree.legacy.alpha.api.md +29 -4
- package/api-report/tree.legacy.public.api.md +29 -4
- package/api-report/tree.public.api.md +29 -4
- package/dist/alpha.d.ts +1 -0
- package/dist/beta.d.ts +1 -0
- package/dist/core/forest/editableForest.js +1 -1
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +2 -5
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +16 -162
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -2
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/pathTree.d.ts +0 -11
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
- package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
- package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/dist/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
- package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +0 -9
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -19
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +16 -18
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
- package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +7 -3
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
- package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -11
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -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 +1 -0
- package/dist/shared-tree/index.d.ts +1 -3
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +1 -7
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +4 -5
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +9 -10
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +40 -39
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +84 -52
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeApi.d.ts +2 -2
- package/dist/shared-tree/treeApi.d.ts.map +1 -1
- package/dist/shared-tree/treeApi.js +9 -3
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +3 -3
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +3 -2
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +11 -2
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +64 -29
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.d.ts +1 -2
- package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +0 -9
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/resubmitMachine.d.ts +2 -0
- package/dist/shared-tree-core/resubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/resubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.d.ts +12 -1
- package/dist/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/dist/shared-tree-core/sequenceIdUtils.js +25 -7
- package/dist/shared-tree-core/sequenceIdUtils.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +33 -30
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +62 -56
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +3 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +156 -63
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +179 -86
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -0
- package/dist/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +23 -2
- 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/index.d.ts +1 -1
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +3 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +2 -2
- package/dist/simple-tree/schemaTypes.js +1 -1
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +1 -2
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/treeFactory.d.ts +16 -5
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +21 -12
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/breakable.d.ts +1 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +3 -2
- package/dist/util/index.js.map +1 -1
- package/dist/util/rangeMap.d.ts +1 -1
- package/dist/util/rangeMap.js +1 -1
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/utils.d.ts +16 -0
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +29 -1
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +1 -0
- package/lib/beta.d.ts +1 -0
- package/lib/core/forest/editableForest.js +1 -1
- package/lib/core/forest/editableForest.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +2 -5
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +17 -163
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -2
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/pathTree.d.ts +0 -11
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +1 -2
- package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js +0 -9
- package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
- package/lib/feature-libraries/flex-tree/treeEvents.d.ts +2 -4
- package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +1 -2
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +0 -9
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +6 -2
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -4
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +4 -19
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +17 -19
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
- package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +7 -3
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +3 -5
- package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -11
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js +13 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldEditor.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -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 +1 -0
- package/lib/shared-tree/index.d.ts +1 -3
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -3
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +4 -5
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +4 -5
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +40 -39
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +82 -50
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeApi.d.ts +2 -2
- package/lib/shared-tree/treeApi.d.ts.map +1 -1
- package/lib/shared-tree/treeApi.js +8 -2
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +3 -3
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +4 -3
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +11 -2
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +65 -30
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.d.ts +1 -2
- package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +0 -9
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/resubmitMachine.d.ts +2 -0
- package/lib/shared-tree-core/resubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/resubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.d.ts +12 -1
- package/lib/shared-tree-core/sequenceIdUtils.d.ts.map +1 -1
- package/lib/shared-tree-core/sequenceIdUtils.js +23 -5
- package/lib/shared-tree-core/sequenceIdUtils.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +33 -30
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +61 -55
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +3 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -0
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +156 -63
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +178 -85
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/{shared-tree → simple-tree/api}/transactionTypes.d.ts +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -0
- package/lib/{shared-tree → simple-tree/api}/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +23 -2
- 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/index.d.ts +1 -1
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +2 -2
- package/lib/simple-tree/schemaTypes.js +1 -1
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +1 -2
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/treeFactory.d.ts +16 -5
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +20 -11
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/breakable.d.ts +1 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/rangeMap.d.ts +1 -1
- package/lib/util/rangeMap.js +1 -1
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/utils.d.ts +16 -0
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +27 -0
- package/lib/util/utils.js.map +1 -1
- package/package.json +23 -23
- package/src/core/forest/editableForest.ts +1 -1
- package/src/core/index.ts +0 -3
- package/src/core/tree/anchorSet.ts +38 -221
- package/src/core/tree/index.ts +0 -3
- package/src/core/tree/pathTree.ts +0 -13
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
- package/src/feature-libraries/detachedFieldIndexSummarizer.ts +0 -11
- package/src/feature-libraries/flex-tree/treeEvents.ts +2 -4
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +0 -11
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +6 -2
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +3 -35
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +18 -48
- package/src/feature-libraries/optional-field/optionalField.ts +10 -3
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -16
- package/src/feature-libraries/sequence-field/sequenceFieldEditor.ts +13 -2
- package/src/index.ts +15 -12
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/index.ts +3 -19
- package/src/shared-tree/schematizingTreeView.ts +18 -16
- package/src/shared-tree/sharedTree.ts +208 -100
- package/src/shared-tree/treeApi.ts +10 -1
- package/src/shared-tree/treeCheckout.ts +11 -8
- package/src/shared-tree-core/editManager.ts +80 -43
- package/src/shared-tree-core/editManagerSummarizer.ts +0 -11
- package/src/shared-tree-core/resubmitMachine.ts +2 -0
- package/src/shared-tree-core/sequenceIdUtils.ts +26 -5
- package/src/shared-tree-core/sharedTreeCore.ts +88 -99
- package/src/simple-tree/api/index.ts +15 -0
- package/src/simple-tree/api/schemaFactory.ts +203 -89
- package/src/{shared-tree → simple-tree/api}/transactionTypes.ts +1 -1
- package/src/simple-tree/api/tree.ts +31 -6
- package/src/simple-tree/index.ts +12 -0
- package/src/simple-tree/schemaTypes.ts +2 -2
- package/src/treeFactory.ts +29 -11
- package/src/util/breakable.ts +1 -1
- package/src/util/index.ts +1 -0
- package/src/util/rangeMap.ts +1 -1
- package/src/util/utils.ts +32 -0
- package/dist/core/tree/visitPath.d.ts +0 -101
- package/dist/core/tree/visitPath.d.ts.map +0 -1
- package/dist/core/tree/visitPath.js +0 -7
- package/dist/core/tree/visitPath.js.map +0 -1
- package/dist/shared-tree/publicContracts.d.ts +0 -18
- package/dist/shared-tree/publicContracts.d.ts.map +0 -1
- package/dist/shared-tree/publicContracts.js +0 -24
- package/dist/shared-tree/publicContracts.js.map +0 -1
- package/dist/shared-tree/transactionTypes.d.ts.map +0 -1
- package/lib/core/tree/visitPath.d.ts +0 -101
- package/lib/core/tree/visitPath.d.ts.map +0 -1
- package/lib/core/tree/visitPath.js +0 -6
- package/lib/core/tree/visitPath.js.map +0 -1
- package/lib/shared-tree/publicContracts.d.ts +0 -18
- package/lib/shared-tree/publicContracts.d.ts.map +0 -1
- package/lib/shared-tree/publicContracts.js +0 -21
- package/lib/shared-tree/publicContracts.js.map +0 -1
- package/lib/shared-tree/transactionTypes.d.ts.map +0 -1
- package/src/core/tree/visitPath.ts +0 -124
- package/src/shared-tree/publicContracts.ts +0 -24
- /package/dist/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
- /package/lib/{shared-tree → simple-tree/api}/transactionTypes.js +0 -0
|
@@ -171,6 +171,141 @@ export type ScopedSchemaName<
|
|
|
171
171
|
> = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;
|
|
172
172
|
// > = `${TScope extends undefined ? "" : `${TScope}.`}${TName}`;
|
|
173
173
|
|
|
174
|
+
/**
|
|
175
|
+
* Stateless APIs exposed via {@link SchemaFactory} as both instance properties and as statics.
|
|
176
|
+
* @privateRemarks
|
|
177
|
+
* We have no way to make linkable members which exist both as statics and instance properties since API-Extractor does not support this.
|
|
178
|
+
* As a workaround, we have this type as a third place which can be linked.
|
|
179
|
+
* @system @sealed @public
|
|
180
|
+
*/
|
|
181
|
+
export const schemaStatics = {
|
|
182
|
+
/**
|
|
183
|
+
* {@link TreeNodeSchema} for holding a JavaScript `string`.
|
|
184
|
+
*
|
|
185
|
+
* @remarks
|
|
186
|
+
* Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.
|
|
187
|
+
*
|
|
188
|
+
* These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.
|
|
189
|
+
* JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.
|
|
190
|
+
* @privateRemarks
|
|
191
|
+
* TODO:
|
|
192
|
+
* We should be much more clear about what happens if you use problematic values.
|
|
193
|
+
* We should validate and/or normalize them when inserting content.
|
|
194
|
+
*/
|
|
195
|
+
string: stringSchema,
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* {@link TreeNodeSchema} for holding a JavaScript `number`.
|
|
199
|
+
*
|
|
200
|
+
* @remarks
|
|
201
|
+
* The number is a {@link https://en.wikipedia.org/wiki/Double-precision_floating-point_format | double-precision 64-bit binary format IEEE 754} value, however there are some exceptions:
|
|
202
|
+
* - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).
|
|
203
|
+
* - `-0` may be converted to `0` in some cases.
|
|
204
|
+
*
|
|
205
|
+
* These limitations match the limitations of JSON.
|
|
206
|
+
* @privateRemarks
|
|
207
|
+
* TODO:
|
|
208
|
+
* We should be much more clear about what happens if you use problematic values.
|
|
209
|
+
* We should validate and/or normalize them when inserting content.
|
|
210
|
+
*/
|
|
211
|
+
number: numberSchema,
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* {@link TreeNodeSchema} for holding a boolean.
|
|
215
|
+
*/
|
|
216
|
+
boolean: booleanSchema,
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* {@link TreeNodeSchema} for JavaScript `null`.
|
|
220
|
+
*
|
|
221
|
+
* @remarks
|
|
222
|
+
* There are good {@link https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null | reasons to avoid using null} in JavaScript, however sometimes it is desired.
|
|
223
|
+
* This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.
|
|
224
|
+
* Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
|
|
225
|
+
*/
|
|
226
|
+
null: nullSchema,
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* {@link TreeNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.
|
|
230
|
+
*/
|
|
231
|
+
handle: handleSchema,
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* {@link AllowedTypes} for holding any of the leaf types.
|
|
235
|
+
*/
|
|
236
|
+
leaves: [stringSchema, numberSchema, booleanSchema, nullSchema, handleSchema],
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Make a field optional instead of the default, which is required.
|
|
240
|
+
*
|
|
241
|
+
* @param t - The types allowed under the field.
|
|
242
|
+
* @param props - Optional properties to associate with the field.
|
|
243
|
+
*
|
|
244
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
245
|
+
* See {@link FieldSchemaMetadata.custom}.
|
|
246
|
+
*/
|
|
247
|
+
optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
248
|
+
t: T,
|
|
249
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
250
|
+
): FieldSchema<FieldKind.Optional, T, TCustomMetadata> => {
|
|
251
|
+
const defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {
|
|
252
|
+
return undefined;
|
|
253
|
+
});
|
|
254
|
+
return createFieldSchema(FieldKind.Optional, t, {
|
|
255
|
+
defaultProvider: defaultOptionalProvider,
|
|
256
|
+
...props,
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Make a field explicitly required.
|
|
262
|
+
*
|
|
263
|
+
* @param t - The types allowed under the field.
|
|
264
|
+
* @param props - Optional properties to associate with the field.
|
|
265
|
+
*
|
|
266
|
+
* @remarks
|
|
267
|
+
* Fields are required by default, but this API can be used to make the required nature explicit in the schema,
|
|
268
|
+
* and allows associating custom {@link FieldProps | properties} with the field.
|
|
269
|
+
*
|
|
270
|
+
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
271
|
+
* See {@link FieldSchemaMetadata.custom}.
|
|
272
|
+
*/
|
|
273
|
+
required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
274
|
+
t: T,
|
|
275
|
+
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
276
|
+
): FieldSchema<FieldKind.Required, T, TCustomMetadata> => {
|
|
277
|
+
return createFieldSchema(FieldKind.Required, t, props);
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* {@link schemaStatics.optional} except tweaked to work better for recursive types.
|
|
282
|
+
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
283
|
+
* @remarks
|
|
284
|
+
* This version of {@link schemaStatics.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
285
|
+
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
286
|
+
*/
|
|
287
|
+
optionalRecursive: <const T extends Unenforced<ImplicitAllowedTypes>>(
|
|
288
|
+
t: T,
|
|
289
|
+
props?: Omit<FieldProps, "defaultProvider">,
|
|
290
|
+
): FieldSchemaUnsafe<FieldKind.Optional, T> => {
|
|
291
|
+
return createFieldSchemaUnsafe(FieldKind.Optional, t, props);
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* {@link schemaStatics.required} except tweaked to work better for recursive types.
|
|
296
|
+
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
297
|
+
* @remarks
|
|
298
|
+
* This version of {@link schemaStatics.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
299
|
+
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
300
|
+
*/
|
|
301
|
+
requiredRecursive: <const T extends Unenforced<ImplicitAllowedTypes>>(
|
|
302
|
+
t: T,
|
|
303
|
+
props?: Omit<FieldProps, "defaultProvider">,
|
|
304
|
+
): FieldSchemaUnsafe<FieldKind.Required, T> => {
|
|
305
|
+
return createFieldSchemaUnsafe(FieldKind.Required, t, props);
|
|
306
|
+
},
|
|
307
|
+
} as const;
|
|
308
|
+
|
|
174
309
|
// TODO:
|
|
175
310
|
// SchemaFactory.array references should link to the correct overloads, however the syntax for this does not seems to work currently for methods unless the they are not qualified with the class.
|
|
176
311
|
// API-Extractor requires such links to be qualified with the class, so it can't work.
|
|
@@ -328,56 +463,65 @@ export class SchemaFactory<
|
|
|
328
463
|
}
|
|
329
464
|
|
|
330
465
|
/**
|
|
331
|
-
* {@
|
|
332
|
-
*
|
|
333
|
-
* @remarks
|
|
334
|
-
* Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.
|
|
335
|
-
*
|
|
336
|
-
* These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.
|
|
337
|
-
* JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.
|
|
338
|
-
* @privateRemarks
|
|
339
|
-
* TODO:
|
|
340
|
-
* We should be much more clear about what happens if you use problematic values.
|
|
341
|
-
* We should validate and/or normalize them when inserting content.
|
|
466
|
+
* {@inheritDoc schemaStatics.string}
|
|
342
467
|
*/
|
|
343
468
|
public readonly string = stringSchema;
|
|
344
469
|
|
|
345
470
|
/**
|
|
346
|
-
* {@
|
|
347
|
-
*
|
|
348
|
-
* @remarks
|
|
349
|
-
* The number is a [double-precision 64-bit binary format IEEE 754](https://en.wikipedia.org/wiki/Double-precision_floating-point_format) value, however there are some exceptions:
|
|
350
|
-
* - `NaN`, and the infinities are converted to `null` (and may therefore only be used where `null` is allowed by the schema).
|
|
351
|
-
* - `-0` may be converted to `0` in some cases.
|
|
352
|
-
*
|
|
353
|
-
* These limitations match the limitations of JSON.
|
|
354
|
-
* @privateRemarks
|
|
355
|
-
* TODO:
|
|
356
|
-
* We should be much more clear about what happens if you use problematic values.
|
|
357
|
-
* We should validate and/or normalize them when inserting content.
|
|
471
|
+
* {@inheritDoc schemaStatics.number}
|
|
358
472
|
*/
|
|
359
473
|
public readonly number = numberSchema;
|
|
360
474
|
|
|
361
475
|
/**
|
|
362
|
-
* {@
|
|
476
|
+
* {@inheritDoc schemaStatics.boolean}
|
|
363
477
|
*/
|
|
364
478
|
public readonly boolean = booleanSchema;
|
|
365
479
|
|
|
366
480
|
/**
|
|
367
|
-
* {@
|
|
368
|
-
*
|
|
369
|
-
* @remarks
|
|
370
|
-
* There are good [reasons to avoid using null](https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null) in JavaScript, however sometimes it is desired.
|
|
371
|
-
* This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.
|
|
372
|
-
* Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
|
|
481
|
+
* {@inheritDoc schemaStatics.null}
|
|
373
482
|
*/
|
|
374
483
|
public readonly null = nullSchema;
|
|
375
484
|
|
|
376
485
|
/**
|
|
377
|
-
* {@
|
|
486
|
+
* {@inheritDoc schemaStatics.handle}
|
|
378
487
|
*/
|
|
379
488
|
public readonly handle = handleSchema;
|
|
380
489
|
|
|
490
|
+
/**
|
|
491
|
+
* {@inheritDoc schemaStatics.leaves}
|
|
492
|
+
*/
|
|
493
|
+
public readonly leaves = schemaStatics.leaves;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* {@inheritDoc schemaStatics.string}
|
|
497
|
+
*/
|
|
498
|
+
public static readonly string = stringSchema;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* {@inheritDoc schemaStatics.number}
|
|
502
|
+
*/
|
|
503
|
+
public static readonly number = numberSchema;
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* {@inheritDoc schemaStatics.boolean}
|
|
507
|
+
*/
|
|
508
|
+
public static readonly boolean = booleanSchema;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* {@inheritDoc schemaStatics.null}
|
|
512
|
+
*/
|
|
513
|
+
public static readonly null = nullSchema;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* {@inheritDoc schemaStatics.handle}
|
|
517
|
+
*/
|
|
518
|
+
public static readonly handle = handleSchema;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* {@inheritDoc schemaStatics.leaves}
|
|
522
|
+
*/
|
|
523
|
+
public static readonly leaves = schemaStatics.leaves;
|
|
524
|
+
|
|
381
525
|
/**
|
|
382
526
|
* Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.
|
|
383
527
|
*
|
|
@@ -696,74 +840,44 @@ export class SchemaFactory<
|
|
|
696
840
|
}
|
|
697
841
|
|
|
698
842
|
/**
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
* @param t - The types allowed under the field.
|
|
702
|
-
* @param props - Optional properties to associate with the field.
|
|
703
|
-
*
|
|
704
|
-
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
705
|
-
* See {@link FieldSchemaMetadata.custom}.
|
|
843
|
+
* {@inheritDoc schemaStatics.optional}
|
|
706
844
|
*/
|
|
707
|
-
public optional
|
|
708
|
-
t: T,
|
|
709
|
-
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
710
|
-
): FieldSchema<FieldKind.Optional, T, TCustomMetadata> {
|
|
711
|
-
const defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => {
|
|
712
|
-
return undefined;
|
|
713
|
-
});
|
|
714
|
-
return createFieldSchema(FieldKind.Optional, t, {
|
|
715
|
-
defaultProvider: defaultOptionalProvider,
|
|
716
|
-
...props,
|
|
717
|
-
});
|
|
718
|
-
}
|
|
845
|
+
public readonly optional = schemaStatics.optional;
|
|
719
846
|
|
|
720
847
|
/**
|
|
721
|
-
*
|
|
722
|
-
*
|
|
723
|
-
* @param t - The types allowed under the field.
|
|
724
|
-
* @param props - Optional properties to associate with the field.
|
|
725
|
-
*
|
|
726
|
-
* @remarks
|
|
727
|
-
* Fields are required by default, but this API can be used to make the required nature explicit in the schema,
|
|
728
|
-
* and allows associating custom {@link FieldProps | properties} with the field.
|
|
729
|
-
*
|
|
730
|
-
* @typeParam TCustomMetadata - Custom metadata properties to associate with the field.
|
|
731
|
-
* See {@link FieldSchemaMetadata.custom}.
|
|
848
|
+
* {@inheritDoc schemaStatics.required}
|
|
732
849
|
*/
|
|
733
|
-
public required
|
|
734
|
-
t: T,
|
|
735
|
-
props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">,
|
|
736
|
-
): FieldSchema<FieldKind.Required, T, TCustomMetadata> {
|
|
737
|
-
return createFieldSchema(FieldKind.Required, t, props);
|
|
738
|
-
}
|
|
850
|
+
public readonly required = schemaStatics.required;
|
|
739
851
|
|
|
740
852
|
/**
|
|
741
|
-
* {@
|
|
742
|
-
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
743
|
-
* @remarks
|
|
744
|
-
* This version of {@link SchemaFactory.optional} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
745
|
-
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
853
|
+
* {@inheritDoc schemaStatics.optionalRecursive}
|
|
746
854
|
*/
|
|
747
|
-
public optionalRecursive
|
|
748
|
-
t: T,
|
|
749
|
-
props?: Omit<FieldProps, "defaultProvider">,
|
|
750
|
-
): FieldSchemaUnsafe<FieldKind.Optional, T> {
|
|
751
|
-
return createFieldSchemaUnsafe(FieldKind.Optional, t, props);
|
|
752
|
-
}
|
|
855
|
+
public readonly optionalRecursive = schemaStatics.optionalRecursive;
|
|
753
856
|
|
|
754
857
|
/**
|
|
755
|
-
* {@
|
|
756
|
-
* Use with {@link ValidateRecursiveSchema} for improved type safety.
|
|
757
|
-
* @remarks
|
|
758
|
-
* This version of {@link SchemaFactory.required} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
|
|
759
|
-
* See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
|
|
858
|
+
* {@inheritDoc schemaStatics.requiredRecursive}
|
|
760
859
|
*/
|
|
761
|
-
public requiredRecursive
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
860
|
+
public readonly requiredRecursive = schemaStatics.requiredRecursive;
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* {@inheritDoc schemaStatics.optional}
|
|
864
|
+
*/
|
|
865
|
+
public static readonly optional = schemaStatics.optional;
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* {@inheritDoc schemaStatics.required}
|
|
869
|
+
*/
|
|
870
|
+
public static readonly required = schemaStatics.required;
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* {@inheritDoc schemaStatics.optionalRecursive}
|
|
874
|
+
*/
|
|
875
|
+
public static readonly optionalRecursive = schemaStatics.optionalRecursive;
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* {@inheritDoc schemaStatics.requiredRecursive}
|
|
879
|
+
*/
|
|
880
|
+
public static readonly requiredRecursive = schemaStatics.requiredRecursive;
|
|
767
881
|
|
|
768
882
|
/**
|
|
769
883
|
* A special field which holds a unique identifier for an object node.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { TreeNode } from "../
|
|
6
|
+
import type { TreeNode } from "../core/index.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A special object that signifies when a SharedTree {@link RunTransaction | transaction} should "roll back".
|
|
@@ -13,11 +13,6 @@ import type {
|
|
|
13
13
|
} from "../../core/index.js";
|
|
14
14
|
|
|
15
15
|
import type {
|
|
16
|
-
RunTransactionParams,
|
|
17
|
-
VoidTransactionCallbackStatus,
|
|
18
|
-
TransactionCallbackStatus,
|
|
19
|
-
TransactionResult,
|
|
20
|
-
TransactionResultExt,
|
|
21
16
|
// This is referenced by doc comments.
|
|
22
17
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports
|
|
23
18
|
TreeAlpha,
|
|
@@ -42,6 +37,15 @@ import { markSchemaMostDerived } from "./schemaFactory.js";
|
|
|
42
37
|
import { fail, getOrCreate } from "../../util/index.js";
|
|
43
38
|
import type { MakeNominal } from "../../util/index.js";
|
|
44
39
|
import { walkFieldSchema } from "../walkFieldSchema.js";
|
|
40
|
+
import type { VerboseTree } from "./verboseTree.js";
|
|
41
|
+
import type { SimpleTreeSchema } from "./simpleSchema.js";
|
|
42
|
+
import type {
|
|
43
|
+
RunTransactionParams,
|
|
44
|
+
TransactionCallbackStatus,
|
|
45
|
+
TransactionResult,
|
|
46
|
+
TransactionResultExt,
|
|
47
|
+
VoidTransactionCallbackStatus,
|
|
48
|
+
} from "./transactionTypes.js";
|
|
45
49
|
/**
|
|
46
50
|
* A tree from which a {@link TreeView} can be created.
|
|
47
51
|
*
|
|
@@ -52,7 +56,6 @@ import { walkFieldSchema } from "../walkFieldSchema.js";
|
|
|
52
56
|
* Maybe rename "exportJsonSchema" to align on "concise" terminology.
|
|
53
57
|
* Ensure schema exporting APIs here align and reference APIs for exporting view schema to the same formats (which should include stored vs property key choice).
|
|
54
58
|
* Make sure users of independentView can use these export APIs (maybe provide a reference back to the ViewableTree from the TreeView to accomplish that).
|
|
55
|
-
* Some of these APIs are on ISharedTree and can get moved here.
|
|
56
59
|
* @system @sealed @public
|
|
57
60
|
*/
|
|
58
61
|
export interface ViewableTree {
|
|
@@ -101,6 +104,28 @@ export interface ViewableTree {
|
|
|
101
104
|
*/
|
|
102
105
|
export interface ITree extends ViewableTree, IFluidLoadable {}
|
|
103
106
|
|
|
107
|
+
/**
|
|
108
|
+
* {@link ITree} extended with some alpha APIs.
|
|
109
|
+
* @privateRemarks
|
|
110
|
+
* TODO: Promote this to alpha.
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
export interface ITreeAlpha extends ITree {
|
|
114
|
+
/**
|
|
115
|
+
* Exports root in the same format as {@link TreeAlpha.(exportVerbose:1)} using stored keys.
|
|
116
|
+
* @remarks
|
|
117
|
+
* This is `undefined` if and only if the root field is empty (this can only happen if the root field is optional).
|
|
118
|
+
*/
|
|
119
|
+
exportVerbose(): VerboseTree | undefined;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Exports the SimpleTreeSchema that is stored in the tree, using stored keys for object fields.
|
|
123
|
+
* @remarks
|
|
124
|
+
* To get the schema using property keys, use {@link getSimpleSchema} on the view schema.
|
|
125
|
+
*/
|
|
126
|
+
exportSimpleSchema(): SimpleTreeSchema;
|
|
127
|
+
}
|
|
128
|
+
|
|
104
129
|
/**
|
|
105
130
|
* Options when constructing a tree view.
|
|
106
131
|
* @public
|
package/src/simple-tree/index.ts
CHANGED
|
@@ -124,6 +124,18 @@ export {
|
|
|
124
124
|
type CustomTreeNode,
|
|
125
125
|
type CustomTreeValue,
|
|
126
126
|
tryStoredSchemaAsArray,
|
|
127
|
+
type schemaStatics,
|
|
128
|
+
type ITreeAlpha,
|
|
129
|
+
type TransactionConstraint,
|
|
130
|
+
type NodeInDocumentConstraint,
|
|
131
|
+
type RunTransactionParams,
|
|
132
|
+
type VoidTransactionCallbackStatus,
|
|
133
|
+
type TransactionCallbackStatus,
|
|
134
|
+
type TransactionResult,
|
|
135
|
+
type TransactionResultExt,
|
|
136
|
+
type TransactionResultSuccess,
|
|
137
|
+
type TransactionResultFailed,
|
|
138
|
+
rollback,
|
|
127
139
|
} from "./api/index.js";
|
|
128
140
|
export {
|
|
129
141
|
type NodeFromSchema,
|
|
@@ -281,7 +281,7 @@ export let createFieldSchema: <
|
|
|
281
281
|
* including functionality that does not have to be kept consistent across versions or deterministic.
|
|
282
282
|
*
|
|
283
283
|
* This can include policy for how to use this schema for "view" purposes, and well as how to expose editing APIs.
|
|
284
|
-
* Use {@link SchemaFactory} to create the FieldSchema instances, for example {@link
|
|
284
|
+
* Use {@link SchemaFactory} to create the FieldSchema instances, for example {@link schemaStatics.optional}.
|
|
285
285
|
* @privateRemarks
|
|
286
286
|
* Public access to the constructor is removed to prevent creating expressible but unsupported (or not stable) configurations.
|
|
287
287
|
* {@link createFieldSchema} can be used internally to create instances.
|
|
@@ -822,7 +822,7 @@ export type NodeBuilderData<T extends TreeNodeSchemaCore<string, NodeKind, boole
|
|
|
822
822
|
/**
|
|
823
823
|
* Value that may be stored as a leaf node.
|
|
824
824
|
* @remarks
|
|
825
|
-
* Some limitations apply, see the documentation for {@link
|
|
825
|
+
* Some limitations apply, see the documentation for {@link schemaStatics.number} and {@link schemaStatics.string} for those restrictions.
|
|
826
826
|
* @public
|
|
827
827
|
*/
|
|
828
828
|
// eslint-disable-next-line @rushstack/no-new-null
|
package/src/treeFactory.ts
CHANGED
|
@@ -15,25 +15,43 @@ import {
|
|
|
15
15
|
createSharedObjectKind,
|
|
16
16
|
} from "@fluidframework/shared-object-base/internal";
|
|
17
17
|
|
|
18
|
-
import {
|
|
19
|
-
|
|
18
|
+
import {
|
|
19
|
+
SharedTree as SharedTreeImpl,
|
|
20
|
+
type SharedTreeOptions,
|
|
21
|
+
type SharedTreeOptionsInternal,
|
|
22
|
+
} from "./shared-tree/index.js";
|
|
20
23
|
import type { ITree } from "./simple-tree/index.js";
|
|
21
24
|
|
|
25
|
+
import { pkgVersion } from "./packageVersion.js";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
|
|
29
|
+
* @alpha
|
|
30
|
+
* @legacy
|
|
31
|
+
*/
|
|
32
|
+
export const SharedTreeFactoryType = "https://graph.microsoft.com/types/tree";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
|
|
36
|
+
* @alpha
|
|
37
|
+
* @legacy
|
|
38
|
+
*/
|
|
39
|
+
export const SharedTreeAttributes: IChannelAttributes = {
|
|
40
|
+
type: SharedTreeFactoryType,
|
|
41
|
+
snapshotFormatVersion: "0.0.0",
|
|
42
|
+
packageVersion: pkgVersion,
|
|
43
|
+
};
|
|
44
|
+
|
|
22
45
|
/**
|
|
23
46
|
* A channel factory that creates an {@link ITree}.
|
|
24
47
|
*/
|
|
25
48
|
export class TreeFactory implements IChannelFactory<ITree> {
|
|
26
|
-
public static
|
|
27
|
-
public
|
|
28
|
-
type: this.Type,
|
|
29
|
-
snapshotFormatVersion: "0.0.0",
|
|
30
|
-
packageVersion: pkgVersion,
|
|
31
|
-
};
|
|
49
|
+
public static Type: string = SharedTreeFactoryType;
|
|
50
|
+
public readonly type: string = SharedTreeFactoryType;
|
|
32
51
|
|
|
33
|
-
public readonly
|
|
34
|
-
public readonly attributes: IChannelAttributes = TreeFactory.attributes;
|
|
52
|
+
public readonly attributes: IChannelAttributes = SharedTreeAttributes;
|
|
35
53
|
|
|
36
|
-
public constructor(private readonly options:
|
|
54
|
+
public constructor(private readonly options: SharedTreeOptionsInternal) {}
|
|
37
55
|
|
|
38
56
|
public async load(
|
|
39
57
|
runtime: IFluidDataStoreRuntime,
|
package/src/util/breakable.ts
CHANGED
|
@@ -47,7 +47,7 @@ export class Breakable {
|
|
|
47
47
|
* @privateRemarks
|
|
48
48
|
* If there is a use-case, this should be made public.
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
public rethrowCaught(brokenBy: unknown): never {
|
|
51
51
|
if (brokenBy instanceof Error) {
|
|
52
52
|
this.break(brokenBy);
|
|
53
53
|
}
|
package/src/util/index.ts
CHANGED
package/src/util/rangeMap.ts
CHANGED
|
@@ -61,7 +61,7 @@ export class RangeMap<K, V> {
|
|
|
61
61
|
* Retrieves the values for all keys in the query range.
|
|
62
62
|
*
|
|
63
63
|
* @param start - The first key in the range being queried
|
|
64
|
-
* @param length
|
|
64
|
+
* @param length - The length of the query range
|
|
65
65
|
* @returns A list of entries, each describing the value for some subrange of the query.
|
|
66
66
|
* The entries are in the same order as the keys, and there is an entry for every key with a non `undefined` value.
|
|
67
67
|
*/
|
package/src/util/utils.ts
CHANGED
|
@@ -616,3 +616,35 @@ export function copyPropertyIfDefined<
|
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Reduces an array of values into a single value.
|
|
622
|
+
* This is similar to `Array.prototype.reduce`,
|
|
623
|
+
* except that it recursively reduces the left and right halves of the input before reducing their respective reductions.
|
|
624
|
+
*
|
|
625
|
+
* When compared with an approach like reducing all the values left-to-right,
|
|
626
|
+
* this balanced approach is beneficial when the cost of invoking `callbackFn` is proportional to the number reduced values that its parameters collectively represent.
|
|
627
|
+
* For example, if `T` is an array, and `callbackFn` concatenates its inputs,
|
|
628
|
+
* then `balancedReduce` will have O(N*log(N)) time complexity instead of `Array.prototype.reduce`'s O(N²).
|
|
629
|
+
* However, if `callbackFn` is O(1) then both `balancedReduce` and `Array.prototype.reduce` will have O(N) complexity.
|
|
630
|
+
*
|
|
631
|
+
* @param array - The array to reduce.
|
|
632
|
+
* @param callbackFn - The function to execute for each pairwise reduction.
|
|
633
|
+
* @param emptyCase - A factory function that provides the value to return if the input array is empty.
|
|
634
|
+
*/
|
|
635
|
+
export function balancedReduce<T>(
|
|
636
|
+
array: readonly T[],
|
|
637
|
+
callbackFn: (left: T, right: T) => T,
|
|
638
|
+
emptyCase: () => T,
|
|
639
|
+
): T {
|
|
640
|
+
if (hasSingle(array)) {
|
|
641
|
+
return array[0];
|
|
642
|
+
}
|
|
643
|
+
if (!hasSome(array)) {
|
|
644
|
+
return emptyCase();
|
|
645
|
+
}
|
|
646
|
+
const mid = Math.floor(array.length / 2);
|
|
647
|
+
const left = balancedReduce(array.slice(0, mid), callbackFn, emptyCase);
|
|
648
|
+
const right = balancedReduce(array.slice(mid), callbackFn, emptyCase);
|
|
649
|
+
return callbackFn(left, right);
|
|
650
|
+
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { ProtoNodes } from "./delta.js";
|
|
6
|
-
import type { DetachedPlaceUpPath, DetachedRangeUpPath, PlaceUpPath, RangeUpPath, UpPath } from "./pathTree.js";
|
|
7
|
-
/**
|
|
8
|
-
* Delta visitor for the path tree.
|
|
9
|
-
*
|
|
10
|
-
* For any of these events, the paths are guaranteed to be valid at the time of the event,
|
|
11
|
-
* and it is valid to read from the Forest at that path.
|
|
12
|
-
*/
|
|
13
|
-
export interface PathVisitor {
|
|
14
|
-
/**
|
|
15
|
-
* Invoked after the creation of a range of nodes.
|
|
16
|
-
* @param content - The content that was created.
|
|
17
|
-
*/
|
|
18
|
-
afterCreate(content: DetachedRangeUpPath): void;
|
|
19
|
-
/**
|
|
20
|
-
* Invoked before the attaching of a range of nodes.
|
|
21
|
-
* Not invoked for replacements.
|
|
22
|
-
* @param source - The content that will be attached.
|
|
23
|
-
* @param destination - The location where the content will be attached.
|
|
24
|
-
* @param kind - The kind of replacement that will occur.
|
|
25
|
-
*/
|
|
26
|
-
beforeAttach(source: DetachedRangeUpPath, destination: PlaceUpPath): void;
|
|
27
|
-
/**
|
|
28
|
-
* Invoked after the attaching of a range of nodes.
|
|
29
|
-
* Not invoked for replacements.
|
|
30
|
-
* @param source - The location where the content originated.
|
|
31
|
-
* @param destination - The content that was attached.
|
|
32
|
-
* @param kind - The kind of replacement that will occur.
|
|
33
|
-
*/
|
|
34
|
-
afterAttach(source: DetachedPlaceUpPath, destination: RangeUpPath): void;
|
|
35
|
-
/**
|
|
36
|
-
* Invoked before the detaching of a range of nodes.
|
|
37
|
-
* Not invoked for replacements.
|
|
38
|
-
* @param source - The content that will be detached.
|
|
39
|
-
* @param destination - The location where the content will be sent to.
|
|
40
|
-
* @param kind - The kind of replacement that will occur.
|
|
41
|
-
*/
|
|
42
|
-
beforeDetach(source: RangeUpPath, destination: DetachedPlaceUpPath): void;
|
|
43
|
-
/**
|
|
44
|
-
* Invoked after the detaching of a range of nodes.
|
|
45
|
-
* Not invoked for replacements.
|
|
46
|
-
* @param source - The content that was detached.
|
|
47
|
-
* @param destination - The location where the content will be attached.
|
|
48
|
-
* @param kind - The kind of replacement that will occur.
|
|
49
|
-
*/
|
|
50
|
-
afterDetach(source: PlaceUpPath, destination: DetachedRangeUpPath): void;
|
|
51
|
-
/**
|
|
52
|
-
* Invoked before the replacement of a range of nodes.
|
|
53
|
-
*
|
|
54
|
-
* Note that the `newContent` range length will always match the `oldContent` range length.
|
|
55
|
-
* A replace might actually be separate detaches and attaches which have been coalesced.
|
|
56
|
-
*
|
|
57
|
-
* @param newContent - The content that will be attached in place of the old.
|
|
58
|
-
* @param oldContent - The old that will be replaced.
|
|
59
|
-
* @param oldContentDestination - The destination of the old content.
|
|
60
|
-
* @param kind - The kind of replacement that will occur.
|
|
61
|
-
*/
|
|
62
|
-
beforeReplace(newContent: DetachedRangeUpPath, oldContent: RangeUpPath, oldContentDestination: DetachedPlaceUpPath): void;
|
|
63
|
-
/**
|
|
64
|
-
* Invoked after the replacement of a range of nodes.
|
|
65
|
-
*
|
|
66
|
-
* Note that the `newContent` range length will always match the `oldContent` range length.
|
|
67
|
-
* A replace might actually be separate detaches and attaches which have been coalesced.
|
|
68
|
-
*
|
|
69
|
-
* @param newContentSource - The place that the new content came from.
|
|
70
|
-
* @param newContent - The new content.
|
|
71
|
-
* @param oldContent - The content that was replaced.
|
|
72
|
-
*/
|
|
73
|
-
afterReplace(newContentSource: DetachedPlaceUpPath, newContent: RangeUpPath, oldContent: DetachedRangeUpPath): void;
|
|
74
|
-
/**
|
|
75
|
-
* Invoked before content is destroyed.
|
|
76
|
-
* @param content - The content that will be destroyed
|
|
77
|
-
*/
|
|
78
|
-
beforeDestroy(content: DetachedRangeUpPath): void;
|
|
79
|
-
/**
|
|
80
|
-
* A sequence of nodes of length `count` is being removed starting with `path`.
|
|
81
|
-
* Called when these nodes are no longer parented under their previous parent, and do not have a new parent.
|
|
82
|
-
* It is possible they may be restored in the future (for example by a conflicted merge or undo).
|
|
83
|
-
*
|
|
84
|
-
* Not called for children of removed nodes.
|
|
85
|
-
*
|
|
86
|
-
* @param path - first node in the removed range.
|
|
87
|
-
* @param count - length of removed range.
|
|
88
|
-
*
|
|
89
|
-
* @deprecated Migrate to using the other events.
|
|
90
|
-
*/
|
|
91
|
-
onRemove(path: UpPath, count: number): void;
|
|
92
|
-
/**
|
|
93
|
-
* @param path - location which first node of inserted range will have after insert.
|
|
94
|
-
* Any nodes at this index (or after it) will be moved to the right (have their indexes increased by `content.length`).
|
|
95
|
-
* @param content - content which is being inserted.
|
|
96
|
-
*
|
|
97
|
-
* @deprecated Migrate to using the other events.
|
|
98
|
-
*/
|
|
99
|
-
onInsert(path: UpPath, content: ProtoNodes): void;
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=visitPath.d.ts.map
|