@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"treeView.js","sourceRoot":"","sources":["../../src/shared-tree/treeView.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAON,cAAc,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAoB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAyDnE;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAOhC,YACiB,QAAmB,EACnB,MAA6B,EAC7B,cAA8B,EAC7B,SAAsB;QAHvB,aAAQ,GAAR,QAAQ,CAAW;QACnB,WAAM,GAAN,MAAM,CAAuB;QAC7B,mBAAc,GAAd,cAAc,CAAgB;QAC7B,cAAS,GAAT,SAAS,CAAa;QAEvC,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QACrE,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAiC,CAAC;IAChE,CAAC;IAEM,CAAC,aAAa,CAAC;QACrB,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACvD,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAChC,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QAC9B,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;IACpB,CAAC;IAEM,IAAI;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpC,OAAO,IAAI,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3E,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAgC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype Context,\n\ttype FlexFieldSchema,\n\ttype FlexTreeContext,\n\ttype FlexTreeSchema,\n\ttype FlexTreeTypedField,\n\ttype NodeKeyManager,\n\tgetTreeContext,\n} from \"../feature-libraries/index.js\";\nimport { tryDisposeTreeNode } from \"../simple-tree/index.js\";\nimport { type IDisposable, disposeSymbol } from \"../util/index.js\";\n\nimport type { ITreeCheckout, ITreeCheckoutFork } from \"./treeCheckout.js\";\n\n/**\n * The portion of {@link FlexTreeView} that does not depend on the schema's type.\n * @privateRemarks\n * Since {@link FlexTreeView}'s schema is invariant, `FlexTreeView<FlexFieldSchema>` does not cover this use case.\n */\nexport interface FlexTreeViewGeneric extends IDisposable {\n\t/**\n\t * Context for controlling the FlexTree nodes produced from {@link FlexTreeView.flexTree}.\n\t *\n\t * @remarks\n\t * This is an owning reference: disposing of this view disposes its context.\n\t */\n\treadonly context: FlexTreeContext;\n\n\t/**\n\t * Access non-view schema specific aspects of of this branch.\n\t *\n\t * @remarks\n\t * This is a non-owning reference: disposing of this view does not impact the branch.\n\t */\n\treadonly checkout: ITreeCheckout;\n}\n\n/**\n * An editable view of a (version control style) branch of a shared tree.\n * @privateRemarks\n * TODO:\n * If schema aware APIs are removed from flex tree, this can be combined with {@link FlexTreeViewGeneric}.\n */\nexport interface FlexTreeView<in out TRoot extends FlexFieldSchema>\n\textends FlexTreeViewGeneric {\n\t/**\n\t * Get a typed view of the tree content using the flex-tree API.\n\t */\n\treadonly flexTree: FlexTreeTypedField<TRoot>;\n\n\t/**\n\t * Spawn a new view which is based off of the current state of this view.\n\t * Any mutations of the new view will not apply to this view until the new view is merged back into this view via `merge()`.\n\t */\n\tfork(): ITreeViewFork<TRoot>;\n}\n\n/**\n * Branch (like in a version control system) of SharedTree.\n *\n * {@link FlexTreeView} that has forked off of the main trunk/branch.\n */\nexport interface ITreeViewFork<in out TRoot extends FlexFieldSchema>\n\textends FlexTreeView<TRoot> {\n\treadonly checkout: ITreeCheckoutFork;\n}\n\n/**\n * Implementation of FlexTreeView wrapping a ITreeCheckout.\n */\nexport class CheckoutFlexTreeView<\n\tin out TRoot extends FlexFieldSchema,\n\tout TCheckout extends ITreeCheckout = ITreeCheckout,\n> implements FlexTreeView<TRoot>\n{\n\tpublic readonly context: Context;\n\tpublic readonly flexTree: FlexTreeTypedField<TRoot>;\n\tpublic constructor(\n\t\tpublic readonly checkout: TCheckout,\n\t\tpublic readonly schema: FlexTreeSchema<TRoot>,\n\t\tpublic readonly nodeKeyManager: NodeKeyManager,\n\t\tprivate readonly onDispose?: () => void,\n\t) {\n\t\tthis.context = getTreeContext(schema, this.checkout, nodeKeyManager);\n\t\tcontextToTreeView.set(this.context, this);\n\t\tthis.flexTree = this.context.root as FlexTreeTypedField<TRoot>;\n\t}\n\n\tpublic [disposeSymbol](): void {\n\t\tfor (const anchorNode of this.checkout.forest.anchors) {\n\t\t\ttryDisposeTreeNode(anchorNode);\n\t\t}\n\n\t\tthis.context[disposeSymbol]();\n\t\tthis.onDispose?.();\n\t}\n\n\tpublic fork(): CheckoutFlexTreeView<TRoot, ITreeCheckout & ITreeCheckoutFork> {\n\t\tconst branch = this.checkout.fork();\n\t\treturn new CheckoutFlexTreeView(branch, this.schema, this.nodeKeyManager);\n\t}\n}\n\n/**\n * Maps the context of every {@link CheckoutFlexTreeView} to the view.\n * In practice, this allows the view or checkout to be obtained from a flex node by first getting the context from the flex node and then using this map.\n */\nexport const contextToTreeView = new WeakMap<Context, FlexTreeViewGeneric>();\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getJsonSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/getJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAW7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CAK1E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getJsonSchema.js","sourceRoot":"","sources":["../../src/simple-tree/getJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C;;GAEG;AACH,MAAM,eAAe,GAAG,IAAI,OAAO,EAAkC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,UAAU,aAAa,CAAC,MAA4B;IACzD,OAAO,WAAW,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG,EAAE;QAChD,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QAC7C,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { JsonTreeSchema } from \"./jsonSchema.js\";\nimport type { ImplicitAllowedTypes } from \"./schemaTypes.js\";\nimport { toJsonSchema } from \"./simpleSchemaToJsonSchema.js\";\nimport { getSimpleSchema } from \"./getSimpleSchema.js\";\nimport { getOrCreate } from \"../util/index.js\";\nimport type { TreeNodeSchema } from \"./core/index.js\";\n\n/**\n * Cache in which the results of {@link getJsonSchema} are saved.\n */\nconst jsonSchemaCache = new WeakMap<TreeNodeSchema, JsonTreeSchema>();\n\n/**\n * Creates a {@link https://json-schema.org/ | JSON Schema} representation of the provided {@link TreeNodeSchema}.\n *\n * @remarks\n * Useful when communicating the schema to external libraries or services.\n * Caches the result for future calls.\n *\n * @example\n *\n * A Shared Tree schema like the following:\n *\n * ```typescript\n * class MyObject extends schemaFactory.object(\"MyObject\", {\n * \tfoo: schemaFactory.number,\n * \tbar: schemaFactory.optional(schemaFactory.string),\n * });\n * ```\n *\n * Will yield JSON Schema like the following:\n *\n * ```json\n * {\n * \t\"$defs\": {\n * \t\t\"com.fluidframework.leaf.string\": {\n * \t\t\t\"type\": \"string\",\n * \t\t},\n * \t\t\"com.fluidframework.leaf.number\": {\n * \t\t\t\"type\": \"number\",\n * \t\t},\n * \t\t\"com.myapp.MyObject\": {\n * \t\t\t\"type\": \"object\",\n * \t\t\t\"properties\": {\n * \t\t\t\t\"foo\": { \"$ref\": \"com.fluidframework.leaf.number\" },\n * \t\t\t\t\"bar\": { \"$ref\": \"com.fluidframework.leaf.string\" },\n * \t\t\t},\n * \t\t\t\"required\": [\"foo\"],\n * \t\t},\n * \t},\n * \t\"anyOf\": [ { \"$ref\": \"#/$defs/com.myapp.MyObject\" } ],\n * }\n * ```\n *\n * @privateRemarks In the future, we may wish to move this to a more discoverable API location.\n * For now, while still an experimental API, it is surfaced as a free function.\n *\n * @alpha\n */\nexport function getJsonSchema(schema: ImplicitAllowedTypes): JsonTreeSchema {\n\treturn getOrCreate(jsonSchemaCache, schema, () => {\n\t\tconst simpleSchema = getSimpleSchema(schema);\n\t\treturn toJsonSchema(simpleSchema);\n\t});\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSimpleSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/getSimpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQ1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,oBAAoB,GAAG,gBAAgB,CAE9E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSimpleSchema.js","sourceRoot":"","sources":["../../src/simple-tree/getSimpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;GAEG;AACH,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAoC,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,MAAM,UAAU,eAAe,CAAC,MAA4B;IAC3D,OAAO,WAAW,CAAC,iBAAiB,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;AACjF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { getOrCreate } from \"../util/index.js\";\nimport type { TreeNodeSchema } from \"./core/index.js\";\nimport type { ImplicitAllowedTypes } from \"./schemaTypes.js\";\nimport type { SimpleTreeSchema } from \"./simpleSchema.js\";\nimport { toSimpleTreeSchema } from \"./viewSchemaToSimpleSchema.js\";\n\n/**\n * Cache in which the results of {@link getSimpleSchema} saved.\n */\nconst simpleSchemaCache = new WeakMap<TreeNodeSchema, SimpleTreeSchema>();\n\n/**\n * Creates a simplified representation of the provided {@link TreeNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n *\n * @example\n *\n * A Shared Tree schema like the following:\n *\n * ```typescript\n * class MyObject extends schemaFactory.object(\"MyObject\", {\n * \tfoo: schemaFactory.number,\n * \tbar: schemaFactory.optional(schemaFactory.string),\n * });\n * ```\n *\n * Will yield JSON Schema like the following:\n *\n * ```typescript\n * {\n * \tdefinitions: [\n * \t\t[\"com.fluidframework.leaf.number\", {\n * \t\t\tkind: \"leaf\",\n * \t\t\ttype: \"number\",\n * \t\t}],\n * \t\t[\"com.fluidframework.leaf.string\", {\n * \t\t\tkind: \"leaf\",\n * \t\t\ttype: \"string\",\n * \t\t}],\n * \t\t[\"com.myapp.MyObject\", {\n * \t\t\tkind: \"object\",\n * \t\t\tfields: {\n * \t\t\t\tfoo: {\n * \t\t\t\t\tkind: \"required\",\n * \t\t\t\t\tallowedTypes: [\"com.fluidframework.leaf.number\"]\n * \t\t\t\t},\n * \t\t\t\tbar: {\n * \t\t\t\t\tkind: \"optional\",\n * \t\t\t\t\tallowedTypes: [\"com.fluidframework.leaf.string\"]\n * \t\t\t\t},\n * \t\t\t},\n * \t\t}],\n * \t],\n * \tallowedTypes: [\"com.myapp.MyObject\"],\n * }\n * ```\n *\n * @privateRemarks In the future, we may wish to move this to a more discoverable API location.\n * For now, while still an experimental API, it is surfaced as a free function.\n */\nexport function getSimpleSchema(schema: ImplicitAllowedTypes): SimpleTreeSchema {\n\treturn getOrCreate(simpleSchemaCache, schema, () => toSimpleTreeSchema(schema));\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/jsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,YAAY,EAAE,CAAC;AAEpD;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,OAAO,GAAG,kBAAkB,CAAC;AAErE;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB,CAClC,SAAS,SAAS,QAAQ,EAC1B,eAAe,SAAS,cAAc;IAEtC;;;;;;;OAOG;IACH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,CAAC;IAExC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1F;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAErD;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACvF;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE;QACf;;;;WAIG;QACH,KAAK,EAAE,aAAa,EAAE,CAAC;KACvB,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IACpF;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE;QAC3B;;;WAGG;QACH,MAAM,EAAE,eAAe,CAAC;KACxB,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAChB,SAAQ,kBAAkB,CAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAC7D;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,IAAI,EAAE,WAAW,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACvB,kBAAkB,GAClB,iBAAiB,GACjB,mBAAmB,GACnB,oBAAoB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,cAAe,SAAQ,eAAe;IACtD;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;CACrD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSchema.js","sourceRoot":"","sources":["../../src/simple-tree/jsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { NodeKind } from \"./core/index.js\";\n\n/**\n * The fully-qualified {@link TreeNodeSchemaCore.identifier}.\n * @alpha\n */\nexport type JsonSchemaId = string;\n\n/**\n * Reference string pointing to a definition in the schema.\n * Should be the fully-qualified {@link TreeNodeSchemaCore.identifier}.\n * @remarks Of the form `#/$defs/<schema-identifier>`, where the `schema-identifier` is the fully-qualified {@link TreeNodeSchemaCore.identifier}.\n * @example Schema `com.myapp.foo` would be referenced via `#/$defs/com.myapp.foo`.\n * @alpha\n */\nexport type JsonRefPath = `#/$defs/${JsonSchemaId}`;\n\n/**\n * JSON entity type.\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n * @alpha\n */\nexport type JsonSchemaType = \"object\" | \"array\" | JsonLeafSchemaType;\n\n/**\n * JSON primitive types.\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n * @alpha\n */\nexport type JsonLeafSchemaType = \"string\" | \"number\" | \"boolean\" | \"null\";\n\n/**\n * Base interface for node schemas represented in {@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} format.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonNodeSchemaBase<\n\tTNodeKind extends NodeKind,\n\tTJsonSchemaType extends JsonSchemaType,\n> {\n\t/**\n\t * Kind of {@link TreeNodeSchema} this JSON Schema entry represents.\n\t *\n\t * @remarks There is not a 1:1 mapping between {@link TreeNodeSchema} types and JSON Schema types.\n\t * This is used to disambiguate the type of {@link TreeNodeSchema} this JSON Schema maps to.\n\t *\n\t * Note: This property name is not a part of the JSON Schema spec. This is a Fluid-specific extension.\n\t */\n\treadonly _treeNodeSchemaKind: TNodeKind;\n\n\t/**\n\t * {@inheritDoc JsonSchemaType}\n\t */\n\treadonly type: TJsonSchemaType;\n}\n\n/**\n * JSON Schema for an object node.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonObjectNodeSchema extends JsonNodeSchemaBase<NodeKind.Object, \"object\"> {\n\t/**\n\t * Object fields.\n\t * @remarks Required fields should have a corresponding entry in {@link JsonObjectNodeSchema.required}.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-properties}.\n\t */\n\treadonly properties: Record<string, JsonFieldSchema>;\n\n\t/**\n\t * List of keys for required fields.\n\t *\n\t * @remarks\n\t * Optional fields should not be included in this list.\n\t * Each key specified must have an entry in {@link JsonObjectNodeSchema.properties}.\n\t */\n\treadonly required?: string[];\n\n\t/**\n\t * Whether or not additional properties (properties not specified by the schema) are allowed in objects of this type.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-additionalproperties}.\n\t */\n\treadonly additionalProperties?: boolean;\n}\n\n/**\n * JSON Schema for an array node.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonArrayNodeSchema extends JsonNodeSchemaBase<NodeKind.Array, \"array\"> {\n\t/**\n\t * The kinds of items allowed under the array.\n\t * @remarks Always represented via references to {@link JsonTreeSchema.$defs}.\n\t *\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-items}.\n\t */\n\treadonly items: {\n\t\t/**\n\t\t * The kinds of items allowed under the array.\n\t\t * @remarks Always represented via references to {@link JsonTreeSchema.$defs}.\n\t\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-anyof}.\n\t\t */\n\t\tanyOf: JsonSchemaRef[];\n\t};\n}\n\n/**\n * JSON Schema for a map node.\n *\n * @remarks Special case for map nodes, which do not have a native JSON schema corollary.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonMapNodeSchema extends JsonNodeSchemaBase<NodeKind.Map, \"object\"> {\n\t/**\n\t * Used to control the types of properties that can appear in the \"object\" representation of the map.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-patternproperties}.\n\t */\n\treadonly patternProperties: {\n\t\t/**\n\t\t * Types allowed in the map.\n\t\t * @remarks This format allows for any (JSON-compliant) key, but restricts the allowed types to only those specified.\n\t\t */\n\t\t\"^.*$\": JsonFieldSchema;\n\t};\n}\n\n/**\n * JSON Schema for a leaf node.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonLeafNodeSchema\n\textends JsonNodeSchemaBase<NodeKind.Leaf, JsonLeafSchemaType> {\n\t/**\n\t * Primitive type.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n\t */\n\treadonly type: JsonLeafSchemaType;\n}\n\n/**\n * Type entry containing a reference to a definition in the schema.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-schema-references}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonSchemaRef {\n\t/**\n\t * Reference to a definition in the schema.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-direct-references-with-ref}.\n\t */\n\t$ref: JsonRefPath;\n}\n\n/**\n * {@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} representation of a {@link TreeNodeSchema}.\n *\n * @alpha\n */\nexport type JsonNodeSchema =\n\t| JsonLeafNodeSchema\n\t| JsonMapNodeSchema\n\t| JsonArrayNodeSchema\n\t| JsonObjectNodeSchema;\n\n/**\n *{@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} representation of a {@link FieldSchema}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonFieldSchema {\n\t/**\n\t * The kinds of items allowed under the field.\n\t * @remarks Always represented via references to {@link JsonTreeSchema.$defs}.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-anyof}.\n\t */\n\treadonly anyOf: JsonSchemaRef[];\n}\n\n/**\n * {@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} representation of a tree schema.\n *\n * @remarks\n * Includes the complete set of definitions reachable from the \"root\" schema.\n *\n * Note: This representation only uses a limited subset of supported JSON Schema features.\n * It is scoped to a format that can be used to sufficiently represent supported SharedTree schema.\n *\n * Also note that this schema format contains Fluid-specific extensions, such as the {@link JsonNodeSchemaBase._treeNodeSchemaKind}\n * property, meaning that it is not a *strict* subset.\n * When using these schemas with validation tools (for example, {@link https://ajv.js.org/}), you will need to opt out\n * of *strict* validation to ensure extra properties are allowed.\n *\n * @privateRemarks\n * Extending JSON Schema is permitted by the spec.\n * See {@link https://json-schema.org/draft/2020-12/json-schema-core#name-extending-json-schema}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonTreeSchema extends JsonFieldSchema {\n\t/**\n\t * The set of definitions reachable from this schema's root.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-schema-re-use-with-defs}\n\t */\n\treadonly $defs: Record<JsonSchemaId, JsonNodeSchema>;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simpleSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/simpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,oBAAoB,CAAC,SAAS,SAAS,QAAQ;IAC/D;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB,CAAC,QAAQ,CAAC,MAAM,CAAC;IACpF;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CACnD;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC;IAClF;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB,CAAC,QAAQ,CAAC,GAAG,CAAC;IAC9E;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB,CAAC,QAAQ,CAAC,IAAI,CAAC;IAChF;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GACzB,oBAAoB,GACpB,mBAAmB,GACnB,qBAAqB,GACrB,sBAAsB,CAAC;AAE1B;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAEzB;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAE5D;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simpleSchema.js","sourceRoot":"","sources":["../../src/simple-tree/simpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ValueSchema } from \"../core/index.js\";\nimport type { NodeKind } from \"./core/index.js\";\nimport type { FieldKind } from \"./schemaTypes.js\";\n\n/**\n * Base interface for all {@link SimpleNodeSchema} implementations.\n *\n * @sealed\n */\nexport interface SimpleNodeSchemaBase<TNodeKind extends NodeKind> {\n\t/**\n\t * The kind of {@link SimpleNodeSchema}.\n\t *\n\t * @remarks can be used to type-switch between implementations.\n\t */\n\treadonly kind: TNodeKind;\n}\n\n/**\n * A {@link SimpleNodeSchema} for an object node.\n *\n * @sealed\n */\nexport interface SimpleObjectNodeSchema extends SimpleNodeSchemaBase<NodeKind.Object> {\n\t/**\n\t * Schemas for each of the object's fields, keyed off of schema's view keys.\n\t */\n\treadonly fields: Record<string, SimpleFieldSchema>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for an array node.\n *\n * @sealed\n */\nexport interface SimpleArrayNodeSchema extends SimpleNodeSchemaBase<NodeKind.Array> {\n\t/**\n\t * The types allowed in the array.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a map node.\n *\n * @sealed\n */\nexport interface SimpleMapNodeSchema extends SimpleNodeSchemaBase<NodeKind.Map> {\n\t/**\n\t * The types allowed as values in the map.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a leaf node.\n *\n * @sealed\n */\nexport interface SimpleLeafNodeSchema extends SimpleNodeSchemaBase<NodeKind.Leaf> {\n\t/**\n\t * The kind of leaf node.\n\t */\n\treadonly leafKind: ValueSchema;\n}\n\n/**\n * A simple, shallow representation of a schema for a node.\n *\n * @remarks This definition is incomplete, and references child types by identifiers.\n * To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which\n * contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.\n */\nexport type SimpleNodeSchema =\n\t| SimpleLeafNodeSchema\n\t| SimpleMapNodeSchema\n\t| SimpleArrayNodeSchema\n\t| SimpleObjectNodeSchema;\n\n/**\n * A simple, shallow representation of a schema for a field.\n *\n * @remarks This definition is incomplete, and references child types by identifiers.\n * To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which\n * contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.\n *\n * @sealed\n */\nexport interface SimpleFieldSchema {\n\t/**\n\t * The kind of object field.\n\t */\n\treadonly kind: FieldKind;\n\n\t/**\n\t * The types allowed under the field.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n}\n\n/**\n * A simplified representation of a schema for a tree.\n *\n * @remarks Contains the complete set of schema {@link SimpleTreeSchema.definitions} required to resolve references\n * by schema identifier.\n *\n * @sealed\n */\nexport interface SimpleTreeSchema {\n\t/**\n\t * The complete set of node schema definitions recursively referenced by the tree's {@link SimpleTreeSchema.allowedTypes}.\n\t *\n\t * @remarks the keys are the schemas' {@link TreeNodeSchemaCore.identifier | identifiers}.\n\t */\n\treadonly definitions: ReadonlyMap<string, SimpleNodeSchema>;\n\n\t/**\n\t * The types allowed under the root of the tree.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * {@link SimpleTreeSchema.definitions} can be used to resolve these identifiers to their associated schema definition.\n\t */\n\treadonly allowedTypes: ReadonlySet<string>;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simpleSchemaToJsonSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/simpleSchemaToJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EASX,cAAc,EAEd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAMX,gBAAgB,EAChB,MAAM,mBAAmB,CAAC;AAG3B;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,cAAc,CAYrE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simpleSchemaToJsonSchema.js","sourceRoot":"","sources":["../../src/simple-tree/simpleSchemaToJsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAa/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAS7C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAwB;IACpD,MAAM,WAAW,GAAG,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAE3D,MAAM,KAAK,GAAoB,EAAE,CAAC;IAClC,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QAC/C,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO;QACN,KAAK,EAAE,WAAW;QAClB,KAAK;KACL,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAC1B,WAAkD;IAElD,MAAM,MAAM,GAAmC,EAAE,CAAC;IAClD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,WAAW,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAoC,CAAC;AAE5E;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,MAAwB;IAClD,OAAO,WAAW,CAAC,mBAAmB,EAAE,MAAM,EAAE,GAAG,EAAE;QACpD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;YACrB,KAAK,QAAQ,CAAC,KAAK;gBAClB,OAAO,sBAAsB,CAAC,MAAM,CAAC,CAAC;YACvC,KAAK,QAAQ,CAAC,IAAI;gBACjB,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;YACtC,KAAK,QAAQ,CAAC,GAAG;gBAChB,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;YACrC,KAAK,QAAQ,CAAC,MAAM;gBACnB,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC;YACxC;gBACC,MAAM,IAAI,SAAS,CAAC,6BAA8B,MAA2B,CAAC,IAAI,EAAE,CAAC,CAAC;QACxF,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,MAA6B;IAC5D,MAAM,YAAY,GAAoB,EAAE,CAAC;IACzC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACpC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IACH,OAAO;QACN,IAAI,EAAE,OAAO;QACb,mBAAmB,EAAE,QAAQ,CAAC,KAAK;QACnC,KAAK,EAAE;YACN,KAAK,EAAE,YAAY;SACnB;KACD,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,MAA4B;IAC1D,IAAI,IAAwB,CAAC;IAC7B,QAAQ,MAAM,CAAC,QAAQ,EAAE,CAAC;QACzB,KAAK,WAAW,CAAC,MAAM;YACtB,IAAI,GAAG,QAAQ,CAAC;YAChB,MAAM;QACP,KAAK,WAAW,CAAC,MAAM;YACtB,IAAI,GAAG,QAAQ,CAAC;YAChB,MAAM;QACP,KAAK,WAAW,CAAC,OAAO;YACvB,IAAI,GAAG,SAAS,CAAC;YACjB,MAAM;QACP,KAAK,WAAW,CAAC,IAAI;YACpB,IAAI,GAAG,MAAM,CAAC;YACd,MAAM;QACP,KAAK,WAAW,CAAC,WAAW;YAC3B,MAAM,IAAI,UAAU,CAAC,kDAAkD,CAAC,CAAC;QAC1E;YACC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,OAAO;QACN,IAAI;QACJ,mBAAmB,EAAE,QAAQ,CAAC,IAAI;KAClC,CAAC;AACH,CAAC;AAED,SAAS,uBAAuB,CAAC,MAA8B;IAC9D,MAAM,UAAU,GAAoC,EAAE,CAAC;IACvD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1D,MAAM,KAAK,GAAoB,EAAE,CAAC;QAClC,KAAK,MAAM,WAAW,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YAC9C,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;QAC1C,CAAC;QAED,UAAU,CAAC,GAAG,CAAC,GAAG;YACjB,KAAK;SACL,CAAC;QACF,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,QAAQ,EAAE,CAAC;YACvC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;IACF,CAAC;IACD,OAAO;QACN,IAAI,EAAE,QAAQ;QACd,mBAAmB,EAAE,QAAQ,CAAC,MAAM;QACpC,UAAU;QACV,QAAQ;QACR,oBAAoB,EAAE,KAAK;KAC3B,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,MAA2B;IACxD,MAAM,YAAY,GAAoB,EAAE,CAAC;IACzC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACpC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IACH,OAAO;QACN,IAAI,EAAE,QAAQ;QACd,mBAAmB,EAAE,QAAQ,CAAC,GAAG;QACjC,iBAAiB,EAAE;YAClB,MAAM,EAAE;gBACP,KAAK,EAAE,YAAY;aACnB;SACD;KACD,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACxC,OAAO;QACN,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC;KAC/B,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACtC,OAAO,WAAW,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { ValueSchema } from \"../core/index.js\";\nimport { getOrCreate } from \"../util/index.js\";\nimport type {\n\tJsonArrayNodeSchema,\n\tJsonFieldSchema,\n\tJsonSchemaRef,\n\tJsonRefPath,\n\tJsonLeafNodeSchema,\n\tJsonMapNodeSchema,\n\tJsonNodeSchema,\n\tJsonObjectNodeSchema,\n\tJsonTreeSchema,\n\tJsonLeafSchemaType,\n} from \"./jsonSchema.js\";\nimport { FieldKind } from \"./schemaTypes.js\";\nimport type {\n\tSimpleArrayNodeSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleNodeSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleTreeSchema,\n} from \"./simpleSchema.js\";\nimport { NodeKind } from \"./core/index.js\";\n\n/**\n * Generates a JSON Schema representation from a simple tree schema.\n * @internal\n */\nexport function toJsonSchema(schema: SimpleTreeSchema): JsonTreeSchema {\n\tconst definitions = convertDefinitions(schema.definitions);\n\n\tconst anyOf: JsonSchemaRef[] = [];\n\tfor (const allowedType of schema.allowedTypes) {\n\t\tanyOf.push(createSchemaRef(allowedType));\n\t}\n\n\treturn {\n\t\t$defs: definitions,\n\t\tanyOf,\n\t};\n}\n\nfunction convertDefinitions(\n\tdefinitions: ReadonlyMap<string, SimpleNodeSchema>,\n): Record<string, JsonNodeSchema> {\n\tconst result: Record<string, JsonNodeSchema> = {};\n\tfor (const [key, value] of definitions) {\n\t\tresult[key] = convertNodeSchema(value);\n\t}\n\treturn result;\n}\n\n/**\n * Private symbol under which the results of {@link convertNodeSchema} are cached on an input {@link SimpleNodeSchema}.\n */\nconst nodeJsonSchemaCache = new WeakMap<SimpleNodeSchema, JsonNodeSchema>();\n\n/**\n * Converts an input {@link SimpleNodeSchema} to a {@link JsonNodeSchema}.\n *\n * @remarks Caches the result on the input schema for future calls.\n */\nfunction convertNodeSchema(schema: SimpleNodeSchema): JsonNodeSchema {\n\treturn getOrCreate(nodeJsonSchemaCache, schema, () => {\n\t\tswitch (schema.kind) {\n\t\t\tcase NodeKind.Array:\n\t\t\t\treturn convertArrayNodeSchema(schema);\n\t\t\tcase NodeKind.Leaf:\n\t\t\t\treturn convertLeafNodeSchema(schema);\n\t\t\tcase NodeKind.Map:\n\t\t\t\treturn convertMapNodeSchema(schema);\n\t\t\tcase NodeKind.Object:\n\t\t\t\treturn convertObjectNodeSchema(schema);\n\t\t\tdefault:\n\t\t\t\tthrow new TypeError(`Unknown node schema kind: ${(schema as SimpleNodeSchema).kind}`);\n\t\t}\n\t});\n}\n\nfunction convertArrayNodeSchema(schema: SimpleArrayNodeSchema): JsonArrayNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tschema.allowedTypes.forEach((type) => {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t});\n\treturn {\n\t\ttype: \"array\",\n\t\t_treeNodeSchemaKind: NodeKind.Array,\n\t\titems: {\n\t\t\tanyOf: allowedTypes,\n\t\t},\n\t};\n}\n\nfunction convertLeafNodeSchema(schema: SimpleLeafNodeSchema): JsonLeafNodeSchema {\n\tlet type: JsonLeafSchemaType;\n\tswitch (schema.leafKind) {\n\t\tcase ValueSchema.String:\n\t\t\ttype = \"string\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Number:\n\t\t\ttype = \"number\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Boolean:\n\t\t\ttype = \"boolean\";\n\t\t\tbreak;\n\t\tcase ValueSchema.Null:\n\t\t\ttype = \"null\";\n\t\t\tbreak;\n\t\tcase ValueSchema.FluidHandle:\n\t\t\tthrow new UsageError(\"Fluid handles are not supported via JSON Schema.\");\n\t\tdefault:\n\t\t\tunreachableCase(schema.leafKind);\n\t}\n\n\treturn {\n\t\ttype,\n\t\t_treeNodeSchemaKind: NodeKind.Leaf,\n\t};\n}\n\nfunction convertObjectNodeSchema(schema: SimpleObjectNodeSchema): JsonObjectNodeSchema {\n\tconst properties: Record<string, JsonFieldSchema> = {};\n\tconst required: string[] = [];\n\tfor (const [key, value] of Object.entries(schema.fields)) {\n\t\tconst anyOf: JsonSchemaRef[] = [];\n\t\tfor (const allowedType of value.allowedTypes) {\n\t\t\tanyOf.push(createSchemaRef(allowedType));\n\t\t}\n\n\t\tproperties[key] = {\n\t\t\tanyOf,\n\t\t};\n\t\tif (value.kind === FieldKind.Required) {\n\t\t\trequired.push(key);\n\t\t}\n\t}\n\treturn {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: NodeKind.Object,\n\t\tproperties,\n\t\trequired,\n\t\tadditionalProperties: false,\n\t};\n}\n\nfunction convertMapNodeSchema(schema: SimpleMapNodeSchema): JsonMapNodeSchema {\n\tconst allowedTypes: JsonSchemaRef[] = [];\n\tschema.allowedTypes.forEach((type) => {\n\t\tallowedTypes.push(createSchemaRef(type));\n\t});\n\treturn {\n\t\ttype: \"object\",\n\t\t_treeNodeSchemaKind: NodeKind.Map,\n\t\tpatternProperties: {\n\t\t\t\"^.*$\": {\n\t\t\t\tanyOf: allowedTypes,\n\t\t\t},\n\t\t},\n\t};\n}\n\nfunction createSchemaRef(schemaId: string): JsonSchemaRef {\n\treturn {\n\t\t\"$ref\": createRefPath(schemaId),\n\t};\n}\n\nfunction createRefPath(schemaId: string): JsonRefPath {\n\treturn `#/$defs/${schemaId}`;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"viewSchemaToSimpleSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/viewSchemaToSimpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAGN,KAAK,oBAAoB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAOX,gBAAgB,EAChB,MAAM,mBAAmB,CAAC;AAM3B;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,GAAG,gBAAgB,CAYjF"}
|
package/src/domains/README.md
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# domains
|
|
2
|
-
|
|
3
|
-
A collection of domain libraries.
|
|
4
|
-
|
|
5
|
-
Domain libraries collect together code related to a particular content type or related sets of content types (aka a domain).
|
|
6
|
-
These typically include schema, as well as an specialized code that works with objects that are related to those schema.
|
package/src/domains/fence.json
DELETED
package/src/domains/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export { SchemaBuilder } from "./schemaBuilder.js";
|
|
7
|
-
export {
|
|
8
|
-
cursorToJsonObject,
|
|
9
|
-
jsonArray,
|
|
10
|
-
jsonObject,
|
|
11
|
-
jsonRoot,
|
|
12
|
-
jsonSchema,
|
|
13
|
-
singleJsonCursor,
|
|
14
|
-
typedJsonCursor,
|
|
15
|
-
type TypedJsonCompatible,
|
|
16
|
-
type TypedJsonCompatibleObject,
|
|
17
|
-
} from "./json/index.js";
|
|
18
|
-
|
|
19
|
-
export { leaf } from "./leafDomain.js";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
singleJsonCursor,
|
|
8
|
-
cursorToJsonObject,
|
|
9
|
-
typedJsonCursor,
|
|
10
|
-
type TypedJsonCompatible,
|
|
11
|
-
type TypedJsonCompatibleObject,
|
|
12
|
-
} from "./jsonCursor.js";
|
|
13
|
-
export { jsonSchema, jsonObject, jsonArray, jsonRoot } from "./jsonDomainSchema.js";
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
EmptyKey,
|
|
10
|
-
type FieldKey,
|
|
11
|
-
type ITreeCursor,
|
|
12
|
-
type ITreeCursorSynchronous,
|
|
13
|
-
mapCursorField,
|
|
14
|
-
mapCursorFields,
|
|
15
|
-
} from "../../core/index.js";
|
|
16
|
-
import {
|
|
17
|
-
type CursorAdapter,
|
|
18
|
-
stackTreeNodeCursor,
|
|
19
|
-
TreeNodeSchemaBase,
|
|
20
|
-
} from "../../feature-libraries/index.js";
|
|
21
|
-
import { brand, isReadonlyArray, type JsonCompatible } from "../../util/index.js";
|
|
22
|
-
import { leaf } from "../leafDomain.js";
|
|
23
|
-
|
|
24
|
-
import { jsonArray, jsonObject } from "./jsonDomainSchema.js";
|
|
25
|
-
import { isFluidHandle } from "@fluidframework/runtime-utils/internal";
|
|
26
|
-
import type { IFluidHandle } from "@fluidframework/core-interfaces/internal";
|
|
27
|
-
|
|
28
|
-
const adapter: CursorAdapter<JsonCompatible> = {
|
|
29
|
-
value: (node: JsonCompatible) =>
|
|
30
|
-
node !== null && typeof node === "object"
|
|
31
|
-
? undefined // arrays and objects have no defined value
|
|
32
|
-
: node, // null, boolean, numbers, and strings are their own values
|
|
33
|
-
type: (node: JsonCompatible) => {
|
|
34
|
-
const type = typeof node;
|
|
35
|
-
|
|
36
|
-
switch (type) {
|
|
37
|
-
case "number":
|
|
38
|
-
return leaf.number.name;
|
|
39
|
-
case "string":
|
|
40
|
-
return leaf.string.name;
|
|
41
|
-
case "boolean":
|
|
42
|
-
return leaf.boolean.name;
|
|
43
|
-
default:
|
|
44
|
-
if (node === null) {
|
|
45
|
-
return leaf.null.name;
|
|
46
|
-
} else if (isReadonlyArray(node)) {
|
|
47
|
-
return jsonArray.name;
|
|
48
|
-
} else {
|
|
49
|
-
return jsonObject.name;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
keysFromNode: (node: JsonCompatible): readonly FieldKey[] => {
|
|
54
|
-
switch (typeof node) {
|
|
55
|
-
case "object":
|
|
56
|
-
if (node === null) {
|
|
57
|
-
return [];
|
|
58
|
-
} else if (isReadonlyArray(node)) {
|
|
59
|
-
return node.length === 0 ? [] : [EmptyKey];
|
|
60
|
-
} else {
|
|
61
|
-
return Object.keys(node) as FieldKey[];
|
|
62
|
-
}
|
|
63
|
-
default:
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
getFieldFromNode: (node: JsonCompatible, key: FieldKey): readonly JsonCompatible[] => {
|
|
68
|
-
// Object.prototype.hasOwnProperty can return true for strings (ex: with key "0"), so we have to filter them out.
|
|
69
|
-
// Rather than just special casing strings, we can handle them with an early return for all primitives.
|
|
70
|
-
if (typeof node !== "object") {
|
|
71
|
-
return [];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (node === null) {
|
|
75
|
-
return [];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (isReadonlyArray(node)) {
|
|
79
|
-
return key === EmptyKey ? node : [];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (Object.prototype.hasOwnProperty.call(node, key)) {
|
|
83
|
-
const field = node[key];
|
|
84
|
-
assert(
|
|
85
|
-
field !== undefined,
|
|
86
|
-
0x41e /* explicit undefined fields should not be preserved in JSON */,
|
|
87
|
-
);
|
|
88
|
-
return [field];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return [];
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Used to read generic json compatible data as a tree in the JSON domain.
|
|
97
|
-
* The returned tree will have a schema in the json domain as defined by {@link jsonRoot}.
|
|
98
|
-
*
|
|
99
|
-
* @returns an {@link ITreeCursorSynchronous} for a single {@link JsonCompatible}.
|
|
100
|
-
*/
|
|
101
|
-
export function singleJsonCursor(root: JsonCompatible): ITreeCursorSynchronous {
|
|
102
|
-
return stackTreeNodeCursor(adapter, root);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Extract a JS object tree from the contents of the given ITreeCursor.
|
|
107
|
-
* Assumes that ITreeCursor contains only unaugmented JsonTypes.
|
|
108
|
-
*/
|
|
109
|
-
export function cursorToJsonObject(reader: ITreeCursor): JsonCompatible {
|
|
110
|
-
const type = reader.type;
|
|
111
|
-
|
|
112
|
-
switch (type) {
|
|
113
|
-
case leaf.number.name:
|
|
114
|
-
case leaf.boolean.name:
|
|
115
|
-
case leaf.string.name:
|
|
116
|
-
assert(reader.value !== undefined, 0x84f /* out of schema: missing value */);
|
|
117
|
-
assert(!isFluidHandle(reader.value), 0x850 /* out of schema: unexpected FluidHandle */);
|
|
118
|
-
return reader.value;
|
|
119
|
-
case jsonArray.name: {
|
|
120
|
-
reader.enterField(EmptyKey);
|
|
121
|
-
const result = mapCursorField(reader, cursorToJsonObject);
|
|
122
|
-
reader.exitField();
|
|
123
|
-
return result;
|
|
124
|
-
}
|
|
125
|
-
case jsonObject.name: {
|
|
126
|
-
const result: JsonCompatible = {};
|
|
127
|
-
mapCursorFields(reader, (cursor) => {
|
|
128
|
-
const key = cursor.getFieldKey();
|
|
129
|
-
assert(cursor.firstNode(), 0x420 /* expected non-empty field */);
|
|
130
|
-
// like `result[key] = cursorToJsonObject(reader);` except safe when keyString == "__proto__".
|
|
131
|
-
Object.defineProperty(result, key, {
|
|
132
|
-
enumerable: true,
|
|
133
|
-
configurable: true,
|
|
134
|
-
writable: true,
|
|
135
|
-
value: cursorToJsonObject(reader),
|
|
136
|
-
});
|
|
137
|
-
assert(!cursor.nextNode(), 0x421 /* expected exactly one node */);
|
|
138
|
-
});
|
|
139
|
-
return result;
|
|
140
|
-
}
|
|
141
|
-
default: {
|
|
142
|
-
assert(type === leaf.null.name, 0x422 /* unexpected type */);
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// #region TypedJsonCursor
|
|
149
|
-
|
|
150
|
-
/** Used to construct a {@link TypedJsonCursor} */
|
|
151
|
-
export interface TypedJsonCompatibleObject {
|
|
152
|
-
[key: string]: TypedJsonCompatible;
|
|
153
|
-
[typedJsonSymbol]: string | TreeNodeSchemaBase;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** Used to construct a {@link TypedJsonCursor} */
|
|
157
|
-
export type TypedJsonCompatible =
|
|
158
|
-
| JsonCompatible
|
|
159
|
-
| TypedJsonCompatibleObject
|
|
160
|
-
| TypedJsonCompatible[]
|
|
161
|
-
| IFluidHandle
|
|
162
|
-
| JsonCompatible;
|
|
163
|
-
|
|
164
|
-
const typedJsonSymbol = Symbol("JSON Cursor Type");
|
|
165
|
-
|
|
166
|
-
function isObject(json: TypedJsonCompatible): json is TypedJsonCompatibleObject {
|
|
167
|
-
if (typeof json === "object" && json !== null) {
|
|
168
|
-
const typed = json as Partial<TypedJsonCompatibleObject>;
|
|
169
|
-
return typed[typedJsonSymbol] !== undefined;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const typedAdapter: CursorAdapter<TypedJsonCompatible> = {
|
|
176
|
-
value: (node: TypedJsonCompatible) => {
|
|
177
|
-
if (isFluidHandle(node)) {
|
|
178
|
-
return node;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// TODO: Get rid of this cast by combining TypedJsonCompatible and JsonCompatible into a single cursor with flags to configure behavior.
|
|
182
|
-
// This cast is necessary because TypedJsonCompatible can have Fluid handles underneath it, however, `adapter` only cares if `node` itself is a FluidHandle, which it is not.
|
|
183
|
-
return adapter.value(node as JsonCompatible);
|
|
184
|
-
},
|
|
185
|
-
type: (node: TypedJsonCompatible) => {
|
|
186
|
-
if (isFluidHandle(node)) {
|
|
187
|
-
return leaf.handle.name;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (isObject(node)) {
|
|
191
|
-
const type = node[typedJsonSymbol];
|
|
192
|
-
return type instanceof TreeNodeSchemaBase ? type.name : brand(type);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
return adapter.type(node as JsonCompatible);
|
|
196
|
-
},
|
|
197
|
-
keysFromNode: (node: TypedJsonCompatible): readonly FieldKey[] => {
|
|
198
|
-
if (isFluidHandle(node)) {
|
|
199
|
-
return [];
|
|
200
|
-
}
|
|
201
|
-
return adapter.keysFromNode(node as JsonCompatible);
|
|
202
|
-
},
|
|
203
|
-
getFieldFromNode: (
|
|
204
|
-
node: TypedJsonCompatible,
|
|
205
|
-
key: FieldKey,
|
|
206
|
-
): readonly TypedJsonCompatible[] => {
|
|
207
|
-
if (isFluidHandle(node)) {
|
|
208
|
-
return [];
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const field = adapter.getFieldFromNode(node as JsonCompatible, key);
|
|
212
|
-
if (isReadonlyArray(field) && field.length === 1 && isReadonlyArray(field[0])) {
|
|
213
|
-
// If the field is an array wrapping another array, then unbox to the inner array
|
|
214
|
-
return field[0];
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
return field;
|
|
218
|
-
},
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* A variant of {@link singleJsonCursor} which allows types to be provided for nodes.
|
|
223
|
-
*
|
|
224
|
-
* @remarks Types are optional, but if present will be used to derive the type of the node when the cursor is read.
|
|
225
|
-
*
|
|
226
|
-
* This cursor differs from singleJsonCursor in that it inlines arrays, (arrays are not boxed into an "array node" but are directly interpreted as sequence fields).
|
|
227
|
-
*
|
|
228
|
-
* It also allows Fluid handles as input.
|
|
229
|
-
*
|
|
230
|
-
* @example
|
|
231
|
-
* ```ts
|
|
232
|
-
* const cursor = typedJsonCursor({
|
|
233
|
-
* [typedJsonCursor.type]: Point,
|
|
234
|
-
* x: 3,
|
|
235
|
-
* y: 42
|
|
236
|
-
* });
|
|
237
|
-
* ```
|
|
238
|
-
*/
|
|
239
|
-
const singleTypedJsonCursor = function (root: TypedJsonCompatible): ITreeCursorSynchronous {
|
|
240
|
-
return stackTreeNodeCursor(typedAdapter, root);
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
singleTypedJsonCursor.type = typedJsonSymbol;
|
|
244
|
-
|
|
245
|
-
export { singleTypedJsonCursor as typedJsonCursor };
|
|
246
|
-
|
|
247
|
-
// #endregion TypedJsonCursor
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Adding this unused import makes the generated d.ts file produced by TypeScript stop breaking API-Extractor's rollup generation.
|
|
7
|
-
// Without this import, TypeScript generates inline `import("../..")` statements in the d.ts file,
|
|
8
|
-
// which API-Extractor leaves as is when generating the rollup, leaving them pointing at the wrong directory.
|
|
9
|
-
// API-Extractor issue: https://github.com/microsoft/rushstack/issues/4507
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports
|
|
11
|
-
import { EmptyKey, ValueSchema } from "../../core/index.js";
|
|
12
|
-
import {
|
|
13
|
-
FieldKinds,
|
|
14
|
-
type FlexAllowedTypes,
|
|
15
|
-
FlexFieldSchema,
|
|
16
|
-
SchemaBuilderInternal,
|
|
17
|
-
} from "../../feature-libraries/index.js";
|
|
18
|
-
import type { requireAssignableTo } from "../../util/index.js";
|
|
19
|
-
import { leaf } from "../leafDomain.js";
|
|
20
|
-
|
|
21
|
-
const builder = new SchemaBuilderInternal({
|
|
22
|
-
scope: "com.fluidframework.json",
|
|
23
|
-
libraries: [leaf.library],
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const jsonPrimitives = [...leaf.primitives, leaf.null] as const;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Types allowed as roots of Json content.
|
|
30
|
-
*/
|
|
31
|
-
export const jsonRoot = [() => jsonObject, () => jsonArray, ...jsonPrimitives] as const;
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
// Recursive objects don't get this type checking automatically, so confirm it
|
|
35
|
-
type _check = requireAssignableTo<typeof jsonRoot, FlexAllowedTypes>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const jsonObject = builder.mapRecursive(
|
|
39
|
-
"object",
|
|
40
|
-
FlexFieldSchema.createUnsafe(FieldKinds.optional, jsonRoot),
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
export const jsonArray = builder.objectRecursive("array", {
|
|
44
|
-
[EmptyKey]: FlexFieldSchema.createUnsafe(FieldKinds.sequence, jsonRoot),
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export const jsonSchema = builder.intoLibrary();
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { ValueSchema } from "../core/index.js";
|
|
7
|
-
import { SchemaBuilderInternal } from "../feature-libraries/index.js";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Names in this domain follow https://en.wikipedia.org/wiki/Reverse_domain_name_notation
|
|
11
|
-
*/
|
|
12
|
-
const builder = new SchemaBuilderInternal({ scope: "com.fluidframework.leaf" });
|
|
13
|
-
|
|
14
|
-
const number = builder.leaf("number", ValueSchema.Number);
|
|
15
|
-
const boolean = builder.leaf("boolean", ValueSchema.Boolean);
|
|
16
|
-
const string = builder.leaf("string", ValueSchema.String);
|
|
17
|
-
const handle = builder.leaf("handle", ValueSchema.FluidHandle);
|
|
18
|
-
const nullSchema = builder.leaf("null", ValueSchema.Null);
|
|
19
|
-
|
|
20
|
-
const primitives = [number, boolean, string] as const;
|
|
21
|
-
const all = [handle, nullSchema, ...primitives] as const;
|
|
22
|
-
|
|
23
|
-
const library = builder.intoLibrary();
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Built-in {@link LeafNodeSchema}.
|
|
27
|
-
*/
|
|
28
|
-
export const leaf = {
|
|
29
|
-
/**
|
|
30
|
-
* {@link LeafNodeSchema} for holding a JavaScript `number`.
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* The number is a [double-precision 64-bit binary format IEEE 754](https://en.wikipedia.org/wiki/Double-precision_floating-point_format) value, however there are some exceptions:
|
|
34
|
-
* - `NaN`, and the infinities should not be used.
|
|
35
|
-
* - `-0` may be converted to `0` in some cases.
|
|
36
|
-
*
|
|
37
|
-
* These limitations match the limitations of JSON.
|
|
38
|
-
* @privateRemarks
|
|
39
|
-
* TODO:
|
|
40
|
-
* We should be much more clear about what happens if you use problematic values.
|
|
41
|
-
* We should validate and/or normalize them when inserting content.
|
|
42
|
-
*/
|
|
43
|
-
number,
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* {@link LeafNodeSchema} for holding a boolean.
|
|
47
|
-
*/
|
|
48
|
-
boolean,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* {@link LeafNodeSchema} for holding a JavaScript `string`.
|
|
52
|
-
*
|
|
53
|
-
* @remarks
|
|
54
|
-
* Strings containing unpaired UTF-16 surrogate pair code units may not be handled correctly.
|
|
55
|
-
*
|
|
56
|
-
* These limitations come from the use of UTF-8 encoding of the strings, which requires them to be valid unicode.
|
|
57
|
-
* JavaScript does not make this requirement for its strings so not all possible JavaScript strings are supported.
|
|
58
|
-
* @privateRemarks
|
|
59
|
-
* TODO:
|
|
60
|
-
* We should be much more clear about what happens if you use problematic values.
|
|
61
|
-
* We should validate and/or normalize them when inserting content.
|
|
62
|
-
*/
|
|
63
|
-
string,
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* {@link LeafNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.
|
|
67
|
-
*/
|
|
68
|
-
handle,
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* {@link LeafNodeSchema} for JavaScript `null`.
|
|
72
|
-
*
|
|
73
|
-
* @remarks
|
|
74
|
-
* There are good [reasons to avoid using null](https://www.npmjs.com/package/%40rushstack/eslint-plugin#rushstackno-new-null) in JavaScript, however sometimes it is desired.
|
|
75
|
-
* This {@link LeafNodeSchema} node provides the option to include nulls in trees when desired.
|
|
76
|
-
* Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
|
|
77
|
-
*/
|
|
78
|
-
null: nullSchema,
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* The set of {@link LeafNodeSchema} which correspond to JavaScript primitive (non-object) types.
|
|
82
|
-
*/
|
|
83
|
-
primitives,
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* All {@link LeafNodeSchema} defined in this library..
|
|
87
|
-
*/
|
|
88
|
-
all,
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* {@link SchemaLibrary} of the {@link LeafNodeSchema}.
|
|
92
|
-
*
|
|
93
|
-
* @privateRemarks
|
|
94
|
-
* This is included by default in schema produced with {@link SchemaBuilder}.
|
|
95
|
-
*/
|
|
96
|
-
library,
|
|
97
|
-
};
|