@fluidframework/tree 2.52.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/api-report/tree.alpha.api.md +38 -29
- package/dist/alpha.d.ts +2 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
- package/dist/feature-libraries/default-schema/defaultFieldKinds.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/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.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/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.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +3 -3
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +9 -3
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +3 -0
- 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 +4 -4
- package/dist/simple-tree/api/create.d.ts.map +1 -1
- package/dist/simple-tree/api/create.js +3 -6
- package/dist/simple-tree/api/create.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.d.ts +5 -9
- package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/dist/simple-tree/api/discrepancies.js +11 -10
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- 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.map +1 -1
- package/dist/simple-tree/api/schemaCompatibilityTester.js +3 -4
- package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +9 -155
- 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 +4 -2
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js +12 -6
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +33 -17
- package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js +20 -12
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +5 -3
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +6 -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/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 +6 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.js +11 -3
- package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/core/walkSchema.d.ts +19 -5
- package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/walkSchema.js +4 -2
- package/dist/simple-tree/core/walkSchema.js.map +1 -1
- package/dist/simple-tree/createContext.d.ts.map +1 -1
- package/dist/simple-tree/createContext.js +1 -1
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +1 -1
- package/dist/simple-tree/fieldSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +4 -4
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +7 -1
- 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 +17 -3
- package/dist/simple-tree/node-kinds/array/arrayNode.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/objectNode.d.ts +2 -2
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +37 -26
- 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 +5 -5
- package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/dist/simple-tree/prepareForInsertion.js +10 -10
- 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 +35 -11
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +68 -33
- package/dist/simple-tree/toStoredSchema.js.map +1 -1
- package/lib/alpha.d.ts +2 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
- package/lib/feature-libraries/default-schema/defaultFieldKinds.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/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.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/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.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +4 -4
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +10 -4
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +3 -0
- 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 +4 -4
- package/lib/simple-tree/api/create.d.ts.map +1 -1
- package/lib/simple-tree/api/create.js +3 -6
- package/lib/simple-tree/api/create.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.d.ts +5 -9
- package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
- package/lib/simple-tree/api/discrepancies.js +11 -10
- package/lib/simple-tree/api/discrepancies.js.map +1 -1
- 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.map +1 -1
- package/lib/simple-tree/api/schemaCompatibilityTester.js +4 -5
- package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +9 -155
- 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 +6 -4
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js +8 -2
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +33 -17
- package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/core/allowedTypes.js +23 -12
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +5 -3
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +3 -2
- 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/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 +6 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.js +9 -2
- package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/core/walkSchema.d.ts +19 -5
- package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/walkSchema.js +4 -2
- package/lib/simple-tree/core/walkSchema.js.map +1 -1
- package/lib/simple-tree/createContext.d.ts.map +1 -1
- package/lib/simple-tree/createContext.js +2 -2
- package/lib/simple-tree/createContext.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +1 -1
- package/lib/simple-tree/fieldSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +4 -4
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- 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 +20 -6
- package/lib/simple-tree/node-kinds/array/arrayNode.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/objectNode.d.ts +2 -2
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +16 -5
- 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 +5 -5
- package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
- package/lib/simple-tree/prepareForInsertion.js +10 -10
- 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 +35 -11
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +67 -34
- package/lib/simple-tree/toStoredSchema.js.map +1 -1
- package/package.json +21 -21
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -0
- 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/optional-field/optionalField.ts +4 -0
- package/src/feature-libraries/sequence-field/sequenceFieldChangeRebaser.ts +4 -0
- package/src/index.ts +2 -1
- package/src/jsonDomainSchema.ts +4 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/schematizeTree.ts +2 -2
- package/src/shared-tree/schematizingTreeView.ts +9 -3
- package/src/shared-tree/treeAlpha.ts +18 -4
- package/src/simple-tree/api/configuration.ts +10 -2
- package/src/simple-tree/api/create.ts +5 -10
- package/src/simple-tree/api/discrepancies.ts +18 -17
- package/src/simple-tree/api/index.ts +2 -3
- package/src/simple-tree/api/schemaCompatibilityTester.ts +5 -9
- package/src/simple-tree/api/schemaFactory.ts +6 -250
- 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 +12 -5
- package/src/simple-tree/api/treeBeta.ts +9 -2
- package/src/simple-tree/core/allowedTypes.ts +46 -26
- package/src/simple-tree/core/index.ts +9 -1
- package/src/simple-tree/core/simpleNodeSchemaBase.ts +30 -0
- package/src/simple-tree/core/toStored.ts +58 -0
- package/src/simple-tree/core/treeNodeSchema.ts +8 -2
- package/src/simple-tree/core/treeNodeValid.ts +14 -2
- package/src/simple-tree/core/walkSchema.ts +23 -6
- package/src/simple-tree/createContext.ts +5 -2
- package/src/simple-tree/fieldSchema.ts +2 -1
- package/src/simple-tree/index.ts +14 -3
- package/src/simple-tree/leafNodeSchema.ts +2 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +32 -4
- package/src/simple-tree/node-kinds/map/mapNode.ts +23 -2
- package/src/simple-tree/node-kinds/object/objectNode.ts +34 -4
- package/src/simple-tree/node-kinds/record/recordNode.ts +20 -2
- package/src/simple-tree/prepareForInsertion.ts +12 -7
- package/src/simple-tree/simpleSchema.ts +6 -26
- package/src/simple-tree/toStoredSchema.ts +107 -44
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
newChangeAtomIdRangeMap,
|
|
40
40
|
type DeltaDetachedNodeChanges,
|
|
41
41
|
type DeltaDetachedNodeRename,
|
|
42
|
+
mapTaggedChange,
|
|
42
43
|
} from "../../core/index.js";
|
|
43
44
|
import {
|
|
44
45
|
type IdAllocationState,
|
|
@@ -213,24 +214,16 @@ export class ModularChangeFamily
|
|
|
213
214
|
}
|
|
214
215
|
|
|
215
216
|
private composeAllFields(
|
|
216
|
-
|
|
217
|
-
|
|
217
|
+
potentiallyConflictedChange1: ModularChangeset,
|
|
218
|
+
potentiallyConflictedChange2: ModularChangeset,
|
|
218
219
|
revInfos: RevisionInfo[],
|
|
219
220
|
idState: IdAllocationState,
|
|
220
221
|
): ModularChangesetContent {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
nodeAliases: newTupleBTree(),
|
|
227
|
-
crossFieldKeys: newCrossFieldKeyTable(),
|
|
228
|
-
};
|
|
229
|
-
} else if (hasConflicts(change1)) {
|
|
230
|
-
return change2;
|
|
231
|
-
} else if (hasConflicts(change2)) {
|
|
232
|
-
return change1;
|
|
233
|
-
}
|
|
222
|
+
// Our current cell ordering scheme in sequences depends on being able to rebase over a change with conflicts.
|
|
223
|
+
// This means that compose must preserve declarations (e.g., new cells) made by conflicted changes (so that we can rebase over the composition).
|
|
224
|
+
// TODO: remove once AB#46104 is completed
|
|
225
|
+
const change1 = this.getEffectiveChange(potentiallyConflictedChange1);
|
|
226
|
+
const change2 = this.getEffectiveChange(potentiallyConflictedChange2);
|
|
234
227
|
|
|
235
228
|
const genId: IdAllocator = idAllocatorFromState(idState);
|
|
236
229
|
const revisionMetadata: RevisionMetadataSource = revisionMetadataSourceFromInfo(revInfos);
|
|
@@ -857,12 +850,17 @@ export class ModularChangeFamily
|
|
|
857
850
|
|
|
858
851
|
public rebase(
|
|
859
852
|
taggedChange: TaggedChange<ModularChangeset>,
|
|
860
|
-
|
|
853
|
+
potentiallyConflictedOver: TaggedChange<ModularChangeset>,
|
|
861
854
|
revisionMetadata: RevisionMetadataSource,
|
|
862
855
|
): ModularChangeset {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
856
|
+
// Our current cell ordering scheme in sequences depends on being able to rebase over a change with conflicts.
|
|
857
|
+
// This means that we must rebase over a muted version of the conflicted changeset.
|
|
858
|
+
// That is, a version that includes its declarations (e.g., new cells) but not its changes.
|
|
859
|
+
// TODO: remove once AB#46104 is completed
|
|
860
|
+
const over = mapTaggedChange(
|
|
861
|
+
potentiallyConflictedOver,
|
|
862
|
+
this.getEffectiveChange(potentiallyConflictedOver.change),
|
|
863
|
+
);
|
|
866
864
|
|
|
867
865
|
const change = taggedChange.change;
|
|
868
866
|
const maxId = Math.max(change.maxId ?? -1, over.change.maxId ?? -1);
|
|
@@ -1711,6 +1709,50 @@ export class ModularChangeFamily
|
|
|
1711
1709
|
|
|
1712
1710
|
return numChildren;
|
|
1713
1711
|
}
|
|
1712
|
+
|
|
1713
|
+
private getEffectiveChange(change: ModularChangeset): ModularChangeset {
|
|
1714
|
+
if (hasConflicts(change)) {
|
|
1715
|
+
return this.muteChange(change);
|
|
1716
|
+
}
|
|
1717
|
+
return change;
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
/**
|
|
1721
|
+
* Returns a copy of the given changeset with the same declarations (e.g., new cells) but no actual changes.
|
|
1722
|
+
*/
|
|
1723
|
+
private muteChange(change: ModularChangeset): ModularChangeset {
|
|
1724
|
+
const muted: Mutable<ModularChangeset> = {
|
|
1725
|
+
...change,
|
|
1726
|
+
crossFieldKeys: newCrossFieldKeyTable(),
|
|
1727
|
+
fieldChanges: this.muteFieldChanges(change.fieldChanges),
|
|
1728
|
+
nodeChanges: brand(change.nodeChanges.mapValues((v) => this.muteNodeChange(v))),
|
|
1729
|
+
};
|
|
1730
|
+
return muted;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
private muteNodeChange(change: NodeChangeset): NodeChangeset {
|
|
1734
|
+
if (change.fieldChanges === undefined) {
|
|
1735
|
+
return change;
|
|
1736
|
+
}
|
|
1737
|
+
return {
|
|
1738
|
+
...change,
|
|
1739
|
+
fieldChanges: this.muteFieldChanges(change.fieldChanges),
|
|
1740
|
+
};
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
private muteFieldChanges(change: FieldChangeMap): FieldChangeMap {
|
|
1744
|
+
return new Map(
|
|
1745
|
+
Array.from(change.entries(), ([key, value]) => [key, this.muteFieldChange(value)]),
|
|
1746
|
+
);
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
private muteFieldChange(change: FieldChange): FieldChange {
|
|
1750
|
+
const handler = getChangeHandler(this.fieldKinds, change.fieldKind);
|
|
1751
|
+
return {
|
|
1752
|
+
fieldKind: change.fieldKind,
|
|
1753
|
+
change: brand(handler.rebaser.mute(change.change)),
|
|
1754
|
+
};
|
|
1755
|
+
}
|
|
1714
1756
|
}
|
|
1715
1757
|
|
|
1716
1758
|
function replaceCrossFieldKeyTableRevisions(
|
|
@@ -465,6 +465,10 @@ export const optionalChangeRebaser: FieldChangeRebaser<OptionalChangeset> = {
|
|
|
465
465
|
|
|
466
466
|
return updated;
|
|
467
467
|
},
|
|
468
|
+
|
|
469
|
+
mute: (change: OptionalChangeset): OptionalChangeset => {
|
|
470
|
+
return { childChanges: change.childChanges, moves: [] };
|
|
471
|
+
},
|
|
468
472
|
};
|
|
469
473
|
|
|
470
474
|
function replaceReplaceRevisions(
|
|
@@ -11,6 +11,7 @@ import { prune } from "./prune.js";
|
|
|
11
11
|
import { rebase } from "./rebase.js";
|
|
12
12
|
import { replaceRevisions } from "./replaceRevisions.js";
|
|
13
13
|
import type { Changeset } from "./types.js";
|
|
14
|
+
import { omitMarkEffect } from "./utils.js";
|
|
14
15
|
|
|
15
16
|
export type SequenceChangeRebaser = FieldChangeRebaser<Changeset>;
|
|
16
17
|
|
|
@@ -20,4 +21,7 @@ export const sequenceFieldChangeRebaser = {
|
|
|
20
21
|
rebase,
|
|
21
22
|
prune,
|
|
22
23
|
replaceRevisions,
|
|
24
|
+
mute: (change: Changeset): Changeset => {
|
|
25
|
+
return change.map((mark) => omitMarkEffect(mark));
|
|
26
|
+
},
|
|
23
27
|
};
|
package/src/index.ts
CHANGED
|
@@ -118,6 +118,7 @@ export {
|
|
|
118
118
|
type InternalTreeNode,
|
|
119
119
|
type WithType,
|
|
120
120
|
type NodeChangedData,
|
|
121
|
+
type SchemaUpgrade,
|
|
121
122
|
// Types not really intended for public use, but used in links.
|
|
122
123
|
// Can not be moved to internalTypes since doing so causes app code to throw errors like:
|
|
123
124
|
// Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package "@fluidframework/tree" does not have an export "TreeNodeApi"
|
|
@@ -168,9 +169,9 @@ export {
|
|
|
168
169
|
type UnannotateAllowedTypes,
|
|
169
170
|
type UnannotateAllowedType,
|
|
170
171
|
type UnannotateAllowedTypesList,
|
|
171
|
-
type UnannotateAllowedTypeOrLazyItem,
|
|
172
172
|
type UnannotateImplicitFieldSchema,
|
|
173
173
|
type UnannotateSchemaRecord,
|
|
174
|
+
type SchemaStaticsAlpha,
|
|
174
175
|
// Beta APIs
|
|
175
176
|
TreeBeta,
|
|
176
177
|
type TreeChangeEventsBeta,
|
package/src/jsonDomainSchema.ts
CHANGED
|
@@ -11,9 +11,11 @@ import type {
|
|
|
11
11
|
ValidateRecursiveSchema,
|
|
12
12
|
// #region Unused imports to make d.ts cleaner
|
|
13
13
|
/* eslint-disable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars */
|
|
14
|
+
ArrayNodeCustomizableSchemaUnsafe,
|
|
14
15
|
System_Unsafe,
|
|
15
16
|
TreeNodeSchemaNonClass,
|
|
16
17
|
TreeNodeSchemaClass,
|
|
18
|
+
TreeRecordNodeUnsafe,
|
|
17
19
|
NodeKind,
|
|
18
20
|
TreeNodeSchemaCore,
|
|
19
21
|
WithType,
|
|
@@ -52,6 +54,7 @@ export namespace JsonAsTree {
|
|
|
52
54
|
] as const satisfies AllowedTypes;
|
|
53
55
|
|
|
54
56
|
/**
|
|
57
|
+
* {@inheritDoc JsonAsTree.(Primitive:variable)}
|
|
55
58
|
* @alpha
|
|
56
59
|
*/
|
|
57
60
|
export type Primitive = TreeNodeFromImplicitAllowedTypes<typeof Primitive>;
|
|
@@ -72,6 +75,7 @@ export namespace JsonAsTree {
|
|
|
72
75
|
export const Tree = [...Primitive, () => JsonObject, () => Array] as const;
|
|
73
76
|
|
|
74
77
|
/**
|
|
78
|
+
* {@inheritDoc JsonAsTree.(Tree:variable)}
|
|
75
79
|
* @alpha
|
|
76
80
|
*/
|
|
77
81
|
export type Tree = TreeNodeFromImplicitAllowedTypes<typeof Tree>;
|
package/src/packageVersion.ts
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
defaultSchemaPolicy,
|
|
20
20
|
mapTreeFromCursor,
|
|
21
21
|
} from "../feature-libraries/index.js";
|
|
22
|
-
import {
|
|
22
|
+
import { toUpgradeSchema, type SchemaCompatibilityTester } from "../simple-tree/index.js";
|
|
23
23
|
import { isReadonlyArray } from "../util/index.js";
|
|
24
24
|
|
|
25
25
|
import type { ITreeCheckout } from "./treeCheckout.js";
|
|
@@ -219,7 +219,7 @@ export function ensureSchema(
|
|
|
219
219
|
return false;
|
|
220
220
|
}
|
|
221
221
|
case UpdateType.SchemaCompatible: {
|
|
222
|
-
checkout.updateSchema(
|
|
222
|
+
checkout.updateSchema(toUpgradeSchema(viewSchema.viewSchema.root));
|
|
223
223
|
return true;
|
|
224
224
|
}
|
|
225
225
|
default: {
|
|
@@ -51,10 +51,10 @@ import {
|
|
|
51
51
|
areImplicitFieldSchemaEqual,
|
|
52
52
|
prepareForInsertionContextless,
|
|
53
53
|
type FieldSchema,
|
|
54
|
-
toStoredSchema,
|
|
55
54
|
tryDisposeTreeNode,
|
|
56
55
|
FieldSchemaAlpha,
|
|
57
56
|
TreeViewConfigurationAlpha,
|
|
57
|
+
toInitialSchema,
|
|
58
58
|
} from "../simple-tree/index.js";
|
|
59
59
|
import {
|
|
60
60
|
type Breakable,
|
|
@@ -172,7 +172,7 @@ export class SchematizingSimpleTreeView<
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
this.runSchemaEdit(() => {
|
|
175
|
-
const schema =
|
|
175
|
+
const schema = toInitialSchema(this.config.schema);
|
|
176
176
|
const mapTree = prepareForInsertionContextless(
|
|
177
177
|
content as InsertableContent | undefined,
|
|
178
178
|
this.rootFieldSchema,
|
|
@@ -181,6 +181,7 @@ export class SchematizingSimpleTreeView<
|
|
|
181
181
|
policy: defaultSchemaPolicy,
|
|
182
182
|
},
|
|
183
183
|
this,
|
|
184
|
+
schema.rootFieldSchema,
|
|
184
185
|
);
|
|
185
186
|
|
|
186
187
|
initialize(this.checkout, {
|
|
@@ -436,7 +437,12 @@ export class SchematizingSimpleTreeView<
|
|
|
436
437
|
);
|
|
437
438
|
}
|
|
438
439
|
const view = this.getFlexTreeContext();
|
|
439
|
-
setField(
|
|
440
|
+
setField(
|
|
441
|
+
view.root,
|
|
442
|
+
this.rootFieldSchema,
|
|
443
|
+
newRoot as InsertableContent | undefined,
|
|
444
|
+
this.checkout.storedSchema.rootFieldSchema,
|
|
445
|
+
);
|
|
440
446
|
}
|
|
441
447
|
|
|
442
448
|
// #region Branching
|
|
@@ -36,7 +36,6 @@ import {
|
|
|
36
36
|
verboseFromCursor,
|
|
37
37
|
type TreeEncodingOptions,
|
|
38
38
|
type VerboseTree,
|
|
39
|
-
toStoredSchema,
|
|
40
39
|
extractPersistedSchema,
|
|
41
40
|
type TreeBranch,
|
|
42
41
|
TreeViewConfigurationAlpha,
|
|
@@ -52,6 +51,9 @@ import {
|
|
|
52
51
|
tryGetTreeNodeForField,
|
|
53
52
|
isObjectNodeSchema,
|
|
54
53
|
isTreeNode,
|
|
54
|
+
toInitialSchema,
|
|
55
|
+
convertField,
|
|
56
|
+
toUnhydratedSchema,
|
|
55
57
|
} from "../simple-tree/index.js";
|
|
56
58
|
import { brand, extractFromOpaque, type JsonCompatible } from "../util/index.js";
|
|
57
59
|
import {
|
|
@@ -493,7 +495,11 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
493
495
|
return undefined as Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
494
496
|
}
|
|
495
497
|
const cursor = cursorFromVerbose(data, schemalessConfig);
|
|
496
|
-
return createFromCursor(
|
|
498
|
+
return createFromCursor(
|
|
499
|
+
schema,
|
|
500
|
+
cursor,
|
|
501
|
+
convertField(normalizeFieldSchema(schema), toUnhydratedSchema),
|
|
502
|
+
);
|
|
497
503
|
},
|
|
498
504
|
|
|
499
505
|
exportConcise,
|
|
@@ -523,11 +529,18 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
523
529
|
const batch: FieldBatch = [cursor];
|
|
524
530
|
// If none provided, create a compressor which will not compress anything.
|
|
525
531
|
const idCompressor = options.idCompressor ?? createIdCompressor();
|
|
532
|
+
|
|
533
|
+
// Grabbing an existing stored schema from the node is important to ensure that unknown optional fields can be preserved.
|
|
534
|
+
// Note that if the node is unhydrated, this can result in all staged allowed types being included in the schema, which might be undesired.
|
|
535
|
+
const storedSchema = isTreeNode(node)
|
|
536
|
+
? getKernel(node).context.flexContext.schema
|
|
537
|
+
: toInitialSchema(schema);
|
|
538
|
+
|
|
526
539
|
const context: FieldBatchEncodingContext = {
|
|
527
540
|
encodeType: TreeCompressionStrategy.Compressed,
|
|
528
541
|
idCompressor,
|
|
529
542
|
originatorId: idCompressor.localSessionId, // TODO: Why is this needed?
|
|
530
|
-
schema: { schema:
|
|
543
|
+
schema: { schema: storedSchema, policy: defaultSchemaPolicy },
|
|
531
544
|
};
|
|
532
545
|
const result = codec.encode(batch, context);
|
|
533
546
|
return result;
|
|
@@ -543,7 +556,8 @@ export const TreeAlpha: TreeAlpha = {
|
|
|
543
556
|
const config = new TreeViewConfigurationAlpha({ schema });
|
|
544
557
|
const content: ViewContent = {
|
|
545
558
|
// Always use a v1 schema codec for consistency.
|
|
546
|
-
|
|
559
|
+
// TODO: reevaluate how staged schema should behave in schema import/export APIs before stabilizing this.
|
|
560
|
+
schema: extractPersistedSchema(config.schema, FluidClientVersion.v2_0, () => true),
|
|
547
561
|
tree: compressedData,
|
|
548
562
|
idCompressor: options.idCompressor ?? createIdCompressor(),
|
|
549
563
|
};
|
|
@@ -25,7 +25,11 @@ import {
|
|
|
25
25
|
evaluateLazySchema,
|
|
26
26
|
markSchemaMostDerived,
|
|
27
27
|
} from "../core/index.js";
|
|
28
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
permissiveStoredSchemaGenerationOptions,
|
|
30
|
+
restrictiveStoredSchemaGenerationOptions,
|
|
31
|
+
toStoredSchema,
|
|
32
|
+
} from "../toStoredSchema.js";
|
|
29
33
|
import {
|
|
30
34
|
isArrayNodeSchema,
|
|
31
35
|
isMapNodeSchema,
|
|
@@ -161,6 +165,9 @@ export interface ITreeViewConfiguration<
|
|
|
161
165
|
|
|
162
166
|
/**
|
|
163
167
|
* Configuration for {@link ViewableTree.viewWith}.
|
|
168
|
+
* @privateRemarks
|
|
169
|
+
* When `ImplicitAnnotatedFieldSchema` is stabilized, TSchema should be updated to use it.
|
|
170
|
+
* When doing this, the example for `staged` will need to be updated/simplified.
|
|
164
171
|
* @sealed @public
|
|
165
172
|
*/
|
|
166
173
|
export class TreeViewConfiguration<
|
|
@@ -213,7 +220,8 @@ export class TreeViewConfiguration<
|
|
|
213
220
|
|
|
214
221
|
// Eagerly perform this conversion to surface errors sooner.
|
|
215
222
|
// Includes detection of duplicate schema identifiers.
|
|
216
|
-
toStoredSchema(config.schema);
|
|
223
|
+
toStoredSchema(config.schema, restrictiveStoredSchemaGenerationOptions);
|
|
224
|
+
toStoredSchema(config.schema, permissiveStoredSchemaGenerationOptions);
|
|
217
225
|
|
|
218
226
|
const definitions = new Map<string, SimpleNodeSchema & TreeNodeSchema>();
|
|
219
227
|
|
|
@@ -13,12 +13,9 @@ import {
|
|
|
13
13
|
mapCursorFields,
|
|
14
14
|
type ITreeCursorSynchronous,
|
|
15
15
|
type SchemaAndPolicy,
|
|
16
|
+
type TreeFieldStoredSchema,
|
|
16
17
|
} from "../../core/index.js";
|
|
17
|
-
import {
|
|
18
|
-
normalizeFieldSchema,
|
|
19
|
-
type ImplicitFieldSchema,
|
|
20
|
-
type TreeFieldFromImplicitField,
|
|
21
|
-
} from "../fieldSchema.js";
|
|
18
|
+
import type { ImplicitFieldSchema, TreeFieldFromImplicitField } from "../fieldSchema.js";
|
|
22
19
|
import {
|
|
23
20
|
type Context,
|
|
24
21
|
getOrCreateNodeFromInnerNode,
|
|
@@ -32,33 +29,31 @@ import {
|
|
|
32
29
|
throwOutOfSchema,
|
|
33
30
|
} from "../../feature-libraries/index.js";
|
|
34
31
|
import { getUnhydratedContext } from "../createContext.js";
|
|
35
|
-
import { convertField } from "../toStoredSchema.js";
|
|
36
32
|
import { unknownTypeError } from "./customTree.js";
|
|
37
33
|
|
|
38
34
|
/**
|
|
39
35
|
* Creates an unhydrated simple-tree field from a cursor in nodes mode.
|
|
40
36
|
* @remarks
|
|
41
37
|
* Does not support providing missing defaults values.
|
|
42
|
-
* Validates the field is in schema using the provided `contextForNewNodes`
|
|
38
|
+
* Validates the field is in schema using `destinationSchema` the provided `contextForNewNodes` or the default unhydrated context if not provided.
|
|
43
39
|
*/
|
|
44
40
|
export function createFromCursor<const TSchema extends ImplicitFieldSchema>(
|
|
45
41
|
schema: TSchema,
|
|
46
42
|
cursor: ITreeCursorSynchronous | undefined,
|
|
43
|
+
destinationSchema: TreeFieldStoredSchema,
|
|
47
44
|
contextForNewNodes?: Context,
|
|
48
45
|
): Unhydrated<TreeFieldFromImplicitField<TSchema>> {
|
|
49
46
|
const context = contextForNewNodes ?? getUnhydratedContext(schema);
|
|
50
47
|
assert(context.flexContext.isHydrated() === false, 0xbfe /* Expected unhydrated context */);
|
|
51
48
|
const mapTrees = cursor === undefined ? [] : [unhydratedFlexTreeFromCursor(context, cursor)];
|
|
52
49
|
|
|
53
|
-
const rootFieldSchema = convertField(normalizeFieldSchema(schema));
|
|
54
|
-
|
|
55
50
|
const schemaAndPolicy: SchemaAndPolicy = {
|
|
56
51
|
policy: defaultSchemaPolicy,
|
|
57
52
|
schema: context.flexContext.schema,
|
|
58
53
|
};
|
|
59
54
|
|
|
60
55
|
// Assuming the caller provides the correct `contextForNewNodes`, this should handle unknown optional fields.
|
|
61
|
-
isFieldInSchema(mapTrees,
|
|
56
|
+
isFieldInSchema(mapTrees, destinationSchema, schemaAndPolicy, throwOutOfSchema);
|
|
62
57
|
|
|
63
58
|
if (mapTrees.length === 0) {
|
|
64
59
|
return undefined as Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
@@ -89,11 +89,13 @@ export interface FieldDiscrepancyLocation {
|
|
|
89
89
|
export interface AllowedTypeDiscrepancy extends FieldDiscrepancyLocation {
|
|
90
90
|
readonly mismatch: "allowedTypes";
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
92
|
+
* Annotated allowed types in viewed schema
|
|
93
|
+
* (excluding {@link SchemaStaticsAlpha.staged | staged} schema) which are not allowed in stored schema.
|
|
93
94
|
*/
|
|
94
95
|
readonly view: readonly AnnotatedAllowedType<TreeNodeSchema>[];
|
|
95
96
|
/**
|
|
96
|
-
*
|
|
97
|
+
* Allowed type identifiers in stored schema which are not allowed in view schema
|
|
98
|
+
* (including the view schema's {@link SchemaStaticsAlpha.staged | staged} schema).
|
|
97
99
|
*/
|
|
98
100
|
readonly stored: readonly TreeNodeSchemaIdentifier[];
|
|
99
101
|
}
|
|
@@ -296,28 +298,28 @@ function* getNodeDiscrepancies(
|
|
|
296
298
|
|
|
297
299
|
/**
|
|
298
300
|
* Returns the allowed types that are not present in both the given view and stored schemas.
|
|
299
|
-
* It returns a tuple containing two arrays:
|
|
300
|
-
* 1. The first array contains the allowed types that are present in the view schema but not in the stored schema.
|
|
301
|
-
* 2. The second array contains the allowed types that are present in the stored schema but not in the view schema.
|
|
302
301
|
*/
|
|
303
302
|
export function findExtraAllowedTypes(
|
|
304
303
|
viewAllowedTypes: readonly AnnotatedAllowedType<TreeNodeSchema>[],
|
|
305
304
|
storedAllowedTypes: TreeTypeSet,
|
|
306
|
-
): {
|
|
307
|
-
viewExtra: readonly AnnotatedAllowedType<TreeNodeSchema>[];
|
|
308
|
-
storedExtra: TreeNodeSchemaIdentifier[];
|
|
309
|
-
} {
|
|
305
|
+
): Pick<AllowedTypeDiscrepancy, "view" | "stored"> {
|
|
310
306
|
const viewNodeSchemaIdentifiers = new Set(
|
|
311
307
|
viewAllowedTypes.map((value) => value.type.identifier),
|
|
312
308
|
);
|
|
313
309
|
|
|
314
|
-
|
|
315
|
-
|
|
310
|
+
// TODO:
|
|
311
|
+
// Add detecting which SchemaUpgrades have been made.
|
|
312
|
+
// When doing so, each will fall into one of three states: staged, partially applied, or fully applied.
|
|
313
|
+
// This would allow for nicer compatibility errors and more detailed compatibility status in the future.
|
|
314
|
+
const view = viewAllowedTypes.filter(
|
|
315
|
+
(value) =>
|
|
316
|
+
!storedAllowedTypes.has(brand(value.type.identifier)) &&
|
|
317
|
+
value.metadata.stagedSchemaUpgrade === undefined,
|
|
316
318
|
);
|
|
317
|
-
const
|
|
319
|
+
const stored = [...storedAllowedTypes].filter(
|
|
318
320
|
(value) => !viewNodeSchemaIdentifiers.has(value),
|
|
319
321
|
);
|
|
320
|
-
return {
|
|
322
|
+
return { view, stored };
|
|
321
323
|
}
|
|
322
324
|
|
|
323
325
|
/**
|
|
@@ -384,14 +386,13 @@ function* getAllowedTypeDiscrepancies(
|
|
|
384
386
|
identifier: TreeNodeSchemaIdentifier | undefined,
|
|
385
387
|
fieldKey: FieldKey | undefined,
|
|
386
388
|
): Iterable<FieldDiscrepancy> {
|
|
387
|
-
const
|
|
388
|
-
if (
|
|
389
|
+
const discrepancies = findExtraAllowedTypes(view, stored);
|
|
390
|
+
if (discrepancies.view.length > 0 || discrepancies.stored.length > 0) {
|
|
389
391
|
yield {
|
|
392
|
+
...discrepancies,
|
|
390
393
|
identifier,
|
|
391
394
|
fieldKey,
|
|
392
395
|
mismatch: "allowedTypes",
|
|
393
|
-
view: viewExtra,
|
|
394
|
-
stored: storedExtra,
|
|
395
396
|
} satisfies AllowedTypeDiscrepancy;
|
|
396
397
|
}
|
|
397
398
|
}
|
|
@@ -24,16 +24,15 @@ export type {
|
|
|
24
24
|
ITreeAlpha,
|
|
25
25
|
} from "./tree.js";
|
|
26
26
|
export { asTreeViewAlpha } from "./tree.js";
|
|
27
|
+
export { type SchemaStatics, schemaStatics } from "./schemaStatics.js";
|
|
27
28
|
export {
|
|
28
29
|
SchemaFactory,
|
|
29
30
|
type ScopedSchemaName,
|
|
30
31
|
type SchemaFactoryObjectOptions,
|
|
31
|
-
type SchemaStatics,
|
|
32
|
-
schemaStatics,
|
|
33
32
|
type NodeSchemaOptions,
|
|
34
33
|
type NodeSchemaOptionsAlpha,
|
|
35
34
|
} from "./schemaFactory.js";
|
|
36
|
-
export { SchemaFactoryAlpha } from "./schemaFactoryAlpha.js";
|
|
35
|
+
export { SchemaFactoryAlpha, type SchemaStaticsAlpha } from "./schemaFactoryAlpha.js";
|
|
37
36
|
export type {
|
|
38
37
|
ValidateRecursiveSchema,
|
|
39
38
|
FixRecursiveArraySchema,
|
|
@@ -8,7 +8,7 @@ import { allowsRepoSuperset, defaultSchemaPolicy } from "../../feature-libraries
|
|
|
8
8
|
|
|
9
9
|
import type { SchemaCompatibilityStatus } from "./tree.js";
|
|
10
10
|
import { getDiscrepanciesInAllowedContent } from "./discrepancies.js";
|
|
11
|
-
import {
|
|
11
|
+
import { toUpgradeSchema } from "../toStoredSchema.js";
|
|
12
12
|
import type { TreeSchema } from "./configuration.js";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -51,18 +51,14 @@ export class SchemaCompatibilityTester {
|
|
|
51
51
|
break;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
toStoredSchema(this.viewSchema.root),
|
|
58
|
-
);
|
|
54
|
+
const wouldUpgradeTo = toUpgradeSchema(this.viewSchema.root);
|
|
55
|
+
|
|
56
|
+
const canUpgrade = allowsRepoSuperset(policy, stored, wouldUpgradeTo);
|
|
59
57
|
|
|
60
58
|
// If true, then upgrading has no effect on what can be stored in the document.
|
|
61
59
|
// TODO: This should likely be changed to indicate up a schema upgrade would be a no-op, including stored schema metadata.
|
|
62
60
|
const isEquivalent =
|
|
63
|
-
canView &&
|
|
64
|
-
canUpgrade &&
|
|
65
|
-
allowsRepoSuperset(policy, toStoredSchema(this.viewSchema.root), stored);
|
|
61
|
+
canView && canUpgrade && allowsRepoSuperset(policy, wouldUpgradeTo, stored);
|
|
66
62
|
|
|
67
63
|
return {
|
|
68
64
|
canView,
|