@fluidframework/tree 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dependency-cruiser-known-violations.json +28 -40
- package/.vscode/Tree.code-workspace +0 -2
- package/CHANGELOG.md +92 -0
- package/README.md +6 -0
- package/alpha.d.ts +11 -0
- package/api-extractor/api-extractor-lint-alpha.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-alpha.esm.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
- package/api-extractor/api-extractor.current.json +8 -0
- package/api-extractor/api-extractor.legacy.json +4 -0
- package/api-extractor.json +1 -1
- package/api-report/tree.alpha.api.md +21 -6
- package/api-report/tree.beta.api.md +21 -6
- package/api-report/tree.legacy.alpha.api.md +562 -0
- package/api-report/tree.legacy.public.api.md +559 -0
- package/api-report/tree.public.api.md +6 -6
- package/dist/alpha.d.ts +102 -0
- package/dist/beta.d.ts +6 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
- package/dist/core/revertible.d.ts.map +1 -0
- package/dist/core/revertible.js.map +1 -0
- package/dist/core/schema-stored/format.d.ts +3 -3
- package/dist/core/schema-stored/format.js +1 -1
- package/dist/core/schema-stored/format.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +2 -7
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +4 -6
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
- package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.d.ts +4 -6
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +15 -1
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts +0 -1
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +1 -0
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/visitDelta.d.ts +7 -2
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/events/emitter.d.ts +127 -0
- package/dist/events/emitter.d.ts.map +1 -0
- package/dist/events/{events.js → emitter.js} +49 -28
- package/dist/events/emitter.js.map +1 -0
- package/dist/events/index.d.ts +2 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +4 -5
- package/dist/events/index.js.map +1 -1
- package/dist/events/interop.d.ts +36 -0
- package/dist/events/interop.d.ts.map +1 -0
- package/dist/{core/revertible/index.d.ts → events/interop.js} +3 -2
- package/dist/events/interop.js.map +1 -0
- package/dist/events/listeners.d.ts +65 -0
- package/dist/events/listeners.d.ts.map +1 -0
- package/{lib/core/revertible/index.d.ts → dist/events/listeners.js} +3 -2
- package/dist/events/listeners.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
- package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +36 -15
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +12 -5
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +28 -2
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
- package/dist/feature-libraries/default-schema/defaultEditBuilder.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 -1
- package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +35 -35
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +82 -115
- package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
- package/dist/feature-libraries/flex-tree/context.d.ts +30 -14
- package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/context.js +10 -7
- package/dist/feature-libraries/flex-tree/context.js.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -281
- package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js +15 -32
- package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/dist/feature-libraries/flex-tree/index.d.ts +2 -3
- 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/lazyEntity.d.ts +3 -3
- package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyEntity.js +2 -10
- package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.d.ts +26 -29
- package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +11 -17
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts +6 -34
- package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +23 -159
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/flex-tree/unboxed.d.ts +4 -16
- package/dist/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/unboxed.js +7 -41
- package/dist/feature-libraries/flex-tree/unboxed.js.map +1 -1
- package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -2
- package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
- package/dist/feature-libraries/flex-tree/utilities.js +3 -6
- package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +3 -5
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +5 -13
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +3 -6
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/discrepancies.js +3 -13
- package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +12 -5
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
- package/dist/feature-libraries/schema-index/format.d.ts +3 -3
- package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
- package/dist/feature-libraries/storedToViewSchema.js +2 -4
- package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
- package/dist/feature-libraries/typed-schema/flexList.d.ts +3 -3
- package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
- package/dist/feature-libraries/typed-schema/index.d.ts +2 -2
- package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/index.js +2 -2
- 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 +8 -10
- package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
- package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
- package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/typedTreeSchema.js +5 -37
- package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
- package/dist/feature-libraries/typed-schema/view.d.ts +4 -6
- package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
- package/dist/feature-libraries/typed-schema/view.js +5 -4
- package/dist/feature-libraries/typed-schema/view.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +83 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/checkoutFlexTreeView.d.ts +53 -0
- package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
- package/dist/shared-tree/{treeView.js → checkoutFlexTreeView.js} +28 -6
- package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -0
- package/dist/shared-tree/index.d.ts +3 -3
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js +2 -2
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +15 -4
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +7 -8
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +9 -4
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +25 -12
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +2 -2
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeEnricher.js +6 -2
- package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +3 -2
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
- package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
- package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/dist/shared-tree/treeApi.d.ts +1 -3
- package/dist/shared-tree/treeApi.d.ts.map +1 -1
- package/dist/shared-tree/treeApi.js +6 -4
- package/dist/shared-tree/treeApi.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +2 -13
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +17 -1
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.js +1 -1
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +1 -1
- package/dist/simple-tree/api/create.js.map +1 -1
- package/{lib/simple-tree → dist/simple-tree/api}/getJsonSchema.d.ts +1 -1
- package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -0
- package/dist/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -0
- package/{lib/simple-tree → dist/simple-tree/api}/getSimpleSchema.d.ts +1 -1
- package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
- package/dist/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
- package/dist/simple-tree/api/getSimpleSchema.js.map +1 -0
- package/dist/simple-tree/api/index.d.ts +5 -0
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +7 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/{lib/simple-tree → dist/simple-tree/api}/jsonSchema.d.ts +1 -1
- package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -0
- package/dist/simple-tree/api/jsonSchema.js.map +1 -0
- package/dist/simple-tree/api/schemaFactory.d.ts +45 -14
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +43 -12
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +4 -4
- package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -0
- package/dist/simple-tree/api/simpleSchema.js.map +1 -0
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
- package/dist/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +4 -4
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
- package/dist/simple-tree/api/tree.d.ts +1 -21
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +3 -38
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeApiBeta.d.ts +79 -0
- package/dist/simple-tree/api/treeApiBeta.d.ts.map +1 -0
- package/dist/simple-tree/api/treeApiBeta.js +26 -0
- package/dist/simple-tree/api/treeApiBeta.js.map +1 -0
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +51 -21
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +2 -2
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
- package/dist/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +4 -4
- package/{lib/simple-tree → dist/simple-tree/api}/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +2 -2
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +33 -38
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +2 -2
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +4 -1
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/schemaCaching.d.ts +5 -0
- package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -1
- package/dist/simple-tree/core/schemaCaching.js +10 -1
- package/dist/simple-tree/core/schemaCaching.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +78 -7
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +219 -30
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/types.d.ts +23 -8
- package/dist/simple-tree/core/types.d.ts.map +1 -1
- package/dist/simple-tree/core/types.js.map +1 -1
- package/dist/simple-tree/core/withType.d.ts +3 -2
- package/dist/simple-tree/core/withType.d.ts.map +1 -1
- package/dist/simple-tree/core/withType.js.map +1 -1
- package/dist/simple-tree/index.d.ts +7 -9
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +15 -6
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +7 -9
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +13 -11
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts +1 -1
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +38 -29
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/objectNode.d.ts +9 -7
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +37 -31
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/proxies.d.ts +1 -14
- package/dist/simple-tree/proxies.d.ts.map +1 -1
- package/dist/simple-tree/proxies.js +12 -15
- package/dist/simple-tree/proxies.js.map +1 -1
- package/dist/simple-tree/proxyBinding.d.ts +2 -62
- package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
- package/dist/simple-tree/proxyBinding.js +8 -181
- package/dist/simple-tree/proxyBinding.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +7 -7
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +4 -4
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/toFlexSchema.d.ts +11 -1
- package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
- package/dist/simple-tree/toFlexSchema.js +54 -31
- package/dist/simple-tree/toFlexSchema.js.map +1 -1
- package/dist/simple-tree/toMapTree.d.ts +25 -37
- package/dist/simple-tree/toMapTree.d.ts.map +1 -1
- package/dist/simple-tree/toMapTree.js +53 -16
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +7 -10
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/typesUnsafe.d.ts +13 -13
- package/dist/simple-tree/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/walkSchema.d.ts +26 -0
- package/dist/simple-tree/walkSchema.d.ts.map +1 -0
- package/dist/simple-tree/walkSchema.js +49 -0
- package/dist/simple-tree/walkSchema.js.map +1 -0
- package/dist/treeFactory.d.ts +2 -1
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +2 -1
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/typeUtils.d.ts +2 -2
- package/dist/util/typeUtils.js.map +1 -1
- package/legacy.d.ts +11 -0
- package/lib/alpha.d.ts +102 -0
- package/lib/beta.d.ts +6 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/{revertible/revertible.d.ts → revertible.d.ts} +12 -0
- package/lib/core/revertible.d.ts.map +1 -0
- package/lib/core/revertible.js.map +1 -0
- package/lib/core/schema-stored/format.d.ts +3 -3
- package/lib/core/schema-stored/format.js +1 -1
- package/lib/core/schema-stored/format.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +2 -7
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +4 -6
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
- package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.d.ts +4 -6
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +15 -1
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts +0 -1
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +1 -0
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/visitDelta.d.ts +7 -2
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/events/emitter.d.ts +127 -0
- package/lib/events/emitter.d.ts.map +1 -0
- package/lib/events/{events.js → emitter.js} +49 -27
- package/lib/events/emitter.js.map +1 -0
- package/lib/events/index.d.ts +2 -1
- package/lib/events/index.d.ts.map +1 -1
- package/lib/events/index.js +1 -1
- package/lib/events/index.js.map +1 -1
- package/lib/events/interop.d.ts +36 -0
- package/lib/events/interop.d.ts.map +1 -0
- package/{src/core/revertible/index.ts → lib/events/interop.js} +2 -2
- package/lib/events/interop.js.map +1 -0
- package/lib/events/listeners.d.ts +65 -0
- package/lib/events/listeners.d.ts.map +1 -0
- package/lib/{core/revertible/index.js → events/listeners.js} +2 -2
- package/lib/events/listeners.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +25 -7
- package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +37 -16
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +4 -2
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +12 -5
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +15 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +28 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +3 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -4
- package/lib/feature-libraries/default-schema/defaultEditBuilder.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 +35 -35
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +83 -116
- package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
- package/lib/feature-libraries/flex-tree/context.d.ts +30 -14
- package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/context.js +10 -7
- package/lib/feature-libraries/flex-tree/context.js.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +57 -281
- package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js +15 -31
- package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
- package/lib/feature-libraries/flex-tree/index.d.ts +2 -3
- package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/index.js +2 -2
- package/lib/feature-libraries/flex-tree/index.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +3 -3
- package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyEntity.js +2 -10
- package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.d.ts +26 -29
- package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +11 -16
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts +6 -34
- package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +24 -156
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/flex-tree/unboxed.d.ts +4 -16
- package/lib/feature-libraries/flex-tree/unboxed.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/unboxed.js +5 -37
- package/lib/feature-libraries/flex-tree/unboxed.js.map +1 -1
- package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -2
- package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
- package/lib/feature-libraries/flex-tree/utilities.js +3 -6
- package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +4 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +3 -5
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +5 -5
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +3 -6
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/discrepancies.js +3 -13
- package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +2 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +12 -5
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +6 -6
- package/lib/feature-libraries/schema-index/format.d.ts +3 -3
- package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
- package/lib/feature-libraries/storedToViewSchema.js +3 -5
- package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
- package/lib/feature-libraries/typed-schema/flexList.d.ts +3 -3
- package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
- package/lib/feature-libraries/typed-schema/index.d.ts +2 -2
- package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/index.js +2 -2
- 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 +9 -11
- package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
- package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +17 -48
- package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/typedTreeSchema.js +5 -36
- package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
- package/lib/feature-libraries/typed-schema/view.d.ts +4 -6
- package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
- package/lib/feature-libraries/typed-schema/view.js +5 -4
- package/lib/feature-libraries/typed-schema/view.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +83 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/checkoutFlexTreeView.d.ts +53 -0
- package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -0
- package/lib/shared-tree/{treeView.js → checkoutFlexTreeView.js} +26 -5
- package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -0
- package/lib/shared-tree/index.d.ts +3 -3
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +15 -4
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +8 -9
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +9 -4
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +26 -13
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +2 -2
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +3 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeEnricher.js +6 -2
- package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts +3 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +3 -2
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts +2 -1
- package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
- package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
- package/lib/shared-tree/treeApi.d.ts +1 -3
- package/lib/shared-tree/treeApi.d.ts.map +1 -1
- package/lib/shared-tree/treeApi.js +7 -5
- package/lib/shared-tree/treeApi.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +2 -13
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +18 -2
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.js +1 -1
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +2 -2
- package/lib/simple-tree/api/create.js.map +1 -1
- package/{dist/simple-tree → lib/simple-tree/api}/getJsonSchema.d.ts +1 -1
- package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -0
- package/lib/simple-tree/{getJsonSchema.js → api/getJsonSchema.js} +1 -1
- package/lib/simple-tree/api/getJsonSchema.js.map +1 -0
- package/{dist/simple-tree → lib/simple-tree/api}/getSimpleSchema.d.ts +1 -1
- package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -0
- package/lib/simple-tree/{getSimpleSchema.js → api/getSimpleSchema.js} +1 -1
- package/lib/simple-tree/api/getSimpleSchema.js.map +1 -0
- package/lib/simple-tree/api/index.d.ts +5 -0
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +3 -0
- package/lib/simple-tree/api/index.js.map +1 -1
- package/{dist/simple-tree → lib/simple-tree/api}/jsonSchema.d.ts +1 -1
- package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -0
- package/lib/simple-tree/api/jsonSchema.js.map +1 -0
- package/lib/simple-tree/api/schemaFactory.d.ts +45 -14
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +43 -12
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/{simpleSchema.d.ts → api/simpleSchema.d.ts} +4 -4
- package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -0
- package/lib/simple-tree/api/simpleSchema.js.map +1 -0
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -0
- package/lib/simple-tree/{simpleSchemaToJsonSchema.js → api/simpleSchemaToJsonSchema.js} +4 -4
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -0
- package/lib/simple-tree/api/tree.d.ts +1 -21
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +2 -34
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeApiBeta.d.ts +79 -0
- package/lib/simple-tree/api/treeApiBeta.d.ts.map +1 -0
- package/lib/simple-tree/api/treeApiBeta.js +23 -0
- package/lib/simple-tree/api/treeApiBeta.js.map +1 -0
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +53 -23
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +1 -1
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/{viewSchemaToSimpleSchema.d.ts → api/viewSchemaToSimpleSchema.d.ts} +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -0
- package/lib/simple-tree/{viewSchemaToSimpleSchema.js → api/viewSchemaToSimpleSchema.js} +4 -4
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -0
- package/lib/simple-tree/arrayNode.d.ts +2 -2
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +36 -41
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +2 -2
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +2 -2
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/schemaCaching.d.ts +5 -0
- package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -1
- package/lib/simple-tree/core/schemaCaching.js +8 -0
- package/lib/simple-tree/core/schemaCaching.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +78 -7
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +211 -24
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/types.d.ts +23 -8
- package/lib/simple-tree/core/types.d.ts.map +1 -1
- package/lib/simple-tree/core/types.js.map +1 -1
- package/lib/simple-tree/core/withType.d.ts +3 -2
- package/lib/simple-tree/core/withType.d.ts.map +1 -1
- package/lib/simple-tree/core/withType.js.map +1 -1
- package/lib/simple-tree/index.d.ts +7 -9
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +5 -5
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +7 -9
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +14 -12
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/mapNode.d.ts +1 -1
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +38 -29
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/objectNode.d.ts +9 -7
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +40 -34
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/proxies.d.ts +1 -14
- package/lib/simple-tree/proxies.d.ts.map +1 -1
- package/lib/simple-tree/proxies.js +11 -14
- package/lib/simple-tree/proxies.js.map +1 -1
- package/lib/simple-tree/proxyBinding.d.ts +2 -62
- package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
- package/lib/simple-tree/proxyBinding.js +6 -174
- package/lib/simple-tree/proxyBinding.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +7 -7
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +4 -4
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/toFlexSchema.d.ts +11 -1
- package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
- package/lib/simple-tree/toFlexSchema.js +29 -8
- package/lib/simple-tree/toFlexSchema.js.map +1 -1
- package/lib/simple-tree/toMapTree.d.ts +25 -37
- package/lib/simple-tree/toMapTree.d.ts.map +1 -1
- package/lib/simple-tree/toMapTree.js +54 -17
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +8 -11
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/typesUnsafe.d.ts +13 -13
- package/lib/simple-tree/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/walkSchema.d.ts +26 -0
- package/lib/simple-tree/walkSchema.d.ts.map +1 -0
- package/lib/simple-tree/walkSchema.js +43 -0
- package/lib/simple-tree/walkSchema.js.map +1 -0
- package/lib/treeFactory.d.ts +2 -1
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +2 -1
- package/lib/treeFactory.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/util/typeUtils.d.ts +2 -2
- package/lib/util/typeUtils.js.map +1 -1
- package/package.json +58 -36
- package/src/core/index.ts +1 -1
- package/src/core/{revertible/revertible.ts → revertible.ts} +15 -0
- package/src/core/schema-stored/format.ts +1 -1
- package/src/core/schema-stored/schema.ts +6 -13
- package/src/core/tree/anchorSet.ts +35 -9
- package/src/core/tree/detachedFieldIndex.ts +6 -5
- package/src/core/tree/visitDelta.ts +7 -2
- package/src/events/{events.ts → emitter.ts} +55 -134
- package/src/events/index.ts +7 -7
- package/src/events/interop.ts +49 -0
- package/src/events/listeners.ts +68 -0
- package/src/feature-libraries/chunked-forest/chunkTree.ts +63 -18
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +18 -4
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +33 -0
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +5 -3
- package/src/feature-libraries/flex-map-tree/index.ts +1 -0
- package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +135 -231
- package/src/feature-libraries/flex-tree/README.md +4 -75
- package/src/feature-libraries/flex-tree/context.ts +37 -16
- package/src/feature-libraries/flex-tree/flexTreeTypes.ts +69 -458
- package/src/feature-libraries/flex-tree/index.ts +7 -29
- package/src/feature-libraries/flex-tree/lazyEntity.ts +2 -11
- package/src/feature-libraries/flex-tree/lazyField.ts +49 -79
- package/src/feature-libraries/flex-tree/lazyNode.ts +26 -306
- package/src/feature-libraries/flex-tree/unboxed.ts +9 -68
- package/src/feature-libraries/flex-tree/utilities.ts +4 -8
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +4 -1
- package/src/feature-libraries/index.ts +2 -41
- package/src/feature-libraries/modular-schema/comparison.ts +4 -6
- package/src/feature-libraries/modular-schema/discrepancies.ts +7 -16
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -1
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +14 -4
- package/src/feature-libraries/storedToViewSchema.ts +5 -6
- package/src/feature-libraries/typed-schema/flexList.ts +3 -3
- package/src/feature-libraries/typed-schema/index.ts +1 -3
- package/src/feature-libraries/typed-schema/schemaCollection.ts +15 -17
- package/src/feature-libraries/typed-schema/typedTreeSchema.ts +35 -127
- package/src/feature-libraries/typed-schema/view.ts +4 -13
- package/src/index.ts +5 -1
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/checkoutFlexTreeView.ts +89 -0
- package/src/shared-tree/index.ts +2 -7
- package/src/shared-tree/schematizeTree.ts +23 -12
- package/src/shared-tree/schematizingTreeView.ts +34 -24
- package/src/shared-tree/sharedTree.ts +6 -1
- package/src/shared-tree/sharedTreeChangeEnricher.ts +6 -1
- package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
- package/src/shared-tree/sharedTreeEditBuilder.ts +9 -4
- package/src/shared-tree/treeApi.ts +10 -10
- package/src/shared-tree/treeCheckout.ts +26 -15
- package/src/shared-tree-core/branch.ts +1 -1
- package/src/simple-tree/ProxyBinding.md +23 -23
- package/src/simple-tree/api/create.ts +8 -3
- package/src/simple-tree/{getJsonSchema.ts → api/getJsonSchema.ts} +3 -3
- package/src/simple-tree/{getSimpleSchema.ts → api/getSimpleSchema.ts} +3 -3
- package/src/simple-tree/api/index.ts +20 -0
- package/src/simple-tree/{jsonSchema.ts → api/jsonSchema.ts} +1 -1
- package/src/simple-tree/api/schemaFactory.ts +44 -13
- package/src/simple-tree/{simpleSchema.ts → api/simpleSchema.ts} +4 -4
- package/src/simple-tree/{simpleSchemaToJsonSchema.ts → api/simpleSchemaToJsonSchema.ts} +4 -4
- package/src/simple-tree/api/tree.ts +2 -71
- package/src/simple-tree/api/treeApiBeta.ts +101 -0
- package/src/simple-tree/api/treeNodeApi.ts +63 -22
- package/src/simple-tree/api/verboseTree.ts +1 -1
- package/src/simple-tree/{viewSchemaToSimpleSchema.ts → api/viewSchemaToSimpleSchema.ts} +5 -5
- package/src/simple-tree/arrayNode.ts +38 -41
- package/src/simple-tree/core/index.ts +4 -0
- package/src/simple-tree/core/schemaCaching.ts +10 -0
- package/src/simple-tree/core/treeNodeKernel.ts +279 -27
- package/src/simple-tree/core/treeNodeSchema.ts +1 -1
- package/src/simple-tree/core/types.ts +23 -8
- package/src/simple-tree/core/withType.ts +3 -1
- package/src/simple-tree/index.ts +29 -20
- package/src/simple-tree/leafNodeSchema.ts +24 -28
- package/src/simple-tree/mapNode.ts +47 -29
- package/src/simple-tree/objectNode.ts +51 -46
- package/src/simple-tree/proxies.ts +22 -51
- package/src/simple-tree/proxyBinding.ts +3 -254
- package/src/simple-tree/schemaTypes.ts +8 -8
- package/src/simple-tree/toFlexSchema.ts +40 -7
- package/src/simple-tree/toMapTree.ts +113 -79
- package/src/simple-tree/treeNodeValid.ts +10 -13
- package/src/simple-tree/typesUnsafe.ts +13 -13
- package/src/simple-tree/walkSchema.ts +81 -0
- package/src/treeFactory.ts +2 -1
- package/src/util/typeUtils.ts +2 -2
- package/dist/core/revertible/index.d.ts.map +0 -1
- package/dist/core/revertible/index.js +0 -10
- package/dist/core/revertible/index.js.map +0 -1
- package/dist/core/revertible/revertible.d.ts.map +0 -1
- package/dist/core/revertible/revertible.js.map +0 -1
- package/dist/domains/index.d.ts +0 -8
- package/dist/domains/index.d.ts.map +0 -1
- package/dist/domains/index.js +0 -20
- package/dist/domains/index.js.map +0 -1
- package/dist/domains/json/index.d.ts +0 -7
- package/dist/domains/json/index.d.ts.map +0 -1
- package/dist/domains/json/index.js +0 -17
- package/dist/domains/json/index.js.map +0 -1
- package/dist/domains/json/jsonCursor.d.ts +0 -52
- package/dist/domains/json/jsonCursor.d.ts.map +0 -1
- package/dist/domains/json/jsonCursor.js +0 -197
- package/dist/domains/json/jsonCursor.js.map +0 -1
- package/dist/domains/json/jsonDomainSchema.d.ts +0 -24
- package/dist/domains/json/jsonDomainSchema.d.ts.map +0 -1
- package/dist/domains/json/jsonDomainSchema.js +0 -32
- package/dist/domains/json/jsonDomainSchema.js.map +0 -1
- package/dist/domains/leafDomain.d.ts +0 -72
- package/dist/domains/leafDomain.d.ts.map +0 -1
- package/dist/domains/leafDomain.js +0 -88
- package/dist/domains/leafDomain.js.map +0 -1
- package/dist/domains/schemaBuilder.d.ts +0 -103
- package/dist/domains/schemaBuilder.d.ts.map +0 -1
- package/dist/domains/schemaBuilder.js +0 -121
- package/dist/domains/schemaBuilder.js.map +0 -1
- package/dist/domains/testRecursiveDomain.d.ts +0 -17
- package/dist/domains/testRecursiveDomain.d.ts.map +0 -1
- package/dist/domains/testRecursiveDomain.js +0 -35
- package/dist/domains/testRecursiveDomain.js.map +0 -1
- package/dist/events/events.d.ts +0 -201
- package/dist/events/events.d.ts.map +0 -1
- package/dist/events/events.js.map +0 -1
- package/dist/feature-libraries/schemaBuilder.d.ts +0 -31
- package/dist/feature-libraries/schemaBuilder.d.ts.map +0 -1
- package/dist/feature-libraries/schemaBuilder.js +0 -40
- package/dist/feature-libraries/schemaBuilder.js.map +0 -1
- package/dist/feature-libraries/schemaBuilderBase.d.ts +0 -191
- package/dist/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
- package/dist/feature-libraries/schemaBuilderBase.js +0 -201
- package/dist/feature-libraries/schemaBuilderBase.js.map +0 -1
- package/dist/shared-tree/treeView.d.ts +0 -73
- package/dist/shared-tree/treeView.d.ts.map +0 -1
- package/dist/shared-tree/treeView.js.map +0 -1
- package/dist/simple-tree/getJsonSchema.d.ts.map +0 -1
- package/dist/simple-tree/getJsonSchema.js.map +0 -1
- package/dist/simple-tree/getSimpleSchema.d.ts.map +0 -1
- package/dist/simple-tree/getSimpleSchema.js.map +0 -1
- package/dist/simple-tree/jsonSchema.d.ts.map +0 -1
- package/dist/simple-tree/jsonSchema.js.map +0 -1
- package/dist/simple-tree/simpleSchema.d.ts.map +0 -1
- package/dist/simple-tree/simpleSchema.js.map +0 -1
- package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
- package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
- package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
- package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +0 -1
- package/lib/core/revertible/index.d.ts.map +0 -1
- package/lib/core/revertible/index.js.map +0 -1
- package/lib/core/revertible/revertible.d.ts.map +0 -1
- package/lib/core/revertible/revertible.js.map +0 -1
- package/lib/domains/index.d.ts +0 -8
- package/lib/domains/index.d.ts.map +0 -1
- package/lib/domains/index.js +0 -8
- package/lib/domains/index.js.map +0 -1
- package/lib/domains/json/index.d.ts +0 -7
- package/lib/domains/json/index.d.ts.map +0 -1
- package/lib/domains/json/index.js +0 -7
- package/lib/domains/json/index.js.map +0 -1
- package/lib/domains/json/jsonCursor.d.ts +0 -52
- package/lib/domains/json/jsonCursor.d.ts.map +0 -1
- package/lib/domains/json/jsonCursor.js +0 -192
- package/lib/domains/json/jsonCursor.js.map +0 -1
- package/lib/domains/json/jsonDomainSchema.d.ts +0 -24
- package/lib/domains/json/jsonDomainSchema.d.ts.map +0 -1
- package/lib/domains/json/jsonDomainSchema.js +0 -29
- package/lib/domains/json/jsonDomainSchema.js.map +0 -1
- package/lib/domains/leafDomain.d.ts +0 -72
- package/lib/domains/leafDomain.d.ts.map +0 -1
- package/lib/domains/leafDomain.js +0 -85
- package/lib/domains/leafDomain.js.map +0 -1
- package/lib/domains/schemaBuilder.d.ts +0 -103
- package/lib/domains/schemaBuilder.d.ts.map +0 -1
- package/lib/domains/schemaBuilder.js +0 -117
- package/lib/domains/schemaBuilder.js.map +0 -1
- package/lib/domains/testRecursiveDomain.d.ts +0 -17
- package/lib/domains/testRecursiveDomain.d.ts.map +0 -1
- package/lib/domains/testRecursiveDomain.js +0 -32
- package/lib/domains/testRecursiveDomain.js.map +0 -1
- package/lib/events/events.d.ts +0 -201
- package/lib/events/events.d.ts.map +0 -1
- package/lib/events/events.js.map +0 -1
- package/lib/feature-libraries/schemaBuilder.d.ts +0 -31
- package/lib/feature-libraries/schemaBuilder.d.ts.map +0 -1
- package/lib/feature-libraries/schemaBuilder.js +0 -36
- package/lib/feature-libraries/schemaBuilder.js.map +0 -1
- package/lib/feature-libraries/schemaBuilderBase.d.ts +0 -191
- package/lib/feature-libraries/schemaBuilderBase.d.ts.map +0 -1
- package/lib/feature-libraries/schemaBuilderBase.js +0 -195
- package/lib/feature-libraries/schemaBuilderBase.js.map +0 -1
- package/lib/shared-tree/treeView.d.ts +0 -73
- package/lib/shared-tree/treeView.d.ts.map +0 -1
- package/lib/shared-tree/treeView.js.map +0 -1
- package/lib/simple-tree/getJsonSchema.d.ts.map +0 -1
- package/lib/simple-tree/getJsonSchema.js.map +0 -1
- package/lib/simple-tree/getSimpleSchema.d.ts.map +0 -1
- package/lib/simple-tree/getSimpleSchema.js.map +0 -1
- package/lib/simple-tree/jsonSchema.d.ts.map +0 -1
- package/lib/simple-tree/jsonSchema.js.map +0 -1
- package/lib/simple-tree/simpleSchema.d.ts.map +0 -1
- package/lib/simple-tree/simpleSchema.js.map +0 -1
- package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +0 -1
- package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +0 -1
- package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +0 -1
- package/src/domains/README.md +0 -6
- package/src/domains/fence.json +0 -5
- package/src/domains/index.ts +0 -19
- package/src/domains/json/fence.json +0 -5
- package/src/domains/json/index.ts +0 -13
- package/src/domains/json/jsonCursor.ts +0 -247
- package/src/domains/json/jsonDomainSchema.ts +0 -47
- package/src/domains/leafDomain.ts +0 -97
- package/src/domains/schemaBuilder.ts +0 -153
- package/src/domains/testRecursiveDomain.ts +0 -38
- package/src/events/fence.json +0 -5
- package/src/feature-libraries/schemaBuilder.ts +0 -45
- package/src/feature-libraries/schemaBuilderBase.ts +0 -393
- package/src/shared-tree/treeView.ts +0 -113
- /package/dist/core/{revertible/revertible.js → revertible.js} +0 -0
- /package/dist/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
- /package/dist/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
- /package/dist/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
- /package/lib/core/{revertible/revertible.js → revertible.js} +0 -0
- /package/lib/simple-tree/{jsonSchema.js → api/jsonSchema.js} +0 -0
- /package/lib/simple-tree/{simpleSchema.js → api/simpleSchema.js} +0 -0
- /package/lib/simple-tree/{simpleSchemaToJsonSchema.d.ts → api/simpleSchemaToJsonSchema.d.ts} +0 -0
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { type Anchor, type AnchorNode, type FieldKey, type ITreeSubscriptionCursor, type TreeNavigationResult, type TreeNodeSchemaIdentifier, type
|
|
6
|
-
import { type
|
|
5
|
+
import { type Anchor, type AnchorNode, type FieldKey, type ITreeSubscriptionCursor, type TreeNavigationResult, type TreeNodeSchemaIdentifier, type Value } from "../../core/index.js";
|
|
6
|
+
import { type FlexTreeNodeSchema } from "../typed-schema/index.js";
|
|
7
7
|
import type { Context } from "./context.js";
|
|
8
|
-
import { FlexTreeEntityKind, type FlexTreeField, type
|
|
8
|
+
import { FlexTreeEntityKind, type FlexTreeField, type FlexTreeNode, flexTreeMarker } from "./flexTreeTypes.js";
|
|
9
9
|
import { LazyEntity, forgetAnchorSymbol, tryMoveCursorToAnchorSymbol } from "./lazyEntity.js";
|
|
10
10
|
/**
|
|
11
11
|
* @param cursor - This does not take ownership of this cursor: Node will fork it as needed.
|
|
@@ -14,16 +14,13 @@ export declare function makeTree(context: Context, cursor: ITreeSubscriptionCurs
|
|
|
14
14
|
/**
|
|
15
15
|
* Lazy implementation of {@link FlexTreeNode}.
|
|
16
16
|
*/
|
|
17
|
-
export declare
|
|
17
|
+
export declare class LazyTreeNode<TSchema extends FlexTreeNodeSchema = FlexTreeNodeSchema> extends LazyEntity<TSchema, Anchor> implements FlexTreeNode {
|
|
18
18
|
#private;
|
|
19
19
|
readonly anchorNode: AnchorNode;
|
|
20
20
|
get [flexTreeMarker](): FlexTreeEntityKind.Node;
|
|
21
|
-
|
|
22
|
-
* Enumerable own property providing a more JS object friendly alternative to "schema".
|
|
23
|
-
*/
|
|
24
|
-
readonly type: TreeNodeSchemaIdentifier;
|
|
21
|
+
get schema(): TreeNodeSchemaIdentifier;
|
|
25
22
|
constructor(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor, anchorNode: AnchorNode, anchor: Anchor);
|
|
26
|
-
is
|
|
23
|
+
is(schema: FlexTreeNodeSchema): boolean;
|
|
27
24
|
protected [tryMoveCursorToAnchorSymbol](cursor: ITreeSubscriptionCursor): TreeNavigationResult;
|
|
28
25
|
protected [forgetAnchorSymbol](): void;
|
|
29
26
|
get value(): Value;
|
|
@@ -34,31 +31,6 @@ export declare abstract class LazyTreeNode<TSchema extends FlexTreeNodeSchema =
|
|
|
34
31
|
readonly parent: FlexTreeField;
|
|
35
32
|
readonly index: number;
|
|
36
33
|
};
|
|
37
|
-
}
|
|
38
|
-
export declare class LazyMap<TSchema extends FlexMapNodeSchema> extends LazyTreeNode<TSchema> implements FlexTreeMapNode<TSchema> {
|
|
39
|
-
constructor(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor, anchorNode: AnchorNode, anchor: Anchor);
|
|
40
34
|
keys(): IterableIterator<FieldKey>;
|
|
41
|
-
values(): IterableIterator<FlexTreeUnboxField<TSchema["info"], "notEmpty">>;
|
|
42
|
-
entries(): IterableIterator<[
|
|
43
|
-
FieldKey,
|
|
44
|
-
FlexTreeUnboxField<TSchema["info"], "notEmpty">
|
|
45
|
-
]>;
|
|
46
|
-
forEach(callbackFn: (value: FlexTreeUnboxField<TSchema["info"], "notEmpty">, key: FieldKey, map: FlexTreeMapNode<TSchema>) => void, thisArg?: unknown): void;
|
|
47
|
-
getBoxed(key: string): FlexTreeTypedField<TSchema["info"]>;
|
|
48
|
-
boxedIterator(): IterableIterator<FlexTreeTypedField<TSchema["info"]>>;
|
|
49
|
-
[Symbol.iterator](): IterableIterator<[
|
|
50
|
-
FieldKey,
|
|
51
|
-
FlexTreeUnboxField<TSchema["info"], "notEmpty">
|
|
52
|
-
]>;
|
|
53
|
-
}
|
|
54
|
-
export declare class LazyLeaf<TSchema extends LeafNodeSchema> extends LazyTreeNode<TSchema> implements FlexTreeLeafNode<TSchema> {
|
|
55
|
-
constructor(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor, anchorNode: AnchorNode, anchor: Anchor);
|
|
56
|
-
get value(): TreeValue<TSchema["info"]>;
|
|
57
35
|
}
|
|
58
|
-
/**
|
|
59
|
-
* {@link reservedObjectNodeFieldPropertyNames} but as a set.
|
|
60
|
-
*/
|
|
61
|
-
export declare const reservedObjectNodeFieldPropertyNameSet: ReadonlySet<string>;
|
|
62
|
-
export declare function propertyNameFromFieldKey<T extends string>(key: T): PropertyNameFromFieldKey<T>;
|
|
63
|
-
export declare function buildLazyObjectNode<TSchema extends FlexObjectNodeSchema>(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor, anchorNode: AnchorNode, anchor: Anchor): LazyTreeNode<TSchema> & FlexTreeObjectNodeTyped<TSchema>;
|
|
64
36
|
//# sourceMappingURL=lazyNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazyNode.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,MAAM,EACX,KAAK,UAAU,EAEf,KAAK,QAAQ,EACb,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,
|
|
1
|
+
{"version":3,"file":"lazyNode.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,MAAM,EACX,KAAK,UAAU,EAEf,KAAK,QAAQ,EACb,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,KAAK,EAIV,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAmB,KAAK,kBAAkB,EAAE,MAAM,0BAA0B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AAI,gBAAgB,CAAC,QAAQ,CAAC;CAGzC"}
|
|
@@ -16,7 +16,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
16
16
|
};
|
|
17
17
|
var _LazyTreeNode_removeDeleteCallback;
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.LazyTreeNode = exports.makeTree = void 0;
|
|
20
20
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
21
21
|
const index_js_1 = require("../../core/index.js");
|
|
22
22
|
const index_js_2 = require("../../util/index.js");
|
|
@@ -25,7 +25,6 @@ const index_js_4 = require("../typed-schema/index.js");
|
|
|
25
25
|
const flexTreeTypes_js_1 = require("./flexTreeTypes.js");
|
|
26
26
|
const lazyEntity_js_1 = require("./lazyEntity.js");
|
|
27
27
|
const lazyField_js_1 = require("./lazyField.js");
|
|
28
|
-
const unboxed_js_1 = require("./unboxed.js");
|
|
29
28
|
/**
|
|
30
29
|
* @param cursor - This does not take ownership of this cursor: Node will fork it as needed.
|
|
31
30
|
*/
|
|
@@ -40,8 +39,8 @@ function makeTree(context, cursor) {
|
|
|
40
39
|
(0, internal_1.assert)(cached instanceof LazyTreeNode, 0x92c /* Expected LazyTreeNode */);
|
|
41
40
|
return cached;
|
|
42
41
|
}
|
|
43
|
-
const schema = context.
|
|
44
|
-
return
|
|
42
|
+
const schema = context.flexSchema.nodeSchema.get(cursor.type) ?? (0, index_js_2.fail)("missing schema");
|
|
43
|
+
return new LazyTreeNode(context, schema, cursor, anchorNode, anchor);
|
|
45
44
|
}
|
|
46
45
|
exports.makeTree = makeTree;
|
|
47
46
|
function cleanupTree(anchor) {
|
|
@@ -49,19 +48,6 @@ function cleanupTree(anchor) {
|
|
|
49
48
|
(0, internal_1.assert)(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);
|
|
50
49
|
cached[index_js_2.disposeSymbol]();
|
|
51
50
|
}
|
|
52
|
-
function buildSubclass(context, schema, cursor, anchorNode, anchor) {
|
|
53
|
-
if ((0, index_js_4.schemaIsMap)(schema)) {
|
|
54
|
-
return new LazyMap(context, schema, cursor, anchorNode, anchor);
|
|
55
|
-
}
|
|
56
|
-
if ((0, index_js_4.schemaIsLeaf)(schema)) {
|
|
57
|
-
return new LazyLeaf(context, schema, cursor, anchorNode, anchor);
|
|
58
|
-
}
|
|
59
|
-
if ((0, index_js_4.schemaIsObjectNode)(schema)) {
|
|
60
|
-
return buildLazyObjectNode(context, schema, cursor, anchorNode, anchor);
|
|
61
|
-
}
|
|
62
|
-
// TODO: there should be a common fallback that works for cases without a specialized implementation.
|
|
63
|
-
(0, index_js_2.fail)("unrecognized node kind");
|
|
64
|
-
}
|
|
65
51
|
/**
|
|
66
52
|
* Lazy implementation of {@link FlexTreeNode}.
|
|
67
53
|
*/
|
|
@@ -69,6 +55,9 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
|
|
|
69
55
|
get [(_LazyTreeNode_removeDeleteCallback = new WeakMap(), flexTreeTypes_js_1.flexTreeMarker)]() {
|
|
70
56
|
return flexTreeTypes_js_1.FlexTreeEntityKind.Node;
|
|
71
57
|
}
|
|
58
|
+
get schema() {
|
|
59
|
+
return this.flexSchema.name;
|
|
60
|
+
}
|
|
72
61
|
constructor(context, schema, cursor, anchorNode, anchor) {
|
|
73
62
|
super(context, schema, cursor, anchor);
|
|
74
63
|
this.anchorNode = anchorNode;
|
|
@@ -77,12 +66,11 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
|
|
|
77
66
|
(0, internal_1.assert)(cursor.mode === 0 /* CursorLocationType.Nodes */, 0x783 /* must be in nodes mode */);
|
|
78
67
|
anchorNode.slots.set(flexTreeTypes_js_1.flexTreeSlot, this);
|
|
79
68
|
__classPrivateFieldSet(this, _LazyTreeNode_removeDeleteCallback, anchorNode.on("afterDestroy", cleanupTree), "f");
|
|
80
|
-
(0, internal_1.assert)(this.context.
|
|
81
|
-
this.type = schema.name;
|
|
69
|
+
(0, internal_1.assert)(this.context.flexSchema.nodeSchema.get(this.flexSchema.name) !== undefined, 0x784 /* There is no explicit schema for this node type. Ensure that the type is correct and the schema for it was added to the TreeStoredSchema */);
|
|
82
70
|
}
|
|
83
71
|
is(schema) {
|
|
84
|
-
(0, internal_1.assert)(this.context.
|
|
85
|
-
return this.
|
|
72
|
+
(0, internal_1.assert)(this.context.flexSchema.nodeSchema.get(schema.name) === schema, 0x785 /* Narrowing must be done to a schema that exists in this context */);
|
|
73
|
+
return this.flexSchema === schema;
|
|
86
74
|
}
|
|
87
75
|
[lazyEntity_js_1.tryMoveCursorToAnchorSymbol](cursor) {
|
|
88
76
|
return this.context.checkout.forest.tryMoveCursorToNode(this[lazyEntity_js_1.anchorSymbol], cursor);
|
|
@@ -99,7 +87,7 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
|
|
|
99
87
|
return this[lazyEntity_js_1.cursorSymbol].value;
|
|
100
88
|
}
|
|
101
89
|
tryGetField(fieldKey) {
|
|
102
|
-
const schema = this.
|
|
90
|
+
const schema = this.flexSchema.getFieldSchema(fieldKey);
|
|
103
91
|
return (0, index_js_1.inCursorField)(this[lazyEntity_js_1.cursorSymbol], fieldKey, (cursor) => {
|
|
104
92
|
if (cursor.getFieldLength() === 0) {
|
|
105
93
|
return undefined;
|
|
@@ -108,10 +96,13 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
|
|
|
108
96
|
});
|
|
109
97
|
}
|
|
110
98
|
getBoxed(key) {
|
|
111
|
-
|
|
99
|
+
const fieldSchema = this.flexSchema.getFieldSchema(key);
|
|
100
|
+
return (0, index_js_1.inCursorField)(this[lazyEntity_js_1.cursorSymbol], key, (cursor) => {
|
|
101
|
+
return (0, lazyField_js_1.makeField)(this.context, fieldSchema, cursor);
|
|
102
|
+
});
|
|
112
103
|
}
|
|
113
104
|
boxedIterator() {
|
|
114
|
-
return (0, index_js_1.mapCursorFields)(this[lazyEntity_js_1.cursorSymbol], (cursor) => (0, lazyField_js_1.makeField)(this.context, this.
|
|
105
|
+
return (0, index_js_1.mapCursorFields)(this[lazyEntity_js_1.cursorSymbol], (cursor) => (0, lazyField_js_1.makeField)(this.context, this.flexSchema.getFieldSchema(cursor.getFieldKey()), cursor)).values();
|
|
115
106
|
}
|
|
116
107
|
get parentField() {
|
|
117
108
|
const cursor = this[lazyEntity_js_1.cursorSymbol];
|
|
@@ -126,12 +117,12 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
|
|
|
126
117
|
// Parent field is a detached sequence, and thus needs special handling for its schema.
|
|
127
118
|
// eslint-disable-next-line unicorn/prefer-ternary
|
|
128
119
|
if (key === index_js_1.rootFieldKey) {
|
|
129
|
-
fieldSchema = this.context.
|
|
120
|
+
fieldSchema = this.context.flexSchema.rootFieldSchema;
|
|
130
121
|
}
|
|
131
122
|
else {
|
|
132
123
|
// All fields (in the flex tree API) have a schema.
|
|
133
124
|
// Since currently there is no known schema for detached field other than the special default root:
|
|
134
|
-
// give all other detached fields a schema of sequence of
|
|
125
|
+
// give all other detached fields a schema of sequence of anything.
|
|
135
126
|
// That schema is the only one that is safe since its the only field schema that allows any possible field content.
|
|
136
127
|
//
|
|
137
128
|
// TODO:
|
|
@@ -140,16 +131,18 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
|
|
|
140
131
|
// 2. Remove (and its inverse) start working on subsequences or fields contents (like everything in a sequence or optional field) and not just single nodes.
|
|
141
132
|
// 3. Possibly other unknown cases.
|
|
142
133
|
// Additionally this approach makes it possible for a user to take a FlexTree node, get its parent, check its schema, down cast based on that, then edit that detached field (ex: removing the node in it).
|
|
143
|
-
// This MIGHT work properly with existing merge resolution logic (it must keep client in sync and be unable to violate schema), but this either needs robust testing or to be explicitly banned (error before
|
|
134
|
+
// This MIGHT work properly with existing merge resolution logic (it must keep client in sync and be unable to violate schema), but this either needs robust testing or to be explicitly banned (error before sending the op).
|
|
144
135
|
// Issues like replacing a node in the a removed sequenced then undoing the remove could easily violate schema if not everything works exactly right!
|
|
145
|
-
fieldSchema = index_js_4.FlexFieldSchema.create(index_js_3.FieldKinds.sequence, [
|
|
136
|
+
fieldSchema = index_js_4.FlexFieldSchema.create(index_js_3.FieldKinds.sequence, [
|
|
137
|
+
...this.context.flexSchema.nodeSchema.values(),
|
|
138
|
+
]);
|
|
146
139
|
}
|
|
147
140
|
}
|
|
148
141
|
else {
|
|
149
142
|
cursor.exitField();
|
|
150
143
|
const parentType = cursor.type;
|
|
151
144
|
cursor.enterField(key);
|
|
152
|
-
const nodeSchema = this.context.
|
|
145
|
+
const nodeSchema = this.context.flexSchema.nodeSchema.get(parentType) ??
|
|
153
146
|
(0, index_js_2.fail)("requested schema that does not exist");
|
|
154
147
|
fieldSchema = nodeSchema.getFieldSchema(key);
|
|
155
148
|
}
|
|
@@ -157,138 +150,9 @@ class LazyTreeNode extends lazyEntity_js_1.LazyEntity {
|
|
|
157
150
|
cursor.enterNode(index);
|
|
158
151
|
return { parent: proxifiedField, index };
|
|
159
152
|
}
|
|
160
|
-
}
|
|
161
|
-
exports.LazyTreeNode = LazyTreeNode;
|
|
162
|
-
class LazyMap extends LazyTreeNode {
|
|
163
|
-
constructor(context, schema, cursor, anchorNode, anchor) {
|
|
164
|
-
super(context, schema, cursor, anchorNode, anchor);
|
|
165
|
-
}
|
|
166
153
|
keys() {
|
|
167
154
|
return (0, index_js_1.mapCursorFields)(this[lazyEntity_js_1.cursorSymbol], (cursor) => cursor.getFieldKey()).values();
|
|
168
155
|
}
|
|
169
|
-
values() {
|
|
170
|
-
return (0, index_js_1.mapCursorFields)(this[lazyEntity_js_1.cursorSymbol], (cursor) => (0, unboxed_js_1.unboxedField)(this.context, this.schema.info, cursor)).values();
|
|
171
|
-
}
|
|
172
|
-
entries() {
|
|
173
|
-
return (0, index_js_1.mapCursorFields)(this[lazyEntity_js_1.cursorSymbol], (cursor) => {
|
|
174
|
-
const entry = [
|
|
175
|
-
cursor.getFieldKey(),
|
|
176
|
-
(0, unboxed_js_1.unboxedField)(this.context, this.schema.info, cursor),
|
|
177
|
-
];
|
|
178
|
-
return entry;
|
|
179
|
-
}).values();
|
|
180
|
-
}
|
|
181
|
-
forEach(callbackFn, thisArg) {
|
|
182
|
-
const fn = thisArg !== undefined ? callbackFn.bind(thisArg) : callbackFn;
|
|
183
|
-
for (const [key, value] of this.entries()) {
|
|
184
|
-
fn(value, key, this);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
getBoxed(key) {
|
|
188
|
-
return super.getBoxed((0, index_js_2.brand)(key));
|
|
189
|
-
}
|
|
190
|
-
boxedIterator() {
|
|
191
|
-
return super.boxedIterator();
|
|
192
|
-
}
|
|
193
|
-
[Symbol.iterator]() {
|
|
194
|
-
return this.entries();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
exports.LazyMap = LazyMap;
|
|
198
|
-
class LazyLeaf extends LazyTreeNode {
|
|
199
|
-
constructor(context, schema, cursor, anchorNode, anchor) {
|
|
200
|
-
super(context, schema, cursor, anchorNode, anchor);
|
|
201
|
-
}
|
|
202
|
-
get value() {
|
|
203
|
-
return super.value;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
exports.LazyLeaf = LazyLeaf;
|
|
207
|
-
/**
|
|
208
|
-
* {@link reservedObjectNodeFieldPropertyNames} but as a set.
|
|
209
|
-
*/
|
|
210
|
-
exports.reservedObjectNodeFieldPropertyNameSet = new Set(flexTreeTypes_js_1.reservedObjectNodeFieldPropertyNames);
|
|
211
|
-
function propertyNameFromFieldKey(key) {
|
|
212
|
-
if (exports.reservedObjectNodeFieldPropertyNameSet.has(key)) {
|
|
213
|
-
return `field${(0, index_js_2.capitalize)(key)}`;
|
|
214
|
-
}
|
|
215
|
-
for (const prefix of flexTreeTypes_js_1.reservedObjectNodeFieldPropertyNamePrefixes) {
|
|
216
|
-
if (key.startsWith(prefix)) {
|
|
217
|
-
const afterPrefix = key.slice(prefix.length);
|
|
218
|
-
if (afterPrefix === (0, index_js_2.capitalize)(afterPrefix)) {
|
|
219
|
-
return `field${(0, index_js_2.capitalize)(key)}`;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return key;
|
|
224
|
-
}
|
|
225
|
-
exports.propertyNameFromFieldKey = propertyNameFromFieldKey;
|
|
226
|
-
function buildLazyObjectNode(context, schema, cursor, anchorNode, anchor) {
|
|
227
|
-
const objectNodeClass = (0, index_js_2.getOrCreate)(cachedStructClasses, schema, () => buildStructClass(schema));
|
|
228
|
-
return new objectNodeClass(context, cursor, anchorNode, anchor);
|
|
229
|
-
}
|
|
230
|
-
exports.buildLazyObjectNode = buildLazyObjectNode;
|
|
231
|
-
const cachedStructClasses = new WeakMap();
|
|
232
|
-
function getBoxedField(objectNode, key, fieldSchema) {
|
|
233
|
-
return (0, index_js_1.inCursorField)(objectNode[lazyEntity_js_1.cursorSymbol], key, (cursor) => {
|
|
234
|
-
return (0, lazyField_js_1.makeField)(objectNode.context, fieldSchema, cursor);
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
function buildStructClass(schema) {
|
|
238
|
-
const propertyDescriptorMap = {};
|
|
239
|
-
for (const [key, fieldSchema] of schema.objectNodeFields) {
|
|
240
|
-
const escapedKey = propertyNameFromFieldKey(key);
|
|
241
|
-
let setter;
|
|
242
|
-
switch (fieldSchema.kind) {
|
|
243
|
-
case index_js_3.FieldKinds.optional: {
|
|
244
|
-
setter = function (newContent) {
|
|
245
|
-
const field = getBoxedField(this, key, fieldSchema);
|
|
246
|
-
field.editor.set(newContent, field.length === 0);
|
|
247
|
-
};
|
|
248
|
-
break;
|
|
249
|
-
}
|
|
250
|
-
case index_js_3.FieldKinds.required: {
|
|
251
|
-
setter = function (newContent) {
|
|
252
|
-
const field = getBoxedField(this, key, fieldSchema);
|
|
253
|
-
field.editor.set(newContent);
|
|
254
|
-
};
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
default:
|
|
258
|
-
setter = undefined;
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
// Create getter and setter (when appropriate) for property
|
|
262
|
-
propertyDescriptorMap[escapedKey] = {
|
|
263
|
-
enumerable: true,
|
|
264
|
-
get() {
|
|
265
|
-
return (0, index_js_1.inCursorField)(this[lazyEntity_js_1.cursorSymbol], key, (cursor) => (0, unboxed_js_1.unboxedField)(this.context, fieldSchema, cursor));
|
|
266
|
-
},
|
|
267
|
-
set: setter,
|
|
268
|
-
};
|
|
269
|
-
// Create set method for property (when appropriate)
|
|
270
|
-
if (setter !== undefined) {
|
|
271
|
-
propertyDescriptorMap[`set${(0, index_js_2.capitalize)(escapedKey)}`] = {
|
|
272
|
-
enumerable: false,
|
|
273
|
-
get() {
|
|
274
|
-
return setter;
|
|
275
|
-
},
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
propertyDescriptorMap[`boxed${(0, index_js_2.capitalize)(escapedKey)}`] = {
|
|
279
|
-
enumerable: false,
|
|
280
|
-
get() {
|
|
281
|
-
return getBoxedField(this, key, fieldSchema);
|
|
282
|
-
},
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
// This must implement `StructTyped<TSchema>`, but TypeScript can't constrain it to do so.
|
|
286
|
-
class CustomStruct extends LazyTreeNode {
|
|
287
|
-
constructor(context, cursor, anchorNode, anchor) {
|
|
288
|
-
super(context, schema, cursor, anchorNode, anchor);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
Object.defineProperties(CustomStruct.prototype, propertyDescriptorMap);
|
|
292
|
-
return CustomStruct;
|
|
293
156
|
}
|
|
157
|
+
exports.LazyTreeNode = LazyTreeNode;
|
|
294
158
|
//# sourceMappingURL=lazyNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazyNode.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/lazyNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,kEAA6D;AAE7D,kDAa6B;AAC7B,kDAA0F;A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AM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QACpD,CAAC;KACD;IAED,MAAM,CAAC,gBAAgB,CAAC,YAAY,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IAEvE,OAAO,YAAY,CAAC;AACrB,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 {\n\ttype Anchor,\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeNavigationResult,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\ttype Value,\n\tinCursorField,\n\tmapCursorFields,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { brand, capitalize, disposeSymbol, fail, getOrCreate } from \"../../util/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\nimport {\n\tAny,\n\ttype FlexAllowedTypes,\n\tFlexFieldSchema,\n\ttype FlexMapNodeSchema,\n\ttype FlexObjectNodeSchema,\n\ttype FlexTreeNodeSchema,\n\ttype LeafNodeSchema,\n\tschemaIsLeaf,\n\tschemaIsMap,\n\tschemaIsObjectNode,\n} from \"../typed-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeLeafNode,\n\ttype FlexTreeMapNode,\n\ttype FlexTreeNode,\n\ttype FlexTreeObjectNodeTyped,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\ttype FlexTreeTypedField,\n\ttype FlexTreeTypedNode,\n\ttype FlexTreeUnboxField,\n\ttype FlexibleNodeContent,\n\ttype PropertyNameFromFieldKey,\n\tflexTreeMarker,\n\tflexTreeSlot,\n\treservedObjectNodeFieldPropertyNamePrefixes,\n\treservedObjectNodeFieldPropertyNames,\n} from \"./flexTreeTypes.js\";\nimport {\n\tLazyEntity,\n\tanchorSymbol,\n\tcursorSymbol,\n\tforgetAnchorSymbol,\n\ttryMoveCursorToAnchorSymbol,\n} from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\nimport { unboxedField } from \"./unboxed.js\";\n\n/**\n * @param cursor - This does not take ownership of this cursor: Node will fork it as needed.\n */\nexport function makeTree(context: Context, cursor: ITreeSubscriptionCursor): LazyTreeNode {\n\tconst anchor = cursor.buildAnchor();\n\tconst anchorNode =\n\t\tcontext.checkout.forest.anchors.locate(anchor) ??\n\t\tfail(\"cursor should point to a node that is not the root of the AnchorSet\");\n\tconst cached = anchorNode.slots.get(flexTreeSlot);\n\tif (cached !== undefined) {\n\t\tcontext.checkout.forest.anchors.forget(anchor);\n\t\tassert(cached.context === context, 0x782 /* contexts must match */);\n\t\tassert(cached instanceof LazyTreeNode, 0x92c /* Expected LazyTreeNode */);\n\t\treturn cached as LazyTreeNode;\n\t}\n\tconst schema = context.schema.nodeSchema.get(cursor.type) ?? fail(\"missing schema\");\n\treturn buildSubclass(context, schema, cursor, anchorNode, anchor);\n}\n\nfunction cleanupTree(anchor: AnchorNode): void {\n\tconst cached = anchor.slots.get(flexTreeSlot) ?? fail(\"tree should only be cleaned up once\");\n\tassert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);\n\tcached[disposeSymbol]();\n}\n\nfunction buildSubclass(\n\tcontext: Context,\n\tschema: FlexTreeNodeSchema,\n\tcursor: ITreeSubscriptionCursor,\n\tanchorNode: AnchorNode,\n\tanchor: Anchor,\n): LazyTreeNode {\n\tif (schemaIsMap(schema)) {\n\t\treturn new LazyMap(context, schema, cursor, anchorNode, anchor);\n\t}\n\tif (schemaIsLeaf(schema)) {\n\t\treturn new LazyLeaf(context, schema, cursor, anchorNode, anchor);\n\t}\n\tif (schemaIsObjectNode(schema)) {\n\t\treturn buildLazyObjectNode(context, schema, cursor, anchorNode, anchor);\n\t}\n\t// TODO: there should be a common fallback that works for cases without a specialized implementation.\n\tfail(\"unrecognized node kind\");\n}\n\n/**\n * Lazy implementation of {@link FlexTreeNode}.\n */\nexport abstract class LazyTreeNode<TSchema extends FlexTreeNodeSchema = FlexTreeNodeSchema>\n\textends LazyEntity<TSchema, Anchor>\n\timplements FlexTreeNode\n{\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Node {\n\t\treturn FlexTreeEntityKind.Node;\n\t}\n\t/**\n\t * Enumerable own property providing a more JS object friendly alternative to \"schema\".\n\t */\n\tpublic readonly type: TreeNodeSchemaIdentifier;\n\n\t// Using JS private here prevents it from showing up as a enumerable own property, or conflicting with struct fields.\n\treadonly #removeDeleteCallback: () => void;\n\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tschema: TSchema,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tpublic readonly anchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, schema, cursor, anchor);\n\t\tassert(cursor.mode === CursorLocationType.Nodes, 0x783 /* must be in nodes mode */);\n\t\tanchorNode.slots.set(flexTreeSlot, this);\n\t\tthis.#removeDeleteCallback = anchorNode.on(\"afterDestroy\", cleanupTree);\n\n\t\tassert(\n\t\t\tthis.context.schema.nodeSchema.get(this.schema.name) !== undefined,\n\t\t\t0x784 /* There is no explicit schema for this node type. Ensure that the type is correct and the schema for it was added to the TreeStoredSchema */,\n\t\t);\n\n\t\tthis.type = schema.name;\n\t}\n\n\tpublic is<TSchemaInner extends FlexTreeNodeSchema>(\n\t\tschema: TSchemaInner,\n\t): this is FlexTreeTypedNode<TSchemaInner> {\n\t\tassert(\n\t\t\tthis.context.schema.nodeSchema.get(schema.name) === schema,\n\t\t\t0x785 /* Narrowing must be done to a schema that exists in this context */,\n\t\t);\n\t\treturn this.schema === (schema as unknown);\n\t}\n\n\tprotected override [tryMoveCursorToAnchorSymbol](\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToNode(this[anchorSymbol], cursor);\n\t}\n\n\tprotected override [forgetAnchorSymbol](): void {\n\t\t// This type unconditionally has an anchor, so `forgetAnchor` is always called and cleanup can be done here:\n\t\t// After this point this node will not be usable,\n\t\t// so remove it from the anchor incase a different context (or the same context later) uses this AnchorSet.\n\t\tthis.anchorNode.slots.delete(flexTreeSlot);\n\t\tthis.#removeDeleteCallback();\n\t\tthis.context.checkout.forest.anchors.forget(this[anchorSymbol]);\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this[cursorSymbol].value;\n\t}\n\n\tpublic tryGetField(fieldKey: FieldKey): FlexTreeField | undefined {\n\t\tconst schema = this.schema.getFieldSchema(fieldKey);\n\t\treturn inCursorField(this[cursorSymbol], fieldKey, (cursor) => {\n\t\t\tif (cursor.getFieldLength() === 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn makeField(this.context, schema, cursor);\n\t\t});\n\t}\n\n\tpublic getBoxed(key: FieldKey): FlexTreeField {\n\t\treturn getBoxedField(this, key, this.schema.getFieldSchema(key));\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeField> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) =>\n\t\t\tmakeField(this.context, this.schema.getFieldSchema(cursor.getFieldKey()), cursor),\n\t\t).values();\n\t}\n\n\tpublic get parentField(): { readonly parent: FlexTreeField; readonly index: number } {\n\t\tconst cursor = this[cursorSymbol];\n\t\tconst index = this.anchorNode.parentIndex;\n\t\tassert(cursor.fieldIndex === index, 0x786 /* mismatched indexes */);\n\t\tconst key = this.anchorNode.parentField;\n\n\t\tcursor.exitNode();\n\t\tassert(key === cursor.getFieldKey(), 0x787 /* mismatched keys */);\n\t\tlet fieldSchema: FlexFieldSchema;\n\n\t\t// Check if the current node is in a detached sequence.\n\t\tif (this.anchorNode.parent === undefined) {\n\t\t\t// Parent field is a detached sequence, and thus needs special handling for its schema.\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (key === rootFieldKey) {\n\t\t\t\tfieldSchema = this.context.schema.rootFieldSchema;\n\t\t\t} else {\n\t\t\t\t// All fields (in the flex tree API) have a schema.\n\t\t\t\t// Since currently there is no known schema for detached field other than the special default root:\n\t\t\t\t// give all other detached fields a schema of sequence of any.\n\t\t\t\t// That schema is the only one that is safe since its the only field schema that allows any possible field content.\n\t\t\t\t//\n\t\t\t\t// TODO:\n\t\t\t\t// if any of the following are done this schema will need to be more specific:\n\t\t\t\t// 1. Editing APIs start exposing user created detached sequences.\n\t\t\t\t// 2. Remove (and its inverse) start working on subsequences or fields contents (like everything in a sequence or optional field) and not just single nodes.\n\t\t\t\t// 3. Possibly other unknown cases.\n\t\t\t\t// Additionally this approach makes it possible for a user to take a FlexTree node, get its parent, check its schema, down cast based on that, then edit that detached field (ex: removing the node in it).\n\t\t\t\t// This MIGHT work properly with existing merge resolution logic (it must keep client in sync and be unable to violate schema), but this either needs robust testing or to be explicitly banned (error before s3ending the op).\n\t\t\t\t// Issues like replacing a node in the a removed sequenced then undoing the remove could easily violate schema if not everything works exactly right!\n\t\t\t\tfieldSchema = FlexFieldSchema.create(FieldKinds.sequence, [Any]);\n\t\t\t}\n\t\t} else {\n\t\t\tcursor.exitField();\n\t\t\tconst parentType = cursor.type;\n\t\t\tcursor.enterField(key);\n\t\t\tconst nodeSchema =\n\t\t\t\tthis.context.schema.nodeSchema.get(parentType) ??\n\t\t\t\tfail(\"requested schema that does not exist\");\n\t\t\tfieldSchema = nodeSchema.getFieldSchema(key);\n\t\t}\n\n\t\tconst proxifiedField = makeField(this.context, fieldSchema, cursor);\n\t\tcursor.enterNode(index);\n\n\t\treturn { parent: proxifiedField, index };\n\t}\n}\n\nexport class LazyMap<TSchema extends FlexMapNodeSchema>\n\textends LazyTreeNode<TSchema>\n\timplements FlexTreeMapNode<TSchema>\n{\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tschema: TSchema,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tanchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, schema, cursor, anchorNode, anchor);\n\t}\n\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) => cursor.getFieldKey()).values();\n\t}\n\n\tpublic values(): IterableIterator<FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">> {\n\t\treturn mapCursorFields(\n\t\t\tthis[cursorSymbol],\n\t\t\t(cursor) =>\n\t\t\t\tunboxedField(this.context, this.schema.info, cursor) as FlexTreeUnboxField<\n\t\t\t\t\tTSchema[\"info\"],\n\t\t\t\t\t\"notEmpty\"\n\t\t\t\t>,\n\t\t).values();\n\t}\n\n\tpublic entries(): IterableIterator<\n\t\t[FieldKey, FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">]\n\t> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) => {\n\t\t\tconst entry: [FieldKey, FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">] = [\n\t\t\t\tcursor.getFieldKey(),\n\t\t\t\tunboxedField(this.context, this.schema.info, cursor) as FlexTreeUnboxField<\n\t\t\t\t\tTSchema[\"info\"],\n\t\t\t\t\t\"notEmpty\"\n\t\t\t\t>,\n\t\t\t];\n\t\t\treturn entry;\n\t\t}).values();\n\t}\n\n\tpublic forEach(\n\t\tcallbackFn: (\n\t\t\tvalue: FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">,\n\t\t\tkey: FieldKey,\n\t\t\tmap: FlexTreeMapNode<TSchema>,\n\t\t) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tconst fn = thisArg !== undefined ? callbackFn.bind(thisArg) : callbackFn;\n\t\tfor (const [key, value] of this.entries()) {\n\t\t\tfn(value, key, this);\n\t\t}\n\t}\n\n\tpublic override getBoxed(key: string): FlexTreeTypedField<TSchema[\"info\"]> {\n\t\treturn super.getBoxed(brand(key)) as FlexTreeTypedField<TSchema[\"info\"]>;\n\t}\n\n\tpublic override boxedIterator(): IterableIterator<FlexTreeTypedField<TSchema[\"info\"]>> {\n\t\treturn super.boxedIterator() as IterableIterator<FlexTreeTypedField<TSchema[\"info\"]>>;\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<\n\t\t[FieldKey, FlexTreeUnboxField<TSchema[\"info\"], \"notEmpty\">]\n\t> {\n\t\treturn this.entries();\n\t}\n}\n\nexport class LazyLeaf<TSchema extends LeafNodeSchema>\n\textends LazyTreeNode<TSchema>\n\timplements FlexTreeLeafNode<TSchema>\n{\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tschema: TSchema,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tanchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, schema, cursor, anchorNode, anchor);\n\t}\n\n\tpublic override get value(): TreeValue<TSchema[\"info\"]> {\n\t\treturn super.value as TreeValue<TSchema[\"info\"]>;\n\t}\n}\n\n/**\n * {@link reservedObjectNodeFieldPropertyNames} but as a set.\n */\nexport const reservedObjectNodeFieldPropertyNameSet: ReadonlySet<string> = new Set(\n\treservedObjectNodeFieldPropertyNames,\n);\n\nexport function propertyNameFromFieldKey<T extends string>(\n\tkey: T,\n): PropertyNameFromFieldKey<T> {\n\tif (reservedObjectNodeFieldPropertyNameSet.has(key)) {\n\t\treturn `field${capitalize(key)}` as PropertyNameFromFieldKey<T>;\n\t}\n\tfor (const prefix of reservedObjectNodeFieldPropertyNamePrefixes) {\n\t\tif (key.startsWith(prefix)) {\n\t\t\tconst afterPrefix = key.slice(prefix.length);\n\t\t\tif (afterPrefix === capitalize(afterPrefix)) {\n\t\t\t\treturn `field${capitalize(key)}` as PropertyNameFromFieldKey<T>;\n\t\t\t}\n\t\t}\n\t}\n\treturn key as PropertyNameFromFieldKey<T>;\n}\n\nexport function buildLazyObjectNode<TSchema extends FlexObjectNodeSchema>(\n\tcontext: Context,\n\tschema: TSchema,\n\tcursor: ITreeSubscriptionCursor,\n\tanchorNode: AnchorNode,\n\tanchor: Anchor,\n): LazyTreeNode<TSchema> & FlexTreeObjectNodeTyped<TSchema> {\n\tconst objectNodeClass = getOrCreate(cachedStructClasses, schema, () =>\n\t\tbuildStructClass(schema),\n\t);\n\treturn new objectNodeClass(context, cursor, anchorNode, anchor) as LazyTreeNode<TSchema> &\n\t\tFlexTreeObjectNodeTyped<TSchema>;\n}\n\nconst cachedStructClasses = new WeakMap<\n\tFlexObjectNodeSchema,\n\tnew (\n\t\tcontext: Context,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tanchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) => LazyTreeNode<FlexObjectNodeSchema>\n>();\n\nfunction getBoxedField(\n\tobjectNode: LazyTreeNode,\n\tkey: FieldKey,\n\tfieldSchema: FlexFieldSchema,\n): FlexTreeField {\n\treturn inCursorField(objectNode[cursorSymbol], key, (cursor) => {\n\t\treturn makeField(objectNode.context, fieldSchema, cursor);\n\t});\n}\n\nfunction buildStructClass<TSchema extends FlexObjectNodeSchema>(\n\tschema: TSchema,\n): new (\n\tcontext: Context,\n\tcursor: ITreeSubscriptionCursor,\n\tanchorNode: AnchorNode,\n\tanchor: Anchor,\n) => LazyTreeNode<TSchema> {\n\tconst propertyDescriptorMap: PropertyDescriptorMap = {};\n\n\tfor (const [key, fieldSchema] of schema.objectNodeFields) {\n\t\tconst escapedKey = propertyNameFromFieldKey(key);\n\t\tlet setter: ((newContent: FlexibleNodeContent) => void) | undefined;\n\t\tswitch (fieldSchema.kind) {\n\t\t\tcase FieldKinds.optional: {\n\t\t\t\tsetter = function (\n\t\t\t\t\tthis: CustomStruct,\n\t\t\t\t\tnewContent: FlexibleNodeContent | undefined,\n\t\t\t\t): void {\n\t\t\t\t\tconst field = getBoxedField(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tfieldSchema,\n\t\t\t\t\t) as FlexTreeOptionalField<FlexAllowedTypes>;\n\t\t\t\t\tfield.editor.set(newContent, field.length === 0);\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase FieldKinds.required: {\n\t\t\t\tsetter = function (this: CustomStruct, newContent: FlexibleNodeContent): void {\n\t\t\t\t\tconst field = getBoxedField(\n\t\t\t\t\t\tthis,\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tfieldSchema,\n\t\t\t\t\t) as FlexTreeRequiredField<FlexAllowedTypes>;\n\t\t\t\t\tfield.editor.set(newContent);\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tsetter = undefined;\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Create getter and setter (when appropriate) for property\n\t\tpropertyDescriptorMap[escapedKey] = {\n\t\t\tenumerable: true,\n\t\t\tget(this: CustomStruct): unknown {\n\t\t\t\treturn inCursorField(this[cursorSymbol], key, (cursor) =>\n\t\t\t\t\tunboxedField(this.context, fieldSchema, cursor),\n\t\t\t\t);\n\t\t\t},\n\t\t\tset: setter,\n\t\t};\n\n\t\t// Create set method for property (when appropriate)\n\t\tif (setter !== undefined) {\n\t\t\tpropertyDescriptorMap[`set${capitalize(escapedKey)}`] = {\n\t\t\t\tenumerable: false,\n\t\t\t\tget(this: CustomStruct) {\n\t\t\t\t\treturn setter;\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tpropertyDescriptorMap[`boxed${capitalize(escapedKey)}`] = {\n\t\t\tenumerable: false,\n\t\t\tget(this: CustomStruct) {\n\t\t\t\treturn getBoxedField(this, key, fieldSchema);\n\t\t\t},\n\t\t};\n\t}\n\n\t// This must implement `StructTyped<TSchema>`, but TypeScript can't constrain it to do so.\n\tclass CustomStruct extends LazyTreeNode<TSchema> {\n\t\tpublic constructor(\n\t\t\tcontext: Context,\n\t\t\tcursor: ITreeSubscriptionCursor,\n\t\t\tanchorNode: AnchorNode,\n\t\t\tanchor: Anchor,\n\t\t) {\n\t\t\tsuper(context, schema, cursor, anchorNode, anchor);\n\t\t}\n\t}\n\n\tObject.defineProperties(CustomStruct.prototype, propertyDescriptorMap);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AmD;gBACnD,mGAAmG;gBACnG,mEAAmE;gBACnE,mHAAmH;gBACnH,EAAE;gBACF,QAAQ;gBACR,8EAA8E;gBAC9E,kEAAkE;gBAClE,4JAA4J;gBAC5J,mCAAmC;gBACnC,2MAA2M;gBAC3M,8NAA8N;gBAC9N,qJAAqJ;gBACrJ,WAAW,GAAG,0BAAe,CAAC,MAAM,CAAC,qBAAU,CAAC,QAAQ,EAAE;oBACzD,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE;iBAC9C,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;aAAM,CAAC;YACP,MAAM,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC;YAC/B,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,UAAU,GACf,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;gBAClD,IAAA,eAAI,EAAC,sCAAsC,CAAC,CAAC;YAC9C,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAC9C,CAAC;QAED,MAAM,cAAc,GAAG,IAAA,wBAAS,EAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;QACpE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAExB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IAC1C,CAAC;IAEM,IAAI;QACV,OAAO,IAAA,0BAAe,EAAC,IAAI,CAAC,4BAAY,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IACvF,CAAC;CACD;AAxID,oCAwIC","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 {\n\ttype Anchor,\n\ttype AnchorNode,\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype ITreeSubscriptionCursor,\n\ttype TreeNavigationResult,\n\ttype TreeNodeSchemaIdentifier,\n\ttype Value,\n\tinCursorField,\n\tmapCursorFields,\n\trootFieldKey,\n} from \"../../core/index.js\";\nimport { disposeSymbol, fail } from \"../../util/index.js\";\nimport { FieldKinds } from \"../default-schema/index.js\";\nimport { FlexFieldSchema, type FlexTreeNodeSchema } from \"../typed-schema/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport {\n\tFlexTreeEntityKind,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\tflexTreeMarker,\n\tflexTreeSlot,\n} from \"./flexTreeTypes.js\";\nimport {\n\tLazyEntity,\n\tanchorSymbol,\n\tcursorSymbol,\n\tforgetAnchorSymbol,\n\ttryMoveCursorToAnchorSymbol,\n} from \"./lazyEntity.js\";\nimport { makeField } from \"./lazyField.js\";\n\n/**\n * @param cursor - This does not take ownership of this cursor: Node will fork it as needed.\n */\nexport function makeTree(context: Context, cursor: ITreeSubscriptionCursor): LazyTreeNode {\n\tconst anchor = cursor.buildAnchor();\n\tconst anchorNode =\n\t\tcontext.checkout.forest.anchors.locate(anchor) ??\n\t\tfail(\"cursor should point to a node that is not the root of the AnchorSet\");\n\tconst cached = anchorNode.slots.get(flexTreeSlot);\n\tif (cached !== undefined) {\n\t\tcontext.checkout.forest.anchors.forget(anchor);\n\t\tassert(cached.context === context, 0x782 /* contexts must match */);\n\t\tassert(cached instanceof LazyTreeNode, 0x92c /* Expected LazyTreeNode */);\n\t\treturn cached as LazyTreeNode;\n\t}\n\tconst schema = context.flexSchema.nodeSchema.get(cursor.type) ?? fail(\"missing schema\");\n\treturn new LazyTreeNode(context, schema, cursor, anchorNode, anchor);\n}\n\nfunction cleanupTree(anchor: AnchorNode): void {\n\tconst cached = anchor.slots.get(flexTreeSlot) ?? fail(\"tree should only be cleaned up once\");\n\tassert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);\n\tcached[disposeSymbol]();\n}\n\n/**\n * Lazy implementation of {@link FlexTreeNode}.\n */\nexport class LazyTreeNode<TSchema extends FlexTreeNodeSchema = FlexTreeNodeSchema>\n\textends LazyEntity<TSchema, Anchor>\n\timplements FlexTreeNode\n{\n\tpublic get [flexTreeMarker](): FlexTreeEntityKind.Node {\n\t\treturn FlexTreeEntityKind.Node;\n\t}\n\n\tpublic get schema(): TreeNodeSchemaIdentifier {\n\t\treturn this.flexSchema.name;\n\t}\n\n\t// Using JS private here prevents it from showing up as a enumerable own property, or conflicting with struct fields.\n\treadonly #removeDeleteCallback: () => void;\n\n\tpublic constructor(\n\t\tcontext: Context,\n\t\tschema: TSchema,\n\t\tcursor: ITreeSubscriptionCursor,\n\t\tpublic readonly anchorNode: AnchorNode,\n\t\tanchor: Anchor,\n\t) {\n\t\tsuper(context, schema, cursor, anchor);\n\t\tassert(cursor.mode === CursorLocationType.Nodes, 0x783 /* must be in nodes mode */);\n\t\tanchorNode.slots.set(flexTreeSlot, this);\n\t\tthis.#removeDeleteCallback = anchorNode.on(\"afterDestroy\", cleanupTree);\n\n\t\tassert(\n\t\t\tthis.context.flexSchema.nodeSchema.get(this.flexSchema.name) !== undefined,\n\t\t\t0x784 /* There is no explicit schema for this node type. Ensure that the type is correct and the schema for it was added to the TreeStoredSchema */,\n\t\t);\n\t}\n\n\tpublic is(schema: FlexTreeNodeSchema): boolean {\n\t\tassert(\n\t\t\tthis.context.flexSchema.nodeSchema.get(schema.name) === schema,\n\t\t\t0x785 /* Narrowing must be done to a schema that exists in this context */,\n\t\t);\n\t\treturn this.flexSchema === (schema as unknown);\n\t}\n\n\tprotected override [tryMoveCursorToAnchorSymbol](\n\t\tcursor: ITreeSubscriptionCursor,\n\t): TreeNavigationResult {\n\t\treturn this.context.checkout.forest.tryMoveCursorToNode(this[anchorSymbol], cursor);\n\t}\n\n\tprotected override [forgetAnchorSymbol](): void {\n\t\t// This type unconditionally has an anchor, so `forgetAnchor` is always called and cleanup can be done here:\n\t\t// After this point this node will not be usable,\n\t\t// so remove it from the anchor incase a different context (or the same context later) uses this AnchorSet.\n\t\tthis.anchorNode.slots.delete(flexTreeSlot);\n\t\tthis.#removeDeleteCallback();\n\t\tthis.context.checkout.forest.anchors.forget(this[anchorSymbol]);\n\t}\n\n\tpublic get value(): Value {\n\t\treturn this[cursorSymbol].value;\n\t}\n\n\tpublic tryGetField(fieldKey: FieldKey): FlexTreeField | undefined {\n\t\tconst schema = this.flexSchema.getFieldSchema(fieldKey);\n\t\treturn inCursorField(this[cursorSymbol], fieldKey, (cursor) => {\n\t\t\tif (cursor.getFieldLength() === 0) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn makeField(this.context, schema, cursor);\n\t\t});\n\t}\n\n\tpublic getBoxed(key: FieldKey): FlexTreeField {\n\t\tconst fieldSchema = this.flexSchema.getFieldSchema(key);\n\t\treturn inCursorField(this[cursorSymbol], key, (cursor) => {\n\t\t\treturn makeField(this.context, fieldSchema, cursor);\n\t\t});\n\t}\n\n\tpublic boxedIterator(): IterableIterator<FlexTreeField> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) =>\n\t\t\tmakeField(this.context, this.flexSchema.getFieldSchema(cursor.getFieldKey()), cursor),\n\t\t).values();\n\t}\n\n\tpublic get parentField(): { readonly parent: FlexTreeField; readonly index: number } {\n\t\tconst cursor = this[cursorSymbol];\n\t\tconst index = this.anchorNode.parentIndex;\n\t\tassert(cursor.fieldIndex === index, 0x786 /* mismatched indexes */);\n\t\tconst key = this.anchorNode.parentField;\n\n\t\tcursor.exitNode();\n\t\tassert(key === cursor.getFieldKey(), 0x787 /* mismatched keys */);\n\t\tlet fieldSchema: FlexFieldSchema;\n\n\t\t// Check if the current node is in a detached sequence.\n\t\tif (this.anchorNode.parent === undefined) {\n\t\t\t// Parent field is a detached sequence, and thus needs special handling for its schema.\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (key === rootFieldKey) {\n\t\t\t\tfieldSchema = this.context.flexSchema.rootFieldSchema;\n\t\t\t} else {\n\t\t\t\t// All fields (in the flex tree API) have a schema.\n\t\t\t\t// Since currently there is no known schema for detached field other than the special default root:\n\t\t\t\t// give all other detached fields a schema of sequence of anything.\n\t\t\t\t// That schema is the only one that is safe since its the only field schema that allows any possible field content.\n\t\t\t\t//\n\t\t\t\t// TODO:\n\t\t\t\t// if any of the following are done this schema will need to be more specific:\n\t\t\t\t// 1. Editing APIs start exposing user created detached sequences.\n\t\t\t\t// 2. Remove (and its inverse) start working on subsequences or fields contents (like everything in a sequence or optional field) and not just single nodes.\n\t\t\t\t// 3. Possibly other unknown cases.\n\t\t\t\t// Additionally this approach makes it possible for a user to take a FlexTree node, get its parent, check its schema, down cast based on that, then edit that detached field (ex: removing the node in it).\n\t\t\t\t// This MIGHT work properly with existing merge resolution logic (it must keep client in sync and be unable to violate schema), but this either needs robust testing or to be explicitly banned (error before sending the op).\n\t\t\t\t// Issues like replacing a node in the a removed sequenced then undoing the remove could easily violate schema if not everything works exactly right!\n\t\t\t\tfieldSchema = FlexFieldSchema.create(FieldKinds.sequence, [\n\t\t\t\t\t...this.context.flexSchema.nodeSchema.values(),\n\t\t\t\t]);\n\t\t\t}\n\t\t} else {\n\t\t\tcursor.exitField();\n\t\t\tconst parentType = cursor.type;\n\t\t\tcursor.enterField(key);\n\t\t\tconst nodeSchema =\n\t\t\t\tthis.context.flexSchema.nodeSchema.get(parentType) ??\n\t\t\t\tfail(\"requested schema that does not exist\");\n\t\t\tfieldSchema = nodeSchema.getFieldSchema(key);\n\t\t}\n\n\t\tconst proxifiedField = makeField(this.context, fieldSchema, cursor);\n\t\tcursor.enterNode(index);\n\n\t\treturn { parent: proxifiedField, index };\n\t}\n\n\tpublic keys(): IterableIterator<FieldKey> {\n\t\treturn mapCursorFields(this[cursorSymbol], (cursor) => cursor.getFieldKey()).values();\n\t}\n}\n"]}
|
|
@@ -2,23 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import type { FlexFieldKind } from "../modular-schema/index.js";
|
|
7
|
-
import { type FlexAllowedTypes, type FlexFieldSchema, type FlexTreeNodeSchema } from "../typed-schema/index.js";
|
|
5
|
+
import type { ITreeSubscriptionCursor } from "../../core/index.js";
|
|
8
6
|
import type { Context } from "./context.js";
|
|
9
|
-
import type {
|
|
7
|
+
import type { FlexTreeUnknownUnboxed } from "./flexTreeTypes.js";
|
|
10
8
|
/**
|
|
11
|
-
*
|
|
9
|
+
* Returns the flex tree node, of the value if it has one.
|
|
12
10
|
*/
|
|
13
|
-
export declare function
|
|
14
|
-
/**
|
|
15
|
-
* See {@link FlexTreeUnboxNodeUnion} for documentation on what unwrapping this performs.
|
|
16
|
-
*/
|
|
17
|
-
export declare function unboxedUnion<TTypes extends FlexAllowedTypes>(context: Context, schema: FlexFieldSchema<FlexFieldKind, TTypes>, cursor: ITreeSubscriptionCursor): FlexTreeUnboxNodeUnion<TTypes>;
|
|
18
|
-
/**
|
|
19
|
-
* @param context - the common context of the field.
|
|
20
|
-
* @param schema - the TreeFieldStoredSchema of the field.
|
|
21
|
-
* @param cursor - the cursor, which must point to the field being proxified.
|
|
22
|
-
*/
|
|
23
|
-
export declare function unboxedField<TSchema extends FlexFieldSchema>(context: Context, schema: TSchema, cursor: ITreeSubscriptionCursor): FlexTreeUnboxField<TSchema>;
|
|
11
|
+
export declare function unboxedFlexNode(context: Context, cursor: ITreeSubscriptionCursor): FlexTreeUnknownUnboxed;
|
|
24
12
|
//# sourceMappingURL=unboxed.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unboxed.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"unboxed.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGjE;;GAEG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,uBAAuB,GAC7B,sBAAsB,CAMxB"}
|
|
@@ -4,51 +4,17 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
const index_js_1 = require("../../core/index.js");
|
|
9
|
-
const index_js_2 = require("../default-schema/index.js");
|
|
10
|
-
const index_js_3 = require("../typed-schema/index.js");
|
|
11
|
-
const lazyField_js_1 = require("./lazyField.js");
|
|
7
|
+
exports.unboxedFlexNode = void 0;
|
|
12
8
|
const lazyNode_js_1 = require("./lazyNode.js");
|
|
13
9
|
/**
|
|
14
|
-
*
|
|
10
|
+
* Returns the flex tree node, of the value if it has one.
|
|
15
11
|
*/
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
function unboxedFlexNode(context, cursor) {
|
|
13
|
+
const value = cursor.value;
|
|
14
|
+
if (value !== undefined) {
|
|
15
|
+
return value;
|
|
19
16
|
}
|
|
20
17
|
return (0, lazyNode_js_1.makeTree)(context, cursor);
|
|
21
18
|
}
|
|
22
|
-
exports.
|
|
23
|
-
/**
|
|
24
|
-
* See {@link FlexTreeUnboxNodeUnion} for documentation on what unwrapping this performs.
|
|
25
|
-
*/
|
|
26
|
-
function unboxedUnion(context, schema, cursor) {
|
|
27
|
-
const type = schema.monomorphicChildType;
|
|
28
|
-
if (type !== undefined) {
|
|
29
|
-
return unboxedTree(context, type, cursor);
|
|
30
|
-
}
|
|
31
|
-
return (0, lazyNode_js_1.makeTree)(context, cursor);
|
|
32
|
-
}
|
|
33
|
-
exports.unboxedUnion = unboxedUnion;
|
|
34
|
-
/**
|
|
35
|
-
* @param context - the common context of the field.
|
|
36
|
-
* @param schema - the TreeFieldStoredSchema of the field.
|
|
37
|
-
* @param cursor - the cursor, which must point to the field being proxified.
|
|
38
|
-
*/
|
|
39
|
-
function unboxedField(context, schema, cursor) {
|
|
40
|
-
const kind = schema.kind;
|
|
41
|
-
if (kind === index_js_2.FieldKinds.required) {
|
|
42
|
-
return (0, index_js_1.inCursorNode)(cursor, 0, (innerCursor) => unboxedUnion(context, schema, innerCursor));
|
|
43
|
-
}
|
|
44
|
-
if (kind === index_js_2.FieldKinds.optional) {
|
|
45
|
-
if (cursor.getFieldLength() === 0) {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
return (0, index_js_1.inCursorNode)(cursor, 0, (innerCursor) => unboxedUnion(context, schema, innerCursor));
|
|
49
|
-
}
|
|
50
|
-
// TODO: forbidden and nodeKey
|
|
51
|
-
return (0, lazyField_js_1.makeField)(context, schema, cursor);
|
|
52
|
-
}
|
|
53
|
-
exports.unboxedField = unboxedField;
|
|
19
|
+
exports.unboxedFlexNode = unboxedFlexNode;
|
|
54
20
|
//# sourceMappingURL=unboxed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unboxed.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"unboxed.js","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/unboxed.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,+CAAyC;AAEzC;;GAEG;AACH,SAAgB,eAAe,CAC9B,OAAgB,EAChB,MAA+B;IAE/B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,IAAA,sBAAQ,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAClC,CAAC;AATD,0CASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITreeSubscriptionCursor } from \"../../core/index.js\";\n\nimport type { Context } from \"./context.js\";\nimport type { FlexTreeUnknownUnboxed } from \"./flexTreeTypes.js\";\nimport { makeTree } from \"./lazyNode.js\";\n\n/**\n * Returns the flex tree node, of the value if it has one.\n */\nexport function unboxedFlexNode(\n\tcontext: Context,\n\tcursor: ITreeSubscriptionCursor,\n): FlexTreeUnknownUnboxed {\n\tconst value = cursor.value;\n\tif (value !== undefined) {\n\t\treturn value;\n\t}\n\treturn makeTree(context, cursor);\n}\n"]}
|
|
@@ -30,9 +30,9 @@ export interface DetachedFieldCache {
|
|
|
30
30
|
* Utility function to get a {@link SchemaAndPolicy} object from a {@link FlexTreeNode} or {@link FlexTreeField}.
|
|
31
31
|
* @param nodeOrField - {@link FlexTreeNode} or {@link FlexTreeField} to get the schema and policy from.
|
|
32
32
|
* @returns A {@link SchemaAndPolicy} object with the stored schema and policy from the node or field provided.
|
|
33
|
-
*
|
|
33
|
+
* For {@link Unhydrated} nodes this schema may only describe the types allowed subtree for this particular entity.
|
|
34
34
|
*/
|
|
35
|
-
export declare function getSchemaAndPolicy(nodeOrField: FlexTreeEntity): SchemaAndPolicy
|
|
35
|
+
export declare function getSchemaAndPolicy(nodeOrField: FlexTreeEntity): SchemaAndPolicy;
|
|
36
36
|
/**
|
|
37
37
|
* Indexing for {@link FlexTreeField.boxedAt} and {@link FlexTreeSequenceField.at} supports the
|
|
38
38
|
* usage of negative indices, which regular indexing using `[` and `]` does not.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/utilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,UAAU,EACf,KAAK,aAAa,EAIlB,KAAK,eAAe,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,aAAa,GAAG,UAAU,CAEpF;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAkB5E;AAiBD,eAAO,MAAM,iBAAiB,8DAAmC,CAAC;AAElE,MAAM,WAAW,kBAAkB;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,cAAc,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/flex-tree/utilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,UAAU,EACf,KAAK,aAAa,EAIlB,KAAK,eAAe,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,aAAa,GAAG,UAAU,CAEpF;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAkB5E;AAiBD,eAAO,MAAM,iBAAiB,8DAAmC,CAAC;AAElE,MAAM,WAAW,kBAAkB;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,cAAc,GAAG,eAAe,CAK/E;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY5E"}
|
|
@@ -59,15 +59,12 @@ exports.detachedFieldSlot = (0, index_js_1.anchorSlot)();
|
|
|
59
59
|
* Utility function to get a {@link SchemaAndPolicy} object from a {@link FlexTreeNode} or {@link FlexTreeField}.
|
|
60
60
|
* @param nodeOrField - {@link FlexTreeNode} or {@link FlexTreeField} to get the schema and policy from.
|
|
61
61
|
* @returns A {@link SchemaAndPolicy} object with the stored schema and policy from the node or field provided.
|
|
62
|
-
*
|
|
62
|
+
* For {@link Unhydrated} nodes this schema may only describe the types allowed subtree for this particular entity.
|
|
63
63
|
*/
|
|
64
64
|
function getSchemaAndPolicy(nodeOrField) {
|
|
65
|
-
if (nodeOrField.context === undefined) {
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
65
|
return {
|
|
69
|
-
schema: nodeOrField.context.
|
|
70
|
-
policy: nodeOrField.context.
|
|
66
|
+
schema: nodeOrField.context.schema,
|
|
67
|
+
policy: nodeOrField.context.flexSchema.policy,
|
|
71
68
|
};
|
|
72
69
|
}
|
|
73
70
|
exports.getSchemaAndPolicy = getSchemaAndPolicy;
|