@fluidframework/tree 2.63.0-359286 → 2.63.0-359734
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/.mocharc.cjs +9 -1
- package/api-report/tree.alpha.api.md +93 -98
- package/api-report/tree.beta.api.md +37 -2
- package/api-report/tree.legacy.beta.api.md +37 -2
- package/api-report/tree.legacy.public.api.md +9 -2
- package/api-report/tree.public.api.md +9 -2
- package/dist/alpha.d.ts +11 -13
- package/dist/beta.d.ts +5 -0
- package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/dist/feature-libraries/treeCursorUtils.js +17 -15
- package/dist/feature-libraries/treeCursorUtils.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 -5
- package/dist/jsonDomainSchema.js +5 -5
- package/dist/jsonDomainSchema.js.map +1 -1
- package/dist/legacy.d.ts +5 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +1 -0
- package/dist/serializableDomainSchema.d.ts +6 -6
- package/dist/serializableDomainSchema.js +5 -5
- package/dist/serializableDomainSchema.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +1 -1
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/treeAlpha.d.ts +20 -28
- package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
- package/dist/shared-tree/treeAlpha.js +4 -29
- package/dist/shared-tree/treeAlpha.js.map +1 -1
- package/dist/simple-tree/api/conciseTree.d.ts +1 -1
- package/dist/simple-tree/api/conciseTree.js.map +1 -1
- package/dist/simple-tree/api/configuration.d.ts +0 -3
- package/dist/simple-tree/api/configuration.d.ts.map +1 -1
- package/dist/simple-tree/api/configuration.js +1 -4
- package/dist/simple-tree/api/configuration.js.map +1 -1
- package/dist/simple-tree/api/customTree.d.ts +7 -7
- package/dist/simple-tree/api/customTree.js +5 -5
- package/dist/simple-tree/api/customTree.js.map +1 -1
- package/dist/simple-tree/api/discrepancies.js +2 -2
- package/dist/simple-tree/api/discrepancies.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +2 -2
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +4 -1
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactory.d.ts +12 -4
- package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactory.js +3 -8
- package/dist/simple-tree/api/schemaFactory.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +27 -26
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.js +11 -0
- package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts +13 -2
- package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaFactoryBeta.js +14 -0
- package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts +9 -14
- package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaStatics.js +9 -12
- package/dist/simple-tree/api/schemaStatics.js.map +1 -1
- package/dist/simple-tree/api/storedSchema.d.ts +2 -2
- package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/dist/simple-tree/api/storedSchema.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +37 -18
- package/dist/simple-tree/api/tree.d.ts.map +1 -1
- package/dist/simple-tree/api/tree.js.map +1 -1
- package/dist/simple-tree/api/treeBeta.d.ts +52 -2
- package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/dist/simple-tree/api/treeBeta.js +36 -1
- package/dist/simple-tree/api/treeBeta.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +1 -1
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/core/allowedTypes.d.ts +120 -62
- package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/dist/simple-tree/core/allowedTypes.js +162 -84
- package/dist/simple-tree/core/allowedTypes.js.map +1 -1
- package/dist/simple-tree/core/context.d.ts +2 -2
- package/dist/simple-tree/core/context.d.ts.map +1 -1
- package/dist/simple-tree/core/context.js.map +1 -1
- package/dist/simple-tree/core/index.d.ts +2 -2
- package/dist/simple-tree/core/index.d.ts.map +1 -1
- package/dist/simple-tree/core/index.js +4 -3
- package/dist/simple-tree/core/index.js.map +1 -1
- package/dist/simple-tree/core/toStored.d.ts +3 -3
- package/dist/simple-tree/core/toStored.d.ts.map +1 -1
- package/dist/simple-tree/core/toStored.js +2 -2
- package/dist/simple-tree/core/toStored.js.map +1 -1
- package/dist/simple-tree/core/treeNode.d.ts +1 -1
- package/dist/simple-tree/core/treeNode.js +1 -1
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +3 -3
- 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 +2 -2
- package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
- package/dist/simple-tree/core/walkSchema.d.ts +3 -3
- package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/walkSchema.js +1 -1
- package/dist/simple-tree/core/walkSchema.js.map +1 -1
- package/dist/simple-tree/createContext.js +2 -2
- package/dist/simple-tree/createContext.js.map +1 -1
- package/dist/simple-tree/fieldSchema.d.ts +9 -32
- package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
- package/dist/simple-tree/fieldSchema.js +12 -20
- 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 +6 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +2 -2
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +5 -6
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/common.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/common.js +2 -2
- package/dist/simple-tree/node-kinds/common.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.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +2 -2
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +3 -3
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +3 -3
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.d.ts +2 -2
- package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts +5 -18
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +5 -15
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +4 -11
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts +3 -3
- package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +3 -3
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +5 -5
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNodeTypes.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.map +1 -1
- package/dist/simple-tree/toStoredSchema.d.ts +8 -8
- package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/dist/simple-tree/toStoredSchema.js +5 -5
- 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/unsafeUnknownSchema.d.ts.map +1 -1
- package/dist/simple-tree/unsafeUnknownSchema.js.map +1 -1
- package/dist/simple-tree/walkFieldSchema.js +1 -1
- package/dist/simple-tree/walkFieldSchema.js.map +1 -1
- package/dist/tableSchema.d.ts +19 -19
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +2 -2
- package/dist/tableSchema.js.map +1 -1
- package/lib/alpha.d.ts +11 -13
- package/lib/beta.d.ts +5 -0
- package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
- package/lib/feature-libraries/treeCursorUtils.js +17 -15
- package/lib/feature-libraries/treeCursorUtils.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 -5
- package/lib/jsonDomainSchema.js +5 -5
- package/lib/jsonDomainSchema.js.map +1 -1
- package/lib/legacy.d.ts +5 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +1 -0
- package/lib/serializableDomainSchema.d.ts +6 -6
- package/lib/serializableDomainSchema.js +5 -5
- package/lib/serializableDomainSchema.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +1 -1
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/treeAlpha.d.ts +20 -28
- package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
- package/lib/shared-tree/treeAlpha.js +3 -28
- package/lib/shared-tree/treeAlpha.js.map +1 -1
- package/lib/simple-tree/api/conciseTree.d.ts +1 -1
- package/lib/simple-tree/api/conciseTree.js.map +1 -1
- package/lib/simple-tree/api/configuration.d.ts +0 -3
- package/lib/simple-tree/api/configuration.d.ts.map +1 -1
- package/lib/simple-tree/api/configuration.js +2 -5
- package/lib/simple-tree/api/configuration.js.map +1 -1
- package/lib/simple-tree/api/customTree.d.ts +7 -7
- package/lib/simple-tree/api/customTree.js +5 -5
- package/lib/simple-tree/api/customTree.js.map +1 -1
- package/lib/simple-tree/api/discrepancies.js +3 -3
- package/lib/simple-tree/api/discrepancies.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +2 -2
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactory.d.ts +12 -4
- package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactory.js +3 -8
- package/lib/simple-tree/api/schemaFactory.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +27 -26
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js +12 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts +13 -2
- package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaFactoryBeta.js +16 -2
- package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts +9 -14
- package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaStatics.js +9 -12
- package/lib/simple-tree/api/schemaStatics.js.map +1 -1
- package/lib/simple-tree/api/storedSchema.d.ts +2 -2
- package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
- package/lib/simple-tree/api/storedSchema.js +1 -1
- package/lib/simple-tree/api/storedSchema.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +37 -18
- package/lib/simple-tree/api/tree.d.ts.map +1 -1
- package/lib/simple-tree/api/tree.js.map +1 -1
- package/lib/simple-tree/api/treeBeta.d.ts +52 -2
- package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
- package/lib/simple-tree/api/treeBeta.js +33 -1
- package/lib/simple-tree/api/treeBeta.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +1 -1
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/core/allowedTypes.d.ts +120 -62
- package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
- package/lib/simple-tree/core/allowedTypes.js +158 -80
- package/lib/simple-tree/core/allowedTypes.js.map +1 -1
- package/lib/simple-tree/core/context.d.ts +2 -2
- package/lib/simple-tree/core/context.d.ts.map +1 -1
- package/lib/simple-tree/core/context.js.map +1 -1
- package/lib/simple-tree/core/index.d.ts +2 -2
- package/lib/simple-tree/core/index.d.ts.map +1 -1
- package/lib/simple-tree/core/index.js +1 -1
- package/lib/simple-tree/core/index.js.map +1 -1
- package/lib/simple-tree/core/toStored.d.ts +3 -3
- package/lib/simple-tree/core/toStored.d.ts.map +1 -1
- package/lib/simple-tree/core/toStored.js +3 -3
- package/lib/simple-tree/core/toStored.js.map +1 -1
- package/lib/simple-tree/core/treeNode.d.ts +1 -1
- package/lib/simple-tree/core/treeNode.js +1 -1
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +3 -3
- 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 +2 -2
- package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
- package/lib/simple-tree/core/walkSchema.d.ts +3 -3
- package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/walkSchema.js +2 -2
- package/lib/simple-tree/core/walkSchema.js.map +1 -1
- package/lib/simple-tree/createContext.js +3 -3
- package/lib/simple-tree/createContext.js.map +1 -1
- package/lib/simple-tree/fieldSchema.d.ts +9 -32
- package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
- package/lib/simple-tree/fieldSchema.js +13 -21
- 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 +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +2 -2
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +6 -7
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/common.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/common.js +3 -3
- package/lib/simple-tree/node-kinds/common.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.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +2 -2
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +4 -4
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +3 -3
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.d.ts +2 -2
- package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts +5 -18
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +6 -15
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +4 -11
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts +3 -3
- package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +4 -4
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +5 -5
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNodeTypes.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.map +1 -1
- package/lib/simple-tree/toStoredSchema.d.ts +8 -8
- package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
- package/lib/simple-tree/toStoredSchema.js +5 -5
- 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/unsafeUnknownSchema.d.ts.map +1 -1
- package/lib/simple-tree/unsafeUnknownSchema.js.map +1 -1
- package/lib/simple-tree/walkFieldSchema.js +1 -1
- package/lib/simple-tree/walkFieldSchema.js.map +1 -1
- package/lib/tableSchema.d.ts +19 -19
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +2 -2
- package/lib/tableSchema.js.map +1 -1
- package/package.json +23 -21
- package/src/feature-libraries/treeCursorUtils.ts +34 -19
- package/src/index.ts +7 -10
- package/src/jsonDomainSchema.ts +5 -5
- package/src/packageVersion.ts +1 -1
- package/src/serializableDomainSchema.ts +6 -6
- package/src/shared-tree/schematizingTreeView.ts +1 -1
- package/src/shared-tree/treeAlpha.ts +32 -81
- package/src/simple-tree/api/conciseTree.ts +1 -1
- package/src/simple-tree/api/configuration.ts +3 -7
- package/src/simple-tree/api/customTree.ts +7 -7
- package/src/simple-tree/api/discrepancies.ts +3 -3
- package/src/simple-tree/api/index.ts +10 -2
- package/src/simple-tree/api/schemaFactory.ts +18 -73
- package/src/simple-tree/api/schemaFactoryAlpha.ts +45 -12
- package/src/simple-tree/api/schemaFactoryBeta.ts +76 -1
- package/src/simple-tree/api/schemaStatics.ts +16 -61
- package/src/simple-tree/api/storedSchema.ts +2 -6
- package/src/simple-tree/api/tree.ts +37 -18
- package/src/simple-tree/api/treeBeta.ts +136 -3
- package/src/simple-tree/api/treeNodeApi.ts +1 -1
- package/src/simple-tree/core/allowedTypes.ts +355 -159
- package/src/simple-tree/core/context.ts +2 -2
- package/src/simple-tree/core/index.ts +10 -8
- package/src/simple-tree/core/toStored.ts +7 -5
- package/src/simple-tree/core/treeNode.ts +1 -1
- package/src/simple-tree/core/treeNodeSchema.ts +3 -6
- package/src/simple-tree/core/treeNodeValid.ts +2 -2
- package/src/simple-tree/core/walkSchema.ts +9 -5
- package/src/simple-tree/createContext.ts +3 -3
- package/src/simple-tree/fieldSchema.ts +24 -98
- package/src/simple-tree/index.ts +11 -10
- package/src/simple-tree/node-kinds/array/arrayNode.ts +9 -14
- package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +7 -8
- package/src/simple-tree/node-kinds/common.ts +5 -3
- package/src/simple-tree/node-kinds/index.ts +0 -2
- package/src/simple-tree/node-kinds/map/mapNode.ts +5 -13
- package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +7 -8
- package/src/simple-tree/node-kinds/object/index.ts +0 -2
- package/src/simple-tree/node-kinds/object/objectNode.ts +13 -51
- package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +5 -19
- package/src/simple-tree/node-kinds/record/recordNode.ts +9 -16
- package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +7 -11
- package/src/simple-tree/prepareForInsertion.ts +5 -5
- package/src/simple-tree/toStoredSchema.ts +8 -9
- package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +2 -6
- package/src/simple-tree/unsafeUnknownSchema.ts +2 -3
- package/src/simple-tree/walkFieldSchema.ts +1 -1
- package/src/tableSchema.ts +24 -37
|
@@ -28,7 +28,6 @@ import type {
|
|
|
28
28
|
TreeNodeSchemaBoth,
|
|
29
29
|
UnhydratedFlexTreeNode,
|
|
30
30
|
NodeSchemaMetadata,
|
|
31
|
-
UnannotateImplicitAllowedTypes,
|
|
32
31
|
ImplicitAllowedTypes,
|
|
33
32
|
InsertableTreeNodeFromImplicitAllowedTypes,
|
|
34
33
|
} from "../core/index.js";
|
|
@@ -51,7 +50,6 @@ import {
|
|
|
51
50
|
type InsertableObjectFromSchemaRecord,
|
|
52
51
|
type TreeMapNode,
|
|
53
52
|
type TreeObjectNode,
|
|
54
|
-
type UnannotateSchemaRecord,
|
|
55
53
|
} from "../node-kinds/index.js";
|
|
56
54
|
import {
|
|
57
55
|
FieldKind,
|
|
@@ -96,13 +94,13 @@ export function schemaFromValue(value: TreeValue): TreeNodeSchema {
|
|
|
96
94
|
}
|
|
97
95
|
|
|
98
96
|
/**
|
|
99
|
-
* Options when declaring an {@link SchemaFactory.object|object node}'s schema
|
|
97
|
+
* Options when declaring an {@link SchemaFactory.object|object node}'s schema.
|
|
100
98
|
*
|
|
101
99
|
* @input
|
|
102
|
-
* @
|
|
100
|
+
* @beta
|
|
103
101
|
*/
|
|
104
|
-
export interface
|
|
105
|
-
extends
|
|
102
|
+
export interface ObjectSchemaOptions<TCustomMetadata = unknown>
|
|
103
|
+
extends NodeSchemaOptions<TCustomMetadata> {
|
|
106
104
|
/**
|
|
107
105
|
* Allow nodes typed with this object node schema to contain optional fields that are not present in the schema declaration.
|
|
108
106
|
* Such nodes can come into existence either via import APIs (see remarks) or by way of collaboration with another client
|
|
@@ -151,12 +149,22 @@ export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown>
|
|
|
151
149
|
readonly allowUnknownOptionalFields?: boolean;
|
|
152
150
|
}
|
|
153
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Options when declaring an {@link SchemaFactory.object|object node}'s schema
|
|
154
|
+
*
|
|
155
|
+
* @input
|
|
156
|
+
* @alpha
|
|
157
|
+
*/
|
|
158
|
+
export interface ObjectSchemaOptionsAlpha<TCustomMetadata = unknown>
|
|
159
|
+
extends ObjectSchemaOptions<TCustomMetadata>,
|
|
160
|
+
NodeSchemaOptionsAlpha<TCustomMetadata> {}
|
|
161
|
+
|
|
154
162
|
/**
|
|
155
163
|
* Default options for Object node schema creation.
|
|
156
164
|
* @remarks Omits parameters that are not relevant for common use cases.
|
|
157
165
|
*/
|
|
158
166
|
export const defaultSchemaFactoryObjectOptions: Required<
|
|
159
|
-
Omit<
|
|
167
|
+
Omit<ObjectSchemaOptionsAlpha, "metadata" | "persistedMetadata">
|
|
160
168
|
> = {
|
|
161
169
|
allowUnknownOptionalFields: false,
|
|
162
170
|
};
|
|
@@ -389,36 +397,12 @@ export class SchemaFactory<
|
|
|
389
397
|
true,
|
|
390
398
|
T
|
|
391
399
|
> {
|
|
392
|
-
|
|
393
|
-
const object: TreeNodeSchemaClass<
|
|
394
|
-
ScopedSchemaName<TScope, Name>,
|
|
395
|
-
NodeKind.Object,
|
|
396
|
-
TreeObjectNode<UnannotateSchemaRecord<T>, ScopedSchemaName<TScope, Name>>,
|
|
397
|
-
object & InsertableObjectFromSchemaRecord<UnannotateSchemaRecord<T>>,
|
|
398
|
-
true,
|
|
399
|
-
T
|
|
400
|
-
> = objectSchema(
|
|
400
|
+
return objectSchema(
|
|
401
401
|
scoped(this, name),
|
|
402
402
|
fields,
|
|
403
403
|
true,
|
|
404
404
|
defaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,
|
|
405
405
|
);
|
|
406
|
-
|
|
407
|
-
return object as TreeNodeSchemaClass<
|
|
408
|
-
ScopedSchemaName<TScope, Name>,
|
|
409
|
-
NodeKind.Object,
|
|
410
|
-
TreeObjectNode<RestrictiveStringRecord<ImplicitFieldSchema>>,
|
|
411
|
-
unknown,
|
|
412
|
-
true,
|
|
413
|
-
T
|
|
414
|
-
> as TreeNodeSchemaClass<
|
|
415
|
-
ScopedSchemaName<TScope, Name>,
|
|
416
|
-
NodeKind.Object,
|
|
417
|
-
TreeObjectNode<T, ScopedSchemaName<TScope, Name>>,
|
|
418
|
-
object & InsertableObjectFromSchemaRecord<T>,
|
|
419
|
-
true,
|
|
420
|
-
T
|
|
421
|
-
>;
|
|
422
406
|
}
|
|
423
407
|
|
|
424
408
|
/**
|
|
@@ -545,17 +529,7 @@ export class SchemaFactory<
|
|
|
545
529
|
T,
|
|
546
530
|
undefined
|
|
547
531
|
> {
|
|
548
|
-
|
|
549
|
-
const map: TreeNodeSchemaBoth<
|
|
550
|
-
ScopedSchemaName<TScope, Name>,
|
|
551
|
-
NodeKind.Map,
|
|
552
|
-
TreeMapNode<UnannotateImplicitAllowedTypes<T>> &
|
|
553
|
-
WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,
|
|
554
|
-
MapNodeInsertableData<UnannotateImplicitAllowedTypes<T>>,
|
|
555
|
-
ImplicitlyConstructable,
|
|
556
|
-
T,
|
|
557
|
-
undefined
|
|
558
|
-
> = mapSchema(
|
|
532
|
+
return mapSchema(
|
|
559
533
|
scoped(this, name),
|
|
560
534
|
allowedTypes,
|
|
561
535
|
implicitlyConstructable,
|
|
@@ -563,25 +537,6 @@ export class SchemaFactory<
|
|
|
563
537
|
!customizable,
|
|
564
538
|
undefined,
|
|
565
539
|
);
|
|
566
|
-
|
|
567
|
-
return map as TreeNodeSchemaBoth<
|
|
568
|
-
ScopedSchemaName<TScope, Name>,
|
|
569
|
-
NodeKind.Map,
|
|
570
|
-
TreeMapNode<UnannotateImplicitAllowedTypes<T>> &
|
|
571
|
-
WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,
|
|
572
|
-
MapNodeInsertableData<ImplicitAllowedTypes>,
|
|
573
|
-
ImplicitlyConstructable,
|
|
574
|
-
T,
|
|
575
|
-
undefined
|
|
576
|
-
> as TreeNodeSchemaBoth<
|
|
577
|
-
ScopedSchemaName<TScope, Name>,
|
|
578
|
-
NodeKind.Map,
|
|
579
|
-
TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>,
|
|
580
|
-
MapNodeInsertableData<T>,
|
|
581
|
-
ImplicitlyConstructable,
|
|
582
|
-
T,
|
|
583
|
-
undefined
|
|
584
|
-
>;
|
|
585
540
|
}
|
|
586
541
|
|
|
587
542
|
/**
|
|
@@ -757,22 +712,12 @@ export class SchemaFactory<
|
|
|
757
712
|
T,
|
|
758
713
|
undefined
|
|
759
714
|
> {
|
|
760
|
-
|
|
715
|
+
return arraySchema(
|
|
761
716
|
scoped(this, name),
|
|
762
717
|
allowedTypes,
|
|
763
718
|
implicitlyConstructable,
|
|
764
719
|
customizable,
|
|
765
720
|
);
|
|
766
|
-
|
|
767
|
-
return array as TreeNodeSchemaBoth<
|
|
768
|
-
ScopedSchemaName<TScope, Name>,
|
|
769
|
-
NodeKind.Array,
|
|
770
|
-
TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, string>, NodeKind.Array>,
|
|
771
|
-
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
772
|
-
ImplicitlyConstructable,
|
|
773
|
-
T,
|
|
774
|
-
undefined
|
|
775
|
-
>;
|
|
776
721
|
}
|
|
777
722
|
|
|
778
723
|
/**
|
|
@@ -17,23 +17,28 @@ import {
|
|
|
17
17
|
defaultSchemaFactoryObjectOptions,
|
|
18
18
|
scoped,
|
|
19
19
|
type NodeSchemaOptionsAlpha,
|
|
20
|
-
type
|
|
20
|
+
type ObjectSchemaOptionsAlpha,
|
|
21
21
|
type ScopedSchemaName,
|
|
22
22
|
} from "./schemaFactory.js";
|
|
23
23
|
import { schemaStatics } from "./schemaStatics.js";
|
|
24
|
-
import type {
|
|
24
|
+
import type { ImplicitFieldSchema } from "../fieldSchema.js";
|
|
25
25
|
import type { RestrictiveStringRecord } from "../../util/index.js";
|
|
26
26
|
import type {
|
|
27
27
|
NodeKind,
|
|
28
28
|
TreeNodeSchema,
|
|
29
29
|
TreeNodeSchemaClass,
|
|
30
30
|
ImplicitAllowedTypes,
|
|
31
|
-
ImplicitAnnotatedAllowedTypes,
|
|
32
31
|
AnnotatedAllowedType,
|
|
33
32
|
LazyItem,
|
|
34
33
|
WithType,
|
|
34
|
+
AllowedTypesMetadata,
|
|
35
|
+
AllowedTypesFullFromMixed,
|
|
36
|
+
} from "../core/index.js";
|
|
37
|
+
import {
|
|
38
|
+
normalizeToAnnotatedAllowedType,
|
|
39
|
+
createSchemaUpgrade,
|
|
40
|
+
AnnotatedAllowedTypesInternal,
|
|
35
41
|
} from "../core/index.js";
|
|
36
|
-
import { normalizeToAnnotatedAllowedType, createSchemaUpgrade } from "../core/index.js";
|
|
37
42
|
import type {
|
|
38
43
|
ArrayNodeCustomizableSchemaUnsafe,
|
|
39
44
|
MapNodeCustomizableSchemaUnsafe,
|
|
@@ -53,7 +58,6 @@ import type {
|
|
|
53
58
|
} from "../fieldSchema.js";
|
|
54
59
|
import type { LeafSchema } from "../leafNodeSchema.js";
|
|
55
60
|
import type { SimpleLeafNodeSchema } from "../simpleSchema.js";
|
|
56
|
-
import type { UnannotateImplicitAllowedTypes } from "../core/index.js";
|
|
57
61
|
import type { FieldSchemaAlphaUnsafe } from "./typesUnsafe.js";
|
|
58
62
|
/* eslint-enable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import/no-duplicates */
|
|
59
63
|
|
|
@@ -94,9 +98,21 @@ export interface SchemaStaticsAlpha {
|
|
|
94
98
|
*
|
|
95
99
|
* TODO: AB#45711: Update the docs above when recursive type support is added.
|
|
96
100
|
*/
|
|
97
|
-
staged: <const T extends LazyItem<TreeNodeSchema>>(
|
|
101
|
+
readonly staged: <const T extends LazyItem<TreeNodeSchema>>(
|
|
98
102
|
t: T | AnnotatedAllowedType<T>,
|
|
99
103
|
) => AnnotatedAllowedType<T>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Normalize information about a set of {@link AllowedTypes} into an {@link AllowedTypesFull}.
|
|
107
|
+
* @remarks
|
|
108
|
+
* This can take in {@link AnnotatedAllowedType} to preserve their annotations.
|
|
109
|
+
*/
|
|
110
|
+
readonly types: <
|
|
111
|
+
const T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[],
|
|
112
|
+
>(
|
|
113
|
+
t: T,
|
|
114
|
+
metadata?: AllowedTypesMetadata,
|
|
115
|
+
) => AllowedTypesFullFromMixed<T>;
|
|
100
116
|
}
|
|
101
117
|
|
|
102
118
|
const schemaStaticsAlpha: SchemaStaticsAlpha = {
|
|
@@ -112,6 +128,13 @@ const schemaStaticsAlpha: SchemaStaticsAlpha = {
|
|
|
112
128
|
},
|
|
113
129
|
};
|
|
114
130
|
},
|
|
131
|
+
|
|
132
|
+
types: <const T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]>(
|
|
133
|
+
t: T,
|
|
134
|
+
metadata: AllowedTypesMetadata = {},
|
|
135
|
+
): AllowedTypesFullFromMixed<T> => {
|
|
136
|
+
return AnnotatedAllowedTypesInternal.createMixed<T>(t, metadata);
|
|
137
|
+
},
|
|
115
138
|
};
|
|
116
139
|
|
|
117
140
|
/**
|
|
@@ -136,12 +159,12 @@ export class SchemaFactoryAlpha<
|
|
|
136
159
|
*/
|
|
137
160
|
public objectAlpha<
|
|
138
161
|
const Name extends TName,
|
|
139
|
-
const T extends RestrictiveStringRecord<
|
|
162
|
+
const T extends RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
140
163
|
const TCustomMetadata = unknown,
|
|
141
164
|
>(
|
|
142
165
|
name: Name,
|
|
143
166
|
fields: T,
|
|
144
|
-
options?:
|
|
167
|
+
options?: ObjectSchemaOptionsAlpha<TCustomMetadata>,
|
|
145
168
|
): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> & {
|
|
146
169
|
/**
|
|
147
170
|
* Typing checking workaround: not for for actual use.
|
|
@@ -176,7 +199,7 @@ export class SchemaFactoryAlpha<
|
|
|
176
199
|
>(
|
|
177
200
|
name: Name,
|
|
178
201
|
t: T,
|
|
179
|
-
options?:
|
|
202
|
+
options?: ObjectSchemaOptionsAlpha<TCustomMetadata>,
|
|
180
203
|
): TreeNodeSchemaClass<
|
|
181
204
|
ScopedSchemaName<TScope, Name>,
|
|
182
205
|
NodeKind.Object,
|
|
@@ -287,6 +310,16 @@ export class SchemaFactoryAlpha<
|
|
|
287
310
|
*/
|
|
288
311
|
public staged = schemaStaticsAlpha.staged;
|
|
289
312
|
|
|
313
|
+
/**
|
|
314
|
+
* {@inheritDoc SchemaStaticsAlpha.types}
|
|
315
|
+
*/
|
|
316
|
+
public static types = schemaStaticsAlpha.types;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* {@inheritDoc SchemaStaticsAlpha.types}
|
|
320
|
+
*/
|
|
321
|
+
public types = schemaStaticsAlpha.types;
|
|
322
|
+
|
|
290
323
|
/**
|
|
291
324
|
* Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.
|
|
292
325
|
*
|
|
@@ -303,7 +336,7 @@ export class SchemaFactoryAlpha<
|
|
|
303
336
|
*/
|
|
304
337
|
public mapAlpha<
|
|
305
338
|
Name extends TName,
|
|
306
|
-
const T extends
|
|
339
|
+
const T extends ImplicitAllowedTypes,
|
|
307
340
|
const TCustomMetadata = unknown,
|
|
308
341
|
>(
|
|
309
342
|
name: Name,
|
|
@@ -354,7 +387,7 @@ export class SchemaFactoryAlpha<
|
|
|
354
387
|
*/
|
|
355
388
|
public arrayAlpha<
|
|
356
389
|
const Name extends TName,
|
|
357
|
-
const T extends
|
|
390
|
+
const T extends ImplicitAllowedTypes,
|
|
358
391
|
const TCustomMetadata = unknown,
|
|
359
392
|
>(
|
|
360
393
|
name: Name,
|
|
@@ -405,7 +438,7 @@ export class SchemaFactoryAlpha<
|
|
|
405
438
|
*/
|
|
406
439
|
public recordAlpha<
|
|
407
440
|
const Name extends TName,
|
|
408
|
-
const T extends
|
|
441
|
+
const T extends ImplicitAllowedTypes,
|
|
409
442
|
const TCustomMetadata = unknown,
|
|
410
443
|
>(
|
|
411
444
|
name: Name,
|
|
@@ -14,15 +14,20 @@ import type {
|
|
|
14
14
|
} from "../core/index.js";
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
|
+
objectSchema,
|
|
17
18
|
recordSchema,
|
|
19
|
+
type InsertableObjectFromSchemaRecord,
|
|
18
20
|
type RecordNodeInsertableData,
|
|
21
|
+
type TreeObjectNode,
|
|
19
22
|
type TreeRecordNode,
|
|
20
23
|
} from "../node-kinds/index.js";
|
|
21
24
|
import {
|
|
25
|
+
defaultSchemaFactoryObjectOptions,
|
|
22
26
|
SchemaFactory,
|
|
23
27
|
scoped,
|
|
24
28
|
structuralName,
|
|
25
29
|
type NodeSchemaOptions,
|
|
30
|
+
type ObjectSchemaOptions,
|
|
26
31
|
type ScopedSchemaName,
|
|
27
32
|
} from "./schemaFactory.js";
|
|
28
33
|
import type { System_Unsafe, TreeRecordNodeUnsafe } from "./typesUnsafe.js";
|
|
@@ -34,9 +39,11 @@ import type {
|
|
|
34
39
|
FieldSchemaAlpha,
|
|
35
40
|
FieldPropsAlpha,
|
|
36
41
|
FieldKind,
|
|
42
|
+
ImplicitFieldSchema,
|
|
37
43
|
} from "../fieldSchema.js";
|
|
38
44
|
import type { LeafSchema } from "../leafNodeSchema.js";
|
|
39
45
|
import type { SimpleLeafNodeSchema } from "../simpleSchema.js";
|
|
46
|
+
import type { RestrictiveStringRecord } from "../../util/index.js";
|
|
40
47
|
/* eslint-enable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import/no-duplicates */
|
|
41
48
|
|
|
42
49
|
/**
|
|
@@ -57,7 +64,73 @@ export class SchemaFactoryBeta<
|
|
|
57
64
|
public scopedFactory<const T extends TName, TNameInner extends number | string = string>(
|
|
58
65
|
name: T,
|
|
59
66
|
): SchemaFactoryBeta<ScopedSchemaName<TScope, T>, TNameInner> {
|
|
60
|
-
return new SchemaFactoryBeta(scoped(this, name));
|
|
67
|
+
return new SchemaFactoryBeta(scoped<TScope, TName, T>(this, name));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.
|
|
72
|
+
*
|
|
73
|
+
* @param name - Unique identifier for this schema within this factory's scope.
|
|
74
|
+
* @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.
|
|
75
|
+
* @param options - Additional options for the schema.
|
|
76
|
+
*/
|
|
77
|
+
public override object<
|
|
78
|
+
const Name extends TName,
|
|
79
|
+
const T extends RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
80
|
+
const TCustomMetadata = unknown,
|
|
81
|
+
>(
|
|
82
|
+
name: Name,
|
|
83
|
+
fields: T,
|
|
84
|
+
options?: ObjectSchemaOptions<TCustomMetadata>,
|
|
85
|
+
): TreeNodeSchemaClass<
|
|
86
|
+
ScopedSchemaName<TScope, Name>,
|
|
87
|
+
NodeKind.Object,
|
|
88
|
+
TreeObjectNode<T, ScopedSchemaName<TScope, Name>>,
|
|
89
|
+
object & InsertableObjectFromSchemaRecord<T>,
|
|
90
|
+
true,
|
|
91
|
+
T
|
|
92
|
+
> {
|
|
93
|
+
return objectSchema(
|
|
94
|
+
scoped<TScope, TName, Name>(this, name),
|
|
95
|
+
fields,
|
|
96
|
+
true,
|
|
97
|
+
options?.allowUnknownOptionalFields ??
|
|
98
|
+
defaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,
|
|
99
|
+
options?.metadata,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public override objectRecursive<
|
|
104
|
+
const Name extends TName,
|
|
105
|
+
const T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>,
|
|
106
|
+
const TCustomMetadata = unknown,
|
|
107
|
+
>(
|
|
108
|
+
name: Name,
|
|
109
|
+
t: T,
|
|
110
|
+
options?: ObjectSchemaOptions<TCustomMetadata>,
|
|
111
|
+
): TreeNodeSchemaClass<
|
|
112
|
+
ScopedSchemaName<TScope, Name>,
|
|
113
|
+
NodeKind.Object,
|
|
114
|
+
System_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,
|
|
115
|
+
object & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,
|
|
116
|
+
false,
|
|
117
|
+
T
|
|
118
|
+
> {
|
|
119
|
+
type TScopedName = ScopedSchemaName<TScope, Name>;
|
|
120
|
+
return this.object(
|
|
121
|
+
name,
|
|
122
|
+
t as T & RestrictiveStringRecord<ImplicitFieldSchema>,
|
|
123
|
+
options,
|
|
124
|
+
) as unknown as TreeNodeSchemaClass<
|
|
125
|
+
TScopedName,
|
|
126
|
+
NodeKind.Object,
|
|
127
|
+
System_Unsafe.TreeObjectNodeUnsafe<T, TScopedName>,
|
|
128
|
+
object & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,
|
|
129
|
+
false,
|
|
130
|
+
T,
|
|
131
|
+
never,
|
|
132
|
+
TCustomMetadata
|
|
133
|
+
>;
|
|
61
134
|
}
|
|
62
135
|
|
|
63
136
|
/**
|
|
@@ -113,6 +186,7 @@ export class SchemaFactoryBeta<
|
|
|
113
186
|
/* Info */ T,
|
|
114
187
|
/* TConstructorExtra */ undefined
|
|
115
188
|
>;
|
|
189
|
+
|
|
116
190
|
/**
|
|
117
191
|
* Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeRecordNode:interface)}.
|
|
118
192
|
*
|
|
@@ -149,6 +223,7 @@ export class SchemaFactoryBeta<
|
|
|
149
223
|
/* Info */ T,
|
|
150
224
|
/* TConstructorExtra */ undefined
|
|
151
225
|
>;
|
|
226
|
+
|
|
152
227
|
/**
|
|
153
228
|
* {@link SchemaFactoryBeta.record} implementation.
|
|
154
229
|
*
|
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
7
|
-
import type {
|
|
8
|
-
ImplicitAllowedTypes,
|
|
9
|
-
ImplicitAnnotatedAllowedTypes,
|
|
10
|
-
UnannotateImplicitAllowedTypes,
|
|
11
|
-
} from "../core/index.js";
|
|
7
|
+
import type { ImplicitAllowedTypes } from "../core/index.js";
|
|
12
8
|
import { FieldKind, getDefaultProvider, createFieldSchema } from "../fieldSchema.js";
|
|
13
9
|
import type {
|
|
14
10
|
FieldProps,
|
|
@@ -165,60 +161,6 @@ export interface SchemaStatics {
|
|
|
165
161
|
|
|
166
162
|
const defaultOptionalProvider: DefaultProvider = getDefaultProvider(() => []);
|
|
167
163
|
|
|
168
|
-
// The following overloads for optional and required are used to get around the fact that
|
|
169
|
-
// the compiler can't infer that UnannotateImplicitAllowedTypes<T> is equal to T when T is known to extend ImplicitAllowedTypes
|
|
170
|
-
|
|
171
|
-
// #region Overloads for optional and required
|
|
172
|
-
function optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
173
|
-
t: T,
|
|
174
|
-
props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider">,
|
|
175
|
-
): FieldSchemaAlpha<FieldKind.Optional, T, TCustomMetadata>;
|
|
176
|
-
|
|
177
|
-
function optional<
|
|
178
|
-
const T extends ImplicitAnnotatedAllowedTypes,
|
|
179
|
-
const TCustomMetadata = unknown,
|
|
180
|
-
>(
|
|
181
|
-
t: T,
|
|
182
|
-
props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider">,
|
|
183
|
-
): FieldSchemaAlpha<FieldKind.Optional, UnannotateImplicitAllowedTypes<T>, TCustomMetadata>;
|
|
184
|
-
|
|
185
|
-
function optional<
|
|
186
|
-
const T extends ImplicitAnnotatedAllowedTypes,
|
|
187
|
-
const TCustomMetadata = unknown,
|
|
188
|
-
>(
|
|
189
|
-
t: T,
|
|
190
|
-
props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider">,
|
|
191
|
-
): FieldSchemaAlpha<FieldKind.Optional, UnannotateImplicitAllowedTypes<T>, TCustomMetadata> {
|
|
192
|
-
return createFieldSchema(FieldKind.Optional, t, {
|
|
193
|
-
defaultProvider: defaultOptionalProvider,
|
|
194
|
-
...props,
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
199
|
-
t: T,
|
|
200
|
-
props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider">,
|
|
201
|
-
): FieldSchemaAlpha<FieldKind.Required, T, TCustomMetadata>;
|
|
202
|
-
|
|
203
|
-
function required<
|
|
204
|
-
const T extends ImplicitAnnotatedAllowedTypes,
|
|
205
|
-
const TCustomMetadata = unknown,
|
|
206
|
-
>(
|
|
207
|
-
t: T,
|
|
208
|
-
props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider">,
|
|
209
|
-
): FieldSchemaAlpha<FieldKind.Required, UnannotateImplicitAllowedTypes<T>, TCustomMetadata>;
|
|
210
|
-
|
|
211
|
-
function required<
|
|
212
|
-
const T extends ImplicitAnnotatedAllowedTypes,
|
|
213
|
-
const TCustomMetadata = unknown,
|
|
214
|
-
>(
|
|
215
|
-
t: T,
|
|
216
|
-
props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider">,
|
|
217
|
-
): FieldSchemaAlpha<FieldKind.Required, UnannotateImplicitAllowedTypes<T>, TCustomMetadata> {
|
|
218
|
-
return createFieldSchema(FieldKind.Required, t, props);
|
|
219
|
-
}
|
|
220
|
-
// #endregion
|
|
221
|
-
|
|
222
164
|
/**
|
|
223
165
|
* Implementation of {@link SchemaStatics}.
|
|
224
166
|
* @remarks
|
|
@@ -233,9 +175,22 @@ export const schemaStaticsStable = {
|
|
|
233
175
|
handle: handleSchema,
|
|
234
176
|
leaves: [stringSchema, numberSchema, booleanSchema, nullSchema, handleSchema],
|
|
235
177
|
|
|
236
|
-
optional,
|
|
178
|
+
optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
179
|
+
t: T,
|
|
180
|
+
props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider">,
|
|
181
|
+
): FieldSchemaAlpha<FieldKind.Optional, T, TCustomMetadata> => {
|
|
182
|
+
return createFieldSchema(FieldKind.Optional, t, {
|
|
183
|
+
defaultProvider: defaultOptionalProvider,
|
|
184
|
+
...props,
|
|
185
|
+
});
|
|
186
|
+
},
|
|
237
187
|
|
|
238
|
-
required,
|
|
188
|
+
required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(
|
|
189
|
+
t: T,
|
|
190
|
+
props?: Omit<FieldPropsAlpha<TCustomMetadata>, "defaultProvider">,
|
|
191
|
+
): FieldSchemaAlpha<FieldKind.Required, T, TCustomMetadata> => {
|
|
192
|
+
return createFieldSchema(FieldKind.Required, t, props);
|
|
193
|
+
},
|
|
239
194
|
|
|
240
195
|
optionalRecursive: <
|
|
241
196
|
const T extends System_Unsafe.ImplicitAllowedTypesUnsafe,
|
|
@@ -13,11 +13,7 @@ import {
|
|
|
13
13
|
} from "../../feature-libraries/schema-index/index.js";
|
|
14
14
|
import type { JsonCompatible } from "../../util/index.js";
|
|
15
15
|
import type { SchemaUpgrade } from "../core/index.js";
|
|
16
|
-
import {
|
|
17
|
-
normalizeFieldSchema,
|
|
18
|
-
type ImplicitAnnotatedFieldSchema,
|
|
19
|
-
type ImplicitFieldSchema,
|
|
20
|
-
} from "../fieldSchema.js";
|
|
16
|
+
import { normalizeFieldSchema, type ImplicitFieldSchema } from "../fieldSchema.js";
|
|
21
17
|
import { toStoredSchema } from "../toStoredSchema.js";
|
|
22
18
|
import { TreeViewConfigurationAlpha } from "./configuration.js";
|
|
23
19
|
|
|
@@ -57,7 +53,7 @@ import type { SchemaCompatibilityStatus } from "./tree.js";
|
|
|
57
53
|
* @alpha
|
|
58
54
|
*/
|
|
59
55
|
export function extractPersistedSchema(
|
|
60
|
-
schema:
|
|
56
|
+
schema: ImplicitFieldSchema,
|
|
61
57
|
oldestCompatibleClient: FluidClientVersion,
|
|
62
58
|
includeStaged: (upgrade: SchemaUpgrade) => boolean,
|
|
63
59
|
): JsonCompatible {
|
|
@@ -322,18 +322,25 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
|
|
|
322
322
|
readonly compatibility: SchemaCompatibilityStatus;
|
|
323
323
|
|
|
324
324
|
/**
|
|
325
|
-
* When
|
|
325
|
+
* When {@link SchemaCompatibilityStatus.canUpgrade} is true,
|
|
326
326
|
* this can be used to modify the stored schema to make it match the view schema.
|
|
327
|
-
* This will update the compatibility state, and allow access to `root`.
|
|
328
|
-
* Beware that this may impact other clients' ability to view the document depending on the application's schema compatibility policy!
|
|
329
327
|
* @remarks
|
|
330
|
-
*
|
|
328
|
+
* This will update the {@link TreeView.compatibility}, allowing access to `root`.
|
|
329
|
+
* Beware that this may impact other clients' ability to view the document: see {@link SchemaCompatibilityStatus.canView} for more information.
|
|
330
|
+
*
|
|
331
|
+
* It is an error to call this when {@link SchemaCompatibilityStatus.canUpgrade} is false.
|
|
332
|
+
* {@link SchemaCompatibilityStatus.canUpgrade} being true does not mean that an upgrade is required, nor that an upgrade will have any effect.
|
|
331
333
|
* @privateRemarks
|
|
332
334
|
* In the future, more upgrade options could be provided here.
|
|
333
335
|
* Some options that could be added:
|
|
334
336
|
* - check the actual document contents (not just the schema) and attempt an atomic document update if the data is compatible.
|
|
335
337
|
* - apply converters and upgrade the document.
|
|
336
338
|
* - apply converters to lazily to adapt the document to the requested view schema (with optional lazy schema updates or transparent conversions on write).
|
|
339
|
+
* - update only a specific change (add an optional field, or apply a staged upgrade)
|
|
340
|
+
* - update persistedMetadata or not
|
|
341
|
+
*
|
|
342
|
+
* As persisted metadata becomes more supported, how it interacts with isEquivalent and upgradeSchema should be clarified:
|
|
343
|
+
* for now the docs are being left somewhat vague to allow flexibility in this area.
|
|
337
344
|
*/
|
|
338
345
|
upgradeSchema(): void;
|
|
339
346
|
|
|
@@ -382,6 +389,8 @@ export interface TreeViewAlpha<
|
|
|
382
389
|
* Information about a view schema's compatibility with the document's stored schema.
|
|
383
390
|
*
|
|
384
391
|
* See SharedTree's README for more information about choosing a compatibility policy.
|
|
392
|
+
* @privateRemarks
|
|
393
|
+
* See {@link SchemaCompatibilityTester} for the implementation of this compatibility checking.
|
|
385
394
|
* @sealed @public
|
|
386
395
|
*/
|
|
387
396
|
export interface SchemaCompatibilityStatus {
|
|
@@ -396,38 +405,41 @@ export interface SchemaCompatibilityStatus {
|
|
|
396
405
|
*
|
|
397
406
|
* - schema repository `A` has extra schema which schema `B` doesn't have, but they are unused (i.e. not reachable from the root schema)
|
|
398
407
|
*
|
|
399
|
-
* - field in schema `A` has allowed field members which the corresponding field in schema `B` does not have, but those types are not constructible (
|
|
408
|
+
* - field in schema `A` has allowed field members which the corresponding field in schema `B` does not have, but those types are not constructible (for example: an object node type containing a required field with no allowed types)
|
|
400
409
|
*
|
|
401
410
|
* These cases are typically not interesting to applications.
|
|
411
|
+
*
|
|
412
|
+
* Note that other content in the stored schema that does not impact document compatibility, like {@link NodeSchemaOptionsAlpha.persistedMetadata}, does not affect this field.
|
|
413
|
+
*
|
|
414
|
+
* For the computation of this equivalence, {@link SchemaStaticsAlpha.staged | staged} schemas are not included.
|
|
415
|
+
* If there are any unknown optional fields, even if allowed by {@link ObjectSchemaOptions.allowUnknownOptionalFields}, `isEquivalent` will be false.
|
|
402
416
|
*/
|
|
403
417
|
readonly isEquivalent: boolean;
|
|
404
418
|
|
|
405
419
|
/**
|
|
406
420
|
* Whether the current view schema is sufficiently compatible with the stored schema to allow viewing tree data.
|
|
407
421
|
* If false, {@link TreeView.root} will throw upon access.
|
|
422
|
+
* @remarks
|
|
423
|
+
* If the view schema does not opt into supporting any additional cases, then `canView` is only true when `isEquivalent` is also true.
|
|
424
|
+
* The view schema can however opt into supporting additional cases, and thus can also view documents with stored schema which would be equivalent, except for the following discrepancies:
|
|
408
425
|
*
|
|
409
|
-
*
|
|
410
|
-
* Do not rely on this:
|
|
411
|
-
* there are near-term plans to extend support for viewing documents when the stored schema contains additional optional fields not present in the view schema.
|
|
412
|
-
* The other two types of backward-compatible changes (field relaxations and addition of allowed field types) will eventually be supported as well,
|
|
413
|
-
* likely through out-of-schema content adapters that the application can provide alongside their view schema.
|
|
426
|
+
* - An object node with {@link ObjectSchemaOptions.allowUnknownOptionalFields} to set to true that has additional optional fields in the stored schema beyond those mentioned in its view schema.
|
|
414
427
|
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
428
|
+
* - An additional type allowed at a location in the stored schema where it is {@link SchemaStaticsAlpha.staged | staged} in the view schema.
|
|
429
|
+
*
|
|
430
|
+
* In these cases `canUpgrade` and `isEquivalent` will be false.
|
|
418
431
|
*
|
|
419
|
-
* @remarks
|
|
420
432
|
* When the documents allowed by the view schema is a strict superset of those by the stored schema,
|
|
421
|
-
*
|
|
433
|
+
* `canView` is false because writes to the document using the view schema could make the document violate its stored schema.
|
|
422
434
|
* In this case, the stored schema could be updated to match the provided view schema, allowing read-write access to the tree.
|
|
423
435
|
* See {@link SchemaCompatibilityStatus.canUpgrade}.
|
|
424
436
|
*
|
|
425
|
-
* Future
|
|
437
|
+
* Future versions of SharedTree may provide readonly access to the document in this case because that would be safe,
|
|
426
438
|
* but this is not currently supported.
|
|
427
439
|
*
|
|
428
440
|
* @privateRemarks
|
|
429
441
|
* A necessary condition for this to be true is that the documents allowed by the view schema are a subset of those allowed by the stored schema.
|
|
430
|
-
* This is not sufficient: the simple-tree layer's read APIs
|
|
442
|
+
* This is not sufficient: the simple-tree layer's read APIs only tolerate very specific cases beyond their schema (unknown optional fields).
|
|
431
443
|
* For example, if the view schema for a node has a required `Point` field but the stored schema has an optional `Point` field,
|
|
432
444
|
* read APIs on the view schema do not work correctly when the document has a node with a missing `Point` field.
|
|
433
445
|
* Similar issues happen when the view schema has a field with less allowed types than the stored schema and the document actually leverages those types.
|
|
@@ -435,8 +447,15 @@ export interface SchemaCompatibilityStatus {
|
|
|
435
447
|
readonly canView: boolean;
|
|
436
448
|
|
|
437
449
|
/**
|
|
438
|
-
* True
|
|
450
|
+
* True when {@link TreeView.upgradeSchema} can add support for all content required to be supported by the view schema.
|
|
451
|
+
* @remarks
|
|
439
452
|
* When true, it is valid to call {@link TreeView.upgradeSchema} (though if the stored schema is already an exact match, this is a no-op).
|
|
453
|
+
*
|
|
454
|
+
* When adding optional fields to schema which previously were marked with {@link ObjectSchemaOptions.allowUnknownOptionalFields}
|
|
455
|
+
* the schema upgrade (assuming no other changes are included) will allow the previous version to view.
|
|
456
|
+
* Even this case must still must be done with caution however as only clients with the newly added field will be able to do future upgrades.
|
|
457
|
+
* Thus if a version of an application is shipped that adds an unknown optional field, all future versions should include it, even if its no longer used,
|
|
458
|
+
* to ensure that documents containing it can still be upgraded.
|
|
440
459
|
*/
|
|
441
460
|
readonly canUpgrade: boolean;
|
|
442
461
|
|