@fluidframework/tree 2.81.1 → 2.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +125 -0
- package/api-report/tree.alpha.api.md +54 -22
- package/api-report/tree.beta.api.md +150 -1
- package/api-report/tree.legacy.beta.api.md +150 -1
- package/api-report/tree.legacy.public.api.md +1 -0
- package/api-report/tree.public.api.md +1 -0
- package/dist/alpha.d.ts +8 -2
- package/dist/beta.d.ts +3 -0
- package/dist/codec/codec.d.ts +17 -8
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +8 -1
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +1 -1
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +2 -1
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +1 -1
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.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 +4 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +3 -2
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +4 -2
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +23 -3
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +30 -16
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/formatV1.d.ts +2 -2
- package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV1.js +0 -5
- package/dist/core/schema-stored/formatV1.js.map +1 -1
- package/dist/core/schema-stored/formatV2.d.ts +11 -10
- package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV2.js +1 -6
- package/dist/core/schema-stored/formatV2.js.map +1 -1
- package/dist/core/schema-stored/index.d.ts.map +1 -1
- package/dist/core/schema-stored/index.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/delta.d.ts +9 -7
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/deltaUtil.js +1 -1
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/visitDelta.js +2 -2
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/extensibleSchemaUnion.d.ts +72 -0
- package/dist/extensibleSchemaUnion.d.ts.map +1 -0
- package/dist/extensibleSchemaUnion.js +79 -0
- package/dist/extensibleSchemaUnion.js.map +1 -0
- package/dist/feature-libraries/changeAtomIdBTree.d.ts +4 -2
- package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.js +9 -1
- package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -3
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +20 -21
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +2 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +5 -2
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts +1 -39
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.js +1 -2
- package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV1.d.ts +1 -39
- package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV2.d.ts +1 -39
- package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +3 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +4 -3
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +42 -22
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +2 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -5
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +11 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +30 -7
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +38 -27
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +10 -127
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -4
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +3 -79
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/requiredField.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +4 -4
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +2 -2
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -16
- package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +3 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +36 -13
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +1 -0
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +10 -0
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +25 -9
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +3 -3
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +8 -32
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +11 -3
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +38 -4
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.d.ts +4 -4
- package/dist/shared-tree/tree.js +1 -1
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +20 -0
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +39 -3
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js +2 -2
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +14 -3
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +59 -16
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/versionedSummarizer.js +1 -1
- package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +9 -0
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +16 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts +10 -0
- package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/dist/simple-tree/api/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +81 -6
- 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/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +4 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +63 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +43 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/index.js +2 -1
- package/dist/simple-tree/node-kinds/array/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/index.js +2 -1
- package/dist/simple-tree/node-kinds/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/tableSchema.d.ts +71 -48
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +200 -98
- package/dist/tableSchema.js.map +1 -1
- package/dist/text/textDomainFormatted.js +1 -1
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/util/bTreeUtils.d.ts +30 -4
- package/dist/util/bTreeUtils.d.ts.map +1 -1
- package/dist/util/bTreeUtils.js +29 -17
- package/dist/util/bTreeUtils.js.map +1 -1
- package/dist/util/brand.d.ts.map +1 -1
- package/dist/util/brand.js.map +1 -1
- package/dist/util/brandedMap.d.ts.map +1 -1
- package/dist/util/brandedMap.js.map +1 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +2 -1
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +6 -3
- package/dist/util/index.js.map +1 -1
- package/dist/util/opaque.d.ts.map +1 -1
- package/dist/util/opaque.js.map +1 -1
- package/dist/util/rangeMap.d.ts +3 -2
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +7 -1
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/readSnapshotBlob.d.ts +1 -1
- package/dist/util/readSnapshotBlob.d.ts.map +1 -1
- package/dist/util/readSnapshotBlob.js.map +1 -1
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/utils.d.ts +20 -16
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +49 -17
- package/dist/util/utils.js.map +1 -1
- package/eslint.config.mts +0 -9
- package/lib/alpha.d.ts +8 -2
- package/lib/beta.d.ts +3 -0
- package/lib/codec/codec.d.ts +17 -8
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +6 -0
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +1 -1
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.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 +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/changeRebaser.d.ts +3 -2
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +23 -3
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +27 -15
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/formatV1.d.ts +2 -2
- package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
- package/lib/core/schema-stored/formatV1.js +0 -5
- package/lib/core/schema-stored/formatV1.js.map +1 -1
- package/lib/core/schema-stored/formatV2.d.ts +11 -10
- package/lib/core/schema-stored/formatV2.d.ts.map +1 -1
- package/lib/core/schema-stored/formatV2.js +1 -6
- package/lib/core/schema-stored/formatV2.js.map +1 -1
- package/lib/core/schema-stored/index.d.ts.map +1 -1
- package/lib/core/schema-stored/index.js +2 -0
- package/lib/core/schema-stored/index.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/delta.d.ts +9 -7
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/deltaUtil.js +1 -1
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/visitDelta.js +2 -2
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/extensibleSchemaUnion.d.ts +72 -0
- package/lib/extensibleSchemaUnion.d.ts.map +1 -0
- package/lib/extensibleSchemaUnion.js +76 -0
- package/lib/extensibleSchemaUnion.js.map +1 -0
- package/lib/feature-libraries/changeAtomIdBTree.d.ts +4 -2
- package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/lib/feature-libraries/changeAtomIdBTree.js +7 -0
- package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -3
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +4 -5
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +2 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts +1 -39
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.js +2 -3
- package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV1.d.ts +1 -39
- package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV2.d.ts +1 -39
- package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +3 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +3 -3
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +41 -21
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -6
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +11 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +29 -6
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +41 -30
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +10 -127
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -4
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +3 -79
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/requiredField.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +4 -4
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +2 -2
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -16
- package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/lib/index.d.ts +5 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +3 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +36 -13
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +1 -0
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +10 -0
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +25 -9
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +3 -3
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +10 -34
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +11 -3
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +39 -5
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.d.ts +4 -4
- package/lib/shared-tree/tree.js +1 -1
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +20 -0
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +39 -3
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js +2 -2
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +14 -3
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +61 -18
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/versionedSummarizer.js +1 -1
- package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +9 -0
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +14 -0
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts +10 -0
- package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/lib/simple-tree/api/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +81 -6
- 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/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +63 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +41 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/index.js +1 -1
- package/lib/simple-tree/node-kinds/array/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/index.js +1 -1
- package/lib/simple-tree/node-kinds/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/tableSchema.d.ts +71 -48
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +201 -99
- package/lib/tableSchema.js.map +1 -1
- package/lib/text/textDomainFormatted.js +1 -1
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/util/bTreeUtils.d.ts +30 -4
- package/lib/util/bTreeUtils.d.ts.map +1 -1
- package/lib/util/bTreeUtils.js +27 -16
- package/lib/util/bTreeUtils.js.map +1 -1
- package/lib/util/brand.d.ts.map +1 -1
- package/lib/util/brand.js.map +1 -1
- package/lib/util/brandedMap.d.ts.map +1 -1
- package/lib/util/brandedMap.js.map +1 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +2 -1
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/index.d.ts +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/opaque.d.ts.map +1 -1
- package/lib/util/opaque.js.map +1 -1
- package/lib/util/rangeMap.d.ts +3 -2
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +7 -1
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/readSnapshotBlob.d.ts +1 -1
- package/lib/util/readSnapshotBlob.d.ts.map +1 -1
- package/lib/util/readSnapshotBlob.js.map +1 -1
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/utils.d.ts +20 -16
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +44 -15
- package/lib/util/utils.js.map +1 -1
- package/package.json +22 -22
- package/src/codec/codec.ts +30 -11
- package/src/codec/index.ts +2 -0
- package/src/codec/versioned/codec.ts +9 -13
- package/src/core/index.ts +3 -1
- package/src/core/rebase/changeRebaser.ts +3 -2
- package/src/core/rebase/index.ts +3 -1
- package/src/core/rebase/types.ts +51 -13
- package/src/core/schema-stored/formatV1.ts +2 -4
- package/src/core/schema-stored/formatV2.ts +9 -7
- package/src/core/schema-stored/index.ts +2 -0
- package/src/core/schema-stored/schema.ts +4 -1
- package/src/core/tree/anchorSet.ts +1 -3
- package/src/core/tree/delta.ts +9 -7
- package/src/core/tree/deltaUtil.ts +1 -1
- package/src/core/tree/visitDelta.ts +2 -2
- package/src/extensibleSchemaUnion.ts +135 -0
- package/src/feature-libraries/changeAtomIdBTree.ts +17 -2
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +5 -6
- package/src/feature-libraries/default-schema/index.ts +0 -1
- package/src/feature-libraries/forest-summary/codec.ts +7 -2
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +15 -3
- package/src/feature-libraries/forest-summary/formatCommon.ts +2 -3
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +4 -5
- package/src/feature-libraries/index.ts +3 -2
- package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +57 -31
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +1 -1
- package/src/feature-libraries/modular-schema/index.ts +4 -1
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +7 -6
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +32 -7
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +54 -33
- package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +2 -4
- package/src/feature-libraries/optional-field/optionalField.ts +1 -1
- package/src/feature-libraries/optional-field/requiredField.ts +2 -4
- package/src/feature-libraries/schema-index/codec.ts +1 -1
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -1
- package/src/feature-libraries/sequence-field/invert.ts +2 -2
- package/src/feature-libraries/sequence-field/replaceRevisions.ts +17 -10
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +1 -1
- package/src/index.ts +12 -7
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +42 -6
- package/src/shared-tree/index.ts +2 -0
- package/src/shared-tree/schematizingTreeView.ts +63 -18
- package/src/shared-tree/sharedTree.ts +19 -37
- package/src/shared-tree/sharedTreeChangeCodecs.ts +43 -9
- package/src/shared-tree/tree.ts +1 -1
- package/src/shared-tree/treeCheckout.ts +50 -3
- package/src/shared-tree-core/editManagerSummarizer.ts +1 -1
- package/src/shared-tree-core/messageCodecV1ToV4.ts +4 -3
- package/src/shared-tree-core/transaction.ts +125 -23
- package/src/shared-tree-core/versionedSummarizer.ts +3 -2
- package/src/simple-tree/api/index.ts +1 -0
- package/src/simple-tree/api/schemaCreationUtilities.ts +35 -5
- package/src/simple-tree/api/simpleTreeIndex.ts +1 -1
- package/src/simple-tree/api/transactionTypes.ts +10 -0
- package/src/simple-tree/api/tree.ts +88 -6
- package/src/simple-tree/core/treeNodeSchema.ts +5 -8
- package/src/simple-tree/index.ts +3 -0
- package/src/simple-tree/leafNodeSchema.ts +3 -2
- package/src/simple-tree/node-kinds/array/arrayNode.ts +86 -0
- package/src/simple-tree/node-kinds/array/index.ts +2 -0
- package/src/simple-tree/node-kinds/index.ts +2 -0
- package/src/simple-tree/node-kinds/object/objectNode.ts +19 -18
- package/src/tableSchema.ts +280 -140
- package/src/text/textDomainFormatted.ts +1 -1
- package/src/util/bTreeUtils.ts +45 -26
- package/src/util/brand.ts +4 -12
- package/src/util/brandedMap.ts +2 -6
- package/src/util/breakable.ts +3 -2
- package/src/util/index.ts +9 -3
- package/src/util/opaque.ts +2 -6
- package/src/util/rangeMap.ts +11 -5
- package/src/util/readSnapshotBlob.ts +3 -3
- package/src/util/typeCheck.ts +11 -9
- package/src/util/utils.ts +57 -28
- package/biome.jsonc +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeNodeSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAqU7D;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AA6GvD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAN,IAAY,kBAaX;AAbD,WAAY,kBAAkB;IAC7B;;OAEG;IACH,2DAAQ,CAAA;IACR;;OAEG;IACH,yDAAO,CAAA;IACP;;OAEG;IACH,+DAAU,CAAA;AACX,CAAC,EAbW,kBAAkB,KAAlB,kBAAkB,QAa7B;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAC3C,MAAqD;IAErD,MAAM,CACL,iBAAiB,IAAI,MAAM,EAC3B,KAAK,CAAC,6FAA6F,CACnG,CAAC;IACF,MAAM,WAAW,GAAG,MAAmC,CAAC;IACxD,OAAO,WAAW,CAAC,iBAAiB,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,QAuBX;AAvBD,WAAY,QAAQ;IACnB;;OAEG;IACH,qCAAO,CAAA;IACP;;OAEG;IACH,yCAAS,CAAA;IACT;;;;OAIG;IACH,2CAAU,CAAA;IACV;;OAEG;IACH,uCAAQ,CAAA;IACR;;OAEG;IACH,2CAAU,CAAA;AACX,CAAC,EAvBW,QAAQ,KAAR,QAAQ,QAuBnB;AA4BD;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAQpC,MAE2F;IAS3F,OAAO,MAAM,CAAC,WAAW,KAAK,SAAS,CAAC;AACzC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { FieldKey, NodeData } from \"../../core/index.js\";\nimport type { UnionToIntersection } from \"../../util/index.js\";\nimport type { FactoryContent } from \"../unhydratedFlexTreeFromInsertable.js\";\n\nimport type { AllowedTypesFullEvaluated, AllowedTypesFull } from \"./allowedTypes.js\";\nimport type { Context } from \"./context.js\";\nimport type { SimpleNodeSchemaBase } from \"./simpleNodeSchemaBase.js\";\nimport type { TreeNode } from \"./treeNode.js\";\nimport type { InternalTreeNode, Unhydrated } from \"./types.js\";\nimport type { UnhydratedFlexTreeField } from \"./unhydratedFlexTree.js\";\n\n/**\n * Schema for a {@link TreeNode} or {@link TreeLeafValue}.\n *\n * @typeParam Name - The full (including scope) name/identifier for the schema.\n * @typeParam Kind - Which kind of node this schema is for.\n * @typeParam TNode - API for nodes that use this schema.\n * @typeParam TBuild - Data which can be used to construct an {@link Unhydrated} node of this type.\n * @typeParam Info - Data used when defining this schema.\n * @remarks\n * Captures the schema both as runtime data and compile time type information.\n * Use {@link SchemaFactory} to define schema.\n * Use `Tree.schema(value)` to lookup the schema for a {@link TreeNode} or {@link TreeLeafValue}.\n * @privateRemarks\n * TODO:\n * The long lists of type parameters here are awkward to deal with.\n * Switching to (or adding an option to use)\n * an interface based pattern with unordered named parameters for types like this would be a good idea.\n * The related `@system` types should be simple to port to the new pattern, but stable public one like this will need to support both:\n * the new one could either be added as a system type, or be recommended to replace this one (deprecating it).\n * @sealed @public\n */\nexport type TreeNodeSchema<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue,\n\tTBuild = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTCustomMetadata = unknown,\n> =\n\t| (TNode extends TreeNode\n\t\t\t? TreeNodeSchemaClass<\n\t\t\t\t\tName,\n\t\t\t\t\tKind,\n\t\t\t\t\tTNode,\n\t\t\t\t\tTBuild,\n\t\t\t\t\tImplicitlyConstructable,\n\t\t\t\t\tInfo,\n\t\t\t\t\tnever,\n\t\t\t\t\tTCustomMetadata\n\t\t\t\t>\n\t\t\t: never)\n\t| TreeNodeSchemaNonClass<\n\t\t\tName,\n\t\t\tKind,\n\t\t\tTNode,\n\t\t\tTBuild,\n\t\t\tImplicitlyConstructable,\n\t\t\tInfo,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t >;\n\n/**\n * Schema which is not a class.\n * @remarks\n * This is used for schema which cannot have their instances constructed using constructors, like leaf schema.\n * @privateRemarks\n * Non-class based schema can have issues with recursive types due to https://github.com/microsoft/TypeScript/issues/55832.\n * @system @sealed @public\n */\nexport type TreeNodeSchemaNonClass<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTConstructorExtra = never,\n\tTCustomMetadata = unknown,\n> = TreeNodeSchemaCore<\n\tName,\n\tKind,\n\tImplicitlyConstructable,\n\tInfo,\n\tTInsertable,\n\tTCustomMetadata\n> &\n\t(undefined extends TConstructorExtra\n\t\t? {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @privateRemarks\n\t\t\t\t * Also allows InternalTreeNode.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\tcreate(data?: TInsertable | TConstructorExtra): TNode;\n\t\t\t}\n\t\t: {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @privateRemarks\n\t\t\t\t * Also allows InternalTreeNode.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\tcreate(data: TInsertable | TConstructorExtra): TNode;\n\t\t\t});\n\n/**\n * Tree node schema which is implemented using a class.\n * @remarks\n * Instances of this class are nodes in the tree.\n * This is also a constructor so that it can be subclassed.\n *\n * Using classes in this way allows introducing a named type and a named value at the same time, helping keep the runtime and compile time information together and easy to refer to un a uniform way.\n * Additionally, this works around https://github.com/microsoft/TypeScript/issues/55832 which causes similar patterns with less explicit types to infer \"any\" in the d.ts file.\n *\n * When sub-classing a a `TreeNodeSchemaClass`, some extra rules must be followed:\n *\n * - Only ever use a single class from the schema's class hierarchy within a document and its schema.\n * For example, if using {@link SchemaFactory.object} you can do:\n * ```typescript\n * // Recommended \"customizable\" object schema pattern.\n * class Good extends schemaFactory.object(\"A\", {\n * \texampleField: schemaFactory.number,\n * }) {\n * \tpublic exampleCustomMethod(): void {\n * \t\tthis.exampleField++;\n * \t}\n * }\n * ```\n * But should avoid:\n * ```typescript\n * // This by itself is ok, and opts into \"POJO mode\".\n * const base = schemaFactory.object(\"A\", {});\n * // This is a bad pattern since it leaves two classes in scope which derive from the same SchemaFactory defined class.\n * // If both get used, its an error!\n * class Invalid extends base {}\n * ```\n *\n * - Do not modify the constructor input parameter types or values:\n * ```typescript\n * class Invalid extends schemaFactory.object(\"A\", {\n * \texampleField: schemaFactory.number,\n * }) {\n * \t// This Modifies the type of the constructor input.\n * \t// This is unsupported due to programmatic access to the constructor being used internally.\n * \tpublic constructor(a: number) {\n * \t\tsuper({ exampleField: a });\n * \t}\n * }\n * ```\n * @sealed @public\n */\nexport type TreeNodeSchemaClass<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode = TreeNode,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTConstructorExtra = never,\n\tTCustomMetadata = unknown,\n> = TreeNodeSchemaCore<\n\tName,\n\tKind,\n\tImplicitlyConstructable,\n\tInfo,\n\tTInsertable,\n\tTCustomMetadata\n> &\n\t(undefined extends TConstructorExtra\n\t\t? {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @remarks\n\t\t\t\t * This constructor is also used internally to construct hydrated nodes with a different parameter type.\n\t\t\t\t * Therefore, overriding this constructor with different argument types is not type-safe and is not supported.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\t// The approach suggested by the linter here is more concise, but ir break intellisense for the constructor.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t\t\t\tnew (data?: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;\n\t\t\t}\n\t\t: {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @remarks\n\t\t\t\t * This constructor is also used internally to construct hydrated nodes with a different parameter type.\n\t\t\t\t * Therefore, overriding this constructor with different argument types is not type-safe and is not supported.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\t// The approach suggested by the linter here is more concise, but ir break intellisense for the constructor.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t\t\t\tnew (data: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;\n\t\t\t});\n\n/**\n * Internal helper for utilities that return schema which can be used in class and non class formats depending on the API exposing it.\n */\nexport type TreeNodeSchemaBoth<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode = TreeNode,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTConstructorExtra = never,\n\tTCustomMetadata = unknown,\n> = TreeNodeSchemaClass<\n\tName,\n\tKind,\n\tTNode,\n\tTInsertable,\n\tImplicitlyConstructable,\n\tInfo,\n\tTConstructorExtra,\n\tTCustomMetadata\n> &\n\tTreeNodeSchemaNonClass<\n\t\tName,\n\t\tKind,\n\t\tTNode,\n\t\tTInsertable,\n\t\tImplicitlyConstructable,\n\t\tInfo,\n\t\tTConstructorExtra,\n\t\tTCustomMetadata\n\t>;\n\n/**\n * Data common to all tree node schema.\n *\n * @remarks\n * Implementation detail of {@link TreeNodeSchema} which should be accessed instead of referring to this type directly.\n *\n * @privateRemarks\n * All implementations must implement {@link TreeNodeSchemaCorePrivate} as well.\n *\n * @sealed @public\n */\nexport interface TreeNodeSchemaCore<\n\tout Name extends string,\n\tout Kind extends NodeKind,\n\tout ImplicitlyConstructable extends boolean,\n\tout Info = unknown,\n\tout TInsertable = never,\n\tout TCustomMetadata = unknown,\n> extends SimpleNodeSchemaBase<Kind, TCustomMetadata> {\n\t/**\n\t * Unique (within a document's schema) identifier used to associate nodes with their schema.\n\t * @remarks\n\t * This is used when encoding nodes, and when decoding nodes to re-associate them with the schema.\n\t * Since this decoding may happen in a different version of the application (or even a different application altogether),\n\t * this identifier should generally correspond to some specific semantics for the data (how to interpret the node with this identifier).\n\t * Any time the semantics change such that data would be misinterpreted if the old semantics were applied\n\t * (for example the units of a value are changed),\n\t * it is best practice to pick a new identifier.\n\t */\n\treadonly identifier: Name;\n\n\t/**\n\t * Data used to define this schema.\n\t *\n\t * @remarks\n\t * The format depends on the kind of node it is for.\n\t * For example, the \"object\" node kind could store the field schema here.\n\t */\n\treadonly info: Info;\n\n\t/**\n\t * When constructing insertable content,\n\t * data that could be passed to the node's constructor can be used instead of an {@link Unhydrated} node\n\t * iff implicitlyConstructable is true.\n\t * @privateRemarks\n\t * Currently the logic for traversing insertable content,\n\t * both to build trees and to hydrate them does not defer to the schema classes to handle the policy,\n\t * so if their constructors differ from what is supported, some cases will not work.\n\t * Setting this to false adjusts the insertable types to disallow cases which could be impacted by these inconsistencies.\n\t */\n\treadonly implicitlyConstructable: ImplicitlyConstructable;\n\n\t/**\n\t * All possible schema that a direct child of a node with this schema could have.\n\t *\n\t * Equivalently, this is also all schema directly referenced when defining this schema's allowed child types,\n\t * which is also the same as the set of schema referenced directly by the `Info` type parameter and the `info` property.\n\t * This property is simply re-exposing that information in an easier to traverse format consistent across all node kinds.\n\t * @remarks\n\t * Some kinds of nodes may have additional restrictions on children:\n\t * this set simply enumerates all directly referenced schema, and can be use to walk over all referenced schema types.\n\t *\n\t * This set cannot be used before the schema in it have been defined:\n\t * more specifically, when using lazy schema references (for example to make foreword references to schema which have not yet been defined),\n\t * users must wait until after the schema are defined to access this set.\n\t * @privateRemarks\n\t * Currently there isn't much use for this in the public API,\n\t * and it's possible this will want to be tweaked or renamed as part of a larger schema reflection API surface that might be added later.\n\t * To keep options option, this is marked `@system` for now.\n\t * @system\n\t */\n\treadonly childTypes: ReadonlySet<TreeNodeSchema>;\n\n\t/**\n\t * Constructs an instance of this node type.\n\t * @remarks\n\t * Due to TypeScript limitations, the return type of this method can not be very specific.\n\t * For {@link TreeNodeSchemaClass} prefer using the constructor directly for better typing.\n\t * For {@link TreeNodeSchemaNonClass} use `create`.\n\t *\n\t * @privateRemarks\n\t * This method signature provides a way to infer `TInsertable` without relying on the constructor, and to construct nodes from schema of unknown kind.\n\t * This makes customizations of the constructor not impact the typing of insertable content, allowing customization of the constructor,\n\t * as long as doing so only adds additional supported cases.\n\t *\n\t * This cannot be required to return `TNode`:\n\t * doing so breaks sub-classing of schema since they don't overload this method with a more specific return type.\n\t * @sealed @system\n\t */\n\tcreateFromInsertable(data: TInsertable): Unhydrated<TreeNode | TreeLeafValue>;\n}\n\n/**\n * Symbol for use by {@link TreeNodeSchemaCorePrivate}.\n */\nexport const privateDataSymbol = Symbol(\"PrivateData\");\n\n/**\n * {@link TreeNodeSchemaCore} extended with some non-exported APIs.\n */\nexport interface TreeNodeSchemaCorePrivate<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTCustomMetadata = unknown,\n> extends TreeNodeSchemaCore<\n\t\tName,\n\t\tKind,\n\t\tImplicitlyConstructable,\n\t\tInfo,\n\t\tTInsertable,\n\t\tTCustomMetadata\n\t> {\n\t/**\n\t * Package private data provided by all {@link TreeNodeSchema}.\n\t * @remarks\n\t * Users can add custom statics to schema classes.\n\t * To reduce the risk of such statics colliding with properties used to implement the schema,\n\t * some of the private APIs are grouped together under this symbol.\n\t *\n\t * Note that there are still some properties which are not under a symbol and thus expose some risk of name collisions.\n\t * See {@link TreeNodeValid} for some such properties.\n\t */\n\treadonly [privateDataSymbol]: TreeNodeSchemaPrivateData;\n}\n\n/**\n * Package private data provided by all {@link TreeNodeSchema}.\n * @remarks\n * This data needs to be available before lazy schema references are resolved.\n * For data which is only available after lazy schema references are resolved,\n * see {@link TreeNodeSchemaInitializedData}, which can be accessed via {@link TreeNodeSchemaPrivateData.idempotentInitialize}.\n */\nexport interface TreeNodeSchemaPrivateData {\n\t/**\n\t * All possible annotated allowed types that a field under a node with this schema could have.\n\t * @remarks\n\t * In this case \"field\" includes anything that is a field in the internal (flex-tree) abstraction layer.\n\t * This includes the content field for arrays, and all the fields for map nodes.\n\t * If this node does not have fields (and thus is a leaf), the array will be empty.\n\t * @privateRemarks\n\t * If this is stabilized, it will live alongside the childTypes property on {@link TreeNodeSchemaCore}.\n\t * @system\n\t */\n\treadonly childAllowedTypes: readonly AllowedTypesFull[];\n\n\t/**\n\t * Idempotent initialization function that pre-caches data and can dereference lazy schema references.\n\t */\n\tidempotentInitialize(): TreeNodeSchemaInitializedData;\n}\n\n/**\n * Additional data about a given schema which is private to this package.\n * @remarks\n * Created by {@link TreeNodeValid.oneTimeSetup} and can involve dereferencing lazy schema references.\n */\nexport interface TreeNodeSchemaInitializedData {\n\t/**\n\t * All possible annotated allowed types that a field under a node with this schema could have.\n\t * @remarks\n\t * In this case \"field\" includes anything that is a field in the internal (flex-tree) abstraction layer.\n\t * This includes the content field for arrays, and all the fields for map nodes.\n\t * If this node does not have fields (and thus is a leaf), the array will be empty.\n\t *\n\t * This set cannot be used before the schema in it have been defined:\n\t * more specifically, when using lazy schema references (for example to make foreword references to schema which have not yet been defined),\n\t * users must wait until after the schema are defined to access this array.\n\t *\n\t * @privateRemarks\n\t * If this is stabilized, it will live alongside the childTypes property on {@link TreeNodeSchemaCore}.\n\t * @system\n\t */\n\treadonly childAllowedTypes: readonly AllowedTypesFullEvaluated[];\n\n\t/**\n\t * A {@link Context} which can be used for unhydrated nodes of this schema.\n\t */\n\treadonly context: Context;\n\n\t/**\n\t * Checks if data might be schema-compatible.\n\t *\n\t * @returns false if `data` is incompatible with `type` based on a cheap/shallow check.\n\t *\n\t * Note that this may return true for cases where data is incompatible, but it must not return false in cases where the data is compatible.\n\t */\n\tshallowCompatibilityTest(data: FactoryContent): CompatibilityLevel;\n\n\t/**\n\t * Convert data to a {@link FlexContent} representation.\n\t * @remarks\n\t * Data must be compatible with the schema according to {@link shallowCompatibilityTest}.\n\t *\n\t * TODO: use of `allowedTypes` is for fallbacks (for example NaN -\\> null).\n\t * This behavior should be moved to shallowCompatibilityTest instead.\n\t */\n\ttoFlexContent(data: FactoryContent, allowedTypes: ReadonlySet<TreeNodeSchema>): FlexContent;\n}\n\nexport type FlexContent = [NodeData, Map<FieldKey, UnhydratedFlexTreeField>];\n\n/**\n * Indicates a compatibility level for inferring a schema to apply to insertable data.\n * @remarks\n * Each schema allowed at a location in the tree has its compatibility level checked against the data being inserted.\n * The compatibility is considered unambiguous if there is a single schema with a higher compatibility than all others.\n *\n * This approach allows adding new compatible formats as a non breaking change.\n * If the new format was already compatible with some other schema, it can still be added as non-breaking as long as a lower compatibility level is used.\n * For example, support for constructing maps from record like objects was added in Fluid Framework 2.2.\n * This format (an object with fields) was already compatible with Object nodes at compatibility level Normal so the new format support for maps was added at compatibility level Low.\n * This ensures that existing code that was using object literals as insertable content where both objects and maps were allowed will continue to work,\n * assuming the objects are intended as ObjectNodes.\n * However new code can now be written using record like objects to construct maps, as long as the schema does not also allow Object nodes which are compatible with the data in that location.\n *\n * @see {@link ITreeConfigurationOptions.preventAmbiguity} for a related setting which interacts with this in a somewhat complex way.\n */\nexport enum CompatibilityLevel {\n\t/**\n\t * Not compatible. Constructor typing indicates incompatibility.\n\t */\n\tNone = 0,\n\t/**\n\t * Additional compatibility cases added in Fluid Framework 2.2.\n\t */\n\tLow = 1,\n\t/**\n\t * Compatible in Fluid Framework 2.0.\n\t */\n\tNormal = 2,\n}\n\n/**\n * Downcasts a {@link TreeNodeSchemaCore} to {@link TreeNodeSchemaCorePrivate} and get its {@link TreeNodeSchemaPrivateData}.\n */\nexport function getTreeNodeSchemaPrivateData(\n\tschema: TreeNodeSchemaCore<string, NodeKind, boolean>,\n): TreeNodeSchemaPrivateData {\n\tassert(\n\t\tprivateDataSymbol in schema,\n\t\t0xbc9 /* All implementations of TreeNodeSchemaCore must also implement TreeNodeSchemaCorePrivate */,\n\t);\n\tconst schemaValid = schema as TreeNodeSchemaCorePrivate;\n\treturn schemaValid[privateDataSymbol];\n}\n\n/**\n * Kind of tree node.\n * @remarks\n * More kinds may be added over time, so do not assume this is an exhaustive set.\n * @public\n */\nexport enum NodeKind {\n\t/**\n\t * A node which serves as a map, storing children under string keys.\n\t */\n\tMap = 0,\n\t/**\n\t * A node which serves as an array, storing children in an ordered sequence.\n\t */\n\tArray = 1,\n\t/**\n\t * A node which stores a heterogenous collection of children in named fields.\n\t * @remarks\n\t * Each field gets its own schema.\n\t */\n\tObject = 2,\n\t/**\n\t * A node which stores a single leaf value.\n\t */\n\tLeaf = 3,\n\t/**\n\t * A node which serves as a record, storing children under string keys.\n\t */\n\tRecord = 4,\n}\n\n/**\n * Metadata associated with a Node Schema.\n *\n * @remarks Specified via {@link NodeSchemaOptions.metadata}.\n *\n * @sealed\n * @public\n */\nexport interface NodeSchemaMetadata<out TCustomMetadata = unknown> {\n\t/**\n\t * User-defined metadata.\n\t */\n\treadonly custom?: TCustomMetadata | undefined;\n\n\t/**\n\t * The description of the Node Schema.\n\t *\n\t * @remarks\n\t *\n\t * If provided, will be used by the system in scenarios where a description of the kind of node is useful.\n\t * E.g., when converting a Node Schema to {@link https://json-schema.org/ | JSON Schema}, this description will be\n\t * used as the `description` property.\n\t */\n\treadonly description?: string | undefined;\n}\n\n/**\n * Returns true if the given schema is a {@link TreeNodeSchemaClass}, or otherwise false if it is a {@link TreeNodeSchemaNonClass}.\n * @internal\n */\nexport function isTreeNodeSchemaClass<\n\tName extends string,\n\tKind extends NodeKind,\n\tTNode extends TreeNode | TreeLeafValue,\n\tTBuild,\n\tImplicitlyConstructable extends boolean,\n\tInfo,\n>(\n\tschema:\n\t\t| TreeNodeSchema<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>\n\t\t| TreeNodeSchemaClass<Name, Kind, TNode & TreeNode, TBuild, ImplicitlyConstructable, Info>,\n): schema is TreeNodeSchemaClass<\n\tName,\n\tKind,\n\tTNode & TreeNode,\n\tTBuild,\n\tImplicitlyConstructable,\n\tInfo\n> {\n\treturn schema.constructor !== undefined;\n}\n\n/**\n * Takes in `TreeNodeSchema[]` and returns a TypedNode union.\n * @privateRemarks\n * If a schema is both TreeNodeSchemaClass and TreeNodeSchemaNonClass, prefer TreeNodeSchemaClass since that includes subclasses properly.\n * @public\n */\nexport type NodeFromSchema<T extends TreeNodeSchema> = T extends TreeNodeSchemaClass<\n\tstring,\n\tNodeKind,\n\tinfer TNode\n>\n\t? TNode\n\t: T extends TreeNodeSchemaNonClass<string, NodeKind, infer TNode>\n\t\t? TNode\n\t\t: never;\n\n/**\n * Data which can be used as a node to be inserted.\n * Either an unhydrated node, or content to build a new node.\n *\n * @see {@link Input}\n *\n * @typeparam TSchemaInput - Schema to process.\n * @typeparam T - Do not specify: default value used as implementation detail.\n * @privateRemarks\n * This can't really be fully correct, since TreeNodeSchema's TNode is generally use covariantly but this code uses it contravariantly.\n * That makes this TreeNodeSchema actually invariant with respect to TNode, but doing that would break all `extends TreeNodeSchema` clauses.\n * As is, this works correctly in most realistic use-cases.\n *\n * One special case this makes is if the result of NodeFromSchema contains TreeNode, this must be an under constrained schema, so the result is set to never.\n * Note that applying UnionToIntersection on the result of NodeFromSchema<T> does not work since it breaks booleans.\n *\n * @public\n */\nexport type InsertableTypedNode<\n\tTSchema extends TreeNodeSchema,\n\tT = UnionToIntersection<TSchema>,\n> =\n\t| (T extends TreeNodeSchema<string, NodeKind, TreeNode | TreeLeafValue, never, true>\n\t\t\t? NodeBuilderData<T>\n\t\t\t: never)\n\t| (T extends TreeNodeSchema\n\t\t\t? Unhydrated<TreeNode extends NodeFromSchema<T> ? never : NodeFromSchema<T>>\n\t\t\t: never);\n\n/**\n * Given a node's schema, return the corresponding object from which the node could be built.\n * @privateRemarks\n * This uses TreeNodeSchemaCore, and thus depends on TreeNodeSchemaCore.createFromInsertable for the typing.\n * This works almost the same as using TreeNodeSchema,\n * except that the more complex typing in TreeNodeSchema case breaks for non-class schema and leaks in `undefined` from optional crete parameters.\n * @system @public\n */\nexport type NodeBuilderData<T extends TreeNodeSchemaCore<string, NodeKind, boolean>> =\n\tT extends TreeNodeSchemaCore<string, NodeKind, boolean, unknown, infer TBuild>\n\t\t? TBuild\n\t\t: never;\n\n/**\n * Value that may be stored as a leaf node.\n * @remarks\n * Some limitations apply, see the documentation for {@link SchemaStatics.number} and {@link SchemaStatics.string} for those restrictions.\n * @public\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport type TreeLeafValue = number | string | boolean | IFluidHandle | null;\n"]}
|
|
1
|
+
{"version":3,"file":"treeNodeSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/core/treeNodeSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAqU7D;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AA6GvD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAN,IAAY,kBAaX;AAbD,WAAY,kBAAkB;IAC7B;;OAEG;IACH,2DAAQ,CAAA;IACR;;OAEG;IACH,yDAAO,CAAA;IACP;;OAEG;IACH,+DAAU,CAAA;AACX,CAAC,EAbW,kBAAkB,KAAlB,kBAAkB,QAa7B;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAC3C,MAAqD;IAErD,MAAM,CACL,iBAAiB,IAAI,MAAM,EAC3B,KAAK,CAAC,6FAA6F,CACnG,CAAC;IACF,MAAM,WAAW,GAAG,MAAmC,CAAC;IACxD,OAAO,WAAW,CAAC,iBAAiB,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,QAuBX;AAvBD,WAAY,QAAQ;IACnB;;OAEG;IACH,qCAAO,CAAA;IACP;;OAEG;IACH,yCAAS,CAAA;IACT;;;;OAIG;IACH,2CAAU,CAAA;IACV;;OAEG;IACH,uCAAQ,CAAA;IACR;;OAEG;IACH,2CAAU,CAAA;AACX,CAAC,EAvBW,QAAQ,KAAR,QAAQ,QAuBnB;AA4BD;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAQpC,MAE2F;IAS3F,OAAO,MAAM,CAAC,WAAW,KAAK,SAAS,CAAC;AACzC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { FieldKey, NodeData } from \"../../core/index.js\";\nimport type { UnionToIntersection } from \"../../util/index.js\";\nimport type { FactoryContent } from \"../unhydratedFlexTreeFromInsertable.js\";\n\nimport type { AllowedTypesFullEvaluated, AllowedTypesFull } from \"./allowedTypes.js\";\nimport type { Context } from \"./context.js\";\nimport type { SimpleNodeSchemaBase } from \"./simpleNodeSchemaBase.js\";\nimport type { TreeNode } from \"./treeNode.js\";\nimport type { InternalTreeNode, Unhydrated } from \"./types.js\";\nimport type { UnhydratedFlexTreeField } from \"./unhydratedFlexTree.js\";\n\n/**\n * Schema for a {@link TreeNode} or {@link TreeLeafValue}.\n *\n * @typeParam Name - The full (including scope) name/identifier for the schema.\n * @typeParam Kind - Which kind of node this schema is for.\n * @typeParam TNode - API for nodes that use this schema.\n * @typeParam TBuild - Data which can be used to construct an {@link Unhydrated} node of this type.\n * @typeParam Info - Data used when defining this schema.\n * @remarks\n * Captures the schema both as runtime data and compile time type information.\n * Use {@link SchemaFactory} to define schema.\n * Use `Tree.schema(value)` to lookup the schema for a {@link TreeNode} or {@link TreeLeafValue}.\n * @privateRemarks\n * TODO:\n * The long lists of type parameters here are awkward to deal with.\n * Switching to (or adding an option to use)\n * an interface based pattern with unordered named parameters for types like this would be a good idea.\n * The related `@system` types should be simple to port to the new pattern, but stable public one like this will need to support both:\n * the new one could either be added as a system type, or be recommended to replace this one (deprecating it).\n * @sealed @public\n */\nexport type TreeNodeSchema<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue,\n\tTBuild = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTCustomMetadata = unknown,\n> =\n\t| (TNode extends TreeNode\n\t\t\t? TreeNodeSchemaClass<\n\t\t\t\t\tName,\n\t\t\t\t\tKind,\n\t\t\t\t\tTNode,\n\t\t\t\t\tTBuild,\n\t\t\t\t\tImplicitlyConstructable,\n\t\t\t\t\tInfo,\n\t\t\t\t\tnever,\n\t\t\t\t\tTCustomMetadata\n\t\t\t\t>\n\t\t\t: never)\n\t| TreeNodeSchemaNonClass<\n\t\t\tName,\n\t\t\tKind,\n\t\t\tTNode,\n\t\t\tTBuild,\n\t\t\tImplicitlyConstructable,\n\t\t\tInfo,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t >;\n\n/**\n * Schema which is not a class.\n * @remarks\n * This is used for schema which cannot have their instances constructed using constructors, like leaf schema.\n * @privateRemarks\n * Non-class based schema can have issues with recursive types due to https://github.com/microsoft/TypeScript/issues/55832.\n * @system @sealed @public\n */\nexport type TreeNodeSchemaNonClass<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTConstructorExtra = never,\n\tTCustomMetadata = unknown,\n> = TreeNodeSchemaCore<\n\tName,\n\tKind,\n\tImplicitlyConstructable,\n\tInfo,\n\tTInsertable,\n\tTCustomMetadata\n> &\n\t(undefined extends TConstructorExtra\n\t\t? {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @privateRemarks\n\t\t\t\t * Also allows InternalTreeNode.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\tcreate(data?: TInsertable | TConstructorExtra): TNode;\n\t\t\t}\n\t\t: {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @privateRemarks\n\t\t\t\t * Also allows InternalTreeNode.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\tcreate(data: TInsertable | TConstructorExtra): TNode;\n\t\t\t});\n\n/**\n * Tree node schema which is implemented using a class.\n * @remarks\n * Instances of this class are nodes in the tree.\n * This is also a constructor so that it can be subclassed.\n *\n * Using classes in this way allows introducing a named type and a named value at the same time, helping keep the runtime and compile time information together and easy to refer to un a uniform way.\n * Additionally, this works around https://github.com/microsoft/TypeScript/issues/55832 which causes similar patterns with less explicit types to infer \"any\" in the d.ts file.\n *\n * When sub-classing a a `TreeNodeSchemaClass`, some extra rules must be followed:\n *\n * - Only ever use a single class from the schema's class hierarchy within a document and its schema.\n * For example, if using {@link SchemaFactory.object} you can do:\n * ```typescript\n * // Recommended \"customizable\" object schema pattern.\n * class Good extends schemaFactory.object(\"A\", {\n * \texampleField: schemaFactory.number,\n * }) {\n * \tpublic exampleCustomMethod(): void {\n * \t\tthis.exampleField++;\n * \t}\n * }\n * ```\n * But should avoid:\n * ```typescript\n * // This by itself is ok, and opts into \"POJO mode\".\n * const base = schemaFactory.object(\"A\", {});\n * // This is a bad pattern since it leaves two classes in scope which derive from the same SchemaFactory defined class.\n * // If both get used, its an error!\n * class Invalid extends base {}\n * ```\n *\n * - Do not modify the constructor input parameter types or values:\n * ```typescript\n * class Invalid extends schemaFactory.object(\"A\", {\n * \texampleField: schemaFactory.number,\n * }) {\n * \t// This Modifies the type of the constructor input.\n * \t// This is unsupported due to programmatic access to the constructor being used internally.\n * \tpublic constructor(a: number) {\n * \t\tsuper({ exampleField: a });\n * \t}\n * }\n * ```\n * @sealed @public\n */\nexport type TreeNodeSchemaClass<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode = TreeNode,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTConstructorExtra = never,\n\tTCustomMetadata = unknown,\n> = TreeNodeSchemaCore<\n\tName,\n\tKind,\n\tImplicitlyConstructable,\n\tInfo,\n\tTInsertable,\n\tTCustomMetadata\n> &\n\t(undefined extends TConstructorExtra\n\t\t? {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @remarks\n\t\t\t\t * This constructor is also used internally to construct hydrated nodes with a different parameter type.\n\t\t\t\t * Therefore, overriding this constructor with different argument types is not type-safe and is not supported.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\t// The approach suggested by the linter here is more concise, but ir break intellisense for the constructor.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t\t\t\tnew (data?: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;\n\t\t\t}\n\t\t: {\n\t\t\t\t/**\n\t\t\t\t * Constructs an {@link Unhydrated} node with this schema.\n\t\t\t\t * @remarks\n\t\t\t\t * This constructor is also used internally to construct hydrated nodes with a different parameter type.\n\t\t\t\t * Therefore, overriding this constructor with different argument types is not type-safe and is not supported.\n\t\t\t\t * @sealed\n\t\t\t\t */\n\t\t\t\t// The approach suggested by the linter here is more concise, but ir break intellisense for the constructor.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t\t\t\tnew (data: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;\n\t\t\t});\n\n/**\n * Internal helper for utilities that return schema which can be used in class and non class formats depending on the API exposing it.\n */\nexport type TreeNodeSchemaBoth<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode extends TreeNode = TreeNode,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTConstructorExtra = never,\n\tTCustomMetadata = unknown,\n> = TreeNodeSchemaClass<\n\tName,\n\tKind,\n\tTNode,\n\tTInsertable,\n\tImplicitlyConstructable,\n\tInfo,\n\tTConstructorExtra,\n\tTCustomMetadata\n> &\n\tTreeNodeSchemaNonClass<\n\t\tName,\n\t\tKind,\n\t\tTNode,\n\t\tTInsertable,\n\t\tImplicitlyConstructable,\n\t\tInfo,\n\t\tTConstructorExtra,\n\t\tTCustomMetadata\n\t>;\n\n/**\n * Data common to all tree node schema.\n *\n * @remarks\n * Implementation detail of {@link TreeNodeSchema} which should be accessed instead of referring to this type directly.\n *\n * @privateRemarks\n * All implementations must implement {@link TreeNodeSchemaCorePrivate} as well.\n *\n * @sealed @public\n */\nexport interface TreeNodeSchemaCore<\n\tout Name extends string,\n\tout Kind extends NodeKind,\n\tout ImplicitlyConstructable extends boolean,\n\tout Info = unknown,\n\tout TInsertable = never,\n\tout TCustomMetadata = unknown,\n> extends SimpleNodeSchemaBase<Kind, TCustomMetadata> {\n\t/**\n\t * Unique (within a document's schema) identifier used to associate nodes with their schema.\n\t * @remarks\n\t * This is used when encoding nodes, and when decoding nodes to re-associate them with the schema.\n\t * Since this decoding may happen in a different version of the application (or even a different application altogether),\n\t * this identifier should generally correspond to some specific semantics for the data (how to interpret the node with this identifier).\n\t * Any time the semantics change such that data would be misinterpreted if the old semantics were applied\n\t * (for example the units of a value are changed),\n\t * it is best practice to pick a new identifier.\n\t */\n\treadonly identifier: Name;\n\n\t/**\n\t * Data used to define this schema.\n\t *\n\t * @remarks\n\t * The format depends on the kind of node it is for.\n\t * For example, the \"object\" node kind could store the field schema here.\n\t */\n\treadonly info: Info;\n\n\t/**\n\t * When constructing insertable content,\n\t * data that could be passed to the node's constructor can be used instead of an {@link Unhydrated} node\n\t * iff implicitlyConstructable is true.\n\t * @privateRemarks\n\t * Currently the logic for traversing insertable content,\n\t * both to build trees and to hydrate them does not defer to the schema classes to handle the policy,\n\t * so if their constructors differ from what is supported, some cases will not work.\n\t * Setting this to false adjusts the insertable types to disallow cases which could be impacted by these inconsistencies.\n\t */\n\treadonly implicitlyConstructable: ImplicitlyConstructable;\n\n\t/**\n\t * All possible schema that a direct child of a node with this schema could have.\n\t *\n\t * Equivalently, this is also all schema directly referenced when defining this schema's allowed child types,\n\t * which is also the same as the set of schema referenced directly by the `Info` type parameter and the `info` property.\n\t * This property is simply re-exposing that information in an easier to traverse format consistent across all node kinds.\n\t * @remarks\n\t * Some kinds of nodes may have additional restrictions on children:\n\t * this set simply enumerates all directly referenced schema, and can be use to walk over all referenced schema types.\n\t *\n\t * This set cannot be used before the schema in it have been defined:\n\t * more specifically, when using lazy schema references (for example to make foreword references to schema which have not yet been defined),\n\t * users must wait until after the schema are defined to access this set.\n\t * @privateRemarks\n\t * Currently there isn't much use for this in the public API,\n\t * and it's possible this will want to be tweaked or renamed as part of a larger schema reflection API surface that might be added later.\n\t * To keep options option, this is marked `@system` for now.\n\t * @system\n\t */\n\treadonly childTypes: ReadonlySet<TreeNodeSchema>;\n\n\t/**\n\t * Constructs an instance of this node type.\n\t * @remarks\n\t * Due to TypeScript limitations, the return type of this method can not be very specific.\n\t * For {@link TreeNodeSchemaClass} prefer using the constructor directly for better typing.\n\t * For {@link TreeNodeSchemaNonClass} use `create`.\n\t *\n\t * @privateRemarks\n\t * This method signature provides a way to infer `TInsertable` without relying on the constructor, and to construct nodes from schema of unknown kind.\n\t * This makes customizations of the constructor not impact the typing of insertable content, allowing customization of the constructor,\n\t * as long as doing so only adds additional supported cases.\n\t *\n\t * This cannot be required to return `TNode`:\n\t * doing so breaks sub-classing of schema since they don't overload this method with a more specific return type.\n\t * @sealed @system\n\t */\n\tcreateFromInsertable(data: TInsertable): Unhydrated<TreeNode | TreeLeafValue>;\n}\n\n/**\n * Symbol for use by {@link TreeNodeSchemaCorePrivate}.\n */\nexport const privateDataSymbol = Symbol(\"PrivateData\");\n\n/**\n * {@link TreeNodeSchemaCore} extended with some non-exported APIs.\n */\nexport interface TreeNodeSchemaCorePrivate<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTInsertable = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n\tTCustomMetadata = unknown,\n> extends TreeNodeSchemaCore<\n\t\tName,\n\t\tKind,\n\t\tImplicitlyConstructable,\n\t\tInfo,\n\t\tTInsertable,\n\t\tTCustomMetadata\n\t> {\n\t/**\n\t * Package private data provided by all {@link TreeNodeSchema}.\n\t * @remarks\n\t * Users can add custom statics to schema classes.\n\t * To reduce the risk of such statics colliding with properties used to implement the schema,\n\t * some of the private APIs are grouped together under this symbol.\n\t *\n\t * Note that there are still some properties which are not under a symbol and thus expose some risk of name collisions.\n\t * See {@link TreeNodeValid} for some such properties.\n\t */\n\treadonly [privateDataSymbol]: TreeNodeSchemaPrivateData;\n}\n\n/**\n * Package private data provided by all {@link TreeNodeSchema}.\n * @remarks\n * This data needs to be available before lazy schema references are resolved.\n * For data which is only available after lazy schema references are resolved,\n * see {@link TreeNodeSchemaInitializedData}, which can be accessed via {@link TreeNodeSchemaPrivateData.idempotentInitialize}.\n */\nexport interface TreeNodeSchemaPrivateData {\n\t/**\n\t * All possible annotated allowed types that a field under a node with this schema could have.\n\t * @remarks\n\t * In this case \"field\" includes anything that is a field in the internal (flex-tree) abstraction layer.\n\t * This includes the content field for arrays, and all the fields for map nodes.\n\t * If this node does not have fields (and thus is a leaf), the array will be empty.\n\t * @privateRemarks\n\t * If this is stabilized, it will live alongside the childTypes property on {@link TreeNodeSchemaCore}.\n\t * @system\n\t */\n\treadonly childAllowedTypes: readonly AllowedTypesFull[];\n\n\t/**\n\t * Idempotent initialization function that pre-caches data and can dereference lazy schema references.\n\t */\n\tidempotentInitialize(): TreeNodeSchemaInitializedData;\n}\n\n/**\n * Additional data about a given schema which is private to this package.\n * @remarks\n * Created by {@link TreeNodeValid.oneTimeSetup} and can involve dereferencing lazy schema references.\n */\nexport interface TreeNodeSchemaInitializedData {\n\t/**\n\t * All possible annotated allowed types that a field under a node with this schema could have.\n\t * @remarks\n\t * In this case \"field\" includes anything that is a field in the internal (flex-tree) abstraction layer.\n\t * This includes the content field for arrays, and all the fields for map nodes.\n\t * If this node does not have fields (and thus is a leaf), the array will be empty.\n\t *\n\t * This set cannot be used before the schema in it have been defined:\n\t * more specifically, when using lazy schema references (for example to make foreword references to schema which have not yet been defined),\n\t * users must wait until after the schema are defined to access this array.\n\t *\n\t * @privateRemarks\n\t * If this is stabilized, it will live alongside the childTypes property on {@link TreeNodeSchemaCore}.\n\t * @system\n\t */\n\treadonly childAllowedTypes: readonly AllowedTypesFullEvaluated[];\n\n\t/**\n\t * A {@link Context} which can be used for unhydrated nodes of this schema.\n\t */\n\treadonly context: Context;\n\n\t/**\n\t * Checks if data might be schema-compatible.\n\t *\n\t * @returns false if `data` is incompatible with `type` based on a cheap/shallow check.\n\t *\n\t * Note that this may return true for cases where data is incompatible, but it must not return false in cases where the data is compatible.\n\t */\n\tshallowCompatibilityTest(data: FactoryContent): CompatibilityLevel;\n\n\t/**\n\t * Convert data to a {@link FlexContent} representation.\n\t * @remarks\n\t * Data must be compatible with the schema according to {@link shallowCompatibilityTest}.\n\t *\n\t * TODO: use of `allowedTypes` is for fallbacks (for example NaN -\\> null).\n\t * This behavior should be moved to shallowCompatibilityTest instead.\n\t */\n\ttoFlexContent(data: FactoryContent, allowedTypes: ReadonlySet<TreeNodeSchema>): FlexContent;\n}\n\nexport type FlexContent = [NodeData, Map<FieldKey, UnhydratedFlexTreeField>];\n\n/**\n * Indicates a compatibility level for inferring a schema to apply to insertable data.\n * @remarks\n * Each schema allowed at a location in the tree has its compatibility level checked against the data being inserted.\n * The compatibility is considered unambiguous if there is a single schema with a higher compatibility than all others.\n *\n * This approach allows adding new compatible formats as a non breaking change.\n * If the new format was already compatible with some other schema, it can still be added as non-breaking as long as a lower compatibility level is used.\n * For example, support for constructing maps from record like objects was added in Fluid Framework 2.2.\n * This format (an object with fields) was already compatible with Object nodes at compatibility level Normal so the new format support for maps was added at compatibility level Low.\n * This ensures that existing code that was using object literals as insertable content where both objects and maps were allowed will continue to work,\n * assuming the objects are intended as ObjectNodes.\n * However new code can now be written using record like objects to construct maps, as long as the schema does not also allow Object nodes which are compatible with the data in that location.\n *\n * @see {@link ITreeConfigurationOptions.preventAmbiguity} for a related setting which interacts with this in a somewhat complex way.\n */\nexport enum CompatibilityLevel {\n\t/**\n\t * Not compatible. Constructor typing indicates incompatibility.\n\t */\n\tNone = 0,\n\t/**\n\t * Additional compatibility cases added in Fluid Framework 2.2.\n\t */\n\tLow = 1,\n\t/**\n\t * Compatible in Fluid Framework 2.0.\n\t */\n\tNormal = 2,\n}\n\n/**\n * Downcasts a {@link TreeNodeSchemaCore} to {@link TreeNodeSchemaCorePrivate} and get its {@link TreeNodeSchemaPrivateData}.\n */\nexport function getTreeNodeSchemaPrivateData(\n\tschema: TreeNodeSchemaCore<string, NodeKind, boolean>,\n): TreeNodeSchemaPrivateData {\n\tassert(\n\t\tprivateDataSymbol in schema,\n\t\t0xbc9 /* All implementations of TreeNodeSchemaCore must also implement TreeNodeSchemaCorePrivate */,\n\t);\n\tconst schemaValid = schema as TreeNodeSchemaCorePrivate;\n\treturn schemaValid[privateDataSymbol];\n}\n\n/**\n * Kind of tree node.\n * @remarks\n * More kinds may be added over time, so do not assume this is an exhaustive set.\n * @public\n */\nexport enum NodeKind {\n\t/**\n\t * A node which serves as a map, storing children under string keys.\n\t */\n\tMap = 0,\n\t/**\n\t * A node which serves as an array, storing children in an ordered sequence.\n\t */\n\tArray = 1,\n\t/**\n\t * A node which stores a heterogenous collection of children in named fields.\n\t * @remarks\n\t * Each field gets its own schema.\n\t */\n\tObject = 2,\n\t/**\n\t * A node which stores a single leaf value.\n\t */\n\tLeaf = 3,\n\t/**\n\t * A node which serves as a record, storing children under string keys.\n\t */\n\tRecord = 4,\n}\n\n/**\n * Metadata associated with a Node Schema.\n *\n * @remarks Specified via {@link NodeSchemaOptions.metadata}.\n *\n * @sealed\n * @public\n */\nexport interface NodeSchemaMetadata<out TCustomMetadata = unknown> {\n\t/**\n\t * User-defined metadata.\n\t */\n\treadonly custom?: TCustomMetadata | undefined;\n\n\t/**\n\t * The description of the Node Schema.\n\t *\n\t * @remarks\n\t *\n\t * If provided, will be used by the system in scenarios where a description of the kind of node is useful.\n\t * E.g., when converting a Node Schema to {@link https://json-schema.org/ | JSON Schema}, this description will be\n\t * used as the `description` property.\n\t */\n\treadonly description?: string | undefined;\n}\n\n/**\n * Returns true if the given schema is a {@link TreeNodeSchemaClass}, or otherwise false if it is a {@link TreeNodeSchemaNonClass}.\n * @internal\n */\nexport function isTreeNodeSchemaClass<\n\tName extends string,\n\tKind extends NodeKind,\n\tTNode extends TreeNode | TreeLeafValue,\n\tTBuild,\n\tImplicitlyConstructable extends boolean,\n\tInfo,\n>(\n\tschema:\n\t\t| TreeNodeSchema<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>\n\t\t| TreeNodeSchemaClass<Name, Kind, TNode & TreeNode, TBuild, ImplicitlyConstructable, Info>,\n): schema is TreeNodeSchemaClass<\n\tName,\n\tKind,\n\tTNode & TreeNode,\n\tTBuild,\n\tImplicitlyConstructable,\n\tInfo\n> {\n\treturn schema.constructor !== undefined;\n}\n\n/**\n * Takes in `TreeNodeSchema[]` and returns a TypedNode union.\n * @privateRemarks\n * If a schema is both TreeNodeSchemaClass and TreeNodeSchemaNonClass, prefer TreeNodeSchemaClass since that includes subclasses properly.\n * @public\n */\nexport type NodeFromSchema<T extends TreeNodeSchema> =\n\tT extends TreeNodeSchemaClass<string, NodeKind, infer TNode>\n\t\t? TNode\n\t\t: T extends TreeNodeSchemaNonClass<string, NodeKind, infer TNode>\n\t\t\t? TNode\n\t\t\t: never;\n\n/**\n * Data which can be used as a node to be inserted.\n * Either an unhydrated node, or content to build a new node.\n *\n * @see {@link Input}\n *\n * @typeparam TSchemaInput - Schema to process.\n * @typeparam T - Do not specify: default value used as implementation detail.\n * @privateRemarks\n * This can't really be fully correct, since TreeNodeSchema's TNode is generally use covariantly but this code uses it contravariantly.\n * That makes this TreeNodeSchema actually invariant with respect to TNode, but doing that would break all `extends TreeNodeSchema` clauses.\n * As is, this works correctly in most realistic use-cases.\n *\n * One special case this makes is if the result of NodeFromSchema contains TreeNode, this must be an under constrained schema, so the result is set to never.\n * Note that applying UnionToIntersection on the result of NodeFromSchema<T> does not work since it breaks booleans.\n *\n * @public\n */\nexport type InsertableTypedNode<\n\tTSchema extends TreeNodeSchema,\n\tT = UnionToIntersection<TSchema>,\n> =\n\t| (T extends TreeNodeSchema<string, NodeKind, TreeNode | TreeLeafValue, never, true>\n\t\t\t? NodeBuilderData<T>\n\t\t\t: never)\n\t| (T extends TreeNodeSchema\n\t\t\t? Unhydrated<TreeNode extends NodeFromSchema<T> ? never : NodeFromSchema<T>>\n\t\t\t: never);\n\n/**\n * Given a node's schema, return the corresponding object from which the node could be built.\n * @privateRemarks\n * This uses TreeNodeSchemaCore, and thus depends on TreeNodeSchemaCore.createFromInsertable for the typing.\n * This works almost the same as using TreeNodeSchema,\n * except that the more complex typing in TreeNodeSchema case breaks for non-class schema and leaks in `undefined` from optional crete parameters.\n * @system @public\n */\nexport type NodeBuilderData<T extends TreeNodeSchemaCore<string, NodeKind, boolean>> =\n\tT extends TreeNodeSchemaCore<string, NodeKind, boolean, unknown, infer TBuild>\n\t\t? TBuild\n\t\t: never;\n\n/**\n * Value that may be stored as a leaf node.\n * @remarks\n * Some limitations apply, see the documentation for {@link SchemaStatics.number} and {@link SchemaStatics.string} for those restrictions.\n * @public\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport type TreeLeafValue = number | string | boolean | IFluidHandle | null;\n"]}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
export { typeNameSymbol, typeSchemaSymbol, contentSchemaSymbol, type WithType, type TreeNodeSchema, type AnnotatedAllowedType, type AllowedTypesFullEvaluated, NodeKind, type TreeNodeSchemaClass, type TreeNodeSchemaNonClass, type TreeNodeSchemaCore, TreeNode, type Unhydrated, type InternalTreeNode, isTreeNode, tryDisposeTreeNode, HydratedContext, SimpleContextSlot, getInnerNode, getOrCreateNodeFromInnerNode, getOrCreateNodeFromInnerUnboxedNode, getKernel, type NodeFromSchema, isTreeNodeSchemaClass, type TreeNodeFromImplicitAllowedTypes, type InsertableTreeNodeFromImplicitAllowedTypes, type TreeLeafValue, type AllowedTypes, type InsertableTreeNodeFromAllowedTypes, type InsertableTypedNode, type NodeBuilderData, type Input, normalizeAllowedTypes, type NodeSchemaMetadata, type ImplicitAllowedTypes, type AllowedTypesMetadata, evaluateLazySchema, type UnannotateAllowedTypesList, type AllowedTypeMetadata, type AnnotatedAllowedTypes, SchemaUpgrade, type LazyItem, type FlexList, type FlexListToUnion, type ExtractItemType, walkNodeSchema, walkAllowedTypes, type SchemaVisitor, type SimpleNodeSchemaBase, withBufferedTreeEvents, type AnnotateAllowedTypesList, type AllowedTypesFull, type AllowedTypesFullFromMixed, AnnotatedAllowedTypesInternal, type NumberKeys, ExpectStored, createSchemaUpgrade, } from "./core/index.js";
|
|
6
6
|
export { walkFieldSchema } from "./walkFieldSchema.js";
|
|
7
7
|
export type { UnsafeUnknownSchema, Insertable } from "./unsafeUnknownSchema.js";
|
|
8
|
-
export { type ITree, type TreeView, type ViewableTree, type TreeViewEvents, TreeViewConfiguration, TreeViewConfigurationAlpha, type ITreeViewConfiguration, type SchemaCompatibilityStatus, type ITreeConfigurationOptions, SchemaFactory, scoped, SchemaFactoryBeta, type SchemaStaticsBeta, SchemaFactoryAlpha, type ObjectSchemaOptionsAlpha, type ObjectSchemaOptions, type ScopedSchemaName, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, treeNodeApi, type TreeNodeApi, type NodeChangedData, borrowCursorFromTreeNodeOrValue, exportConcise, importConcise, TreeBeta, type TreeChangeEventsBeta, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, type DirtyTreeStatus, trackDirtyNodes, type DirtyTreeMap, type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type JsonArrayNodeSchema, type JsonMapNodeSchema, type JsonLeafNodeSchema, type JsonSchemaRef, type JsonRefPath, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonTreeSchema, type JsonFieldSchema, type JsonLeafSchemaType, type JsonRecordNodeSchema, type JsonStringKeyPatternProperties, type TreeSchemaEncodingOptions, getJsonSchema, getSimpleSchema, type VerboseTreeNode, type TreeEncodingOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, SchemaCompatibilityTester, type Unenforced, type System_Unsafe, type ArrayNodeCustomizableSchemaUnsafe, type MapNodeCustomizableSchemaUnsafe, type TreeRecordNodeUnsafe, type UnannotateAllowedTypeUnsafe, type AnnotatedAllowedTypeUnsafe, type AnnotatedAllowedTypesUnsafe, type AllowedTypesFullUnsafe, type AllowedTypesFullFromMixedUnsafe, type UnannotateAllowedTypesListUnsafe, type AnnotateAllowedTypesListUnsafe, type TreeViewAlpha, type TreeViewBeta, type TreeBranch, type TreeBranchAlpha, type TreeBranchEvents, getPropertyKeyFromStoredKey, getStoredKey, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, type CustomTreeNode, type CustomTreeValue, tryStoredSchemaAsArray, type SchemaStatics, type ITreeAlpha, type TransactionConstraint, type TransactionConstraintAlpha, type NodeInDocumentConstraint, type NoChangeConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, rollback, generateSchemaFromSimpleSchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, type HandleConverter, allowUnused, type FieldSchemaAlphaUnsafe, getIdentifierFromNode, type ValidateRecursiveSchemaTemplate, type FixRecursiveRecursionLimit, schemaStatics, type TreeChangeEvents, type NodeSchemaOptions, type NodeSchemaOptionsAlpha, KeyEncodingOptions, type TreeParsingOptions, incrementalSummaryHint, incrementalEncodingPolicyForAllowedTypes, type SchemaFactory_base, encodeSchemaCompatibilitySnapshot, decodeSchemaCompatibilitySnapshot, exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, eraseSchemaDetails, eraseSchemaDetailsSubclassable, checkSchemaCompatibilitySnapshots, type SnapshotFileSystem, type SchemaCompatibilitySnapshotsOptions, } from "./api/index.js";
|
|
8
|
+
export { type ITree, type TreeView, type ViewableTree, type TreeViewEvents, TreeViewConfiguration, TreeViewConfigurationAlpha, type ITreeViewConfiguration, type SchemaCompatibilityStatus, type ITreeConfigurationOptions, SchemaFactory, scoped, SchemaFactoryBeta, type SchemaStaticsBeta, SchemaFactoryAlpha, type ObjectSchemaOptionsAlpha, type ObjectSchemaOptions, type ScopedSchemaName, type ValidateRecursiveSchema, type FixRecursiveArraySchema, adaptEnum, enumFromStrings, singletonSchema, treeNodeApi, type TreeNodeApi, type NodeChangedData, borrowCursorFromTreeNodeOrValue, exportConcise, importConcise, TreeBeta, type TreeChangeEventsBeta, type SimpleTreeIndex, type IdentifierIndex, createSimpleTreeIndex, createIdentifierIndex, type DirtyTreeStatus, trackDirtyNodes, type DirtyTreeMap, type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type JsonArrayNodeSchema, type JsonMapNodeSchema, type JsonLeafNodeSchema, type JsonSchemaRef, type JsonRefPath, type JsonNodeSchema, type JsonNodeSchemaBase, type JsonTreeSchema, type JsonFieldSchema, type JsonLeafSchemaType, type JsonRecordNodeSchema, type JsonStringKeyPatternProperties, type TreeSchemaEncodingOptions, getJsonSchema, getSimpleSchema, type VerboseTreeNode, type TreeEncodingOptions, type VerboseTree, extractPersistedSchema, comparePersistedSchema, type ConciseTree, SchemaCompatibilityTester, type Unenforced, type System_Unsafe, type ArrayNodeCustomizableSchemaUnsafe, type MapNodeCustomizableSchemaUnsafe, type TreeRecordNodeUnsafe, type UnannotateAllowedTypeUnsafe, type AnnotatedAllowedTypeUnsafe, type AnnotatedAllowedTypesUnsafe, type AllowedTypesFullUnsafe, type AllowedTypesFullFromMixedUnsafe, type UnannotateAllowedTypesListUnsafe, type AnnotateAllowedTypesListUnsafe, type TreeViewAlpha, type TreeViewBeta, type TreeBranch, type TreeBranchAlpha, type TreeBranchEvents, getPropertyKeyFromStoredKey, getStoredKey, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, type CustomTreeNode, type CustomTreeValue, tryStoredSchemaAsArray, type SchemaStatics, type ITreeAlpha, type TransactionConstraint, type TransactionConstraintAlpha, type NodeInDocumentConstraint, type NoChangeConstraint, type RunTransactionParams, type VoidTransactionCallbackStatus, type TransactionCallbackStatus, type TransactionResult, type TransactionResultExt, type TransactionResultSuccess, type TransactionResultFailed, rollback, generateSchemaFromSimpleSchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, type HandleConverter, allowUnused, type FieldSchemaAlphaUnsafe, getIdentifierFromNode, type ValidateRecursiveSchemaTemplate, type FixRecursiveRecursionLimit, schemaStatics, type TreeChangeEvents, type NodeSchemaOptions, type NodeSchemaOptionsAlpha, KeyEncodingOptions, type TreeParsingOptions, incrementalSummaryHint, incrementalEncodingPolicyForAllowedTypes, type SchemaFactory_base, encodeSchemaCompatibilitySnapshot, decodeSchemaCompatibilitySnapshot, exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, eraseSchemaDetails, eraseSchemaDetailsSubclassable, checkSchemaCompatibilitySnapshots, type SnapshotFileSystem, type SchemaCompatibilitySnapshotsOptions, createCustomizedFluidFrameworkScopedFactory, } from "./api/index.js";
|
|
9
9
|
export type { SimpleTreeSchema, SimpleNodeSchema, SimpleFieldSchema, SimpleLeafNodeSchema, SimpleMapNodeSchema, SimpleArrayNodeSchema, SimpleObjectNodeSchema, SimpleNodeSchemaBaseAlpha, SimpleObjectFieldSchema, SimpleRecordNodeSchema, SimpleAllowedTypeAttributes, SchemaType, } from "./simpleSchema.js";
|
|
10
10
|
export { type ImplicitFieldSchema, type TreeFieldFromImplicitField, FieldKind, FieldSchema, FieldSchemaAlpha, type InsertableTreeFieldFromImplicitField, type DefaultProvider, type FieldProps, type FieldPropsAlpha, normalizeFieldSchema, areFieldSchemaEqual, areImplicitFieldSchemaEqual, type ApplyKind, type FieldSchemaMetadata, type InsertableField, type ApplyKindInput, type ReadableField, type ReadSchema, } from "./fieldSchema.js";
|
|
11
11
|
export { tryGetTreeNodeForField } from "./getTreeNodeForField.js";
|
|
12
|
-
export { type ArrayNodeCustomizableSchema, type ArrayNodePojoEmulationSchema, ArrayNodeSchema, asIndex, isArrayNodeSchema, IterableTreeArrayContent, type ReadonlyArrayNode, TreeArrayNode, type MapNodeCustomizableSchema, type MapNodePojoEmulationSchema, MapNodeSchema, isMapNodeSchema, type TreeMapNode, type MapNodeInsertableData, type FieldHasDefault, type InsertableObjectFromSchemaRecord, type ObjectFromSchemaRecord, ObjectNodeSchema, type ObjectNodeSchemaPrivate, objectSchema, isObjectNodeSchema, type TreeObjectNode, setField, isRecordNodeSchema, type RecordNodeCustomizableSchema, type RecordNodeInsertableData, type RecordNodePojoEmulationSchema, RecordNodeSchema, type TreeRecordNode, } from "./node-kinds/index.js";
|
|
12
|
+
export { type ArrayNodeCustomizableSchema, type ArrayNodePojoEmulationSchema, ArrayNodeSchema, asIndex, isArrayNodeSchema, IterableTreeArrayContent, type ReadonlyArrayNode, TreeArrayNode, type MapNodeCustomizableSchema, type MapNodePojoEmulationSchema, MapNodeSchema, isMapNodeSchema, type TreeMapNode, type MapNodeInsertableData, type FieldHasDefault, type InsertableObjectFromSchemaRecord, type ObjectFromSchemaRecord, ObjectNodeSchema, type ObjectNodeSchemaPrivate, objectSchema, isObjectNodeSchema, type TreeObjectNode, setField, isRecordNodeSchema, type RecordNodeCustomizableSchema, type RecordNodeInsertableData, type RecordNodePojoEmulationSchema, RecordNodeSchema, type TreeRecordNode, type ArrayPlaceAnchor, createArrayInsertionAnchor, } from "./node-kinds/index.js";
|
|
13
13
|
export { unhydratedFlexTreeFromInsertable, type InsertableContent, type FactoryContent, type FactoryContentObject, } from "./unhydratedFlexTreeFromInsertable.js";
|
|
14
14
|
export { prepareForInsertion, prepareForInsertionContextless, } from "./prepareForInsertion.js";
|
|
15
15
|
export { toStoredSchema, convertFieldKind, toUpgradeSchema, toInitialSchema, toUnhydratedSchema, restrictiveStoredSchemaGenerationOptions, permissiveStoredSchemaGenerationOptions, } from "./toStoredSchema.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACj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B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,QAAQ,EACR,8BAA8B,EAC9B,yBAAyB,EACzB,cAAc,EACd,yBAAyB,EACzB,KAAK,eAAe,EACpB,WAAW,EACX,KAAK,sBAAsB,EAC3B,qBAAqB,EACrB,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,wCAAwC,EACxC,KAAK,kBAAkB,EACvB,iCAAiC,EACjC,iCAAiC,EACjC,iCAAiC,EACjC,iCAAiC,EACjC,kBAAkB,EAClB,kBAAkB,EAClB,8BAA8B,EAC9B,iCAAiC,EACjC,KAAK,kBAAkB,EACvB,KAAK,mCAAmC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,4BAA4B,EAC5B,mCAAmC,EACnC,SAAS,EACT,KAAK,cAAc,EACnB,qBAAqB,EACrB,KAAK,gCAAgC,EACrC,KAAK,0CAA0C,EAC/C,KA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contentSchemaSymbol, NodeKind, TreeNode, isTreeNode, tryDisposeTreeNode, HydratedContext, SimpleContextSlot, getInnerNode, getOrCreateNodeFromInnerNode, getOrCreateNodeFromInnerUnboxedNode, getKernel, isTreeNodeSchemaClass, normalizeAllowedTypes, evaluateLazySchema, SchemaUpgrade, walkNodeSchema, walkAllowedTypes, withBufferedTreeEvents, AnnotatedAllowedTypesInternal, ExpectStored, createSchemaUpgrade, } from "./core/index.js";
|
|
6
6
|
export { walkFieldSchema } from "./walkFieldSchema.js";
|
|
7
|
-
export { TreeViewConfiguration, TreeViewConfigurationAlpha, SchemaFactory, scoped, SchemaFactoryBeta, SchemaFactoryAlpha, adaptEnum, enumFromStrings, singletonSchema, treeNodeApi, borrowCursorFromTreeNodeOrValue, exportConcise, importConcise, TreeBeta, createSimpleTreeIndex, createIdentifierIndex, trackDirtyNodes, getJsonSchema, getSimpleSchema, extractPersistedSchema, comparePersistedSchema, SchemaCompatibilityTester, getPropertyKeyFromStoredKey, getStoredKey, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, tryStoredSchemaAsArray, rollback, generateSchemaFromSimpleSchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, allowUnused, getIdentifierFromNode, schemaStatics, KeyEncodingOptions, incrementalSummaryHint, incrementalEncodingPolicyForAllowedTypes, encodeSchemaCompatibilitySnapshot, decodeSchemaCompatibilitySnapshot, exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, eraseSchemaDetails, eraseSchemaDetailsSubclassable, checkSchemaCompatibilitySnapshots, } from "./api/index.js";
|
|
7
|
+
export { TreeViewConfiguration, TreeViewConfigurationAlpha, SchemaFactory, scoped, SchemaFactoryBeta, SchemaFactoryAlpha, adaptEnum, enumFromStrings, singletonSchema, treeNodeApi, borrowCursorFromTreeNodeOrValue, exportConcise, importConcise, TreeBeta, createSimpleTreeIndex, createIdentifierIndex, trackDirtyNodes, getJsonSchema, getSimpleSchema, extractPersistedSchema, comparePersistedSchema, SchemaCompatibilityTester, getPropertyKeyFromStoredKey, getStoredKey, tryGetSchema, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, conciseFromCursor, createFromCursor, asTreeViewAlpha, customFromCursorStored, tryStoredSchemaAsArray, rollback, generateSchemaFromSimpleSchema, replaceConciseTreeHandles, replaceHandles, replaceVerboseTreeHandles, allowUnused, getIdentifierFromNode, schemaStatics, KeyEncodingOptions, incrementalSummaryHint, incrementalEncodingPolicyForAllowedTypes, encodeSchemaCompatibilitySnapshot, decodeSchemaCompatibilitySnapshot, exportCompatibilitySchemaSnapshot, importCompatibilitySchemaSnapshot, checkCompatibility, eraseSchemaDetails, eraseSchemaDetailsSubclassable, checkSchemaCompatibilitySnapshots, createCustomizedFluidFrameworkScopedFactory, } from "./api/index.js";
|
|
8
8
|
export { FieldKind, FieldSchema, FieldSchemaAlpha, normalizeFieldSchema, areFieldSchemaEqual, areImplicitFieldSchemaEqual, } from "./fieldSchema.js";
|
|
9
9
|
export { tryGetTreeNodeForField } from "./getTreeNodeForField.js";
|
|
10
|
-
export { ArrayNodeSchema, asIndex, isArrayNodeSchema, IterableTreeArrayContent, TreeArrayNode, MapNodeSchema, isMapNodeSchema, ObjectNodeSchema, objectSchema, isObjectNodeSchema, setField, isRecordNodeSchema, RecordNodeSchema, } from "./node-kinds/index.js";
|
|
10
|
+
export { ArrayNodeSchema, asIndex, isArrayNodeSchema, IterableTreeArrayContent, TreeArrayNode, MapNodeSchema, isMapNodeSchema, ObjectNodeSchema, objectSchema, isObjectNodeSchema, setField, isRecordNodeSchema, RecordNodeSchema, createArrayInsertionAnchor, } from "./node-kinds/index.js";
|
|
11
11
|
export { unhydratedFlexTreeFromInsertable, } from "./unhydratedFlexTreeFromInsertable.js";
|
|
12
12
|
export { prepareForInsertion, prepareForInsertionContextless, } from "./prepareForInsertion.js";
|
|
13
13
|
export { toStoredSchema, convertFieldKind, toUpgradeSchema, toInitialSchema, toUnhydratedSchema, restrictiveStoredSchemaGenerationOptions, permissiveStoredSchemaGenerationOptions, } from "./toStoredSchema.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EAKnB,QAAQ,EAIR,QAAQ,EAGR,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,4BAA4B,EAC5B,mCAAmC,EACnC,SAAS,EAET,qBAAqB,EASrB,qBAAqB,EAIrB,kBAAkB,EAIlB,aAAa,EAKb,cAAc,EACd,gBAAgB,EAGhB,sBAAsB,EAItB,6BAA6B,EAE7B,YAAY,EACZ,mBAAmB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAKN,qBAAqB,EACrB,0BAA0B,EAI1B,aAAa,EACb,MAAM,EACN,iBAAiB,EAEjB,kBAAkB,EAMlB,SAAS,EACT,eAAe,EACf,eAAe,EACf,WAAW,EAGX,+BAA+B,EAC/B,aAAa,EACb,aAAa,EACb,QAAQ,EAIR,qBAAqB,EACrB,qBAAqB,EAErB,eAAe,EAkBf,aAAa,EACb,eAAe,EAIf,sBAAsB,EACtB,sBAAsB,EAEtB,yBAAyB,EAkBzB,2BAA2B,EAC3B,YAAY,EACZ,YAAY,EACZ,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EAGtB,sBAAsB,EActB,QAAQ,EACR,8BAA8B,EAC9B,yBAAyB,EACzB,cAAc,EACd,yBAAyB,EAEzB,WAAW,EAEX,qBAAqB,EAGrB,aAAa,EAIb,kBAAkB,EAElB,sBAAsB,EACtB,wCAAwC,EAExC,iCAAiC,EACjC,iCAAiC,EACjC,iCAAiC,EACjC,iCAAiC,EACjC,kBAAkB,EAClB,kBAAkB,EAClB,8BAA8B,EAC9B,iCAAiC,GAGjC,MAAM,gBAAgB,CAAC;AAexB,OAAO,EAGN,SAAS,EACT,WAAW,EACX,gBAAgB,EAKhB,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,GAO3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAGN,eAAe,EACf,OAAO,EACP,iBAAiB,EACjB,wBAAwB,EAExB,aAAa,EAGb,aAAa,EACb,eAAe,EAMf,gBAAgB,EAEhB,YAAY,EACZ,kBAAkB,EAElB,QAAQ,EACR,kBAAkB,EAIlB,gBAAgB,GAEhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,gCAAgC,GAIhC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,mBAAmB,EACnB,8BAA8B,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,wCAAwC,EACxC,uCAAuC,GACvC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,GACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAmB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttypeNameSymbol,\n\ttypeSchemaSymbol,\n\tcontentSchemaSymbol,\n\ttype WithType,\n\ttype TreeNodeSchema,\n\ttype AnnotatedAllowedType,\n\ttype AllowedTypesFullEvaluated,\n\tNodeKind,\n\ttype TreeNodeSchemaClass,\n\ttype TreeNodeSchemaNonClass,\n\ttype TreeNodeSchemaCore,\n\tTreeNode,\n\ttype Unhydrated,\n\ttype InternalTreeNode,\n\tisTreeNode,\n\ttryDisposeTreeNode,\n\tHydratedContext,\n\tSimpleContextSlot,\n\tgetInnerNode,\n\tgetOrCreateNodeFromInnerNode,\n\tgetOrCreateNodeFromInnerUnboxedNode,\n\tgetKernel,\n\ttype NodeFromSchema,\n\tisTreeNodeSchemaClass,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\ttype AllowedTypes,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype InsertableTypedNode,\n\ttype NodeBuilderData,\n\ttype Input,\n\tnormalizeAllowedTypes,\n\ttype NodeSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\ttype AllowedTypesMetadata,\n\tevaluateLazySchema,\n\ttype UnannotateAllowedTypesList,\n\ttype AllowedTypeMetadata,\n\ttype AnnotatedAllowedTypes,\n\tSchemaUpgrade,\n\ttype LazyItem,\n\ttype FlexList,\n\ttype FlexListToUnion,\n\ttype ExtractItemType,\n\twalkNodeSchema,\n\twalkAllowedTypes,\n\ttype SchemaVisitor,\n\ttype SimpleNodeSchemaBase,\n\twithBufferedTreeEvents,\n\ttype AnnotateAllowedTypesList,\n\ttype AllowedTypesFull,\n\ttype AllowedTypesFullFromMixed,\n\tAnnotatedAllowedTypesInternal,\n\ttype NumberKeys,\n\tExpectStored,\n\tcreateSchemaUpgrade,\n} from \"./core/index.js\";\nexport { walkFieldSchema } from \"./walkFieldSchema.js\";\nexport type { UnsafeUnknownSchema, Insertable } from \"./unsafeUnknownSchema.js\";\nexport {\n\ttype ITree,\n\ttype TreeView,\n\ttype ViewableTree,\n\ttype TreeViewEvents,\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n\ttype ITreeViewConfiguration,\n\ttype SchemaCompatibilityStatus,\n\ttype ITreeConfigurationOptions,\n\tSchemaFactory,\n\tscoped,\n\tSchemaFactoryBeta,\n\ttype SchemaStaticsBeta,\n\tSchemaFactoryAlpha,\n\ttype ObjectSchemaOptionsAlpha,\n\ttype ObjectSchemaOptions,\n\ttype ScopedSchemaName,\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttreeNodeApi,\n\ttype TreeNodeApi,\n\ttype NodeChangedData,\n\tborrowCursorFromTreeNodeOrValue,\n\texportConcise,\n\timportConcise,\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\ttype SimpleTreeIndex,\n\ttype IdentifierIndex,\n\tcreateSimpleTreeIndex,\n\tcreateIdentifierIndex,\n\ttype DirtyTreeStatus,\n\ttrackDirtyNodes,\n\ttype DirtyTreeMap,\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n\ttype JsonRecordNodeSchema,\n\ttype JsonStringKeyPatternProperties,\n\ttype TreeSchemaEncodingOptions,\n\tgetJsonSchema,\n\tgetSimpleSchema,\n\ttype VerboseTreeNode,\n\ttype TreeEncodingOptions,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n\ttype ConciseTree,\n\tSchemaCompatibilityTester,\n\ttype Unenforced,\n\ttype System_Unsafe,\n\ttype ArrayNodeCustomizableSchemaUnsafe,\n\ttype MapNodeCustomizableSchemaUnsafe,\n\ttype TreeRecordNodeUnsafe,\n\ttype UnannotateAllowedTypeUnsafe,\n\ttype AnnotatedAllowedTypeUnsafe,\n\ttype AnnotatedAllowedTypesUnsafe,\n\ttype AllowedTypesFullUnsafe,\n\ttype AllowedTypesFullFromMixedUnsafe,\n\ttype UnannotateAllowedTypesListUnsafe,\n\ttype AnnotateAllowedTypesListUnsafe,\n\ttype TreeViewAlpha,\n\ttype TreeViewBeta,\n\ttype TreeBranch,\n\ttype TreeBranchAlpha,\n\ttype TreeBranchEvents,\n\tgetPropertyKeyFromStoredKey,\n\tgetStoredKey,\n\ttryGetSchema,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\tconciseFromCursor,\n\tcreateFromCursor,\n\tasTreeViewAlpha,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\n\ttype SchemaStatics,\n\ttype ITreeAlpha,\n\ttype TransactionConstraint,\n\ttype TransactionConstraintAlpha,\n\ttype NodeInDocumentConstraint,\n\ttype NoChangeConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n\tgenerateSchemaFromSimpleSchema,\n\treplaceConciseTreeHandles,\n\treplaceHandles,\n\treplaceVerboseTreeHandles,\n\ttype HandleConverter,\n\tallowUnused,\n\ttype FieldSchemaAlphaUnsafe,\n\tgetIdentifierFromNode,\n\ttype ValidateRecursiveSchemaTemplate,\n\ttype FixRecursiveRecursionLimit,\n\tschemaStatics,\n\ttype TreeChangeEvents,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaOptionsAlpha,\n\tKeyEncodingOptions,\n\ttype TreeParsingOptions,\n\tincrementalSummaryHint,\n\tincrementalEncodingPolicyForAllowedTypes,\n\ttype SchemaFactory_base,\n\tencodeSchemaCompatibilitySnapshot,\n\tdecodeSchemaCompatibilitySnapshot,\n\texportCompatibilitySchemaSnapshot,\n\timportCompatibilitySchemaSnapshot,\n\tcheckCompatibility,\n\teraseSchemaDetails,\n\teraseSchemaDetailsSubclassable,\n\tcheckSchemaCompatibilitySnapshots,\n\ttype SnapshotFileSystem,\n\ttype SchemaCompatibilitySnapshotsOptions,\n} from \"./api/index.js\";\nexport type {\n\tSimpleTreeSchema,\n\tSimpleNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleArrayNodeSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleNodeSchemaBaseAlpha,\n\tSimpleObjectFieldSchema,\n\tSimpleRecordNodeSchema,\n\tSimpleAllowedTypeAttributes,\n\tSchemaType,\n} from \"./simpleSchema.js\";\nexport {\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\tFieldKind,\n\tFieldSchema,\n\tFieldSchemaAlpha,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype DefaultProvider,\n\ttype FieldProps,\n\ttype FieldPropsAlpha,\n\tnormalizeFieldSchema,\n\tareFieldSchemaEqual,\n\tareImplicitFieldSchemaEqual,\n\ttype ApplyKind,\n\ttype FieldSchemaMetadata,\n\ttype InsertableField,\n\ttype ApplyKindInput,\n\ttype ReadableField,\n\ttype ReadSchema,\n} from \"./fieldSchema.js\";\nexport { tryGetTreeNodeForField } from \"./getTreeNodeForField.js\";\nexport {\n\ttype ArrayNodeCustomizableSchema,\n\ttype ArrayNodePojoEmulationSchema,\n\tArrayNodeSchema,\n\tasIndex,\n\tisArrayNodeSchema,\n\tIterableTreeArrayContent,\n\ttype ReadonlyArrayNode,\n\tTreeArrayNode,\n\ttype MapNodeCustomizableSchema,\n\ttype MapNodePojoEmulationSchema,\n\tMapNodeSchema,\n\tisMapNodeSchema,\n\ttype TreeMapNode,\n\ttype MapNodeInsertableData,\n\ttype FieldHasDefault,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype ObjectFromSchemaRecord,\n\tObjectNodeSchema,\n\ttype ObjectNodeSchemaPrivate,\n\tobjectSchema,\n\tisObjectNodeSchema,\n\ttype TreeObjectNode,\n\tsetField,\n\tisRecordNodeSchema,\n\ttype RecordNodeCustomizableSchema,\n\ttype RecordNodeInsertableData,\n\ttype RecordNodePojoEmulationSchema,\n\tRecordNodeSchema,\n\ttype TreeRecordNode,\n} from \"./node-kinds/index.js\";\nexport {\n\tunhydratedFlexTreeFromInsertable,\n\ttype InsertableContent,\n\ttype FactoryContent,\n\ttype FactoryContentObject,\n} from \"./unhydratedFlexTreeFromInsertable.js\";\nexport {\n\tprepareForInsertion,\n\tprepareForInsertionContextless,\n} from \"./prepareForInsertion.js\";\nexport {\n\ttoStoredSchema,\n\tconvertFieldKind,\n\ttoUpgradeSchema,\n\ttoInitialSchema,\n\ttoUnhydratedSchema,\n\trestrictiveStoredSchemaGenerationOptions,\n\tpermissiveStoredSchemaGenerationOptions,\n} from \"./toStoredSchema.js\";\nexport {\n\tnumberSchema,\n\tstringSchema,\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n} from \"./leafNodeSchema.js\";\nexport type { LeafSchema } from \"./leafNodeSchema.js\";\nexport { getUnhydratedContext } from \"./createContext.js\";\nexport { type TreeSchema, createTreeSchema } from \"./treeSchema.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/simple-tree/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EAKnB,QAAQ,EAIR,QAAQ,EAGR,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,4BAA4B,EAC5B,mCAAmC,EACnC,SAAS,EAET,qBAAqB,EASrB,qBAAqB,EAIrB,kBAAkB,EAIlB,aAAa,EAKb,cAAc,EACd,gBAAgB,EAGhB,sBAAsB,EAItB,6BAA6B,EAE7B,YAAY,EACZ,mBAAmB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAKN,qBAAqB,EACrB,0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B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,wCAAwC,EACxC,uCAAuC,GACvC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,GACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAmB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttypeNameSymbol,\n\ttypeSchemaSymbol,\n\tcontentSchemaSymbol,\n\ttype WithType,\n\ttype TreeNodeSchema,\n\ttype AnnotatedAllowedType,\n\ttype AllowedTypesFullEvaluated,\n\tNodeKind,\n\ttype TreeNodeSchemaClass,\n\ttype TreeNodeSchemaNonClass,\n\ttype TreeNodeSchemaCore,\n\tTreeNode,\n\ttype Unhydrated,\n\ttype InternalTreeNode,\n\tisTreeNode,\n\ttryDisposeTreeNode,\n\tHydratedContext,\n\tSimpleContextSlot,\n\tgetInnerNode,\n\tgetOrCreateNodeFromInnerNode,\n\tgetOrCreateNodeFromInnerUnboxedNode,\n\tgetKernel,\n\ttype NodeFromSchema,\n\tisTreeNodeSchemaClass,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeLeafValue,\n\ttype AllowedTypes,\n\ttype InsertableTreeNodeFromAllowedTypes,\n\ttype InsertableTypedNode,\n\ttype NodeBuilderData,\n\ttype Input,\n\tnormalizeAllowedTypes,\n\ttype NodeSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\ttype AllowedTypesMetadata,\n\tevaluateLazySchema,\n\ttype UnannotateAllowedTypesList,\n\ttype AllowedTypeMetadata,\n\ttype AnnotatedAllowedTypes,\n\tSchemaUpgrade,\n\ttype LazyItem,\n\ttype FlexList,\n\ttype FlexListToUnion,\n\ttype ExtractItemType,\n\twalkNodeSchema,\n\twalkAllowedTypes,\n\ttype SchemaVisitor,\n\ttype SimpleNodeSchemaBase,\n\twithBufferedTreeEvents,\n\ttype AnnotateAllowedTypesList,\n\ttype AllowedTypesFull,\n\ttype AllowedTypesFullFromMixed,\n\tAnnotatedAllowedTypesInternal,\n\ttype NumberKeys,\n\tExpectStored,\n\tcreateSchemaUpgrade,\n} from \"./core/index.js\";\nexport { walkFieldSchema } from \"./walkFieldSchema.js\";\nexport type { UnsafeUnknownSchema, Insertable } from \"./unsafeUnknownSchema.js\";\nexport {\n\ttype ITree,\n\ttype TreeView,\n\ttype ViewableTree,\n\ttype TreeViewEvents,\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n\ttype ITreeViewConfiguration,\n\ttype SchemaCompatibilityStatus,\n\ttype ITreeConfigurationOptions,\n\tSchemaFactory,\n\tscoped,\n\tSchemaFactoryBeta,\n\ttype SchemaStaticsBeta,\n\tSchemaFactoryAlpha,\n\ttype ObjectSchemaOptionsAlpha,\n\ttype ObjectSchemaOptions,\n\ttype ScopedSchemaName,\n\ttype ValidateRecursiveSchema,\n\ttype FixRecursiveArraySchema,\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\ttreeNodeApi,\n\ttype TreeNodeApi,\n\ttype NodeChangedData,\n\tborrowCursorFromTreeNodeOrValue,\n\texportConcise,\n\timportConcise,\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n\ttype SimpleTreeIndex,\n\ttype IdentifierIndex,\n\tcreateSimpleTreeIndex,\n\tcreateIdentifierIndex,\n\ttype DirtyTreeStatus,\n\ttrackDirtyNodes,\n\ttype DirtyTreeMap,\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n\ttype JsonRecordNodeSchema,\n\ttype JsonStringKeyPatternProperties,\n\ttype TreeSchemaEncodingOptions,\n\tgetJsonSchema,\n\tgetSimpleSchema,\n\ttype VerboseTreeNode,\n\ttype TreeEncodingOptions,\n\ttype VerboseTree,\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n\ttype ConciseTree,\n\tSchemaCompatibilityTester,\n\ttype Unenforced,\n\ttype System_Unsafe,\n\ttype ArrayNodeCustomizableSchemaUnsafe,\n\ttype MapNodeCustomizableSchemaUnsafe,\n\ttype TreeRecordNodeUnsafe,\n\ttype UnannotateAllowedTypeUnsafe,\n\ttype AnnotatedAllowedTypeUnsafe,\n\ttype AnnotatedAllowedTypesUnsafe,\n\ttype AllowedTypesFullUnsafe,\n\ttype AllowedTypesFullFromMixedUnsafe,\n\ttype UnannotateAllowedTypesListUnsafe,\n\ttype AnnotateAllowedTypesListUnsafe,\n\ttype TreeViewAlpha,\n\ttype TreeViewBeta,\n\ttype TreeBranch,\n\ttype TreeBranchAlpha,\n\ttype TreeBranchEvents,\n\tgetPropertyKeyFromStoredKey,\n\tgetStoredKey,\n\ttryGetSchema,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\tconciseFromCursor,\n\tcreateFromCursor,\n\tasTreeViewAlpha,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\n\ttype SchemaStatics,\n\ttype ITreeAlpha,\n\ttype TransactionConstraint,\n\ttype TransactionConstraintAlpha,\n\ttype NodeInDocumentConstraint,\n\ttype NoChangeConstraint,\n\ttype RunTransactionParams,\n\ttype VoidTransactionCallbackStatus,\n\ttype TransactionCallbackStatus,\n\ttype TransactionResult,\n\ttype TransactionResultExt,\n\ttype TransactionResultSuccess,\n\ttype TransactionResultFailed,\n\trollback,\n\tgenerateSchemaFromSimpleSchema,\n\treplaceConciseTreeHandles,\n\treplaceHandles,\n\treplaceVerboseTreeHandles,\n\ttype HandleConverter,\n\tallowUnused,\n\ttype FieldSchemaAlphaUnsafe,\n\tgetIdentifierFromNode,\n\ttype ValidateRecursiveSchemaTemplate,\n\ttype FixRecursiveRecursionLimit,\n\tschemaStatics,\n\ttype TreeChangeEvents,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaOptionsAlpha,\n\tKeyEncodingOptions,\n\ttype TreeParsingOptions,\n\tincrementalSummaryHint,\n\tincrementalEncodingPolicyForAllowedTypes,\n\ttype SchemaFactory_base,\n\tencodeSchemaCompatibilitySnapshot,\n\tdecodeSchemaCompatibilitySnapshot,\n\texportCompatibilitySchemaSnapshot,\n\timportCompatibilitySchemaSnapshot,\n\tcheckCompatibility,\n\teraseSchemaDetails,\n\teraseSchemaDetailsSubclassable,\n\tcheckSchemaCompatibilitySnapshots,\n\ttype SnapshotFileSystem,\n\ttype SchemaCompatibilitySnapshotsOptions,\n\tcreateCustomizedFluidFrameworkScopedFactory,\n} from \"./api/index.js\";\nexport type {\n\tSimpleTreeSchema,\n\tSimpleNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleArrayNodeSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleNodeSchemaBaseAlpha,\n\tSimpleObjectFieldSchema,\n\tSimpleRecordNodeSchema,\n\tSimpleAllowedTypeAttributes,\n\tSchemaType,\n} from \"./simpleSchema.js\";\nexport {\n\ttype ImplicitFieldSchema,\n\ttype TreeFieldFromImplicitField,\n\tFieldKind,\n\tFieldSchema,\n\tFieldSchemaAlpha,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype DefaultProvider,\n\ttype FieldProps,\n\ttype FieldPropsAlpha,\n\tnormalizeFieldSchema,\n\tareFieldSchemaEqual,\n\tareImplicitFieldSchemaEqual,\n\ttype ApplyKind,\n\ttype FieldSchemaMetadata,\n\ttype InsertableField,\n\ttype ApplyKindInput,\n\ttype ReadableField,\n\ttype ReadSchema,\n} from \"./fieldSchema.js\";\nexport { tryGetTreeNodeForField } from \"./getTreeNodeForField.js\";\nexport {\n\ttype ArrayNodeCustomizableSchema,\n\ttype ArrayNodePojoEmulationSchema,\n\tArrayNodeSchema,\n\tasIndex,\n\tisArrayNodeSchema,\n\tIterableTreeArrayContent,\n\ttype ReadonlyArrayNode,\n\tTreeArrayNode,\n\ttype MapNodeCustomizableSchema,\n\ttype MapNodePojoEmulationSchema,\n\tMapNodeSchema,\n\tisMapNodeSchema,\n\ttype TreeMapNode,\n\ttype MapNodeInsertableData,\n\ttype FieldHasDefault,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype ObjectFromSchemaRecord,\n\tObjectNodeSchema,\n\ttype ObjectNodeSchemaPrivate,\n\tobjectSchema,\n\tisObjectNodeSchema,\n\ttype TreeObjectNode,\n\tsetField,\n\tisRecordNodeSchema,\n\ttype RecordNodeCustomizableSchema,\n\ttype RecordNodeInsertableData,\n\ttype RecordNodePojoEmulationSchema,\n\tRecordNodeSchema,\n\ttype TreeRecordNode,\n\ttype ArrayPlaceAnchor,\n\tcreateArrayInsertionAnchor,\n} from \"./node-kinds/index.js\";\nexport {\n\tunhydratedFlexTreeFromInsertable,\n\ttype InsertableContent,\n\ttype FactoryContent,\n\ttype FactoryContentObject,\n} from \"./unhydratedFlexTreeFromInsertable.js\";\nexport {\n\tprepareForInsertion,\n\tprepareForInsertionContextless,\n} from \"./prepareForInsertion.js\";\nexport {\n\ttoStoredSchema,\n\tconvertFieldKind,\n\ttoUpgradeSchema,\n\ttoInitialSchema,\n\ttoUnhydratedSchema,\n\trestrictiveStoredSchemaGenerationOptions,\n\tpermissiveStoredSchemaGenerationOptions,\n} from \"./toStoredSchema.js\";\nexport {\n\tnumberSchema,\n\tstringSchema,\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n} from \"./leafNodeSchema.js\";\nexport type { LeafSchema } from \"./leafNodeSchema.js\";\nexport { getUnhydratedContext } from \"./createContext.js\";\nexport { type TreeSchema, createTreeSchema } from \"./treeSchema.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leafNodeSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/leafNodeSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,
|
|
1
|
+
{"version":3,"file":"leafNodeSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/leafNodeSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAiB,KAAK,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EACN,KAAK,YAAY,EAIjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAS,KAAK,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EACN,QAAQ,EACR,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,iBAAiB,EAGjB,KAAK,WAAW,EAEhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAE5E;;;;;;;;GAQG;AACH,qBAAa,cAAc,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,CAAC,CAAC,SAAS,WAAW,CAC3E,YACC,sBAAsB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,EACvE,oBAAoB,EACpB,yBAAyB;;IAE1B,SAAgB,UAAU,EAAE,IAAI,CAAC;I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AAqB,CAC7B,KAAoB,EACpB,YAAyC;IAEzC,QAAQ,OAAO,KAAK,EAAE,CAAC;QACtB,KAAK,QAAQ,CAAC,CAAC,CAAC;YACf,IAAI,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC1B,kDAAkD;gBAClD,wBAAwB;gBACxB,OAAO,CAAC,CAAC;YACV,CAAC;iBAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBACnC,OAAO,KAAK,CAAC;YACd,CAAC;iBAAM,CAAC;gBACP,4DAA4D;gBAC5D,sEAAsE;gBACtE,6DAA6D;gBAC7D,IAAI,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;oBAClC,OAAO,IAAI,CAAC;gBACb,CAAC;qBAAM,CAAC;oBACP,MAAM,IAAI,UAAU,CAAC,uCAAuC,KAAK,GAAG,CAAC,CAAC;gBACvE,CAAC;YACF,CAAC;QACF,CAAC;QACD,KAAK,QAAQ,CAAC;QACd,QAAQ;QACR,uHAAuH;QACvH,wCAAwC;QACxC,KAAK,SAAS,CAAC,CAAC,CAAC;YAChB,OAAO,KAAK,CAAC;QACd,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACf,IAAI,KAAK,KAAK,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5C,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QACD,cAAc;QACd,OAAO,CAAC,CAAC,CAAC;YACT,MAAM,IAAI,UAAU,CAAC,oCAAoC,KAAK,GAAG,CAAC,CAAC;QACpE,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type TreeValue, ValueSchema } from \"../core/index.js\";\nimport {\n\ttype FlexTreeNode,\n\tisFlexTreeNode,\n\tisTreeValue,\n\tvalueSchemaAllows,\n} from \"../feature-libraries/index.js\";\nimport { brand, type JsonCompatibleReadOnlyObject } from \"../util/index.js\";\n\nimport {\n\tNodeKind,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaNonClass,\n\ttype NodeSchemaMetadata,\n\ttype TreeLeafValue,\n\ttype TreeNodeSchemaCorePrivate,\n\ttype TreeNodeSchemaPrivateData,\n\tprivateDataSymbol,\n\ttype TreeNodeSchemaInitializedData,\n\tCompatibilityLevel,\n\ttype FlexContent,\n} from \"./core/index.js\";\nimport { getTreeNodeSchemaInitializedData } from \"./createContext.js\";\nimport type { SimpleLeafNodeSchema } from \"./simpleSchema.js\";\nimport type { FactoryContent } from \"./unhydratedFlexTreeFromInsertable.js\";\n\n/**\n * Instances of this class are schema for leaf nodes.\n * @remarks\n * Unlike other schema, leaf schema are class instances instead of classes themselves.\n * This is because the instance type (the tree node type) for leaves are not objects,\n * so those instances can't be instances of a schema based class.\n * @privateRemarks\n * This class refers to the underlying flex tree schema in its constructor, so this class can't be included in the package API.\n */\nexport class LeafNodeSchema<Name extends string, const T extends ValueSchema>\n\timplements\n\t\tTreeNodeSchemaNonClass<Name, NodeKind.Leaf, TreeValue<T>, TreeValue<T>>,\n\t\tSimpleLeafNodeSchema,\n\t\tTreeNodeSchemaCorePrivate\n{\n\tpublic readonly identifier: Name;\n\tpublic readonly kind = NodeKind.Leaf;\n\tpublic readonly info: T;\n\tpublic readonly implicitlyConstructable = true as const;\n\tpublic readonly childTypes: ReadonlySet<TreeNodeSchema> = new Set();\n\tpublic readonly [privateDataSymbol]: TreeNodeSchemaPrivateData = {\n\t\tidempotentInitialize: () =>\n\t\t\t(this.#initializedData ??= getTreeNodeSchemaInitializedData(this, {\n\t\t\t\tshallowCompatibilityTest: (data: FactoryContent): CompatibilityLevel =>\n\t\t\t\t\tshallowCompatibilityTest(this, data),\n\t\t\t\ttoFlexContent: (\n\t\t\t\t\tdata: FactoryContent,\n\t\t\t\t\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\t\t\t\t): FlexContent => leafToFlexContent(data, this, allowedTypes),\n\t\t\t})),\n\t\tchildAllowedTypes: [],\n\t};\n\t#initializedData: TreeNodeSchemaInitializedData | undefined;\n\n\tpublic create(data: TreeValue<T> | FlexTreeNode): TreeValue<T> {\n\t\tif (isFlexTreeNode(data)) {\n\t\t\tconst value = data.value;\n\t\t\tassert(valueSchemaAllows(this.info, value), 0x916 /* invalid value */);\n\t\t\treturn value;\n\t\t}\n\t\treturn data;\n\t}\n\n\tpublic createFromInsertable(data: TreeValue<T>): TreeValue<T> {\n\t\treturn data;\n\t}\n\n\tpublic readonly leafKind: ValueSchema;\n\n\tpublic readonly metadata: NodeSchemaMetadata = {};\n\tpublic readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined;\n\n\tpublic constructor(name: Name, t: T) {\n\t\tthis.identifier = name;\n\t\tthis.info = t;\n\t\tthis.leafKind = t;\n\t}\n}\n\n/**\n * Wrapper around LeafNodeSchema's constructor that provides the return type that is desired in the package public API.\n */\nfunction makeLeaf<Name extends string, const T extends ValueSchema>(\n\tname: Name,\n\tt: T,\n): LeafSchema<Name, TreeValue<T>> & SimpleLeafNodeSchema {\n\t// Names in this domain follow https://en.wikipedia.org/wiki/Reverse_domain_name_notation\n\treturn new LeafNodeSchema(`com.fluidframework.leaf.${name}`, t);\n}\n\n/**\n * A {@link TreeNodeSchema} for a {@link TreeLeafValue}.\n * @remarks\n * This is just a more specific alias for a particular {@link TreeNodeSchemaNonClass}.\n * It only exists to make the API (particularly errors, IntelliSense, and generated .d.ts files) more readable.\n *\n * See {@link SchemaFactory} and its various properties for actual leaf schema objects.\n * @privateRemarks\n * This is an interface so its name will show up in things like type errors instead of the fully expanded TreeNodeSchemaNonClass.\n * @system @sealed @public\n */\nexport interface LeafSchema<Name extends string, T extends TreeLeafValue>\n\textends TreeNodeSchemaNonClass<\n\t\t`com.fluidframework.leaf.${Name}`,\n\t\tNodeKind.Leaf,\n\t\t/* TNode */ T,\n\t\t/* TInsertable */ T,\n\t\t/* ImplicitlyConstructable */ true\n\t> {}\n\n// Leaf schema shared between all SchemaFactory instances.\nexport const stringSchema = makeLeaf(\"string\", ValueSchema.String);\nexport const numberSchema = makeLeaf(\"number\", ValueSchema.Number);\nexport const booleanSchema = makeLeaf(\"boolean\", ValueSchema.Boolean);\nexport const nullSchema = makeLeaf(\"null\", ValueSchema.Null);\nexport const handleSchema = makeLeaf(\"handle\", ValueSchema.FluidHandle);\n\n/**\n * Checks if data might be schema-compatible.\n *\n * @returns false if `data` is incompatible with `type` based on a cheap/shallow check.\n *\n * Note that this may return true for cases where data is incompatible, but it must not return false in cases where the data is compatible.\n */\nfunction shallowCompatibilityTest(\n\tschema: TreeNodeSchema,\n\tdata: FactoryContent,\n): CompatibilityLevel {\n\tif (isTreeValue(data)) {\n\t\treturn allowsValue(schema, data) ? CompatibilityLevel.Normal : CompatibilityLevel.None;\n\t}\n\n\treturn CompatibilityLevel.None;\n}\n\nfunction allowsValue(schema: TreeNodeSchema, value: TreeValue): boolean {\n\tif (schema.kind === NodeKind.Leaf) {\n\t\treturn valueSchemaAllows(schema.info as ValueSchema, value);\n\t}\n\treturn false;\n}\n\n/**\n * Transforms data under a Leaf schema.\n * @param data - The tree data to be transformed. Must be a {@link TreeValue}.\n * @param schema - The schema associated with the value.\n * @param allowedTypes - The allowed types specified by the parent.\n * Used to determine which fallback values may be appropriate.\n */\nexport function leafToFlexContent(\n\tdata: FactoryContent,\n\tschema: TreeNodeSchema,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): FlexContent {\n\tassert(schema.kind === NodeKind.Leaf, 0x921 /* Expected a leaf schema. */);\n\tif (!isTreeValue(data)) {\n\t\t// This rule exists to protect against useless `toString` output like `[object Object]`.\n\t\t// In this case, that's actually reasonable behavior, since object input is not compatible with Leaf schemas.\n\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\tthrow new UsageError(`Input data is incompatible with leaf schema: ${data}`);\n\t}\n\n\tconst mappedValue = mapValueWithFallbacks(data, allowedTypes);\n\tconst mappedSchema = [...allowedTypes].find((type) => allowsValue(type, mappedValue));\n\n\tassert(mappedSchema !== undefined, 0x84a /* Unsupported schema for provided primitive. */);\n\n\tconst result: FlexContent = [\n\t\t{\n\t\t\tvalue: mappedValue,\n\t\t\ttype: brand(mappedSchema.identifier),\n\t\t},\n\t\tnew Map(),\n\t];\n\n\treturn result;\n}\n\n/**\n * Checks an incoming {@link TreeLeafValue} to ensure it is compatible with its requirements.\n * For unsupported values with a schema-compatible replacement, return the replacement value.\n * For unsupported values without a schema-compatible replacement, throw.\n * For supported values, return the input.\n */\nfunction mapValueWithFallbacks(\n\tvalue: TreeLeafValue,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): TreeValue {\n\tswitch (typeof value) {\n\t\tcase \"number\": {\n\t\t\tif (Object.is(value, -0)) {\n\t\t\t\t// Our serialized data format does not support -0.\n\t\t\t\t// Map such input to +0.\n\t\t\t\treturn 0;\n\t\t\t} else if (Number.isFinite(value)) {\n\t\t\t\treturn value;\n\t\t\t} else {\n\t\t\t\t// Our serialized data format does not support NaN nor +/-∞.\n\t\t\t\t// If the schema supports `null`, fall back to that. Otherwise, throw.\n\t\t\t\t// This is intended to match JSON's behavior for such values.\n\t\t\t\tif (allowedTypes.has(nullSchema)) {\n\t\t\t\t\treturn null;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new UsageError(`Received unsupported numeric value: ${value}.`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcase \"string\":\n\t\t// TODO:\n\t\t// This should detect invalid strings. Something like @stdlib/regexp-utf16-unpaired-surrogate could be used to do this.\n\t\t// See SchemaFactory.string for details.\n\t\tcase \"boolean\": {\n\t\t\treturn value;\n\t\t}\n\t\tcase \"object\": {\n\t\t\tif (value === null || isFluidHandle(value)) {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t\t// fallthrough\n\t\tdefault: {\n\t\t\tthrow new UsageError(`Received unsupported leaf value: ${value}.`);\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"leafNodeSchema.js","sourceRoot":"","sources":["../../src/simple-tree/leafNodeSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAiC,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAEN,cAAc,EACd,WAAW,EACX,iBAAiB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,EAAqC,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EACN,QAAQ,EAOR,iBAAiB,EAEjB,kBAAkB,GAGlB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;;;;;GAQG;AACH,MAAM,OAAO,cAAc;IAyBnB,MAAM,CAAC,IAAiC;QAC9C,IAAI,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACzB,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACvE,OAAO,KAAK,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,oBAAoB,CAAC,IAAkB;QAC7C,OAAO,IAAI,CAAC;IACb,CAAC;IAOD,YAAmB,IAAU,EAAE,CAAI;QApCnB,SAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAErB,4BAAu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;QACpE,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type FieldKey, type TreeValue, ValueSchema } from \"../core/index.js\";\nimport {\n\ttype FlexTreeNode,\n\tisFlexTreeNode,\n\tisTreeValue,\n\tvalueSchemaAllows,\n} from \"../feature-libraries/index.js\";\nimport { brand, type JsonCompatibleReadOnlyObject } from \"../util/index.js\";\n\nimport {\n\tNodeKind,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaNonClass,\n\ttype NodeSchemaMetadata,\n\ttype TreeLeafValue,\n\ttype TreeNodeSchemaCorePrivate,\n\ttype TreeNodeSchemaPrivateData,\n\tprivateDataSymbol,\n\ttype TreeNodeSchemaInitializedData,\n\tCompatibilityLevel,\n\ttype FlexContent,\n\ttype UnhydratedFlexTreeField,\n} from \"./core/index.js\";\nimport { getTreeNodeSchemaInitializedData } from \"./createContext.js\";\nimport type { SimpleLeafNodeSchema } from \"./simpleSchema.js\";\nimport type { FactoryContent } from \"./unhydratedFlexTreeFromInsertable.js\";\n\n/**\n * Instances of this class are schema for leaf nodes.\n * @remarks\n * Unlike other schema, leaf schema are class instances instead of classes themselves.\n * This is because the instance type (the tree node type) for leaves are not objects,\n * so those instances can't be instances of a schema based class.\n * @privateRemarks\n * This class refers to the underlying flex tree schema in its constructor, so this class can't be included in the package API.\n */\nexport class LeafNodeSchema<Name extends string, const T extends ValueSchema>\n\timplements\n\t\tTreeNodeSchemaNonClass<Name, NodeKind.Leaf, TreeValue<T>, TreeValue<T>>,\n\t\tSimpleLeafNodeSchema,\n\t\tTreeNodeSchemaCorePrivate\n{\n\tpublic readonly identifier: Name;\n\tpublic readonly kind = NodeKind.Leaf;\n\tpublic readonly info: T;\n\tpublic readonly implicitlyConstructable = true as const;\n\tpublic readonly childTypes: ReadonlySet<TreeNodeSchema> = new Set();\n\tpublic readonly [privateDataSymbol]: TreeNodeSchemaPrivateData = {\n\t\tidempotentInitialize: () =>\n\t\t\t(this.#initializedData ??= getTreeNodeSchemaInitializedData(this, {\n\t\t\t\tshallowCompatibilityTest: (data: FactoryContent): CompatibilityLevel =>\n\t\t\t\t\tshallowCompatibilityTest(this, data),\n\t\t\t\ttoFlexContent: (\n\t\t\t\t\tdata: FactoryContent,\n\t\t\t\t\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\t\t\t\t): FlexContent => leafToFlexContent(data, this, allowedTypes),\n\t\t\t})),\n\t\tchildAllowedTypes: [],\n\t};\n\t#initializedData: TreeNodeSchemaInitializedData | undefined;\n\n\tpublic create(data: TreeValue<T> | FlexTreeNode): TreeValue<T> {\n\t\tif (isFlexTreeNode(data)) {\n\t\t\tconst value = data.value;\n\t\t\tassert(valueSchemaAllows(this.info, value), 0x916 /* invalid value */);\n\t\t\treturn value;\n\t\t}\n\t\treturn data;\n\t}\n\n\tpublic createFromInsertable(data: TreeValue<T>): TreeValue<T> {\n\t\treturn data;\n\t}\n\n\tpublic readonly leafKind: ValueSchema;\n\n\tpublic readonly metadata: NodeSchemaMetadata = {};\n\tpublic readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined;\n\n\tpublic constructor(name: Name, t: T) {\n\t\tthis.identifier = name;\n\t\tthis.info = t;\n\t\tthis.leafKind = t;\n\t}\n}\n\n/**\n * Wrapper around LeafNodeSchema's constructor that provides the return type that is desired in the package public API.\n */\nfunction makeLeaf<Name extends string, const T extends ValueSchema>(\n\tname: Name,\n\tt: T,\n): LeafSchema<Name, TreeValue<T>> & SimpleLeafNodeSchema {\n\t// Names in this domain follow https://en.wikipedia.org/wiki/Reverse_domain_name_notation\n\treturn new LeafNodeSchema(`com.fluidframework.leaf.${name}`, t);\n}\n\n/**\n * A {@link TreeNodeSchema} for a {@link TreeLeafValue}.\n * @remarks\n * This is just a more specific alias for a particular {@link TreeNodeSchemaNonClass}.\n * It only exists to make the API (particularly errors, IntelliSense, and generated .d.ts files) more readable.\n *\n * See {@link SchemaFactory} and its various properties for actual leaf schema objects.\n * @privateRemarks\n * This is an interface so its name will show up in things like type errors instead of the fully expanded TreeNodeSchemaNonClass.\n * @system @sealed @public\n */\nexport interface LeafSchema<Name extends string, T extends TreeLeafValue>\n\textends TreeNodeSchemaNonClass<\n\t\t`com.fluidframework.leaf.${Name}`,\n\t\tNodeKind.Leaf,\n\t\t/* TNode */ T,\n\t\t/* TInsertable */ T,\n\t\t/* ImplicitlyConstructable */ true\n\t> {}\n\n// Leaf schema shared between all SchemaFactory instances.\nexport const stringSchema = makeLeaf(\"string\", ValueSchema.String);\nexport const numberSchema = makeLeaf(\"number\", ValueSchema.Number);\nexport const booleanSchema = makeLeaf(\"boolean\", ValueSchema.Boolean);\nexport const nullSchema = makeLeaf(\"null\", ValueSchema.Null);\nexport const handleSchema = makeLeaf(\"handle\", ValueSchema.FluidHandle);\n\n/**\n * Checks if data might be schema-compatible.\n *\n * @returns false if `data` is incompatible with `type` based on a cheap/shallow check.\n *\n * Note that this may return true for cases where data is incompatible, but it must not return false in cases where the data is compatible.\n */\nfunction shallowCompatibilityTest(\n\tschema: TreeNodeSchema,\n\tdata: FactoryContent,\n): CompatibilityLevel {\n\tif (isTreeValue(data)) {\n\t\treturn allowsValue(schema, data) ? CompatibilityLevel.Normal : CompatibilityLevel.None;\n\t}\n\n\treturn CompatibilityLevel.None;\n}\n\nfunction allowsValue(schema: TreeNodeSchema, value: TreeValue): boolean {\n\tif (schema.kind === NodeKind.Leaf) {\n\t\treturn valueSchemaAllows(schema.info as ValueSchema, value);\n\t}\n\treturn false;\n}\n\n/**\n * Transforms data under a Leaf schema.\n * @param data - The tree data to be transformed. Must be a {@link TreeValue}.\n * @param schema - The schema associated with the value.\n * @param allowedTypes - The allowed types specified by the parent.\n * Used to determine which fallback values may be appropriate.\n */\nexport function leafToFlexContent(\n\tdata: FactoryContent,\n\tschema: TreeNodeSchema,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): FlexContent {\n\tassert(schema.kind === NodeKind.Leaf, 0x921 /* Expected a leaf schema. */);\n\tif (!isTreeValue(data)) {\n\t\t// This rule exists to protect against useless `toString` output like `[object Object]`.\n\t\t// In this case, that's actually reasonable behavior, since object input is not compatible with Leaf schemas.\n\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\tthrow new UsageError(`Input data is incompatible with leaf schema: ${data}`);\n\t}\n\n\tconst mappedValue = mapValueWithFallbacks(data, allowedTypes);\n\tconst mappedSchema = [...allowedTypes].find((type) => allowsValue(type, mappedValue));\n\n\tassert(mappedSchema !== undefined, 0x84a /* Unsupported schema for provided primitive. */);\n\n\tconst result: FlexContent = [\n\t\t{\n\t\t\tvalue: mappedValue,\n\t\t\ttype: brand(mappedSchema.identifier),\n\t\t},\n\t\tnew Map<FieldKey, UnhydratedFlexTreeField>(),\n\t];\n\n\treturn result;\n}\n\n/**\n * Checks an incoming {@link TreeLeafValue} to ensure it is compatible with its requirements.\n * For unsupported values with a schema-compatible replacement, return the replacement value.\n * For unsupported values without a schema-compatible replacement, throw.\n * For supported values, return the input.\n */\nfunction mapValueWithFallbacks(\n\tvalue: TreeLeafValue,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): TreeValue {\n\tswitch (typeof value) {\n\t\tcase \"number\": {\n\t\t\tif (Object.is(value, -0)) {\n\t\t\t\t// Our serialized data format does not support -0.\n\t\t\t\t// Map such input to +0.\n\t\t\t\treturn 0;\n\t\t\t} else if (Number.isFinite(value)) {\n\t\t\t\treturn value;\n\t\t\t} else {\n\t\t\t\t// Our serialized data format does not support NaN nor +/-∞.\n\t\t\t\t// If the schema supports `null`, fall back to that. Otherwise, throw.\n\t\t\t\t// This is intended to match JSON's behavior for such values.\n\t\t\t\tif (allowedTypes.has(nullSchema)) {\n\t\t\t\t\treturn null;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new UsageError(`Received unsupported numeric value: ${value}.`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcase \"string\":\n\t\t// TODO:\n\t\t// This should detect invalid strings. Something like @stdlib/regexp-utf16-unpaired-surrogate could be used to do this.\n\t\t// See SchemaFactory.string for details.\n\t\tcase \"boolean\": {\n\t\t\treturn value;\n\t\t}\n\t\tcase \"object\": {\n\t\t\tif (value === null || isFluidHandle(value)) {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t\t// fallthrough\n\t\tdefault: {\n\t\t\tthrow new UsageError(`Received unsupported leaf value: ${value}.`);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -44,6 +44,18 @@ export interface TreeArrayNode<TAllowedTypes extends System_Unsafe.ImplicitAllow
|
|
|
44
44
|
* @param value - The content to insert.
|
|
45
45
|
*/
|
|
46
46
|
insertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
47
|
+
/**
|
|
48
|
+
* Inserts new item(s) at the end of the array.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* The order of the inserted items relative to other concurrently inserted items at the same location is only partially specified:
|
|
52
|
+
* Concurrently inserting `[A, B]` and `[X, Y]` at the same location may yield
|
|
53
|
+
* either `[A, B, X, Y]` or `[X, Y, A, B]`, regardless of the order in which those edits are sequenced.
|
|
54
|
+
* No other interleavings are possible. (e.g. `[A, X, B, Y]` is not possible.)
|
|
55
|
+
*
|
|
56
|
+
* @param value - The content to insert.
|
|
57
|
+
*/
|
|
58
|
+
push(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
47
59
|
/**
|
|
48
60
|
* Removes the item at the specified location.
|
|
49
61
|
* @param index - The index at which to remove the item.
|
|
@@ -376,4 +388,55 @@ export declare function asIndex(key: string | symbol, exclusiveMax: number): num
|
|
|
376
388
|
* @param persistedMetadata - Optional persisted metadata for the object node schema.
|
|
377
389
|
*/
|
|
378
390
|
export declare function arraySchema<TName extends string, const T extends ImplicitAllowedTypes, const ImplicitlyConstructable extends boolean, const TCustomMetadata = unknown>(identifier: TName, info: T, implicitlyConstructable: ImplicitlyConstructable, customizable: boolean, nodeOptions: NodeSchemaOptionsAlpha<TCustomMetadata>): ArrayNodeCustomizableSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> & ArrayNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> & TreeNodeSchemaCorePrivate<string, NodeKind, never, boolean, unknown, unknown>;
|
|
391
|
+
/**
|
|
392
|
+
* A location in a {@link (TreeArrayNode:interface)}.
|
|
393
|
+
* @remarks
|
|
394
|
+
* Tracks a location even as the array is mutated.
|
|
395
|
+
* How this is adjusted for edits depends on the specific anchor being used.
|
|
396
|
+
* See {@link createArrayInsertionAnchor} for one way to create such an anchor.
|
|
397
|
+
* @privateRemarks
|
|
398
|
+
* This being sealed is not important for its current behaviors as nothing downcasts this,
|
|
399
|
+
* however it is possible we might want to add additional members in the future:
|
|
400
|
+
* sealing this ensures that such additions are a non-breaking change.
|
|
401
|
+
* Things we might want to add include status (for example if its deleted) or events (for example to notify when its index changes).
|
|
402
|
+
* Some specific anchors might even want to add additional method members for things like confidence
|
|
403
|
+
* (so we can indicate when the anchor goes from being truly robust to a heuristic guess due to an edit).
|
|
404
|
+
* @alpha
|
|
405
|
+
* @sealed
|
|
406
|
+
*/
|
|
407
|
+
export interface ArrayPlaceAnchor {
|
|
408
|
+
/**
|
|
409
|
+
* The current index within the array that this anchor refers to.
|
|
410
|
+
* @remarks
|
|
411
|
+
* This value is updated as the array is edited in a way that depends on the specific anchor implementation.
|
|
412
|
+
* This index may take on a value from 0 to the length of the array (inclusive).
|
|
413
|
+
* If used as the index to insert content into the array, this means it can point to any location in the array,
|
|
414
|
+
* including just after the last child.
|
|
415
|
+
*/
|
|
416
|
+
get index(): number;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Create an {@link ArrayPlaceAnchor} tracking an insertion point in the array which is currently at the provided index.
|
|
420
|
+
*
|
|
421
|
+
* @param node - The array node to anchor into.
|
|
422
|
+
* @param currentIndex - The current index of the place to track.
|
|
423
|
+
* @remarks
|
|
424
|
+
* This anchor will track the logical position in the array across changes.
|
|
425
|
+
* As long as the subsection of the array surrounding the anchor point is not edited,
|
|
426
|
+
* this anchor will move with them, keeping its relative position to those children fixed.
|
|
427
|
+
* How exactly it behaves when the adjacent portion of the array is modified is subject to change,
|
|
428
|
+
* but this will always report a valid index to insert content at (which can be the index after the last item in the array).
|
|
429
|
+
*
|
|
430
|
+
* This is intended to track a location that might be used for an insertion point (for example in a text editor): future changes to its details should
|
|
431
|
+
* make it behave better for such uses.
|
|
432
|
+
*
|
|
433
|
+
* The current implementation is known to behave particularly poorly if the child which was at the original anchor point's index is removed
|
|
434
|
+
* (jumps to the end of the array): this behavior is subject to change.
|
|
435
|
+
* @privateRemarks
|
|
436
|
+
* When stabilized, this should probably become a method on {@link (TreeArrayNode:interface)}.
|
|
437
|
+
* Future versions of this should use rebaser / changeset logic to do a better job of tracking a location across removals or reinsertion.
|
|
438
|
+
* How this would work, especially for unhydrated nodes is not yet clear.
|
|
439
|
+
* @alpha
|
|
440
|
+
*/
|
|
441
|
+
export declare function createArrayInsertionAnchor(node: TreeArrayNode, currentIndex: number): ArrayPlaceAnchor;
|
|
379
442
|
//# sourceMappingURL=arrayNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayNode.d.ts","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/array/arrayNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAEN,KAAK,QAAQ,EAGb,QAAQ,EACR,KAAK,QAAQ,EAab,KAAK,oBAAoB,EACzB,KAAK,0CAA0C,EAE/C,KAAK,aAAa,EAClB,KAAK,gCAAgC,EAIrC,KAAK,yBAAyB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C,KAAK,CAAC,eAAe,GAAG,OAAO,EAE/B,UAAU,EAAE,KAAK,EACjB,IAAI,EAAE,CAAC,EACP,uBAAuB,EAAE,uBAAuB,EAChD,YAAY,EAAE,OAAO,EACrB,WAAW,EAAE,sBAAsB,CAAC,eAAe,CAAC,sPAyIpD;AA2FD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;;OAOG;IACH,IAAI,KAAK,IAAI,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,0BAA0B,CACzC,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,MAAM,GAClB,gBAAgB,CAclB"}
|
|
@@ -323,6 +323,9 @@ class CustomArrayNodeBase extends TreeNodeWithArrayFeatures {
|
|
|
323
323
|
insertAtEnd(...value) {
|
|
324
324
|
this.insertAt(this.length, ...value);
|
|
325
325
|
}
|
|
326
|
+
push(...value) {
|
|
327
|
+
this.insertAt(this.length, ...value);
|
|
328
|
+
}
|
|
326
329
|
removeAt(index) {
|
|
327
330
|
const field = getSequenceField(this);
|
|
328
331
|
validateIndex(index, field, "TreeArrayNode.removeAt");
|
|
@@ -600,4 +603,42 @@ function shallowCompatibilityTest(data, schema) {
|
|
|
600
603
|
}
|
|
601
604
|
return CompatibilityLevel.None;
|
|
602
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
* Create an {@link ArrayPlaceAnchor} tracking an insertion point in the array which is currently at the provided index.
|
|
608
|
+
*
|
|
609
|
+
* @param node - The array node to anchor into.
|
|
610
|
+
* @param currentIndex - The current index of the place to track.
|
|
611
|
+
* @remarks
|
|
612
|
+
* This anchor will track the logical position in the array across changes.
|
|
613
|
+
* As long as the subsection of the array surrounding the anchor point is not edited,
|
|
614
|
+
* this anchor will move with them, keeping its relative position to those children fixed.
|
|
615
|
+
* How exactly it behaves when the adjacent portion of the array is modified is subject to change,
|
|
616
|
+
* but this will always report a valid index to insert content at (which can be the index after the last item in the array).
|
|
617
|
+
*
|
|
618
|
+
* This is intended to track a location that might be used for an insertion point (for example in a text editor): future changes to its details should
|
|
619
|
+
* make it behave better for such uses.
|
|
620
|
+
*
|
|
621
|
+
* The current implementation is known to behave particularly poorly if the child which was at the original anchor point's index is removed
|
|
622
|
+
* (jumps to the end of the array): this behavior is subject to change.
|
|
623
|
+
* @privateRemarks
|
|
624
|
+
* When stabilized, this should probably become a method on {@link (TreeArrayNode:interface)}.
|
|
625
|
+
* Future versions of this should use rebaser / changeset logic to do a better job of tracking a location across removals or reinsertion.
|
|
626
|
+
* How this would work, especially for unhydrated nodes is not yet clear.
|
|
627
|
+
* @alpha
|
|
628
|
+
*/
|
|
629
|
+
export function createArrayInsertionAnchor(node, currentIndex) {
|
|
630
|
+
const field = getInnerNode(node).getBoxed(EmptyKey);
|
|
631
|
+
const child = field.boxedAt(currentIndex);
|
|
632
|
+
return {
|
|
633
|
+
get index() {
|
|
634
|
+
if (child === undefined) {
|
|
635
|
+
return field.length;
|
|
636
|
+
}
|
|
637
|
+
if (child.parentField.parent !== field) {
|
|
638
|
+
return field.length;
|
|
639
|
+
}
|
|
640
|
+
return child.parentField.index;
|
|
641
|
+
},
|
|
642
|
+
};
|
|
643
|
+
}
|
|
603
644
|
//# sourceMappingURL=arrayNode.js.map
|