@fluidframework/tree 2.51.0 → 2.53.0-350190
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/.vscode/settings.json +0 -1
- package/CHANGELOG.md +43 -0
- package/api-report/tree.alpha.api.md +40 -30
- package/dist/alpha.d.ts +2 -1
- package/dist/codec/codec.d.ts +2 -1
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +4 -3
- package/dist/codec/codec.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +3 -1
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +2 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts +1 -23
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js +2 -2
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/dist/core/tree/detachedFieldIndex.js +2 -3
- package/dist/core/tree/detachedFieldIndex.js.map +1 -1
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +17 -0
- package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecCommon.js +68 -0
- package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +11 -0
- package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecV1.js +55 -0
- package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecV2.d.ts +11 -0
- package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecV2.js +49 -0
- package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts +11 -0
- package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -0
- package/dist/core/tree/detachedFieldIndexCodecs.js +26 -0
- package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -0
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +37 -0
- package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -0
- package/dist/core/tree/{detachedFieldIndexFormat.js → detachedFieldIndexFormatCommon.js} +18 -13
- package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -0
- package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +13 -0
- package/dist/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -0
- package/dist/core/tree/detachedFieldIndexFormatV1.js +12 -0
- package/dist/core/tree/detachedFieldIndexFormatV1.js.map +1 -0
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +14 -0
- package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -0
- package/dist/core/tree/detachedFieldIndexFormatV2.js +14 -0
- package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +9 -9
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +21 -21
- package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +4 -2
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +4 -4
- package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +50 -31
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +74 -61
- package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts +20 -14
- package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/format.js +18 -12
- package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/{lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts → dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts} +20 -14
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/{nodeShape.js → nodeEncoder.js} +23 -17
- package/dist/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -0
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +7 -7
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +22 -22
- package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -2
- package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +5 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +15 -2
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultSchema.js +0 -2
- package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js +2 -2
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts +14 -4
- package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/schemaChecker.js +31 -26
- package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +1 -2
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +2 -4
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.d.ts +5 -6
- package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/comparison.js +15 -16
- package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +7 -0
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +1 -0
- package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +1 -0
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +49 -20
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +9 -3
- package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/dist/feature-libraries/object-forest/objectForest.js +2 -3
- package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +3 -0
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeRebaser.d.ts +1 -0
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeRebaser.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeRebaser.js +4 -0
- package/dist/feature-libraries/sequence-field/sequenceFieldChangeRebaser.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/jsonDomainSchema.d.ts +5 -3
- package/dist/jsonDomainSchema.d.ts.map +1 -1
- package/dist/jsonDomainSchema.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts +8 -0
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +23 -11
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/schematizeTree.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/schematizingTreeView.d.ts +0 -1
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +9 -12
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +1 -29
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +20 -6
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +18 -7
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +2 -1
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +32 -0
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js +1 -1
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/simple-tree/api/conciseTree.d.ts +2 -2
- package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/conciseTree.js +6 -6
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +11 -2
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js +5 -1
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/create.d.ts +8 -7
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +33 -23
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +25 -4
- package/dist/simple-tree/api/customTree.d.ts.map +1 -1
- package/dist/simple-tree/api/customTree.js +42 -16
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.d.ts +94 -0
- package/dist/simple-tree/api/discrepancies.d.ts.map +1 -0
- package/dist/simple-tree/api/discrepancies.js +256 -0
- package/dist/simple-tree/api/discrepancies.js.map +1 -0
- package/dist/simple-tree/api/index.d.ts +3 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +3 -2
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +9 -7
- package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +17 -117
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +16 -159
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +4 -47
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +157 -16
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +33 -11
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -3
- package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryRecursive.js +1 -7
- package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts +158 -0
- package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -0
- package/dist/simple-tree/api/schemaStatics.js +59 -0
- package/dist/simple-tree/api/schemaStatics.js.map +1 -0
- package/dist/simple-tree/api/storedSchema.d.ts +5 -3
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js +9 -3
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts +2 -2
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js +16 -4
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/verboseTree.d.ts +2 -2
- package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/dist/simple-tree/api/verboseTree.js +15 -15
- package/dist/simple-tree/api/verboseTree.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +43 -11
- package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js +51 -11
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/context.d.ts +13 -2
- package/dist/simple-tree/core/context.d.ts.map +1 -1
- package/dist/simple-tree/core/context.js +22 -9
- package/dist/simple-tree/core/context.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +6 -4
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +8 -1
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/simpleNodeSchemaBase.d.ts +25 -0
- package/dist/simple-tree/core/simpleNodeSchemaBase.d.ts.map +1 -0
- package/dist/simple-tree/core/simpleNodeSchemaBase.js +7 -0
- package/dist/simple-tree/core/simpleNodeSchemaBase.js.map +1 -0
- package/dist/simple-tree/core/toStored.d.ts +32 -0
- package/dist/simple-tree/core/toStored.d.ts.map +1 -0
- package/dist/simple-tree/core/toStored.js +37 -0
- package/dist/simple-tree/core/toStored.js.map +1 -0
- package/dist/simple-tree/core/treeNodeKernel.d.ts +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js +1 -1
- package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +7 -2
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts +7 -2
- package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.js +19 -4
- package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/core/walkSchema.d.ts +22 -5
- package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/walkSchema.js +6 -2
- package/dist/simple-tree/core/walkSchema.js.map +1 -1
- package/dist/simple-tree/createContext.d.ts +2 -0
- package/dist/simple-tree/createContext.d.ts.map +1 -1
- package/dist/simple-tree/createContext.js +4 -2
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +1 -0
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +2 -1
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +7 -7
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +13 -8
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +1 -0
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +18 -4
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/index.js +1 -2
- package/dist/simple-tree/node-kinds/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +9 -2
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.js +1 -2
- package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts +3 -8
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +41 -44
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +9 -2
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/prepareForInsertion.d.ts +6 -6
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +19 -13
- package/dist/simple-tree/prepareForInsertion.js.map +1 -1
- package/dist/simple-tree/simpleSchema.d.ts +6 -21
- package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
- package/dist/simple-tree/simpleSchema.js.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts +38 -11
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +71 -33
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +2 -2
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/dist/simple-tree/walkFieldSchema.d.ts +1 -0
- package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/walkFieldSchema.js +1 -0
- package/dist/simple-tree/walkFieldSchema.js.map +1 -1
- package/lib/alpha.d.ts +2 -1
- package/lib/codec/codec.d.ts +2 -1
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +4 -3
- package/lib/codec/codec.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +3 -1
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +1 -0
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts +1 -23
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js +2 -2
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
- package/lib/core/tree/detachedFieldIndex.js +2 -3
- package/lib/core/tree/detachedFieldIndex.js.map +1 -1
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +17 -0
- package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecCommon.js +64 -0
- package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +11 -0
- package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecV1.js +51 -0
- package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecV2.d.ts +11 -0
- package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecV2.js +45 -0
- package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts +11 -0
- package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -0
- package/lib/core/tree/detachedFieldIndexCodecs.js +21 -0
- package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -0
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +37 -0
- package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -0
- package/lib/core/tree/{detachedFieldIndexFormat.js → detachedFieldIndexFormatCommon.js} +13 -10
- package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -0
- package/lib/core/tree/detachedFieldIndexFormatV1.d.ts +13 -0
- package/lib/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -0
- package/lib/core/tree/detachedFieldIndexFormatV1.js +9 -0
- package/lib/core/tree/detachedFieldIndexFormatV1.js.map +1 -0
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +14 -0
- package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -0
- package/lib/core/tree/detachedFieldIndexFormatV2.js +11 -0
- package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +9 -9
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +19 -19
- package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +4 -2
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +4 -4
- package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +50 -31
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +70 -57
- package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts +20 -14
- package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/format.js +17 -11
- package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
- package/{dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts → lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts} +20 -14
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.d.ts.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/{nodeShape.js → nodeEncoder.js} +21 -15
- package/lib/feature-libraries/chunked-forest/codec/nodeEncoder.js.map +1 -0
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +7 -7
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +19 -19
- package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +2 -2
- package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +5 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +15 -2
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultSchema.js +0 -2
- package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js +1 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts +14 -4
- package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/schemaChecker.js +29 -24
- package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +1 -2
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -2
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.d.ts +5 -6
- package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/comparison.js +14 -14
- package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +7 -0
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js +1 -0
- package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +1 -0
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +50 -21
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +9 -3
- package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
- package/lib/feature-libraries/object-forest/objectForest.js +3 -4
- package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +3 -0
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeRebaser.d.ts +1 -0
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeRebaser.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeRebaser.js +4 -0
- package/lib/feature-libraries/sequence-field/sequenceFieldChangeRebaser.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/jsonDomainSchema.d.ts +5 -3
- package/lib/jsonDomainSchema.d.ts.map +1 -1
- package/lib/jsonDomainSchema.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts +8 -0
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +21 -10
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/schematizeTree.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/schematizingTreeView.d.ts +0 -1
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +10 -13
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +2 -30
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +20 -6
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +19 -8
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +2 -1
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +33 -1
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js +1 -1
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts +2 -2
- package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/conciseTree.js +6 -6
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +11 -2
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js +6 -2
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/create.d.ts +8 -7
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +35 -25
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +25 -4
- package/lib/simple-tree/api/customTree.d.ts.map +1 -1
- package/lib/simple-tree/api/customTree.js +43 -17
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.d.ts +94 -0
- package/lib/simple-tree/api/discrepancies.d.ts.map +1 -0
- package/lib/simple-tree/api/discrepancies.js +251 -0
- package/lib/simple-tree/api/discrepancies.js.map +1 -0
- package/lib/simple-tree/api/index.d.ts +3 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +2 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +9 -7
- package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js +19 -119
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +16 -159
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +2 -45
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +157 -16
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +23 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -3
- package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryRecursive.js +0 -5
- package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts +158 -0
- package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -0
- package/lib/simple-tree/api/schemaStatics.js +56 -0
- package/lib/simple-tree/api/schemaStatics.js.map +1 -0
- package/lib/simple-tree/api/storedSchema.d.ts +5 -3
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +12 -6
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts +2 -2
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js +14 -2
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/verboseTree.d.ts +2 -2
- package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
- package/lib/simple-tree/api/verboseTree.js +9 -9
- package/lib/simple-tree/api/verboseTree.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +43 -11
- package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/core/allowedTypes.js +52 -11
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/context.d.ts +13 -2
- package/lib/simple-tree/core/context.d.ts.map +1 -1
- package/lib/simple-tree/core/context.js +22 -9
- package/lib/simple-tree/core/context.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +6 -4
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +4 -3
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/simpleNodeSchemaBase.d.ts +25 -0
- package/lib/simple-tree/core/simpleNodeSchemaBase.d.ts.map +1 -0
- package/lib/simple-tree/core/simpleNodeSchemaBase.js +6 -0
- package/lib/simple-tree/core/simpleNodeSchemaBase.js.map +1 -0
- package/lib/simple-tree/core/toStored.d.ts +32 -0
- package/lib/simple-tree/core/toStored.d.ts.map +1 -0
- package/lib/simple-tree/core/toStored.js +32 -0
- package/lib/simple-tree/core/toStored.js.map +1 -0
- package/lib/simple-tree/core/treeNodeKernel.d.ts +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js +1 -1
- package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +7 -2
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts +7 -2
- package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.js +17 -3
- package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/core/walkSchema.d.ts +22 -5
- package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/walkSchema.js +6 -2
- package/lib/simple-tree/core/walkSchema.js.map +1 -1
- package/lib/simple-tree/createContext.d.ts +2 -0
- package/lib/simple-tree/createContext.d.ts.map +1 -1
- package/lib/simple-tree/createContext.js +5 -3
- package/lib/simple-tree/createContext.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +1 -0
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +2 -1
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +7 -7
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +5 -5
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +2 -1
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +21 -7
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/index.js +1 -1
- package/lib/simple-tree/node-kinds/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +12 -5
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.js +1 -1
- package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts +3 -8
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +19 -21
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +12 -5
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/prepareForInsertion.d.ts +6 -6
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +21 -15
- package/lib/simple-tree/prepareForInsertion.js.map +1 -1
- package/lib/simple-tree/simpleSchema.d.ts +6 -21
- package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
- package/lib/simple-tree/simpleSchema.js.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts +38 -11
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +70 -34
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +2 -2
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +1 -1
- package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
- package/lib/simple-tree/walkFieldSchema.d.ts +1 -0
- package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/walkFieldSchema.js +1 -0
- package/lib/simple-tree/walkFieldSchema.js.map +1 -1
- package/package.json +23 -23
- package/src/codec/codec.ts +4 -3
- package/src/core/index.ts +2 -0
- package/src/core/rebase/index.ts +2 -0
- package/src/core/rebase/types.ts +4 -0
- package/src/core/schema-stored/schema.ts +2 -26
- package/src/core/tree/detachedFieldIndex.ts +4 -6
- package/src/core/tree/detachedFieldIndexCodecCommon.ts +87 -0
- package/src/core/tree/{detachedFieldIndexCodec.ts → detachedFieldIndexCodecV1.ts} +22 -68
- package/src/core/tree/detachedFieldIndexCodecV2.ts +72 -0
- package/src/core/tree/detachedFieldIndexCodecs.ts +44 -0
- package/src/core/tree/{detachedFieldIndexFormat.ts → detachedFieldIndexFormatCommon.ts} +32 -23
- package/src/core/tree/detachedFieldIndexFormatV1.ts +15 -0
- package/src/core/tree/detachedFieldIndexFormatV2.ts +17 -0
- package/src/feature-libraries/chunked-forest/codec/README.md +1 -1
- package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +25 -25
- package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +10 -6
- package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +96 -73
- package/src/feature-libraries/chunked-forest/codec/format.ts +20 -14
- package/src/feature-libraries/chunked-forest/codec/{nodeShape.ts → nodeEncoder.ts} +23 -17
- package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +34 -34
- package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +5 -5
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +11 -0
- package/src/feature-libraries/default-schema/defaultSchema.ts +0 -2
- package/src/feature-libraries/default-schema/index.ts +1 -1
- package/src/feature-libraries/default-schema/schemaChecker.ts +47 -30
- package/src/feature-libraries/index.ts +1 -3
- package/src/feature-libraries/modular-schema/comparison.ts +14 -29
- package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +9 -0
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +1 -0
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +61 -19
- package/src/feature-libraries/object-forest/objectForest.ts +10 -6
- package/src/feature-libraries/optional-field/optionalField.ts +4 -0
- package/src/feature-libraries/sequence-field/sequenceFieldChangeRebaser.ts +4 -0
- package/src/index.ts +7 -1
- package/src/jsonDomainSchema.ts +4 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +45 -19
- package/src/shared-tree/schematizeTree.ts +2 -2
- package/src/shared-tree/schematizingTreeView.ts +24 -15
- package/src/shared-tree/sharedTree.ts +2 -42
- package/src/shared-tree/treeAlpha.ts +48 -22
- package/src/shared-tree/treeCheckout.ts +54 -10
- package/src/shared-tree-core/branch.ts +1 -6
- package/src/simple-tree/api/conciseTree.ts +9 -7
- package/src/simple-tree/api/configuration.ts +18 -4
- package/src/simple-tree/api/create.ts +44 -36
- package/src/simple-tree/api/customTree.ts +59 -20
- package/src/simple-tree/api/discrepancies.ts +474 -0
- package/src/simple-tree/api/index.ts +2 -3
- package/src/simple-tree/api/schemaCompatibilityTester.ts +23 -151
- package/src/simple-tree/api/schemaFactory.ts +13 -254
- package/src/simple-tree/api/schemaFactoryAlpha.ts +174 -1
- package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -25
- package/src/simple-tree/api/schemaStatics.ts +291 -0
- package/src/simple-tree/api/storedSchema.ts +18 -14
- package/src/simple-tree/api/treeBeta.ts +24 -4
- package/src/simple-tree/api/verboseTree.ts +17 -8
- package/src/simple-tree/core/allowedTypes.ts +87 -34
- package/src/simple-tree/core/context.ts +24 -22
- package/src/simple-tree/core/index.ts +11 -2
- package/src/simple-tree/core/simpleNodeSchemaBase.ts +30 -0
- package/src/simple-tree/core/toStored.ts +58 -0
- package/src/simple-tree/core/treeNodeKernel.ts +1 -1
- package/src/simple-tree/core/treeNodeSchema.ts +8 -2
- package/src/simple-tree/core/treeNodeValid.ts +23 -4
- package/src/simple-tree/core/walkSchema.ts +26 -6
- package/src/simple-tree/createContext.ts +11 -3
- package/src/simple-tree/fieldSchema.ts +3 -1
- package/src/simple-tree/index.ts +19 -13
- package/src/simple-tree/leafNodeSchema.ts +2 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +64 -23
- package/src/simple-tree/node-kinds/index.ts +0 -1
- package/src/simple-tree/node-kinds/map/mapNode.ts +23 -2
- package/src/simple-tree/node-kinds/object/index.ts +0 -1
- package/src/simple-tree/node-kinds/object/objectNode.ts +42 -30
- package/src/simple-tree/node-kinds/record/recordNode.ts +20 -2
- package/src/simple-tree/prepareForInsertion.ts +28 -15
- package/src/simple-tree/simpleSchema.ts +6 -26
- package/src/simple-tree/toStoredSchema.ts +110 -44
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +6 -2
- package/src/simple-tree/walkFieldSchema.ts +1 -0
- package/dist/core/tree/detachedFieldIndexCodec.d.ts +0 -11
- package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +0 -1
- package/dist/core/tree/detachedFieldIndexCodec.js +0 -100
- package/dist/core/tree/detachedFieldIndexCodec.js.map +0 -1
- package/dist/core/tree/detachedFieldIndexFormat.d.ts +0 -33
- package/dist/core/tree/detachedFieldIndexFormat.d.ts.map +0 -1
- package/dist/core/tree/detachedFieldIndexFormat.js.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +0 -1
- package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +0 -1
- package/dist/feature-libraries/initializeForest.d.ts +0 -18
- package/dist/feature-libraries/initializeForest.d.ts.map +0 -1
- package/dist/feature-libraries/initializeForest.js +0 -35
- package/dist/feature-libraries/initializeForest.js.map +0 -1
- package/dist/simple-tree/discrepancies.d.ts +0 -167
- package/dist/simple-tree/discrepancies.d.ts.map +0 -1
- package/dist/simple-tree/discrepancies.js +0 -382
- package/dist/simple-tree/discrepancies.js.map +0 -1
- package/lib/core/tree/detachedFieldIndexCodec.d.ts +0 -11
- package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +0 -1
- package/lib/core/tree/detachedFieldIndexCodec.js +0 -96
- package/lib/core/tree/detachedFieldIndexCodec.js.map +0 -1
- package/lib/core/tree/detachedFieldIndexFormat.d.ts +0 -33
- package/lib/core/tree/detachedFieldIndexFormat.d.ts.map +0 -1
- package/lib/core/tree/detachedFieldIndexFormat.js.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +0 -1
- package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +0 -1
- package/lib/feature-libraries/initializeForest.d.ts +0 -18
- package/lib/feature-libraries/initializeForest.d.ts.map +0 -1
- package/lib/feature-libraries/initializeForest.js +0 -31
- package/lib/feature-libraries/initializeForest.js.map +0 -1
- package/lib/simple-tree/discrepancies.d.ts +0 -167
- package/lib/simple-tree/discrepancies.d.ts.map +0 -1
- package/lib/simple-tree/discrepancies.js +0 -376
- package/lib/simple-tree/discrepancies.js.map +0 -1
- package/src/feature-libraries/initializeForest.ts +0 -55
- package/src/simple-tree/discrepancies.ts +0 -648
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
FieldKey,
|
|
12
12
|
DetachedField,
|
|
13
13
|
TreeFieldStoredSchema,
|
|
14
|
+
TreeTypeSet,
|
|
14
15
|
} from "../core/index.js";
|
|
15
16
|
import {
|
|
16
17
|
type FlexTreeContext,
|
|
@@ -19,8 +20,9 @@ import {
|
|
|
19
20
|
FieldKinds,
|
|
20
21
|
type FlexibleFieldContent,
|
|
21
22
|
type FlexibleNodeContent,
|
|
23
|
+
throwOutOfSchema,
|
|
22
24
|
} from "../feature-libraries/index.js";
|
|
23
|
-
import {
|
|
25
|
+
import type { ImplicitAnnotatedFieldSchema } from "./fieldSchema.js";
|
|
24
26
|
import {
|
|
25
27
|
type InsertableContent,
|
|
26
28
|
unhydratedFlexTreeFromInsertable,
|
|
@@ -29,13 +31,20 @@ import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
|
29
31
|
import { brand } from "../util/index.js";
|
|
30
32
|
import {
|
|
31
33
|
getKernel,
|
|
32
|
-
type
|
|
34
|
+
type ImplicitAnnotatedAllowedTypes,
|
|
33
35
|
type TreeNode,
|
|
34
36
|
type UnhydratedFlexTreeNode,
|
|
35
37
|
} from "./core/index.js";
|
|
36
38
|
import { debugAssert, oob } from "@fluidframework/core-utils/internal";
|
|
37
|
-
import {
|
|
38
|
-
|
|
39
|
+
import { isFieldInSchema } from "../feature-libraries/index.js";
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* For now, schema validation for inserted content is always enabled.
|
|
43
|
+
* @remarks
|
|
44
|
+
* If this ends up being too much of a performance overhead, AND nothing depends on it (like staged allowed types likely will),
|
|
45
|
+
* this could be changed.
|
|
46
|
+
*/
|
|
47
|
+
const validateSchema = true;
|
|
39
48
|
|
|
40
49
|
/**
|
|
41
50
|
* Prepare content from a user for insertion into a tree.
|
|
@@ -47,14 +56,16 @@ import { convertField } from "./toStoredSchema.js";
|
|
|
47
56
|
*/
|
|
48
57
|
export function prepareForInsertion<TIn extends InsertableContent | undefined>(
|
|
49
58
|
data: TIn,
|
|
50
|
-
schema:
|
|
59
|
+
schema: ImplicitAnnotatedFieldSchema,
|
|
51
60
|
destinationContext: FlexTreeContext,
|
|
61
|
+
destinationSchema: TreeFieldStoredSchema,
|
|
52
62
|
): TIn extends undefined ? undefined : FlexibleNodeContent {
|
|
53
63
|
return prepareForInsertionContextless(
|
|
54
64
|
data,
|
|
55
65
|
schema,
|
|
56
66
|
getSchemaAndPolicy(destinationContext),
|
|
57
67
|
destinationContext.isHydrated() ? destinationContext : undefined,
|
|
68
|
+
destinationSchema,
|
|
58
69
|
);
|
|
59
70
|
}
|
|
60
71
|
|
|
@@ -73,21 +84,20 @@ export function prepareForInsertion<TIn extends InsertableContent | undefined>(
|
|
|
73
84
|
*/
|
|
74
85
|
export function prepareArrayContentForInsertion(
|
|
75
86
|
data: readonly InsertableContent[],
|
|
76
|
-
schema:
|
|
87
|
+
schema: ImplicitAnnotatedAllowedTypes,
|
|
77
88
|
destinationContext: FlexTreeContext,
|
|
89
|
+
destinationSchema: TreeTypeSet,
|
|
78
90
|
): FlexibleFieldContent {
|
|
79
91
|
const mapTrees: UnhydratedFlexTreeNode[] = data.map((item) =>
|
|
80
92
|
unhydratedFlexTreeFromInsertable(item, schema),
|
|
81
93
|
);
|
|
82
94
|
|
|
83
|
-
const fieldSchema = convertField(normalizeFieldSchema(schema));
|
|
84
|
-
|
|
85
95
|
validateAndPrepare(
|
|
86
96
|
getSchemaAndPolicy(destinationContext),
|
|
87
97
|
destinationContext.isHydrated() ? destinationContext : undefined,
|
|
88
98
|
{
|
|
89
99
|
kind: FieldKinds.sequence.identifier,
|
|
90
|
-
types:
|
|
100
|
+
types: destinationSchema,
|
|
91
101
|
persistedMetadata: undefined,
|
|
92
102
|
},
|
|
93
103
|
mapTrees,
|
|
@@ -107,15 +117,15 @@ export function prepareArrayContentForInsertion(
|
|
|
107
117
|
*/
|
|
108
118
|
export function prepareForInsertionContextless<TIn extends InsertableContent | undefined>(
|
|
109
119
|
data: TIn,
|
|
110
|
-
schema:
|
|
120
|
+
schema: ImplicitAnnotatedFieldSchema,
|
|
111
121
|
schemaAndPolicy: SchemaAndPolicy,
|
|
112
122
|
hydratedData: FlexTreeHydratedContextMinimal | undefined,
|
|
123
|
+
destinationSchema: TreeFieldStoredSchema,
|
|
113
124
|
): TIn extends undefined ? undefined : FlexibleNodeContent {
|
|
114
125
|
const mapTree = unhydratedFlexTreeFromInsertable(data, schema);
|
|
115
126
|
|
|
116
127
|
const contentArray = mapTree === undefined ? [] : [mapTree];
|
|
117
|
-
|
|
118
|
-
validateAndPrepare(schemaAndPolicy, hydratedData, fieldSchema, contentArray);
|
|
128
|
+
validateAndPrepare(schemaAndPolicy, hydratedData, destinationSchema, contentArray);
|
|
119
129
|
|
|
120
130
|
return mapTree;
|
|
121
131
|
}
|
|
@@ -137,9 +147,12 @@ function validateAndPrepare(
|
|
|
137
147
|
// This ensures that when `isFieldInSchema` requests identifiers (or any other contextual defaults),
|
|
138
148
|
// they were already creating used the more specific context we have access to from `hydratedData`.
|
|
139
149
|
prepareContentForHydration(mapTrees, hydratedData.checkout.forest, hydratedData);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
150
|
+
// TODO: AB#45723
|
|
151
|
+
// Now that staged schema rely on this validation, its a bit odd we don't do it for insertion into unhydrated contexts.
|
|
152
|
+
// We can't simply enable it for them however due to contextual default fields which would not have been created yet (see comment above).
|
|
153
|
+
// Specifically at least clone can result in unhydrated trees which can end up violating their stored schema (but not view schema) just using the type safe APIs.
|
|
154
|
+
if (validateSchema === true) {
|
|
155
|
+
isFieldInSchema(mapTrees, fieldSchema, schemaAndPolicy, throwOutOfSchema);
|
|
143
156
|
}
|
|
144
157
|
}
|
|
145
158
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { ValueSchema } from "../core/index.js";
|
|
7
7
|
import type { JsonCompatibleReadOnlyObject } from "../util/index.js";
|
|
8
|
-
import type { NodeKind,
|
|
8
|
+
import type { NodeKind, SimpleNodeSchemaBase } from "./core/index.js";
|
|
9
9
|
import type { FieldKind, FieldSchemaMetadata } from "./fieldSchema.js";
|
|
10
10
|
|
|
11
11
|
/*
|
|
@@ -13,30 +13,6 @@ import type { FieldKind, FieldSchemaMetadata } from "./fieldSchema.js";
|
|
|
13
13
|
* - Customize their JSON serialization to use these formats or provide some other serialization scheme.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* Base interface for {@link TreeNodeSchema} and {@link SimpleNodeSchema} types.
|
|
18
|
-
* Once simple schema is stable this doesn't have a reason to be kept `@system`, but it could be.
|
|
19
|
-
* @system
|
|
20
|
-
* @public
|
|
21
|
-
* @sealed
|
|
22
|
-
*/
|
|
23
|
-
export interface SimpleNodeSchemaBase<
|
|
24
|
-
out TNodeKind extends NodeKind,
|
|
25
|
-
out TCustomMetadata = unknown,
|
|
26
|
-
> {
|
|
27
|
-
/**
|
|
28
|
-
* The {@link NodeKind}.
|
|
29
|
-
*
|
|
30
|
-
* @remarks can be used to type-switch between implementations.
|
|
31
|
-
*/
|
|
32
|
-
readonly kind: TNodeKind;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* User-provided {@link NodeSchemaMetadata} for this schema.
|
|
36
|
-
*/
|
|
37
|
-
readonly metadata: NodeSchemaMetadata<TCustomMetadata>;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
16
|
/**
|
|
41
17
|
* A {@link SimpleNodeSchema} containing fields for alpha features.
|
|
42
18
|
*
|
|
@@ -230,7 +206,11 @@ export interface SimpleTreeSchema {
|
|
|
230
206
|
/**
|
|
231
207
|
* The complete set of node schema definitions recursively referenced by the tree's {@link SimpleTreeSchema.root}.
|
|
232
208
|
*
|
|
233
|
-
* @remarks
|
|
209
|
+
* @remarks
|
|
210
|
+
* The keys are the schemas' {@link TreeNodeSchemaCore.identifier | identifiers}.
|
|
211
|
+
*
|
|
212
|
+
* Information about if a schema is {@link SchemaStaticsAlpha.staged | staged} or not is not available as the "Simple Schema" layer of abstraction: they are included unconditionally.
|
|
213
|
+
* Options for filtering out staged schemas from view schema are available in {@link extractPersistedSchema}.
|
|
234
214
|
*/
|
|
235
215
|
readonly definitions: ReadonlyMap<string, SimpleNodeSchema>;
|
|
236
216
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { unreachableCase, fail } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
|
|
9
9
|
import {
|
|
@@ -20,27 +20,81 @@ import {
|
|
|
20
20
|
type TreeTypeSet,
|
|
21
21
|
} from "../core/index.js";
|
|
22
22
|
import { FieldKinds, type FlexFieldKind } from "../feature-libraries/index.js";
|
|
23
|
-
import { brand, getOrCreate } from "../util/index.js";
|
|
23
|
+
import { brand, getOrCreate, type JsonCompatibleReadOnlyObject } from "../util/index.js";
|
|
24
24
|
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
import {
|
|
26
|
+
allowedTypeFilter,
|
|
27
|
+
convertAllowedTypes,
|
|
28
|
+
getTreeNodeSchemaPrivateData,
|
|
29
|
+
isClassBasedSchema,
|
|
30
|
+
NodeKind,
|
|
31
|
+
type SimpleNodeSchemaBase,
|
|
32
|
+
type StoredSchemaGenerationOptions,
|
|
33
|
+
} from "./core/index.js";
|
|
34
|
+
import {
|
|
35
|
+
FieldKind,
|
|
36
|
+
FieldSchemaAlpha,
|
|
37
|
+
normalizeFieldSchema,
|
|
38
|
+
type ImplicitAnnotatedFieldSchema,
|
|
39
|
+
type ImplicitFieldSchema,
|
|
40
|
+
} from "./fieldSchema.js";
|
|
41
|
+
import type { SimpleFieldSchema, SimpleNodeSchema } from "./simpleSchema.js";
|
|
33
42
|
import { walkFieldSchema } from "./walkFieldSchema.js";
|
|
34
43
|
|
|
35
|
-
const viewToStoredCache = new WeakMap<
|
|
44
|
+
const viewToStoredCache = new WeakMap<
|
|
45
|
+
StoredSchemaGenerationOptions,
|
|
46
|
+
WeakMap<ImplicitFieldSchema, TreeStoredSchema>
|
|
47
|
+
>();
|
|
48
|
+
|
|
49
|
+
export const restrictiveStoredSchemaGenerationOptions: StoredSchemaGenerationOptions = {
|
|
50
|
+
includeStaged: () => false,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const permissiveStoredSchemaGenerationOptions: StoredSchemaGenerationOptions = {
|
|
54
|
+
includeStaged: () => true,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Converts a {@link ImplicitAnnotatedFieldSchema} into a {@link TreeStoredSchema} for use in schema upgrades.
|
|
59
|
+
*
|
|
60
|
+
* TODO: once upgrades are more flexible, this should take in more options, including the old schema and specific upgrades to enable.
|
|
61
|
+
*/
|
|
62
|
+
export function toUpgradeSchema(root: ImplicitAnnotatedFieldSchema): TreeStoredSchema {
|
|
63
|
+
return toStoredSchema(root, restrictiveStoredSchemaGenerationOptions);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Converts a {@link ImplicitAnnotatedFieldSchema} into a {@link TreeStoredSchema} for use as initial document schema.
|
|
68
|
+
*/
|
|
69
|
+
export function toInitialSchema(root: ImplicitAnnotatedFieldSchema): TreeStoredSchema {
|
|
70
|
+
return toStoredSchema(root, restrictiveStoredSchemaGenerationOptions);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Converts a {@link ImplicitAnnotatedFieldSchema} into a {@link TreeStoredSchema} to used for unhydrated nodes.
|
|
75
|
+
* @remarks
|
|
76
|
+
* This allows as much as possible, relying on further validation when inserting the content.
|
|
77
|
+
*
|
|
78
|
+
* TODO: this should get additional options to enable support for unknown optional fields.
|
|
79
|
+
*/
|
|
80
|
+
export const toUnhydratedSchema = permissiveStoredSchemaGenerationOptions;
|
|
36
81
|
|
|
37
82
|
/**
|
|
38
|
-
* Converts a {@link
|
|
83
|
+
* Converts a {@link ImplicitAnnotatedFieldSchema} into a {@link TreeStoredSchema}.
|
|
84
|
+
*
|
|
85
|
+
* @privateRemarks
|
|
86
|
+
* TODO:#38722 When runtime schema upgrades are implemented, this will need to be updated to check if
|
|
87
|
+
* a staged allowed type has been upgraded and if so, include it in the conversion.
|
|
88
|
+
*
|
|
39
89
|
* @throws
|
|
40
90
|
* Throws a `UsageError` if multiple schemas are encountered with the same identifier.
|
|
41
91
|
*/
|
|
42
|
-
export function toStoredSchema(
|
|
43
|
-
|
|
92
|
+
export function toStoredSchema(
|
|
93
|
+
root: ImplicitAnnotatedFieldSchema,
|
|
94
|
+
options: StoredSchemaGenerationOptions,
|
|
95
|
+
): TreeStoredSchema {
|
|
96
|
+
const cache = getOrCreate(viewToStoredCache, options, () => new WeakMap());
|
|
97
|
+
return getOrCreate(cache, root, () => {
|
|
44
98
|
const normalized = normalizeFieldSchema(root);
|
|
45
99
|
const nodeSchema: Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema> = new Map();
|
|
46
100
|
walkFieldSchema(normalized, {
|
|
@@ -55,42 +109,39 @@ export function toStoredSchema(root: ImplicitFieldSchema): TreeStoredSchema {
|
|
|
55
109
|
}
|
|
56
110
|
nodeSchema.set(
|
|
57
111
|
brand(schema.identifier),
|
|
58
|
-
getStoredSchema(
|
|
112
|
+
getStoredSchema(
|
|
113
|
+
schema as SimpleNodeSchemaBase<NodeKind> as SimpleNodeSchema,
|
|
114
|
+
options,
|
|
115
|
+
),
|
|
59
116
|
);
|
|
60
117
|
},
|
|
118
|
+
allowedTypeFilter: (allowedType) => allowedTypeFilter(allowedType, options),
|
|
61
119
|
});
|
|
62
120
|
|
|
63
121
|
const result: TreeStoredSchema = {
|
|
64
122
|
nodeSchema,
|
|
65
|
-
rootFieldSchema: convertField(normalized),
|
|
123
|
+
rootFieldSchema: convertField(normalized, options),
|
|
66
124
|
};
|
|
67
125
|
return result;
|
|
68
126
|
});
|
|
69
127
|
}
|
|
70
128
|
|
|
71
|
-
/**
|
|
72
|
-
* Converts a {@link SimpleTreeSchema} into a {@link TreeStoredSchema}.
|
|
73
|
-
*/
|
|
74
|
-
export function simpleToStoredSchema(root: SimpleTreeSchema): TreeStoredSchema {
|
|
75
|
-
const nodeSchema: Map<TreeNodeSchemaIdentifier, TreeNodeStoredSchema> = new Map();
|
|
76
|
-
for (const [identifier, schema] of root.definitions) {
|
|
77
|
-
nodeSchema.set(brand(identifier), getStoredSchema(schema));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const result: TreeStoredSchema = {
|
|
81
|
-
nodeSchema,
|
|
82
|
-
rootFieldSchema: convertField(root.root),
|
|
83
|
-
};
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
129
|
/**
|
|
88
130
|
* Normalizes an {@link ImplicitFieldSchema} into a {@link TreeFieldSchema}.
|
|
89
131
|
*/
|
|
90
|
-
export function convertField(
|
|
132
|
+
export function convertField(
|
|
133
|
+
schema: SimpleFieldSchema | FieldSchemaAlpha,
|
|
134
|
+
options: StoredSchemaGenerationOptions,
|
|
135
|
+
): TreeFieldStoredSchema {
|
|
91
136
|
const kind: FieldKindIdentifier =
|
|
92
137
|
convertFieldKind.get(schema.kind)?.identifier ?? fail(0xae3 /* Invalid field kind */);
|
|
93
|
-
|
|
138
|
+
let types: TreeTypeSet;
|
|
139
|
+
// eslint-disable-next-line unicorn/prefer-ternary
|
|
140
|
+
if (schema instanceof FieldSchemaAlpha) {
|
|
141
|
+
types = convertAllowedTypes(schema.annotatedAllowedTypesNormalized, options);
|
|
142
|
+
} else {
|
|
143
|
+
types = schema.allowedTypesIdentifiers as TreeTypeSet;
|
|
144
|
+
}
|
|
94
145
|
return { kind, types, persistedMetadata: schema.persistedMetadata };
|
|
95
146
|
}
|
|
96
147
|
|
|
@@ -110,12 +161,20 @@ export const convertFieldKind: ReadonlyMap<FieldKind, FlexFieldKind> = new Map<
|
|
|
110
161
|
* Converts a {@link TreeNodeSchema} into a {@link TreeNodeStoredSchema}.
|
|
111
162
|
* @privateRemarks
|
|
112
163
|
* TODO: Persist node metadata once schema FormatV2 is supported.
|
|
164
|
+
*
|
|
165
|
+
* TODO: AB#43548: Using a stored schema for unhydrated flex trees does not handle schema evolution features like "allowUnknownOptionalFields".
|
|
166
|
+
* Usage of this and the conversion which wrap it should be audited and reduced.
|
|
113
167
|
*/
|
|
114
|
-
export function getStoredSchema(
|
|
168
|
+
export function getStoredSchema(
|
|
169
|
+
schema: SimpleNodeSchema,
|
|
170
|
+
options: StoredSchemaGenerationOptions,
|
|
171
|
+
): TreeNodeStoredSchema {
|
|
172
|
+
if (isClassBasedSchema(schema)) {
|
|
173
|
+
return getTreeNodeSchemaPrivateData(schema).toStored(options);
|
|
174
|
+
}
|
|
115
175
|
const kind = schema.kind;
|
|
116
176
|
switch (kind) {
|
|
117
177
|
case NodeKind.Leaf: {
|
|
118
|
-
assert(schema.kind === NodeKind.Leaf, 0xa4a /* invalid kind */);
|
|
119
178
|
return new LeafNodeStoredSchema(schema.leafKind);
|
|
120
179
|
}
|
|
121
180
|
case NodeKind.Map:
|
|
@@ -133,18 +192,12 @@ export function getStoredSchema(schema: SimpleNodeSchema): TreeNodeStoredSchema
|
|
|
133
192
|
}
|
|
134
193
|
case NodeKind.Array: {
|
|
135
194
|
const types = schema.allowedTypesIdentifiers as TreeTypeSet;
|
|
136
|
-
|
|
137
|
-
kind: FieldKinds.sequence.identifier,
|
|
138
|
-
types,
|
|
139
|
-
persistedMetadata: schema.persistedMetadata,
|
|
140
|
-
};
|
|
141
|
-
const fields = new Map([[EmptyKey, field]]);
|
|
142
|
-
return new ObjectNodeStoredSchema(fields, schema.persistedMetadata);
|
|
195
|
+
return arrayNodeStoredSchema(types, schema.persistedMetadata);
|
|
143
196
|
}
|
|
144
197
|
case NodeKind.Object: {
|
|
145
198
|
const fields: Map<FieldKey, TreeFieldStoredSchema> = new Map();
|
|
146
199
|
for (const fieldSchema of schema.fields.values()) {
|
|
147
|
-
fields.set(brand(fieldSchema.storedKey), convertField(fieldSchema));
|
|
200
|
+
fields.set(brand(fieldSchema.storedKey), convertField(fieldSchema, options));
|
|
148
201
|
}
|
|
149
202
|
return new ObjectNodeStoredSchema(fields, schema.persistedMetadata);
|
|
150
203
|
}
|
|
@@ -153,3 +206,16 @@ export function getStoredSchema(schema: SimpleNodeSchema): TreeNodeStoredSchema
|
|
|
153
206
|
}
|
|
154
207
|
}
|
|
155
208
|
}
|
|
209
|
+
|
|
210
|
+
export function arrayNodeStoredSchema(
|
|
211
|
+
types: TreeTypeSet,
|
|
212
|
+
persistedMetadata: JsonCompatibleReadOnlyObject | undefined,
|
|
213
|
+
): ObjectNodeStoredSchema {
|
|
214
|
+
const field = {
|
|
215
|
+
kind: FieldKinds.sequence.identifier,
|
|
216
|
+
types,
|
|
217
|
+
persistedMetadata,
|
|
218
|
+
};
|
|
219
|
+
const fields = new Map([[EmptyKey, field]]);
|
|
220
|
+
return new ObjectNodeStoredSchema(fields, persistedMetadata);
|
|
221
|
+
}
|
|
@@ -9,7 +9,11 @@ import { assert } from "@fluidframework/core-utils/internal";
|
|
|
9
9
|
|
|
10
10
|
import { hasSingle } from "../util/index.js";
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
normalizeFieldSchema,
|
|
14
|
+
FieldKind,
|
|
15
|
+
type ImplicitAnnotatedFieldSchema,
|
|
16
|
+
} from "./fieldSchema.js";
|
|
13
17
|
import {
|
|
14
18
|
CompatibilityLevel,
|
|
15
19
|
getKernel,
|
|
@@ -50,7 +54,7 @@ import { getUnhydratedContext } from "./createContext.js";
|
|
|
50
54
|
*/
|
|
51
55
|
export function unhydratedFlexTreeFromInsertable<TIn extends InsertableContent | undefined>(
|
|
52
56
|
data: TIn,
|
|
53
|
-
allowedTypes:
|
|
57
|
+
allowedTypes: ImplicitAnnotatedFieldSchema,
|
|
54
58
|
): TIn extends undefined ? undefined : UnhydratedFlexTreeNode {
|
|
55
59
|
const normalizedFieldSchema = normalizeFieldSchema(allowedTypes);
|
|
56
60
|
|
|
@@ -8,6 +8,7 @@ import { type ImplicitFieldSchema, normalizeFieldSchema } from "./fieldSchema.js
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Traverses all {@link TreeNodeSchema} schema reachable from `schema`, applying the visitor pattern.
|
|
11
|
+
* @internal
|
|
11
12
|
*/
|
|
12
13
|
export function walkFieldSchema(
|
|
13
14
|
schema: ImplicitFieldSchema,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
6
|
-
import { type ICodecOptions, type IJsonCodec } from "../../codec/index.js";
|
|
7
|
-
import type { RevisionTagCodec } from "../rebase/index.js";
|
|
8
|
-
import { Format } from "./detachedFieldIndexFormat.js";
|
|
9
|
-
import type { DetachedFieldSummaryData } from "./detachedFieldIndexTypes.js";
|
|
10
|
-
export declare function makeDetachedNodeToFieldCodec(revisionTagCodec: RevisionTagCodec, options: ICodecOptions, idCompressor: IIdCompressor): IJsonCodec<DetachedFieldSummaryData, Format>;
|
|
11
|
-
//# sourceMappingURL=detachedFieldIndexCodec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detachedFieldIndexCodec.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAsB,gBAAgB,EAAe,MAAM,oBAAoB,CAAC;AAE5F,OAAO,EAEN,MAAM,EAGN,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAEX,wBAAwB,EAExB,MAAM,8BAA8B,CAAC;AA6CtC,wBAAgB,4BAA4B,CAC3C,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,aAAa,EACtB,YAAY,EAAE,aAAa,GACzB,UAAU,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAkD9C"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.makeDetachedNodeToFieldCodec = void 0;
|
|
8
|
-
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
-
const index_js_1 = require("../../codec/index.js");
|
|
10
|
-
const index_js_2 = require("../../util/index.js");
|
|
11
|
-
const detachedFieldIndexFormat_js_1 = require("./detachedFieldIndexFormat.js");
|
|
12
|
-
class MajorCodec {
|
|
13
|
-
constructor(revisionTagCodec, options, idCompressor) {
|
|
14
|
-
this.revisionTagCodec = revisionTagCodec;
|
|
15
|
-
this.options = options;
|
|
16
|
-
this.idCompressor = idCompressor;
|
|
17
|
-
}
|
|
18
|
-
encode(major) {
|
|
19
|
-
(0, internal_1.assert)(major !== undefined, 0x88e /* Unexpected undefined revision */);
|
|
20
|
-
const id = this.revisionTagCodec.encode(major);
|
|
21
|
-
/**
|
|
22
|
-
* Preface: this codec is only used at summarization time (not for ops).
|
|
23
|
-
* Note that the decode path must provide a session id in which to interpret the revision tag.
|
|
24
|
-
* The revision associated with a detached root generally comes from the session which detaches that subtree,
|
|
25
|
-
* which isn't generally the local session (nor is it available at decode time with the layering of the tree
|
|
26
|
-
* package), despite decode using the local session id.
|
|
27
|
-
*
|
|
28
|
-
* This is made OK by enforcing that all ids on encode/decode are non-local, since local ids won't be interpretable
|
|
29
|
-
* at decode time.
|
|
30
|
-
* This assert is valid because the revision for an acked edit will have already been finalized, and a revision
|
|
31
|
-
* for a local-only edit will be finalizable at summarization time (local edits can only occur on a summarizing client
|
|
32
|
-
* if they're created while detached, and local ids made while detached are finalized before generating the attach summary).
|
|
33
|
-
*/
|
|
34
|
-
(0, internal_1.assert)(id === "root" || id >= 0, 0x88f /* Expected final id on encode of detached field index revision */);
|
|
35
|
-
return id;
|
|
36
|
-
}
|
|
37
|
-
decode(major) {
|
|
38
|
-
(0, internal_1.assert)(major === "root" || major >= 0, 0x890 /* Expected final id on decode of detached field index revision */);
|
|
39
|
-
return this.revisionTagCodec.decode(major, {
|
|
40
|
-
originatorId: this.revisionTagCodec.localSessionId,
|
|
41
|
-
idCompressor: this.idCompressor,
|
|
42
|
-
revision: undefined,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function makeDetachedNodeToFieldCodec(revisionTagCodec, options, idCompressor) {
|
|
47
|
-
const majorCodec = new MajorCodec(revisionTagCodec, options, idCompressor);
|
|
48
|
-
return (0, index_js_1.makeVersionedValidatedCodec)(options, new Set([detachedFieldIndexFormat_js_1.version]), detachedFieldIndexFormat_js_1.Format, {
|
|
49
|
-
encode: (data) => {
|
|
50
|
-
const rootsForRevisions = [];
|
|
51
|
-
for (const [major, innerMap] of data.data) {
|
|
52
|
-
const encodedRevision = majorCodec.encode(major);
|
|
53
|
-
const rootRanges = [];
|
|
54
|
-
for (const [minor, detachedField] of innerMap) {
|
|
55
|
-
rootRanges.push([minor, detachedField.root]);
|
|
56
|
-
}
|
|
57
|
-
if ((0, index_js_2.hasSingle)(rootRanges)) {
|
|
58
|
-
const firstRootRange = rootRanges[0];
|
|
59
|
-
const rootsForRevision = [
|
|
60
|
-
encodedRevision,
|
|
61
|
-
firstRootRange[0],
|
|
62
|
-
firstRootRange[1],
|
|
63
|
-
];
|
|
64
|
-
rootsForRevisions.push(rootsForRevision);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
const rootsForRevision = [encodedRevision, rootRanges];
|
|
68
|
-
rootsForRevisions.push(rootsForRevision);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
const encoded = {
|
|
72
|
-
version: detachedFieldIndexFormat_js_1.version,
|
|
73
|
-
data: rootsForRevisions,
|
|
74
|
-
maxId: data.maxId,
|
|
75
|
-
};
|
|
76
|
-
return encoded;
|
|
77
|
-
},
|
|
78
|
-
decode: (parsed) => {
|
|
79
|
-
const map = new Map();
|
|
80
|
-
for (const rootsForRevision of parsed.data) {
|
|
81
|
-
const innerMap = new Map();
|
|
82
|
-
if (rootsForRevision.length === 2) {
|
|
83
|
-
for (const [minor, root] of rootsForRevision[1]) {
|
|
84
|
-
innerMap.set(minor, { root });
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
innerMap.set(rootsForRevision[1], { root: rootsForRevision[2] });
|
|
89
|
-
}
|
|
90
|
-
map.set(majorCodec.decode(rootsForRevision[0]), innerMap);
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
data: map,
|
|
94
|
-
maxId: parsed.maxId,
|
|
95
|
-
};
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
exports.makeDetachedNodeToFieldCodec = makeDetachedNodeToFieldCodec;
|
|
100
|
-
//# sourceMappingURL=detachedFieldIndexCodec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detachedFieldIndexCodec.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexCodec.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\n\nimport {\n\ttype ICodecOptions,\n\ttype IJsonCodec,\n\tmakeVersionedValidatedCodec,\n} from \"../../codec/index.js\";\nimport { hasSingle } from \"../../util/index.js\";\nimport type { EncodedRevisionTag, RevisionTagCodec, RevisionTag } from \"../rebase/index.js\";\n\nimport {\n\ttype EncodedRootsForRevision,\n\tFormat,\n\ttype RootRanges,\n\tversion,\n} from \"./detachedFieldIndexFormat.js\";\nimport type {\n\tDetachedField,\n\tDetachedFieldSummaryData,\n\tMajor,\n} from \"./detachedFieldIndexTypes.js\";\n\nclass MajorCodec implements IJsonCodec<Major> {\n\tpublic constructor(\n\t\tprivate readonly revisionTagCodec: RevisionTagCodec,\n\t\tprivate readonly options: ICodecOptions,\n\t\tprivate readonly idCompressor: IIdCompressor,\n\t) {}\n\n\tpublic encode(major: Major): EncodedRevisionTag {\n\t\tassert(major !== undefined, 0x88e /* Unexpected undefined revision */);\n\t\tconst id = this.revisionTagCodec.encode(major);\n\t\t/**\n\t\t * Preface: this codec is only used at summarization time (not for ops).\n\t\t * Note that the decode path must provide a session id in which to interpret the revision tag.\n\t\t * The revision associated with a detached root generally comes from the session which detaches that subtree,\n\t\t * which isn't generally the local session (nor is it available at decode time with the layering of the tree\n\t\t * package), despite decode using the local session id.\n\t\t *\n\t\t * This is made OK by enforcing that all ids on encode/decode are non-local, since local ids won't be interpretable\n\t\t * at decode time.\n\t\t * This assert is valid because the revision for an acked edit will have already been finalized, and a revision\n\t\t * for a local-only edit will be finalizable at summarization time (local edits can only occur on a summarizing client\n\t\t * if they're created while detached, and local ids made while detached are finalized before generating the attach summary).\n\t\t */\n\t\tassert(\n\t\t\tid === \"root\" || id >= 0,\n\t\t\t0x88f /* Expected final id on encode of detached field index revision */,\n\t\t);\n\t\treturn id;\n\t}\n\n\tpublic decode(major: EncodedRevisionTag): RevisionTag {\n\t\tassert(\n\t\t\tmajor === \"root\" || major >= 0,\n\t\t\t0x890 /* Expected final id on decode of detached field index revision */,\n\t\t);\n\t\treturn this.revisionTagCodec.decode(major, {\n\t\t\toriginatorId: this.revisionTagCodec.localSessionId,\n\t\t\tidCompressor: this.idCompressor,\n\t\t\trevision: undefined,\n\t\t});\n\t}\n}\n\nexport function makeDetachedNodeToFieldCodec(\n\trevisionTagCodec: RevisionTagCodec,\n\toptions: ICodecOptions,\n\tidCompressor: IIdCompressor,\n): IJsonCodec<DetachedFieldSummaryData, Format> {\n\tconst majorCodec = new MajorCodec(revisionTagCodec, options, idCompressor);\n\treturn makeVersionedValidatedCodec(options, new Set([version]), Format, {\n\t\tencode: (data: DetachedFieldSummaryData): Format => {\n\t\t\tconst rootsForRevisions: EncodedRootsForRevision[] = [];\n\t\t\tfor (const [major, innerMap] of data.data) {\n\t\t\t\tconst encodedRevision = majorCodec.encode(major);\n\t\t\t\tconst rootRanges: RootRanges = [];\n\t\t\t\tfor (const [minor, detachedField] of innerMap) {\n\t\t\t\t\trootRanges.push([minor, detachedField.root]);\n\t\t\t\t}\n\t\t\t\tif (hasSingle(rootRanges)) {\n\t\t\t\t\tconst firstRootRange = rootRanges[0];\n\t\t\t\t\tconst rootsForRevision: EncodedRootsForRevision = [\n\t\t\t\t\t\tencodedRevision,\n\t\t\t\t\t\tfirstRootRange[0],\n\t\t\t\t\t\tfirstRootRange[1],\n\t\t\t\t\t];\n\t\t\t\t\trootsForRevisions.push(rootsForRevision);\n\t\t\t\t} else {\n\t\t\t\t\tconst rootsForRevision: EncodedRootsForRevision = [encodedRevision, rootRanges];\n\t\t\t\t\trootsForRevisions.push(rootsForRevision);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst encoded: Format = {\n\t\t\t\tversion,\n\t\t\t\tdata: rootsForRevisions,\n\t\t\t\tmaxId: data.maxId,\n\t\t\t};\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (parsed: Format): DetachedFieldSummaryData => {\n\t\t\tconst map = new Map();\n\t\t\tfor (const rootsForRevision of parsed.data) {\n\t\t\t\tconst innerMap = new Map<number, DetachedField>();\n\t\t\t\tif (rootsForRevision.length === 2) {\n\t\t\t\t\tfor (const [minor, root] of rootsForRevision[1]) {\n\t\t\t\t\t\tinnerMap.set(minor, { root });\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tinnerMap.set(rootsForRevision[1], { root: rootsForRevision[2] });\n\t\t\t\t}\n\t\t\t\tmap.set(majorCodec.decode(rootsForRevision[0]), innerMap);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdata: map,\n\t\t\t\tmaxId: parsed.maxId,\n\t\t\t};\n\t\t},\n\t});\n}\n"]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { type Static } from "@sinclair/typebox";
|
|
6
|
-
import type { ForestRootId } from "./detachedFieldIndexTypes.js";
|
|
7
|
-
export declare const version = 1;
|
|
8
|
-
/**
|
|
9
|
-
* The ID of a detached node. Is not globally unique on.
|
|
10
|
-
* A `RevisionTag` + `DetachId` pair is globally unique and eventually consistent across clients.
|
|
11
|
-
*/
|
|
12
|
-
export declare const DetachId: import("@sinclair/typebox").TNumber;
|
|
13
|
-
/**
|
|
14
|
-
* A mapping from a range of the detached node IDs the corresponding range root IDs.
|
|
15
|
-
* The detached node IDs need to be qualified with a revision (stored in the containing `EncodedRootsForRevision`).
|
|
16
|
-
* Note: the length of the range (currently always 1) can be looked up in the forest.
|
|
17
|
-
*/
|
|
18
|
-
export declare const RootRange: import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<ForestRootId>]>;
|
|
19
|
-
export type RootRange = Static<typeof RootRange>;
|
|
20
|
-
export declare const RootRanges: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<ForestRootId>]>>;
|
|
21
|
-
export type RootRanges = Static<typeof RootRanges>;
|
|
22
|
-
/**
|
|
23
|
-
* For all the roots detached in a revision, represents a mapping from the detached node ID to corresponding root ID.
|
|
24
|
-
*/
|
|
25
|
-
export declare const EncodedRootsForRevision: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<import("../../util/brand.js").Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<ForestRootId>]>>]>, import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<import("../../util/brand.js").Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<ForestRootId>]>]>;
|
|
26
|
-
export type EncodedRootsForRevision = Static<typeof EncodedRootsForRevision>;
|
|
27
|
-
export declare const Format: import("@sinclair/typebox").TObject<{
|
|
28
|
-
version: import("@sinclair/typebox").TLiteral<1>;
|
|
29
|
-
data: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<import("../../util/brand.js").Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<ForestRootId>]>>]>, import("@sinclair/typebox").TTuple<[import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"root">, import("@sinclair/typebox").TUnsafe<import("../../util/brand.js").Brand<import("@fluidframework/id-compressor").OpSpaceCompressedId, "EncodedRevisionTag">>]>, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TUnsafe<ForestRootId>]>]>>;
|
|
30
|
-
maxId: import("@sinclair/typebox").TUnsafe<ForestRootId>;
|
|
31
|
-
}>;
|
|
32
|
-
export type Format = Static<typeof Format>;
|
|
33
|
-
//# sourceMappingURL=detachedFieldIndexFormat.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detachedFieldIndexFormat.d.ts","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAKtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,eAAO,MAAM,OAAO,IAAM,CAAC;AAE3B;;;GAGG;AACH,eAAO,MAAM,QAAQ,qCAAiC,CAAC;AAQvD;;;;GAIG;AACH,eAAO,MAAM,SAAS,8HAKpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC;AAEjD,eAAO,MAAM,UAAU,kKAAwB,CAAC;AAChD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,uBAAuB,80BAKlC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE7E,eAAO,MAAM,MAAM;;;;EAOlB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detachedFieldIndexFormat.js","sourceRoot":"","sources":["../../../src/core/tree/detachedFieldIndexFormat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAAsD;AAEtD,kDAAwD;AACxD,iDAAuD;AAI1C,QAAA,OAAO,GAAG,GAAG,CAAC;AAE3B;;;GAGG;AACU,QAAA,QAAQ,GAAG,cAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,kBAAkB,GAAG,IAAA,4BAAiB,EAAe,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AAE3F;;;;GAIG;AACU,QAAA,SAAS,GAAG,cAAI,CAAC,KAAK,CAAC;IACnC,iCAAiC;IACjC,gBAAQ;IACR,6BAA6B;IAC7B,kBAAkB;CAClB,CAAC,CAAC;AAGU,QAAA,UAAU,GAAG,cAAI,CAAC,KAAK,CAAC,iBAAS,CAAC,CAAC;AAGhD;;GAEG;AACU,QAAA,uBAAuB,GAAG,cAAI,CAAC,KAAK,CAAC;IACjD,yEAAyE;IACzE,cAAI,CAAC,KAAK,CAAC,CAAC,4BAAiB,EAAE,kBAAU,CAAC,CAAC;IAC3C,mEAAmE;IACnE,cAAI,CAAC,KAAK,CAAC,CAAC,4BAAiB,EAAE,gBAAQ,EAAE,kBAAkB,CAAC,CAAC;CAC7D,CAAC,CAAC;AAGU,QAAA,MAAM,GAAG,cAAI,CAAC,MAAM,CAChC;IACC,OAAO,EAAE,cAAI,CAAC,OAAO,CAAC,eAAO,CAAC;IAC9B,IAAI,EAAE,cAAI,CAAC,KAAK,CAAC,+BAAuB,CAAC;IACzC,KAAK,EAAE,kBAAkB;CACzB,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type Static, Type } from \"@sinclair/typebox\";\n\nimport { brandedNumberType } from \"../../util/index.js\";\nimport { RevisionTagSchema } from \"../rebase/index.js\";\n\nimport type { ForestRootId } from \"./detachedFieldIndexTypes.js\";\n\nexport const version = 1.0;\n\n/**\n * The ID of a detached node. Is not globally unique on.\n * A `RevisionTag` + `DetachId` pair is globally unique and eventually consistent across clients.\n */\nexport const DetachId = Type.Number({ multipleOf: 1 });\n\n/**\n * The ID of a root node in the forest associated with the owning checkout. Is unique for that forest.\n * Is not consistent across clients.\n */\nconst ForestRootIdSchema = brandedNumberType<ForestRootId>({ minimum: -1, multipleOf: 1 });\n\n/**\n * A mapping from a range of the detached node IDs the corresponding range root IDs.\n * The detached node IDs need to be qualified with a revision (stored in the containing `EncodedRootsForRevision`).\n * Note: the length of the range (currently always 1) can be looked up in the forest.\n */\nexport const RootRange = Type.Tuple([\n\t// ID for the first detached node\n\tDetachId,\n\t// ID for the first root node\n\tForestRootIdSchema,\n]);\nexport type RootRange = Static<typeof RootRange>;\n\nexport const RootRanges = Type.Array(RootRange);\nexport type RootRanges = Static<typeof RootRanges>;\n\n/**\n * For all the roots detached in a revision, represents a mapping from the detached node ID to corresponding root ID.\n */\nexport const EncodedRootsForRevision = Type.Union([\n\t// Used to represent a revision in which more than one node were detached\n\tType.Tuple([RevisionTagSchema, RootRanges]),\n\t// Used to represent a revision in which a single node was detached\n\tType.Tuple([RevisionTagSchema, DetachId, ForestRootIdSchema]),\n]);\nexport type EncodedRootsForRevision = Static<typeof EncodedRootsForRevision>;\n\nexport const Format = Type.Object(\n\t{\n\t\tversion: Type.Literal(version),\n\t\tdata: Type.Array(EncodedRootsForRevision),\n\t\tmaxId: ForestRootIdSchema,\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type Format = Static<typeof Format>;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeShape.d.ts","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/nodeShape.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAEN,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAG7B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,KAAK,YAAY,EAAmB,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAEhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE3F,qBAAa,SAAU,SAAQ,KAAK,CAAC,iBAAiB,CAAE,YAAW,WAAW;aAQ5D,IAAI,EAAE,SAAS,GAAG,wBAAwB;aAC1C,KAAK,EAAE,iBAAiB;IACxC;;;;;;;;;;OAUG;aACa,wBAAwB,EAAE,SAAS,iBAAiB,EAAE;IACtE;;;OAGG;aACa,kBAAkB,EAAE,SAAS,GAAG,YAAY;IAzB7D;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAgB;gBAGpC,IAAI,EAAE,SAAS,GAAG,wBAAwB,EAC1C,KAAK,EAAE,iBAAiB;IACxC;;;;;;;;;;OAUG;IACa,wBAAwB,EAAE,SAAS,iBAAiB,EAAE;IACtE;;;OAGG;IACa,kBAAkB,EAAE,SAAS,GAAG,YAAY;IAM7D,OAAO,CAAC,gBAAgB;IAajB,UAAU,CAChB,MAAM,EAAE,sBAAsB,EAC9B,KAAK,EAAE,YAAY,EACnB,YAAY,EAAE,YAAY,CAAC,iBAAiB,CAAC,GAC3C,IAAI;IAgCA,WAAW,CACjB,WAAW,EAAE,kBAAkB,CAAC,MAAM,CAAC,EACvC,MAAM,EAAE,kBAAkB,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,GAClD,iBAAiB;IAWb,mCAAmC,CACzC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,EAC5B,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK,IAAI,GACxD,IAAI;IAeP,IAAW,KAAK,IAAI,SAAS,CAE5B;CACD;AAED,wBAAgB,iBAAiB,CAChC,aAAa,EAAE,SAAS,iBAAiB,EAAE,EAC3C,WAAW,EAAE,kBAAkB,CAAC,MAAM,CAAC,EACvC,MAAM,EAAE,kBAAkB,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,GAClD,iBAAiB,EAAE,GAAG,SAAS,CAUjC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeShape.js","sourceRoot":"","sources":["../../../../src/feature-libraries/chunked-forest/codec/nodeShape.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport { isStableId } from \"@fluidframework/id-compressor/internal\";\n\nimport {\n\ttype FieldKey,\n\ttype ITreeCursorSynchronous,\n\ttype TreeNodeSchemaIdentifier,\n\tforEachField,\n\ttype Value,\n} from \"../../../core/index.js\";\nimport { brand } from \"../../../util/index.js\";\n\nimport type { Counter, DeduplicationTable } from \"./chunkCodecUtilities.js\";\nimport { type BufferFormat, IdentifierToken, Shape } from \"./chunkEncodingGeneric.js\";\nimport {\n\ttype EncoderCache,\n\ttype FieldEncoder,\n\ttype KeyedFieldEncoder,\n\ttype NodeEncoder,\n\tencodeValue,\n} from \"./compressedEncode.js\";\nimport type { EncodedChunkShape, EncodedFieldShape, EncodedValueShape } from \"./format.js\";\n\nexport class NodeShape extends Shape<EncodedChunkShape> implements NodeEncoder {\n\t/**\n\t * Set of keys for fields that are encoded using {@link NodeShape.specializedFieldEncoders}.\n\t * TODO: Ensure uniform chunks, encoding and identifier generation sort fields the same.\n\t */\n\tprivate readonly specializedFieldKeys: Set<FieldKey>;\n\n\tpublic constructor(\n\t\tpublic readonly type: undefined | TreeNodeSchemaIdentifier,\n\t\tpublic readonly value: EncodedValueShape,\n\t\t/**\n\t\t * Encoders for a specific set of fields, by key, in the order they will be encoded.\n\t\t * These are fields for which specialized encoding is provided as an optimization.\n\t\t * Using these for a given field instead of falling back to {@link NodeShape.specializedFieldEncoders} is often more efficient:\n\t\t * this avoids the need to explicitly include the key and shape in the encoded data for each node instance.\n\t\t * Instead, this information is here, and thus is encoded only once as part of the node shape.\n\t\t * These encoders will be used, even if the field they apply to is empty (which can add overhead for fields which are usually empty).\n\t\t *\n\t\t * Any fields not included here will be encoded using {@link NodeShape.otherFieldsEncoder}.\n\t\t * If {@link NodeShape.otherFieldsEncoder} is undefined, then this must handle all non-empty fields.\n\t\t */\n\t\tpublic readonly specializedFieldEncoders: readonly KeyedFieldEncoder[],\n\t\t/**\n\t\t * Encoder for all other fields that are not in {@link NodeShape.specializedFieldEncoders}. These fields must\n\t\t * be encoded after the specialized fields.\n\t\t */\n\t\tpublic readonly otherFieldsEncoder: undefined | FieldEncoder,\n\t) {\n\t\tsuper();\n\t\tthis.specializedFieldKeys = new Set(this.specializedFieldEncoders.map((f) => f.key));\n\t}\n\n\tprivate getValueToEncode(cursor: ITreeCursorSynchronous, cache: EncoderCache): Value {\n\t\tif (this.value === 0) {\n\t\t\tassert(typeof cursor.value === \"string\", 0x9aa /* identifier must be type string */);\n\t\t\tif (isStableId(cursor.value)) {\n\t\t\t\tconst sessionSpaceCompressedId = cache.idCompressor.tryRecompress(cursor.value);\n\t\t\t\tif (sessionSpaceCompressedId !== undefined) {\n\t\t\t\t\treturn cache.idCompressor.normalizeToOpSpace(sessionSpaceCompressedId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cursor.value;\n\t}\n\n\tpublic encodeNode(\n\t\tcursor: ITreeCursorSynchronous,\n\t\tcache: EncoderCache,\n\t\toutputBuffer: BufferFormat<EncodedChunkShape>,\n\t): void {\n\t\tif (this.type === undefined) {\n\t\t\toutputBuffer.push(new IdentifierToken(cursor.type));\n\t\t} else {\n\t\t\tassert(cursor.type === this.type, 0x741 /* type must match shape */);\n\t\t}\n\t\tencodeValue(this.getValueToEncode(cursor, cache), this.value, outputBuffer);\n\t\tfor (const fieldEncoder of this.specializedFieldEncoders) {\n\t\t\tcursor.enterField(brand(fieldEncoder.key));\n\t\t\tfieldEncoder.encoder.encodeField(cursor, cache, outputBuffer);\n\t\t\tcursor.exitField();\n\t\t}\n\n\t\tconst otherFieldsBuffer: BufferFormat<EncodedChunkShape> = [];\n\n\t\tforEachField(cursor, () => {\n\t\t\tconst key = cursor.getFieldKey();\n\t\t\tif (!this.specializedFieldKeys.has(key)) {\n\t\t\t\tassert(\n\t\t\t\t\tthis.otherFieldsEncoder !== undefined,\n\t\t\t\t\t0x742 /* had extra local fields when shape does not support them */,\n\t\t\t\t);\n\t\t\t\totherFieldsBuffer.push(new IdentifierToken(key));\n\t\t\t\tthis.otherFieldsEncoder.encodeField(cursor, cache, otherFieldsBuffer);\n\t\t\t}\n\t\t});\n\n\t\tif (this.otherFieldsEncoder !== undefined) {\n\t\t\toutputBuffer.push(otherFieldsBuffer);\n\t\t}\n\t}\n\n\tpublic encodeShape(\n\t\tidentifiers: DeduplicationTable<string>,\n\t\tshapes: DeduplicationTable<Shape<EncodedChunkShape>>,\n\t): EncodedChunkShape {\n\t\treturn {\n\t\t\tc: {\n\t\t\t\ttype: encodeOptionalIdentifier(this.type, identifiers),\n\t\t\t\tvalue: this.value,\n\t\t\t\tfields: encodeFieldShapes(this.specializedFieldEncoders, identifiers, shapes),\n\t\t\t\textraFields: encodeOptionalFieldShape(this.otherFieldsEncoder, shapes),\n\t\t\t},\n\t\t};\n\t}\n\n\tpublic countReferencedShapesAndIdentifiers(\n\t\tidentifiers: Counter<string>,\n\t\tshapeDiscovered: (shape: Shape<EncodedChunkShape>) => void,\n\t): void {\n\t\tif (this.type !== undefined) {\n\t\t\tidentifiers.add(this.type);\n\t\t}\n\n\t\tfor (const fieldEncoder of this.specializedFieldEncoders) {\n\t\t\tidentifiers.add(fieldEncoder.key);\n\t\t\tshapeDiscovered(fieldEncoder.encoder.shape);\n\t\t}\n\n\t\tif (this.otherFieldsEncoder !== undefined) {\n\t\t\tshapeDiscovered(this.otherFieldsEncoder.shape);\n\t\t}\n\t}\n\n\tpublic get shape(): NodeShape {\n\t\treturn this;\n\t}\n}\n\nexport function encodeFieldShapes(\n\tfieldEncoders: readonly KeyedFieldEncoder[],\n\tidentifiers: DeduplicationTable<string>,\n\tshapes: DeduplicationTable<Shape<EncodedChunkShape>>,\n): EncodedFieldShape[] | undefined {\n\tif (fieldEncoders.length === 0) {\n\t\treturn undefined;\n\t}\n\treturn fieldEncoders.map((fieldEncoder) => [\n\t\t// key\n\t\tencodeIdentifier(fieldEncoder.key, identifiers),\n\t\t// shape\n\t\tshapes.valueToIndex.get(fieldEncoder.encoder.shape) ?? fail(0xb50 /* missing shape */),\n\t]);\n}\n\nfunction encodeIdentifier(\n\tidentifier: string,\n\tidentifiers: DeduplicationTable<string>,\n): string | number {\n\treturn identifiers.valueToIndex.get(identifier) ?? identifier;\n}\n\nfunction encodeOptionalIdentifier(\n\tidentifier: string | undefined,\n\tidentifiers: DeduplicationTable<string>,\n): string | number | undefined {\n\treturn identifier === undefined ? undefined : encodeIdentifier(identifier, identifiers);\n}\n\nfunction encodeOptionalFieldShape(\n\tshape: FieldEncoder | undefined,\n\tshapes: DeduplicationTable<Shape<EncodedChunkShape>>,\n): number | undefined {\n\treturn shape === undefined ? undefined : dedupShape(shape.shape, shapes);\n}\n\nfunction dedupShape(\n\tshape: Shape<EncodedChunkShape>,\n\tshapes: DeduplicationTable<Shape<EncodedChunkShape>>,\n): number {\n\treturn shapes.valueToIndex.get(shape) ?? fail(0xb51 /* missing shape */);\n}\n"]}
|