@fluidframework/tree 2.30.0 → 2.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1632 -1500
- package/api-extractor/api-extractor.current.json +0 -3
- package/api-report/tree.alpha.api.md +233 -88
- package/api-report/tree.beta.api.md +86 -61
- package/api-report/tree.legacy.alpha.api.md +86 -61
- package/api-report/tree.legacy.public.api.md +86 -61
- package/api-report/tree.public.api.md +86 -61
- package/dist/alpha.d.ts +26 -1
- package/dist/beta.d.ts +5 -1
- package/dist/codec/codec.d.ts +1 -1
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +3 -4
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/discriminatedUnions.d.ts.map +1 -1
- package/dist/codec/discriminatedUnions.js +1 -1
- package/dist/codec/discriminatedUnions.js.map +1 -1
- package/dist/core/rebase/utils.js +1 -1
- package/dist/core/rebase/utils.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +4 -1
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +8 -4
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js +4 -4
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/treeTextFormat.js +2 -2
- package/dist/core/tree/treeTextFormat.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/basicChunk.js +8 -8
- package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -2
- package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/chunkedForest.js +3 -3
- package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +3 -4
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/emptyChunk.js +15 -15
- package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/uniformChunk.js +4 -4
- package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +19 -19
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +1 -2
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyField.js +3 -3
- package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/dist/feature-libraries/flex-tree/lazyNode.js +4 -4
- package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
- package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +4 -4
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/isNeverTree.js +2 -3
- package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +4 -4
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js +1 -1
- package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/dist/feature-libraries/schema-index/codec.js +2 -1
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/compose.js +16 -17
- package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +1 -1
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/utils.js +1 -1
- package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +4 -5
- package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/jsonDomainSchema.d.ts +15 -16
- package/dist/jsonDomainSchema.d.ts.map +1 -1
- package/dist/jsonDomainSchema.js +10 -5
- package/dist/jsonDomainSchema.js.map +1 -1
- package/dist/legacy.d.ts +5 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +5 -1
- package/dist/serializableDomainSchema.d.ts +8 -14
- package/dist/serializableDomainSchema.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +1 -1
- package/dist/shared-tree/schematizeTree.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +16 -12
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js +1 -1
- package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/dist/shared-tree/treeApiAlpha.d.ts +6 -2
- package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeApiAlpha.js +20 -17
- package/dist/shared-tree/treeApiAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +1 -1
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +4 -3
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +2 -2
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/editManager.d.ts.map +1 -1
- package/dist/shared-tree-core/editManager.js +37 -31
- package/dist/shared-tree-core/editManager.js.map +1 -1
- package/dist/sharedTreeAttributes.d.ts +18 -0
- package/dist/sharedTreeAttributes.d.ts.map +1 -0
- package/dist/sharedTreeAttributes.js +25 -0
- package/dist/sharedTreeAttributes.js.map +1 -0
- package/dist/simple-tree/api/customTree.js +3 -3
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.d.ts +10 -0
- package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getJsonSchema.js +10 -0
- package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.d.ts +13 -43
- package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/getSimpleSchema.js +13 -43
- package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +3 -3
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +2 -2
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +100 -58
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +65 -133
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +31 -23
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +17 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +40 -5
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.d.ts +4 -4
- package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFromSimple.js +26 -15
- package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +3 -2
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +7 -6
- package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js +4 -3
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
- package/dist/simple-tree/api/tree.d.ts +1 -1
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js +6 -6
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +3 -3
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.d.ts +87 -21
- package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/dist/simple-tree/api/typesUnsafe.js +0 -1
- package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +4 -4
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/api/view.d.ts.map +1 -1
- package/dist/simple-tree/api/view.js +16 -17
- package/dist/simple-tree/api/view.js.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +16 -3
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +70 -147
- package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/dist/simple-tree/arrayNode.d.ts +5 -4
- package/dist/simple-tree/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/arrayNode.js +13 -9
- package/dist/simple-tree/arrayNode.js.map +1 -1
- package/dist/simple-tree/arrayNodeTypes.d.ts +46 -0
- package/dist/simple-tree/arrayNodeTypes.d.ts.map +1 -0
- package/dist/simple-tree/arrayNodeTypes.js +30 -0
- package/dist/simple-tree/arrayNodeTypes.js.map +1 -0
- package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/dist/simple-tree/core/getOrCreateNode.js +1 -11
- package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +1 -2
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +2 -3
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.d.ts +12 -5
- package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +36 -20
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +14 -7
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/unhydratedFlexTree.js +5 -5
- package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/dist/simple-tree/index.d.ts +9 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +9 -1
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +22 -5
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +2 -0
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/mapNode.d.ts +3 -2
- package/dist/simple-tree/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/mapNode.js +5 -1
- package/dist/simple-tree/mapNode.js.map +1 -1
- package/dist/simple-tree/mapNodeTypes.d.ts +46 -0
- package/dist/simple-tree/mapNodeTypes.d.ts.map +1 -0
- package/dist/simple-tree/mapNodeTypes.js +30 -0
- package/dist/simple-tree/mapNodeTypes.js.map +1 -0
- package/dist/simple-tree/objectNode.d.ts +10 -3
- package/dist/simple-tree/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/objectNode.js +10 -5
- package/dist/simple-tree/objectNode.js.map +1 -1
- package/dist/simple-tree/objectNodeTypes.d.ts +9 -5
- package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/objectNodeTypes.js +3 -0
- package/dist/simple-tree/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/proxies.js +2 -1
- package/dist/simple-tree/proxies.js.map +1 -1
- package/dist/simple-tree/schemaTypes.d.ts +47 -6
- package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
- package/dist/simple-tree/schemaTypes.js +40 -4
- package/dist/simple-tree/schemaTypes.js.map +1 -1
- package/dist/simple-tree/{api/simpleSchema.d.ts → simpleSchema.d.ts} +54 -30
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
- package/dist/simple-tree/simpleSchema.js.map +1 -0
- package/dist/simple-tree/toMapTree.js +3 -3
- package/dist/simple-tree/toMapTree.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +1 -1
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/treeNodeValid.js +4 -5
- package/dist/simple-tree/treeNodeValid.js.map +1 -1
- package/dist/treeFactory.d.ts +0 -12
- package/dist/treeFactory.d.ts.map +1 -1
- package/dist/treeFactory.js +5 -21
- package/dist/treeFactory.js.map +1 -1
- package/dist/util/idAllocator.d.ts.map +1 -1
- package/dist/util/idAllocator.js +1 -2
- package/dist/util/idAllocator.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +2 -3
- package/dist/util/index.js.map +1 -1
- package/dist/util/typeCheck.d.ts +7 -0
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/utils.d.ts +0 -1
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +1 -4
- package/dist/util/utils.js.map +1 -1
- package/lib/alpha.d.ts +26 -1
- package/lib/beta.d.ts +5 -1
- package/lib/codec/codec.d.ts +1 -1
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +1 -2
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/discriminatedUnions.d.ts.map +1 -1
- package/lib/codec/discriminatedUnions.js +2 -2
- package/lib/codec/discriminatedUnions.js.map +1 -1
- package/lib/core/rebase/utils.js +1 -1
- package/lib/core/rebase/utils.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +4 -1
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +6 -2
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js +2 -2
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/treeTextFormat.js +1 -1
- package/lib/core/tree/treeTextFormat.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/basicChunk.js +2 -2
- package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkTree.js +2 -2
- package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -2
- package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +1 -2
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -1
- package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/uniformChunk.js +2 -2
- package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +1 -2
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyField.js +2 -2
- package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
- package/lib/feature-libraries/flex-tree/lazyNode.js +2 -2
- package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
- package/lib/feature-libraries/indexing/anchorTreeIndex.js +2 -2
- package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +2 -2
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/isNeverTree.js +1 -2
- package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +2 -2
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +2 -2
- package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +2 -2
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
- package/lib/feature-libraries/schema-index/codec.js +2 -1
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/compose.js +1 -2
- package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +2 -2
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +2 -2
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/utils.js +2 -2
- package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +1 -2
- package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/jsonDomainSchema.d.ts +15 -16
- package/lib/jsonDomainSchema.d.ts.map +1 -1
- package/lib/jsonDomainSchema.js +11 -6
- package/lib/jsonDomainSchema.js.map +1 -1
- package/lib/legacy.d.ts +5 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +5 -1
- package/lib/serializableDomainSchema.d.ts +8 -14
- package/lib/serializableDomainSchema.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +2 -2
- package/lib/shared-tree/schematizeTree.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +14 -10
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFamily.js +2 -2
- package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
- package/lib/shared-tree/treeApiAlpha.d.ts +6 -2
- package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeApiAlpha.js +10 -7
- package/lib/shared-tree/treeApiAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +2 -2
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +4 -3
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +2 -2
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/editManager.d.ts.map +1 -1
- package/lib/shared-tree-core/editManager.js +35 -29
- package/lib/shared-tree-core/editManager.js.map +1 -1
- package/lib/sharedTreeAttributes.d.ts +18 -0
- package/lib/sharedTreeAttributes.d.ts.map +1 -0
- package/lib/sharedTreeAttributes.js +22 -0
- package/lib/sharedTreeAttributes.js.map +1 -0
- package/lib/simple-tree/api/customTree.js +2 -2
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.d.ts +10 -0
- package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getJsonSchema.js +10 -0
- package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/getSimpleSchema.d.ts +13 -43
- package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/getSimpleSchema.js +13 -43
- package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +3 -3
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -0
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +100 -58
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +64 -132
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +31 -23
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +18 -2
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +40 -5
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.d.ts +4 -4
- package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFromSimple.js +21 -10
- package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +3 -2
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +6 -6
- package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js +2 -1
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
- package/lib/simple-tree/api/tree.d.ts +1 -1
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js +2 -2
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +2 -2
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.d.ts +87 -21
- package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
- package/lib/simple-tree/api/typesUnsafe.js +0 -1
- package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +2 -2
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/api/view.d.ts.map +1 -1
- package/lib/simple-tree/api/view.js +1 -2
- package/lib/simple-tree/api/view.js.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +16 -3
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +69 -146
- package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
- package/lib/simple-tree/arrayNode.d.ts +5 -4
- package/lib/simple-tree/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/arrayNode.js +7 -3
- package/lib/simple-tree/arrayNode.js.map +1 -1
- package/lib/simple-tree/arrayNodeTypes.d.ts +46 -0
- package/lib/simple-tree/arrayNodeTypes.d.ts.map +1 -0
- package/lib/simple-tree/arrayNodeTypes.js +26 -0
- package/lib/simple-tree/arrayNodeTypes.js.map +1 -0
- package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
- package/lib/simple-tree/core/getOrCreateNode.js +2 -12
- package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +1 -2
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +1 -2
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.d.ts +12 -5
- package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +28 -14
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +14 -7
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/unhydratedFlexTree.js +2 -2
- package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
- package/lib/simple-tree/index.d.ts +9 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +3 -0
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +22 -5
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +2 -0
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/mapNode.d.ts +3 -2
- package/lib/simple-tree/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/mapNode.js +5 -1
- package/lib/simple-tree/mapNode.js.map +1 -1
- package/lib/simple-tree/mapNodeTypes.d.ts +46 -0
- package/lib/simple-tree/mapNodeTypes.d.ts.map +1 -0
- package/lib/simple-tree/mapNodeTypes.js +26 -0
- package/lib/simple-tree/mapNodeTypes.js.map +1 -0
- package/lib/simple-tree/objectNode.d.ts +10 -3
- package/lib/simple-tree/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/objectNode.js +10 -5
- package/lib/simple-tree/objectNode.js.map +1 -1
- package/lib/simple-tree/objectNodeTypes.d.ts +9 -5
- package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/objectNodeTypes.js +3 -0
- package/lib/simple-tree/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/proxies.js +2 -1
- package/lib/simple-tree/proxies.js.map +1 -1
- package/lib/simple-tree/schemaTypes.d.ts +47 -6
- package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
- package/lib/simple-tree/schemaTypes.js +37 -3
- package/lib/simple-tree/schemaTypes.js.map +1 -1
- package/lib/simple-tree/{api/simpleSchema.d.ts → simpleSchema.d.ts} +54 -30
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
- package/lib/simple-tree/simpleSchema.js.map +1 -0
- package/lib/simple-tree/toMapTree.js +2 -2
- package/lib/simple-tree/toMapTree.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +2 -2
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/treeNodeValid.js +1 -2
- package/lib/simple-tree/treeNodeValid.js.map +1 -1
- package/lib/treeFactory.d.ts +0 -12
- package/lib/treeFactory.d.ts.map +1 -1
- package/lib/treeFactory.js +1 -17
- package/lib/treeFactory.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/util/idAllocator.d.ts.map +1 -1
- package/lib/util/idAllocator.js +1 -2
- package/lib/util/idAllocator.js.map +1 -1
- package/lib/util/index.d.ts +1 -1
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -1
- package/lib/util/index.js.map +1 -1
- package/lib/util/typeCheck.d.ts +7 -0
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/utils.d.ts +0 -1
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +0 -2
- package/lib/util/utils.js.map +1 -1
- package/package.json +22 -25
- package/src/codec/codec.ts +2 -2
- package/src/codec/discriminatedUnions.ts +2 -2
- package/src/core/rebase/utils.ts +1 -1
- package/src/core/schema-stored/schema.ts +6 -2
- package/src/core/tree/anchorSet.ts +1 -2
- package/src/core/tree/treeTextFormat.ts +1 -1
- package/src/feature-libraries/chunked-forest/basicChunk.ts +2 -2
- package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -2
- package/src/feature-libraries/chunked-forest/chunkedForest.ts +1 -2
- package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -1
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +2 -2
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +1 -2
- package/src/feature-libraries/chunked-forest/emptyChunk.ts +1 -1
- package/src/feature-libraries/chunked-forest/uniformChunk.ts +2 -2
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
- package/src/feature-libraries/default-schema/schemaChecker.ts +1 -2
- package/src/feature-libraries/flex-tree/lazyField.ts +2 -2
- package/src/feature-libraries/flex-tree/lazyNode.ts +2 -2
- package/src/feature-libraries/indexing/anchorTreeIndex.ts +2 -2
- package/src/feature-libraries/modular-schema/comparison.ts +2 -2
- package/src/feature-libraries/modular-schema/isNeverTree.ts +1 -2
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +1 -2
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +1 -2
- package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +2 -2
- package/src/feature-libraries/object-forest/objectForest.ts +1 -2
- package/src/feature-libraries/schema-index/codec.ts +2 -1
- package/src/feature-libraries/sequence-field/compose.ts +2 -2
- package/src/feature-libraries/sequence-field/invert.ts +2 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +2 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +2 -2
- package/src/feature-libraries/sequence-field/utils.ts +2 -2
- package/src/feature-libraries/treeCursorUtils.ts +1 -2
- package/src/index.ts +26 -3
- package/src/jsonDomainSchema.ts +30 -11
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/schematizeTree.ts +2 -2
- package/src/shared-tree/sharedTree.ts +16 -10
- package/src/shared-tree/sharedTreeChangeFamily.ts +1 -2
- package/src/shared-tree/treeApiAlpha.ts +36 -13
- package/src/shared-tree/treeCheckout.ts +2 -8
- package/src/shared-tree-core/branch.ts +5 -3
- package/src/shared-tree-core/editManager.ts +37 -45
- package/src/sharedTreeAttributes.ts +25 -0
- package/src/simple-tree/api/customTree.ts +2 -2
- package/src/simple-tree/api/getJsonSchema.ts +10 -0
- package/src/simple-tree/api/getSimpleSchema.ts +14 -44
- package/src/simple-tree/api/index.ts +7 -11
- package/src/simple-tree/api/schemaCreationUtilities.ts +1 -2
- package/src/simple-tree/api/schemaFactory.ts +161 -86
- package/src/simple-tree/api/schemaFactoryAlpha.ts +62 -67
- package/src/simple-tree/api/schemaFactoryRecursive.ts +44 -12
- package/src/simple-tree/api/schemaFromSimple.ts +41 -13
- package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +7 -7
- package/src/simple-tree/api/simpleTreeIndex.ts +2 -1
- package/src/simple-tree/api/tree.ts +3 -3
- package/src/simple-tree/api/treeNodeApi.ts +2 -2
- package/src/simple-tree/api/typesUnsafe.ts +151 -33
- package/src/simple-tree/api/verboseTree.ts +2 -2
- package/src/simple-tree/api/view.ts +1 -2
- package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +80 -185
- package/src/simple-tree/arrayNode.ts +20 -14
- package/src/simple-tree/arrayNodeTypes.ts +93 -0
- package/src/simple-tree/core/getOrCreateNode.ts +3 -13
- package/src/simple-tree/core/index.ts +1 -1
- package/src/simple-tree/core/treeNodeKernel.ts +32 -18
- package/src/simple-tree/core/treeNodeSchema.ts +14 -8
- package/src/simple-tree/core/unhydratedFlexTree.ts +2 -2
- package/src/simple-tree/index.ts +30 -9
- package/src/simple-tree/leafNodeSchema.ts +28 -7
- package/src/simple-tree/mapNode.ts +13 -11
- package/src/simple-tree/mapNodeTypes.ts +90 -0
- package/src/simple-tree/objectNode.ts +37 -13
- package/src/simple-tree/objectNodeTypes.ts +21 -16
- package/src/simple-tree/proxies.ts +2 -2
- package/src/simple-tree/schemaTypes.ts +83 -19
- package/src/simple-tree/{api/simpleSchema.ts → simpleSchema.ts} +61 -32
- package/src/simple-tree/toMapTree.ts +2 -2
- package/src/simple-tree/toStoredSchema.ts +2 -2
- package/src/simple-tree/treeNodeValid.ts +1 -2
- package/src/treeFactory.ts +1 -19
- package/src/util/idAllocator.ts +1 -3
- package/src/util/index.ts +0 -1
- package/src/util/typeCheck.ts +7 -0
- package/src/util/utils.ts +0 -3
- package/dist/simple-tree/api/simpleSchema.d.ts.map +0 -1
- package/dist/simple-tree/api/simpleSchema.js.map +0 -1
- package/dist/simple-tree/core/schemaCaching.d.ts +0 -16
- package/dist/simple-tree/core/schemaCaching.d.ts.map +0 -1
- package/dist/simple-tree/core/schemaCaching.js +0 -32
- package/dist/simple-tree/core/schemaCaching.js.map +0 -1
- package/lib/simple-tree/api/simpleSchema.d.ts.map +0 -1
- package/lib/simple-tree/api/simpleSchema.js.map +0 -1
- package/lib/simple-tree/core/schemaCaching.d.ts +0 -16
- package/lib/simple-tree/core/schemaCaching.d.ts.map +0 -1
- package/lib/simple-tree/core/schemaCaching.js +0 -27
- package/lib/simple-tree/core/schemaCaching.js.map +0 -1
- package/prettier.config.cjs +0 -8
- package/src/simple-tree/core/schemaCaching.ts +0 -35
- /package/dist/simple-tree/{api/simpleSchema.js → simpleSchema.js} +0 -0
- /package/lib/simple-tree/{api/simpleSchema.js → simpleSchema.js} +0 -0
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
5
|
+
import { assert, unreachableCase, fail } from "@fluidframework/core-utils/internal";
|
|
6
6
|
import { LeafNodeStoredSchema, MapNodeStoredSchema, ObjectNodeStoredSchema, ValueSchema, Multiplicity, identifierFieldKindIdentifier, } from "../../../core/index.js";
|
|
7
|
-
import { fail } from "../../../util/index.js";
|
|
8
7
|
import { EncoderCache, anyNodeEncoder, asFieldEncoder, compressedEncode, } from "./compressedEncode.js";
|
|
9
8
|
import { SpecialField } from "./format.js";
|
|
10
9
|
import { NodeShape } from "./nodeShape.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaBasedEncode.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"schemaBasedEncode.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/schemaBasedEncode.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IAAI,IAAI,GAAG,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC;AAED,SAAS,oBAAoB,CAAC,MAA+B;IAC5D,QAAQ,MAAM,EAAE,CAAC;QAChB,KAAK,SAAS;YACb,OAAO,KAAK,CAAC;QACd,KAAK,WAAW,CAAC,MAAM,CAAC;QACxB,KAAK,WAAW,CAAC,MAAM,CAAC;QACxB,KAAK,WAAW,CAAC,OAAO,CAAC;QACzB,KAAK,WAAW,CAAC,WAAW;YAC3B,OAAO,IAAI,CAAC;QACb,KAAK,WAAW,CAAC,IAAI;YACpB,OAAO,CAAC,IAAI,CAAC,CAAC;QACf;YACC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tLeafNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\ttype StoredSchemaCollection,\n\ttype TreeFieldStoredSchema,\n\ttype TreeNodeSchemaIdentifier,\n\tValueSchema,\n\tMultiplicity,\n\tidentifierFieldKindIdentifier,\n} from \"../../../core/index.js\";\nimport type { FullSchemaPolicy } from \"../../modular-schema/index.js\";\n\nimport {\n\tEncoderCache,\n\ttype FieldEncoder,\n\ttype FieldShaper,\n\ttype KeyedFieldEncoder,\n\ttype TreeShaper,\n\tanyNodeEncoder,\n\tasFieldEncoder,\n\tcompressedEncode,\n} from \"./compressedEncode.js\";\nimport type { FieldBatch } from \"./fieldBatch.js\";\nimport { type EncodedFieldBatch, type EncodedValueShape, SpecialField } from \"./format.js\";\nimport { NodeShape } from \"./nodeShape.js\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\n/**\n * Encode data from `fieldBatch` in into an `EncodedChunk`.\n *\n * Optimized for encoded size and encoding performance.\n * TODO: This function should eventually also take in the root FieldSchema to more efficiently compress the nodes.\n */\nexport function schemaCompressedEncode(\n\tschema: StoredSchemaCollection,\n\tpolicy: FullSchemaPolicy,\n\tfieldBatch: FieldBatch,\n\tidCompressor: IIdCompressor,\n): EncodedFieldBatch {\n\treturn compressedEncode(fieldBatch, buildCache(schema, policy, idCompressor));\n}\n\nexport function buildCache(\n\tschema: StoredSchemaCollection,\n\tpolicy: FullSchemaPolicy,\n\tidCompressor: IIdCompressor,\n): EncoderCache {\n\tconst cache: EncoderCache = new EncoderCache(\n\t\t(fieldHandler: FieldShaper, schemaName: TreeNodeSchemaIdentifier) =>\n\t\t\ttreeShaper(schema, policy, fieldHandler, schemaName),\n\t\t(treeHandler: TreeShaper, field: TreeFieldStoredSchema) =>\n\t\t\tfieldShaper(treeHandler, field, cache, schema),\n\t\tpolicy.fieldKinds,\n\t\tidCompressor,\n\t);\n\treturn cache;\n}\n\n/**\n * Selects shapes to use to encode fields.\n */\nexport function fieldShaper(\n\ttreeHandler: TreeShaper,\n\tfield: TreeFieldStoredSchema,\n\tcache: EncoderCache,\n\tstoredSchema: StoredSchemaCollection,\n): FieldEncoder {\n\tconst kind = cache.fieldShapes.get(field.kind) ?? fail(0xb52 /* missing FieldKind */);\n\tconst type = oneFromSet(field.types);\n\tconst nodeEncoder = type !== undefined ? treeHandler.shapeFromTree(type) : anyNodeEncoder;\n\tif (kind.multiplicity === Multiplicity.Single) {\n\t\tif (field.kind === identifierFieldKindIdentifier) {\n\t\t\tassert(type !== undefined, 0x999 /* field type must be defined in identifier field */);\n\t\t\tconst nodeSchema = storedSchema.nodeSchema.get(type);\n\t\t\tassert(nodeSchema !== undefined, 0x99a /* nodeSchema must be defined */);\n\t\t\tassert(\n\t\t\t\tnodeSchema instanceof LeafNodeStoredSchema,\n\t\t\t\t0x99b /* nodeSchema must be LeafNodeStoredSchema */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\tnodeSchema.leafValue === ValueSchema.String,\n\t\t\t\t0x99c /* identifier field can only be type string */,\n\t\t\t);\n\t\t\tconst identifierNodeEncoder = new NodeShape(\n\t\t\t\ttype,\n\t\t\t\tSpecialField.Identifier,\n\t\t\t\t[],\n\t\t\t\tundefined,\n\t\t\t);\n\t\t\treturn asFieldEncoder(identifierNodeEncoder);\n\t\t}\n\t\treturn asFieldEncoder(nodeEncoder);\n\t} else {\n\t\treturn cache.nestedArray(nodeEncoder);\n\t}\n}\n\n/**\n * Selects shapes to use to encode trees.\n */\nexport function treeShaper(\n\tfullSchema: StoredSchemaCollection,\n\tpolicy: FullSchemaPolicy,\n\tfieldHandler: FieldShaper,\n\tschemaName: TreeNodeSchemaIdentifier,\n): NodeShape {\n\tconst schema =\n\t\tfullSchema.nodeSchema.get(schemaName) ?? fail(0xb53 /* missing node schema */);\n\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\t// TODO:Performance:\n\t\t// consider moving some optional and sequence fields to extra fields if they are commonly empty\n\t\t// to reduce encoded size.\n\n\t\tconst objectNodeFields: KeyedFieldEncoder[] = [];\n\t\tfor (const [key, field] of schema.objectNodeFields ?? []) {\n\t\t\tobjectNodeFields.push({ key, shape: fieldHandler.shapeFromField(field) });\n\t\t}\n\n\t\tconst shape = new NodeShape(schemaName, false, objectNodeFields, undefined);\n\t\treturn shape;\n\t}\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\tconst shape = new NodeShape(\n\t\t\tschemaName,\n\t\t\tvalueShapeFromSchema(schema.leafValue),\n\t\t\t[],\n\t\t\tundefined,\n\t\t);\n\t\treturn shape;\n\t}\n\tif (schema instanceof MapNodeStoredSchema) {\n\t\tconst shape = new NodeShape(\n\t\t\tschemaName,\n\t\t\tfalse,\n\t\t\t[],\n\t\t\tfieldHandler.shapeFromField(schema.mapFields),\n\t\t);\n\t\treturn shape;\n\t}\n\tfail(0xb54 /* unsupported node kind */);\n}\n\nexport function oneFromSet<T>(set: ReadonlySet<T> | undefined): T | undefined {\n\tif (set === undefined) {\n\t\treturn undefined;\n\t}\n\tif (set.size !== 1) {\n\t\treturn undefined;\n\t}\n\tfor (const item of set) {\n\t\treturn item;\n\t}\n}\n\nfunction valueShapeFromSchema(schema: ValueSchema | undefined): undefined | EncodedValueShape {\n\tswitch (schema) {\n\t\tcase undefined:\n\t\t\treturn false;\n\t\tcase ValueSchema.Number:\n\t\tcase ValueSchema.String:\n\t\tcase ValueSchema.Boolean:\n\t\tcase ValueSchema.FluidHandle:\n\t\t\treturn true;\n\t\tcase ValueSchema.Null:\n\t\t\treturn [null];\n\t\tdefault:\n\t\t\tunreachableCase(schema);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emptyChunk.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/emptyChunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"emptyChunk.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/emptyChunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAON,KAAK,aAAa,EAClB,KAAK,SAAS,EAGd,MAAM,qBAAqB,CAAC;AAG7B;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,SAUxB,CAAC;AAOF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,aAoEzB,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { fail } from "@fluidframework/core-utils/internal";
|
|
5
6
|
import { CursorMarker, cursorChunk, dummyRoot, } from "../../core/index.js";
|
|
6
|
-
import { fail } from "../../util/index.js";
|
|
7
7
|
import { prefixFieldPath } from "../treeCursorUtils.js";
|
|
8
8
|
/**
|
|
9
9
|
* Chunk that is empty.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emptyChunk.js","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/emptyChunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,YAAY,EAOZ,WAAW,EACX,SAAS,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"emptyChunk.js","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/emptyChunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAC3D,OAAO,EAEN,YAAY,EAOZ,WAAW,EACX,SAAS,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAc;IACpC,cAAc,EAAE,CAAC;IACjB,MAAM;QACL,OAAO,WAAW,CAAC;IACpB,CAAC;IACD,cAAc,KAAU,CAAC;IACzB,gBAAgB,KAAU,CAAC;IAC3B,QAAQ;QACP,OAAO,KAAK,CAAC,CAAC,yCAAyC;IACxD,CAAC;CACD,CAAC;AAEF,MAAM,SAAS,GAAgB;IAC9B,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,SAAS;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAkB;IACzC,CAAC,YAAY,CAAC,EAAE,IAAI;IACpB,OAAO,EAAE,KAAK;IACd,IAAI,mCAA2B;IAC/B,CAAC,WAAW,CAAC,EAAE,UAAU;IACzB,SAAS;QACR,IAAI,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC9C,CAAC;IACD,SAAS;QACR,IAAI,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC9C,CAAC;IACD,iBAAiB;QAChB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,WAAW;QACV,OAAO,SAAS,CAAC,KAAK,CAAC;IACxB,CAAC;IACD,cAAc;QACb,OAAO,CAAC,CAAC;IACV,CAAC;IACD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yright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport {\n\tCursorLocationType,\n\tCursorMarker,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype PathRootPrefix,\n\ttype UpPath,\n\ttype ChunkedCursor,\n\ttype TreeChunk,\n\tcursorChunk,\n\tdummyRoot,\n} from \"../../core/index.js\";\nimport { prefixFieldPath } from \"../treeCursorUtils.js\";\n\n/**\n * Chunk that is empty.\n *\n * Since all emptiness is the same, this is a singleton.\n *\n * Useful for when a chunk or cursor is needed for an empty field or detached sequence.\n */\nexport const emptyChunk: TreeChunk = {\n\ttopLevelLength: 0,\n\tcursor(): ChunkedCursor {\n\t\treturn emptyCursor;\n\t},\n\treferenceAdded(): void {},\n\treferenceRemoved(): void {},\n\tisShared(): boolean {\n\t\treturn false; // Immutable, so sharing does not matter.\n\t},\n};\n\nconst emptyPath: FieldUpPath = {\n\tparent: undefined,\n\tfield: dummyRoot,\n};\n\n/**\n * Cursor over an empty field.\n * Contains no nodes and is stateless.\n */\nexport const emptyCursor: ChunkedCursor = {\n\t[CursorMarker]: true,\n\tpending: false,\n\tmode: CursorLocationType.Fields,\n\t[cursorChunk]: emptyChunk,\n\tnextField(): boolean {\n\t\tfail(0xafb /* cannot navigate above root */);\n\t},\n\texitField(): void {\n\t\tfail(0xafc /* cannot navigate above root */);\n\t},\n\tskipPendingFields(): boolean {\n\t\treturn true;\n\t},\n\tgetFieldKey(): FieldKey {\n\t\treturn emptyPath.field;\n\t},\n\tgetFieldLength(): number {\n\t\treturn 0;\n\t},\n\tfirstNode(): boolean {\n\t\treturn false;\n\t},\n\tenterNode(childIndex: number): void {\n\t\tfail(0xafd /* empty cursor has no nodes */);\n\t},\n\tgetFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\treturn prefixFieldPath(prefix, emptyPath);\n\t},\n\tgetPath(): UpPath | undefined {\n\t\tfail(0xafe /* empty cursor has no nodes */);\n\t},\n\tget fieldIndex(): never {\n\t\treturn fail(0xaff /* empty cursor has no nodes */);\n\t},\n\tget chunkStart(): never {\n\t\treturn fail(0xb00 /* empty cursor has no nodes */);\n\t},\n\tget chunkLength(): never {\n\t\treturn fail(0xb01 /* empty cursor has no nodes */);\n\t},\n\tseekNodes(offset: number): boolean {\n\t\tfail(0xb02 /* empty cursor has no nodes */);\n\t},\n\tnextNode(): boolean {\n\t\tfail(0xb03 /* empty cursor has no nodes */);\n\t},\n\texitNode(): void {\n\t\tfail(0xb04 /* empty cursor has no nodes */);\n\t},\n\tfirstField(): boolean {\n\t\tfail(0xb05 /* empty cursor has no nodes */);\n\t},\n\tenterField(key: FieldKey): void {\n\t\tfail(0xb06 /* empty cursor has no nodes */);\n\t},\n\tget type(): never {\n\t\treturn fail(0xb07 /* empty cursor has no nodes */);\n\t},\n\tget value(): never {\n\t\treturn fail(0xb08 /* empty cursor has no nodes */);\n\t},\n\tatChunkRoot(): boolean {\n\t\treturn true;\n\t},\n\tfork(): ChunkedCursor {\n\t\treturn emptyCursor;\n\t},\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniformChunk.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/uniformChunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,kBAAkB,EAClB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,WAAW,EAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"uniformChunk.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/uniformChunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,kBAAkB,EAClB,KAAK,QAAQ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3D,IAAW,UAAU,IAAI,MAAM,CAE9B;IAED,SAAgB,UAAU,EAAE,MAAM,CAAK;IAEvC,IAAW,WAAW,IAAI,MAAM,CAE/B;IAEM,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAWlC,QAAQ,IAAI,OAAO;IAanB,QAAQ,IAAI,IAAI;IAahB,UAAU,IAAI,OAAO;IAYrB,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI;IAWtC,IAAW,IAAI,IAAI,wBAAwB,CAE1C;IAED,IAAW,KAAK,IAAI,KAAK,CAYxB;CACD"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { assert, compareArrays, oob } from "@fluidframework/core-utils/internal";
|
|
5
|
+
import { assert, compareArrays, oob, fail } from "@fluidframework/core-utils/internal";
|
|
6
6
|
import { cursorChunk, dummyRoot, } from "../../core/index.js";
|
|
7
|
-
import { ReferenceCountedBase,
|
|
7
|
+
import { ReferenceCountedBase, hasSome } from "../../util/index.js";
|
|
8
8
|
import { SynchronousCursor, prefixFieldPath, prefixPath } from "../treeCursorUtils.js";
|
|
9
9
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
10
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniformChunk.js","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/uniformChunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAEjF,OAAO,EAWN,WAAW,EACX,SAAS,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,U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B,CAAC;IACvC,CAAC;IAED,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,QAAQ,kCAA0B,CAAC,KAAK,CAAC,IAAI,CAAC;IAC3D,CAAC;IAED,IAAW,KAAK;QACf,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,kCAA0B,CAAC;QACrD,iGAAiG;QACjG,yIAAyI;QACzI,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,+BAA+B,EAAE,CAAC;YACvE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAC7D,OAAO,YAAY,CAAC,UAAU,CAAC,KAAiC,CAAC,CAAC;YACnE,CAAC;QACF,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, compareArrays, oob } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype PathRootPrefix,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\ttype UpPath,\n\ttype Value,\n\ttype ChunkedCursor,\n\ttype TreeChunk,\n\tcursorChunk,\n\tdummyRoot,\n} from \"../../core/index.js\";\nimport { ReferenceCountedBase, fail, hasSome } from \"../../util/index.js\";\nimport { SynchronousCursor, prefixFieldPath, prefixPath } from \"../treeCursorUtils.js\";\n\nimport type { SessionSpaceCompressedId, IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Create a tree chunk with ref count 1.\n *\n * @param shape - describes the semantics and layout of `values`.\n * @param values - provides exclusive ownership of this array to this object (which might mutate it in the future).\n */\nexport function uniformChunk(shape: ChunkShape, values: TreeValue[]): TreeChunk {\n\treturn new UniformChunk(shape, values);\n}\n\n/**\n * Chunk which handles a sequence of trees with identical \"shape\" (see `TreeShape`).\n *\n * Separates shape from content,\n * allowing deduplication of shape information and storing of content as a flat sequence of values.\n */\nexport class UniformChunk extends ReferenceCountedBase implements TreeChunk {\n\tpublic idCompressor: undefined | IIdCompressor;\n\t/**\n\t * Create a tree chunk with ref count 1.\n\t *\n\t * @param shape - describes the semantics and layout of `values`.\n\t * @param values - provides exclusive ownership of this array to this object (which might mutate it in the future).\n\t */\n\tpublic constructor(\n\t\tpublic shape: ChunkShape,\n\t\tpublic values: TreeValue[],\n\t\tidCompressor?: IIdCompressor,\n\t) {\n\t\tsuper();\n\t\tthis.idCompressor = idCompressor;\n\t\tassert(\n\t\t\tshape.treeShape.valuesPerTopLevelNode * shape.topLevelLength === values.length,\n\t\t\t0x4c3 /* invalid number of values for shape */,\n\t\t);\n\t}\n\n\tpublic get topLevelLength(): number {\n\t\treturn this.shape.topLevelLength;\n\t}\n\n\tpublic clone(): UniformChunk {\n\t\treturn new UniformChunk(this.shape, this.values.slice());\n\t}\n\n\tpublic cursor(): Cursor {\n\t\treturn new Cursor(this);\n\t}\n\n\tprotected onUnreferenced(): void {}\n}\n\n/**\n * The \"shape\" of a field.\n *\n * Requires that all trees in the field have the same shape, which is described by `TreeShape`.\n * Note that this requirement means that not all fields can be described using this type.\n */\nexport type FieldShape = readonly [FieldKey, TreeShape, number];\n\n/**\n * The \"shape\" of a tree.\n * Does not contain the actual values from the tree, but describes everything else,\n * including where the values would be found in a flat values array.\n *\n * Note that since this requires fields to have uniform shapes (see `FieldShape`),\n * not all trees can have their shape described using this type.\n */\nexport class TreeShape {\n\tpublic readonly fields: ReadonlyMap<FieldKey, OffsetShape>;\n\tpublic readonly fieldsOffsetArray: readonly OffsetShape[];\n\tpublic readonly valuesPerTopLevelNode: number;\n\n\t// TODO: this is only needed at chunk roots. Optimize it base on that.\n\tpublic readonly positions: readonly NodePositionInfo[];\n\n\t/**\n\t *\n\t * @param type - {@link TreeNodeSchemaIdentifier} used to compare shapes.\n\t * @param hasValue - whether or not the TreeShape has a value.\n\t * @param fieldsArray - an array of {@link FieldShape} values, which contains a TreeShape for each FieldKey.\n\t *\n\t * @param maybeDecompressedStringAsNumber - used to check whether or not the value could have been compressed by the idCompressor.\n\t * This flag can only be set on string leaf nodes, and will throw a usage error otherwise.\n\t * If set to true, an additional check can be made (example: getting the value of {@link Cursor}) to return the original uncompressed value.\n\t */\n\tpublic constructor(\n\t\tpublic readonly type: TreeNodeSchemaIdentifier,\n\t\tpublic readonly hasValue: boolean,\n\t\tpublic readonly fieldsArray: readonly FieldShape[],\n\t\tpublic readonly maybeDecompressedStringAsNumber: boolean = false,\n\t) {\n\t\tif (\n\t\t\tmaybeDecompressedStringAsNumber &&\n\t\t\t!(hasValue && type === \"com.fluidframework.leaf.string\")\n\t\t) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"maybeDecompressedStringAsNumber flag can only be set to true for string leaf node.\",\n\t\t\t);\n\t\t}\n\t\tconst fields: Map<FieldKey, OffsetShape> = new Map();\n\t\tlet numberOfValues = hasValue ? 1 : 0;\n\t\tconst infos: NodePositionInfo[] = [\n\t\t\tnew NodePositionInfo(undefined, dummyRoot, 0, undefined, undefined, this, 1, 0),\n\t\t];\n\t\tlet fieldIndex = 0;\n\t\tfor (const [k, f, length] of fieldsArray) {\n\t\t\tassert(!fields.has(k), 0x4c5 /* no duplicate keys */);\n\t\t\tconst offset = new OffsetShape(f, length, infos.length, k, fieldIndex);\n\t\t\tfields.set(k, offset);\n\t\t\tclonePositions(0, [k, f, length], fieldIndex, numberOfValues, infos);\n\t\t\tnumberOfValues += f.valuesPerTopLevelNode * length;\n\t\t\tfieldIndex++;\n\t\t}\n\t\tthis.fields = fields;\n\t\tthis.valuesPerTopLevelNode = numberOfValues;\n\t\tthis.positions = infos;\n\n\t\tthis.fieldsOffsetArray = [...fields.values()];\n\t}\n\n\tpublic equals(other: TreeShape): boolean {\n\t\t// TODO: either dedup instances and/or store a collision resistant hash for fast compare.\n\n\t\tif (\n\t\t\t!compareArrays(\n\t\t\t\tthis.fieldsArray,\n\t\t\t\tother.fieldsArray,\n\t\t\t\t([k, f, l], [k2, f2, l2]) => k === k2 && l === l2 && f.equals(f2),\n\t\t\t)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn this.type === other.type && this.hasValue === other.hasValue;\n\t}\n\n\tpublic withTopLevelLength(topLevelLength: number): ChunkShape {\n\t\treturn new ChunkShape(this, topLevelLength);\n\t}\n}\n\nfunction clonePositions(\n\tindexOfParentInOutput: number | undefined,\n\t[key, shape, copies]: FieldShape,\n\tindexOfParentField: number,\n\tvalueOffset: number,\n\toutputInto: NodePositionInfo[] | (NodePositionInfo | undefined)[],\n): void {\n\tconst offset = outputInto.length;\n\tfor (let index = 0; index < copies; index++) {\n\t\tfor (const inner of shape.positions) {\n\t\t\tconst wasRoot = inner.indexOfParentPosition === undefined;\n\t\t\tconst parentPositionIndex = wasRoot\n\t\t\t\t? indexOfParentInOutput\n\t\t\t\t: inner.indexOfParentPosition + index * shape.positions.length + offset;\n\t\t\toutputInto.push(\n\t\t\t\tnew NodePositionInfo(\n\t\t\t\t\tparentPositionIndex === undefined ? undefined : outputInto[parentPositionIndex],\n\t\t\t\t\tinner.parentField === dummyRoot ? key : inner.parentField,\n\t\t\t\t\twasRoot ? index : inner.parentIndex,\n\t\t\t\t\tinner.indexOfParentField ?? indexOfParentField,\n\t\t\t\t\tparentPositionIndex,\n\t\t\t\t\tinner.shape,\n\t\t\t\t\twasRoot ? copies : inner.topLevelLength,\n\t\t\t\t\tinner.valueOffset + valueOffset + shape.valuesPerTopLevelNode * index,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * The shape (see `TreeShape`) of a sequence of trees, all with the same shape (like `FieldShape`, but without a field key).\n *\n * This shape is optimized (by caching derived data like the positions array),\n * so that when paired with a value array it can be efficiently traversed like a tree by an {@link ITreeCursorSynchronous}.\n * See {@link uniformChunk} for how to do this.\n *\n * TODO: consider storing shape information in WASM\n */\nexport class ChunkShape {\n\tpublic readonly positions: readonly (NodePositionInfo | undefined)[];\n\n\tpublic constructor(\n\t\tpublic readonly treeShape: TreeShape,\n\t\tpublic readonly topLevelLength: number,\n\t) {\n\t\tassert(topLevelLength > 0, 0x4c6 /* topLevelLength must be greater than 0 */);\n\n\t\t// TODO: avoid duplication from inner loop\n\t\tconst positions: (NodePositionInfo | undefined)[] = [undefined];\n\t\tclonePositions(0, [dummyRoot, treeShape, topLevelLength], 0, 0, positions);\n\t\tthis.positions = positions;\n\t}\n\n\tpublic equals(other: ChunkShape): boolean {\n\t\t// TODO: either dedup instances and/or store a collision resistant hash for fast compare.\n\t\treturn this.topLevelLength === other.topLevelLength && this.treeShape === other.treeShape;\n\t}\n}\n\n/**\n * Shape of a field (like `FieldShape`) but with information about how it would be offset within a chunk because of its parents.\n */\nclass OffsetShape {\n\t/**\n\t * @param shape - the shape of each child in this field\n\t * @param topLevelLength - number of top level nodes in this sequence chunk (either field within a chunk, or top level chunk)\n\t * @param offset - number of nodes before this in the parent's subtree. The nodes are considered in depth first pre order\n\t * traversal, so a parent is the first node in its subtree (before its children) with offset 0\n\t * @param key - field key\n\t * @param indexOfParentField - index to this shape in the parent's array of fields\n\t */\n\tpublic constructor(\n\t\tpublic readonly shape: TreeShape,\n\t\tpublic readonly topLevelLength: number,\n\t\tpublic readonly offset: number,\n\t\tpublic readonly key: FieldKey,\n\t\tpublic readonly indexOfParentField: number | undefined,\n\t) {}\n}\n\n/**\n * Information about a node at a specific position within a uniform chunk.\n */\nclass NodePositionInfo implements UpPath {\n\t/**\n\t * @param parent - TODO\n\t * @param parentField - TODO\n\t * @param parentIndex - indexWithinParentField\n\t * @param indexOfParentField - which field of the parent `parentIndex` is indexing into to locate this.\n\t * @param indexOfParentPosition - Index of parent NodePositionInfo in positions array. TODO: use offsets to avoid copying at top level?\n\t * @param shape - Shape of the top level sequence this node is part of\n\t * @param valueOffset - TODO\n\t */\n\tpublic constructor(\n\t\tpublic readonly parent: NodePositionInfo | undefined, // TODO; general UpPath to allow prefixing here?\n\t\tpublic readonly parentField: FieldKey,\n\t\tpublic readonly parentIndex: number,\n\t\tpublic readonly indexOfParentField: number | undefined,\n\t\tpublic readonly indexOfParentPosition: number | undefined,\n\t\tpublic readonly shape: TreeShape, // Shape of sequence that contains this node (top level is parent of this node)\n\t\tpublic readonly topLevelLength: number,\n\t\tpublic readonly valueOffset: number,\n\t) {}\n}\n\n/**\n * The cursor implementation for `UniformChunk`.\n *\n * Works by tracking its location in the chunk's `positions` array.\n */\nclass Cursor extends SynchronousCursor implements ChunkedCursor {\n\tprivate positionIndex!: number; // When in fields mode, this points to the parent node.\n\t// Undefined when in root field\n\tprivate nodePositionInfo: NodePositionInfo | undefined;\n\n\t// Cached constants for faster access\n\tprivate readonly shape: ChunkShape;\n\tprivate readonly positions: readonly (NodePositionInfo | undefined)[];\n\n\tpublic mode: CursorLocationType = CursorLocationType.Fields;\n\n\t// Undefined when not in fields mode.\n\tprivate fieldKey?: FieldKey;\n\n\t// Valid only in fields mode. Can be past end for empty fields.\n\t// This is redundant with fieldKey above (but might be worth keeping for perf), and could be removed.\n\tprivate indexOfField: number = 0;\n\n\t// TODO: support prefix (path above root, including index offset of chunk in its containing field)\n\tpublic constructor(private readonly chunk: UniformChunk) {\n\t\tsuper();\n\t\tthis.shape = this.chunk.shape;\n\t\tthis.positions = this.shape.positions;\n\t\tthis.fieldKey = dummyRoot;\n\t\tthis.moveToPosition(0);\n\t}\n\n\tpublic get [cursorChunk](): UniformChunk | undefined {\n\t\treturn this.atChunkRoot() ? this.chunk : undefined;\n\t}\n\n\tpublic atChunkRoot(): boolean {\n\t\tassert(\n\t\t\t(this.fieldKey === undefined) === (this.mode === CursorLocationType.Nodes),\n\t\t\t0x560 /* expect valid field key */,\n\t\t);\n\t\treturn (\n\t\t\tthis.nodePositionInfo === undefined ||\n\t\t\t(this.nodePositionInfo.parent === undefined && this.fieldKey === undefined)\n\t\t);\n\t}\n\n\tpublic fork(): Cursor {\n\t\tconst cursor = new Cursor(this.chunk);\n\t\tcursor.mode = this.mode;\n\t\tcursor.fieldKey = this.fieldKey;\n\t\tcursor.indexOfField = this.indexOfField;\n\t\tcursor.moveToPosition(this.positionIndex);\n\t\treturn cursor;\n\t}\n\n\t/**\n\t * Change the current node within the chunk.\n\t * See `nodeInfo` for getting data about the current node.\n\t *\n\t * @param positionIndex - index of the position of the newly selected node in `positions`.\n\t * This is NOT an index within a field, and is not bounds checked.\n\t */\n\tprivate moveToPosition(positionIndex: number): void {\n\t\tthis.nodePositionInfo = this.positions[positionIndex];\n\t\tthis.positionIndex = positionIndex;\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\tassert(positionIndex === 0, 0x561 /* expected root at start */);\n\t\t\tassert(this.mode === CursorLocationType.Fields, 0x562 /* expected root to be a field */);\n\t\t}\n\t}\n\n\t/**\n\t * Gets information about the current node.\n\t *\n\t * When in Nodes mode, this means the node this cursor is current at.\n\t * When if fields mode, this means the node which is the parent of the current field.\n\t * This cursor is in Nodes mode at the root, so there is no case where a fields mode does not have a parent.\n\t *\n\t * @param requiredMode - asserts that the mode matches this. Since the semantics of this function are somewhat mode dependent,\n\t * providing this ensures that the caller knows what the results will mean.\n\t */\n\tprivate nodeInfo(requiredMode: CursorLocationType): NodePositionInfo {\n\t\tassert(this.mode === requiredMode, 0x4c8 /* tried to access cursor when in wrong mode */);\n\t\tassert(\n\t\t\tthis.nodePositionInfo !== undefined,\n\t\t\t0x53e /* can not access nodeInfo in root field */,\n\t\t);\n\t\treturn this.nodePositionInfo;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.indexOfField++;\n\t\tconst fields = this.nodeInfo(CursorLocationType.Fields).shape.fieldsArray;\n\t\tif (this.indexOfField < fields.length) {\n\t\t\tconst fieldArr = fields[this.indexOfField] ?? oob();\n\t\t\tthis.fieldKey = fieldArr[0];\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitField();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x4c9 /* exitField when in wrong mode */);\n\t\tassert(this.nodePositionInfo !== undefined, 0x563 /* can not exit root field */);\n\t\tthis.fieldKey = undefined;\n\t\tthis.mode = CursorLocationType.Nodes;\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\treturn this.fieldKey ?? fail(0xb09 /* not in a field */);\n\t}\n\n\tpublic getFieldLength(): number {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x53f /* tried to access cursor when in wrong mode */,\n\t\t);\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\treturn this.shape.topLevelLength;\n\t\t}\n\t\tconst fieldInfo = this.nodePositionInfo.shape.fieldsArray[this.indexOfField];\n\t\tif (fieldInfo === undefined) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn fieldInfo[2];\n\t}\n\n\tpublic firstNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x540 /* tried to access cursor when in wrong mode */,\n\t\t);\n\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\t// Root field is not allowed to be empty, so we can skip handling that case.\n\t\t\tthis.enterRootNodeInner(0);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn this.enterNodeInner(this.nodePositionInfo, 0);\n\t\t}\n\t}\n\n\tpublic enterNode(childIndex: number): void {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x541 /* tried to access cursor when in wrong mode */,\n\t\t);\n\t\tassert(childIndex >= 0, 0x4ca /* index must be positive */);\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\tassert(\n\t\t\t\tchildIndex < this.shape.topLevelLength,\n\t\t\t\t0x542 /* index must not be past the end of the field */,\n\t\t\t);\n\t\t\tthis.enterRootNodeInner(childIndex);\n\t\t} else {\n\t\t\tconst moved = this.enterNodeInner(this.nodePositionInfo, childIndex);\n\t\t\tassert(moved, 0x4cb /* index must not be past the end of the field */);\n\t\t}\n\t}\n\n\t/**\n\t * Enter the current field, at `childIndex`.\n\t * @param childIndex - index into current field to navigate to. Must be non-negative integer.\n\t */\n\tprivate enterNodeInner(currentPosition: NodePositionInfo, childIndex: number): boolean {\n\t\tconst shape = currentPosition.shape;\n\t\tconst fields = shape.fieldsOffsetArray;\n\t\tif (this.indexOfField >= fields.length) {\n\t\t\treturn false; // Handle empty field (indexed by key into empty field)\n\t\t}\n\t\tconst f = shape.fieldsOffsetArray[this.indexOfField] ?? oob();\n\t\tif (childIndex >= f.topLevelLength) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.mode = CursorLocationType.Nodes;\n\t\tthis.fieldKey = undefined;\n\t\tthis.moveToPosition(this.positionIndex + f.offset + childIndex * f.shape.positions.length);\n\t\tassert(this.fieldIndex === childIndex, 0x4cc /* should be at selected child */);\n\t\treturn true;\n\t}\n\n\tprivate enterRootNodeInner(childIndex: number): void {\n\t\tthis.mode = CursorLocationType.Nodes;\n\t\tthis.fieldKey = undefined;\n\t\t// 1 for the \"undefined\" at the beginning of the positions array, then stride by top level tree shape.\n\t\tthis.moveToPosition(1 + childIndex * this.shape.treeShape.positions.length);\n\t\tassert(this.fieldIndex === childIndex, 0x543 /* should be at selected child */);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\treturn prefixFieldPath(prefix, {\n\t\t\tfield: this.getFieldKey(),\n\t\t\tparent: this.nodePositionInfo,\n\t\t});\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\treturn prefixPath(prefix, this.nodeInfo(CursorLocationType.Nodes));\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).parentIndex;\n\t}\n\n\tpublic readonly chunkStart: number = 0;\n\n\tpublic get chunkLength(): number {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).topLevelLength;\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst index = offset + info.parentIndex;\n\t\tif (index >= 0 && index < info.topLevelLength) {\n\t\t\tthis.moveToPosition(this.positionIndex + offset * info.shape.positions.length);\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\t// This is the same as `return this.seekNodes(1);` but slightly faster.\n\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst index = info.parentIndex + 1;\n\t\tif (index === info.topLevelLength) {\n\t\t\tthis.exitNode();\n\t\t\treturn false;\n\t\t}\n\t\tthis.moveToPosition(this.positionIndex + info.shape.positions.length);\n\t\treturn true;\n\t}\n\n\tpublic exitNode(): void {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tthis.indexOfField =\n\t\t\tinfo.indexOfParentField ??\n\t\t\tfail(0xb0a /* navigation up to root field not yet supported */); // TODO;\n\t\tthis.fieldKey = info.parentField;\n\t\tthis.mode = CursorLocationType.Fields;\n\t\tthis.moveToPosition(\n\t\t\tinfo.indexOfParentPosition ??\n\t\t\t\tfail(0xb0b /* navigation up to root field not yet supported */),\n\t\t); // TODO\n\t}\n\n\tpublic firstField(): boolean {\n\t\tconst fieldsArray = this.nodeInfo(CursorLocationType.Nodes).shape.fieldsArray;\n\t\tif (!hasSome(fieldsArray)) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.indexOfField = 0;\n\t\tthis.mode = CursorLocationType.Fields;\n\t\tconst fields = fieldsArray[0];\n\t\tthis.fieldKey = fields[0];\n\t\treturn true;\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\tconst fieldMap = this.nodeInfo(CursorLocationType.Nodes).shape.fields;\n\t\tconst fieldInfo = fieldMap.get(key);\n\t\tthis.indexOfField =\n\t\t\tfieldInfo === undefined\n\t\t\t\t? fieldMap.size\n\t\t\t\t: (fieldInfo.indexOfParentField ?? fail(0xb0c /* children should have parents */));\n\t\tthis.fieldKey = key;\n\t\tthis.mode = CursorLocationType.Fields;\n\t}\n\n\tpublic get type(): TreeNodeSchemaIdentifier {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).shape.type;\n\t}\n\n\tpublic get value(): Value {\n\t\tconst idCompressor = this.chunk.idCompressor;\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\t// If the maybeDecompressedStringAsNumber flag is set to true, we check if the value is a number.\n\t\t// This flag can only ever be set on string leaf nodes, so if the value is a number, we can assume it is a compressible, known stable id.\n\t\tif (info.shape.hasValue && info.shape.maybeDecompressedStringAsNumber) {\n\t\t\tconst value = this.chunk.values[info.valueOffset];\n\t\t\tif (typeof value === \"number\" && idCompressor !== undefined) {\n\t\t\t\treturn idCompressor.decompress(value as SessionSpaceCompressedId);\n\t\t\t}\n\t\t}\n\t\treturn info.shape.hasValue ? this.chunk.values[info.valueOffset] : undefined;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"uniformChunk.js","sourceRoot":"","sources":["../../../src/feature-libraries/chunked-forest/uniformChunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEvF,OAAO,EAWN,WAAW,EACX,SAAS,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,uB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;IAED,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,QAAQ,kCAA0B,CAAC,KAAK,CAAC,IAAI,CAAC;IAC3D,CAAC;IAED,IAAW,KAAK;QACf,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,kCAA0B,CAAC;QACrD,iGAAiG;QACjG,yIAAyI;QACzI,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,+BAA+B,EAAE,CAAC;YACvE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAC7D,OAAO,YAAY,CAAC,UAAU,CAAC,KAAiC,CAAC,CAAC;YACnE,CAAC;QACF,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9E,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, compareArrays, oob, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tCursorLocationType,\n\ttype FieldKey,\n\ttype FieldUpPath,\n\ttype PathRootPrefix,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeValue,\n\ttype UpPath,\n\ttype Value,\n\ttype ChunkedCursor,\n\ttype TreeChunk,\n\tcursorChunk,\n\tdummyRoot,\n} from \"../../core/index.js\";\nimport { ReferenceCountedBase, hasSome } from \"../../util/index.js\";\nimport { SynchronousCursor, prefixFieldPath, prefixPath } from \"../treeCursorUtils.js\";\n\nimport type { SessionSpaceCompressedId, IIdCompressor } from \"@fluidframework/id-compressor\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Create a tree chunk with ref count 1.\n *\n * @param shape - describes the semantics and layout of `values`.\n * @param values - provides exclusive ownership of this array to this object (which might mutate it in the future).\n */\nexport function uniformChunk(shape: ChunkShape, values: TreeValue[]): TreeChunk {\n\treturn new UniformChunk(shape, values);\n}\n\n/**\n * Chunk which handles a sequence of trees with identical \"shape\" (see `TreeShape`).\n *\n * Separates shape from content,\n * allowing deduplication of shape information and storing of content as a flat sequence of values.\n */\nexport class UniformChunk extends ReferenceCountedBase implements TreeChunk {\n\tpublic idCompressor: undefined | IIdCompressor;\n\t/**\n\t * Create a tree chunk with ref count 1.\n\t *\n\t * @param shape - describes the semantics and layout of `values`.\n\t * @param values - provides exclusive ownership of this array to this object (which might mutate it in the future).\n\t */\n\tpublic constructor(\n\t\tpublic shape: ChunkShape,\n\t\tpublic values: TreeValue[],\n\t\tidCompressor?: IIdCompressor,\n\t) {\n\t\tsuper();\n\t\tthis.idCompressor = idCompressor;\n\t\tassert(\n\t\t\tshape.treeShape.valuesPerTopLevelNode * shape.topLevelLength === values.length,\n\t\t\t0x4c3 /* invalid number of values for shape */,\n\t\t);\n\t}\n\n\tpublic get topLevelLength(): number {\n\t\treturn this.shape.topLevelLength;\n\t}\n\n\tpublic clone(): UniformChunk {\n\t\treturn new UniformChunk(this.shape, this.values.slice());\n\t}\n\n\tpublic cursor(): Cursor {\n\t\treturn new Cursor(this);\n\t}\n\n\tprotected onUnreferenced(): void {}\n}\n\n/**\n * The \"shape\" of a field.\n *\n * Requires that all trees in the field have the same shape, which is described by `TreeShape`.\n * Note that this requirement means that not all fields can be described using this type.\n */\nexport type FieldShape = readonly [FieldKey, TreeShape, number];\n\n/**\n * The \"shape\" of a tree.\n * Does not contain the actual values from the tree, but describes everything else,\n * including where the values would be found in a flat values array.\n *\n * Note that since this requires fields to have uniform shapes (see `FieldShape`),\n * not all trees can have their shape described using this type.\n */\nexport class TreeShape {\n\tpublic readonly fields: ReadonlyMap<FieldKey, OffsetShape>;\n\tpublic readonly fieldsOffsetArray: readonly OffsetShape[];\n\tpublic readonly valuesPerTopLevelNode: number;\n\n\t// TODO: this is only needed at chunk roots. Optimize it base on that.\n\tpublic readonly positions: readonly NodePositionInfo[];\n\n\t/**\n\t *\n\t * @param type - {@link TreeNodeSchemaIdentifier} used to compare shapes.\n\t * @param hasValue - whether or not the TreeShape has a value.\n\t * @param fieldsArray - an array of {@link FieldShape} values, which contains a TreeShape for each FieldKey.\n\t *\n\t * @param maybeDecompressedStringAsNumber - used to check whether or not the value could have been compressed by the idCompressor.\n\t * This flag can only be set on string leaf nodes, and will throw a usage error otherwise.\n\t * If set to true, an additional check can be made (example: getting the value of {@link Cursor}) to return the original uncompressed value.\n\t */\n\tpublic constructor(\n\t\tpublic readonly type: TreeNodeSchemaIdentifier,\n\t\tpublic readonly hasValue: boolean,\n\t\tpublic readonly fieldsArray: readonly FieldShape[],\n\t\tpublic readonly maybeDecompressedStringAsNumber: boolean = false,\n\t) {\n\t\tif (\n\t\t\tmaybeDecompressedStringAsNumber &&\n\t\t\t!(hasValue && type === \"com.fluidframework.leaf.string\")\n\t\t) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"maybeDecompressedStringAsNumber flag can only be set to true for string leaf node.\",\n\t\t\t);\n\t\t}\n\t\tconst fields: Map<FieldKey, OffsetShape> = new Map();\n\t\tlet numberOfValues = hasValue ? 1 : 0;\n\t\tconst infos: NodePositionInfo[] = [\n\t\t\tnew NodePositionInfo(undefined, dummyRoot, 0, undefined, undefined, this, 1, 0),\n\t\t];\n\t\tlet fieldIndex = 0;\n\t\tfor (const [k, f, length] of fieldsArray) {\n\t\t\tassert(!fields.has(k), 0x4c5 /* no duplicate keys */);\n\t\t\tconst offset = new OffsetShape(f, length, infos.length, k, fieldIndex);\n\t\t\tfields.set(k, offset);\n\t\t\tclonePositions(0, [k, f, length], fieldIndex, numberOfValues, infos);\n\t\t\tnumberOfValues += f.valuesPerTopLevelNode * length;\n\t\t\tfieldIndex++;\n\t\t}\n\t\tthis.fields = fields;\n\t\tthis.valuesPerTopLevelNode = numberOfValues;\n\t\tthis.positions = infos;\n\n\t\tthis.fieldsOffsetArray = [...fields.values()];\n\t}\n\n\tpublic equals(other: TreeShape): boolean {\n\t\t// TODO: either dedup instances and/or store a collision resistant hash for fast compare.\n\n\t\tif (\n\t\t\t!compareArrays(\n\t\t\t\tthis.fieldsArray,\n\t\t\t\tother.fieldsArray,\n\t\t\t\t([k, f, l], [k2, f2, l2]) => k === k2 && l === l2 && f.equals(f2),\n\t\t\t)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn this.type === other.type && this.hasValue === other.hasValue;\n\t}\n\n\tpublic withTopLevelLength(topLevelLength: number): ChunkShape {\n\t\treturn new ChunkShape(this, topLevelLength);\n\t}\n}\n\nfunction clonePositions(\n\tindexOfParentInOutput: number | undefined,\n\t[key, shape, copies]: FieldShape,\n\tindexOfParentField: number,\n\tvalueOffset: number,\n\toutputInto: NodePositionInfo[] | (NodePositionInfo | undefined)[],\n): void {\n\tconst offset = outputInto.length;\n\tfor (let index = 0; index < copies; index++) {\n\t\tfor (const inner of shape.positions) {\n\t\t\tconst wasRoot = inner.indexOfParentPosition === undefined;\n\t\t\tconst parentPositionIndex = wasRoot\n\t\t\t\t? indexOfParentInOutput\n\t\t\t\t: inner.indexOfParentPosition + index * shape.positions.length + offset;\n\t\t\toutputInto.push(\n\t\t\t\tnew NodePositionInfo(\n\t\t\t\t\tparentPositionIndex === undefined ? undefined : outputInto[parentPositionIndex],\n\t\t\t\t\tinner.parentField === dummyRoot ? key : inner.parentField,\n\t\t\t\t\twasRoot ? index : inner.parentIndex,\n\t\t\t\t\tinner.indexOfParentField ?? indexOfParentField,\n\t\t\t\t\tparentPositionIndex,\n\t\t\t\t\tinner.shape,\n\t\t\t\t\twasRoot ? copies : inner.topLevelLength,\n\t\t\t\t\tinner.valueOffset + valueOffset + shape.valuesPerTopLevelNode * index,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * The shape (see `TreeShape`) of a sequence of trees, all with the same shape (like `FieldShape`, but without a field key).\n *\n * This shape is optimized (by caching derived data like the positions array),\n * so that when paired with a value array it can be efficiently traversed like a tree by an {@link ITreeCursorSynchronous}.\n * See {@link uniformChunk} for how to do this.\n *\n * TODO: consider storing shape information in WASM\n */\nexport class ChunkShape {\n\tpublic readonly positions: readonly (NodePositionInfo | undefined)[];\n\n\tpublic constructor(\n\t\tpublic readonly treeShape: TreeShape,\n\t\tpublic readonly topLevelLength: number,\n\t) {\n\t\tassert(topLevelLength > 0, 0x4c6 /* topLevelLength must be greater than 0 */);\n\n\t\t// TODO: avoid duplication from inner loop\n\t\tconst positions: (NodePositionInfo | undefined)[] = [undefined];\n\t\tclonePositions(0, [dummyRoot, treeShape, topLevelLength], 0, 0, positions);\n\t\tthis.positions = positions;\n\t}\n\n\tpublic equals(other: ChunkShape): boolean {\n\t\t// TODO: either dedup instances and/or store a collision resistant hash for fast compare.\n\t\treturn this.topLevelLength === other.topLevelLength && this.treeShape === other.treeShape;\n\t}\n}\n\n/**\n * Shape of a field (like `FieldShape`) but with information about how it would be offset within a chunk because of its parents.\n */\nclass OffsetShape {\n\t/**\n\t * @param shape - the shape of each child in this field\n\t * @param topLevelLength - number of top level nodes in this sequence chunk (either field within a chunk, or top level chunk)\n\t * @param offset - number of nodes before this in the parent's subtree. The nodes are considered in depth first pre order\n\t * traversal, so a parent is the first node in its subtree (before its children) with offset 0\n\t * @param key - field key\n\t * @param indexOfParentField - index to this shape in the parent's array of fields\n\t */\n\tpublic constructor(\n\t\tpublic readonly shape: TreeShape,\n\t\tpublic readonly topLevelLength: number,\n\t\tpublic readonly offset: number,\n\t\tpublic readonly key: FieldKey,\n\t\tpublic readonly indexOfParentField: number | undefined,\n\t) {}\n}\n\n/**\n * Information about a node at a specific position within a uniform chunk.\n */\nclass NodePositionInfo implements UpPath {\n\t/**\n\t * @param parent - TODO\n\t * @param parentField - TODO\n\t * @param parentIndex - indexWithinParentField\n\t * @param indexOfParentField - which field of the parent `parentIndex` is indexing into to locate this.\n\t * @param indexOfParentPosition - Index of parent NodePositionInfo in positions array. TODO: use offsets to avoid copying at top level?\n\t * @param shape - Shape of the top level sequence this node is part of\n\t * @param valueOffset - TODO\n\t */\n\tpublic constructor(\n\t\tpublic readonly parent: NodePositionInfo | undefined, // TODO; general UpPath to allow prefixing here?\n\t\tpublic readonly parentField: FieldKey,\n\t\tpublic readonly parentIndex: number,\n\t\tpublic readonly indexOfParentField: number | undefined,\n\t\tpublic readonly indexOfParentPosition: number | undefined,\n\t\tpublic readonly shape: TreeShape, // Shape of sequence that contains this node (top level is parent of this node)\n\t\tpublic readonly topLevelLength: number,\n\t\tpublic readonly valueOffset: number,\n\t) {}\n}\n\n/**\n * The cursor implementation for `UniformChunk`.\n *\n * Works by tracking its location in the chunk's `positions` array.\n */\nclass Cursor extends SynchronousCursor implements ChunkedCursor {\n\tprivate positionIndex!: number; // When in fields mode, this points to the parent node.\n\t// Undefined when in root field\n\tprivate nodePositionInfo: NodePositionInfo | undefined;\n\n\t// Cached constants for faster access\n\tprivate readonly shape: ChunkShape;\n\tprivate readonly positions: readonly (NodePositionInfo | undefined)[];\n\n\tpublic mode: CursorLocationType = CursorLocationType.Fields;\n\n\t// Undefined when not in fields mode.\n\tprivate fieldKey?: FieldKey;\n\n\t// Valid only in fields mode. Can be past end for empty fields.\n\t// This is redundant with fieldKey above (but might be worth keeping for perf), and could be removed.\n\tprivate indexOfField: number = 0;\n\n\t// TODO: support prefix (path above root, including index offset of chunk in its containing field)\n\tpublic constructor(private readonly chunk: UniformChunk) {\n\t\tsuper();\n\t\tthis.shape = this.chunk.shape;\n\t\tthis.positions = this.shape.positions;\n\t\tthis.fieldKey = dummyRoot;\n\t\tthis.moveToPosition(0);\n\t}\n\n\tpublic get [cursorChunk](): UniformChunk | undefined {\n\t\treturn this.atChunkRoot() ? this.chunk : undefined;\n\t}\n\n\tpublic atChunkRoot(): boolean {\n\t\tassert(\n\t\t\t(this.fieldKey === undefined) === (this.mode === CursorLocationType.Nodes),\n\t\t\t0x560 /* expect valid field key */,\n\t\t);\n\t\treturn (\n\t\t\tthis.nodePositionInfo === undefined ||\n\t\t\t(this.nodePositionInfo.parent === undefined && this.fieldKey === undefined)\n\t\t);\n\t}\n\n\tpublic fork(): Cursor {\n\t\tconst cursor = new Cursor(this.chunk);\n\t\tcursor.mode = this.mode;\n\t\tcursor.fieldKey = this.fieldKey;\n\t\tcursor.indexOfField = this.indexOfField;\n\t\tcursor.moveToPosition(this.positionIndex);\n\t\treturn cursor;\n\t}\n\n\t/**\n\t * Change the current node within the chunk.\n\t * See `nodeInfo` for getting data about the current node.\n\t *\n\t * @param positionIndex - index of the position of the newly selected node in `positions`.\n\t * This is NOT an index within a field, and is not bounds checked.\n\t */\n\tprivate moveToPosition(positionIndex: number): void {\n\t\tthis.nodePositionInfo = this.positions[positionIndex];\n\t\tthis.positionIndex = positionIndex;\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\tassert(positionIndex === 0, 0x561 /* expected root at start */);\n\t\t\tassert(this.mode === CursorLocationType.Fields, 0x562 /* expected root to be a field */);\n\t\t}\n\t}\n\n\t/**\n\t * Gets information about the current node.\n\t *\n\t * When in Nodes mode, this means the node this cursor is current at.\n\t * When if fields mode, this means the node which is the parent of the current field.\n\t * This cursor is in Nodes mode at the root, so there is no case where a fields mode does not have a parent.\n\t *\n\t * @param requiredMode - asserts that the mode matches this. Since the semantics of this function are somewhat mode dependent,\n\t * providing this ensures that the caller knows what the results will mean.\n\t */\n\tprivate nodeInfo(requiredMode: CursorLocationType): NodePositionInfo {\n\t\tassert(this.mode === requiredMode, 0x4c8 /* tried to access cursor when in wrong mode */);\n\t\tassert(\n\t\t\tthis.nodePositionInfo !== undefined,\n\t\t\t0x53e /* can not access nodeInfo in root field */,\n\t\t);\n\t\treturn this.nodePositionInfo;\n\t}\n\n\tpublic nextField(): boolean {\n\t\tthis.indexOfField++;\n\t\tconst fields = this.nodeInfo(CursorLocationType.Fields).shape.fieldsArray;\n\t\tif (this.indexOfField < fields.length) {\n\t\t\tconst fieldArr = fields[this.indexOfField] ?? oob();\n\t\t\tthis.fieldKey = fieldArr[0];\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitField();\n\t\treturn false;\n\t}\n\n\tpublic exitField(): void {\n\t\tassert(this.mode === CursorLocationType.Fields, 0x4c9 /* exitField when in wrong mode */);\n\t\tassert(this.nodePositionInfo !== undefined, 0x563 /* can not exit root field */);\n\t\tthis.fieldKey = undefined;\n\t\tthis.mode = CursorLocationType.Nodes;\n\t}\n\n\tpublic getFieldKey(): FieldKey {\n\t\treturn this.fieldKey ?? fail(0xb09 /* not in a field */);\n\t}\n\n\tpublic getFieldLength(): number {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x53f /* tried to access cursor when in wrong mode */,\n\t\t);\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\treturn this.shape.topLevelLength;\n\t\t}\n\t\tconst fieldInfo = this.nodePositionInfo.shape.fieldsArray[this.indexOfField];\n\t\tif (fieldInfo === undefined) {\n\t\t\treturn 0;\n\t\t}\n\t\treturn fieldInfo[2];\n\t}\n\n\tpublic firstNode(): boolean {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x540 /* tried to access cursor when in wrong mode */,\n\t\t);\n\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\t// Root field is not allowed to be empty, so we can skip handling that case.\n\t\t\tthis.enterRootNodeInner(0);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn this.enterNodeInner(this.nodePositionInfo, 0);\n\t\t}\n\t}\n\n\tpublic enterNode(childIndex: number): void {\n\t\tassert(\n\t\t\tthis.mode === CursorLocationType.Fields,\n\t\t\t0x541 /* tried to access cursor when in wrong mode */,\n\t\t);\n\t\tassert(childIndex >= 0, 0x4ca /* index must be positive */);\n\t\tif (this.nodePositionInfo === undefined) {\n\t\t\tassert(\n\t\t\t\tchildIndex < this.shape.topLevelLength,\n\t\t\t\t0x542 /* index must not be past the end of the field */,\n\t\t\t);\n\t\t\tthis.enterRootNodeInner(childIndex);\n\t\t} else {\n\t\t\tconst moved = this.enterNodeInner(this.nodePositionInfo, childIndex);\n\t\t\tassert(moved, 0x4cb /* index must not be past the end of the field */);\n\t\t}\n\t}\n\n\t/**\n\t * Enter the current field, at `childIndex`.\n\t * @param childIndex - index into current field to navigate to. Must be non-negative integer.\n\t */\n\tprivate enterNodeInner(currentPosition: NodePositionInfo, childIndex: number): boolean {\n\t\tconst shape = currentPosition.shape;\n\t\tconst fields = shape.fieldsOffsetArray;\n\t\tif (this.indexOfField >= fields.length) {\n\t\t\treturn false; // Handle empty field (indexed by key into empty field)\n\t\t}\n\t\tconst f = shape.fieldsOffsetArray[this.indexOfField] ?? oob();\n\t\tif (childIndex >= f.topLevelLength) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.mode = CursorLocationType.Nodes;\n\t\tthis.fieldKey = undefined;\n\t\tthis.moveToPosition(this.positionIndex + f.offset + childIndex * f.shape.positions.length);\n\t\tassert(this.fieldIndex === childIndex, 0x4cc /* should be at selected child */);\n\t\treturn true;\n\t}\n\n\tprivate enterRootNodeInner(childIndex: number): void {\n\t\tthis.mode = CursorLocationType.Nodes;\n\t\tthis.fieldKey = undefined;\n\t\t// 1 for the \"undefined\" at the beginning of the positions array, then stride by top level tree shape.\n\t\tthis.moveToPosition(1 + childIndex * this.shape.treeShape.positions.length);\n\t\tassert(this.fieldIndex === childIndex, 0x543 /* should be at selected child */);\n\t}\n\n\tpublic getFieldPath(prefix?: PathRootPrefix): FieldUpPath {\n\t\treturn prefixFieldPath(prefix, {\n\t\t\tfield: this.getFieldKey(),\n\t\t\tparent: this.nodePositionInfo,\n\t\t});\n\t}\n\n\tpublic getPath(prefix?: PathRootPrefix): UpPath | undefined {\n\t\treturn prefixPath(prefix, this.nodeInfo(CursorLocationType.Nodes));\n\t}\n\n\tpublic get fieldIndex(): number {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).parentIndex;\n\t}\n\n\tpublic readonly chunkStart: number = 0;\n\n\tpublic get chunkLength(): number {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).topLevelLength;\n\t}\n\n\tpublic seekNodes(offset: number): boolean {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst index = offset + info.parentIndex;\n\t\tif (index >= 0 && index < info.topLevelLength) {\n\t\t\tthis.moveToPosition(this.positionIndex + offset * info.shape.positions.length);\n\t\t\treturn true;\n\t\t}\n\t\tthis.exitNode();\n\t\treturn false;\n\t}\n\n\tpublic nextNode(): boolean {\n\t\t// This is the same as `return this.seekNodes(1);` but slightly faster.\n\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tconst index = info.parentIndex + 1;\n\t\tif (index === info.topLevelLength) {\n\t\t\tthis.exitNode();\n\t\t\treturn false;\n\t\t}\n\t\tthis.moveToPosition(this.positionIndex + info.shape.positions.length);\n\t\treturn true;\n\t}\n\n\tpublic exitNode(): void {\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\tthis.indexOfField =\n\t\t\tinfo.indexOfParentField ??\n\t\t\tfail(0xb0a /* navigation up to root field not yet supported */); // TODO;\n\t\tthis.fieldKey = info.parentField;\n\t\tthis.mode = CursorLocationType.Fields;\n\t\tthis.moveToPosition(\n\t\t\tinfo.indexOfParentPosition ??\n\t\t\t\tfail(0xb0b /* navigation up to root field not yet supported */),\n\t\t); // TODO\n\t}\n\n\tpublic firstField(): boolean {\n\t\tconst fieldsArray = this.nodeInfo(CursorLocationType.Nodes).shape.fieldsArray;\n\t\tif (!hasSome(fieldsArray)) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.indexOfField = 0;\n\t\tthis.mode = CursorLocationType.Fields;\n\t\tconst fields = fieldsArray[0];\n\t\tthis.fieldKey = fields[0];\n\t\treturn true;\n\t}\n\n\tpublic enterField(key: FieldKey): void {\n\t\tconst fieldMap = this.nodeInfo(CursorLocationType.Nodes).shape.fields;\n\t\tconst fieldInfo = fieldMap.get(key);\n\t\tthis.indexOfField =\n\t\t\tfieldInfo === undefined\n\t\t\t\t? fieldMap.size\n\t\t\t\t: (fieldInfo.indexOfParentField ?? fail(0xb0c /* children should have parents */));\n\t\tthis.fieldKey = key;\n\t\tthis.mode = CursorLocationType.Fields;\n\t}\n\n\tpublic get type(): TreeNodeSchemaIdentifier {\n\t\treturn this.nodeInfo(CursorLocationType.Nodes).shape.type;\n\t}\n\n\tpublic get value(): Value {\n\t\tconst idCompressor = this.chunk.idCompressor;\n\t\tconst info = this.nodeInfo(CursorLocationType.Nodes);\n\t\t// If the maybeDecompressedStringAsNumber flag is set to true, we check if the value is a number.\n\t\t// This flag can only ever be set on string leaf nodes, so if the value is a number, we can assume it is a compressible, known stable id.\n\t\tif (info.shape.hasValue && info.shape.maybeDecompressedStringAsNumber) {\n\t\t\tconst value = this.chunk.values[info.valueOffset];\n\t\t\tif (typeof value === \"number\" && idCompressor !== undefined) {\n\t\t\t\treturn idCompressor.decompress(value as SessionSpaceCompressedId);\n\t\t\t}\n\t\t}\n\t\treturn info.shape.hasValue ? this.chunk.values[info.valueOffset] : undefined;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultFieldKinds.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultFieldKinds.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"defaultFieldKinds.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultFieldKinds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,YAAY,EAEjB,KAAK,mBAAmB,EACxB,4BAA4B,EAC5B,YAAY,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEN,KAAK,kBAAkB,EACvB,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Y,CAAC,QAAQ,CAAC;CAAG;AACrF;GACG;AACH,MAAM,WAAW,QAAS,SAAQ,aAAa,CAAC,UAAU,EAAE,YAAY,CAAC,QAAQ,CAAC;CAAG;AACrF;GACG;AACH,MAAM,WAAW,UAAW,SAAQ,aAAa,CAAC,YAAY,EAAE,YAAY,CAAC,MAAM,CAAC;CAAG;AACvF;GACG;AACH,MAAM,WAAW,SAChB,SAAQ,aAAa,CAAC,OAAO,4BAA4B,EAAE,YAAY,CAAC,SAAS,CAAC;CAAG;AAEtF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE;IAExB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC4B,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { fail } from "@fluidframework/core-utils/internal";
|
|
5
6
|
import { forbiddenFieldKindIdentifier, Multiplicity, } from "../../core/index.js";
|
|
6
|
-
import { fail } from "../../util/index.js";
|
|
7
7
|
import { FieldKindWithEditor, allowsTreeSchemaIdentifierSuperset, referenceFreeFieldChangeRebaser, } from "../modular-schema/index.js";
|
|
8
8
|
import { optionalChangeHandler, optionalFieldEditor, } from "../optional-field/index.js";
|
|
9
9
|
import { sequenceFieldChangeHandler } from "../sequence-field/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultFieldKinds.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultFieldKinds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIN,4BAA4B,EAC5B,YAAY,GACZ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D,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;YAC3D,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;YAC3D,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;YAC7D,CAAC,UAAU,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;SAC/D,CAAC;KACF;CACD,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAA0D,IAAI,GAAG,CACvF,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAC5F,CAAC;AAwBF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAOnB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ChangeAtomId,\n\ttype DeltaDetachedNodeId,\n\ttype FieldKindIdentifier,\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity,\n} from \"../../core/index.js\";\nimport { fail } from \"../../util/index.js\";\nimport {\n\ttype FieldChangeDelta,\n\ttype FieldChangeHandler,\n\ttype FieldEditor,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tFieldKindWithEditor,\n\ttype FlexFieldKind,\n\ttype ToDelta,\n\tallowsTreeSchemaIdentifierSuperset,\n\treferenceFreeFieldChangeRebaser,\n} from \"../modular-schema/index.js\";\nimport {\n\ttype OptionalChangeset,\n\toptionalChangeHandler,\n\toptionalFieldEditor,\n} from \"../optional-field/index.js\";\nimport { sequenceFieldChangeHandler } from \"../sequence-field/index.js\";\n\nimport { noChangeCodecFamily } from \"./noChangeCodecs.js\";\n\n/**\n * ChangeHandler that only handles no-op / identity changes.\n */\nexport const noChangeHandler: FieldChangeHandler<0> = {\n\trebaser: referenceFreeFieldChangeRebaser({\n\t\tcompose: (change1: 0, change2: 0) => 0,\n\t\tinvert: (changes: 0) => 0,\n\t\trebase: (change: 0, over: 0) => 0,\n\t}),\n\tcodecsFactory: () => noChangeCodecFamily,\n\teditor: { buildChildChanges: () => fail(0xb0d /* Child changes not supported */) },\n\tintoDelta: (change, deltaFromChild: ToDelta): FieldChangeDelta => ({}),\n\trelevantRemovedRoots: (change): Iterable<DeltaDetachedNodeId> => [],\n\tisEmpty: (change: 0) => true,\n\tgetNestedChanges: (change: 0) => [],\n\tcreateEmpty: () => 0,\n\tgetCrossFieldKeys: () => [],\n};\n\nexport interface ValueFieldEditor extends FieldEditor<OptionalChangeset> {\n\t/**\n\t * Creates a change which replaces the current value of the field with `newValue`.\n\t * @param ids - The ids for the fill and detach fields.\n\t */\n\tset(ids: { fill: ChangeAtomId; detach: ChangeAtomId }): OptionalChangeset;\n}\n\nconst optionalIdentifier = \"Optional\";\n/**\n * 0 or 1 items.\n */\nexport const optional = new FieldKindWithEditor(\n\toptionalIdentifier,\n\tMultiplicity.Optional,\n\toptionalChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier || other.kind === optionalIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set([]),\n);\n\nexport const valueFieldEditor: ValueFieldEditor = {\n\t...optionalFieldEditor,\n\tset: (ids: {\n\t\tfill: ChangeAtomId;\n\t\tdetach: ChangeAtomId;\n\t}): OptionalChangeset => optionalFieldEditor.set(false, ids),\n};\n\nexport const valueChangeHandler: FieldChangeHandler<OptionalChangeset, ValueFieldEditor> = {\n\t...optional.changeHandler,\n\teditor: valueFieldEditor,\n};\n\nconst requiredIdentifier = \"Value\";\n\n/**\n * Exactly one item.\n */\nexport const required = new FieldKindWithEditor(\n\trequiredIdentifier,\n\tMultiplicity.Single,\n\tvalueChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === nodeKey.identifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\nconst sequenceIdentifier = \"Sequence\";\n\n/**\n * 0 or more items.\n */\nexport const sequence = new FieldKindWithEditor(\n\tsequenceIdentifier,\n\tMultiplicity.Sequence,\n\tsequenceFieldChangeHandler,\n\t(types, other) =>\n\t\tother.kind === sequenceIdentifier &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\t// TODO: add normalizer/importers for handling ops from other kinds.\n\tnew Set([]),\n);\n\nconst nodeKeyIdentifier = \"NodeKey\";\n\n/**\n * Exactly one identifier.\n */\nexport const nodeKey = new FieldKindWithEditor(\n\tnodeKeyIdentifier,\n\tMultiplicity.Single,\n\tnoChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === nodeKeyIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\nconst identifierFieldIdentifier = \"Identifier\";\n\n/**\n * Exactly one identifier.\n */\nexport const identifier = new FieldKindWithEditor(\n\tidentifierFieldIdentifier,\n\tMultiplicity.Single,\n\tnoChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === identifierFieldIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\n/**\n * Exactly 0 items.\n *\n * Using Forbidden makes what types are listed for allowed in a field irrelevant\n * since the field will never have values in it.\n *\n * Using Forbidden is equivalent to picking a kind that permits empty (like sequence or optional)\n * and having no allowed types (or only never types).\n * Because of this, its possible to express everything constraint wise without Forbidden,\n * but using Forbidden can be more semantically clear than optional with no allowed types.\n *\n * For view schema, this can be useful if you need to:\n * - run a specific out of schema handler when a field is present,\n * but otherwise are ignoring or tolerating (ex: via extra fields) unmentioned fields.\n * - prevent a specific field from being used as an extra field\n * (perhaps for some past of future compatibility reason)\n * - keep a field in a schema for metadata purposes\n * (ex: for improved error messaging, error handling or documentation)\n * that is not used in this specific version of the schema (ex: to document what it was or will be used for).\n *\n * For stored schema, this can be useful if you need to:\n * - have a field which can have its schema updated to Optional or Sequence of any type.\n * - to exclude a field from extra fields\n * - for the schema system to use as a default for fields which aren't declared\n * (ex: when updating a field that did not exist into one that does)\n *\n * See {@link emptyField} for a constant, reusable field using Forbidden.\n */\nexport const forbidden = new FieldKindWithEditor(\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity.Forbidden,\n\tnoChangeHandler,\n\t// All multiplicities other than Value support empty.\n\t(types, other) => fieldKinds.get(other.kind)?.multiplicity !== Multiplicity.Single,\n\tnew Set(),\n);\n\nexport const fieldKindConfigurations: ReadonlyMap<number, FieldKindConfiguration> = new Map([\n\t[\n\t\t1,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 1 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 1 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 1 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\t2,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 1 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\t3,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 2 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\t4,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 3 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n]);\n\n/**\n * All supported field kinds.\n *\n * @privateRemarks\n * Before making a SharedTree format change which impacts which set of field kinds are allowed,\n * code which uses this should be audited for compatibility considerations.\n */\nexport const fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindWithEditor> = new Map(\n\t[required, optional, sequence, nodeKey, identifier, forbidden].map((s) => [s.identifier, s]),\n);\n\n// Create named Aliases for nicer intellisense.\n\n// TODO: Find a way to make docs like {@inheritDoc required} work in vscode.\n// TODO: ensure thy work in generated docs.\n// TODO: add these comments to the rest of the cases below.\n/**\n */\nexport interface Required extends FlexFieldKind<\"Value\", Multiplicity.Single> {}\n/**\n */\nexport interface Optional extends FlexFieldKind<\"Optional\", Multiplicity.Optional> {}\n/**\n */\nexport interface Sequence extends FlexFieldKind<\"Sequence\", Multiplicity.Sequence> {}\n/**\n */\nexport interface Identifier extends FlexFieldKind<\"Identifier\", Multiplicity.Single> {}\n/**\n */\nexport interface Forbidden\n\textends FlexFieldKind<typeof forbiddenFieldKindIdentifier, Multiplicity.Forbidden> {}\n\n/**\n * Default FieldKinds with their editor types erased.\n */\nexport const FieldKinds: {\n\t// TODO: inheritDoc for these somehow\n\treadonly required: Required;\n\treadonly optional: Optional;\n\treadonly sequence: Sequence;\n\treadonly identifier: Identifier;\n\treadonly forbidden: Forbidden;\n} = { required, optional, sequence, identifier, forbidden };\n"]}
|
|
1
|
+
{"version":3,"file":"defaultFieldKinds.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/defaultFieldKinds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAC3D,OAAO,EAIN,4BAA4B,EAC5B,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAMN,mBAAmB,EAGnB,kCAAkC,EAClC,+BAA+B,GAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEN,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA0B;IACrD,OAAO,EAAE,+BAA+B,CAAC;QACxC,OAAO,EAAE,CAAC,OAAU,EAAE,OAAU,EAAE,EAAE,CAA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A0D,IAAI,GAAG,CACvF,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAC5F,CAAC;AAwBF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAOnB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype ChangeAtomId,\n\ttype DeltaDetachedNodeId,\n\ttype FieldKindIdentifier,\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity,\n} from \"../../core/index.js\";\nimport {\n\ttype FieldChangeDelta,\n\ttype FieldChangeHandler,\n\ttype FieldEditor,\n\ttype FieldKindConfiguration,\n\ttype FieldKindConfigurationEntry,\n\tFieldKindWithEditor,\n\ttype FlexFieldKind,\n\ttype ToDelta,\n\tallowsTreeSchemaIdentifierSuperset,\n\treferenceFreeFieldChangeRebaser,\n} from \"../modular-schema/index.js\";\nimport {\n\ttype OptionalChangeset,\n\toptionalChangeHandler,\n\toptionalFieldEditor,\n} from \"../optional-field/index.js\";\nimport { sequenceFieldChangeHandler } from \"../sequence-field/index.js\";\n\nimport { noChangeCodecFamily } from \"./noChangeCodecs.js\";\n\n/**\n * ChangeHandler that only handles no-op / identity changes.\n */\nexport const noChangeHandler: FieldChangeHandler<0> = {\n\trebaser: referenceFreeFieldChangeRebaser({\n\t\tcompose: (change1: 0, change2: 0) => 0,\n\t\tinvert: (changes: 0) => 0,\n\t\trebase: (change: 0, over: 0) => 0,\n\t}),\n\tcodecsFactory: () => noChangeCodecFamily,\n\teditor: { buildChildChanges: () => fail(0xb0d /* Child changes not supported */) },\n\tintoDelta: (change, deltaFromChild: ToDelta): FieldChangeDelta => ({}),\n\trelevantRemovedRoots: (change): Iterable<DeltaDetachedNodeId> => [],\n\tisEmpty: (change: 0) => true,\n\tgetNestedChanges: (change: 0) => [],\n\tcreateEmpty: () => 0,\n\tgetCrossFieldKeys: () => [],\n};\n\nexport interface ValueFieldEditor extends FieldEditor<OptionalChangeset> {\n\t/**\n\t * Creates a change which replaces the current value of the field with `newValue`.\n\t * @param ids - The ids for the fill and detach fields.\n\t */\n\tset(ids: { fill: ChangeAtomId; detach: ChangeAtomId }): OptionalChangeset;\n}\n\nconst optionalIdentifier = \"Optional\";\n/**\n * 0 or 1 items.\n */\nexport const optional = new FieldKindWithEditor(\n\toptionalIdentifier,\n\tMultiplicity.Optional,\n\toptionalChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier || other.kind === optionalIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set([]),\n);\n\nexport const valueFieldEditor: ValueFieldEditor = {\n\t...optionalFieldEditor,\n\tset: (ids: {\n\t\tfill: ChangeAtomId;\n\t\tdetach: ChangeAtomId;\n\t}): OptionalChangeset => optionalFieldEditor.set(false, ids),\n};\n\nexport const valueChangeHandler: FieldChangeHandler<OptionalChangeset, ValueFieldEditor> = {\n\t...optional.changeHandler,\n\teditor: valueFieldEditor,\n};\n\nconst requiredIdentifier = \"Value\";\n\n/**\n * Exactly one item.\n */\nexport const required = new FieldKindWithEditor(\n\trequiredIdentifier,\n\tMultiplicity.Single,\n\tvalueChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === nodeKey.identifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\nconst sequenceIdentifier = \"Sequence\";\n\n/**\n * 0 or more items.\n */\nexport const sequence = new FieldKindWithEditor(\n\tsequenceIdentifier,\n\tMultiplicity.Sequence,\n\tsequenceFieldChangeHandler,\n\t(types, other) =>\n\t\tother.kind === sequenceIdentifier &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\t// TODO: add normalizer/importers for handling ops from other kinds.\n\tnew Set([]),\n);\n\nconst nodeKeyIdentifier = \"NodeKey\";\n\n/**\n * Exactly one identifier.\n */\nexport const nodeKey = new FieldKindWithEditor(\n\tnodeKeyIdentifier,\n\tMultiplicity.Single,\n\tnoChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === nodeKeyIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\nconst identifierFieldIdentifier = \"Identifier\";\n\n/**\n * Exactly one identifier.\n */\nexport const identifier = new FieldKindWithEditor(\n\tidentifierFieldIdentifier,\n\tMultiplicity.Single,\n\tnoChangeHandler,\n\t(types, other) =>\n\t\t(other.kind === sequence.identifier ||\n\t\t\tother.kind === requiredIdentifier ||\n\t\t\tother.kind === optional.identifier ||\n\t\t\tother.kind === identifierFieldIdentifier) &&\n\t\tallowsTreeSchemaIdentifierSuperset(types, other.types),\n\tnew Set(),\n);\n\n/**\n * Exactly 0 items.\n *\n * Using Forbidden makes what types are listed for allowed in a field irrelevant\n * since the field will never have values in it.\n *\n * Using Forbidden is equivalent to picking a kind that permits empty (like sequence or optional)\n * and having no allowed types (or only never types).\n * Because of this, its possible to express everything constraint wise without Forbidden,\n * but using Forbidden can be more semantically clear than optional with no allowed types.\n *\n * For view schema, this can be useful if you need to:\n * - run a specific out of schema handler when a field is present,\n * but otherwise are ignoring or tolerating (ex: via extra fields) unmentioned fields.\n * - prevent a specific field from being used as an extra field\n * (perhaps for some past of future compatibility reason)\n * - keep a field in a schema for metadata purposes\n * (ex: for improved error messaging, error handling or documentation)\n * that is not used in this specific version of the schema (ex: to document what it was or will be used for).\n *\n * For stored schema, this can be useful if you need to:\n * - have a field which can have its schema updated to Optional or Sequence of any type.\n * - to exclude a field from extra fields\n * - for the schema system to use as a default for fields which aren't declared\n * (ex: when updating a field that did not exist into one that does)\n *\n * See {@link emptyField} for a constant, reusable field using Forbidden.\n */\nexport const forbidden = new FieldKindWithEditor(\n\tforbiddenFieldKindIdentifier,\n\tMultiplicity.Forbidden,\n\tnoChangeHandler,\n\t// All multiplicities other than Value support empty.\n\t(types, other) => fieldKinds.get(other.kind)?.multiplicity !== Multiplicity.Single,\n\tnew Set(),\n);\n\nexport const fieldKindConfigurations: ReadonlyMap<number, FieldKindConfiguration> = new Map([\n\t[\n\t\t1,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 1 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 1 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 1 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\t2,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 1 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\t3,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 2 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n\t[\n\t\t4,\n\t\tnew Map<FieldKindIdentifier, FieldKindConfigurationEntry>([\n\t\t\t[nodeKey.identifier, { kind: nodeKey, formatVersion: 1 }],\n\t\t\t[required.identifier, { kind: required, formatVersion: 2 }],\n\t\t\t[optional.identifier, { kind: optional, formatVersion: 2 }],\n\t\t\t[sequence.identifier, { kind: sequence, formatVersion: 3 }],\n\t\t\t[forbidden.identifier, { kind: forbidden, formatVersion: 1 }],\n\t\t\t[identifier.identifier, { kind: identifier, formatVersion: 1 }],\n\t\t]),\n\t],\n]);\n\n/**\n * All supported field kinds.\n *\n * @privateRemarks\n * Before making a SharedTree format change which impacts which set of field kinds are allowed,\n * code which uses this should be audited for compatibility considerations.\n */\nexport const fieldKinds: ReadonlyMap<FieldKindIdentifier, FieldKindWithEditor> = new Map(\n\t[required, optional, sequence, nodeKey, identifier, forbidden].map((s) => [s.identifier, s]),\n);\n\n// Create named Aliases for nicer intellisense.\n\n// TODO: Find a way to make docs like {@inheritDoc required} work in vscode.\n// TODO: ensure thy work in generated docs.\n// TODO: add these comments to the rest of the cases below.\n/**\n */\nexport interface Required extends FlexFieldKind<\"Value\", Multiplicity.Single> {}\n/**\n */\nexport interface Optional extends FlexFieldKind<\"Optional\", Multiplicity.Optional> {}\n/**\n */\nexport interface Sequence extends FlexFieldKind<\"Sequence\", Multiplicity.Sequence> {}\n/**\n */\nexport interface Identifier extends FlexFieldKind<\"Identifier\", Multiplicity.Single> {}\n/**\n */\nexport interface Forbidden\n\textends FlexFieldKind<typeof forbiddenFieldKindIdentifier, Multiplicity.Forbidden> {}\n\n/**\n * Default FieldKinds with their editor types erased.\n */\nexport const FieldKinds: {\n\t// TODO: inheritDoc for these somehow\n\treadonly required: Required;\n\treadonly optional: Optional;\n\treadonly sequence: Sequence;\n\treadonly identifier: Identifier;\n\treadonly forbidden: Forbidden;\n} = { required, optional, sequence, identifier, forbidden };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaChecker.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/schemaChecker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAI1B,YAAY,EACZ,KAAK,eAAe,EACpB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemaChecker.d.ts","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/schemaChecker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAI1B,YAAY,EACZ,KAAK,eAAe,EACpB,MAAM,qBAAqB,CAAC;AAG7B,0BAAkB,sBAAsB;IACvC,OAAO,IAAA;IACP,2BAA2B,IAAA;IAC3B,2BAA2B,IAAA;IAC3B,wBAAwB,IAAA;IACxB,qBAAqB,IAAA;IACrB,yBAAyB,IAAA;IACzB,2BAA2B,IAAA;IAC3B,2BAA2B,IAAA;IAC3B,kBAAkB,IAAA;IAClB,YAAY,IAAA;CACZ;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC7B,IAAI,EAAE,OAAO,EACb,eAAe,EAAE,eAAe,GAC9B,sBAAsB,CA2DxB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC9B,UAAU,EAAE,SAAS,OAAO,EAAE,EAC9B,MAAM,EAAE,qBAAqB,EAC7B,eAAe,EAAE,eAAe,GAC9B,sBAAsB,CA0BxB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACvC,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,YAAY,GACxB,OAAO,CAaT"}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { unreachableCase } from "@fluidframework/core-utils/internal";
|
|
5
|
+
import { unreachableCase, fail } from "@fluidframework/core-utils/internal";
|
|
6
6
|
import { LeafNodeStoredSchema, ObjectNodeStoredSchema, MapNodeStoredSchema, Multiplicity, } from "../../core/index.js";
|
|
7
7
|
import { allowsValue } from "../valueUtilities.js";
|
|
8
|
-
import { fail } from "../../util/index.js";
|
|
9
8
|
export var SchemaValidationErrors;
|
|
10
9
|
(function (SchemaValidationErrors) {
|
|
11
10
|
SchemaValidationErrors[SchemaValidationErrors["NoError"] = 0] = "NoError";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaChecker.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/schemaChecker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"schemaChecker.js","sourceRoot":"","sources":["../../../src/feature-libraries/default-schema/schemaChecker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAGN,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,YAAY,GAEZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,CAAN,IAAkB,sBAWjB;AAXD,WAAkB,sBAAsB;IACvC,yEAAO,CAAA;IACP,iHAA2B,CAAA;IAC3B,iHAA2B,CAAA;IAC3B,2GAAwB,CAAA;IACxB,qGAAqB,CAAA;IACrB,6GAAyB,CAAA;IACzB,iHAA2B,CAAA;IAC3B,iHAA2B,CAAA;IAC3B,+FAAkB,CAAA;IAClB,mFAAY,CAAA;AACb,CAAC,EAXiB,sBAAsB,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EAAE,CAAC;QAC/B,kEAAkE;QAClE,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChE,+DAAuD;QACxD,CAAC;QAED,8DAA8D;QAC9D,MAAM,kBAAkB,GAAG,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QACjE,IAAI,kBAAkB,2CAAmC,EAAE,CAAC;YAC3D,OAAO,kBAAkB,CAAC;QAC3B,CAAC;IACF,CAAC;IAED,8CAAsC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACvC,aAAqB,EACrB,YAA0B;IAE1B,QAAQ,YAAY,EAAE,CAAC;QACtB,KAAK,YAAY,CAAC,MAAM;YACvB,OAAO,aAAa,KAAK,CAAC,CAAC;QAC5B,KAAK,YAAY,CAAC,QAAQ;YACzB,OAAO,aAAa,IAAI,CAAC,CAAC;QAC3B,KAAK,YAAY,CAAC,QAAQ;YACzB,OAAO,IAAI,CAAC;QACb,KAAK,YAAY,CAAC,SAAS;YAC1B,OAAO,aAAa,KAAK,CAAC,CAAC;QAC5B;YACC,eAAe,CAAC,YAAY,CAAC,CAAC;IAChC,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase, fail } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype MapTree,\n\ttype TreeFieldStoredSchema,\n\tLeafNodeStoredSchema,\n\tObjectNodeStoredSchema,\n\tMapNodeStoredSchema,\n\tMultiplicity,\n\ttype SchemaAndPolicy,\n} from \"../../core/index.js\";\nimport { allowsValue } from \"../valueUtilities.js\";\n\nexport const enum SchemaValidationErrors {\n\tNoError,\n\tField_KindNotInSchemaPolicy,\n\tField_IncorrectMultiplicity,\n\tField_NodeTypeNotAllowed,\n\tLeafNode_InvalidValue,\n\tLeafNode_FieldsNotAllowed,\n\tObjectNode_FieldNotInSchema,\n\tNonLeafNode_ValueNotAllowed,\n\tNode_MissingSchema,\n\tUnknownError,\n}\n\n/**\n * Deeply checks that the provided node complies with the schema based on its identifier.\n */\nexport function isNodeInSchema(\n\tnode: MapTree,\n\tschemaAndPolicy: SchemaAndPolicy,\n): SchemaValidationErrors {\n\t// If the stored schema is completely empty it _probably_ (in almost all cases?) means the tree is brand new and we\n\t// shouldn't validate the data.\n\t// TODO: AB#8197\n\t// See https://github.com/microsoft/FluidFramework/pull/21305#discussion_r1626595991 for further discussion.\n\tif (schemaAndPolicy.schema.nodeSchema.size === 0) {\n\t\treturn SchemaValidationErrors.NoError;\n\t}\n\n\t// Validate the schema declared by the node exists\n\tconst schema = schemaAndPolicy.schema.nodeSchema.get(node.type);\n\tif (schema === undefined) {\n\t\treturn SchemaValidationErrors.Node_MissingSchema;\n\t}\n\n\t// Validate the node is well formed according to its schema\n\n\tif (schema instanceof LeafNodeStoredSchema) {\n\t\tif (node.fields.size !== 0) {\n\t\t\treturn SchemaValidationErrors.LeafNode_FieldsNotAllowed;\n\t\t}\n\t\tif (!allowsValue(schema.leafValue, node.value)) {\n\t\t\treturn SchemaValidationErrors.LeafNode_InvalidValue;\n\t\t}\n\t} else if (schema instanceof ObjectNodeStoredSchema) {\n\t\tif (node.value !== undefined) {\n\t\t\treturn SchemaValidationErrors.NonLeafNode_ValueNotAllowed;\n\t\t}\n\t\tconst uncheckedFieldsFromNode = new Set(node.fields.keys());\n\t\tfor (const [fieldKey, fieldSchema] of schema.objectNodeFields) {\n\t\t\tconst nodeField = node.fields.get(fieldKey) ?? [];\n\t\t\tconst fieldInSchemaResult = isFieldInSchema(nodeField, fieldSchema, schemaAndPolicy);\n\t\t\tif (fieldInSchemaResult !== SchemaValidationErrors.NoError) {\n\t\t\t\treturn fieldInSchemaResult;\n\t\t\t}\n\t\t\tuncheckedFieldsFromNode.delete(fieldKey);\n\t\t}\n\t\t// The node has fields that we did not check as part of looking at every field defined in the node's schema\n\t\tif (\n\t\t\tuncheckedFieldsFromNode.size !== 0 &&\n\t\t\t!schemaAndPolicy.policy.allowUnknownOptionalFields(node.type)\n\t\t) {\n\t\t\treturn SchemaValidationErrors.ObjectNode_FieldNotInSchema;\n\t\t}\n\t} else if (schema instanceof MapNodeStoredSchema) {\n\t\tif (node.value !== undefined) {\n\t\t\treturn SchemaValidationErrors.NonLeafNode_ValueNotAllowed;\n\t\t}\n\t\tfor (const field of node.fields.values()) {\n\t\t\tconst fieldInSchemaResult = isFieldInSchema(field, schema.mapFields, schemaAndPolicy);\n\t\t\tif (fieldInSchemaResult !== SchemaValidationErrors.NoError) {\n\t\t\t\treturn fieldInSchemaResult;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfail(0xb0e /* Unknown TreeNodeStoredSchema type */);\n\t}\n\n\treturn SchemaValidationErrors.NoError;\n}\n\n/**\n * Deeply checks that the nodes comply with the field schema and included schema.\n */\nexport function isFieldInSchema(\n\tchildNodes: readonly MapTree[],\n\tschema: TreeFieldStoredSchema,\n\tschemaAndPolicy: SchemaAndPolicy,\n): SchemaValidationErrors {\n\t// Validate that the field kind is handled by the schema policy\n\tconst kind = schemaAndPolicy.policy.fieldKinds.get(schema.kind);\n\tif (kind === undefined) {\n\t\treturn SchemaValidationErrors.Field_KindNotInSchemaPolicy;\n\t}\n\n\t// Validate that the field doesn't contain more nodes than its type supports\n\tif (!compliesWithMultiplicity(childNodes.length, kind.multiplicity)) {\n\t\treturn SchemaValidationErrors.Field_IncorrectMultiplicity;\n\t}\n\n\tfor (const node of childNodes) {\n\t\t// Validate the type declared by the node is allowed in this field\n\t\tif (schema.types !== undefined && !schema.types.has(node.type)) {\n\t\t\treturn SchemaValidationErrors.Field_NodeTypeNotAllowed;\n\t\t}\n\n\t\t// Validate the node complies with the type it declares to be.\n\t\tconst nodeInSchemaResult = isNodeInSchema(node, schemaAndPolicy);\n\t\tif (nodeInSchemaResult !== SchemaValidationErrors.NoError) {\n\t\t\treturn nodeInSchemaResult;\n\t\t}\n\t}\n\n\treturn SchemaValidationErrors.NoError;\n}\n\n/**\n * Validates that a given number of items complies with the specified {@link Multiplicity | multiplicity}.\n * @param numberOfItems - Number of items.\n * @param multiplicity - Kind of multiplicity to validate against.\n * @returns `true` if the specified number of items complies with the specified multiplicity; otherwise, `false`.\n */\nexport function compliesWithMultiplicity(\n\tnumberOfItems: number,\n\tmultiplicity: Multiplicity,\n): boolean {\n\tswitch (multiplicity) {\n\t\tcase Multiplicity.Single:\n\t\t\treturn numberOfItems === 1;\n\t\tcase Multiplicity.Optional:\n\t\t\treturn numberOfItems <= 1;\n\t\tcase Multiplicity.Sequence:\n\t\t\treturn true;\n\t\tcase Multiplicity.Forbidden:\n\t\t\treturn numberOfItems === 0;\n\t\tdefault:\n\t\t\tunreachableCase(multiplicity);\n\t}\n}\n"]}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
5
|
+
import { assert, fail } from "@fluidframework/core-utils/internal";
|
|
6
6
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
7
7
|
import { inCursorNode, iterateCursorField, rootFieldKey, } from "../../core/index.js";
|
|
8
|
-
import { disposeSymbol,
|
|
8
|
+
import { disposeSymbol, getOrCreate } from "../../util/index.js";
|
|
9
9
|
import { FieldKinds, MappedEditBuilder, } from "../default-schema/index.js";
|
|
10
10
|
import { FlexTreeEntityKind, TreeStatus, flexTreeMarker, flexTreeSlot, } from "./flexTreeTypes.js";
|
|
11
11
|
import { LazyEntity, anchorSymbol, cursorSymbol, forgetAnchorSymbol, isFreedSymbol, tryMoveCursorToAnchorSymbol, } from "./lazyEntity.js";
|