@fluidframework/tree 2.80.0 → 2.81.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 +57 -0
- package/api-report/tree.alpha.api.md +42 -7
- package/dist/alpha.d.ts +5 -0
- package/dist/codec/codec.d.ts +2 -2
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +8 -8
- package/dist/codec/codec.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 +12 -12
- 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.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.map +1 -1
- package/dist/core/rebase/types.d.ts +44 -7
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +5 -1
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV2.js +4 -4
- package/dist/core/schema-stored/formatV2.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +2 -1
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -3
- package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecV2.js +2 -2
- package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV1.js +3 -3
- package/dist/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexFormatV2.js +4 -4
- package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +1 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +3 -2
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js +59 -19
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.d.ts +6 -1
- package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +3 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -0
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +17 -15
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +10 -52
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +23 -64
- 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/fieldKindIdentifiers.d.ts +9 -0
- package/dist/feature-libraries/fieldKindIdentifiers.d.ts.map +1 -0
- package/dist/feature-libraries/fieldKindIdentifiers.js +16 -0
- package/dist/feature-libraries/fieldKindIdentifiers.js.map +1 -0
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +8 -8
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/observer.d.ts +1 -1
- package/dist/feature-libraries/flex-tree/observer.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/observer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +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 +6 -4
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV1.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV2.js.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +4 -4
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +2 -2
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +1 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +2 -2
- package/dist/feature-libraries/modular-schema/genericFieldKind.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 +2 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +52 -43
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +3 -3
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +5 -3
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/index.d.ts +3 -3
- package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/index.js +4 -8
- package/dist/feature-libraries/optional-field/index.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts +10 -2
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +13 -1
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/requiredField.d.ts +36 -0
- package/dist/feature-libraries/optional-field/requiredField.d.ts.map +1 -0
- package/dist/feature-libraries/optional-field/requiredField.js +27 -0
- package/dist/feature-libraries/optional-field/requiredField.js.map +1 -0
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +7 -7
- package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/schemaChecker.js +1 -1
- package/dist/feature-libraries/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/sequence-field/index.d.ts +2 -14
- package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/index.js +3 -30
- package/dist/feature-libraries/sequence-field/index.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceKind.d.ts +16 -0
- package/dist/feature-libraries/sequence-field/sequenceKind.d.ts.map +1 -0
- package/dist/feature-libraries/sequence-field/sequenceKind.js +24 -0
- package/dist/feature-libraries/sequence-field/sequenceKind.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- 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.map +1 -1
- package/dist/shared-tree/independentView.js +7 -7
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +12 -10
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +2 -2
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +6 -33
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +31 -24
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +75 -58
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/tree.d.ts.map +1 -1
- package/dist/shared-tree/tree.js +14 -14
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +1 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +77 -77
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +21 -6
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +93 -37
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +1 -1
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +5 -1
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.d.ts +18 -31
- package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/branchCommitEnricher.js +24 -76
- package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/dist/shared-tree-core/branchIdCodec.d.ts.map +1 -1
- package/dist/shared-tree-core/branchIdCodec.js.map +1 -1
- package/dist/shared-tree-core/changeEnricher.d.ts +8 -43
- package/dist/shared-tree-core/changeEnricher.d.ts.map +1 -1
- package/dist/shared-tree-core/changeEnricher.js +0 -13
- package/dist/shared-tree-core/changeEnricher.js.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts +4 -12
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js +26 -36
- package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +13 -7
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsCommons.js +1 -2
- package/dist/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
- package/dist/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
- package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js +1 -1
- package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/index.d.ts +2 -2
- package/dist/shared-tree-core/index.d.ts.map +1 -1
- package/dist/shared-tree-core/index.js +1 -3
- package/dist/shared-tree-core/index.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecVSharedBranches.js +2 -2
- package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts +2 -2
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/dist/shared-tree-core/messageTypes.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -4
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +13 -13
- package/dist/shared-tree-core/sharedTreeCore.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/configuration.d.ts +2 -2
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js +14 -14
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +1 -1
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +7 -7
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/dirtyIndex.d.ts +1 -1
- package/dist/simple-tree/api/dirtyIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/dirtyIndex.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/dist/simple-tree/api/discrepancies.js +23 -23
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.d.ts +1 -1
- package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.js +1 -1
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/identifierIndex.d.ts +2 -2
- package/dist/simple-tree/api/identifierIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/identifierIndex.js.map +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/api/incrementalAllowedTypes.js +6 -6
- package/dist/simple-tree/api/incrementalAllowedTypes.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 +2 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts +2 -2
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +7 -7
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +2 -2
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +7 -7
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +6 -6
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +2 -2
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts +2 -2
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js +2 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaStatics.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.d.ts +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaCodec.js +17 -17
- package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +2 -2
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +6 -6
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.d.ts +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +244 -0
- package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js +298 -2
- package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +5 -3
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js +2 -2
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +4 -4
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +22 -22
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js +7 -7
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/context.d.ts.map +1 -1
- package/dist/simple-tree/core/context.js.map +1 -1
- package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNode.js +1 -1
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +7 -5
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +5 -5
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts +3 -3
- package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.js +2 -2
- package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/core/withType.d.ts.map +1 -1
- package/dist/simple-tree/core/withType.js.map +1 -1
- package/dist/simple-tree/createContext.d.ts.map +1 -1
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +1 -1
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +1 -1
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +3 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +15 -15
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +46 -46
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/common.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +2 -2
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +24 -24
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts +2 -2
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +9 -9
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +3 -3
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +34 -34
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts +2 -2
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +13 -13
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchema.js.map +1 -1
- package/dist/simple-tree/treeSchema.d.ts.map +1 -1
- package/dist/simple-tree/treeSchema.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +10 -10
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +22 -21
- package/dist/tableSchema.js.map +1 -1
- package/dist/text/index.d.ts +7 -0
- package/dist/text/index.d.ts.map +1 -0
- package/dist/text/index.js +12 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/textDomain.d.ts +146 -0
- package/dist/text/textDomain.d.ts.map +1 -0
- package/dist/text/textDomain.js +122 -0
- package/dist/text/textDomain.js.map +1 -0
- package/dist/text/textDomainFormatted.d.ts +572 -0
- package/dist/text/textDomainFormatted.d.ts.map +1 -0
- package/dist/text/textDomainFormatted.js +183 -0
- package/dist/text/textDomainFormatted.js.map +1 -0
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +9 -9
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/bTreeUtils.d.ts +12 -4
- package/dist/util/bTreeUtils.d.ts.map +1 -1
- package/dist/util/bTreeUtils.js +14 -18
- package/dist/util/bTreeUtils.js.map +1 -1
- package/dist/util/nestedMap.js +12 -12
- package/dist/util/nestedMap.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/docs/user-facing/merge-semantics.md +3 -2
- package/eslint.config.mts +8 -36
- package/lib/alpha.d.ts +5 -0
- package/lib/codec/codec.d.ts +2 -2
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +1 -1
- package/lib/codec/codec.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 +2 -2
- 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.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.map +1 -1
- package/lib/core/rebase/types.d.ts +44 -7
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +5 -1
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/schema-stored/formatV2.d.ts.map +1 -1
- package/lib/core/schema-stored/formatV2.js +1 -1
- package/lib/core/schema-stored/formatV2.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +2 -1
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.js +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecV2.js +2 -2
- package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV1.js +2 -2
- package/lib/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexFormatV2.js +2 -2
- package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +1 -1
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +3 -2
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js +59 -19
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/feature-libraries/changeAtomIdBTree.d.ts +6 -1
- package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +3 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +1 -0
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -3
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +10 -52
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +4 -45
- 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/fieldKindIdentifiers.d.ts +9 -0
- package/lib/feature-libraries/fieldKindIdentifiers.d.ts.map +1 -0
- package/lib/feature-libraries/fieldKindIdentifiers.js +13 -0
- package/lib/feature-libraries/fieldKindIdentifiers.js.map +1 -0
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/observer.d.ts +1 -1
- package/lib/feature-libraries/flex-tree/observer.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/observer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +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 -4
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV1.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV2.js.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +4 -4
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +2 -2
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +1 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +2 -2
- package/lib/feature-libraries/modular-schema/genericFieldKind.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 +2 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV2.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +52 -43
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +3 -3
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +5 -3
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/index.d.ts +3 -3
- package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/index.js +2 -2
- package/lib/feature-libraries/optional-field/index.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts +10 -2
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +14 -2
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/requiredField.d.ts +36 -0
- package/lib/feature-libraries/optional-field/requiredField.d.ts.map +1 -0
- package/lib/feature-libraries/optional-field/requiredField.js +24 -0
- package/lib/feature-libraries/optional-field/requiredField.js.map +1 -0
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
- package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/schemaChecker.js +1 -1
- package/lib/feature-libraries/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/sequence-field/index.d.ts +2 -14
- package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/index.js +1 -13
- package/lib/feature-libraries/sequence-field/index.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceKind.d.ts +16 -0
- package/lib/feature-libraries/sequence-field/sequenceKind.d.ts.map +1 -0
- package/lib/feature-libraries/sequence-field/sequenceKind.js +21 -0
- package/lib/feature-libraries/sequence-field/sequenceKind.js.map +1 -0
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- 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.map +1 -1
- package/lib/shared-tree/independentView.js +3 -3
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +12 -10
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +2 -2
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +6 -33
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +31 -24
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +73 -55
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/tree.d.ts.map +1 -1
- package/lib/shared-tree/tree.js +7 -7
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +1 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +3 -3
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +21 -6
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +67 -11
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +1 -1
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +5 -1
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.d.ts +18 -31
- package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/branchCommitEnricher.js +24 -76
- package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
- package/lib/shared-tree-core/branchIdCodec.d.ts.map +1 -1
- package/lib/shared-tree-core/branchIdCodec.js.map +1 -1
- package/lib/shared-tree-core/changeEnricher.d.ts +8 -43
- package/lib/shared-tree-core/changeEnricher.d.ts.map +1 -1
- package/lib/shared-tree-core/changeEnricher.js +1 -11
- package/lib/shared-tree-core/changeEnricher.js.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts +4 -12
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.js +28 -38
- package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +13 -7
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsCommons.js +1 -2
- package/lib/shared-tree-core/editManagerCodecsCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js +1 -1
- package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.js +1 -1
- package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/index.d.ts +2 -2
- package/lib/shared-tree-core/index.d.ts.map +1 -1
- package/lib/shared-tree-core/index.js +0 -1
- package/lib/shared-tree-core/index.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecVSharedBranches.js +2 -2
- package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts +2 -2
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
- package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
- package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
- package/lib/shared-tree-core/messageTypes.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -4
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +14 -14
- package/lib/shared-tree-core/sharedTreeCore.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/configuration.d.ts +2 -2
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js +4 -4
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +1 -1
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +1 -1
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/dirtyIndex.d.ts +1 -1
- package/lib/simple-tree/api/dirtyIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/dirtyIndex.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/lib/simple-tree/api/discrepancies.js +3 -3
- package/lib/simple-tree/api/discrepancies.js.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.d.ts +1 -1
- package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.js +1 -1
- package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/identifierIndex.d.ts +2 -2
- package/lib/simple-tree/api/identifierIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/identifierIndex.js.map +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/api/incrementalAllowedTypes.js +3 -3
- package/lib/simple-tree/api/incrementalAllowedTypes.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/schemaCompatibilityTester.d.ts +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts +2 -2
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +2 -2
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +2 -2
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +6 -6
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +2 -2
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts +2 -2
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js +2 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaStatics.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaCodec.d.ts +1 -1
- package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaCodec.js +3 -3
- package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +2 -2
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +6 -6
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.d.ts +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +244 -0
- package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js +271 -1
- package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +5 -3
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js +2 -2
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +4 -4
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +3 -3
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/core/allowedTypes.js +2 -2
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/context.d.ts.map +1 -1
- package/lib/simple-tree/core/context.js.map +1 -1
- package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNode.js +1 -1
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +7 -5
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +5 -5
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts +3 -3
- package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.js +2 -2
- package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/core/withType.d.ts.map +1 -1
- package/lib/simple-tree/core/withType.js.map +1 -1
- package/lib/simple-tree/createContext.d.ts.map +1 -1
- package/lib/simple-tree/createContext.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +1 -1
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +1 -1
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +2 -2
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +5 -5
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/common.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +2 -2
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +6 -6
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts +2 -2
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +3 -3
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +3 -3
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +4 -4
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts +2 -2
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +4 -4
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -1
- package/lib/simple-tree/treeSchema.d.ts.map +1 -1
- package/lib/simple-tree/treeSchema.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +2 -2
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +2 -1
- package/lib/tableSchema.js.map +1 -1
- package/lib/text/index.d.ts +7 -0
- package/lib/text/index.d.ts.map +1 -0
- package/lib/text/index.js +7 -0
- package/lib/text/index.js.map +1 -0
- package/lib/text/textDomain.d.ts +146 -0
- package/lib/text/textDomain.d.ts.map +1 -0
- package/lib/text/textDomain.js +118 -0
- package/lib/text/textDomain.js.map +1 -0
- package/lib/text/textDomainFormatted.d.ts +572 -0
- package/lib/text/textDomainFormatted.d.ts.map +1 -0
- package/lib/text/textDomainFormatted.js +180 -0
- package/lib/text/textDomainFormatted.js.map +1 -0
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +2 -2
- package/lib/treeFactory.js.map +1 -1
- package/lib/util/bTreeUtils.d.ts +12 -4
- package/lib/util/bTreeUtils.d.ts.map +1 -1
- package/lib/util/bTreeUtils.js +15 -19
- package/lib/util/bTreeUtils.js.map +1 -1
- package/lib/util/nestedMap.js +12 -12
- package/lib/util/nestedMap.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/package.json +25 -25
- package/src/codec/codec.ts +10 -7
- package/src/codec/versioned/codec.ts +3 -3
- package/src/core/index.ts +2 -0
- package/src/core/rebase/index.ts +2 -0
- package/src/core/rebase/types.ts +57 -20
- package/src/core/rebase/utils.ts +8 -4
- package/src/core/schema-stored/formatV2.ts +2 -1
- package/src/core/tree/anchorSet.ts +2 -1
- package/src/core/tree/detachedFieldIndex.ts +1 -1
- package/src/core/tree/detachedFieldIndexCodecCommon.ts +2 -1
- package/src/core/tree/detachedFieldIndexCodecV1.ts +2 -2
- package/src/core/tree/detachedFieldIndexCodecV2.ts +3 -3
- package/src/core/tree/detachedFieldIndexFormatV1.ts +3 -2
- package/src/core/tree/detachedFieldIndexFormatV2.ts +3 -2
- package/src/core/tree/visitDelta.ts +8 -5
- package/src/core/tree/visitorUtils.ts +57 -20
- package/src/feature-libraries/changeAtomIdBTree.ts +9 -1
- package/src/feature-libraries/chunked-forest/chunkTree.ts +1 -1
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -1
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +2 -1
- package/src/feature-libraries/chunked-forest/codec/format.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/formatGeneric.ts +1 -0
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +3 -3
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +5 -10
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +22 -110
- package/src/feature-libraries/default-schema/index.ts +0 -5
- package/src/feature-libraries/fieldKindIdentifiers.ts +16 -0
- package/src/feature-libraries/flex-tree/lazyField.ts +1 -1
- package/src/feature-libraries/flex-tree/observer.ts +3 -1
- package/src/feature-libraries/forest-summary/codec.ts +1 -1
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +9 -7
- package/src/feature-libraries/forest-summary/formatV1.ts +1 -0
- package/src/feature-libraries/forest-summary/formatV2.ts +1 -0
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +9 -7
- package/src/feature-libraries/forest-summary/summaryTypes.ts +1 -0
- package/src/feature-libraries/index.ts +0 -5
- package/src/feature-libraries/mapTreeCursor.ts +1 -1
- package/src/feature-libraries/modular-schema/fieldKindConfiguration.ts +1 -0
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +2 -2
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +3 -1
- package/src/feature-libraries/modular-schema/modularChangeCodecV2.ts +2 -2
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +3 -2
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +83 -74
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +3 -3
- package/src/feature-libraries/object-forest/objectForest.ts +5 -3
- package/src/feature-libraries/optional-field/index.ts +6 -8
- package/src/feature-libraries/optional-field/optionalField.ts +31 -0
- package/src/feature-libraries/optional-field/requiredField.ts +62 -0
- package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +1 -1
- package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +1 -0
- package/src/feature-libraries/schemaChecker.ts +3 -2
- package/src/feature-libraries/sequence-field/index.ts +2 -51
- package/src/feature-libraries/sequence-field/rebase.ts +1 -1
- package/src/feature-libraries/sequence-field/sequenceKind.ts +40 -0
- package/src/index.ts +7 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +4 -3
- package/src/shared-tree/schematizingTreeView.ts +17 -13
- package/src/shared-tree/sharedTree.ts +9 -46
- package/src/shared-tree/sharedTreeChangeCodecs.ts +1 -0
- package/src/shared-tree/sharedTreeChangeEnricher.ts +87 -66
- package/src/shared-tree/tree.ts +10 -10
- package/src/shared-tree/treeAlpha.ts +26 -25
- package/src/shared-tree/treeCheckout.ts +119 -23
- package/src/shared-tree-core/branch.ts +9 -5
- package/src/shared-tree-core/branchCommitEnricher.ts +25 -77
- package/src/shared-tree-core/branchIdCodec.ts +1 -0
- package/src/shared-tree-core/changeEnricher.ts +8 -52
- package/src/shared-tree-core/defaultResubmitMachine.ts +39 -51
- package/src/shared-tree-core/editManager.ts +32 -32
- package/src/shared-tree-core/editManagerCodecs.ts +2 -2
- package/src/shared-tree-core/editManagerCodecsCommons.ts +7 -6
- package/src/shared-tree-core/editManagerCodecsV1toV4.ts +1 -1
- package/src/shared-tree-core/editManagerCodecsVSharedBranches.ts +2 -2
- package/src/shared-tree-core/editManagerFormatCommons.ts +1 -0
- package/src/shared-tree-core/editManagerFormatV1toV4.ts +1 -0
- package/src/shared-tree-core/editManagerFormatVSharedBranches.ts +3 -2
- package/src/shared-tree-core/index.ts +2 -5
- package/src/shared-tree-core/messageCodecV1ToV4.ts +3 -3
- package/src/shared-tree-core/messageCodecVSharedBranches.ts +4 -4
- package/src/shared-tree-core/messageCodecs.ts +2 -2
- package/src/shared-tree-core/messageFormatV1ToV4.ts +1 -0
- package/src/shared-tree-core/messageFormatVSharedBranches.ts +1 -0
- package/src/shared-tree-core/messageTypes.ts +1 -0
- package/src/shared-tree-core/sharedTreeCore.ts +27 -28
- package/src/shared-tree-core/versionedSummarizer.ts +3 -1
- package/src/simple-tree/api/configuration.ts +9 -9
- package/src/simple-tree/api/create.ts +7 -6
- package/src/simple-tree/api/dirtyIndex.ts +4 -2
- package/src/simple-tree/api/discrepancies.ts +9 -8
- package/src/simple-tree/api/getJsonSchema.ts +4 -3
- package/src/simple-tree/api/identifierIndex.ts +4 -2
- package/src/simple-tree/api/incrementalAllowedTypes.ts +6 -5
- package/src/simple-tree/api/index.ts +3 -0
- package/src/simple-tree/api/schemaCompatibilityTester.ts +3 -3
- package/src/simple-tree/api/schemaCreationUtilities.ts +4 -3
- package/src/simple-tree/api/schemaFactory.ts +16 -17
- package/src/simple-tree/api/schemaFactoryAlpha.ts +22 -22
- package/src/simple-tree/api/schemaFactoryBeta.ts +18 -16
- package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -1
- package/src/simple-tree/api/schemaFromSimple.ts +1 -1
- package/src/simple-tree/api/schemaStatics.ts +2 -0
- package/src/simple-tree/api/simpleSchemaCodec.ts +12 -11
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +24 -22
- package/src/simple-tree/api/simpleTreeIndex.ts +6 -4
- package/src/simple-tree/api/snapshotCompatibilityChecker.ts +504 -1
- package/src/simple-tree/api/storedSchema.ts +2 -1
- package/src/simple-tree/api/tree.ts +5 -3
- package/src/simple-tree/api/treeBeta.ts +3 -3
- package/src/simple-tree/api/treeNodeApi.ts +14 -13
- package/src/simple-tree/api/typesUnsafe.ts +7 -8
- package/src/simple-tree/api/verboseTree.ts +6 -5
- package/src/simple-tree/core/allowedTypes.ts +4 -4
- package/src/simple-tree/core/context.ts +1 -1
- package/src/simple-tree/core/treeNode.ts +1 -1
- package/src/simple-tree/core/treeNodeKernel.ts +7 -5
- package/src/simple-tree/core/treeNodeSchema.ts +7 -6
- package/src/simple-tree/core/treeNodeValid.ts +9 -9
- package/src/simple-tree/core/unhydratedFlexTree.ts +1 -1
- package/src/simple-tree/core/withType.ts +3 -2
- package/src/simple-tree/createContext.ts +1 -0
- package/src/simple-tree/fieldSchema.ts +1 -2
- package/src/simple-tree/index.ts +3 -0
- package/src/simple-tree/leafNodeSchema.ts +3 -3
- package/src/simple-tree/node-kinds/array/arrayNode.ts +17 -16
- package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +2 -2
- package/src/simple-tree/node-kinds/common.ts +1 -1
- package/src/simple-tree/node-kinds/map/mapNode.ts +16 -15
- package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +2 -2
- package/src/simple-tree/node-kinds/object/objectNode.ts +11 -11
- package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +8 -7
- package/src/simple-tree/node-kinds/record/recordNode.ts +12 -12
- package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +1 -2
- package/src/simple-tree/prepareForInsertion.ts +10 -8
- package/src/simple-tree/simpleSchema.ts +1 -0
- package/src/simple-tree/treeSchema.ts +1 -0
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +2 -2
- package/src/tableSchema.ts +3 -1
- package/src/text/README.md +8 -0
- package/src/text/index.ts +7 -0
- package/src/text/textDomain.ts +199 -0
- package/src/text/textDomainFormatted.ts +309 -0
- package/src/treeFactory.ts +4 -4
- package/src/util/bTreeUtils.ts +33 -22
- package/src/util/nestedMap.ts +12 -12
- package/src/util/readSnapshotBlob.ts +4 -2
- package/.eslintrc.cjs +0 -125
- package/assertTagging.config.mjs +0 -14
- package/dist/shared-tree-core/transactionEnricher.d.ts +0 -23
- package/dist/shared-tree-core/transactionEnricher.d.ts.map +0 -1
- package/dist/shared-tree-core/transactionEnricher.js +0 -74
- package/dist/shared-tree-core/transactionEnricher.js.map +0 -1
- package/lib/shared-tree-core/transactionEnricher.d.ts +0 -23
- package/lib/shared-tree-core/transactionEnricher.d.ts.map +0 -1
- package/lib/shared-tree-core/transactionEnricher.js +0 -70
- package/lib/shared-tree-core/transactionEnricher.js.map +0 -1
- package/src/shared-tree-core/transactionEnricher.ts +0 -74
|
@@ -7,16 +7,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.recordSchema = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
10
|
-
const index_js_1 = require("../../../
|
|
11
|
-
const index_js_2 = require("
|
|
10
|
+
const index_js_1 = require("../../../core/index.js");
|
|
11
|
+
const index_js_2 = require("../../../feature-libraries/index.js");
|
|
12
|
+
const index_js_3 = require("../../../util/index.js");
|
|
13
|
+
const index_js_4 = require("../../core/index.js");
|
|
12
14
|
const createContext_js_1 = require("../../createContext.js");
|
|
13
|
-
const getTreeNodeForField_js_1 = require("../../getTreeNodeForField.js");
|
|
14
15
|
const fieldSchema_js_1 = require("../../fieldSchema.js");
|
|
15
|
-
const
|
|
16
|
-
const index_js_3 = require("../../../feature-libraries/index.js");
|
|
16
|
+
const getTreeNodeForField_js_1 = require("../../getTreeNodeForField.js");
|
|
17
17
|
const prepareForInsertion_js_1 = require("../../prepareForInsertion.js");
|
|
18
|
+
const unhydratedFlexTreeFromInsertable_js_1 = require("../../unhydratedFlexTreeFromInsertable.js");
|
|
18
19
|
const common_js_1 = require("../common.js");
|
|
19
|
-
const index_js_4 = require("../../../core/index.js");
|
|
20
20
|
/**
|
|
21
21
|
* Create a proxy which implements the {@link TreeRecordNode} API.
|
|
22
22
|
* @param proxyTarget - Target object of the proxy.
|
|
@@ -29,11 +29,11 @@ function createRecordNodeProxy(proxyTarget, customizable, schema) {
|
|
|
29
29
|
if (typeof key === "symbol") {
|
|
30
30
|
switch (key) {
|
|
31
31
|
// POJO mode records don't have TreeNode's build in members on their targets, so special case them:
|
|
32
|
-
case
|
|
32
|
+
case index_js_4.typeSchemaSymbol: {
|
|
33
33
|
return schema;
|
|
34
34
|
}
|
|
35
35
|
// eslint-disable-next-line import-x/no-deprecated
|
|
36
|
-
case
|
|
36
|
+
case index_js_4.typeNameSymbol: {
|
|
37
37
|
return schema.identifier;
|
|
38
38
|
}
|
|
39
39
|
case Symbol.iterator: {
|
|
@@ -58,8 +58,8 @@ function createRecordNodeProxy(proxyTarget, customizable, schema) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
if (typeof key === "string") {
|
|
61
|
-
const innerNode = (0,
|
|
62
|
-
const field = innerNode.tryGetField((0,
|
|
61
|
+
const innerNode = (0, index_js_4.getInnerNode)(receiver);
|
|
62
|
+
const field = innerNode.tryGetField((0, index_js_3.brand)(key));
|
|
63
63
|
if (field !== undefined) {
|
|
64
64
|
return (0, getTreeNodeForField_js_1.tryGetTreeNodeForField)(field);
|
|
65
65
|
}
|
|
@@ -70,11 +70,11 @@ function createRecordNodeProxy(proxyTarget, customizable, schema) {
|
|
|
70
70
|
if (typeof key === "symbol") {
|
|
71
71
|
return false;
|
|
72
72
|
}
|
|
73
|
-
const innerNode = (0,
|
|
74
|
-
const field = innerNode.getBoxed((0,
|
|
75
|
-
const kernel = (0,
|
|
76
|
-
const innerSchema = innerNode.context.schema.nodeSchema.get((0,
|
|
77
|
-
(0, internal_1.assert)(innerSchema instanceof
|
|
73
|
+
const innerNode = (0, index_js_4.getInnerNode)(receiver);
|
|
74
|
+
const field = innerNode.getBoxed((0, index_js_3.brand)(key));
|
|
75
|
+
const kernel = (0, index_js_4.getKernel)(receiver);
|
|
76
|
+
const innerSchema = innerNode.context.schema.nodeSchema.get((0, index_js_3.brand)(schema.identifier));
|
|
77
|
+
(0, internal_1.assert)(innerSchema instanceof index_js_1.MapNodeStoredSchema, 0xc1a /* Expected MapNodeStoredSchema */);
|
|
78
78
|
const mapTree = (0, prepareForInsertion_js_1.prepareForInsertion)(value, (0, fieldSchema_js_1.createFieldSchema)(fieldSchema_js_1.FieldKind.Optional, kernel.schema.info), innerNode.context, innerSchema.mapFields);
|
|
79
79
|
field.editor.set(mapTree, field.length === 0);
|
|
80
80
|
return true;
|
|
@@ -83,20 +83,20 @@ function createRecordNodeProxy(proxyTarget, customizable, schema) {
|
|
|
83
83
|
if (typeof key === "symbol") {
|
|
84
84
|
return false;
|
|
85
85
|
}
|
|
86
|
-
const innerNode = (0,
|
|
87
|
-
const childField = innerNode.tryGetField((0,
|
|
86
|
+
const innerNode = (0, index_js_4.getInnerNode)(proxy);
|
|
87
|
+
const childField = innerNode.tryGetField((0, index_js_3.brand)(key));
|
|
88
88
|
return childField !== undefined;
|
|
89
89
|
},
|
|
90
90
|
ownKeys: (target) => {
|
|
91
|
-
const innerNode = (0,
|
|
91
|
+
const innerNode = (0, index_js_4.getInnerNode)(proxy);
|
|
92
92
|
return [...innerNode.keys()];
|
|
93
93
|
},
|
|
94
94
|
getOwnPropertyDescriptor: (target, key) => {
|
|
95
95
|
if (typeof key === "symbol") {
|
|
96
96
|
return undefined;
|
|
97
97
|
}
|
|
98
|
-
const innerNode = (0,
|
|
99
|
-
const field = innerNode.tryGetField((0,
|
|
98
|
+
const innerNode = (0, index_js_4.getInnerNode)(proxy);
|
|
99
|
+
const field = innerNode.tryGetField((0, index_js_3.brand)(key));
|
|
100
100
|
if (field === undefined) {
|
|
101
101
|
return undefined;
|
|
102
102
|
}
|
|
@@ -114,8 +114,8 @@ function createRecordNodeProxy(proxyTarget, customizable, schema) {
|
|
|
114
114
|
if (typeof key === "symbol") {
|
|
115
115
|
return false;
|
|
116
116
|
}
|
|
117
|
-
const innerNode = (0,
|
|
118
|
-
const field = innerNode.tryGetField((0,
|
|
117
|
+
const innerNode = (0, index_js_4.getInnerNode)(proxy);
|
|
118
|
+
const field = innerNode.tryGetField((0, index_js_3.brand)(key));
|
|
119
119
|
if (field !== undefined) {
|
|
120
120
|
field.editor.set(undefined, field.length === 0);
|
|
121
121
|
}
|
|
@@ -124,12 +124,12 @@ function createRecordNodeProxy(proxyTarget, customizable, schema) {
|
|
|
124
124
|
});
|
|
125
125
|
return proxy;
|
|
126
126
|
}
|
|
127
|
-
class CustomRecordNodeBase extends
|
|
127
|
+
class CustomRecordNodeBase extends index_js_4.TreeNodeValid {
|
|
128
128
|
constructor(input) {
|
|
129
129
|
super(input ?? {});
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
CustomRecordNodeBase.kind =
|
|
132
|
+
CustomRecordNodeBase.kind = index_js_4.NodeKind.Record;
|
|
133
133
|
/**
|
|
134
134
|
* Define a {@link TreeNodeSchema} for a {@link TreeRecordNode}.
|
|
135
135
|
*
|
|
@@ -140,10 +140,10 @@ CustomRecordNodeBase.kind = index_js_2.NodeKind.Record;
|
|
|
140
140
|
function recordSchema(options) {
|
|
141
141
|
const { identifier, info, customizable, implicitlyConstructable, nodeOptions } = options;
|
|
142
142
|
const persistedMetadata = nodeOptions?.persistedMetadata;
|
|
143
|
-
const normalizedTypes = (0,
|
|
143
|
+
const normalizedTypes = (0, index_js_4.normalizeAllowedTypes)(info);
|
|
144
144
|
const lazyAllowedTypesIdentifiers = new internal_1.Lazy(() => new Set(normalizedTypes.evaluate().map((type) => type.identifier)));
|
|
145
145
|
const lazySimpleAllowedTypes = new internal_1.Lazy(() => {
|
|
146
|
-
return
|
|
146
|
+
return index_js_4.AnnotatedAllowedTypesInternal.evaluateSimpleAllowedTypes(normalizedTypes);
|
|
147
147
|
});
|
|
148
148
|
let privateData;
|
|
149
149
|
class Schema extends CustomRecordNodeBase {
|
|
@@ -210,10 +210,10 @@ function recordSchema(options) {
|
|
|
210
210
|
return normalizedTypes.evaluateSet();
|
|
211
211
|
}
|
|
212
212
|
// eslint-disable-next-line import-x/no-deprecated
|
|
213
|
-
get [
|
|
213
|
+
get [index_js_4.typeNameSymbol]() {
|
|
214
214
|
return identifier;
|
|
215
215
|
}
|
|
216
|
-
get [
|
|
216
|
+
get [index_js_4.typeSchemaSymbol]() {
|
|
217
217
|
return Schema.constructorCached?.constructor;
|
|
218
218
|
}
|
|
219
219
|
[Symbol.iterator]() {
|
|
@@ -222,8 +222,8 @@ function recordSchema(options) {
|
|
|
222
222
|
get [Symbol.toStringTag]() {
|
|
223
223
|
return identifier;
|
|
224
224
|
}
|
|
225
|
-
static get [
|
|
226
|
-
return (privateData ??= (0,
|
|
225
|
+
static get [index_js_4.privateDataSymbol]() {
|
|
226
|
+
return (privateData ??= (0, index_js_4.createTreeNodeSchemaPrivateData)(this, [normalizedTypes]));
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
Schema.constructorCached = undefined;
|
|
@@ -245,13 +245,13 @@ function* recordIterator(record) {
|
|
|
245
245
|
* {@link TreeNodeSchemaInitializedData.shallowCompatibilityTest} for Record nodes.
|
|
246
246
|
*/
|
|
247
247
|
function shallowCompatibilityTest(data) {
|
|
248
|
-
if ((0,
|
|
249
|
-
return
|
|
248
|
+
if ((0, index_js_2.isTreeValue)(data)) {
|
|
249
|
+
return index_js_4.CompatibilityLevel.None;
|
|
250
250
|
}
|
|
251
251
|
if (Symbol.iterator in data) {
|
|
252
|
-
return
|
|
252
|
+
return index_js_4.CompatibilityLevel.None;
|
|
253
253
|
}
|
|
254
|
-
return
|
|
254
|
+
return index_js_4.CompatibilityLevel.Normal;
|
|
255
255
|
}
|
|
256
256
|
/**
|
|
257
257
|
* {@link TreeNodeSchemaInitializedData.toFlexContent} for Record nodes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordNode.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/record/recordNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AACnE,uEAAsE;AAEtE,qDAAkF;AAElF,kDAwB6B;AAC7B,6DAA0E;AAC1E,yEAAsE;AACtE,yDAAoE;AACpE,mGAImD;AAQnD,kEAI6C;AAC7C,yEAAmE;AACnE,4CAA2D;AAC3D,qDAA6D;AAI7D;;;;;GAKG;AACH,SAAS,qBAAqB,CAC7B,WAAmB,EACnB,YAAqB,EACrB,MAAwB;IAExB,MAAM,KAAK,GAAmB,IAAI,KAAK,CAAiB,WAA6B,EAAE;QACtF,GAAG,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAW,EAAE;YACvC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;gBAC7B,QAAQ,GAAG,EAAE,CAAC;oBACb,mGAAmG;oBACnG,KAAK,2BAAgB,CAAC,CAAC,CAAC;wBACvB,OAAO,MAAM,CAAC;oBACf,CAAC;oBACD,kDAAkD;oBAClD,KAAK,yBAAc,CAAC,CAAC,CAAC;wBACrB,OAAO,MAAM,CAAC,UAAU,CAAC;oBAC1B,CAAC;oBACD,KAAK,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;wBACtB,OAAO,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;oBACpC,CAAC;oBACD,KAAK,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;wBACzB,qDAAqD;wBACrD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBACpD,CAAC;oBACD,KAAK,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;wBACzB,4EAA4E;wBAC5E,2CAA2C;wBAC3C,IAAI,YAAY,EAAE,CAAC;4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5D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Lazy } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type JsonCompatibleReadOnlyObject, brand } from \"../../../util/index.js\";\n\nimport {\n\ttype TreeNodeSchema,\n\tNodeKind,\n\t// eslint-disable-next-line import-x/no-deprecated\n\ttypeNameSymbol,\n\ttypeSchemaSymbol,\n\ttype UnhydratedFlexTreeNode,\n\tgetInnerNode,\n\tgetKernel,\n\ttype InternalTreeNode,\n\ttype NodeSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tTreeNodeValid,\n\ttype MostDerivedData,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaCorePrivate,\n\tprivateDataSymbol,\n\tcreateTreeNodeSchemaPrivateData,\n\ttype FlexContent,\n\tCompatibilityLevel,\n\ttype TreeNodeSchemaPrivateData,\n\tAnnotatedAllowedTypesInternal,\n} from \"../../core/index.js\";\nimport { getTreeNodeSchemaInitializedData } from \"../../createContext.js\";\nimport { tryGetTreeNodeForField } from \"../../getTreeNodeForField.js\";\nimport { createFieldSchema, FieldKind } from \"../../fieldSchema.js\";\nimport {\n\tunhydratedFlexTreeFromInsertable,\n\ttype FactoryContent,\n\ttype InsertableContent,\n} from \"../../unhydratedFlexTreeFromInsertable.js\";\nimport type {\n\tRecordNodeCustomizableSchema,\n\tRecordNodeInsertableData,\n\tRecordNodePojoEmulationSchema,\n\tRecordNodeSchema,\n\tTreeRecordNode,\n} from \"./recordNodeTypes.js\";\nimport {\n\tisTreeValue,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n} from \"../../../feature-libraries/index.js\";\nimport { prepareForInsertion } from \"../../prepareForInsertion.js\";\nimport { recordLikeDataToFlexContent } from \"../common.js\";\nimport { MapNodeStoredSchema } from \"../../../core/index.js\";\nimport type { NodeSchemaOptionsAlpha } from \"../../api/index.js\";\nimport type { SchemaType, SimpleAllowedTypeAttributes } from \"../../simpleSchema.js\";\n\n/**\n * Create a proxy which implements the {@link TreeRecordNode} API.\n * @param proxyTarget - Target object of the proxy.\n * @param customizable - See {@link RecordNodeSchemaOptions.customizable}.\n * @param schema - The schema of the record node.\n */\nfunction createRecordNodeProxy(\n\tproxyTarget: object,\n\tcustomizable: boolean,\n\tschema: RecordNodeSchema,\n): TreeRecordNode {\n\tconst proxy: TreeRecordNode = new Proxy<TreeRecordNode>(proxyTarget as TreeRecordNode, {\n\t\tget: (target, key, receiver): unknown => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\tswitch (key) {\n\t\t\t\t\t// POJO mode records don't have TreeNode's build in members on their targets, so special case them:\n\t\t\t\t\tcase typeSchemaSymbol: {\n\t\t\t\t\t\treturn schema;\n\t\t\t\t\t}\n\t\t\t\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\t\t\t\tcase typeNameSymbol: {\n\t\t\t\t\t\treturn schema.identifier;\n\t\t\t\t\t}\n\t\t\t\t\tcase Symbol.iterator: {\n\t\t\t\t\t\treturn () => recordIterator(proxy);\n\t\t\t\t\t}\n\t\t\t\t\tcase Symbol.toPrimitive: {\n\t\t\t\t\t\t// Handle string interpolation and coercion to string\n\t\t\t\t\t\treturn () => Object.prototype.toString.call(proxy);\n\t\t\t\t\t}\n\t\t\t\t\tcase Symbol.toStringTag: {\n\t\t\t\t\t\t// In order to satisfy deep equality checks in POJO (non-customizable) mode,\n\t\t\t\t\t\t// we cannot override the behavior of this.\n\t\t\t\t\t\tif (customizable) {\n\t\t\t\t\t\t\t// Generates nicer toString behavior for customizable records.\n\t\t\t\t\t\t\t// E.g. `[object My.Record]` instead of `[object Object]`.\n\t\t\t\t\t\t\treturn schema.identifier;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t// No-op\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof key === \"string\") {\n\t\t\t\tconst innerNode = getInnerNode(receiver);\n\t\t\t\tconst field = innerNode.tryGetField(brand(key));\n\t\t\t\tif (field !== undefined) {\n\t\t\t\t\treturn tryGetTreeNodeForField(field);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t},\n\t\tset: (target, key, value: InsertableContent | undefined, receiver): boolean => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(receiver);\n\t\t\tconst field = innerNode.getBoxed(brand(key)) as FlexTreeOptionalField;\n\t\t\tconst kernel = getKernel(receiver);\n\t\t\tconst innerSchema = innerNode.context.schema.nodeSchema.get(brand(schema.identifier));\n\t\t\tassert(\n\t\t\t\tinnerSchema instanceof MapNodeStoredSchema,\n\t\t\t\t0xc1a /* Expected MapNodeStoredSchema */,\n\t\t\t);\n\n\t\t\tconst mapTree = prepareForInsertion(\n\t\t\t\tvalue,\n\t\t\t\tcreateFieldSchema(FieldKind.Optional, kernel.schema.info as ImplicitAllowedTypes),\n\t\t\t\tinnerNode.context,\n\t\t\t\tinnerSchema.mapFields,\n\t\t\t);\n\n\t\t\tfield.editor.set(mapTree, field.length === 0);\n\t\t\treturn true;\n\t\t},\n\t\thas: (target, key): boolean => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\tconst childField = innerNode.tryGetField(brand(key));\n\n\t\t\treturn childField !== undefined;\n\t\t},\n\t\townKeys: (target) => {\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\treturn [...innerNode.keys()];\n\t\t},\n\t\tgetOwnPropertyDescriptor: (target, key) => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\tconst field = innerNode.tryGetField(brand(key));\n\n\t\t\tif (field === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tvalue: tryGetTreeNodeForField(field),\n\t\t\t\twritable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true, // Must be 'configurable' if property is absent from proxy target.\n\t\t\t};\n\t\t},\n\t\tdefineProperty(target, key, attributes) {\n\t\t\tthrow new UsageError(\"Shadowing properties of record nodes is not permitted.\");\n\t\t},\n\t\tdeleteProperty(target, key) {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\tconst field = innerNode.tryGetField(brand(key)) as FlexTreeOptionalField | undefined;\n\t\t\tif (field !== undefined) {\n\t\t\t\tfield.editor.set(undefined, field.length === 0);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t});\n\treturn proxy;\n}\n\nabstract class CustomRecordNodeBase<\n\tconst TAllowedTypes extends ImplicitAllowedTypes,\n> extends TreeNodeValid<RecordNodeInsertableData<TAllowedTypes>> {\n\tpublic static readonly kind = NodeKind.Record;\n\n\tpublic constructor(\n\t\tinput?: InternalTreeNode | RecordNodeInsertableData<TAllowedTypes> | undefined,\n\t) {\n\t\tsuper(input ?? {});\n\t}\n}\n\n/**\n * {@link recordSchema} options.\n * @input\n */\nexport interface RecordSchemaOptions<\n\tTName extends string,\n\tTAllowedTypes extends ImplicitAllowedTypes,\n\tTImplicitlyConstructable extends boolean,\n\tTCustomMetadata = unknown,\n> {\n\t/**\n\t * Unique identifier for this schema within this factory's scope.\n\t */\n\treadonly identifier: TName;\n\n\treadonly customizable: boolean;\n\n\t/**\n\t * The kinds of nodes that are allowed as children of this record.\n\t */\n\treadonly info: TAllowedTypes;\n\n\treadonly implicitlyConstructable: TImplicitlyConstructable;\n\n\treadonly nodeOptions?: NodeSchemaOptionsAlpha<TCustomMetadata>;\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link TreeRecordNode}.\n *\n * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n * @param persistedMetadata -\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function recordSchema<\n\tTName extends string,\n\tconst TAllowedTypes extends ImplicitAllowedTypes,\n\tconst TImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\toptions: RecordSchemaOptions<\n\t\tTName,\n\t\tTAllowedTypes,\n\t\tTImplicitlyConstructable,\n\t\tTCustomMetadata\n\t>,\n) {\n\tconst { identifier, info, customizable, implicitlyConstructable, nodeOptions } = options;\n\tconst persistedMetadata = nodeOptions?.persistedMetadata;\n\n\tconst normalizedTypes = normalizeAllowedTypes(info);\n\tconst lazyAllowedTypesIdentifiers = new Lazy(\n\t\t() => new Set(normalizedTypes.evaluate().map((type) => type.identifier)),\n\t);\n\tconst lazySimpleAllowedTypes = new Lazy(() => {\n\t\treturn AnnotatedAllowedTypesInternal.evaluateSimpleAllowedTypes(normalizedTypes);\n\t});\n\n\tlet privateData: TreeNodeSchemaPrivateData | undefined;\n\n\tclass Schema\n\t\textends CustomRecordNodeBase<TAllowedTypes>\n\t\timplements TreeRecordNode<TAllowedTypes>\n\t{\n\t\t/**\n\t\t * Record-like index signature for the node.\n\t\t */\n\t\t[key: string]: TreeNodeFromImplicitAllowedTypes<TAllowedTypes>;\n\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\t// Differentiate between the following cases:\n\t\t\t//\n\t\t\t// Case 1: Direct construction (POJO emulation)\n\t\t\t//\n\t\t\t// const Foo = schemaFactory.record(\"Foo\", schemaFactory.number);\n\t\t\t//\n\t\t\t// assert.deepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t//\t\t \"Prototype chain equivalent to POJO.\");\n\t\t\t//\n\t\t\t// Case 2: Subclass construction (Customizable Record)\n\t\t\t//\n\t\t\t// \t class Foo extends schemaFactory.record(\"Foo\", schemaFactory.number) {}\n\t\t\t//\n\t\t\t// \t assert.notDeepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t// \t \"Subclass prototype chain differs from POJO.\");\n\t\t\t//\n\t\t\t// In Case 1 (POJO emulation), the prototype chain match '{}' (proxyTarget = undefined)\n\t\t\t// In Case 2 (Customizable Object), the prototype chain include the user's subclass (proxyTarget = this)\n\t\t\tconst proxyTarget = customizable ? instance : {};\n\t\t\treturn createRecordNodeProxy(\n\t\t\t\tproxyTarget,\n\t\t\t\tcustomizable,\n\t\t\t\tthis as unknown as RecordNodeSchema,\n\t\t\t) as unknown as Schema;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn unhydratedFlexTreeFromInsertable(input as object, this as typeof Schema);\n\t\t}\n\n\t\tprotected static override oneTimeSetup(): TreeNodeSchemaInitializedData {\n\t\t\t// First run, do extra validation.\n\t\t\t// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.\n\t\t\t// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).\n\t\t\t{\n\t\t\t\tlet prototype: object = this.prototype;\n\t\t\t\t// There isn't a clear cleaner way to author this loop.\n\t\t\t\twhile (prototype !== Schema.prototype) {\n\t\t\t\t\tfor (const key of Object.getOwnPropertyNames(prototype)) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t// constructor is a special case, since one is built in on the derived type, and shadowing it works fine since we only use it before fields are applied.\n\t\t\t\t\t\t\tkey !== \"constructor\" &&\n\t\t\t\t\t\t\tReflect.getOwnPropertyDescriptor(prototype, key) !== undefined\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Schema ${identifier} defines an inherited property \"${key.toString()}\" which could shadow a legal entry. Since child fields are exposed as own properties, shadowing properties of record nodes is not permitted.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Since this stops at CustomRecordNode, it should never see a null prototype, so this case is safe.\n\t\t\t\t\t// Additionally, if the prototype chain is ever messed up such that CustomRecordNode is not in it,\n\t\t\t\t\t// the null that would show up here does at least ensure this code throws instead of hanging.\n\t\t\t\t\tprototype = Reflect.getPrototypeOf(prototype) as object;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst schema = this as RecordNodeSchema;\n\t\t\treturn getTreeNodeSchemaInitializedData(this, {\n\t\t\t\tshallowCompatibilityTest,\n\t\t\t\ttoFlexContent: (data: FactoryContent): FlexContent =>\n\t\t\t\t\trecordToFlexContent(data, schema),\n\t\t\t});\n\t\t}\n\n\t\tpublic static get allowedTypesIdentifiers(): ReadonlySet<string> {\n\t\t\treturn lazyAllowedTypesIdentifiers.value;\n\t\t}\n\n\t\tpublic static get simpleAllowedTypes(): ReadonlyMap<\n\t\t\tstring,\n\t\t\tSimpleAllowedTypeAttributes<SchemaType.View>\n\t\t> {\n\t\t\treturn lazySimpleAllowedTypes.value;\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: TImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn normalizedTypes.evaluateSet();\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> =\n\t\t\tnodeOptions?.metadata ?? {};\n\t\tpublic static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =\n\t\t\tpersistedMetadata;\n\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): Output {\n\t\t\treturn Schema.constructorCached?.constructor as unknown as Output;\n\t\t}\n\n\t\tpublic [Symbol.iterator](): IterableIterator<\n\t\t\t[string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>]\n\t\t> {\n\t\t\treturn recordIterator(this);\n\t\t}\n\t\tpublic get [Symbol.toStringTag](): string {\n\t\t\treturn identifier;\n\t\t}\n\n\t\tpublic static get [privateDataSymbol](): TreeNodeSchemaPrivateData {\n\t\t\treturn (privateData ??= createTreeNodeSchemaPrivateData(this, [normalizedTypes]));\n\t\t}\n\t}\n\n\ttype Output = RecordNodeCustomizableSchema<\n\t\tTName,\n\t\tTAllowedTypes,\n\t\tTImplicitlyConstructable,\n\t\tTCustomMetadata\n\t> &\n\t\tRecordNodePojoEmulationSchema<\n\t\t\tTName,\n\t\t\tTAllowedTypes,\n\t\t\tTImplicitlyConstructable,\n\t\t\tTCustomMetadata\n\t\t> &\n\t\tTreeNodeSchemaCorePrivate;\n\n\tconst output: Output = Schema;\n\treturn output;\n}\n\nfunction* recordIterator<TAllowedTypes extends ImplicitAllowedTypes>(\n\trecord: TreeRecordNode<TAllowedTypes>,\n): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>]> {\n\tfor (const [key, value] of Object.entries(record)) {\n\t\tyield [key, value];\n\t}\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.shallowCompatibilityTest} for Record nodes.\n */\nfunction shallowCompatibilityTest(data: FactoryContent): CompatibilityLevel {\n\tif (isTreeValue(data)) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\tif (Symbol.iterator in data) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\treturn CompatibilityLevel.Normal;\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.toFlexContent} for Record nodes.\n *\n * Transforms data under a Record schema.\n * @param data - The tree data to be transformed. Must be a Record-like object.\n * @param schema - The schema to comply with.\n */\nfunction recordToFlexContent(data: FactoryContent, schema: RecordNodeSchema): FlexContent {\n\tif (!(typeof data === \"object\" && data !== null)) {\n\t\tthrow new UsageError(`Input data is incompatible with Record schema: ${data}`);\n\t}\n\n\tconst fieldsIterator: Iterable<readonly [string, InsertableContent]> = Object.entries(data);\n\treturn recordLikeDataToFlexContent(fieldsIterator, schema);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"recordNode.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/record/recordNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AACnE,uEAAsE;AAEtE,qDAA6D;AAC7D,kEAI6C;AAC7C,qDAAkF;AAElF,kDAwB6B;AAC7B,6DAA0E;AAC1E,yDAAoE;AACpE,yEAAsE;AACtE,yEAAmE;AAEnE,mGAImD;AACnD,4CAA2D;AAU3D;;;;;GAKG;AACH,SAAS,qBAAqB,CAC7B,WAAmB,EACnB,YAAqB,EACrB,MAAwB;IAExB,MAAM,KAAK,GAAmB,IAAI,KAAK,CAAiB,WAA6B,EAAE;QACtF,GAAG,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAW,EAAE;YACvC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;gBAC7B,QAAQ,GAAG,EAAE,CAAC;oBACb,mGAAmG;oBACnG,KAAK,2BAAgB,CAAC,CAAC,CAAC;wBACvB,OAAO,MAAM,CAAC;oBACf,CAAC;oBACD,kDAAkD;oBAClD,KAAK,yBAAc,CAAC,CAAC,CAAC;wBACrB,OAAO,MAAM,CAAC,UAAU,CAAC;oBAC1B,CAAC;oBACD,KAAK,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;wBACtB,OAAO,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;oBACpC,CAAC;oBACD,KAAK,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;wBACzB,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,IAAI,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,qBAAU,CAAC,kDAAkD,IAAI,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,MAAM,cAAc,GAAmD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5F,OAAO,IAAA,uCAA2B,EAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Lazy } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { MapNodeStoredSchema } from \"../../../core/index.js\";\nimport {\n\tisTreeValue,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n} from \"../../../feature-libraries/index.js\";\nimport { type JsonCompatibleReadOnlyObject, brand } from \"../../../util/index.js\";\nimport type { NodeSchemaOptionsAlpha } from \"../../api/index.js\";\nimport {\n\ttype TreeNodeSchema,\n\tNodeKind,\n\t// eslint-disable-next-line import-x/no-deprecated\n\ttypeNameSymbol,\n\ttypeSchemaSymbol,\n\ttype UnhydratedFlexTreeNode,\n\tgetInnerNode,\n\tgetKernel,\n\ttype InternalTreeNode,\n\ttype NodeSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tTreeNodeValid,\n\ttype MostDerivedData,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaCorePrivate,\n\tprivateDataSymbol,\n\tcreateTreeNodeSchemaPrivateData,\n\ttype FlexContent,\n\tCompatibilityLevel,\n\ttype TreeNodeSchemaPrivateData,\n\tAnnotatedAllowedTypesInternal,\n} from \"../../core/index.js\";\nimport { getTreeNodeSchemaInitializedData } from \"../../createContext.js\";\nimport { createFieldSchema, FieldKind } from \"../../fieldSchema.js\";\nimport { tryGetTreeNodeForField } from \"../../getTreeNodeForField.js\";\nimport { prepareForInsertion } from \"../../prepareForInsertion.js\";\nimport type { SchemaType, SimpleAllowedTypeAttributes } from \"../../simpleSchema.js\";\nimport {\n\tunhydratedFlexTreeFromInsertable,\n\ttype FactoryContent,\n\ttype InsertableContent,\n} from \"../../unhydratedFlexTreeFromInsertable.js\";\nimport { recordLikeDataToFlexContent } from \"../common.js\";\n\nimport type {\n\tRecordNodeCustomizableSchema,\n\tRecordNodeInsertableData,\n\tRecordNodePojoEmulationSchema,\n\tRecordNodeSchema,\n\tTreeRecordNode,\n} from \"./recordNodeTypes.js\";\n\n/**\n * Create a proxy which implements the {@link TreeRecordNode} API.\n * @param proxyTarget - Target object of the proxy.\n * @param customizable - See {@link RecordNodeSchemaOptions.customizable}.\n * @param schema - The schema of the record node.\n */\nfunction createRecordNodeProxy(\n\tproxyTarget: object,\n\tcustomizable: boolean,\n\tschema: RecordNodeSchema,\n): TreeRecordNode {\n\tconst proxy: TreeRecordNode = new Proxy<TreeRecordNode>(proxyTarget as TreeRecordNode, {\n\t\tget: (target, key, receiver): unknown => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\tswitch (key) {\n\t\t\t\t\t// POJO mode records don't have TreeNode's build in members on their targets, so special case them:\n\t\t\t\t\tcase typeSchemaSymbol: {\n\t\t\t\t\t\treturn schema;\n\t\t\t\t\t}\n\t\t\t\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\t\t\t\tcase typeNameSymbol: {\n\t\t\t\t\t\treturn schema.identifier;\n\t\t\t\t\t}\n\t\t\t\t\tcase Symbol.iterator: {\n\t\t\t\t\t\treturn () => recordIterator(proxy);\n\t\t\t\t\t}\n\t\t\t\t\tcase Symbol.toPrimitive: {\n\t\t\t\t\t\t// Handle string interpolation and coercion to string\n\t\t\t\t\t\treturn () => Object.prototype.toString.call(proxy);\n\t\t\t\t\t}\n\t\t\t\t\tcase Symbol.toStringTag: {\n\t\t\t\t\t\t// In order to satisfy deep equality checks in POJO (non-customizable) mode,\n\t\t\t\t\t\t// we cannot override the behavior of this.\n\t\t\t\t\t\tif (customizable) {\n\t\t\t\t\t\t\t// Generates nicer toString behavior for customizable records.\n\t\t\t\t\t\t\t// E.g. `[object My.Record]` instead of `[object Object]`.\n\t\t\t\t\t\t\treturn schema.identifier;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t// No-op\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof key === \"string\") {\n\t\t\t\tconst innerNode = getInnerNode(receiver);\n\t\t\t\tconst field = innerNode.tryGetField(brand(key));\n\t\t\t\tif (field !== undefined) {\n\t\t\t\t\treturn tryGetTreeNodeForField(field);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t},\n\t\tset: (target, key, value: InsertableContent | undefined, receiver): boolean => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(receiver);\n\t\t\tconst field = innerNode.getBoxed(brand(key)) as FlexTreeOptionalField;\n\t\t\tconst kernel = getKernel(receiver);\n\t\t\tconst innerSchema = innerNode.context.schema.nodeSchema.get(brand(schema.identifier));\n\t\t\tassert(\n\t\t\t\tinnerSchema instanceof MapNodeStoredSchema,\n\t\t\t\t0xc1a /* Expected MapNodeStoredSchema */,\n\t\t\t);\n\n\t\t\tconst mapTree = prepareForInsertion(\n\t\t\t\tvalue,\n\t\t\t\tcreateFieldSchema(FieldKind.Optional, kernel.schema.info as ImplicitAllowedTypes),\n\t\t\t\tinnerNode.context,\n\t\t\t\tinnerSchema.mapFields,\n\t\t\t);\n\n\t\t\tfield.editor.set(mapTree, field.length === 0);\n\t\t\treturn true;\n\t\t},\n\t\thas: (target, key): boolean => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\tconst childField = innerNode.tryGetField(brand(key));\n\n\t\t\treturn childField !== undefined;\n\t\t},\n\t\townKeys: (target) => {\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\treturn [...innerNode.keys()];\n\t\t},\n\t\tgetOwnPropertyDescriptor: (target, key) => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\tconst field = innerNode.tryGetField(brand(key));\n\n\t\t\tif (field === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tvalue: tryGetTreeNodeForField(field),\n\t\t\t\twritable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true, // Must be 'configurable' if property is absent from proxy target.\n\t\t\t};\n\t\t},\n\t\tdefineProperty(target, key, attributes) {\n\t\t\tthrow new UsageError(\"Shadowing properties of record nodes is not permitted.\");\n\t\t},\n\t\tdeleteProperty(target, key) {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\tconst field = innerNode.tryGetField(brand(key)) as FlexTreeOptionalField | undefined;\n\t\t\tif (field !== undefined) {\n\t\t\t\tfield.editor.set(undefined, field.length === 0);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t});\n\treturn proxy;\n}\n\nabstract class CustomRecordNodeBase<\n\tconst TAllowedTypes extends ImplicitAllowedTypes,\n> extends TreeNodeValid<RecordNodeInsertableData<TAllowedTypes>> {\n\tpublic static readonly kind = NodeKind.Record;\n\n\tpublic constructor(\n\t\tinput?: InternalTreeNode | RecordNodeInsertableData<TAllowedTypes> | undefined,\n\t) {\n\t\tsuper(input ?? {});\n\t}\n}\n\n/**\n * {@link recordSchema} options.\n * @input\n */\nexport interface RecordSchemaOptions<\n\tTName extends string,\n\tTAllowedTypes extends ImplicitAllowedTypes,\n\tTImplicitlyConstructable extends boolean,\n\tTCustomMetadata = unknown,\n> {\n\t/**\n\t * Unique identifier for this schema within this factory's scope.\n\t */\n\treadonly identifier: TName;\n\n\treadonly customizable: boolean;\n\n\t/**\n\t * The kinds of nodes that are allowed as children of this record.\n\t */\n\treadonly info: TAllowedTypes;\n\n\treadonly implicitlyConstructable: TImplicitlyConstructable;\n\n\treadonly nodeOptions?: NodeSchemaOptionsAlpha<TCustomMetadata>;\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link TreeRecordNode}.\n *\n * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n * @param persistedMetadata -\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function recordSchema<\n\tTName extends string,\n\tconst TAllowedTypes extends ImplicitAllowedTypes,\n\tconst TImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\toptions: RecordSchemaOptions<\n\t\tTName,\n\t\tTAllowedTypes,\n\t\tTImplicitlyConstructable,\n\t\tTCustomMetadata\n\t>,\n) {\n\tconst { identifier, info, customizable, implicitlyConstructable, nodeOptions } = options;\n\tconst persistedMetadata = nodeOptions?.persistedMetadata;\n\n\tconst normalizedTypes = normalizeAllowedTypes(info);\n\tconst lazyAllowedTypesIdentifiers = new Lazy(\n\t\t() => new Set(normalizedTypes.evaluate().map((type) => type.identifier)),\n\t);\n\tconst lazySimpleAllowedTypes = new Lazy(() => {\n\t\treturn AnnotatedAllowedTypesInternal.evaluateSimpleAllowedTypes(normalizedTypes);\n\t});\n\n\tlet privateData: TreeNodeSchemaPrivateData | undefined;\n\n\tclass Schema\n\t\textends CustomRecordNodeBase<TAllowedTypes>\n\t\timplements TreeRecordNode<TAllowedTypes>\n\t{\n\t\t/**\n\t\t * Record-like index signature for the node.\n\t\t */\n\t\t[key: string]: TreeNodeFromImplicitAllowedTypes<TAllowedTypes>;\n\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\t// Differentiate between the following cases:\n\t\t\t//\n\t\t\t// Case 1: Direct construction (POJO emulation)\n\t\t\t//\n\t\t\t// const Foo = schemaFactory.record(\"Foo\", schemaFactory.number);\n\t\t\t//\n\t\t\t// assert.deepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t//\t\t \"Prototype chain equivalent to POJO.\");\n\t\t\t//\n\t\t\t// Case 2: Subclass construction (Customizable Record)\n\t\t\t//\n\t\t\t// \t class Foo extends schemaFactory.record(\"Foo\", schemaFactory.number) {}\n\t\t\t//\n\t\t\t// \t assert.notDeepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t// \t \"Subclass prototype chain differs from POJO.\");\n\t\t\t//\n\t\t\t// In Case 1 (POJO emulation), the prototype chain match '{}' (proxyTarget = undefined)\n\t\t\t// In Case 2 (Customizable Object), the prototype chain include the user's subclass (proxyTarget = this)\n\t\t\tconst proxyTarget = customizable ? instance : {};\n\t\t\treturn createRecordNodeProxy(\n\t\t\t\tproxyTarget,\n\t\t\t\tcustomizable,\n\t\t\t\tthis as unknown as RecordNodeSchema,\n\t\t\t) as unknown as Schema;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn unhydratedFlexTreeFromInsertable(input as object, this as typeof Schema);\n\t\t}\n\n\t\tprotected static override oneTimeSetup(): TreeNodeSchemaInitializedData {\n\t\t\t// First run, do extra validation.\n\t\t\t// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.\n\t\t\t// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).\n\t\t\t{\n\t\t\t\tlet prototype: object = this.prototype;\n\t\t\t\t// There isn't a clear cleaner way to author this loop.\n\t\t\t\twhile (prototype !== Schema.prototype) {\n\t\t\t\t\tfor (const key of Object.getOwnPropertyNames(prototype)) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t// constructor is a special case, since one is built in on the derived type, and shadowing it works fine since we only use it before fields are applied.\n\t\t\t\t\t\t\tkey !== \"constructor\" &&\n\t\t\t\t\t\t\tReflect.getOwnPropertyDescriptor(prototype, key) !== undefined\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Schema ${identifier} defines an inherited property \"${key.toString()}\" which could shadow a legal entry. Since child fields are exposed as own properties, shadowing properties of record nodes is not permitted.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Since this stops at CustomRecordNode, it should never see a null prototype, so this case is safe.\n\t\t\t\t\t// Additionally, if the prototype chain is ever messed up such that CustomRecordNode is not in it,\n\t\t\t\t\t// the null that would show up here does at least ensure this code throws instead of hanging.\n\t\t\t\t\tprototype = Reflect.getPrototypeOf(prototype) as object;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst schema = this as RecordNodeSchema;\n\t\t\treturn getTreeNodeSchemaInitializedData(this, {\n\t\t\t\tshallowCompatibilityTest,\n\t\t\t\ttoFlexContent: (data: FactoryContent): FlexContent =>\n\t\t\t\t\trecordToFlexContent(data, schema),\n\t\t\t});\n\t\t}\n\n\t\tpublic static get allowedTypesIdentifiers(): ReadonlySet<string> {\n\t\t\treturn lazyAllowedTypesIdentifiers.value;\n\t\t}\n\n\t\tpublic static get simpleAllowedTypes(): ReadonlyMap<\n\t\t\tstring,\n\t\t\tSimpleAllowedTypeAttributes<SchemaType.View>\n\t\t> {\n\t\t\treturn lazySimpleAllowedTypes.value;\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: TImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn normalizedTypes.evaluateSet();\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> =\n\t\t\tnodeOptions?.metadata ?? {};\n\t\tpublic static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =\n\t\t\tpersistedMetadata;\n\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): Output {\n\t\t\treturn Schema.constructorCached?.constructor as unknown as Output;\n\t\t}\n\n\t\tpublic [Symbol.iterator](): IterableIterator<\n\t\t\t[string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>]\n\t\t> {\n\t\t\treturn recordIterator(this);\n\t\t}\n\t\tpublic get [Symbol.toStringTag](): string {\n\t\t\treturn identifier;\n\t\t}\n\n\t\tpublic static get [privateDataSymbol](): TreeNodeSchemaPrivateData {\n\t\t\treturn (privateData ??= createTreeNodeSchemaPrivateData(this, [normalizedTypes]));\n\t\t}\n\t}\n\n\ttype Output = RecordNodeCustomizableSchema<\n\t\tTName,\n\t\tTAllowedTypes,\n\t\tTImplicitlyConstructable,\n\t\tTCustomMetadata\n\t> &\n\t\tRecordNodePojoEmulationSchema<\n\t\t\tTName,\n\t\t\tTAllowedTypes,\n\t\t\tTImplicitlyConstructable,\n\t\t\tTCustomMetadata\n\t\t> &\n\t\tTreeNodeSchemaCorePrivate;\n\n\tconst output: Output = Schema;\n\treturn output;\n}\n\nfunction* recordIterator<TAllowedTypes extends ImplicitAllowedTypes>(\n\trecord: TreeRecordNode<TAllowedTypes>,\n): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>]> {\n\tfor (const [key, value] of Object.entries(record)) {\n\t\tyield [key, value];\n\t}\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.shallowCompatibilityTest} for Record nodes.\n */\nfunction shallowCompatibilityTest(data: FactoryContent): CompatibilityLevel {\n\tif (isTreeValue(data)) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\tif (Symbol.iterator in data) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\treturn CompatibilityLevel.Normal;\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.toFlexContent} for Record nodes.\n *\n * Transforms data under a Record schema.\n * @param data - The tree data to be transformed. Must be a Record-like object.\n * @param schema - The schema to comply with.\n */\nfunction recordToFlexContent(data: FactoryContent, schema: RecordNodeSchema): FlexContent {\n\tif (!(typeof data === \"object\" && data !== null)) {\n\t\tthrow new UsageError(`Input data is incompatible with Record schema: ${data}`);\n\t}\n\n\tconst fieldsIterator: Iterable<readonly [string, InsertableContent]> = Object.entries(data);\n\treturn recordLikeDataToFlexContent(fieldsIterator, schema);\n}\n"]}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import type { RestrictiveStringRecord } from "../../../util/index.js";
|
|
5
6
|
import { NodeKind } from "../../core/index.js";
|
|
6
7
|
import type { TreeNodeSchemaClass, TreeNodeSchema, TreeNodeSchemaNonClass, WithType, TreeNode, ImplicitAllowedTypes, InsertableTreeNodeFromImplicitAllowedTypes, TreeNodeFromImplicitAllowedTypes } from "../../core/index.js";
|
|
7
8
|
import type { SchemaType, SimpleRecordNodeSchema } from "../../simpleSchema.js";
|
|
8
|
-
import type { RestrictiveStringRecord } from "../../../util/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* A {@link TreeNode} which models a TypeScript {@link https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type | record}.
|
|
11
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordNodeTypes.d.ts","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/record/recordNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,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AC,GAChF,6BAA6B,CAAC,KAAK,EAAE,CAAC,EAAE,uBAAuB,EAAE,eAAe,CAAC,CAAC;AAErF;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC5B;;OAEG;2CACyB,cAAc;CAGjC,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,IAAI,gBAAgB,CAErF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordNodeTypes.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/record/recordNodeTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"recordNodeTypes.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/record/recordNodeTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kDAA+C;AAsH/C;;GAEG;AACU,QAAA,gBAAgB,GAAG;IAC/B;;OAEG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAqB;QACzC,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACQ,CAAC;AAEX;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAsB;IACxD,OAAO,MAAM,CAAC,IAAI,KAAK,mBAAQ,CAAC,MAAM,CAAC;AACxC,CAAC;AAFD,gDAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { RestrictiveStringRecord } from \"../../../util/index.js\";\nimport { NodeKind } from \"../../core/index.js\";\nimport type {\n\tTreeNodeSchemaClass,\n\tTreeNodeSchema,\n\tTreeNodeSchemaNonClass,\n\tWithType,\n\tTreeNode,\n\tImplicitAllowedTypes,\n\tInsertableTreeNodeFromImplicitAllowedTypes,\n\tTreeNodeFromImplicitAllowedTypes,\n} from \"../../core/index.js\";\nimport type { SchemaType, SimpleRecordNodeSchema } from \"../../simpleSchema.js\";\n\n/**\n * A {@link TreeNode} which models a TypeScript {@link https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type | record}.\n *\n * @remarks\n * Due to {@link https://github.com/microsoft/TypeScript/issues/43826}, we can't enable implicit construction of {@link TreeNode|TreeNodes} for setters.\n * Therefore code assigning to these fields must explicitly construct nodes using the schema's constructor or create method,\n * or using some other method like {@link (TreeAlpha:interface).create}.\n *\n * Field Assignment and Deletion\n *\n * Unlike JavaScript's `Record` type, assigning `undefined` to a key in {@link TreeRecordNode} behaves like a `delete` operation,\n * removing the field's contents.\n *\n * This is to stay consistent with {@link TreeObjectNode} behavior.\n *\n * Example:\n * ```ts\n * const Numbers = schemaFactory.record(\"Numbers\", schemaFactory.number);\n * const record = new Numbers({ a:1, b:2 });\n *\n * // This is equivalent to delete record.a, and removes the entry.\n * record.a = undefined\n * ```\n *\n * @beta\n */\nexport interface TreeRecordNode<\n\tTAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n> extends TreeNode,\n\t\tRecord<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {\n\t/**\n\t * Allows the record's entries to be iterated over, including in contexts like `for...of` loops.\n\t */\n\t[Symbol.iterator](): IterableIterator<\n\t\t[string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>]\n\t>;\n}\n\n/**\n * Content which can be used to construct a Record node, explicitly or implicitly.\n * @system @beta\n */\nexport type RecordNodeInsertableData<T extends ImplicitAllowedTypes> = RestrictiveStringRecord<\n\tInsertableTreeNodeFromImplicitAllowedTypes<T>\n>;\n\n/**\n * A schema for customizable {@link (TreeMapNode:interface)}s.\n * @system @sealed @alpha\n */\nexport interface RecordNodeCustomizableSchema<\n\tout TName extends string = string,\n\tin out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tout ImplicitlyConstructable extends boolean = true,\n\tout TCustomMetadata = unknown,\n> extends TreeNodeSchemaClass<\n\t\t\t/* Name */ TName,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNode<T> & WithType<TName, NodeKind.Record, T>,\n\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t/* ImplicitlyConstructable */ ImplicitlyConstructable,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined,\n\t\t\t/* TCustomMetadata */ TCustomMetadata\n\t\t>,\n\t\tSimpleRecordNodeSchema<SchemaType.View, TCustomMetadata> {}\n\n/**\n * A schema for POJO emulation mode {@link (TreeMapNode:interface)}s.\n * @system @sealed @alpha\n */\nexport interface RecordNodePojoEmulationSchema<\n\tout TName extends string = string,\n\tin out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tout ImplicitlyConstructable extends boolean = true,\n\tout TCustomMetadata = unknown,\n> extends TreeNodeSchemaNonClass<\n\t\t\t/* Name */ TName,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNode<T> & WithType<TName, NodeKind.Record, T>,\n\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t/* ImplicitlyConstructable */ ImplicitlyConstructable,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined,\n\t\t\t/* TCustomMetadata */ TCustomMetadata\n\t\t>,\n\t\tSimpleRecordNodeSchema<SchemaType.View, TCustomMetadata> {}\n\n/**\n * A schema for {@link (TreeRecordNode:interface)}s.\n * @privateRemarks\n * This could have generic arguments added and forwarded.\n * The expected use-cases for this don't need them however, and if they did want an argument it would probably be the allowed types;\n * perhaps if moving to an order independent way to pass generic arguments, adding support for them here would make sense.\n * @alpha\n */\nexport type RecordNodeSchema<\n\tTName extends string = string,\n\tT extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tImplicitlyConstructable extends boolean = true,\n\tTCustomMetadata = unknown,\n> =\n\t| RecordNodeCustomizableSchema<TName, T, ImplicitlyConstructable, TCustomMetadata>\n\t| RecordNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata>;\n\n/**\n * @alpha\n */\nexport const RecordNodeSchema = {\n\t/**\n\t * `instanceof`-based narrowing support for {@link (RecordNodeSchema:type)} in JavaScript and TypeScript 5.3 or newer.\n\t */\n\t[Symbol.hasInstance](value: TreeNodeSchema): value is RecordNodeSchema {\n\t\treturn isRecordNodeSchema(value);\n\t},\n} as const;\n\n/**\n * Narrows a {@link (TreeNodeSchema:interface)} to an {@link (RecordNodeSchema:interface)}.\n * @privateRemarks\n * If at some point we want to have internal only APIs for RecordNodeSchema (like done for objects),\n * this can include those since its not the public-facing API.\n */\nexport function isRecordNodeSchema(schema: TreeNodeSchema): schema is RecordNodeSchema {\n\treturn schema.kind === NodeKind.Record;\n}\n"]}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { SchemaAndPolicy, UpPath, TreeFieldStoredSchema, TreeTypeSet } from "../core/index.js";
|
|
6
6
|
import { type FlexTreeContext, type FlexTreeHydratedContextMinimal, type FlexibleFieldContent, type FlexibleNodeContent } from "../feature-libraries/index.js";
|
|
7
|
-
import type { ImplicitFieldSchema } from "./fieldSchema.js";
|
|
8
|
-
import { type InsertableContent } from "./unhydratedFlexTreeFromInsertable.js";
|
|
9
7
|
import { type Mutable } from "../util/index.js";
|
|
10
8
|
import { type ImplicitAllowedTypes, type TreeNode, type UnhydratedFlexTreeNode } from "./core/index.js";
|
|
9
|
+
import type { ImplicitFieldSchema } from "./fieldSchema.js";
|
|
10
|
+
import { type InsertableContent } from "./unhydratedFlexTreeFromInsertable.js";
|
|
11
11
|
/**
|
|
12
12
|
* Prepare content from a user for insertion into a tree.
|
|
13
13
|
* @remarks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareForInsertion.d.ts","sourceRoot":"","sources":["../../src/simple-tree/prepareForInsertion.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"prepareForInsertion.d.ts","sourceRoot":"","sources":["../../src/simple-tree/prepareForInsertion.ts"],"names":[],"m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,SAAS,GAAG,mBAAmB,CAazD;AAoCD;;GAEG;AACH,UAAU,gBAAgB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CACxB;AAED;;GAEG;AACH,UAAU,iBAAiB;IAC1B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,CAAC;CACnC;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACzC,OAAO,EAAE,SAAS,sBAAsB,EAAE,EAC1C,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,8BAA8B,GACrC,IAAI,CAwBN;AAyCD;;GAEG;AACH,KAAK,kBAAkB,GAAG,CACzB,YAAY,EAAE,SAAS,iBAAiB,EAAE;AAC1C;;GAEG;AACH,WAAW,EAAE,QAAQ,KACjB,IAAI,CAAC;AAEV;;;GAGG;AACH,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC"}
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.prepareContentForHydration = exports.prepareForInsertionContextless = exports.prepareArrayContentForInsertion = exports.prepareForInsertion = void 0;
|
|
8
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
+
const internal_2 = require("@fluidframework/telemetry-utils/internal");
|
|
8
10
|
const index_js_1 = require("../feature-libraries/index.js");
|
|
11
|
+
const index_js_2 = require("../feature-libraries/index.js");
|
|
12
|
+
const index_js_3 = require("../util/index.js");
|
|
13
|
+
const index_js_4 = require("./core/index.js");
|
|
9
14
|
const unhydratedFlexTreeFromInsertable_js_1 = require("./unhydratedFlexTreeFromInsertable.js");
|
|
10
|
-
const internal_1 = require("@fluidframework/telemetry-utils/internal");
|
|
11
|
-
const index_js_2 = require("../util/index.js");
|
|
12
|
-
const index_js_3 = require("./core/index.js");
|
|
13
|
-
const internal_2 = require("@fluidframework/core-utils/internal");
|
|
14
|
-
const index_js_4 = require("../feature-libraries/index.js");
|
|
15
15
|
/**
|
|
16
16
|
* For now, schema validation for inserted content is always enabled.
|
|
17
17
|
* @remarks
|
|
@@ -88,14 +88,14 @@ function validateAndPrepare(schemaAndPolicy, hydratedData, fieldSchema, mapTrees
|
|
|
88
88
|
// We can't simply enable it for them however due to contextual default fields which would not have been created yet (see comment above).
|
|
89
89
|
// Specifically at least clone can result in unhydrated trees which can end up violating their stored schema (but not view schema) just using the type safe APIs.
|
|
90
90
|
if (validateSchema === true) {
|
|
91
|
-
(0,
|
|
91
|
+
(0, index_js_2.isFieldInSchema)(mapTrees, fieldSchema, schemaAndPolicy, index_js_1.throwOutOfSchema);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* A dummy key value used in {@link LocatedNodesBatch.rootPath} which will be replaced with the actual detached field once it is known.
|
|
97
97
|
*/
|
|
98
|
-
const placeholderKey = (0,
|
|
98
|
+
const placeholderKey = (0, index_js_3.brand)("placeholder");
|
|
99
99
|
/**
|
|
100
100
|
* Records any {@link TreeNode}s in the given `content` tree and does the necessary bookkeeping to ensure they are synchronized with subsequent reads of the tree.
|
|
101
101
|
* Additionally populates any {@link UnhydratedFlexTreeField.pendingDefault}s using the provided `context`.
|
|
@@ -130,7 +130,7 @@ function prepareContentForHydration(content, scheduler, context) {
|
|
|
130
130
|
exports.prepareContentForHydration = prepareContentForHydration;
|
|
131
131
|
function walkMapTree(root, path, onVisitTreeNode, context) {
|
|
132
132
|
if (root.parentField.parent.parent !== undefined) {
|
|
133
|
-
throw new
|
|
133
|
+
throw new internal_2.UsageError("Attempted to insert a node which is already under a parent. If this is desired, remove the node from its parent before inserting it elsewhere.");
|
|
134
134
|
}
|
|
135
135
|
const nexts = [];
|
|
136
136
|
for (let next = [path, root]; next !== undefined; next = nexts.pop()) {
|
|
@@ -170,7 +170,7 @@ function scheduleHydration(locatedNodes, forest, doHydration) {
|
|
|
170
170
|
let index = 0;
|
|
171
171
|
const off = forest.events.on("afterRootFieldCreated", (fieldKey) => {
|
|
172
172
|
// Indexing is safe here because of the length check above. This assumes the array has not been modified which should be the case.
|
|
173
|
-
const batch = locatedNodes[index] ?? (0,
|
|
173
|
+
const batch = locatedNodes[index] ?? (0, internal_1.oob)();
|
|
174
174
|
doHydration(batch, { parent: undefined, parentField: fieldKey, parentIndex: 0 });
|
|
175
175
|
if (++index === locatedNodes.length) {
|
|
176
176
|
off();
|
|
@@ -183,9 +183,9 @@ function scheduleHydration(locatedNodes, forest, doHydration) {
|
|
|
183
183
|
*/
|
|
184
184
|
function hydrator(locatedNodes, forest) {
|
|
185
185
|
return (batch, attachedPath) => {
|
|
186
|
-
const context = forest.anchors.slots.get(index_js_1.ContextSlot) ?? (0,
|
|
186
|
+
const context = forest.anchors.slots.get(index_js_1.ContextSlot) ?? (0, internal_1.fail)(0xb41 /* missing context */);
|
|
187
187
|
// Modify paths in batch to point to correct location:
|
|
188
|
-
(0,
|
|
188
|
+
(0, internal_1.debugAssert)(() => batch.rootPath.parentField === placeholderKey);
|
|
189
189
|
batch.rootPath.parentField = attachedPath.parentField;
|
|
190
190
|
batch.rootPath.parent = attachedPath.parent;
|
|
191
191
|
batch.rootPath.parentIndex = attachedPath.parentIndex;
|
|
@@ -193,7 +193,7 @@ function hydrator(locatedNodes, forest) {
|
|
|
193
193
|
// Find or create one as necessary.
|
|
194
194
|
for (const { path, node } of batch.paths) {
|
|
195
195
|
const anchor = forest.anchors.track(path);
|
|
196
|
-
const anchorNode = forest.anchors.locate(anchor) ?? (0,
|
|
196
|
+
const anchorNode = forest.anchors.locate(anchor) ?? (0, internal_1.fail)(0xc7b /* missing anchor */);
|
|
197
197
|
let flexNode = anchorNode.slots.get(index_js_1.flexTreeSlot);
|
|
198
198
|
if (flexNode === undefined) {
|
|
199
199
|
// the flex node must be created
|
|
@@ -203,7 +203,7 @@ function hydrator(locatedNodes, forest) {
|
|
|
203
203
|
cursor.free();
|
|
204
204
|
(0, index_js_1.assertFlexTreeEntityNotFreed)(flexNode);
|
|
205
205
|
}
|
|
206
|
-
(0,
|
|
206
|
+
(0, index_js_4.getKernel)(node).hydrate(flexNode);
|
|
207
207
|
forest.anchors.forget(anchor);
|
|
208
208
|
}
|
|
209
209
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareForInsertion.js","sourceRoot":"","sources":["../../src/simple-tree/prepareForInsertion.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,4DAYuC;AAEvC,+FAG+C;AAC/C,uEAAsE;AACtE,+CAAuD;AACvD,8CAKyB;AACzB,kEAA6E;AAC7E,4DAAgE;AAEhE;;;;;GAKG;AACH,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAClC,IAAS,EACT,MAA2B,EAC3B,kBAAmC,EACnC,iBAAwC;IAExC,OAAO,8BAA8B,CACpC,IAAI,EACJ,MAAM,EACN,IAAA,6BAAkB,EAAC,kBAAkB,CAAC,EACtC,kBAAkB,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,EAChE,iBAAiB,CACjB,CAAC;AACH,CAAC;AAbD,kDAaC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,+BAA+B,CAC9C,IAAkC,EAClC,MAA4B,EAC5B,kBAAmC,EACnC,iBAA8B;IAE9B,MAAM,QAAQ,GAA6B,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAC5D,IAAA,sEAAgC,EAAC,IAAI,EAAE,MAAM,CAAC,CAC9C,CAAC;IAEF,kBAAkB,CACjB,IAAA,6BAAkB,EAAC,kBAAkB,CAAC,EACtC,kBAAkB,CAAC,UAAU,EAA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gBAC5B,gCAAgC;gBAChC,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;gBACpD,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;gBAE5C,QAAQ,GAAG,IAAA,0CAA+B,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;gBAC5D,MAAM,CAAC,IAAI,EAAE,CAAC;gBACd,IAAA,uCAA4B,EAAC,QAAQ,CAAC,CAAC;YACxC,CAAC;YAED,IAAA,oBAAS,EAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAClC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;IACF,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tSchemaAndPolicy,\n\tIForestSubscription,\n\tUpPath,\n\tFieldKey,\n\tDetachedField,\n\tTreeFieldStoredSchema,\n\tTreeTypeSet,\n} from \"../core/index.js\";\nimport {\n\ttype FlexTreeContext,\n\tgetSchemaAndPolicy,\n\ttype FlexTreeHydratedContextMinimal,\n\tFieldKinds,\n\ttype FlexibleFieldContent,\n\ttype FlexibleNodeContent,\n\tthrowOutOfSchema,\n\tflexTreeSlot,\n\tContextSlot,\n\tgetOrCreateHydratedFlexTreeNode,\n\tassertFlexTreeEntityNotFreed,\n} from \"../feature-libraries/index.js\";\nimport type { ImplicitFieldSchema } from \"./fieldSchema.js\";\nimport {\n\ttype InsertableContent,\n\tunhydratedFlexTreeFromInsertable,\n} from \"./unhydratedFlexTreeFromInsertable.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { brand, type Mutable } from \"../util/index.js\";\nimport {\n\tgetKernel,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNode,\n\ttype UnhydratedFlexTreeNode,\n} from \"./core/index.js\";\nimport { debugAssert, fail, oob } from \"@fluidframework/core-utils/internal\";\nimport { isFieldInSchema } from \"../feature-libraries/index.js\";\n\n/**\n * For now, schema validation for inserted content is always enabled.\n * @remarks\n * If this ends up being too much of a performance overhead, AND nothing depends on it (like staged allowed types likely will),\n * this could be changed.\n */\nconst validateSchema = true;\n\n/**\n * Prepare content from a user for insertion into a tree.\n * @remarks\n * This validates and converts the input, and if necessary invokes {@link prepareContentForHydration}.\n *\n * The next edit made to `destinationContext`'s forest must be the creation of a detached field containing this content,\n * (Triggering {@link ForestEvents.afterRootFieldCreated}) otherwise hydration will break.\n */\nexport function prepareForInsertion<TIn extends InsertableContent | undefined>(\n\tdata: TIn,\n\tschema: ImplicitFieldSchema,\n\tdestinationContext: FlexTreeContext,\n\tdestinationSchema: TreeFieldStoredSchema,\n): TIn extends undefined ? undefined : FlexibleNodeContent {\n\treturn prepareForInsertionContextless(\n\t\tdata,\n\t\tschema,\n\t\tgetSchemaAndPolicy(destinationContext),\n\t\tdestinationContext.isHydrated() ? destinationContext : undefined,\n\t\tdestinationSchema,\n\t);\n}\n\n/**\n * {@link prepareForInsertion} but batched for array content.\n * @remarks\n * This is for inserting items into an array, not a inserting a {@link TreeArrayNode} (that would use {@link prepareForInsertion}).\n *\n * The next edits made to `destinationContext`'s forest must be the creation of a detached field.\n * One edit for each item in `data`, in order.\n *\n * @privateRemarks\n * This has to be done as a single operation for all items in data\n * (as opposed to mapping {@link prepareForInsertion} over the array)\n * due to how the eventing in prepareContentForHydration works.\n */\nexport function prepareArrayContentForInsertion(\n\tdata: readonly InsertableContent[],\n\tschema: ImplicitAllowedTypes,\n\tdestinationContext: FlexTreeContext,\n\tdestinationSchema: TreeTypeSet,\n): FlexibleFieldContent {\n\tconst mapTrees: UnhydratedFlexTreeNode[] = data.map((item) =>\n\t\tunhydratedFlexTreeFromInsertable(item, schema),\n\t);\n\n\tvalidateAndPrepare(\n\t\tgetSchemaAndPolicy(destinationContext),\n\t\tdestinationContext.isHydrated() ? destinationContext : undefined,\n\t\t{\n\t\t\tkind: FieldKinds.sequence.identifier,\n\t\t\ttypes: destinationSchema,\n\t\t\tpersistedMetadata: undefined,\n\t\t},\n\t\tmapTrees,\n\t);\n\n\treturn mapTrees;\n}\n\n/**\n * Split out from {@link prepareForInsertion} as to allow use without a context.\n *\n * @param hydratedData - If specified, the `mapTrees` will be prepared for hydration into this context.\n * `undefined` when `mapTrees` are being inserted into an {@link Unhydrated} tree.\n *\n * @remarks\n * Adding this entry point is a workaround for initialize not currently having a context.\n */\nexport function prepareForInsertionContextless<TIn extends InsertableContent | undefined>(\n\tdata: TIn,\n\tschema: ImplicitFieldSchema,\n\tschemaAndPolicy: SchemaAndPolicy,\n\thydratedData: FlexTreeHydratedContextMinimal | undefined,\n\tdestinationSchema: TreeFieldStoredSchema,\n\tscheduleHydrationOverride?: HydrationScheduler,\n): TIn extends undefined ? undefined : FlexibleNodeContent {\n\tconst mapTree = unhydratedFlexTreeFromInsertable(data, schema);\n\n\tconst contentArray = mapTree === undefined ? [] : [mapTree];\n\tvalidateAndPrepare(\n\t\tschemaAndPolicy,\n\t\thydratedData,\n\t\tdestinationSchema,\n\t\tcontentArray,\n\t\tscheduleHydrationOverride,\n\t);\n\n\treturn mapTree;\n}\n\n/**\n * If hydrating, do a final validation against the schema and prepare the content for hydration.\n *\n * @param hydratedData - If specified, the `mapTrees` will be prepared for hydration into this context.\n * `undefined` when `mapTrees` are being inserted into an {@link Unhydrated} tree.\n */\nfunction validateAndPrepare(\n\tschemaAndPolicy: SchemaAndPolicy,\n\thydratedData: FlexTreeHydratedContextMinimal | undefined,\n\tfieldSchema: TreeFieldStoredSchema,\n\tmapTrees: readonly UnhydratedFlexTreeNode[],\n\tscheduleHydrationOverride?: HydrationScheduler,\n): void {\n\tif (hydratedData !== undefined) {\n\t\t// Run `prepareContentForHydration` before walking the tree in `isFieldInSchema`.\n\t\t// This ensures that when `isFieldInSchema` requests identifiers (or any other contextual defaults),\n\t\t// they were already creating used the more specific context we have access to from `hydratedData`.\n\t\tprepareContentForHydration(\n\t\t\tmapTrees,\n\t\t\tscheduleHydrationOverride ??\n\t\t\t\t((batch, doHydration) =>\n\t\t\t\t\tscheduleHydration(batch, hydratedData.checkout.forest, doHydration)),\n\t\t\thydratedData,\n\t\t);\n\t\t// TODO: AB#45723\n\t\t// Now that staged schema rely on this validation, its a bit odd we don't do it for insertion into unhydrated contexts.\n\t\t// We can't simply enable it for them however due to contextual default fields which would not have been created yet (see comment above).\n\t\t// Specifically at least clone can result in unhydrated trees which can end up violating their stored schema (but not view schema) just using the type safe APIs.\n\t\tif (validateSchema === true) {\n\t\t\tisFieldInSchema(mapTrees, fieldSchema, schemaAndPolicy, throwOutOfSchema);\n\t\t}\n\t}\n}\n\n/**\n * The path from the included node to the root of the content tree it was inserted as part of.\n */\ninterface RelativeNodePath {\n\treadonly path: UpPath;\n\treadonly node: TreeNode;\n}\n\n/**\n * {@link RelativeNodePath}s for every {@link TreeNode} in the content tree inserted as an atomic operation.\n */\ninterface LocatedNodesBatch {\n\t/**\n\t * UpPath shared by all {@link RelativeNodePath}s in this batch corresponding to the root of the inserted content.\n\t */\n\treadonly rootPath: Mutable<UpPath>;\n\treadonly paths: RelativeNodePath[];\n}\n\n/**\n * A dummy key value used in {@link LocatedNodesBatch.rootPath} which will be replaced with the actual detached field once it is known.\n */\nconst placeholderKey: DetachedField & FieldKey = brand(\"placeholder\" as const);\n\n/**\n * Records any {@link TreeNode}s in the given `content` tree and does the necessary bookkeeping to ensure they are synchronized with subsequent reads of the tree.\n * Additionally populates any {@link UnhydratedFlexTreeField.pendingDefault}s using the provided `context`.\n *\n * @remarks If the content tree contains has any associated {@link TreeNode}s, this function must be called just prior to inserting the content into the tree.\n * Specifically, no other content may be inserted into the tree between the invocation of this function and the insertion of `content`.\n * The insertion of `content` must occur or else this function will cause memory leaks.\n *\n * Exported for testing purposes: otherwise should not be used outside this module.\n * @param content - the content subsequence to be inserted, of which might deeply contain {@link TreeNode}s which need to be hydrated.\n * @param forest - the forest the content is being inserted into.\n */\nexport function prepareContentForHydration(\n\tcontent: readonly UnhydratedFlexTreeNode[],\n\tscheduler: HydrationScheduler,\n\tcontext: FlexTreeHydratedContextMinimal,\n): void {\n\tconst batches: LocatedNodesBatch[] = [];\n\tfor (const item of content) {\n\t\tconst batch: LocatedNodesBatch = {\n\t\t\trootPath: {\n\t\t\t\tparent: undefined,\n\t\t\t\tparentField: placeholderKey,\n\t\t\t\tparentIndex: 0,\n\t\t\t},\n\t\t\tpaths: [],\n\t\t};\n\t\tbatches.push(batch);\n\t\twalkMapTree(\n\t\t\titem,\n\t\t\tbatch.rootPath,\n\t\t\t(p, node) => {\n\t\t\t\tbatch.paths.push({ path: p, node });\n\t\t\t},\n\t\t\tcontext,\n\t\t);\n\t}\n\n\tconst doHydration = hydrator(batches, context.checkout.forest);\n\tscheduler(batches, doHydration);\n}\n\nfunction walkMapTree(\n\troot: UnhydratedFlexTreeNode,\n\tpath: UpPath,\n\tonVisitTreeNode: (path: UpPath, treeNode: TreeNode) => void,\n\tcontext: FlexTreeHydratedContextMinimal,\n): void {\n\tif (root.parentField.parent.parent !== undefined) {\n\t\tthrow new UsageError(\n\t\t\t\"Attempted to insert a node which is already under a parent. If this is desired, remove the node from its parent before inserting it elsewhere.\",\n\t\t);\n\t}\n\n\ttype Next = [path: UpPath, tree: UnhydratedFlexTreeNode];\n\tconst nexts: Next[] = [];\n\tfor (let next: Next | undefined = [path, root]; next !== undefined; next = nexts.pop()) {\n\t\tconst [p, node] = next;\n\t\tif (node !== undefined) {\n\t\t\tconst treeNode = node.treeNode;\n\t\t\tif (treeNode !== undefined) {\n\t\t\t\tonVisitTreeNode(p, treeNode);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, field] of node.allFieldsLazy) {\n\t\t\tfield.fillPendingDefaults(context);\n\t\t\tfor (const [i, child] of field.children.entries()) {\n\t\t\t\tnexts.push([\n\t\t\t\t\t{\n\t\t\t\t\t\tparent: p,\n\t\t\t\t\t\tparentField: key,\n\t\t\t\t\t\tparentIndex: i,\n\t\t\t\t\t},\n\t\t\t\t\tchild,\n\t\t\t\t]);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * A function which can schedule hydration of batches of nodes to occur at a later time (which must be after they have been inserted into the tree).\n */\ntype HydrationScheduler = (\n\tlocatedNodes: readonly LocatedNodesBatch[],\n\t/**\n\t * Does the actual hydration. Should be called for each index in `locatedNodes` once the corresponding content has been inserted into the tree.\n\t */\n\tdoHydration: Hydrator,\n) => void;\n\n/**\n * Does the actual hydration.\n * The provided `attachPath` is the path the content is currently under (where it was attached in the tree).\n */\ntype Hydrator = (batch: LocatedNodesBatch, attachPath: UpPath) => void;\n\n/**\n * Register events which will hydrate batches of nodes when they are inserted.\n * The next edits to forest must be their insertions, in order, or data corruption can occur.\n * @param locatedNodes - the nodes to register with the forest.\n * Each index in this array expects its content to be added and produce its own `afterRootFieldCreated` event.\n * If array subsequence insertion is optimized to produce a single event, this will not work correctly as is, and will need to be modified to take in a single {@link LocatedNodesBatch}.\n */\nfunction scheduleHydration(\n\tlocatedNodes: readonly LocatedNodesBatch[],\n\tforest: IForestSubscription,\n\tdoHydration: Hydrator,\n): void {\n\t// Only subscribe to the event if there is at least one TreeNode tree to hydrate - this is not the case when inserting an empty array [].\n\tif (locatedNodes.length > 0) {\n\t\t// Creating a new array emits one event per element in the array, so listen to the event once for each element\n\t\tlet index = 0;\n\t\tconst off = forest.events.on(\"afterRootFieldCreated\", (fieldKey) => {\n\t\t\t// Indexing is safe here because of the length check above. This assumes the array has not been modified which should be the case.\n\t\t\tconst batch = locatedNodes[index] ?? oob();\n\t\t\tdoHydration(batch, { parent: undefined, parentField: fieldKey, parentIndex: 0 });\n\t\t\tif (++index === locatedNodes.length) {\n\t\t\t\toff();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Implementation of {@link Hydrator}.\n */\nfunction hydrator(\n\tlocatedNodes: readonly LocatedNodesBatch[],\n\tforest: IForestSubscription,\n): (batch: LocatedNodesBatch, attachedPath: UpPath) => void {\n\treturn (batch: LocatedNodesBatch, attachedPath: UpPath) => {\n\t\tconst context = forest.anchors.slots.get(ContextSlot) ?? fail(0xb41 /* missing context */);\n\n\t\t// Modify paths in batch to point to correct location:\n\t\tdebugAssert(() => batch.rootPath.parentField === placeholderKey);\n\t\tbatch.rootPath.parentField = attachedPath.parentField;\n\t\tbatch.rootPath.parent = attachedPath.parent;\n\t\tbatch.rootPath.parentIndex = attachedPath.parentIndex;\n\n\t\t// To hydrate a TreeNode, it must be associated with a HydratedFlexTreeNode.\n\t\t// Find or create one as necessary.\n\t\tfor (const { path, node } of batch.paths) {\n\t\t\tconst anchor = forest.anchors.track(path);\n\t\t\tconst anchorNode = forest.anchors.locate(anchor) ?? fail(0xc7b /* missing anchor */);\n\n\t\t\tlet flexNode = anchorNode.slots.get(flexTreeSlot);\n\t\t\tif (flexNode === undefined) {\n\t\t\t\t// the flex node must be created\n\t\t\t\tconst cursor = forest.allocateCursor(\"getFlexNode\");\n\t\t\t\tforest.moveCursorToPath(anchorNode, cursor);\n\n\t\t\t\tflexNode = getOrCreateHydratedFlexTreeNode(context, cursor);\n\t\t\t\tcursor.free();\n\t\t\t\tassertFlexTreeEntityNotFreed(flexNode);\n\t\t\t}\n\n\t\t\tgetKernel(node).hydrate(flexNode);\n\t\t\tforest.anchors.forget(anchor);\n\t\t}\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"prepareForInsertion.js","sourceRoot":"","sources":["../../src/simple-tree/prepareForInsertion.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6E;AAC7E,uEAAsE;AAWtE,4DAYuC;AACvC,4DAAgE;AAChE,+CAAuD;AAEvD,8CAKyB;AAEzB,+FAG+C;AAE/C;;;;;GAKG;AACH,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAClC,IAAS,EACT,MAA2B,EAC3B,kBAAmC,EACnC,iBAAwC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GAAG,YAAY,CAAC,MAAM,CAAC;QAC5C,KAAK,CAAC,QAAQ,CAAC,WAAW,GAAG,YAAY,CAAC,WAAW,CAAC;QAEtD,4EAA4E;QAC5E,mCAAmC;QACnC,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC1C,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAA,eAAI,EAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YAErF,IAAI,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,uBAAY,CAAC,CAAC;YAClD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC5B,gCAAgC;gBAChC,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;gBACpD,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;gBAE5C,QAAQ,GAAG,IAAA,0CAA+B,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;gBAC5D,MAAM,CAAC,IAAI,EAAE,CAAC;gBACd,IAAA,uCAA4B,EAAC,QAAQ,CAAC,CAAC;YACxC,CAAC;YAED,IAAA,oBAAS,EAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAClC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;IACF,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { debugAssert, fail, oob } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type {\n\tSchemaAndPolicy,\n\tIForestSubscription,\n\tUpPath,\n\tFieldKey,\n\tDetachedField,\n\tTreeFieldStoredSchema,\n\tTreeTypeSet,\n} from \"../core/index.js\";\nimport {\n\ttype FlexTreeContext,\n\tgetSchemaAndPolicy,\n\ttype FlexTreeHydratedContextMinimal,\n\tFieldKinds,\n\ttype FlexibleFieldContent,\n\ttype FlexibleNodeContent,\n\tthrowOutOfSchema,\n\tflexTreeSlot,\n\tContextSlot,\n\tgetOrCreateHydratedFlexTreeNode,\n\tassertFlexTreeEntityNotFreed,\n} from \"../feature-libraries/index.js\";\nimport { isFieldInSchema } from \"../feature-libraries/index.js\";\nimport { brand, type Mutable } from \"../util/index.js\";\n\nimport {\n\tgetKernel,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNode,\n\ttype UnhydratedFlexTreeNode,\n} from \"./core/index.js\";\nimport type { ImplicitFieldSchema } from \"./fieldSchema.js\";\nimport {\n\ttype InsertableContent,\n\tunhydratedFlexTreeFromInsertable,\n} from \"./unhydratedFlexTreeFromInsertable.js\";\n\n/**\n * For now, schema validation for inserted content is always enabled.\n * @remarks\n * If this ends up being too much of a performance overhead, AND nothing depends on it (like staged allowed types likely will),\n * this could be changed.\n */\nconst validateSchema = true;\n\n/**\n * Prepare content from a user for insertion into a tree.\n * @remarks\n * This validates and converts the input, and if necessary invokes {@link prepareContentForHydration}.\n *\n * The next edit made to `destinationContext`'s forest must be the creation of a detached field containing this content,\n * (Triggering {@link ForestEvents.afterRootFieldCreated}) otherwise hydration will break.\n */\nexport function prepareForInsertion<TIn extends InsertableContent | undefined>(\n\tdata: TIn,\n\tschema: ImplicitFieldSchema,\n\tdestinationContext: FlexTreeContext,\n\tdestinationSchema: TreeFieldStoredSchema,\n): TIn extends undefined ? undefined : FlexibleNodeContent {\n\treturn prepareForInsertionContextless(\n\t\tdata,\n\t\tschema,\n\t\tgetSchemaAndPolicy(destinationContext),\n\t\tdestinationContext.isHydrated() ? destinationContext : undefined,\n\t\tdestinationSchema,\n\t);\n}\n\n/**\n * {@link prepareForInsertion} but batched for array content.\n * @remarks\n * This is for inserting items into an array, not a inserting a {@link TreeArrayNode} (that would use {@link prepareForInsertion}).\n *\n * The next edits made to `destinationContext`'s forest must be the creation of a detached field.\n * One edit for each item in `data`, in order.\n *\n * @privateRemarks\n * This has to be done as a single operation for all items in data\n * (as opposed to mapping {@link prepareForInsertion} over the array)\n * due to how the eventing in prepareContentForHydration works.\n */\nexport function prepareArrayContentForInsertion(\n\tdata: readonly InsertableContent[],\n\tschema: ImplicitAllowedTypes,\n\tdestinationContext: FlexTreeContext,\n\tdestinationSchema: TreeTypeSet,\n): FlexibleFieldContent {\n\tconst mapTrees: UnhydratedFlexTreeNode[] = data.map((item) =>\n\t\tunhydratedFlexTreeFromInsertable(item, schema),\n\t);\n\n\tvalidateAndPrepare(\n\t\tgetSchemaAndPolicy(destinationContext),\n\t\tdestinationContext.isHydrated() ? destinationContext : undefined,\n\t\t{\n\t\t\tkind: FieldKinds.sequence.identifier,\n\t\t\ttypes: destinationSchema,\n\t\t\tpersistedMetadata: undefined,\n\t\t},\n\t\tmapTrees,\n\t);\n\n\treturn mapTrees;\n}\n\n/**\n * Split out from {@link prepareForInsertion} as to allow use without a context.\n *\n * @param hydratedData - If specified, the `mapTrees` will be prepared for hydration into this context.\n * `undefined` when `mapTrees` are being inserted into an {@link Unhydrated} tree.\n *\n * @remarks\n * Adding this entry point is a workaround for initialize not currently having a context.\n */\nexport function prepareForInsertionContextless<TIn extends InsertableContent | undefined>(\n\tdata: TIn,\n\tschema: ImplicitFieldSchema,\n\tschemaAndPolicy: SchemaAndPolicy,\n\thydratedData: FlexTreeHydratedContextMinimal | undefined,\n\tdestinationSchema: TreeFieldStoredSchema,\n\tscheduleHydrationOverride?: HydrationScheduler,\n): TIn extends undefined ? undefined : FlexibleNodeContent {\n\tconst mapTree = unhydratedFlexTreeFromInsertable(data, schema);\n\n\tconst contentArray = mapTree === undefined ? [] : [mapTree];\n\tvalidateAndPrepare(\n\t\tschemaAndPolicy,\n\t\thydratedData,\n\t\tdestinationSchema,\n\t\tcontentArray,\n\t\tscheduleHydrationOverride,\n\t);\n\n\treturn mapTree;\n}\n\n/**\n * If hydrating, do a final validation against the schema and prepare the content for hydration.\n *\n * @param hydratedData - If specified, the `mapTrees` will be prepared for hydration into this context.\n * `undefined` when `mapTrees` are being inserted into an {@link Unhydrated} tree.\n */\nfunction validateAndPrepare(\n\tschemaAndPolicy: SchemaAndPolicy,\n\thydratedData: FlexTreeHydratedContextMinimal | undefined,\n\tfieldSchema: TreeFieldStoredSchema,\n\tmapTrees: readonly UnhydratedFlexTreeNode[],\n\tscheduleHydrationOverride?: HydrationScheduler,\n): void {\n\tif (hydratedData !== undefined) {\n\t\t// Run `prepareContentForHydration` before walking the tree in `isFieldInSchema`.\n\t\t// This ensures that when `isFieldInSchema` requests identifiers (or any other contextual defaults),\n\t\t// they were already creating used the more specific context we have access to from `hydratedData`.\n\t\tprepareContentForHydration(\n\t\t\tmapTrees,\n\t\t\tscheduleHydrationOverride ??\n\t\t\t\t((batch, doHydration) =>\n\t\t\t\t\tscheduleHydration(batch, hydratedData.checkout.forest, doHydration)),\n\t\t\thydratedData,\n\t\t);\n\t\t// TODO: AB#45723\n\t\t// Now that staged schema rely on this validation, its a bit odd we don't do it for insertion into unhydrated contexts.\n\t\t// We can't simply enable it for them however due to contextual default fields which would not have been created yet (see comment above).\n\t\t// Specifically at least clone can result in unhydrated trees which can end up violating their stored schema (but not view schema) just using the type safe APIs.\n\t\tif (validateSchema === true) {\n\t\t\tisFieldInSchema(mapTrees, fieldSchema, schemaAndPolicy, throwOutOfSchema);\n\t\t}\n\t}\n}\n\n/**\n * The path from the included node to the root of the content tree it was inserted as part of.\n */\ninterface RelativeNodePath {\n\treadonly path: UpPath;\n\treadonly node: TreeNode;\n}\n\n/**\n * {@link RelativeNodePath}s for every {@link TreeNode} in the content tree inserted as an atomic operation.\n */\ninterface LocatedNodesBatch {\n\t/**\n\t * UpPath shared by all {@link RelativeNodePath}s in this batch corresponding to the root of the inserted content.\n\t */\n\treadonly rootPath: Mutable<UpPath>;\n\treadonly paths: RelativeNodePath[];\n}\n\n/**\n * A dummy key value used in {@link LocatedNodesBatch.rootPath} which will be replaced with the actual detached field once it is known.\n */\nconst placeholderKey: DetachedField & FieldKey = brand(\"placeholder\" as const);\n\n/**\n * Records any {@link TreeNode}s in the given `content` tree and does the necessary bookkeeping to ensure they are synchronized with subsequent reads of the tree.\n * Additionally populates any {@link UnhydratedFlexTreeField.pendingDefault}s using the provided `context`.\n *\n * @remarks If the content tree contains has any associated {@link TreeNode}s, this function must be called just prior to inserting the content into the tree.\n * Specifically, no other content may be inserted into the tree between the invocation of this function and the insertion of `content`.\n * The insertion of `content` must occur or else this function will cause memory leaks.\n *\n * Exported for testing purposes: otherwise should not be used outside this module.\n * @param content - the content subsequence to be inserted, of which might deeply contain {@link TreeNode}s which need to be hydrated.\n * @param forest - the forest the content is being inserted into.\n */\nexport function prepareContentForHydration(\n\tcontent: readonly UnhydratedFlexTreeNode[],\n\tscheduler: HydrationScheduler,\n\tcontext: FlexTreeHydratedContextMinimal,\n): void {\n\tconst batches: LocatedNodesBatch[] = [];\n\tfor (const item of content) {\n\t\tconst batch: LocatedNodesBatch = {\n\t\t\trootPath: {\n\t\t\t\tparent: undefined,\n\t\t\t\tparentField: placeholderKey,\n\t\t\t\tparentIndex: 0,\n\t\t\t},\n\t\t\tpaths: [],\n\t\t};\n\t\tbatches.push(batch);\n\t\twalkMapTree(\n\t\t\titem,\n\t\t\tbatch.rootPath,\n\t\t\t(p, node) => {\n\t\t\t\tbatch.paths.push({ path: p, node });\n\t\t\t},\n\t\t\tcontext,\n\t\t);\n\t}\n\n\tconst doHydration = hydrator(batches, context.checkout.forest);\n\tscheduler(batches, doHydration);\n}\n\nfunction walkMapTree(\n\troot: UnhydratedFlexTreeNode,\n\tpath: UpPath,\n\tonVisitTreeNode: (path: UpPath, treeNode: TreeNode) => void,\n\tcontext: FlexTreeHydratedContextMinimal,\n): void {\n\tif (root.parentField.parent.parent !== undefined) {\n\t\tthrow new UsageError(\n\t\t\t\"Attempted to insert a node which is already under a parent. If this is desired, remove the node from its parent before inserting it elsewhere.\",\n\t\t);\n\t}\n\n\ttype Next = [path: UpPath, tree: UnhydratedFlexTreeNode];\n\tconst nexts: Next[] = [];\n\tfor (let next: Next | undefined = [path, root]; next !== undefined; next = nexts.pop()) {\n\t\tconst [p, node] = next;\n\t\tif (node !== undefined) {\n\t\t\tconst treeNode = node.treeNode;\n\t\t\tif (treeNode !== undefined) {\n\t\t\t\tonVisitTreeNode(p, treeNode);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [key, field] of node.allFieldsLazy) {\n\t\t\tfield.fillPendingDefaults(context);\n\t\t\tfor (const [i, child] of field.children.entries()) {\n\t\t\t\tnexts.push([\n\t\t\t\t\t{\n\t\t\t\t\t\tparent: p,\n\t\t\t\t\t\tparentField: key,\n\t\t\t\t\t\tparentIndex: i,\n\t\t\t\t\t},\n\t\t\t\t\tchild,\n\t\t\t\t]);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * A function which can schedule hydration of batches of nodes to occur at a later time (which must be after they have been inserted into the tree).\n */\ntype HydrationScheduler = (\n\tlocatedNodes: readonly LocatedNodesBatch[],\n\t/**\n\t * Does the actual hydration. Should be called for each index in `locatedNodes` once the corresponding content has been inserted into the tree.\n\t */\n\tdoHydration: Hydrator,\n) => void;\n\n/**\n * Does the actual hydration.\n * The provided `attachPath` is the path the content is currently under (where it was attached in the tree).\n */\ntype Hydrator = (batch: LocatedNodesBatch, attachPath: UpPath) => void;\n\n/**\n * Register events which will hydrate batches of nodes when they are inserted.\n * The next edits to forest must be their insertions, in order, or data corruption can occur.\n * @param locatedNodes - the nodes to register with the forest.\n * Each index in this array expects its content to be added and produce its own `afterRootFieldCreated` event.\n * If array subsequence insertion is optimized to produce a single event, this will not work correctly as is, and will need to be modified to take in a single {@link LocatedNodesBatch}.\n */\nfunction scheduleHydration(\n\tlocatedNodes: readonly LocatedNodesBatch[],\n\tforest: IForestSubscription,\n\tdoHydration: Hydrator,\n): void {\n\t// Only subscribe to the event if there is at least one TreeNode tree to hydrate - this is not the case when inserting an empty array [].\n\tif (locatedNodes.length > 0) {\n\t\t// Creating a new array emits one event per element in the array, so listen to the event once for each element\n\t\tlet index = 0;\n\t\tconst off = forest.events.on(\"afterRootFieldCreated\", (fieldKey) => {\n\t\t\t// Indexing is safe here because of the length check above. This assumes the array has not been modified which should be the case.\n\t\t\tconst batch = locatedNodes[index] ?? oob();\n\t\t\tdoHydration(batch, { parent: undefined, parentField: fieldKey, parentIndex: 0 });\n\t\t\tif (++index === locatedNodes.length) {\n\t\t\t\toff();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Implementation of {@link Hydrator}.\n */\nfunction hydrator(\n\tlocatedNodes: readonly LocatedNodesBatch[],\n\tforest: IForestSubscription,\n): (batch: LocatedNodesBatch, attachedPath: UpPath) => void {\n\treturn (batch: LocatedNodesBatch, attachedPath: UpPath) => {\n\t\tconst context = forest.anchors.slots.get(ContextSlot) ?? fail(0xb41 /* missing context */);\n\n\t\t// Modify paths in batch to point to correct location:\n\t\tdebugAssert(() => batch.rootPath.parentField === placeholderKey);\n\t\tbatch.rootPath.parentField = attachedPath.parentField;\n\t\tbatch.rootPath.parent = attachedPath.parent;\n\t\tbatch.rootPath.parentIndex = attachedPath.parentIndex;\n\n\t\t// To hydrate a TreeNode, it must be associated with a HydratedFlexTreeNode.\n\t\t// Find or create one as necessary.\n\t\tfor (const { path, node } of batch.paths) {\n\t\t\tconst anchor = forest.anchors.track(path);\n\t\t\tconst anchorNode = forest.anchors.locate(anchor) ?? fail(0xc7b /* missing anchor */);\n\n\t\t\tlet flexNode = anchorNode.slots.get(flexTreeSlot);\n\t\t\tif (flexNode === undefined) {\n\t\t\t\t// the flex node must be created\n\t\t\t\tconst cursor = forest.allocateCursor(\"getFlexNode\");\n\t\t\t\tforest.moveCursorToPath(anchorNode, cursor);\n\n\t\t\t\tflexNode = getOrCreateHydratedFlexTreeNode(context, cursor);\n\t\t\t\tcursor.free();\n\t\t\t\tassertFlexTreeEntityNotFreed(flexNode);\n\t\t\t}\n\n\t\t\tgetKernel(node).hydrate(flexNode);\n\t\t\tforest.anchors.forget(anchor);\n\t\t}\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/simpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"simpleSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/simpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAOvE;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB,CACzC,GAAG,CAAC,IAAI,SAAS,UAAU,EAC3B,GAAG,CAAC,SAAS,SAAS,QAAQ,EAC9B,GAAG,CAAC,eAAe,GAAG,OAAO,CAC5B,SAAQ,oBAAoB,CAAC,SAAS,EAAE,eAAe,CAAC;IACzD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,iBAAiB,EAAE,4BAA4B,GAAG,SAAS,CAAC;IAGrE,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,UAAU,CAAC,GAC9E,CAAC,IAAI,SAAS,UAAU,CAAC,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