@fluidframework/tree 2.1.0 → 2.3.0-288113
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/.mocharc.customBenchmarks.cjs +33 -0
- package/CHANGELOG.md +297 -0
- package/README.md +34 -4
- package/api-extractor.json +17 -0
- package/api-report/tree.alpha.api.md +158 -28
- package/api-report/tree.beta.api.md +59 -28
- package/api-report/tree.public.api.md +59 -28
- package/dist/beta.d.ts +4 -1
- package/dist/codec/discriminatedUnions.d.ts +11 -5
- package/dist/codec/discriminatedUnions.d.ts.map +1 -1
- package/dist/codec/discriminatedUnions.js.map +1 -1
- package/dist/codec/index.d.ts +1 -1
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js.map +1 -1
- package/dist/core/forest/editableForest.d.ts +1 -5
- package/dist/core/forest/editableForest.d.ts.map +1 -1
- package/dist/core/forest/editableForest.js.map +1 -1
- package/dist/core/forest/forest.d.ts +0 -6
- package/dist/core/forest/forest.d.ts.map +1 -1
- package/dist/core/forest/forest.js +0 -2
- package/dist/core/forest/forest.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +0 -4
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +1 -3
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +1 -8
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +1 -9
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/rebase/utils.d.ts +0 -1
- package/dist/core/rebase/utils.d.ts.map +1 -1
- package/dist/core/rebase/utils.js +12 -7
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/multiplicity.d.ts +0 -1
- package/dist/core/schema-stored/multiplicity.d.ts.map +1 -1
- package/dist/core/schema-stored/multiplicity.js +0 -1
- package/dist/core/schema-stored/multiplicity.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +0 -7
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +0 -4
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts +0 -3
- package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/dist/core/schema-view/view.d.ts +0 -3
- package/dist/core/schema-view/view.d.ts.map +1 -1
- package/dist/core/schema-view/view.js +0 -1
- package/dist/core/schema-view/view.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +4 -16
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +12 -5
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/cursor.d.ts +1 -6
- package/dist/core/tree/cursor.d.ts.map +1 -1
- package/dist/core/tree/cursor.js +0 -2
- package/dist/core/tree/cursor.js.map +1 -1
- package/dist/core/tree/delta.d.ts +0 -11
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodec.js +3 -2
- package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexTypes.d.ts +0 -1
- package/dist/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
- package/dist/core/tree/index.d.ts +1 -1
- package/dist/core/tree/index.d.ts.map +1 -1
- package/dist/core/tree/index.js +3 -1
- package/dist/core/tree/index.js.map +1 -1
- package/dist/core/tree/mapTree.d.ts +20 -4
- package/dist/core/tree/mapTree.d.ts.map +1 -1
- package/dist/core/tree/mapTree.js +29 -0
- package/dist/core/tree/mapTree.js.map +1 -1
- package/dist/core/tree/pathTree.d.ts +0 -11
- package/dist/core/tree/pathTree.d.ts.map +1 -1
- package/dist/core/tree/pathTree.js.map +1 -1
- package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
- package/dist/core/tree/treeTextFormat.js +3 -2
- package/dist/core/tree/treeTextFormat.js.map +1 -1
- package/dist/core/tree/types.d.ts +0 -11
- package/dist/core/tree/types.d.ts.map +1 -1
- package/dist/core/tree/types.js +0 -4
- package/dist/core/tree/types.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +0 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js +2 -2
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/core/tree/visitPath.d.ts +0 -2
- package/dist/core/tree/visitPath.d.ts.map +1 -1
- package/dist/core/tree/visitPath.js.map +1 -1
- package/dist/core/tree/visitorUtils.d.ts +0 -1
- package/dist/core/tree/visitorUtils.d.ts.map +1 -1
- package/dist/core/tree/visitorUtils.js.map +1 -1
- package/dist/domains/index.d.ts +1 -1
- package/dist/domains/index.d.ts.map +1 -1
- package/dist/domains/index.js +2 -1
- package/dist/domains/index.js.map +1 -1
- package/dist/domains/json/index.d.ts +1 -1
- package/dist/domains/json/index.d.ts.map +1 -1
- package/dist/domains/json/index.js +2 -1
- package/dist/domains/json/index.js.map +1 -1
- package/dist/domains/json/jsonCursor.d.ts +36 -2
- package/dist/domains/json/jsonCursor.d.ts.map +1 -1
- package/dist/domains/json/jsonCursor.js +76 -5
- package/dist/domains/json/jsonCursor.js.map +1 -1
- package/dist/domains/json/jsonDomainSchema.d.ts +13 -3
- package/dist/domains/json/jsonDomainSchema.d.ts.map +1 -1
- package/dist/domains/json/jsonDomainSchema.js +12 -4
- package/dist/domains/json/jsonDomainSchema.js.map +1 -1
- package/dist/domains/leafDomain.d.ts +0 -1
- package/dist/domains/leafDomain.d.ts.map +1 -1
- package/dist/domains/leafDomain.js +0 -1
- package/dist/domains/leafDomain.js.map +1 -1
- package/dist/domains/schemaBuilder.d.ts +1 -7
- package/dist/domains/schemaBuilder.d.ts.map +1 -1
- package/dist/domains/schemaBuilder.js +0 -10
- package/dist/domains/schemaBuilder.js.map +1 -1
- package/dist/events/events.d.ts +7 -5
- package/dist/events/events.d.ts.map +1 -1
- package/dist/events/events.js +5 -3
- package/dist/events/events.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +8 -3
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunk.d.ts +1 -1
- package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +3 -3
- 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 +7 -5
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +8 -5
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +5 -3
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +9 -19
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
- package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultSchema.js +0 -1
- package/dist/feature-libraries/default-schema/defaultSchema.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 +2 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +6 -0
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/editableTreeBinder.d.ts +0 -67
- package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
- package/dist/feature-libraries/editableTreeBinder.js +5 -24
- package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
- package/dist/feature-libraries/fieldGenerator.d.ts +0 -3
- package/dist/feature-libraries/fieldGenerator.d.ts.map +1 -1
- package/dist/feature-libraries/fieldGenerator.js +0 -1
- package/dist/feature-libraries/fieldGenerator.js.map +1 -1
- package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
- package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
- package/dist/feature-libraries/flex-map-tree/index.js +2 -2
- package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -51
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +171 -180
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +0 -1
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -373
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js +1 -34
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/index.d.ts +2 -2
- package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/index.js +1 -3
- package/dist/feature-libraries/flex-tree/index.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +9 -27
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +26 -102
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts +3 -18
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +2 -126
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
- package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
- package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -1
- package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/utilities.js +4 -0
- package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js +2 -2
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +6 -8
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +7 -20
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.d.ts +6 -2
- package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/dist/feature-libraries/mapTreeCursor.js +9 -1
- package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
- package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
- package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
- package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -1
- package/dist/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
- package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
- package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/dist/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
- package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/discrepancies.js +105 -2
- package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
- package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldKind.js +1 -2
- package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +57 -85
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +5 -8
- package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
- package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js +6 -0
- package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +2 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +39 -22
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +192 -228
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
- 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/node-key/nodeKey.d.ts +0 -4
- package/dist/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
- package/dist/feature-libraries/node-key/nodeKey.js +0 -2
- package/dist/feature-libraries/node-key/nodeKey.js.map +1 -1
- package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
- package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
- package/dist/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +1 -10
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
- package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/schemaBuilderBase.d.ts +2 -28
- package/dist/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
- package/dist/feature-libraries/schemaBuilderBase.js +1 -27
- package/dist/feature-libraries/schemaBuilderBase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +24 -21
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.d.ts +3 -3
- package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV2.js +7 -6
- package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/formatV3.d.ts +195 -0
- package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
- package/dist/feature-libraries/sequence-field/formatV3.js +23 -0
- package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -0
- package/dist/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
- package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
- package/dist/feature-libraries/sequence-field/index.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/index.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +21 -13
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.js +1 -1
- package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
- package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/rebase.js +24 -6
- package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -3
- package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +38 -4
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +54 -9
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +85 -0
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +4 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/feature-libraries/sequence-field/types.d.ts +23 -4
- package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/types.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.d.ts +5 -4
- package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +70 -42
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/storedToViewSchema.d.ts +0 -1
- package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
- package/dist/feature-libraries/storedToViewSchema.js +0 -1
- package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.d.ts +0 -6
- package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +8 -6
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/feature-libraries/treeTextCursor.d.ts +0 -2
- package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
- package/dist/feature-libraries/treeTextCursor.js +0 -2
- package/dist/feature-libraries/treeTextCursor.js.map +1 -1
- package/dist/feature-libraries/typed-schema/flexList.d.ts +0 -3
- package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
- package/dist/feature-libraries/typed-schema/index.d.ts +1 -1
- package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/index.js +1 -3
- package/dist/feature-libraries/typed-schema/index.js.map +1 -1
- package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -4
- package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
- package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
- package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/typedTreeSchema.js +1 -40
- package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
- package/dist/feature-libraries/typed-schema/view.d.ts +0 -1
- package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/view.js.map +1 -1
- package/dist/index.d.ts +8 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -90
- package/dist/index.js.map +1 -1
- package/dist/internalTypes.d.ts +1 -1
- package/dist/internalTypes.d.ts.map +1 -1
- package/dist/internalTypes.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +4 -1
- package/dist/shared-tree/schematizeTree.d.ts +2 -11
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +13 -2
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +2 -2
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +4 -17
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +4 -8
- 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 +4 -0
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/treeApi.js +2 -2
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +0 -5
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +5 -3
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree/treeView.d.ts +3 -6
- package/dist/shared-tree/treeView.d.ts.map +1 -1
- package/dist/shared-tree/treeView.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +11 -6
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.js +3 -3
- package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerCodecs.js +1 -0
- package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/dist/shared-tree-core/editManagerFormat.d.ts +2 -2
- package/dist/shared-tree-core/editManagerFormat.d.ts.map +1 -1
- package/dist/shared-tree-core/editManagerFormat.js +6 -1
- package/dist/shared-tree-core/editManagerFormat.js.map +1 -1
- package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecs.js +1 -0
- package/dist/shared-tree-core/messageCodecs.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +3 -1
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +54 -0
- package/dist/simple-tree/api/create.d.ts.map +1 -0
- package/dist/simple-tree/api/create.js +99 -0
- package/dist/simple-tree/api/create.js.map +1 -0
- package/dist/simple-tree/api/index.d.ts +12 -0
- package/dist/simple-tree/api/index.d.ts.map +1 -0
- package/dist/simple-tree/api/index.js +28 -0
- package/dist/simple-tree/api/index.js.map +1 -0
- package/{lib/simple-tree → dist/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
- package/dist/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -0
- package/dist/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -0
- package/dist/simple-tree/{schemaFactory.js → api/schemaFactory.js} +10 -9
- package/dist/simple-tree/api/schemaFactory.js.map +1 -0
- package/{lib/simple-tree → dist/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
- package/dist/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
- package/dist/simple-tree/api/testRecursiveDomain.d.ts +62 -0
- package/dist/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
- package/dist/simple-tree/api/testRecursiveDomain.js.map +1 -0
- package/{lib/simple-tree → dist/simple-tree/api}/tree.d.ts +111 -20
- package/dist/simple-tree/api/tree.d.ts.map +1 -0
- package/dist/simple-tree/api/tree.js +173 -0
- package/dist/simple-tree/api/tree.js.map +1 -0
- package/dist/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +7 -6
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -0
- package/dist/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +57 -21
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -0
- package/dist/simple-tree/api/verboseTree.d.ts +136 -0
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -0
- package/dist/simple-tree/api/verboseTree.js +220 -0
- package/dist/simple-tree/api/verboseTree.js.map +1 -0
- package/dist/simple-tree/arrayNode.d.ts +3 -3
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +72 -85
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +10 -0
- package/dist/simple-tree/core/index.d.ts.map +1 -0
- package/dist/simple-tree/core/index.js +27 -0
- package/dist/simple-tree/core/index.js.map +1 -0
- package/{lib/simple-tree → dist/simple-tree/core}/schemaCaching.d.ts +2 -9
- package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -0
- package/dist/simple-tree/{schemaCaching.js → core/schemaCaching.js} +2 -23
- package/dist/simple-tree/core/schemaCaching.js.map +1 -0
- package/dist/simple-tree/core/treeNodeKernel.d.ts +70 -0
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
- package/dist/simple-tree/core/treeNodeKernel.js +164 -0
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -0
- package/dist/simple-tree/core/treeNodeSchema.d.ts +149 -0
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
- package/dist/simple-tree/core/treeNodeSchema.js +35 -0
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -0
- package/{lib/simple-tree → dist/simple-tree/core}/types.d.ts +50 -79
- package/dist/simple-tree/core/types.d.ts.map +1 -0
- package/dist/simple-tree/core/types.js +117 -0
- package/dist/simple-tree/core/types.js.map +1 -0
- package/dist/simple-tree/core/withType.d.ts +82 -0
- package/dist/simple-tree/core/withType.d.ts.map +1 -0
- package/dist/simple-tree/core/withType.js +39 -0
- package/dist/simple-tree/core/withType.js.map +1 -0
- package/dist/simple-tree/getJsonSchema.d.ts +55 -0
- package/dist/simple-tree/getJsonSchema.d.ts.map +1 -0
- package/dist/simple-tree/getJsonSchema.js +69 -0
- package/dist/simple-tree/getJsonSchema.js.map +1 -0
- package/dist/simple-tree/getSimpleFieldSchema.d.ts +14 -0
- package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
- package/dist/simple-tree/getSimpleFieldSchema.js +29 -0
- package/dist/simple-tree/getSimpleFieldSchema.js.map +1 -0
- package/dist/simple-tree/getSimpleSchema.d.ts +58 -0
- package/dist/simple-tree/getSimpleSchema.d.ts.map +1 -0
- package/dist/simple-tree/getSimpleSchema.js +68 -0
- package/dist/simple-tree/getSimpleSchema.js.map +1 -0
- package/dist/simple-tree/index.d.ts +12 -13
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +26 -23
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/jsonSchema.d.ts +206 -0
- package/dist/simple-tree/jsonSchema.d.ts.map +1 -0
- package/dist/{feature-libraries/schema-aware/index.js → simple-tree/jsonSchema.js} +1 -1
- package/dist/simple-tree/jsonSchema.js.map +1 -0
- 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 +3 -4
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts +9 -3
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +33 -35
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +18 -16
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +43 -44
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +38 -0
- package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -0
- package/dist/simple-tree/objectNodeTypes.js +19 -0
- package/dist/simple-tree/objectNodeTypes.js.map +1 -0
- package/dist/simple-tree/proxies.d.ts +6 -25
- package/dist/simple-tree/proxies.d.ts.map +1 -1
- package/dist/simple-tree/proxies.js +50 -63
- package/dist/simple-tree/proxies.js.map +1 -1
- package/dist/simple-tree/proxyBinding.d.ts +45 -22
- package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
- package/dist/simple-tree/proxyBinding.js +94 -59
- package/dist/simple-tree/proxyBinding.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +10 -159
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +11 -42
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +124 -0
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
- package/dist/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
- package/dist/simple-tree/simpleSchema.js.map +1 -0
- package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
- package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
- package/dist/simple-tree/simpleSchemaToJsonSchema.js +146 -0
- package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
- package/dist/simple-tree/toFlexSchema.d.ts +4 -12
- package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
- package/dist/simple-tree/toFlexSchema.js +42 -52
- package/dist/simple-tree/toFlexSchema.js.map +1 -1
- package/dist/simple-tree/toMapTree.d.ts +39 -39
- package/dist/simple-tree/toMapTree.d.ts.map +1 -1
- package/dist/simple-tree/toMapTree.js +227 -171
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts +74 -0
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -0
- package/dist/simple-tree/{types.js → treeNodeValid.js} +18 -111
- package/dist/simple-tree/treeNodeValid.js.map +1 -0
- package/dist/simple-tree/typesUnsafe.d.ts +35 -4
- package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
- package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
- package/dist/simple-tree/viewSchemaToSimpleSchema.js +171 -0
- package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
- package/dist/util/brand.d.ts +0 -3
- package/dist/util/brand.d.ts.map +1 -1
- package/dist/util/brand.js +1 -2
- package/dist/util/brand.js.map +1 -1
- package/dist/util/brandedMap.d.ts +0 -5
- package/dist/util/brandedMap.d.ts.map +1 -1
- package/dist/util/brandedMap.js +0 -1
- package/dist/util/brandedMap.js.map +1 -1
- package/dist/util/idAllocator.d.ts +0 -2
- package/dist/util/idAllocator.d.ts.map +1 -1
- package/dist/util/idAllocator.js +0 -1
- package/dist/util/idAllocator.js.map +1 -1
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +4 -2
- package/dist/util/index.js.map +1 -1
- package/dist/util/nestedMap.d.ts +5 -19
- package/dist/util/nestedMap.d.ts.map +1 -1
- package/dist/util/nestedMap.js +17 -17
- package/dist/util/nestedMap.js.map +1 -1
- package/dist/util/opaque.d.ts +0 -4
- package/dist/util/opaque.d.ts.map +1 -1
- package/dist/util/opaque.js +0 -2
- package/dist/util/opaque.js.map +1 -1
- package/dist/util/rangeMap.d.ts +0 -2
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +4 -3
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/transactionResult.d.ts +0 -1
- package/dist/util/transactionResult.d.ts.map +1 -1
- package/dist/util/transactionResult.js +0 -1
- package/dist/util/transactionResult.js.map +1 -1
- package/dist/util/typeCheck.d.ts +2 -20
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/typeCheckTests.d.ts +4 -4
- package/dist/util/typeCheckTests.d.ts.map +1 -1
- package/dist/util/typeCheckTests.js.map +1 -1
- package/dist/util/typeUtils.d.ts +0 -7
- package/dist/util/typeUtils.d.ts.map +1 -1
- package/dist/util/typeUtils.js.map +1 -1
- package/dist/util/utils.d.ts +6 -8
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +14 -5
- package/dist/util/utils.js.map +1 -1
- package/lib/beta.d.ts +4 -1
- package/lib/codec/discriminatedUnions.d.ts +11 -5
- package/lib/codec/discriminatedUnions.d.ts.map +1 -1
- package/lib/codec/discriminatedUnions.js.map +1 -1
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/core/forest/editableForest.d.ts +1 -5
- package/lib/core/forest/editableForest.d.ts.map +1 -1
- package/lib/core/forest/editableForest.js.map +1 -1
- package/lib/core/forest/forest.d.ts +0 -6
- package/lib/core/forest/forest.d.ts.map +1 -1
- package/lib/core/forest/forest.js +0 -2
- package/lib/core/forest/forest.js.map +1 -1
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/changeRebaser.d.ts +0 -4
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +1 -8
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +1 -7
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/rebase/utils.d.ts +0 -1
- package/lib/core/rebase/utils.d.ts.map +1 -1
- package/lib/core/rebase/utils.js +13 -8
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/schema-stored/multiplicity.d.ts +0 -1
- package/lib/core/schema-stored/multiplicity.d.ts.map +1 -1
- package/lib/core/schema-stored/multiplicity.js +0 -1
- package/lib/core/schema-stored/multiplicity.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +0 -7
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +0 -4
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.d.ts +0 -3
- package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
- package/lib/core/schema-view/view.d.ts +0 -3
- package/lib/core/schema-view/view.d.ts.map +1 -1
- package/lib/core/schema-view/view.js +0 -1
- package/lib/core/schema-view/view.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +4 -16
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +12 -5
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/cursor.d.ts +1 -6
- package/lib/core/tree/cursor.d.ts.map +1 -1
- package/lib/core/tree/cursor.js +0 -2
- package/lib/core/tree/cursor.js.map +1 -1
- package/lib/core/tree/delta.d.ts +0 -11
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodec.js +4 -3
- package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexTypes.d.ts +0 -1
- package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
- package/lib/core/tree/index.d.ts +1 -1
- package/lib/core/tree/index.d.ts.map +1 -1
- package/lib/core/tree/index.js +1 -0
- package/lib/core/tree/index.js.map +1 -1
- package/lib/core/tree/mapTree.d.ts +20 -4
- package/lib/core/tree/mapTree.d.ts.map +1 -1
- package/lib/core/tree/mapTree.js +27 -1
- package/lib/core/tree/mapTree.js.map +1 -1
- package/lib/core/tree/pathTree.d.ts +0 -11
- package/lib/core/tree/pathTree.d.ts.map +1 -1
- package/lib/core/tree/pathTree.js.map +1 -1
- package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
- package/lib/core/tree/treeTextFormat.js +3 -2
- package/lib/core/tree/treeTextFormat.js.map +1 -1
- package/lib/core/tree/types.d.ts +0 -11
- package/lib/core/tree/types.d.ts.map +1 -1
- package/lib/core/tree/types.js +0 -4
- package/lib/core/tree/types.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +0 -1
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js +2 -2
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/core/tree/visitPath.d.ts +0 -2
- package/lib/core/tree/visitPath.d.ts.map +1 -1
- package/lib/core/tree/visitPath.js.map +1 -1
- package/lib/core/tree/visitorUtils.d.ts +0 -1
- package/lib/core/tree/visitorUtils.d.ts.map +1 -1
- package/lib/core/tree/visitorUtils.js.map +1 -1
- package/lib/domains/index.d.ts +1 -1
- package/lib/domains/index.d.ts.map +1 -1
- package/lib/domains/index.js +1 -1
- package/lib/domains/index.js.map +1 -1
- package/lib/domains/json/index.d.ts +1 -1
- package/lib/domains/json/index.d.ts.map +1 -1
- package/lib/domains/json/index.js +1 -1
- package/lib/domains/json/index.js.map +1 -1
- package/lib/domains/json/jsonCursor.d.ts +36 -2
- package/lib/domains/json/jsonCursor.d.ts.map +1 -1
- package/lib/domains/json/jsonCursor.js +76 -5
- package/lib/domains/json/jsonCursor.js.map +1 -1
- package/lib/domains/json/jsonDomainSchema.d.ts +13 -3
- package/lib/domains/json/jsonDomainSchema.d.ts.map +1 -1
- package/lib/domains/json/jsonDomainSchema.js +9 -1
- package/lib/domains/json/jsonDomainSchema.js.map +1 -1
- package/lib/domains/leafDomain.d.ts +0 -1
- package/lib/domains/leafDomain.d.ts.map +1 -1
- package/lib/domains/leafDomain.js +0 -1
- package/lib/domains/leafDomain.js.map +1 -1
- package/lib/domains/schemaBuilder.d.ts +1 -7
- package/lib/domains/schemaBuilder.d.ts.map +1 -1
- package/lib/domains/schemaBuilder.js +1 -11
- package/lib/domains/schemaBuilder.js.map +1 -1
- package/lib/events/events.d.ts +7 -5
- package/lib/events/events.d.ts.map +1 -1
- package/lib/events/events.js +5 -3
- package/lib/events/events.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +9 -4
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunk.d.ts +1 -1
- package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -4
- 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 +8 -6
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +9 -6
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -16
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
- package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultSchema.js +0 -1
- package/lib/feature-libraries/default-schema/defaultSchema.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 +1 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +6 -0
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/editableTreeBinder.d.ts +0 -67
- package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
- package/lib/feature-libraries/editableTreeBinder.js +6 -25
- package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
- package/lib/feature-libraries/fieldGenerator.d.ts +0 -3
- package/lib/feature-libraries/fieldGenerator.d.ts.map +1 -1
- package/lib/feature-libraries/fieldGenerator.js +0 -1
- package/lib/feature-libraries/fieldGenerator.js.map +1 -1
- package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
- package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
- package/lib/feature-libraries/flex-map-tree/index.js +1 -1
- package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -51
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +172 -180
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +0 -1
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -373
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js +0 -33
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/index.d.ts +2 -2
- package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/index.js +1 -1
- package/lib/feature-libraries/flex-tree/index.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +9 -27
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +28 -104
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts +3 -18
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +5 -126
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
- package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
- package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -1
- package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/utilities.js +4 -0
- package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js +3 -3
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +6 -8
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +6 -7
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.d.ts +6 -2
- package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
- package/lib/feature-libraries/mapTreeCursor.js +7 -0
- package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
- package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
- package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
- package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -1
- package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
- package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
- package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
- package/lib/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
- package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/discrepancies.js +103 -1
- package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
- package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldKind.js +1 -2
- package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +56 -83
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +6 -9
- package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
- package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js +4 -1
- package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +42 -25
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +169 -206
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
- 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/node-key/nodeKey.d.ts +0 -4
- package/lib/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
- package/lib/feature-libraries/node-key/nodeKey.js +0 -2
- package/lib/feature-libraries/node-key/nodeKey.js.map +1 -1
- package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
- package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
- package/lib/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +2 -11
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
- package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/schemaBuilderBase.d.ts +2 -28
- package/lib/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
- package/lib/feature-libraries/schemaBuilderBase.js +2 -28
- package/lib/feature-libraries/schemaBuilderBase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +25 -22
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.d.ts +3 -3
- package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV2.js +3 -3
- package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/formatV3.d.ts +195 -0
- package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
- package/lib/feature-libraries/sequence-field/formatV3.js +19 -0
- package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -0
- package/lib/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
- package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
- package/lib/feature-libraries/sequence-field/index.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/index.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +22 -14
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/markQueue.js +2 -2
- package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
- package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/rebase.js +25 -7
- package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
- package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -3
- package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +40 -6
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +55 -11
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +81 -0
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +5 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/lib/feature-libraries/sequence-field/types.d.ts +23 -4
- package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/types.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.d.ts +5 -4
- package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +67 -41
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/storedToViewSchema.d.ts +0 -1
- package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
- package/lib/feature-libraries/storedToViewSchema.js +0 -1
- package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.d.ts +0 -6
- package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +9 -7
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/feature-libraries/treeTextCursor.d.ts +0 -2
- package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
- package/lib/feature-libraries/treeTextCursor.js +0 -2
- package/lib/feature-libraries/treeTextCursor.js.map +1 -1
- package/lib/feature-libraries/typed-schema/flexList.d.ts +0 -3
- package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
- package/lib/feature-libraries/typed-schema/index.d.ts +1 -1
- package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/index.js +1 -1
- package/lib/feature-libraries/typed-schema/index.js.map +1 -1
- package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/schemaCollection.js +1 -5
- package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
- package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
- package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -38
- package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
- package/lib/feature-libraries/typed-schema/view.d.ts +0 -1
- package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/view.js.map +1 -1
- package/lib/index.d.ts +8 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -9
- package/lib/index.js.map +1 -1
- package/lib/internalTypes.d.ts +1 -1
- package/lib/internalTypes.d.ts.map +1 -1
- package/lib/internalTypes.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +4 -1
- package/lib/shared-tree/schematizeTree.d.ts +2 -11
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +15 -4
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +3 -3
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +4 -17
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +6 -10
- 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 +4 -0
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/treeApi.js +3 -3
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +0 -5
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +6 -4
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree/treeView.d.ts +3 -6
- package/lib/shared-tree/treeView.d.ts.map +1 -1
- package/lib/shared-tree/treeView.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +12 -7
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.js +4 -4
- package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerCodecs.js +1 -0
- package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
- package/lib/shared-tree-core/editManagerFormat.d.ts +2 -2
- package/lib/shared-tree-core/editManagerFormat.d.ts.map +1 -1
- package/lib/shared-tree-core/editManagerFormat.js +6 -1
- package/lib/shared-tree-core/editManagerFormat.js.map +1 -1
- package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecs.js +1 -0
- package/lib/shared-tree-core/messageCodecs.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +4 -2
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +54 -0
- package/lib/simple-tree/api/create.d.ts.map +1 -0
- package/lib/simple-tree/api/create.js +92 -0
- package/lib/simple-tree/api/create.js.map +1 -0
- package/lib/simple-tree/api/index.d.ts +12 -0
- package/lib/simple-tree/api/index.d.ts.map +1 -0
- package/lib/simple-tree/api/index.js +13 -0
- package/lib/simple-tree/api/index.js.map +1 -0
- package/{dist/simple-tree → lib/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
- package/lib/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -0
- package/lib/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -0
- package/lib/simple-tree/{schemaFactory.js → api/schemaFactory.js} +9 -8
- package/lib/simple-tree/api/schemaFactory.js.map +1 -0
- package/{dist/simple-tree → lib/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
- package/lib/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
- package/lib/simple-tree/api/testRecursiveDomain.d.ts +62 -0
- package/lib/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
- package/lib/simple-tree/api/testRecursiveDomain.js.map +1 -0
- package/{dist/simple-tree → lib/simple-tree/api}/tree.d.ts +111 -20
- package/lib/simple-tree/api/tree.d.ts.map +1 -0
- package/lib/simple-tree/api/tree.js +165 -0
- package/lib/simple-tree/api/tree.js.map +1 -0
- package/lib/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +7 -6
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -0
- package/lib/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +55 -19
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -0
- package/lib/simple-tree/api/verboseTree.d.ts +136 -0
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -0
- package/lib/simple-tree/api/verboseTree.js +213 -0
- package/lib/simple-tree/api/verboseTree.js.map +1 -0
- package/lib/simple-tree/arrayNode.d.ts +3 -3
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +59 -70
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +10 -0
- package/lib/simple-tree/core/index.d.ts.map +1 -0
- package/lib/simple-tree/core/index.js +10 -0
- package/lib/simple-tree/core/index.js.map +1 -0
- package/{dist/simple-tree → lib/simple-tree/core}/schemaCaching.d.ts +2 -9
- package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -0
- package/lib/simple-tree/{schemaCaching.js → core/schemaCaching.js} +1 -21
- package/lib/simple-tree/core/schemaCaching.js.map +1 -0
- package/lib/simple-tree/core/treeNodeKernel.d.ts +70 -0
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
- package/lib/simple-tree/core/treeNodeKernel.js +157 -0
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -0
- package/lib/simple-tree/core/treeNodeSchema.d.ts +149 -0
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
- package/lib/simple-tree/core/treeNodeSchema.js +32 -0
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -0
- package/{dist/simple-tree → lib/simple-tree/core}/types.d.ts +50 -79
- package/lib/simple-tree/core/types.d.ts.map +1 -0
- package/lib/simple-tree/core/types.js +111 -0
- package/lib/simple-tree/core/types.js.map +1 -0
- package/lib/simple-tree/core/withType.d.ts +82 -0
- package/lib/simple-tree/core/withType.d.ts.map +1 -0
- package/lib/simple-tree/core/withType.js +36 -0
- package/lib/simple-tree/core/withType.js.map +1 -0
- package/lib/simple-tree/getJsonSchema.d.ts +55 -0
- package/lib/simple-tree/getJsonSchema.d.ts.map +1 -0
- package/lib/simple-tree/getJsonSchema.js +65 -0
- package/lib/simple-tree/getJsonSchema.js.map +1 -0
- package/lib/simple-tree/getSimpleFieldSchema.d.ts +14 -0
- package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
- package/lib/simple-tree/getSimpleFieldSchema.js +25 -0
- package/lib/simple-tree/getSimpleFieldSchema.js.map +1 -0
- package/lib/simple-tree/getSimpleSchema.d.ts +58 -0
- package/lib/simple-tree/getSimpleSchema.d.ts.map +1 -0
- package/lib/simple-tree/getSimpleSchema.js +64 -0
- package/lib/simple-tree/getSimpleSchema.js.map +1 -0
- package/lib/simple-tree/index.d.ts +12 -13
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +8 -11
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/jsonSchema.d.ts +206 -0
- package/lib/simple-tree/jsonSchema.d.ts.map +1 -0
- package/lib/simple-tree/{nodeKeys.js → jsonSchema.js} +1 -1
- package/lib/simple-tree/jsonSchema.js.map +1 -0
- 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 +1 -2
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/mapNode.d.ts +9 -3
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +36 -36
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +18 -16
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +36 -34
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +38 -0
- package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -0
- package/lib/simple-tree/objectNodeTypes.js +15 -0
- package/lib/simple-tree/objectNodeTypes.js.map +1 -0
- package/lib/simple-tree/proxies.d.ts +6 -25
- package/lib/simple-tree/proxies.d.ts.map +1 -1
- package/lib/simple-tree/proxies.js +46 -57
- package/lib/simple-tree/proxies.js.map +1 -1
- package/lib/simple-tree/proxyBinding.d.ts +45 -22
- package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
- package/lib/simple-tree/proxyBinding.js +89 -52
- package/lib/simple-tree/proxyBinding.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +10 -159
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +9 -41
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +124 -0
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
- package/lib/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -0
- package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
- package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
- package/lib/simple-tree/simpleSchemaToJsonSchema.js +142 -0
- package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
- package/lib/simple-tree/toFlexSchema.d.ts +4 -12
- package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
- package/lib/simple-tree/toFlexSchema.js +9 -18
- package/lib/simple-tree/toFlexSchema.js.map +1 -1
- package/lib/simple-tree/toMapTree.d.ts +39 -39
- package/lib/simple-tree/toMapTree.d.ts.map +1 -1
- package/lib/simple-tree/toMapTree.js +214 -158
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts +74 -0
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -0
- package/lib/simple-tree/{types.js → treeNodeValid.js} +8 -98
- package/lib/simple-tree/treeNodeValid.js.map +1 -0
- package/lib/simple-tree/typesUnsafe.d.ts +35 -4
- package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
- package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
- package/lib/simple-tree/viewSchemaToSimpleSchema.js +167 -0
- package/lib/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
- package/lib/util/brand.d.ts +0 -3
- package/lib/util/brand.d.ts.map +1 -1
- package/lib/util/brand.js +1 -2
- package/lib/util/brand.js.map +1 -1
- package/lib/util/brandedMap.d.ts +0 -5
- package/lib/util/brandedMap.d.ts.map +1 -1
- package/lib/util/brandedMap.js +0 -1
- package/lib/util/brandedMap.js.map +1 -1
- package/lib/util/idAllocator.d.ts +0 -2
- package/lib/util/idAllocator.d.ts.map +1 -1
- package/lib/util/idAllocator.js +0 -1
- package/lib/util/idAllocator.js.map +1 -1
- package/lib/util/index.d.ts +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/nestedMap.d.ts +5 -19
- package/lib/util/nestedMap.d.ts.map +1 -1
- package/lib/util/nestedMap.js +15 -16
- package/lib/util/nestedMap.js.map +1 -1
- package/lib/util/opaque.d.ts +0 -4
- package/lib/util/opaque.d.ts.map +1 -1
- package/lib/util/opaque.js +0 -2
- package/lib/util/opaque.js.map +1 -1
- package/lib/util/rangeMap.d.ts +0 -2
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +4 -3
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/transactionResult.d.ts +0 -1
- package/lib/util/transactionResult.d.ts.map +1 -1
- package/lib/util/transactionResult.js +0 -1
- package/lib/util/transactionResult.js.map +1 -1
- package/lib/util/typeCheck.d.ts +2 -20
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/typeCheckTests.d.ts +4 -4
- package/lib/util/typeCheckTests.d.ts.map +1 -1
- package/lib/util/typeCheckTests.js.map +1 -1
- package/lib/util/typeUtils.d.ts +0 -7
- package/lib/util/typeUtils.d.ts.map +1 -1
- package/lib/util/typeUtils.js.map +1 -1
- package/lib/util/utils.d.ts +6 -8
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +12 -4
- package/lib/util/utils.js.map +1 -1
- package/package.json +25 -24
- package/src/codec/discriminatedUnions.ts +20 -10
- package/src/codec/index.ts +5 -1
- package/src/core/forest/README.md +4 -2
- package/src/core/forest/editableForest.ts +1 -6
- package/src/core/forest/forest.ts +0 -6
- package/src/core/index.ts +2 -2
- package/src/core/rebase/changeRebaser.ts +0 -4
- package/src/core/rebase/index.ts +0 -2
- package/src/core/rebase/types.ts +1 -23
- package/src/core/rebase/utils.ts +13 -11
- package/src/core/schema-stored/multiplicity.ts +0 -1
- package/src/core/schema-stored/schema.ts +0 -7
- package/src/core/schema-stored/storedSchemaRepository.ts +0 -3
- package/src/core/schema-view/view.ts +0 -3
- package/src/core/tree/anchorSet.ts +27 -26
- package/src/core/tree/cursor.ts +1 -6
- package/src/core/tree/delta.ts +0 -11
- package/src/core/tree/detachedFieldIndexCodec.ts +4 -3
- package/src/core/tree/detachedFieldIndexTypes.ts +0 -1
- package/src/core/tree/index.ts +1 -1
- package/src/core/tree/mapTree.ts +45 -4
- package/src/core/tree/pathTree.ts +0 -11
- package/src/core/tree/treeTextFormat.ts +3 -2
- package/src/core/tree/types.ts +0 -11
- package/src/core/tree/visitDelta.ts +2 -3
- package/src/core/tree/visitPath.ts +0 -2
- package/src/core/tree/visitorUtils.ts +0 -1
- package/src/domains/index.ts +3 -0
- package/src/domains/json/index.ts +7 -1
- package/src/domains/json/jsonCursor.ts +113 -6
- package/src/domains/json/jsonDomainSchema.ts +4 -5
- package/src/domains/leafDomain.ts +0 -1
- package/src/domains/schemaBuilder.ts +0 -22
- package/src/events/events.ts +10 -6
- package/src/feature-libraries/chunked-forest/README.md +9 -1
- package/src/feature-libraries/chunked-forest/basicChunk.ts +14 -9
- package/src/feature-libraries/chunked-forest/chunk.ts +1 -1
- package/src/feature-libraries/chunked-forest/chunkTree.ts +4 -4
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +8 -6
- package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +9 -6
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +18 -46
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +11 -6
- package/src/feature-libraries/default-schema/defaultSchema.ts +0 -1
- package/src/feature-libraries/default-schema/index.ts +1 -1
- package/src/feature-libraries/default-schema/schemaChecker.ts +6 -0
- package/src/feature-libraries/editableTreeBinder.ts +6 -78
- package/src/feature-libraries/fieldGenerator.ts +0 -3
- package/src/feature-libraries/flex-map-tree/index.ts +2 -1
- package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +238 -288
- package/src/feature-libraries/flex-tree/context.ts +0 -1
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +27 -524
- package/src/feature-libraries/flex-tree/index.ts +1 -18
- package/src/feature-libraries/flex-tree/lazyField.ts +38 -214
- package/src/feature-libraries/flex-tree/lazyNode.ts +3 -215
- package/src/feature-libraries/flex-tree/treeEvents.ts +0 -2
- package/src/feature-libraries/flex-tree/utilities.ts +6 -1
- package/src/feature-libraries/forest-summary/codec.ts +3 -3
- package/src/feature-libraries/index.ts +5 -49
- package/src/feature-libraries/mapTreeCursor.ts +13 -4
- package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -4
- package/src/feature-libraries/modular-schema/crossFieldQueries.ts +0 -2
- package/src/feature-libraries/modular-schema/discrepancies.ts +117 -1
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +0 -8
- package/src/feature-libraries/modular-schema/fieldKind.ts +1 -3
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +69 -92
- package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +7 -14
- package/src/feature-libraries/modular-schema/genericFieldKindTypes.ts +6 -15
- package/src/feature-libraries/modular-schema/index.ts +2 -2
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +68 -34
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +330 -336
- package/src/feature-libraries/modular-schema/modularChangeTypes.ts +7 -14
- package/src/feature-libraries/node-key/nodeKey.ts +0 -4
- package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -1
- package/src/feature-libraries/object-forest/objectForest.ts +1 -13
- package/src/feature-libraries/schemaBuilderBase.ts +1 -49
- package/src/feature-libraries/sequence-field/compose.ts +41 -20
- package/src/feature-libraries/sequence-field/formatV2.ts +3 -3
- package/src/feature-libraries/sequence-field/formatV3.ts +65 -0
- package/src/feature-libraries/sequence-field/helperTypes.ts +33 -0
- package/src/feature-libraries/sequence-field/index.ts +1 -0
- package/src/feature-libraries/sequence-field/invert.ts +28 -18
- package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
- package/src/feature-libraries/sequence-field/moveEffectTable.ts +2 -2
- package/src/feature-libraries/sequence-field/rebase.ts +30 -13
- package/src/feature-libraries/sequence-field/replaceRevisions.ts +27 -3
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +52 -7
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +92 -19
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +134 -0
- package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +2 -0
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +8 -2
- package/src/feature-libraries/sequence-field/types.ts +24 -4
- package/src/feature-libraries/sequence-field/utils.ts +78 -50
- package/src/feature-libraries/storedToViewSchema.ts +0 -1
- package/src/feature-libraries/treeCursorUtils.ts +11 -11
- package/src/feature-libraries/treeTextCursor.ts +0 -2
- package/src/feature-libraries/typed-schema/flexList.ts +0 -3
- package/src/feature-libraries/typed-schema/index.ts +0 -2
- package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -5
- package/src/feature-libraries/typed-schema/typedTreeSchema.ts +2 -68
- package/src/feature-libraries/typed-schema/view.ts +0 -1
- package/src/index.ts +32 -242
- package/src/internalTypes.ts +1 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/schematizeTree.ts +25 -21
- package/src/shared-tree/schematizingTreeView.ts +6 -6
- package/src/shared-tree/sharedTree.ts +8 -39
- package/src/shared-tree/sharedTreeChangeCodecs.ts +8 -0
- package/src/shared-tree/sharedTreeChangeFamily.ts +3 -3
- package/src/shared-tree/sharedTreeEditBuilder.ts +0 -2
- package/src/shared-tree/treeApi.ts +3 -3
- package/src/shared-tree/treeCheckout.ts +6 -8
- package/src/shared-tree/treeView.ts +3 -6
- package/src/shared-tree-core/branch.ts +20 -8
- package/src/shared-tree-core/defaultResubmitMachine.ts +4 -4
- package/src/shared-tree-core/editManagerCodecs.ts +1 -0
- package/src/shared-tree-core/editManagerFormat.ts +7 -2
- package/src/shared-tree-core/messageCodecs.ts +2 -1
- package/src/shared-tree-core/sharedTreeCore.ts +5 -3
- package/src/simple-tree/ProxyBinding.md +2 -0
- package/src/simple-tree/api/README.md +7 -0
- package/src/simple-tree/api/create.ts +179 -0
- package/src/simple-tree/api/index.ts +36 -0
- package/src/simple-tree/{schemaCreationUtilities.ts → api/schemaCreationUtilities.ts} +13 -5
- package/src/simple-tree/{schemaFactory.ts → api/schemaFactory.ts} +36 -34
- package/src/simple-tree/{schemaFactoryRecursive.ts → api/schemaFactoryRecursive.ts} +47 -10
- package/src/simple-tree/{testRecursiveDomain.ts → api/testRecursiveDomain.ts} +3 -1
- package/src/simple-tree/{tree.ts → api/tree.ts} +246 -34
- package/src/simple-tree/{treeNodeApi.ts → api/treeNodeApi.ts} +84 -41
- package/src/simple-tree/api/verboseTree.ts +415 -0
- package/src/simple-tree/arrayNode.ts +103 -110
- package/src/simple-tree/core/README.md +11 -0
- package/src/simple-tree/core/index.ts +34 -0
- package/src/simple-tree/{schemaCaching.ts → core/schemaCaching.ts} +3 -37
- package/src/simple-tree/core/treeNodeKernel.ts +200 -0
- package/src/simple-tree/core/treeNodeSchema.ts +184 -0
- package/src/simple-tree/core/types.ts +281 -0
- package/src/simple-tree/core/withType.ts +89 -0
- package/src/simple-tree/getJsonSchema.ts +70 -0
- package/src/simple-tree/getSimpleFieldSchema.ts +36 -0
- package/src/simple-tree/getSimpleSchema.ts +69 -0
- package/src/simple-tree/index.ts +59 -33
- package/src/simple-tree/jsonSchema.ts +230 -0
- package/src/simple-tree/leafNodeSchema.ts +6 -3
- package/src/simple-tree/mapNode.ts +56 -55
- package/src/simple-tree/objectNode.ts +66 -90
- package/src/simple-tree/objectNodeTypes.ts +68 -0
- package/src/simple-tree/proxies.ts +52 -68
- package/src/simple-tree/proxyBinding.ts +127 -72
- package/src/simple-tree/schemaTypes.ts +29 -194
- package/src/simple-tree/simpleSchema.ts +138 -0
- package/src/simple-tree/simpleSchemaToJsonSchema.ts +178 -0
- package/src/simple-tree/toFlexSchema.ts +9 -42
- package/src/simple-tree/toMapTree.ts +270 -296
- package/src/simple-tree/{types.ts → treeNodeValid.ts} +16 -232
- package/src/simple-tree/typesUnsafe.ts +51 -5
- package/src/simple-tree/viewSchemaToSimpleSchema.ts +209 -0
- package/src/util/brand.ts +1 -4
- package/src/util/brandedMap.ts +0 -5
- package/src/util/idAllocator.ts +0 -2
- package/src/util/index.ts +2 -0
- package/src/util/nestedMap.ts +23 -20
- package/src/util/opaque.ts +0 -4
- package/src/util/rangeMap.ts +5 -5
- package/src/util/transactionResult.ts +0 -1
- package/src/util/typeCheck.ts +2 -20
- package/src/util/typeCheckTests.ts +4 -4
- package/src/util/typeUtils.ts +0 -7
- package/src/util/utils.ts +13 -8
- package/tsconfig.json +0 -1
- package/dist/feature-libraries/contextuallyTyped.d.ts +0 -209
- package/dist/feature-libraries/contextuallyTyped.d.ts.map +0 -1
- package/dist/feature-libraries/contextuallyTyped.js +0 -328
- package/dist/feature-libraries/contextuallyTyped.js.map +0 -1
- package/dist/feature-libraries/schema-aware/index.d.ts +0 -6
- package/dist/feature-libraries/schema-aware/index.d.ts.map +0 -1
- package/dist/feature-libraries/schema-aware/index.js.map +0 -1
- package/dist/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
- package/dist/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
- package/dist/feature-libraries/schema-aware/schemaAware.js.map +0 -1
- package/dist/simple-tree/nodeKeys.d.ts +0 -41
- package/dist/simple-tree/nodeKeys.d.ts.map +0 -1
- package/dist/simple-tree/nodeKeys.js +0 -7
- package/dist/simple-tree/nodeKeys.js.map +0 -1
- package/dist/simple-tree/schemaCaching.d.ts.map +0 -1
- package/dist/simple-tree/schemaCaching.js.map +0 -1
- package/dist/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
- package/dist/simple-tree/schemaCreationUtilities.js.map +0 -1
- package/dist/simple-tree/schemaFactory.d.ts.map +0 -1
- package/dist/simple-tree/schemaFactory.js.map +0 -1
- package/dist/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
- package/dist/simple-tree/schemaFactoryRecursive.js.map +0 -1
- package/dist/simple-tree/testRecursiveDomain.d.ts +0 -61
- package/dist/simple-tree/testRecursiveDomain.d.ts.map +0 -1
- package/dist/simple-tree/testRecursiveDomain.js.map +0 -1
- package/dist/simple-tree/tree.d.ts.map +0 -1
- package/dist/simple-tree/tree.js +0 -73
- package/dist/simple-tree/tree.js.map +0 -1
- package/dist/simple-tree/treeNodeApi.d.ts.map +0 -1
- package/dist/simple-tree/treeNodeApi.js.map +0 -1
- package/dist/simple-tree/treeNodeKernel.d.ts +0 -26
- package/dist/simple-tree/treeNodeKernel.d.ts.map +0 -1
- package/dist/simple-tree/treeNodeKernel.js +0 -83
- package/dist/simple-tree/treeNodeKernel.js.map +0 -1
- package/dist/simple-tree/types.d.ts.map +0 -1
- package/dist/simple-tree/types.js.map +0 -1
- package/lib/feature-libraries/contextuallyTyped.d.ts +0 -209
- package/lib/feature-libraries/contextuallyTyped.d.ts.map +0 -1
- package/lib/feature-libraries/contextuallyTyped.js +0 -311
- package/lib/feature-libraries/contextuallyTyped.js.map +0 -1
- package/lib/feature-libraries/schema-aware/index.d.ts +0 -6
- package/lib/feature-libraries/schema-aware/index.d.ts.map +0 -1
- package/lib/feature-libraries/schema-aware/index.js +0 -6
- package/lib/feature-libraries/schema-aware/index.js.map +0 -1
- package/lib/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
- package/lib/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
- package/lib/feature-libraries/schema-aware/schemaAware.js.map +0 -1
- package/lib/simple-tree/nodeKeys.d.ts +0 -41
- package/lib/simple-tree/nodeKeys.d.ts.map +0 -1
- package/lib/simple-tree/nodeKeys.js.map +0 -1
- package/lib/simple-tree/schemaCaching.d.ts.map +0 -1
- package/lib/simple-tree/schemaCaching.js.map +0 -1
- package/lib/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
- package/lib/simple-tree/schemaCreationUtilities.js.map +0 -1
- package/lib/simple-tree/schemaFactory.d.ts.map +0 -1
- package/lib/simple-tree/schemaFactory.js.map +0 -1
- package/lib/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
- package/lib/simple-tree/schemaFactoryRecursive.js.map +0 -1
- package/lib/simple-tree/testRecursiveDomain.d.ts +0 -61
- package/lib/simple-tree/testRecursiveDomain.d.ts.map +0 -1
- package/lib/simple-tree/testRecursiveDomain.js.map +0 -1
- package/lib/simple-tree/tree.d.ts.map +0 -1
- package/lib/simple-tree/tree.js +0 -66
- package/lib/simple-tree/tree.js.map +0 -1
- package/lib/simple-tree/treeNodeApi.d.ts.map +0 -1
- package/lib/simple-tree/treeNodeApi.js.map +0 -1
- package/lib/simple-tree/treeNodeKernel.d.ts +0 -26
- package/lib/simple-tree/treeNodeKernel.d.ts.map +0 -1
- package/lib/simple-tree/treeNodeKernel.js +0 -79
- package/lib/simple-tree/treeNodeKernel.js.map +0 -1
- package/lib/simple-tree/types.d.ts.map +0 -1
- package/lib/simple-tree/types.js.map +0 -1
- package/src/feature-libraries/contextuallyTyped.ts +0 -582
- package/src/feature-libraries/schema-aware/README.md +0 -19
- package/src/feature-libraries/schema-aware/index.ts +0 -16
- package/src/feature-libraries/schema-aware/schemaAware.ts +0 -135
- package/src/simple-tree/nodeKeys.ts +0 -42
- package/src/simple-tree/treeNodeKernel.ts +0 -91
- /package/dist/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
- /package/lib/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxyBinding.js","sourceRoot":"","sources":["../../src/simple-tree/proxyBinding.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAgD,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EACN,WAAW,EAOX,4BAA4B,EAC5B,YAAY,EAIZ,aAAa,GACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIxC,0EAA0E;AAC1E,sDAAsD;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,qGAAqG;AACrG,kEAAkE;AAElE;;GAEG;AACH,MAAM,SAAS,GAAG,UAAU,EAAY,CAAC;AAEzC,sIAAsI;AACtI,0KAA0K;AAC1K,iKAAiK;AACjK,2EAA2E;AAE3E,+EAA+E;AAC/E,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAwB,CAAC;AAE9D,8EAA8E;AAC9E,oIAAoI;AACpI,MAAM,kBAAkB,GAAG,IAAI,OAAO,EAAyB,CAAC;AAChE,MAAM,kBAAkB,GAAG,IAAI,OAAO,EAAyB,CAAC;AAChE,8HAA8H;AAC9H,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAwB,CAAC;AAE7D;;;;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CAAC;AAOD,MAAM,UAAU,YAAY,CAAC,IAAc;IAC1C,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAc;IACvC,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC5E,OAAO,MAAM,CAAC;AACf,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,UAAsB;IACxD,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9C,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC5E,MAAM,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;AACF,CAAC;AAED,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAA4B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { type AnchorNode, type AnchorSet, type UpPath, anchorSlot } from \"../core/index.js\";\nimport {\n\tContextSlot,\n\ttype FlexTreeNodeSchema,\n\ttype FlexMapNodeSchema,\n\ttype FlexObjectNodeSchema,\n\ttype FlexTreeMapNode,\n\ttype FlexTreeNode,\n\ttype FlexTreeObjectNode,\n\tassertFlexTreeEntityNotFreed,\n\tflexTreeSlot,\n\ttype FieldKinds,\n\ttype FlexFieldSchema,\n\ttype MapTreeNode,\n\tisMapTreeNode,\n} from \"../feature-libraries/index.js\";\nimport { fail } from \"../util/index.js\";\nimport type { WithType } from \"./schemaTypes.js\";\nimport type { TreeArrayNode } from \"./arrayNode.js\";\nimport type { TreeNode } from \"./types.js\";\n// TODO: decide how to deal with dependencies on flex-tree implementation.\n// eslint-disable-next-line import/no-internal-modules\nimport { makeTree } from \"../feature-libraries/flex-tree/lazyNode.js\";\nimport type { TreeMapNode } from \"./mapNode.js\";\nimport { TreeNodeKernel } from \"./treeNodeKernel.js\";\n\n// This file contains various maps and helpers for supporting proxy binding (a.k.a. proxy hydration).\n// See ./ProxyBinding.md for a high-level overview of the process.\n\n/**\n * An anchor slot which associates an anchor with its corresponding node proxy, if there is one.\n */\nconst proxySlot = anchorSlot<TreeNode>();\n\n// The following records are maintained as WeakMaps, rather than a private symbol (e.g. like `targetSymbol`) on the node proxy itself.\n// The map behaves essentially the same, except that performing a lookup in the map will not perform a property read/get on the key object (as is the case with a symbol).\n// Since `SharedTreeNodes` are proxies with non-trivial `get` traps, this choice is meant to prevent the confusion of the lookup passing through multiple objects\n// via the trap, or the trap not properly handling the special symbol, etc.\n\n/** A reverse mapping of {@link proxySlot} that is updated at the same time. */\nconst proxyToAnchorNode = new WeakMap<TreeNode, AnchorNode>();\n\n// Map unhydrated nodes to and from their underlying flex tree implementation.\n// These maps are populated after a user calls `const proxy = new Foo({})` but before `proxy` is inserted into the tree and queried.\nconst proxyToMapTreeNode = new WeakMap<TreeNode, MapTreeNode>();\nconst mapTreeNodeToProxy = new WeakMap<MapTreeNode, TreeNode>();\n/** Used by `anchorProxy` as an optimization to ensure that only one anchor is remembered at a time for a given anchor node */\nconst anchorForgetters = new WeakMap<TreeNode, () => void>();\n\n/**\n * Creates an anchor node and associates it with the given proxy.\n * @privateRemarks Use `forgetters` to cleanup the anchor allocated by this function once the anchor is no longer needed.\n * In practice, this happens when either the anchor node is destroyed, or another anchor to the same node is created by a new flex node.\n */\nexport function anchorProxy(anchors: AnchorSet, path: UpPath, proxy: TreeNode): AnchorNode {\n\tassert(!anchorForgetters.has(proxy), 0x91c /* Proxy anchor should not be set twice */);\n\tconst anchor = anchors.track(path);\n\tconst anchorNode = anchors.locate(anchor) ?? fail(\"Expected anchor node to be present\");\n\tbindProxyToAnchorNode(proxy, anchorNode);\n\tconst forget = (): void => {\n\t\tif (anchors.locate(anchor)) {\n\t\t\tanchors.forget(anchor);\n\t\t}\n\t\tanchorForgetters.delete(proxy);\n\t\toff();\n\t};\n\tanchorForgetters.set(proxy, forget);\n\tconst off = anchorNode.on(\"afterDestroy\", forget);\n\treturn anchorNode;\n}\n\n/**\n * Retrieves the flex node associated with the given target via {@link setFlexNode}.\n * @remarks Fails if the flex node has not been set.\n */\nexport function getFlexNode(\n\tproxy: TypedNode<FlexObjectNodeSchema>,\n\tallowFreed?: true,\n): FlexTreeObjectNode;\nexport function getFlexNode(proxy: TreeArrayNode, allowFreed?: true): FlexTreeNode;\nexport function getFlexNode(\n\tproxy: TreeMapNode,\n\tallowFreed?: true,\n): FlexTreeMapNode<FlexMapNodeSchema<string, FlexFieldSchema<typeof FieldKinds.optional>>>;\nexport function getFlexNode(proxy: TreeNode, allowFreed?: true): FlexTreeNode;\nexport function getFlexNode(proxy: TreeNode, allowFreed = false): FlexTreeNode {\n\tconst anchorNode = proxyToAnchorNode.get(proxy);\n\tif (anchorNode !== undefined) {\n\t\t// The proxy is bound to an anchor node, but it may or may not have an actual flex node yet\n\t\tconst flexNode = anchorNode.slots.get(flexTreeSlot);\n\t\tif (flexNode !== undefined) {\n\t\t\treturn flexNode; // If it does have a flex node, return it...\n\t\t} // ...otherwise, the flex node must be created\n\t\tconst context = anchorNode.anchorSet.slots.get(ContextSlot) ?? fail(\"missing context\");\n\t\tconst cursor = context.checkout.forest.allocateCursor(\"getFlexNode\");\n\t\tcontext.checkout.forest.moveCursorToPath(anchorNode, cursor);\n\t\tconst newFlexNode = makeTree(context, cursor);\n\t\tcursor.free();\n\t\t// Calling this is a performance improvement, however, do this only after demand to avoid momentarily having no anchors to anchorNode\n\t\tanchorForgetters?.get(proxy)?.();\n\t\tif (!allowFreed) {\n\t\t\tassertFlexTreeEntityNotFreed(newFlexNode);\n\t\t}\n\t\treturn newFlexNode;\n\t}\n\n\treturn proxyToMapTreeNode.get(proxy) ?? fail(\"Expected raw tree node for proxy\");\n}\n\n/**\n * Retrieves the flex node associated with the given target via {@link setFlexNode}, if any.\n */\nexport function tryGetFlexNode(target: unknown): FlexTreeNode | undefined {\n\t// Calling 'WeakMap.get()' with primitives (numbers, strings, etc.) will return undefined.\n\t// This is in contrast to 'WeakMap.set()', which will throw a TypeError if given a non-object key.\n\treturn (\n\t\tproxyToAnchorNode.get(target as TreeNode)?.slots.get(flexTreeSlot) ??\n\t\tproxyToMapTreeNode.get(target as TreeNode)\n\t);\n}\n\n/**\n * Retrieves the proxy associated with the given flex node via {@link setFlexNode}, if any.\n */\nexport function tryGetProxy(flexNode: FlexTreeNode): TreeNode | undefined {\n\tif (isMapTreeNode(flexNode)) {\n\t\treturn mapTreeNodeToProxy.get(flexNode);\n\t}\n\treturn flexNode.anchorNode.slots.get(proxySlot);\n}\n\n/**\n * Associate the given proxy and the given flex node.\n * @returns The proxy\n * @remarks\n * This creates a 1:1 mapping between the proxy and tree node.\n * Either can be retrieved from the other via {@link getFlexNode}/{@link tryGetFlexNode} or {@link tryGetProxy}.\n * If the given proxy is already mapped to an flex node, the existing mapping will be overwritten.\n * If the given flex node is already mapped to a different proxy, this function will fail.\n */\nexport function setFlexNode<TProxy extends TreeNode>(\n\tproxy: TProxy,\n\tflexNode: FlexTreeNode,\n): TProxy {\n\tconst existingFlexNode = proxyToAnchorNode.get(proxy)?.slots.get(flexTreeSlot);\n\tassert(\n\t\texistingFlexNode === undefined,\n\t\t0x91d /* Cannot associate a flex node with multiple targets */,\n\t);\n\tif (isMapTreeNode(flexNode)) {\n\t\tproxyToMapTreeNode.set(proxy, flexNode);\n\t\tmapTreeNodeToProxy.set(flexNode, proxy);\n\t} else {\n\t\tassert(\n\t\t\ttryGetProxy(flexNode) === undefined,\n\t\t\t0x7f5 /* Cannot associate an flex node with multiple targets */,\n\t\t);\n\t\tbindProxyToAnchorNode(proxy, flexNode.anchorNode);\n\t}\n\treturn proxy;\n}\n\n/**\n * Bi-directionally associates the given proxy to the given anchor node.\n * @remarks Cleans up mappings to raw flex nodes - it is assumed that they are no longer needed once the proxy has an anchor node.\n */\nfunction bindProxyToAnchorNode(proxy: TreeNode, anchorNode: AnchorNode): void {\n\t// If the proxy currently has a raw node, forget it\n\tconst mapTreeNode = proxyToMapTreeNode.get(proxy);\n\tif (mapTreeNode !== undefined) {\n\t\tproxyToMapTreeNode.delete(proxy);\n\t\tmapTreeNodeToProxy.delete(mapTreeNode);\n\t}\n\t// Once a proxy has been associated with an anchor node, it should never change to another anchor node\n\tassert(\n\t\t!proxyToAnchorNode.has(proxy),\n\t\t0x91e /* Proxy has already been bound to a different anchor node */,\n\t);\n\tproxyToAnchorNode.set(proxy, anchorNode);\n\t// However, it's fine for an anchor node to rotate through different proxies when the content at that place in the tree is replaced.\n\tanchorNode.slots.set(proxySlot, proxy);\n\tgetKernel(proxy).hydrate(anchorNode);\n}\n\n/**\n * Given a node's schema, return the corresponding object in the proxy-based API.\n */\ntype TypedNode<TSchema extends FlexTreeNodeSchema> = TreeNode & WithType<TSchema[\"name\"]>;\n\nexport function createKernel(node: TreeNode): void {\n\ttreeNodeToKernel.set(node, new TreeNodeKernel(node));\n}\n\nexport function getKernel(node: TreeNode): TreeNodeKernel {\n\tconst kernel = treeNodeToKernel.get(node);\n\tassert(kernel !== undefined, 0x9b1 /* Expected tree node to have kernel */);\n\treturn kernel;\n}\n\nexport function tryDisposeTreeNode(anchorNode: AnchorNode): void {\n\tconst treeNode = anchorNode.slots.get(proxySlot);\n\tif (treeNode !== undefined) {\n\t\tconst kernel = treeNodeToKernel.get(treeNode);\n\t\tassert(kernel !== undefined, 0x9b2 /* Expected tree node to have kernel */);\n\t\tkernel.dispose();\n\t}\n}\n\nconst treeNodeToKernel = new WeakMap<TreeNode, TreeNodeKernel>();\n"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oI;IACpI,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACtC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC;AAOD,MAAM,UAAU,kBAAkB,CAAC,UAAsB;IACxD,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;QACnC,MAAM,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { type AnchorNode, type AnchorSet, type UpPath, anchorSlot } from \"../core/index.js\";\nimport {\n\tContextSlot,\n\ttype FlexTreeNodeSchema,\n\ttype FlexMapNodeSchema,\n\ttype FlexObjectNodeSchema,\n\ttype FlexTreeMapNode,\n\ttype FlexTreeNode,\n\ttype FlexTreeObjectNode,\n\tassertFlexTreeEntityNotFreed,\n\tflexTreeSlot,\n\ttype FieldKinds,\n\ttype FlexFieldSchema,\n\ttype MapTreeNode,\n\tisMapTreeNode,\n} from \"../feature-libraries/index.js\";\nimport { fail } from \"../util/index.js\";\nimport type { WithType, TreeNode } from \"./core/index.js\";\nimport type { TreeArrayNode } from \"./arrayNode.js\";\n// TODO: decide how to deal with dependencies on flex-tree implementation.\n// eslint-disable-next-line import/no-internal-modules\nimport { makeTree } from \"../feature-libraries/flex-tree/lazyNode.js\";\nimport type { TreeMapNode } from \"./mapNode.js\";\nimport { getKernel } from \"./core/index.js\";\n\n// This file contains various maps and helpers for supporting associating simple TreeNodes with their InnerNodes, and swapping those InnerNodes as part of hydration.\n// See ./ProxyBinding.md for a high-level overview of the process.\n\n/**\n * An anchor slot which associates an anchor with its corresponding TreeNode, if there is one.\n * @remarks\n * For this to work, we have to require that there is at most a single view using a given AnchorSet.\n * FlexTree already has this assumption, and we also assume there is a single simple-tree per FlexTree, so this is valid.\n */\nconst proxySlot = anchorSlot<TreeNode>();\n\n// The following records are maintained as WeakMaps, rather than a private symbol (e.g. like `targetSymbol`) on the TreeNode.\n// The map behaves essentially the same, except that performing a lookup in the map will not perform a property read/get on the key object (as is the case with a symbol).\n// Since `SharedTreeNodes` are proxies with non-trivial `get` traps, this choice is meant to prevent the confusion of the lookup passing through multiple objects\n// via the trap, or the trap not properly handling the special symbol, etc.\n\n/**\n * A reverse mapping of {@link proxySlot} that is updated at the same time.\n *\n * @remarks\n * Nodes in this map are hydrated (and thus \"marinated\" or \"cooked\").\n * Nodes not in this map are known to be {@link Unhydrated}.\n * Thus this map can be used to check if a node is hydrated.\n *\n * Any node not in this map must be in {@link proxyToMapTreeNode} since it contains all unhydrated nodes.\n * It also contains \"marinated\" nodes which are in both.\n */\nconst proxyToAnchorNode = new WeakMap<TreeNode, AnchorNode>();\n\n/**\n * Map {@link Unhydrated} nodes and \"marinated\" nodes to and from their underlying MapTreeNode.\n * These maps are populated by the TreeNode's constructor when called by a user before the node is inserted into the tree and queried.\n */\nconst proxyToMapTreeNode = new WeakMap<TreeNode, MapTreeNode>();\n\n/**\n * {@inheritdoc proxyToMapTreeNode}\n */\nconst mapTreeNodeToProxy = new WeakMap<MapTreeNode, TreeNode>();\n\n/**\n * Used by {@link anchorProxy} as an optimization to ensure that only one anchor is remembered at a time for a given anchor node\n */\nconst anchorForgetters = new WeakMap<TreeNode, () => void>();\n\n/**\n * Creates an anchor node and associates it with the given proxy.\n * @privateRemarks\n * Use `forgetters` to cleanup the anchor allocated by this function once the anchor is no longer needed.\n * In practice, this happens when either the anchor node is destroyed, or another anchor to the same node is created by a new flex node.\n *\n * The FlexTreeNode holds a reference to the same anchor, and has a lifetime at least as long as the simple-tree,\n * so this would be unnecessary except for the case of \"marinated\" nodes, which have an anchor,\n * but might not have a FlexTreeNode.\n * Handling this case is an optimization assuming that this extra anchor reference is cheaper than eagerly creating FlexTreeNodes.\n */\nexport function anchorProxy(anchors: AnchorSet, path: UpPath, proxy: TreeNode): AnchorNode {\n\tassert(!anchorForgetters.has(proxy), 0x91c /* Proxy anchor should not be set twice */);\n\tconst anchor = anchors.track(path);\n\tconst anchorNode = anchors.locate(anchor) ?? fail(\"Expected anchor node to be present\");\n\tbindHydratedNodeToAnchor(proxy, anchorNode);\n\tconst forget = (): void => {\n\t\tif (anchors.locate(anchor)) {\n\t\t\tanchors.forget(anchor);\n\t\t}\n\t\tanchorForgetters.delete(proxy);\n\t\toff();\n\t};\n\tanchorForgetters.set(proxy, forget);\n\tconst off = anchorNode.on(\"afterDestroy\", forget);\n\treturn anchorNode;\n}\n\n/**\n * Retrieves the flex node associated with the given target via {@link setInnerNode}.\n * @remarks\n * For {@link Unhydrated} nodes, this returns the MapTreeNode.\n *\n * For hydrated nodes it returns a FlexTreeNode backed by the forest.\n * Note that for \"marinated\" nodes, this FlexTreeNode exists and returns it: it does not return the MapTreeNode which is the current InnerNode.\n */\nexport function getOrCreateInnerNode(\n\ttreeNode: TypedNode<FlexObjectNodeSchema>,\n\tallowFreed?: true,\n): InnerNode & FlexTreeObjectNode;\nexport function getOrCreateInnerNode(treeNode: TreeArrayNode, allowFreed?: true): InnerNode;\nexport function getOrCreateInnerNode(\n\ttreeNode: TreeMapNode,\n\tallowFreed?: true,\n): InnerNode &\n\tFlexTreeMapNode<FlexMapNodeSchema<string, FlexFieldSchema<typeof FieldKinds.optional>>>;\nexport function getOrCreateInnerNode(treeNode: TreeNode, allowFreed?: true): InnerNode;\nexport function getOrCreateInnerNode(treeNode: TreeNode, allowFreed = false): InnerNode {\n\tconst anchorNode = proxyToAnchorNode.get(treeNode);\n\tif (anchorNode !== undefined) {\n\t\t// The proxy is bound to an anchor node, but it may or may not have an actual flex node yet\n\t\tconst flexNode = anchorNode.slots.get(flexTreeSlot);\n\t\tif (flexNode !== undefined) {\n\t\t\treturn flexNode; // If it does have a flex node, return it...\n\t\t} // ...otherwise, the flex node must be created\n\t\tconst context = anchorNode.anchorSet.slots.get(ContextSlot) ?? fail(\"missing context\");\n\t\tconst cursor = context.checkout.forest.allocateCursor(\"getFlexNode\");\n\t\tcontext.checkout.forest.moveCursorToPath(anchorNode, cursor);\n\t\tconst newFlexNode = makeTree(context, cursor);\n\t\tcursor.free();\n\t\t// Calling this is a performance improvement, however, do this only after demand to avoid momentarily having no anchors to anchorNode\n\t\tanchorForgetters?.get(treeNode)?.();\n\t\tif (!allowFreed) {\n\t\t\tassertFlexTreeEntityNotFreed(newFlexNode);\n\t\t}\n\t\treturn newFlexNode;\n\t}\n\n\t// Unhydrated case\n\treturn proxyToMapTreeNode.get(treeNode) ?? fail(\"Expected raw tree node for proxy\");\n}\n\n/**\n * For \"cooked\" nodes this is a FlexTreeNode thats a projection of forest content.\n * For {@link Unhydrated} nodes this is a MapTreeNode.\n * For \"marinated\" nodes, some code (ex: getOrCreateInnerNode) returns the FlexTreeNode thats a projection of forest content, and some code (ex: tryGetInnerNode) returns undefined.\n *\n * @remarks\n * Currently MapTreeNode extends FlexTreeNode, and most code which can work with either just uses FlexTreeNode.\n * TODO: Code should be migrating toward using this type to distinguish to two use-cases.\n *\n * TODO: The inconsistent handling of \"marinated\" cases should be cleaned up.\n * Maybe getOrCreateInnerNode should cook marinated nodes so they have a proper InnerNode?\n */\nexport type InnerNode = FlexTreeNode | MapTreeNode;\n\n/**\n * Retrieves the InnerNode associated with the given target via {@link setInnerNode}, if any.\n * @remarks\n * If `target` is a unhydrated node, returns its MapTreeNode.\n * If `target` is a cooked node (or marinated but a FlexTreeNode exists) returns the FlexTreeNode.\n * If the target is not a node, or a marinated node with no FlexTreeNode for its anchor, returns undefined.\n */\nexport function tryGetInnerNode(target: unknown): InnerNode | undefined {\n\t// Calling 'WeakMap.get()' with primitives (numbers, strings, etc.) will return undefined.\n\t// This is in contrast to 'WeakMap.set()', which will throw a TypeError if given a non-object key.\n\tconst anchorNode = proxyToAnchorNode.get(target as TreeNode);\n\t// Hydrated node case\n\tif (anchorNode !== undefined) {\n\t\tconst flex = anchorNode.slots.get(flexTreeSlot);\n\t\tif (flex !== undefined) {\n\t\t\t// Cooked, or possible Marinated but something else cased the flex tree node to exist.\n\t\t\treturn flex;\n\t\t}\n\t\t// Marinated case\n\t\tassert(\n\t\t\tproxyToMapTreeNode.get(target as TreeNode) === undefined,\n\t\t\t0xa05 /* marinated nodes should not have MapTreeNodes */,\n\t\t);\n\t\treturn undefined;\n\t}\n\t// Unhydrated node or not a node case:\n\treturn proxyToMapTreeNode.get(target as TreeNode);\n}\n\n/**\n * Retrieves the proxy associated with the given flex node via {@link setInnerNode}, if any.\n */\nexport function tryGetCachedTreeNode(flexNode: InnerNode): TreeNode | undefined {\n\tif (isMapTreeNode(flexNode)) {\n\t\t// Unhydrated case\n\t\treturn mapTreeNodeToProxy.get(flexNode);\n\t}\n\t// Hydrated case\n\treturn flexNode.anchorNode.slots.get(proxySlot);\n}\n\n/**\n * Associate the given TreeNode and the given flex node.\n * @returns The node.\n * @remarks\n * This creates a 1:1 mapping between the tree node and InnerNode.\n * Either can be retrieved from the other via {@link getOrCreateInnerNode}/{@link tryGetInnerNode} or {@link tryGetCachedTreeNode}.\n * If the given proxy is already mapped to an flex node, the existing mapping will be overwritten.\n * If the given flex node is already mapped to a different proxy, this function will fail.\n */\nexport function setInnerNode<TNode extends TreeNode>(\n\tnode: TNode,\n\tinnerNode: InnerNode,\n): TNode {\n\tconst existingFlexNode = proxyToAnchorNode.get(node)?.slots.get(flexTreeSlot);\n\tassert(\n\t\texistingFlexNode === undefined,\n\t\t0x91d /* Cannot associate a flex node with multiple targets */,\n\t);\n\tif (isMapTreeNode(innerNode)) {\n\t\t// Unhydrated case\n\t\tproxyToMapTreeNode.set(node, innerNode);\n\t\tmapTreeNodeToProxy.set(innerNode, node);\n\t} else {\n\t\t// Hydrated case\n\t\tassert(\n\t\t\ttryGetCachedTreeNode(innerNode) === undefined,\n\t\t\t0x7f5 /* Cannot associate an flex node with multiple targets */,\n\t\t);\n\t\tbindHydratedNodeToAnchor(node, innerNode.anchorNode);\n\t}\n\treturn node;\n}\n\n/**\n * Bi-directionally associates the given hydrated TreeNode to the given anchor node.\n * @remarks Cleans up mappings to {@link MapTreeNode} - it is assumed that they are no longer needed once the proxy has an anchor node.\n */\nfunction bindHydratedNodeToAnchor(node: TreeNode, anchorNode: AnchorNode): void {\n\t// If the proxy currently has a raw node, forget it\n\tconst mapTreeNode = proxyToMapTreeNode.get(node);\n\tif (mapTreeNode !== undefined) {\n\t\tproxyToMapTreeNode.delete(node);\n\t\tmapTreeNodeToProxy.delete(mapTreeNode);\n\t}\n\t// Once a proxy has been associated with an anchor node, it should never change to another anchor node\n\tassert(\n\t\t!proxyToAnchorNode.has(node),\n\t\t0x91e /* Proxy has already been bound to a different anchor node */,\n\t);\n\tproxyToAnchorNode.set(node, anchorNode);\n\t// However, it's fine for an anchor node to rotate through different proxies when the content at that place in the tree is replaced.\n\tanchorNode.slots.set(proxySlot, node);\n\tgetKernel(node).hydrate(anchorNode);\n}\n\n/**\n * Given a node's schema, return the corresponding object in the proxy-based API.\n */\ntype TypedNode<TSchema extends FlexTreeNodeSchema> = TreeNode & WithType<TSchema[\"name\"]>;\n\nexport function tryDisposeTreeNode(anchorNode: AnchorNode): void {\n\tconst treeNode = anchorNode.slots.get(proxySlot);\n\tif (treeNode !== undefined) {\n\t\tconst kernel = getKernel(treeNode);\n\t\tkernel.dispose();\n\t}\n}\n"]}
|
|
@@ -5,116 +5,13 @@
|
|
|
5
5
|
import type { ErasedType, IFluidHandle } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { type LazyItem, type NodeKeyManager, type FlexListToUnion } from "../feature-libraries/index.js";
|
|
7
7
|
import { type MakeNominal } from "../util/index.js";
|
|
8
|
-
import type {
|
|
8
|
+
import type { Unhydrated, NodeKind, TreeNodeSchema, TreeNodeSchemaClass } from "./core/index.js";
|
|
9
9
|
import type { FieldKey } from "../core/index.js";
|
|
10
10
|
import type { InsertableContent } from "./proxies.js";
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @typeParam Name - The full (including scope) name/identifier for the schema.
|
|
14
|
-
* @typeParam Kind - Which kind of node this schema is for.
|
|
15
|
-
* @typeParam TNode - API for nodes that use this schema.
|
|
16
|
-
* @typeParam TBuild - Data which can be used to construct an {@link Unhydrated} node of this type.
|
|
17
|
-
* @typeParam Info - Data used when defining this schema.
|
|
18
|
-
* @remarks
|
|
19
|
-
* Captures the schema both as runtime data and compile time type information.
|
|
20
|
-
* @sealed @public
|
|
21
|
-
*/
|
|
22
|
-
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode = unknown, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown> = TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
23
|
-
/**
|
|
24
|
-
* Schema which is not a class.
|
|
25
|
-
* @remarks
|
|
26
|
-
* This is used for schema which cannot have their instances constructed using constructors, like leaf schema.
|
|
27
|
-
* @privateRemarks
|
|
28
|
-
* Non-class based schema can have issues with recursive types due to https://github.com/microsoft/TypeScript/issues/55832.
|
|
29
|
-
* @sealed @public
|
|
30
|
-
*/
|
|
31
|
-
export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
32
|
-
create(data: TInsertable): TNode;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Tree node schema which is implemented using a class.
|
|
36
|
-
* @remarks
|
|
37
|
-
* Instances of this class are nodes in the tree.
|
|
38
|
-
* This is also a constructor so that it can be subclassed.
|
|
39
|
-
*
|
|
40
|
-
* Using classes in this way allows introducing a named type and a named value at the same time, helping keep the runtime and compile time information together and easy to refer to un a uniform way.
|
|
41
|
-
* Additionally, this works around https://github.com/microsoft/TypeScript/issues/55832 which causes similar patterns with less explicit types to infer "any" in the d.ts file.
|
|
42
|
-
*
|
|
43
|
-
* When sub-classing a a `TreeNodeSchemaClass`, some extra rules must be followed:
|
|
44
|
-
*
|
|
45
|
-
* - Only ever use a single class from the schema's class hierarchy within a document and its schema.
|
|
46
|
-
* For example, if using {@link SchemaFactory.object} you can do:
|
|
47
|
-
* ```typescript
|
|
48
|
-
* // Recommended "customizable" object schema pattern.
|
|
49
|
-
* class Good extends schemaFactory.object("A", {
|
|
50
|
-
* exampleField: schemaFactory.number,
|
|
51
|
-
* }) {
|
|
52
|
-
* public exampleCustomMethod(): void {
|
|
53
|
-
* this.exampleField++;
|
|
54
|
-
* }
|
|
55
|
-
* }
|
|
56
|
-
* ```
|
|
57
|
-
* But should avoid:
|
|
58
|
-
* ```typescript
|
|
59
|
-
* // This by itself is ok, and opts into "POJO mode".
|
|
60
|
-
* const base = schemaFactory.object("A", {});
|
|
61
|
-
* // This is a bad pattern since it leaves two classes in scope which derive from the same SchemaFactory defined class.
|
|
62
|
-
* // If both get used, its an error!
|
|
63
|
-
* class Invalid extends base {}
|
|
64
|
-
* ```
|
|
65
|
-
* - Do not modify the constructor input parameter types or values:
|
|
66
|
-
* ```typescript
|
|
67
|
-
* class Invalid extends schemaFactory.object("A", {
|
|
68
|
-
* exampleField: schemaFactory.number,
|
|
69
|
-
* }) {
|
|
70
|
-
* // This Modifies the type of the constructor input.
|
|
71
|
-
* // This is unsupported due to programmatic access to the constructor being used internally.
|
|
72
|
-
* public constructor(a: number) {
|
|
73
|
-
* super({ exampleField: a });
|
|
74
|
-
* }
|
|
75
|
-
* }
|
|
76
|
-
* ```
|
|
77
|
-
* @sealed @public
|
|
78
|
-
*/
|
|
79
|
-
export interface TreeNodeSchemaClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
80
|
-
/**
|
|
81
|
-
* Constructs an {@link Unhydrated} node with this schema.
|
|
82
|
-
* @remarks
|
|
83
|
-
* This constructor is also used internally to construct hydrated nodes with a different parameter type.
|
|
84
|
-
* Therefore, overriding this constructor with different argument types is not type-safe and is not supported.
|
|
85
|
-
* @sealed
|
|
86
|
-
*/
|
|
87
|
-
new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Data common to all tree node schema.
|
|
91
|
-
* @remarks
|
|
92
|
-
* Implementation detail of {@link TreeNodeSchema} which should be accessed instead of referring to this type directly.
|
|
93
|
-
* @sealed @public
|
|
12
|
+
* Returns true if the given schema is a {@link TreeNodeSchemaClass}, or otherwise false if it is a {@link TreeNodeSchemaNonClass}.
|
|
94
13
|
*/
|
|
95
|
-
export
|
|
96
|
-
readonly identifier: Name;
|
|
97
|
-
readonly kind: Kind;
|
|
98
|
-
/**
|
|
99
|
-
* Data used to define this schema.
|
|
100
|
-
*
|
|
101
|
-
* @remarks
|
|
102
|
-
* The format depends on the kind of node it is for.
|
|
103
|
-
* For example, the "object" node kind could store the field schema here.
|
|
104
|
-
*/
|
|
105
|
-
readonly info: Info;
|
|
106
|
-
/**
|
|
107
|
-
* When constructing insertable content,
|
|
108
|
-
* data that could be passed to the node's constructor can be used instead of an {@link Unhydrated} node
|
|
109
|
-
* iff implicitlyConstructable is true.
|
|
110
|
-
* @privateRemarks
|
|
111
|
-
* Currently the logic for traversing insertable content,
|
|
112
|
-
* both to build trees and to hydrate them does not defer to the schema classes to handle the policy,
|
|
113
|
-
* so if their constructors differ from what is supported, some cases will not work.
|
|
114
|
-
* Setting this to false adjusts the insertable types to disallow cases which could be impacted by these inconsistencies.
|
|
115
|
-
*/
|
|
116
|
-
readonly implicitlyConstructable: ImplicitlyConstructable;
|
|
117
|
-
}
|
|
14
|
+
export declare function isTreeNodeSchemaClass<Name extends string, Kind extends NodeKind, TNode, TBuild, ImplicitlyConstructable extends boolean, Info>(schema: TreeNodeSchema<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>): schema is TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
118
15
|
/**
|
|
119
16
|
* Types for use in fields.
|
|
120
17
|
* @remarks
|
|
@@ -149,32 +46,6 @@ export declare enum FieldKind {
|
|
|
149
46
|
*/
|
|
150
47
|
Identifier = 2
|
|
151
48
|
}
|
|
152
|
-
/**
|
|
153
|
-
* Kind of tree node.
|
|
154
|
-
* @remarks
|
|
155
|
-
* More kinds may be added over time, so do not assume this is an exhaustive set.
|
|
156
|
-
* @public
|
|
157
|
-
*/
|
|
158
|
-
export declare enum NodeKind {
|
|
159
|
-
/**
|
|
160
|
-
* A node which serves as a map, storing children under string keys.
|
|
161
|
-
*/
|
|
162
|
-
Map = 0,
|
|
163
|
-
/**
|
|
164
|
-
* A node which serves as an array, storing children in an ordered sequence.
|
|
165
|
-
*/
|
|
166
|
-
Array = 1,
|
|
167
|
-
/**
|
|
168
|
-
* A node which stores a heterogenous collection of children in named fields.
|
|
169
|
-
* @remarks
|
|
170
|
-
* Each field gets its own schema.
|
|
171
|
-
*/
|
|
172
|
-
Object = 2,
|
|
173
|
-
/**
|
|
174
|
-
* A node which stores a single leaf value.
|
|
175
|
-
*/
|
|
176
|
-
Leaf = 3
|
|
177
|
-
}
|
|
178
49
|
/**
|
|
179
50
|
* Maps from a view key to its corresponding {@link FieldProps.key | stored key} for the provided
|
|
180
51
|
* {@link ImplicitFieldSchema | field schema}.
|
|
@@ -312,13 +183,17 @@ export declare class FieldSchema<out Kind extends FieldKind = FieldKind, out Typ
|
|
|
312
183
|
* This class is used with instanceof, and therefore should have nominal typing.
|
|
313
184
|
* This field enforces that.
|
|
314
185
|
*/
|
|
315
|
-
protected _typeCheck
|
|
186
|
+
protected _typeCheck: MakeNominal;
|
|
316
187
|
private readonly lazyTypes;
|
|
317
188
|
/**
|
|
318
189
|
* What types of tree nodes are allowed in this field.
|
|
319
190
|
* @remarks Counterpart to {@link FieldSchema.allowedTypes}, with any lazy definitions evaluated.
|
|
320
191
|
*/
|
|
321
192
|
get allowedTypeSet(): ReadonlySet<TreeNodeSchema>;
|
|
193
|
+
/**
|
|
194
|
+
* True if and only if, when constructing a node with this field, a value must be provided for it.
|
|
195
|
+
*/
|
|
196
|
+
readonly requiresValue: boolean;
|
|
322
197
|
private constructor();
|
|
323
198
|
}
|
|
324
199
|
/**
|
|
@@ -402,33 +277,9 @@ export type InsertableTypedNode<T extends TreeNodeSchema> = (T extends {
|
|
|
402
277
|
export type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
|
|
403
278
|
/**
|
|
404
279
|
* Value that may be stored as a leaf node.
|
|
405
|
-
* @public
|
|
406
|
-
*/
|
|
407
|
-
export type TreeLeafValue = number | string | boolean | IFluidHandle | null;
|
|
408
|
-
/**
|
|
409
|
-
* The type of a {@link TreeNode}.
|
|
410
|
-
* For more information about the type, use `Tree.schema(theNode)` instead.
|
|
411
280
|
* @remarks
|
|
412
|
-
*
|
|
413
|
-
* `Tree.is` and `Tree.schema` provide a superset of this information in more friendly ways.
|
|
414
|
-
*
|
|
415
|
-
* This symbol should not manually be added to objects as doing so allows the object to be invalidly used where nodes are expected.
|
|
416
|
-
* Instead construct a real node of the desired type using its constructor.
|
|
417
|
-
* @privateRemarks
|
|
418
|
-
* This prevents non-nodes from being accidentally used as nodes, as well as allows the type checker to distinguish different node types.
|
|
281
|
+
* Some limitations apply, see the documentation for {@link SchemaFactory.number} and {@link SchemaFactory.string} for those restrictions.
|
|
419
282
|
* @public
|
|
420
283
|
*/
|
|
421
|
-
export
|
|
422
|
-
/**
|
|
423
|
-
* Adds a type symbol to a type for stronger typing.
|
|
424
|
-
* @remarks
|
|
425
|
-
* An implementation detail of {@link TreeNode}'s strong typing setup: not intended for direct use outside of this package.
|
|
426
|
-
* @sealed @public
|
|
427
|
-
*/
|
|
428
|
-
export interface WithType<TName extends string = string> {
|
|
429
|
-
/**
|
|
430
|
-
* Type symbol, marking a type in a way to increase type safety via strong type checking.
|
|
431
|
-
*/
|
|
432
|
-
get [typeNameSymbol](): TName;
|
|
433
|
-
}
|
|
284
|
+
export type TreeLeafValue = number | string | boolean | IFluidHandle | null;
|
|
434
285
|
//# sourceMappingURL=schemaTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaTypes.d.ts","sourceRoot":"","sources":["../../src/simple-tree/schemaTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIhF,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,cAAc,EAEnB,KAAK,eAAe,EACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"schemaTypes.d.ts","sourceRoot":"","sources":["../../src/simple-tree/schemaTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIhF,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,cAAc,EAEnB,KAAK,eAAe,EACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,WAAW,EAA0B,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,EACX,UAAU,EACV,QAAQ,EACR,cAAc,EACd,mBAAmB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,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3C,OAAO,SAAS,oBAAoB,GAAG,cAAc,IAClD,OAAO,SAAS,cAAc,GAC/B,cAAc,CAAC,OAAO,CAAC,GACvB,OAAO,SAAS,YAAY,GAC3B,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GACxC,OAAO,CAAC;AAEZ;;;GAGG;AACH,MAAM,MAAM,0CAA0C,CACrD,OAAO,SAAS,oBAAoB,GAAG,cAAc,IAClD,OAAO,SAAS,cAAc,GAC/B,mBAAmB,CAAC,OAAO,CAAC,GAC5B,OAAO,SAAS,YAAY,GAC3B,mBAAmB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GAC7C,KAAK,CAAC;AAEV;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,cAAc,IAAI,CAAC,SAAS,cAAc,CAC9E,MAAM,EACN,QAAQ,EACR,MAAM,KAAK,CACX,GACE,KAAK,GACL,KAAK,CAAC;AAET;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,cAAc,IACrD,CAAC,CAAC,SAAS;IAAE,uBAAuB,EAAE,IAAI,CAAA;CAAE,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAC1E,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,cAAc,IAAI,CAAC,SAAS,cAAc,CAC/E,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,MAAM,CACZ,GACE,MAAM,GACN,KAAK,CAAC;AAET;;;;;GAKG;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,YAAY,GAAG,IAAI,CAAC"}
|
|
@@ -6,6 +6,12 @@ import { Lazy } from "@fluidframework/core-utils/internal";
|
|
|
6
6
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
7
7
|
import { isLazy, } from "../feature-libraries/index.js";
|
|
8
8
|
import { brand, isReadonlyArray } from "../util/index.js";
|
|
9
|
+
/**
|
|
10
|
+
* Returns true if the given schema is a {@link TreeNodeSchemaClass}, or otherwise false if it is a {@link TreeNodeSchemaNonClass}.
|
|
11
|
+
*/
|
|
12
|
+
export function isTreeNodeSchemaClass(schema) {
|
|
13
|
+
return schema.constructor !== undefined;
|
|
14
|
+
}
|
|
9
15
|
/**
|
|
10
16
|
* Kind of a field on a node.
|
|
11
17
|
* @remarks
|
|
@@ -33,33 +39,6 @@ export var FieldKind;
|
|
|
33
39
|
*/
|
|
34
40
|
FieldKind[FieldKind["Identifier"] = 2] = "Identifier";
|
|
35
41
|
})(FieldKind || (FieldKind = {}));
|
|
36
|
-
/**
|
|
37
|
-
* Kind of tree node.
|
|
38
|
-
* @remarks
|
|
39
|
-
* More kinds may be added over time, so do not assume this is an exhaustive set.
|
|
40
|
-
* @public
|
|
41
|
-
*/
|
|
42
|
-
export var NodeKind;
|
|
43
|
-
(function (NodeKind) {
|
|
44
|
-
/**
|
|
45
|
-
* A node which serves as a map, storing children under string keys.
|
|
46
|
-
*/
|
|
47
|
-
NodeKind[NodeKind["Map"] = 0] = "Map";
|
|
48
|
-
/**
|
|
49
|
-
* A node which serves as an array, storing children in an ordered sequence.
|
|
50
|
-
*/
|
|
51
|
-
NodeKind[NodeKind["Array"] = 1] = "Array";
|
|
52
|
-
/**
|
|
53
|
-
* A node which stores a heterogenous collection of children in named fields.
|
|
54
|
-
* @remarks
|
|
55
|
-
* Each field gets its own schema.
|
|
56
|
-
*/
|
|
57
|
-
NodeKind[NodeKind["Object"] = 2] = "Object";
|
|
58
|
-
/**
|
|
59
|
-
* A node which stores a single leaf value.
|
|
60
|
-
*/
|
|
61
|
-
NodeKind[NodeKind["Leaf"] = 3] = "Leaf";
|
|
62
|
-
})(NodeKind || (NodeKind = {}));
|
|
63
42
|
/**
|
|
64
43
|
* Maps from a view key to its corresponding {@link FieldProps.key | stored key} for the provided
|
|
65
44
|
* {@link ImplicitFieldSchema | field schema}.
|
|
@@ -131,6 +110,9 @@ export class FieldSchema {
|
|
|
131
110
|
this.allowedTypes = allowedTypes;
|
|
132
111
|
this.props = props;
|
|
133
112
|
this.lazyTypes = new Lazy(() => normalizeAllowedTypes(this.allowedTypes));
|
|
113
|
+
// TODO: optional fields should (by default) get a default provider that returns undefined, removing the need to special case them here:
|
|
114
|
+
this.requiresValue =
|
|
115
|
+
this.props?.defaultProvider === undefined && this.kind !== FieldKind.Optional;
|
|
134
116
|
}
|
|
135
117
|
}
|
|
136
118
|
(() => {
|
|
@@ -170,18 +152,4 @@ function evaluateLazySchema(value) {
|
|
|
170
152
|
}
|
|
171
153
|
return evaluatedSchema;
|
|
172
154
|
}
|
|
173
|
-
/**
|
|
174
|
-
* The type of a {@link TreeNode}.
|
|
175
|
-
* For more information about the type, use `Tree.schema(theNode)` instead.
|
|
176
|
-
* @remarks
|
|
177
|
-
* This symbol mainly exists on nodes to allow TypeScript to provide more accurate type checking.
|
|
178
|
-
* `Tree.is` and `Tree.schema` provide a superset of this information in more friendly ways.
|
|
179
|
-
*
|
|
180
|
-
* This symbol should not manually be added to objects as doing so allows the object to be invalidly used where nodes are expected.
|
|
181
|
-
* Instead construct a real node of the desired type using its constructor.
|
|
182
|
-
* @privateRemarks
|
|
183
|
-
* This prevents non-nodes from being accidentally used as nodes, as well as allows the type checker to distinguish different node types.
|
|
184
|
-
* @public
|
|
185
|
-
*/
|
|
186
|
-
export const typeNameSymbol = Symbol("TreeNode Type");
|
|
187
155
|
//# sourceMappingURL=schemaTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaTypes.js","sourceRoot":"","sources":["../../src/simple-tree/schemaTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAGN,MAAM,GAEN,MA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eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IACxD,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,IAAI,UAAU,CACnB,iHAAiH,CACjH,CAAC;IACH,CAAC;IACD,OAAO,eAAe,CAAC;AACxB,CAAC;AA0HD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkB,MAAM,CAAC,eAAe,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType, IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { Lazy } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype LazyItem,\n\ttype NodeKeyManager,\n\tisLazy,\n\ttype FlexListToUnion,\n} from \"../feature-libraries/index.js\";\nimport { type MakeNominal, brand, isReadonlyArray } from \"../util/index.js\";\nimport type { InternalTreeNode, Unhydrated } from \"./types.js\";\nimport type { FieldKey } from \"../core/index.js\";\nimport type { InsertableContent } from \"./proxies.js\";\n\n/**\n * Schema for a tree node.\n * @typeParam Name - The full (including scope) name/identifier for the schema.\n * @typeParam Kind - Which kind of node this schema is for.\n * @typeParam TNode - API for nodes that use this schema.\n * @typeParam TBuild - Data which can be used to construct an {@link Unhydrated} node of this type.\n * @typeParam Info - Data used when defining this schema.\n * @remarks\n * Captures the schema both as runtime data and compile time type information.\n * @sealed @public\n */\nexport type TreeNodeSchema<\n\tName extends string = string,\n\tKind extends NodeKind = NodeKind,\n\tTNode = unknown,\n\tTBuild = never,\n\tImplicitlyConstructable extends boolean = boolean,\n\tInfo = unknown,\n> =\n\t| TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>\n\t| TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;\n\n/**\n * Schema which is not a class.\n * @remarks\n * This is used for schema which cannot have their instances constructed using constructors, like leaf schema.\n * @privateRemarks\n * Non-class based schema can have issues with recursive types due to https://github.com/microsoft/TypeScript/issues/55832.\n * @sealed @public\n */\nexport interface TreeNodeSchemaNonClass<\n\tout Name extends string = string,\n\tout Kind extends NodeKind = NodeKind,\n\tout TNode = unknown,\n\tin TInsertable = never,\n\tout ImplicitlyConstructable extends boolean = boolean,\n\tout Info = unknown,\n> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {\n\tcreate(data: TInsertable): TNode;\n}\n\n/**\n * Tree node schema which is implemented using a class.\n * @remarks\n * Instances of this class are nodes in the tree.\n * This is also a constructor so that it can be subclassed.\n *\n * Using classes in this way allows introducing a named type and a named value at the same time, helping keep the runtime and compile time information together and easy to refer to un a uniform way.\n * Additionally, this works around https://github.com/microsoft/TypeScript/issues/55832 which causes similar patterns with less explicit types to infer \"any\" in the d.ts file.\n *\n * When sub-classing a a `TreeNodeSchemaClass`, some extra rules must be followed:\n *\n * - Only ever use a single class from the schema's class hierarchy within a document and its schema.\n * For example, if using {@link SchemaFactory.object} you can do:\n * ```typescript\n * // Recommended \"customizable\" object schema pattern.\n * class Good extends schemaFactory.object(\"A\", {\n * \texampleField: schemaFactory.number,\n * }) {\n * \tpublic exampleCustomMethod(): void {\n * \t\tthis.exampleField++;\n * \t}\n * }\n * ```\n * But should avoid:\n * ```typescript\n * // This by itself is ok, and opts into \"POJO mode\".\n * const base = schemaFactory.object(\"A\", {});\n * // This is a bad pattern since it leaves two classes in scope which derive from the same SchemaFactory defined class.\n * // If both get used, its an error!\n * class Invalid extends base {}\n * ```\n * - Do not modify the constructor input parameter types or values:\n * ```typescript\n * class Invalid extends schemaFactory.object(\"A\", {\n * \texampleField: schemaFactory.number,\n * }) {\n * \t// This Modifies the type of the constructor input.\n * \t// This is unsupported due to programmatic access to the constructor being used internally.\n * \tpublic constructor(a: number) {\n * \t\tsuper({ exampleField: a });\n * \t}\n * }\n * ```\n * @sealed @public\n */\nexport interface TreeNodeSchemaClass<\n\tout Name extends string = string,\n\tout Kind extends NodeKind = NodeKind,\n\tout TNode = unknown,\n\tin TInsertable = never,\n\tout ImplicitlyConstructable extends boolean = boolean,\n\tout Info = unknown,\n> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {\n\t/**\n\t * Constructs an {@link Unhydrated} node with this schema.\n\t * @remarks\n\t * This constructor is also used internally to construct hydrated nodes with a different parameter type.\n\t * Therefore, overriding this constructor with different argument types is not type-safe and is not supported.\n\t * @sealed\n\t */\n\tnew (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;\n}\n\n/**\n * Data common to all tree node schema.\n * @remarks\n * Implementation detail of {@link TreeNodeSchema} which should be accessed instead of referring to this type directly.\n * @sealed @public\n */\nexport interface TreeNodeSchemaCore<\n\tout Name extends string,\n\tout Kind extends NodeKind,\n\tout ImplicitlyConstructable extends boolean,\n\tout Info = unknown,\n> {\n\treadonly identifier: Name;\n\treadonly kind: Kind;\n\n\t/**\n\t * Data used to define this schema.\n\t *\n\t * @remarks\n\t * The format depends on the kind of node it is for.\n\t * For example, the \"object\" node kind could store the field schema here.\n\t */\n\treadonly info: Info;\n\n\t/**\n\t * When constructing insertable content,\n\t * data that could be passed to the node's constructor can be used instead of an {@link Unhydrated} node\n\t * iff implicitlyConstructable is true.\n\t * @privateRemarks\n\t * Currently the logic for traversing insertable content,\n\t * both to build trees and to hydrate them does not defer to the schema classes to handle the policy,\n\t * so if their constructors differ from what is supported, some cases will not work.\n\t * Setting this to false adjusts the insertable types to disallow cases which could be impacted by these inconsistencies.\n\t */\n\treadonly implicitlyConstructable: ImplicitlyConstructable;\n}\n\n/**\n * Types for use in fields.\n * @remarks\n * Type constraint used in schema declaration APIs.\n * Not intended for direct use outside of package.\n * @public\n */\nexport type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];\n\n/**\n * Kind of a field on a node.\n * @remarks\n * More kinds may be added over time, so do not assume this is an exhaustive set.\n * @public\n */\nexport enum FieldKind {\n\t/**\n\t * A field which can be empty or filled.\n\t * @remarks\n\t * Allows 0 or one child.\n\t */\n\tOptional,\n\t/**\n\t * A field which must always be filled.\n\t * @remarks\n\t * Only allows exactly one child.\n\t */\n\tRequired,\n\t/**\n\t * A special field used for node identifiers.\n\t * @remarks\n\t * Only allows exactly one child.\n\t */\n\tIdentifier,\n}\n\n/**\n * Kind of tree node.\n * @remarks\n * More kinds may be added over time, so do not assume this is an exhaustive set.\n * @public\n */\nexport enum NodeKind {\n\t/**\n\t * A node which serves as a map, storing children under string keys.\n\t */\n\tMap,\n\t/**\n\t * A node which serves as an array, storing children in an ordered sequence.\n\t */\n\tArray,\n\t/**\n\t * A node which stores a heterogenous collection of children in named fields.\n\t * @remarks\n\t * Each field gets its own schema.\n\t */\n\tObject,\n\t/**\n\t * A node which stores a single leaf value.\n\t */\n\tLeaf,\n}\n\n/**\n * Maps from a view key to its corresponding {@link FieldProps.key | stored key} for the provided\n * {@link ImplicitFieldSchema | field schema}.\n *\n * @remarks\n * If an explicit stored key was specified in the schema, it will be used.\n * Otherwise, the stored key is the same as the view key.\n */\nexport function getStoredKey(viewKey: string, fieldSchema: ImplicitFieldSchema): FieldKey {\n\treturn brand(getExplicitStoredKey(fieldSchema) ?? viewKey);\n}\n\n/**\n * Gets the {@link FieldProps.key | stored key} specified by the schema, if one was explicitly specified.\n * Otherwise, returns undefined.\n */\nexport function getExplicitStoredKey(fieldSchema: ImplicitFieldSchema): string | undefined {\n\treturn fieldSchema instanceof FieldSchema ? fieldSchema.props?.key : undefined;\n}\n\n/**\n * Additional information to provide to a {@link FieldSchema}.\n *\n * @public\n */\nexport interface FieldProps {\n\t/**\n\t * The unique identifier of a field, used in the persisted form of the tree.\n\t *\n\t * @remarks\n\t * If not explicitly set via the schema, this is the same as the schema's property key.\n\t *\n\t * Specifying a stored key that differs from the property key is particularly useful in refactoring scenarios.\n\t * To update the developer-facing API, while maintaining backwards compatibility with existing SharedTree data,\n\t * you can change the property key and specify the previous property key as the stored key.\n\t *\n\t * Notes:\n\t *\n\t * - Stored keys have no impact on standard JavaScript behavior, on tree nodes. For example, `Object.keys`\n\t * will always return the property keys specified in the schema, ignoring any stored keys that differ from\n\t * the property keys.\n\t *\n\t * - When specifying stored keys in an object schema, you must ensure that the final set of stored keys\n\t * (accounting for those implicitly derived from property keys) contains no duplicates.\n\t * This is validated at runtime.\n\t *\n\t * @example Refactoring code without breaking compatibility with existing data\n\t *\n\t * Consider some existing object schema:\n\t *\n\t * ```TypeScript\n\t * class Point extends schemaFactory.object(\"Point\", {\n\t * \txPosition: schemaFactory.number,\n\t * \tyPosition: schemaFactory.number,\n\t * \tzPosition: schemaFactory.optional(schemaFactory.number),\n\t * });\n\t * ```\n\t *\n\t * Developers using nodes of this type would access the the `xPosition` property as `point.xPosition`.\n\t *\n\t * We would like to refactor the schema to omit \"Position\" from the property keys, but application data has\n\t * already been persisted using the original property keys. To maintain compatibility with existing data,\n\t * we can refactor the schema as follows:\n\t *\n\t * ```TypeScript\n\t * class Point extends schemaFactory.object(\"Point\", {\n\t * \tx: schemaFactory.required(schemaFactory.number, { key: \"xPosition\" }),\n\t * \ty: schemaFactory.required(schemaFactory.number, { key: \"yPosition\" }),\n\t * \tz: schemaFactory.optional(schemaFactory.number, { key: \"zPosition\" }),\n\t * });\n\t * ```\n\t *\n\t * Now, developers can access the `x` property as `point.x`, while existing data can still be collaborated on.\n\t *\n\t * @defaultValue If not specified, the key that is persisted is the property key that was specified in the schema.\n\t */\n\treadonly key?: string;\n\t/**\n\t * A default provider used for fields which were not provided any values.\n\t * @privateRemarks\n\t * We are using an erased type here, as we want to expose this API but `InsertableContent` and `NodeKeyManager` are not public.\n\t */\n\treadonly defaultProvider?: DefaultProvider;\n}\n\n/**\n * A {@link FieldProvider} which requires additional context in order to produce its content\n */\nexport type ContextualFieldProvider = (\n\tcontext: NodeKeyManager,\n) => InsertableContent | undefined;\n/**\n * A {@link FieldProvider} which can produce its content in a vacuum\n */\nexport type ConstantFieldProvider = () => InsertableContent | undefined;\n/**\n * A function which produces content for a field every time that it is called\n */\nexport type FieldProvider = ContextualFieldProvider | ConstantFieldProvider;\n/**\n * Returns true if the given {@link FieldProvider} is a {@link ConstantFieldProvider}\n */\nexport function isConstant(\n\tfieldProvider: FieldProvider,\n): fieldProvider is ConstantFieldProvider {\n\treturn fieldProvider.length === 0;\n}\n\n/**\n * Provides a default value for a field.\n * @remarks\n * If present in a `FieldSchema`, when constructing new tree content that field can be omitted, and a default will be provided.\n * @sealed @public\n */\nexport interface DefaultProvider extends ErasedType<\"@fluidframework/tree.FieldProvider\"> {}\n\nexport function extractFieldProvider(input: DefaultProvider): FieldProvider {\n\treturn input as unknown as FieldProvider;\n}\n\nexport function getDefaultProvider(input: FieldProvider): DefaultProvider {\n\treturn input as unknown as DefaultProvider;\n}\n\n/**\n * Package internal construction API.\n */\nexport let createFieldSchema: <\n\tKind extends FieldKind = FieldKind,\n\tTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n>(\n\tkind: Kind,\n\tallowedTypes: Types,\n\tprops?: FieldProps,\n) => FieldSchema<Kind, Types>;\n\n/**\n * All policy for a specific field,\n * including functionality that does not have to be kept consistent across versions or deterministic.\n *\n * This can include policy for how to use this schema for \"view\" purposes, and well as how to expose editing APIs.\n * Use {@link SchemaFactory} to create the FieldSchema instances, for example {@link SchemaFactory.optional}.\n * @privateRemarks\n * Public access to the constructor is removed to prevent creating expressible but unsupported (or not stable) configurations.\n * {@link createFieldSchema} can be used internally to create instances.\n * @sealed @public\n */\nexport class FieldSchema<\n\tout Kind extends FieldKind = FieldKind,\n\tout Types extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n> {\n\tstatic {\n\t\tcreateFieldSchema = <\n\t\t\tKind2 extends FieldKind = FieldKind,\n\t\t\tTypes2 extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\t>(\n\t\t\tkind: Kind2,\n\t\t\tallowedTypes: Types2,\n\t\t\tprops?: FieldProps,\n\t\t) => new FieldSchema(kind, allowedTypes, props);\n\t}\n\t/**\n\t * This class is used with instanceof, and therefore should have nominal typing.\n\t * This field enforces that.\n\t */\n\tprotected _typeCheck?: MakeNominal;\n\n\tprivate readonly lazyTypes: Lazy<ReadonlySet<TreeNodeSchema>>;\n\n\t/**\n\t * What types of tree nodes are allowed in this field.\n\t * @remarks Counterpart to {@link FieldSchema.allowedTypes}, with any lazy definitions evaluated.\n\t */\n\tpublic get allowedTypeSet(): ReadonlySet<TreeNodeSchema> {\n\t\treturn this.lazyTypes.value;\n\t}\n\n\tprivate constructor(\n\t\t/**\n\t\t * The {@link https://en.wikipedia.org/wiki/Kind_(type_theory) | kind } of this field.\n\t\t * Determines the multiplicity, viewing and editing APIs as well as the merge resolution policy.\n\t\t */\n\t\tpublic readonly kind: Kind,\n\t\t/**\n\t\t * What types of tree nodes are allowed in this field.\n\t\t */\n\t\tpublic readonly allowedTypes: Types,\n\t\t/**\n\t\t * Optional properties associated with the field.\n\t\t */\n\t\tpublic readonly props?: FieldProps,\n\t) {\n\t\tthis.lazyTypes = new Lazy(() => normalizeAllowedTypes(this.allowedTypes));\n\t}\n}\n\n/**\n * Normalizes a {@link ImplicitFieldSchema} to a {@link FieldSchema}.\n */\nexport function normalizeFieldSchema(schema: ImplicitFieldSchema): FieldSchema {\n\treturn schema instanceof FieldSchema\n\t\t? schema\n\t\t: createFieldSchema(FieldKind.Required, schema);\n}\n/**\n * Normalizes a {@link ImplicitAllowedTypes} to a set of {@link TreeNodeSchema}s, by eagerly evaluating any\n * lazy schema declarations.\n *\n * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of\n * recursive schemas may fail.\n */\nexport function normalizeAllowedTypes(\n\ttypes: ImplicitAllowedTypes,\n): ReadonlySet<TreeNodeSchema> {\n\tconst normalized = new Set<TreeNodeSchema>();\n\tif (isReadonlyArray(types)) {\n\t\tfor (const lazyType of types) {\n\t\t\tnormalized.add(evaluateLazySchema(lazyType));\n\t\t}\n\t} else {\n\t\tnormalized.add(evaluateLazySchema(types));\n\t}\n\treturn normalized;\n}\n\nfunction evaluateLazySchema(value: LazyItem<TreeNodeSchema>): TreeNodeSchema {\n\tconst evaluatedSchema = isLazy(value) ? value() : value;\n\tif (evaluatedSchema === undefined) {\n\t\tthrow new UsageError(\n\t\t\t`Encountered an undefined schema. This could indicate that some referenced schema has not yet been instantiated.`,\n\t\t);\n\t}\n\treturn evaluatedSchema;\n}\n\n/**\n * Types allowed in a field.\n * @remarks\n * Implicitly treats a single type as an array of one type.\n * @public\n */\nexport type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;\n\n/**\n * Schema for a field of a tree node.\n * @remarks\n * Implicitly treats {@link ImplicitAllowedTypes} as a Required field of that type.\n * @public\n */\nexport type ImplicitFieldSchema = FieldSchema | ImplicitAllowedTypes;\n\n/**\n * Converts ImplicitFieldSchema to the corresponding tree node's field type.\n * @public\n */\nexport type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> =\n\tTSchema extends FieldSchema<infer Kind, infer Types>\n\t\t? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind, false>\n\t\t: TSchema extends ImplicitAllowedTypes\n\t\t\t? TreeNodeFromImplicitAllowedTypes<TSchema>\n\t\t\t: unknown;\n\n/**\n * Type of content that can be inserted into the tree for a field of the given schema.\n * @public\n */\nexport type InsertableTreeFieldFromImplicitField<\n\tTSchema extends ImplicitFieldSchema = FieldSchema,\n> = TSchema extends FieldSchema<infer Kind, infer Types>\n\t? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypes<Types>, Kind, true>\n\t: TSchema extends ImplicitAllowedTypes\n\t\t? InsertableTreeNodeFromImplicitAllowedTypes<TSchema>\n\t\t: unknown;\n\n/**\n * Suitable for output.\n * For input must error on side of excluding undefined instead.\n * @public\n */\nexport type ApplyKind<T, Kind extends FieldKind, DefaultsAreOptional extends boolean> = {\n\t[FieldKind.Required]: T;\n\t[FieldKind.Optional]: T | undefined;\n\t[FieldKind.Identifier]: DefaultsAreOptional extends true ? T | undefined : T;\n}[Kind];\n\n/**\n * Type of tree node for a field of the given schema.\n * @public\n */\nexport type TreeNodeFromImplicitAllowedTypes<\n\tTSchema extends ImplicitAllowedTypes = TreeNodeSchema,\n> = TSchema extends TreeNodeSchema\n\t? NodeFromSchema<TSchema>\n\t: TSchema extends AllowedTypes\n\t\t? NodeFromSchema<FlexListToUnion<TSchema>>\n\t\t: unknown;\n\n/**\n * Type of content that can be inserted into the tree for a node of the given schema.\n * @public\n */\nexport type InsertableTreeNodeFromImplicitAllowedTypes<\n\tTSchema extends ImplicitAllowedTypes = TreeNodeSchema,\n> = TSchema extends TreeNodeSchema\n\t? InsertableTypedNode<TSchema>\n\t: TSchema extends AllowedTypes\n\t\t? InsertableTypedNode<FlexListToUnion<TSchema>>\n\t\t: never;\n\n/**\n * Takes in `TreeNodeSchema[]` and returns a TypedNode union.\n * @public\n */\nexport type NodeFromSchema<T extends TreeNodeSchema> = T extends TreeNodeSchema<\n\tstring,\n\tNodeKind,\n\tinfer TNode\n>\n\t? TNode\n\t: never;\n\n/**\n * Data which can be used as a node to be inserted.\n * Either an unhydrated node, or content to build a new node.\n * @public\n */\nexport type InsertableTypedNode<T extends TreeNodeSchema> =\n\t| (T extends { implicitlyConstructable: true } ? NodeBuilderData<T> : never)\n\t| Unhydrated<NodeFromSchema<T>>;\n\n/**\n * Given a node's schema, return the corresponding object from which the node could be built.\n * @privateRemarks\n * Currently this assumes factory functions take exactly one argument.\n * This could be changed if needed.\n *\n * These factory functions can also take a FlexTreeNode, but this is not exposed in the public facing types.\n * @public\n */\nexport type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<\n\tstring,\n\tNodeKind,\n\tunknown,\n\tinfer TBuild\n>\n\t? TBuild\n\t: never;\n\n/**\n * Value that may be stored as a leaf node.\n * @public\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport type TreeLeafValue = number | string | boolean | IFluidHandle | null;\n\n/**\n * The type of a {@link TreeNode}.\n * For more information about the type, use `Tree.schema(theNode)` instead.\n * @remarks\n * This symbol mainly exists on nodes to allow TypeScript to provide more accurate type checking.\n * `Tree.is` and `Tree.schema` provide a superset of this information in more friendly ways.\n *\n * This symbol should not manually be added to objects as doing so allows the object to be invalidly used where nodes are expected.\n * Instead construct a real node of the desired type using its constructor.\n * @privateRemarks\n * This prevents non-nodes from being accidentally used as nodes, as well as allows the type checker to distinguish different node types.\n * @public\n */\nexport const typeNameSymbol: unique symbol = Symbol(\"TreeNode Type\");\n\n/**\n * Adds a type symbol to a type for stronger typing.\n * @remarks\n * An implementation detail of {@link TreeNode}'s strong typing setup: not intended for direct use outside of this package.\n * @sealed @public\n */\nexport interface WithType<TName extends string = string> {\n\t/**\n\t * Type symbol, marking a type in a way to increase type safety via strong type checking.\n\t */\n\tget [typeNameSymbol](): TName;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"schemaTypes.js","sourceRoot":"","sources":["../../src/simple-tree/schemaTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAGN,MAAM,GAEN,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAoB,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAU5E;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAQpC,MAAgF;IAEhF,OAAO,MAAM,CAAC,WAAW,KAAK,SAAS,CAAC;AACzC,CAAC;AAWD;;;;;GAKG;AACH,MAAM,CAAN,IAAY,SAmBX;AAnBD,WAAY,SAAS;IACpB;;;;OAIG;IACH,iDAAQ,CAAA;IACR;;;;OAIG;IACH,iDAAQ,CAAA;IACR;;;;OAIG;IACH,qDAAU,CAAA;AACX,CAAC,EAnBW,SAAS,KAAT,SAAS,QAmBpB;AAED;;;;;;;GAOG;AACH,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AiB,GAAG,CAInB,IAAW,EACX,YAAoB,EACpB,KAAkB,EACjB,EAAE,CAAC,IAAI,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC,GAAA,CAAA;AA4CF;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAA2B;IAC/D,OAAO,MAAM,YAAY,WAAW;QACnC,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AACD;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACpC,KAA2B;IAE3B,MAAM,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC7C,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;YAC9B,UAAU,CAAC,GAAG,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9C,CAAC;IACF,CAAC;SAAM,CAAC;QACP,UAAU,CAAC,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,UAAU,CAAC;AACnB,CAAC;AAED,SAAS,kBAAkB,CAAC,KAA+B;IAC1D,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IACxD,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,IAAI,UAAU,CACnB,iHAAiH,CACjH,CAAC;IACH,CAAC;IACD,OAAO,eAAe,CAAC;AACxB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ErasedType, IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { Lazy } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\ttype LazyItem,\n\ttype NodeKeyManager,\n\tisLazy,\n\ttype FlexListToUnion,\n} from \"../feature-libraries/index.js\";\nimport { type MakeNominal, brand, isReadonlyArray } from \"../util/index.js\";\nimport type {\n\tUnhydrated,\n\tNodeKind,\n\tTreeNodeSchema,\n\tTreeNodeSchemaClass,\n} from \"./core/index.js\";\nimport type { FieldKey } from \"../core/index.js\";\nimport type { InsertableContent } from \"./proxies.js\";\n\n/**\n * Returns true if the given schema is a {@link TreeNodeSchemaClass}, or otherwise false if it is a {@link TreeNodeSchemaNonClass}.\n */\nexport function isTreeNodeSchemaClass<\n\tName extends string,\n\tKind extends NodeKind,\n\tTNode,\n\tTBuild,\n\tImplicitlyConstructable extends boolean,\n\tInfo,\n>(\n\tschema: TreeNodeSchema<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>,\n): schema is TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> {\n\treturn schema.constructor !== undefined;\n}\n\n/**\n * Types for use in fields.\n * @remarks\n * Type constraint used in schema declaration APIs.\n * Not intended for direct use outside of package.\n * @public\n */\nexport type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];\n\n/**\n * Kind of a field on a node.\n * @remarks\n * More kinds may be added over time, so do not assume this is an exhaustive set.\n * @public\n */\nexport enum FieldKind {\n\t/**\n\t * A field which can be empty or filled.\n\t * @remarks\n\t * Allows 0 or one child.\n\t */\n\tOptional,\n\t/**\n\t * A field which must always be filled.\n\t * @remarks\n\t * Only allows exactly one child.\n\t */\n\tRequired,\n\t/**\n\t * A special field used for node identifiers.\n\t * @remarks\n\t * Only allows exactly one child.\n\t */\n\tIdentifier,\n}\n\n/**\n * Maps from a view key to its corresponding {@link FieldProps.key | stored key} for the provided\n * {@link ImplicitFieldSchema | field schema}.\n *\n * @remarks\n * If an explicit stored key was specified in the schema, it will be used.\n * Otherwise, the stored key is the same as the view key.\n */\nexport function getStoredKey(viewKey: string, fieldSchema: ImplicitFieldSchema): FieldKey {\n\treturn brand(getExplicitStoredKey(fieldSchema) ?? viewKey);\n}\n\n/**\n * Gets the {@link FieldProps.key | stored key} specified by the schema, if one was explicitly specified.\n * Otherwise, returns undefined.\n */\nexport function getExplicitStoredKey(fieldSchema: ImplicitFieldSchema): string | undefined {\n\treturn fieldSchema instanceof FieldSchema ? fieldSchema.props?.key : undefined;\n}\n\n/**\n * Additional information to provide to a {@link FieldSchema}.\n *\n * @public\n */\nexport interface FieldProps {\n\t/**\n\t * The unique identifier of a field, used in the persisted form of the tree.\n\t *\n\t * @remarks\n\t * If not explicitly set via the schema, this is the same as the schema's property key.\n\t *\n\t * Specifying a stored key that differs from the property key is particularly useful in refactoring scenarios.\n\t * To update the developer-facing API, while maintaining backwards compatibility with existing SharedTree data,\n\t * you can change the property key and specify the previous property key as the stored key.\n\t *\n\t * Notes:\n\t *\n\t * - Stored keys have no impact on standard JavaScript behavior, on tree nodes. For example, `Object.keys`\n\t * will always return the property keys specified in the schema, ignoring any stored keys that differ from\n\t * the property keys.\n\t *\n\t * - When specifying stored keys in an object schema, you must ensure that the final set of stored keys\n\t * (accounting for those implicitly derived from property keys) contains no duplicates.\n\t * This is validated at runtime.\n\t *\n\t * @example Refactoring code without breaking compatibility with existing data\n\t *\n\t * Consider some existing object schema:\n\t *\n\t * ```TypeScript\n\t * class Point extends schemaFactory.object(\"Point\", {\n\t * \txPosition: schemaFactory.number,\n\t * \tyPosition: schemaFactory.number,\n\t * \tzPosition: schemaFactory.optional(schemaFactory.number),\n\t * });\n\t * ```\n\t *\n\t * Developers using nodes of this type would access the the `xPosition` property as `point.xPosition`.\n\t *\n\t * We would like to refactor the schema to omit \"Position\" from the property keys, but application data has\n\t * already been persisted using the original property keys. To maintain compatibility with existing data,\n\t * we can refactor the schema as follows:\n\t *\n\t * ```TypeScript\n\t * class Point extends schemaFactory.object(\"Point\", {\n\t * \tx: schemaFactory.required(schemaFactory.number, { key: \"xPosition\" }),\n\t * \ty: schemaFactory.required(schemaFactory.number, { key: \"yPosition\" }),\n\t * \tz: schemaFactory.optional(schemaFactory.number, { key: \"zPosition\" }),\n\t * });\n\t * ```\n\t *\n\t * Now, developers can access the `x` property as `point.x`, while existing data can still be collaborated on.\n\t *\n\t * @defaultValue If not specified, the key that is persisted is the property key that was specified in the schema.\n\t */\n\treadonly key?: string;\n\t/**\n\t * A default provider used for fields which were not provided any values.\n\t * @privateRemarks\n\t * We are using an erased type here, as we want to expose this API but `InsertableContent` and `NodeKeyManager` are not public.\n\t */\n\treadonly defaultProvider?: DefaultProvider;\n}\n\n/**\n * A {@link FieldProvider} which requires additional context in order to produce its content\n */\nexport type ContextualFieldProvider = (\n\tcontext: NodeKeyManager,\n) => InsertableContent | undefined;\n/**\n * A {@link FieldProvider} which can produce its content in a vacuum\n */\nexport type ConstantFieldProvider = () => InsertableContent | undefined;\n/**\n * A function which produces content for a field every time that it is called\n */\nexport type FieldProvider = ContextualFieldProvider | ConstantFieldProvider;\n/**\n * Returns true if the given {@link FieldProvider} is a {@link ConstantFieldProvider}\n */\nexport function isConstant(\n\tfieldProvider: FieldProvider,\n): fieldProvider is ConstantFieldProvider {\n\treturn fieldProvider.length === 0;\n}\n\n/**\n * Provides a default value for a field.\n * @remarks\n * If present in a `FieldSchema`, when constructing new tree content that field can be omitted, and a default will be provided.\n * @sealed @public\n */\nexport interface DefaultProvider extends ErasedType<\"@fluidframework/tree.FieldProvider\"> {}\n\nexport function extractFieldProvider(input: DefaultProvider): FieldProvider {\n\treturn input as unknown as FieldProvider;\n}\n\nexport function getDefaultProvider(input: FieldProvider): DefaultProvider {\n\treturn input as unknown as DefaultProvider;\n}\n\n/**\n * Package internal construction API.\n */\nexport let createFieldSchema: <\n\tKind extends FieldKind = FieldKind,\n\tTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n>(\n\tkind: Kind,\n\tallowedTypes: Types,\n\tprops?: FieldProps,\n) => FieldSchema<Kind, Types>;\n\n/**\n * All policy for a specific field,\n * including functionality that does not have to be kept consistent across versions or deterministic.\n *\n * This can include policy for how to use this schema for \"view\" purposes, and well as how to expose editing APIs.\n * Use {@link SchemaFactory} to create the FieldSchema instances, for example {@link SchemaFactory.optional}.\n * @privateRemarks\n * Public access to the constructor is removed to prevent creating expressible but unsupported (or not stable) configurations.\n * {@link createFieldSchema} can be used internally to create instances.\n * @sealed @public\n */\nexport class FieldSchema<\n\tout Kind extends FieldKind = FieldKind,\n\tout Types extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n> {\n\tstatic {\n\t\tcreateFieldSchema = <\n\t\t\tKind2 extends FieldKind = FieldKind,\n\t\t\tTypes2 extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\t>(\n\t\t\tkind: Kind2,\n\t\t\tallowedTypes: Types2,\n\t\t\tprops?: FieldProps,\n\t\t) => new FieldSchema(kind, allowedTypes, props);\n\t}\n\t/**\n\t * This class is used with instanceof, and therefore should have nominal typing.\n\t * This field enforces that.\n\t */\n\tprotected _typeCheck!: MakeNominal;\n\n\tprivate readonly lazyTypes: Lazy<ReadonlySet<TreeNodeSchema>>;\n\n\t/**\n\t * What types of tree nodes are allowed in this field.\n\t * @remarks Counterpart to {@link FieldSchema.allowedTypes}, with any lazy definitions evaluated.\n\t */\n\tpublic get allowedTypeSet(): ReadonlySet<TreeNodeSchema> {\n\t\treturn this.lazyTypes.value;\n\t}\n\n\t/**\n\t * True if and only if, when constructing a node with this field, a value must be provided for it.\n\t */\n\tpublic readonly requiresValue: boolean;\n\n\tprivate constructor(\n\t\t/**\n\t\t * The {@link https://en.wikipedia.org/wiki/Kind_(type_theory) | kind } of this field.\n\t\t * Determines the multiplicity, viewing and editing APIs as well as the merge resolution policy.\n\t\t */\n\t\tpublic readonly kind: Kind,\n\t\t/**\n\t\t * What types of tree nodes are allowed in this field.\n\t\t */\n\t\tpublic readonly allowedTypes: Types,\n\t\t/**\n\t\t * Optional properties associated with the field.\n\t\t */\n\t\tpublic readonly props?: FieldProps,\n\t) {\n\t\tthis.lazyTypes = new Lazy(() => normalizeAllowedTypes(this.allowedTypes));\n\t\t// TODO: optional fields should (by default) get a default provider that returns undefined, removing the need to special case them here:\n\t\tthis.requiresValue =\n\t\t\tthis.props?.defaultProvider === undefined && this.kind !== FieldKind.Optional;\n\t}\n}\n\n/**\n * Normalizes a {@link ImplicitFieldSchema} to a {@link FieldSchema}.\n */\nexport function normalizeFieldSchema(schema: ImplicitFieldSchema): FieldSchema {\n\treturn schema instanceof FieldSchema\n\t\t? schema\n\t\t: createFieldSchema(FieldKind.Required, schema);\n}\n/**\n * Normalizes a {@link ImplicitAllowedTypes} to a set of {@link TreeNodeSchema}s, by eagerly evaluating any\n * lazy schema declarations.\n *\n * @remarks Note: this must only be called after all required schemas have been declared, otherwise evaluation of\n * recursive schemas may fail.\n */\nexport function normalizeAllowedTypes(\n\ttypes: ImplicitAllowedTypes,\n): ReadonlySet<TreeNodeSchema> {\n\tconst normalized = new Set<TreeNodeSchema>();\n\tif (isReadonlyArray(types)) {\n\t\tfor (const lazyType of types) {\n\t\t\tnormalized.add(evaluateLazySchema(lazyType));\n\t\t}\n\t} else {\n\t\tnormalized.add(evaluateLazySchema(types));\n\t}\n\treturn normalized;\n}\n\nfunction evaluateLazySchema(value: LazyItem<TreeNodeSchema>): TreeNodeSchema {\n\tconst evaluatedSchema = isLazy(value) ? value() : value;\n\tif (evaluatedSchema === undefined) {\n\t\tthrow new UsageError(\n\t\t\t`Encountered an undefined schema. This could indicate that some referenced schema has not yet been instantiated.`,\n\t\t);\n\t}\n\treturn evaluatedSchema;\n}\n\n/**\n * Types allowed in a field.\n * @remarks\n * Implicitly treats a single type as an array of one type.\n * @public\n */\nexport type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;\n\n/**\n * Schema for a field of a tree node.\n * @remarks\n * Implicitly treats {@link ImplicitAllowedTypes} as a Required field of that type.\n * @public\n */\nexport type ImplicitFieldSchema = FieldSchema | ImplicitAllowedTypes;\n\n/**\n * Converts ImplicitFieldSchema to the corresponding tree node's field type.\n * @public\n */\nexport type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> =\n\tTSchema extends FieldSchema<infer Kind, infer Types>\n\t\t? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind, false>\n\t\t: TSchema extends ImplicitAllowedTypes\n\t\t\t? TreeNodeFromImplicitAllowedTypes<TSchema>\n\t\t\t: unknown;\n\n/**\n * Type of content that can be inserted into the tree for a field of the given schema.\n * @public\n */\nexport type InsertableTreeFieldFromImplicitField<\n\tTSchema extends ImplicitFieldSchema = FieldSchema,\n> = TSchema extends FieldSchema<infer Kind, infer Types>\n\t? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypes<Types>, Kind, true>\n\t: TSchema extends ImplicitAllowedTypes\n\t\t? InsertableTreeNodeFromImplicitAllowedTypes<TSchema>\n\t\t: unknown;\n\n/**\n * Suitable for output.\n * For input must error on side of excluding undefined instead.\n * @public\n */\nexport type ApplyKind<T, Kind extends FieldKind, DefaultsAreOptional extends boolean> = {\n\t[FieldKind.Required]: T;\n\t[FieldKind.Optional]: T | undefined;\n\t[FieldKind.Identifier]: DefaultsAreOptional extends true ? T | undefined : T;\n}[Kind];\n\n/**\n * Type of tree node for a field of the given schema.\n * @public\n */\nexport type TreeNodeFromImplicitAllowedTypes<\n\tTSchema extends ImplicitAllowedTypes = TreeNodeSchema,\n> = TSchema extends TreeNodeSchema\n\t? NodeFromSchema<TSchema>\n\t: TSchema extends AllowedTypes\n\t\t? NodeFromSchema<FlexListToUnion<TSchema>>\n\t\t: unknown;\n\n/**\n * Type of content that can be inserted into the tree for a node of the given schema.\n * @public\n */\nexport type InsertableTreeNodeFromImplicitAllowedTypes<\n\tTSchema extends ImplicitAllowedTypes = TreeNodeSchema,\n> = TSchema extends TreeNodeSchema\n\t? InsertableTypedNode<TSchema>\n\t: TSchema extends AllowedTypes\n\t\t? InsertableTypedNode<FlexListToUnion<TSchema>>\n\t\t: never;\n\n/**\n * Takes in `TreeNodeSchema[]` and returns a TypedNode union.\n * @public\n */\nexport type NodeFromSchema<T extends TreeNodeSchema> = T extends TreeNodeSchema<\n\tstring,\n\tNodeKind,\n\tinfer TNode\n>\n\t? TNode\n\t: never;\n\n/**\n * Data which can be used as a node to be inserted.\n * Either an unhydrated node, or content to build a new node.\n * @public\n */\nexport type InsertableTypedNode<T extends TreeNodeSchema> =\n\t| (T extends { implicitlyConstructable: true } ? NodeBuilderData<T> : never)\n\t| Unhydrated<NodeFromSchema<T>>;\n\n/**\n * Given a node's schema, return the corresponding object from which the node could be built.\n * @privateRemarks\n * Currently this assumes factory functions take exactly one argument.\n * This could be changed if needed.\n *\n * These factory functions can also take a FlexTreeNode, but this is not exposed in the public facing types.\n * @public\n */\nexport type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<\n\tstring,\n\tNodeKind,\n\tunknown,\n\tinfer TBuild\n>\n\t? TBuild\n\t: never;\n\n/**\n * Value that may be stored as a leaf node.\n * @remarks\n * Some limitations apply, see the documentation for {@link SchemaFactory.number} and {@link SchemaFactory.string} for those restrictions.\n * @public\n */\n// eslint-disable-next-line @rushstack/no-new-null\nexport type TreeLeafValue = number | string | boolean | IFluidHandle | null;\n"]}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { ValueSchema } from "../core/index.js";
|
|
6
|
+
import type { NodeKind } from "./core/index.js";
|
|
7
|
+
import type { FieldKind } from "./schemaTypes.js";
|
|
8
|
+
/**
|
|
9
|
+
* Base interface for all {@link SimpleNodeSchema} implementations.
|
|
10
|
+
*
|
|
11
|
+
* @sealed
|
|
12
|
+
*/
|
|
13
|
+
export interface SimpleNodeSchemaBase<TNodeKind extends NodeKind> {
|
|
14
|
+
/**
|
|
15
|
+
* The kind of {@link SimpleNodeSchema}.
|
|
16
|
+
*
|
|
17
|
+
* @remarks can be used to type-switch between implementations.
|
|
18
|
+
*/
|
|
19
|
+
readonly kind: TNodeKind;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A {@link SimpleNodeSchema} for an object node.
|
|
23
|
+
*
|
|
24
|
+
* @sealed
|
|
25
|
+
*/
|
|
26
|
+
export interface SimpleObjectNodeSchema extends SimpleNodeSchemaBase<NodeKind.Object> {
|
|
27
|
+
/**
|
|
28
|
+
* Schemas for each of the object's fields, keyed off of schema's view keys.
|
|
29
|
+
*/
|
|
30
|
+
readonly fields: Record<string, SimpleFieldSchema>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A {@link SimpleNodeSchema} for an array node.
|
|
34
|
+
*
|
|
35
|
+
* @sealed
|
|
36
|
+
*/
|
|
37
|
+
export interface SimpleArrayNodeSchema extends SimpleNodeSchemaBase<NodeKind.Array> {
|
|
38
|
+
/**
|
|
39
|
+
* The types allowed in the array.
|
|
40
|
+
*
|
|
41
|
+
* @remarks Refers to the types by identifier.
|
|
42
|
+
* A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.
|
|
43
|
+
*/
|
|
44
|
+
readonly allowedTypes: ReadonlySet<string>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A {@link SimpleNodeSchema} for a map node.
|
|
48
|
+
*
|
|
49
|
+
* @sealed
|
|
50
|
+
*/
|
|
51
|
+
export interface SimpleMapNodeSchema extends SimpleNodeSchemaBase<NodeKind.Map> {
|
|
52
|
+
/**
|
|
53
|
+
* The types allowed as values in the map.
|
|
54
|
+
*
|
|
55
|
+
* @remarks Refers to the types by identifier.
|
|
56
|
+
* A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.
|
|
57
|
+
*/
|
|
58
|
+
readonly allowedTypes: ReadonlySet<string>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A {@link SimpleNodeSchema} for a leaf node.
|
|
62
|
+
*
|
|
63
|
+
* @sealed
|
|
64
|
+
*/
|
|
65
|
+
export interface SimpleLeafNodeSchema extends SimpleNodeSchemaBase<NodeKind.Leaf> {
|
|
66
|
+
/**
|
|
67
|
+
* The kind of leaf node.
|
|
68
|
+
*/
|
|
69
|
+
readonly leafKind: ValueSchema;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A simple, shallow representation of a schema for a node.
|
|
73
|
+
*
|
|
74
|
+
* @remarks This definition is incomplete, and references child types by identifiers.
|
|
75
|
+
* To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which
|
|
76
|
+
* contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.
|
|
77
|
+
*/
|
|
78
|
+
export type SimpleNodeSchema = SimpleLeafNodeSchema | SimpleMapNodeSchema | SimpleArrayNodeSchema | SimpleObjectNodeSchema;
|
|
79
|
+
/**
|
|
80
|
+
* A simple, shallow representation of a schema for a field.
|
|
81
|
+
*
|
|
82
|
+
* @remarks This definition is incomplete, and references child types by identifiers.
|
|
83
|
+
* To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which
|
|
84
|
+
* contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.
|
|
85
|
+
*
|
|
86
|
+
* @sealed
|
|
87
|
+
*/
|
|
88
|
+
export interface SimpleFieldSchema {
|
|
89
|
+
/**
|
|
90
|
+
* The kind of object field.
|
|
91
|
+
*/
|
|
92
|
+
readonly kind: FieldKind;
|
|
93
|
+
/**
|
|
94
|
+
* The types allowed under the field.
|
|
95
|
+
*
|
|
96
|
+
* @remarks Refers to the types by identifier.
|
|
97
|
+
* A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.
|
|
98
|
+
*/
|
|
99
|
+
readonly allowedTypes: ReadonlySet<string>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A simplified representation of a schema for a tree.
|
|
103
|
+
*
|
|
104
|
+
* @remarks Contains the complete set of schema {@link SimpleTreeSchema.definitions} required to resolve references
|
|
105
|
+
* by schema identifier.
|
|
106
|
+
*
|
|
107
|
+
* @sealed
|
|
108
|
+
*/
|
|
109
|
+
export interface SimpleTreeSchema {
|
|
110
|
+
/**
|
|
111
|
+
* The complete set of node schema definitions recursively referenced by the tree's {@link SimpleTreeSchema.allowedTypes}.
|
|
112
|
+
*
|
|
113
|
+
* @remarks the keys are the schemas' {@link TreeNodeSchemaCore.identifier | identifiers}.
|
|
114
|
+
*/
|
|
115
|
+
readonly definitions: ReadonlyMap<string, SimpleNodeSchema>;
|
|
116
|
+
/**
|
|
117
|
+
* The types allowed under the root of the tree.
|
|
118
|
+
*
|
|
119
|
+
* @remarks Refers to the types by identifier.
|
|
120
|
+
* {@link SimpleTreeSchema.definitions} can be used to resolve these identifiers to their associated schema definition.
|
|
121
|
+
*/
|
|
122
|
+
readonly allowedTypes: ReadonlySet<string>;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=simpleSchema.d.ts.map
|
|
@@ -0,0 +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,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,oBAAoB,CAAC,SAAS,SAAS,QAAQ;IAC/D;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB,CAAC,QAAQ,CAAC,MAAM,CAAC;IACpF;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CACnD;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAClF;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB,CAAC,QAAQ,CAAC,GAAG,CAAC;IAC9E;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC;IAChF;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GACzB,oBAAoB,GACpB,mBAAmB,GACnB,qBAAqB,GACrB,sBAAsB,CAAC;AAE1B;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAEzB;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAE5D;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simpleSchema.js","sourceRoot":"","sources":["../../src/simple-tree/simpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ValueSchema } from \"../core/index.js\";\nimport type { NodeKind } from \"./core/index.js\";\nimport type { FieldKind } from \"./schemaTypes.js\";\n\n/**\n * Base interface for all {@link SimpleNodeSchema} implementations.\n *\n * @sealed\n */\nexport interface SimpleNodeSchemaBase<TNodeKind extends NodeKind> {\n\t/**\n\t * The kind of {@link SimpleNodeSchema}.\n\t *\n\t * @remarks can be used to type-switch between implementations.\n\t */\n\treadonly kind: TNodeKind;\n}\n\n/**\n * A {@link SimpleNodeSchema} for an object node.\n *\n * @sealed\n */\nexport interface SimpleObjectNodeSchema extends SimpleNodeSchemaBase<NodeKind.Object> {\n\t/**\n\t * Schemas for each of the object's fields, keyed off of schema's view keys.\n\t */\n\treadonly fields: Record<string, SimpleFieldSchema>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for an array node.\n *\n * @sealed\n */\nexport interface SimpleArrayNodeSchema extends SimpleNodeSchemaBase<NodeKind.Array> {\n\t/**\n\t * The types allowed in the array.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a map node.\n *\n * @sealed\n */\nexport interface SimpleMapNodeSchema extends SimpleNodeSchemaBase<NodeKind.Map> {\n\t/**\n\t * The types allowed as values in the map.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a leaf node.\n *\n * @sealed\n */\nexport interface SimpleLeafNodeSchema extends SimpleNodeSchemaBase<NodeKind.Leaf> {\n\t/**\n\t * The kind of leaf node.\n\t */\n\treadonly leafKind: ValueSchema;\n}\n\n/**\n * A simple, shallow representation of a schema for a node.\n *\n * @remarks This definition is incomplete, and references child types by identifiers.\n * To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which\n * contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.\n */\nexport type SimpleNodeSchema =\n\t| SimpleLeafNodeSchema\n\t| SimpleMapNodeSchema\n\t| SimpleArrayNodeSchema\n\t| SimpleObjectNodeSchema;\n\n/**\n * A simple, shallow representation of a schema for a field.\n *\n * @remarks This definition is incomplete, and references child types by identifiers.\n * To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which\n * contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.\n *\n * @sealed\n */\nexport interface SimpleFieldSchema {\n\t/**\n\t * The kind of object field.\n\t */\n\treadonly kind: FieldKind;\n\n\t/**\n\t * The types allowed under the field.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n}\n\n/**\n * A simplified representation of a schema for a tree.\n *\n * @remarks Contains the complete set of schema {@link SimpleTreeSchema.definitions} required to resolve references\n * by schema identifier.\n *\n * @sealed\n */\nexport interface SimpleTreeSchema {\n\t/**\n\t * The complete set of node schema definitions recursively referenced by the tree's {@link SimpleTreeSchema.allowedTypes}.\n\t *\n\t * @remarks the keys are the schemas' {@link TreeNodeSchemaCore.identifier | identifiers}.\n\t */\n\treadonly definitions: ReadonlyMap<string, SimpleNodeSchema>;\n\n\t/**\n\t * The types allowed under the root of the tree.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * {@link SimpleTreeSchema.definitions} can be used to resolve these identifiers to their associated schema definition.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n}\n"]}
|