@fluidframework/tree 2.52.0 → 2.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +14 -2
- package/CHANGELOG.md +125 -0
- package/api-report/tree.alpha.api.md +48 -41
- package/dist/alpha.d.ts +2 -1
- package/dist/core/tree/visitDelta.d.ts +1 -1
- package/dist/core/tree/visitDelta.d.ts.map +1 -1
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.d.ts +1 -0
- package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/index.js +3 -1
- package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +2 -4
- package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
- package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -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/default-schema/noChangeCodecs.d.ts +1 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/noChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +4 -0
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +5 -5
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +1 -1
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +4 -2
- package/dist/feature-libraries/index.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/modularChangeCodecs.js +1 -0
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.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/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/dist/feature-libraries/sequence-field/types.d.ts +1 -1
- package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/dist/feature-libraries/sequence-field/types.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/jsonDomainSchema.d.ts +5 -3
- package/dist/jsonDomainSchema.d.ts.map +1 -1
- package/dist/jsonDomainSchema.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +1 -1
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +0 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizeTree.d.ts +23 -60
- package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
- package/dist/shared-tree/schematizeTree.js +59 -151
- 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 +11 -11
- 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/shared-tree-core/defaultResubmitMachine.d.ts +2 -1
- package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/dist/shared-tree-core/defaultResubmitMachine.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 +46 -30
- 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/treeNode.d.ts +0 -3
- package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNode.js +3 -3
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.d.ts +7 -2
- package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts +6 -1
- package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeValid.js +11 -6
- 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 +2 -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 +9 -2
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +1 -0
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +18 -4
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/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/dist/tableSchema.d.ts +25 -32
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +10 -24
- package/dist/tableSchema.js.map +1 -1
- package/docs/.attachments/cell-ordering/C-knows-of-ABC.png +0 -0
- package/docs/.attachments/cell-ordering/C-knows-of-C.png +0 -0
- package/docs/.attachments/cell-ordering/XvsA.png +0 -0
- package/docs/.attachments/cell-ordering/compose-a-b.png +0 -0
- package/docs/.attachments/cell-ordering/compose-a-ref-p1-b-ref-p2.png +0 -0
- package/docs/.attachments/cell-ordering/compose-b-no-ref-to-ca.png +0 -0
- package/docs/.attachments/cell-ordering/rebase-ab-over-x.png +0 -0
- package/docs/.attachments/cell-ordering/rebase-b-over-x.png +0 -0
- package/docs/.attachments/cell-ordering/rebase-b2-over-x.png +0 -0
- package/docs/.attachments/cell-ordering/rebase-b2.png +0 -0
- package/docs/.attachments/cell-ordering/rebase-to-abprime.png +0 -0
- package/docs/.attachments/cell-ordering/rebase-to-bprime.png +0 -0
- package/docs/main/cell-ordering.md +638 -0
- package/lib/alpha.d.ts +2 -1
- package/lib/core/tree/visitDelta.d.ts +1 -1
- package/lib/core/tree/visitDelta.d.ts.map +1 -1
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.d.ts +1 -0
- package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/index.js +1 -0
- package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +2 -4
- package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js +4 -1
- package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -0
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.d.ts +1 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/noChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +4 -0
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +1 -1
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +1 -1
- package/lib/feature-libraries/index.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/modularChangeCodecs.js +1 -0
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.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/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
- package/lib/feature-libraries/sequence-field/types.d.ts +1 -1
- package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
- package/lib/feature-libraries/sequence-field/types.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +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.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +2 -2
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +0 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizeTree.d.ts +23 -60
- package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
- package/lib/shared-tree/schematizeTree.js +60 -150
- 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 +14 -14
- 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/shared-tree-core/defaultResubmitMachine.d.ts +2 -1
- package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
- package/lib/shared-tree-core/defaultResubmitMachine.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 +46 -30
- 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/treeNode.d.ts +0 -3
- package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNode.js +3 -3
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.d.ts +7 -2
- package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts +6 -1
- package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeValid.js +9 -5
- 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 +2 -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 +2 -2
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +2 -1
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +21 -7
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/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/lib/tableSchema.d.ts +25 -32
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +11 -25
- package/lib/tableSchema.js.map +1 -1
- package/package.json +21 -21
- package/src/core/tree/visitDelta.ts +3 -1
- package/src/feature-libraries/chunked-forest/index.ts +1 -0
- package/src/feature-libraries/default-schema/defaultEditBuilder.ts +12 -5
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -0
- package/src/feature-libraries/default-schema/noChangeCodecs.ts +1 -1
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -1
- package/src/feature-libraries/index.ts +2 -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/modularChangeCodecs.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/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +4 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +4 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +4 -2
- package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +1 -1
- package/src/feature-libraries/sequence-field/types.ts +1 -1
- package/src/index.ts +2 -1
- package/src/jsonDomainSchema.ts +4 -0
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +6 -2
- package/src/shared-tree/index.ts +0 -2
- package/src/shared-tree/schematizeTree.ts +83 -199
- package/src/shared-tree/schematizingTreeView.ts +26 -12
- package/src/shared-tree/treeAlpha.ts +18 -4
- package/src/shared-tree-core/defaultResubmitMachine.ts +2 -1
- 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 +71 -42
- 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/treeNode.ts +3 -3
- package/src/simple-tree/core/treeNodeSchema.ts +8 -2
- package/src/simple-tree/core/treeNodeValid.ts +14 -5
- package/src/simple-tree/core/walkSchema.ts +23 -6
- package/src/simple-tree/createContext.ts +5 -2
- package/src/simple-tree/fieldSchema.ts +4 -2
- package/src/simple-tree/index.ts +15 -6
- package/src/simple-tree/leafNodeSchema.ts +2 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +58 -37
- package/src/simple-tree/node-kinds/map/mapNode.ts +26 -2
- package/src/simple-tree/node-kinds/object/objectNode.ts +37 -4
- package/src/simple-tree/node-kinds/record/recordNode.ts +23 -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
- package/src/tableSchema.ts +40 -35
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { brand } from "../../util/index.js";
|
|
7
|
+
import {
|
|
8
|
+
normalizeAnnotatedAllowedTypes,
|
|
9
|
+
type AnnotatedAllowedType,
|
|
10
|
+
type ImplicitAnnotatedAllowedTypes,
|
|
11
|
+
type SchemaUpgrade,
|
|
12
|
+
} from "./allowedTypes.js";
|
|
13
|
+
import type { TreeNodeSchemaIdentifier, TreeTypeSet } from "../../core/index.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Options for generating a {@link TreeStoredSchema} from view schema.
|
|
17
|
+
*/
|
|
18
|
+
export interface StoredSchemaGenerationOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Determines whether to include staged schema in the resulting stored schema.
|
|
21
|
+
* @remarks
|
|
22
|
+
* Due to caching, the behavior of this function must be pure.
|
|
23
|
+
*/
|
|
24
|
+
includeStaged(upgrade: SchemaUpgrade): boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Filters an allowed type based on the provided options.
|
|
29
|
+
* @param allowedType - The allowed type to filter.
|
|
30
|
+
* @param options - The options to use for filtering.
|
|
31
|
+
* @returns Whether the allowed type passes the filter.
|
|
32
|
+
*/
|
|
33
|
+
export function allowedTypeFilter(
|
|
34
|
+
allowedType: AnnotatedAllowedType,
|
|
35
|
+
options: StoredSchemaGenerationOptions,
|
|
36
|
+
): boolean {
|
|
37
|
+
// If the allowed type is staged, only include it if the options allow it.
|
|
38
|
+
if (allowedType.metadata.stagedSchemaUpgrade !== undefined) {
|
|
39
|
+
return options.includeStaged(allowedType.metadata.stagedSchemaUpgrade);
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Converts an ImplicitAnnotatedAllowedTypes to a stored schema.
|
|
46
|
+
* @param schema - The schema to convert.
|
|
47
|
+
* @param options - The options to use for filtering.
|
|
48
|
+
* @returns The converted stored schema.
|
|
49
|
+
*/
|
|
50
|
+
export function convertAllowedTypes(
|
|
51
|
+
schema: ImplicitAnnotatedAllowedTypes,
|
|
52
|
+
options: StoredSchemaGenerationOptions,
|
|
53
|
+
): TreeTypeSet {
|
|
54
|
+
const filtered: TreeNodeSchemaIdentifier[] = normalizeAnnotatedAllowedTypes(schema)
|
|
55
|
+
.types.filter((allowedType) => allowedTypeFilter(allowedType, options))
|
|
56
|
+
.map((a) => brand(a.type.identifier));
|
|
57
|
+
return new Set(filtered);
|
|
58
|
+
}
|
|
@@ -10,6 +10,7 @@ import { tryGetTreeNodeSchema } from "./treeNodeKernel.js";
|
|
|
10
10
|
import { NodeKind, type TreeNodeSchemaClass } from "./treeNodeSchema.js";
|
|
11
11
|
// eslint-disable-next-line import/no-deprecated
|
|
12
12
|
import { type WithType, typeNameSymbol, type typeSchemaSymbol } from "./withType.js";
|
|
13
|
+
import { markEager } from "./flexList.js";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* A non-{@link NodeKind.Leaf|leaf} SharedTree node. Includes objects, arrays, and maps.
|
|
@@ -37,13 +38,10 @@ import { type WithType, typeNameSymbol, type typeSchemaSymbol } from "./withType
|
|
|
37
38
|
* @privateRemarks
|
|
38
39
|
* This is a class not an interface to enable stricter type checking (see {@link TreeNode.#brand})
|
|
39
40
|
* and some runtime enforcement of schema class policy (see the the validation in the constructor).
|
|
40
|
-
* This class is however only `type` exported not value exported, preventing the class object from being used,
|
|
41
|
-
* similar to how interfaces work.
|
|
42
41
|
*
|
|
43
42
|
* Not all node implementations include this in their prototype chain (some hide it with a proxy),
|
|
44
43
|
* and thus cause the default/built in `instanceof` to return false despite our type checking and all other APIs treating them as TreeNodes.
|
|
45
44
|
* This class provides a custom `Symbol.hasInstance` to fix `instanceof` for this class and all classes extending it.
|
|
46
|
-
* For now the type-only export prevents use of `instanceof` on this class (but allows it in subclasses like schema classes).
|
|
47
45
|
* @sealed @public
|
|
48
46
|
*/
|
|
49
47
|
export abstract class TreeNode implements WithType {
|
|
@@ -138,6 +136,8 @@ export abstract class TreeNode implements WithType {
|
|
|
138
136
|
}
|
|
139
137
|
}
|
|
140
138
|
}
|
|
139
|
+
// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.
|
|
140
|
+
markEager(TreeNode);
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* `token` to pass to {@link TreeNode}'s constructor used to detect invalid subclasses.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import type { IFluidHandle } from "@fluidframework/core-interfaces";
|
|
8
8
|
|
|
9
|
-
import type { SimpleNodeSchemaBase } from "
|
|
9
|
+
import type { SimpleNodeSchemaBase } from "./simpleNodeSchemaBase.js";
|
|
10
10
|
import type { TreeNode } from "./treeNode.js";
|
|
11
11
|
import type { InternalTreeNode, Unhydrated } from "./types.js";
|
|
12
12
|
import type { UnionToIntersection } from "../../util/index.js";
|
|
@@ -15,9 +15,10 @@ import type {
|
|
|
15
15
|
NormalizedAnnotatedAllowedTypes,
|
|
16
16
|
} from "./allowedTypes.js";
|
|
17
17
|
import type { Context } from "./context.js";
|
|
18
|
-
import type { FieldKey, NodeData } from "../../core/index.js";
|
|
18
|
+
import type { FieldKey, NodeData, TreeNodeStoredSchema } from "../../core/index.js";
|
|
19
19
|
import type { UnhydratedFlexTreeField } from "./unhydratedFlexTree.js";
|
|
20
20
|
import type { FactoryContent } from "../unhydratedFlexTreeFromInsertable.js";
|
|
21
|
+
import type { StoredSchemaGenerationOptions } from "./toStored.js";
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Schema for a {@link TreeNode} or {@link TreeLeafValue}.
|
|
@@ -396,6 +397,11 @@ export interface TreeNodeSchemaPrivateData {
|
|
|
396
397
|
* Idempotent initialization function that pre-caches data and can dereference lazy schema references.
|
|
397
398
|
*/
|
|
398
399
|
idempotentInitialize(): TreeNodeSchemaInitializedData;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Converts a the schema into a {@link TreeNodeStoredSchema}.
|
|
403
|
+
*/
|
|
404
|
+
toStored(options: StoredSchemaGenerationOptions): TreeNodeStoredSchema;
|
|
399
405
|
}
|
|
400
406
|
|
|
401
407
|
/**
|
|
@@ -8,7 +8,6 @@ import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
|
8
8
|
|
|
9
9
|
import { type FlexTreeNode, isFlexTreeNode } from "../../feature-libraries/index.js";
|
|
10
10
|
|
|
11
|
-
import { markEager } from "./flexList.js";
|
|
12
11
|
import { inPrototypeChain, privateToken, TreeNode } from "./treeNode.js";
|
|
13
12
|
import { UnhydratedFlexTreeNode } from "./unhydratedFlexTree.js";
|
|
14
13
|
import {
|
|
@@ -27,6 +26,7 @@ import {
|
|
|
27
26
|
import type { InternalTreeNode } from "./types.js";
|
|
28
27
|
import { typeSchemaSymbol } from "./withType.js";
|
|
29
28
|
import type { ImplicitAnnotatedAllowedTypes } from "./allowedTypes.js";
|
|
29
|
+
import type { SimpleNodeSchemaBase } from "./simpleNodeSchemaBase.js";
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Class which all {@link TreeNode}s must extend.
|
|
@@ -208,8 +208,6 @@ export abstract class TreeNodeValid<TInput> extends TreeNode {
|
|
|
208
208
|
return result;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.
|
|
212
|
-
markEager(TreeNodeValid);
|
|
213
211
|
|
|
214
212
|
/**
|
|
215
213
|
* Data cached about the most derived type in a schema's class hierarchy.
|
|
@@ -233,7 +231,7 @@ export interface MostDerivedData {
|
|
|
233
231
|
export function schemaAsTreeNodeValid(
|
|
234
232
|
schema: TreeNodeSchemaCore<string, NodeKind, boolean>,
|
|
235
233
|
): typeof TreeNodeValid & TreeNodeSchema {
|
|
236
|
-
if (!
|
|
234
|
+
if (!isClassBasedSchema(schema)) {
|
|
237
235
|
// Use JSON.stringify to quote and escape identifier string.
|
|
238
236
|
throw new UsageError(
|
|
239
237
|
`Schema for ${JSON.stringify(
|
|
@@ -242,7 +240,16 @@ export function schemaAsTreeNodeValid(
|
|
|
242
240
|
);
|
|
243
241
|
}
|
|
244
242
|
|
|
245
|
-
return schema
|
|
243
|
+
return schema;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Check if a schema is a {@link TreeNodeValid}.
|
|
248
|
+
*/
|
|
249
|
+
export function isClassBasedSchema(
|
|
250
|
+
schema: SimpleNodeSchemaBase<NodeKind>,
|
|
251
|
+
): schema is typeof TreeNodeValid & TreeNodeSchema {
|
|
252
|
+
return inPrototypeChain(schema, TreeNodeValid);
|
|
246
253
|
}
|
|
247
254
|
|
|
248
255
|
/**
|
|
@@ -253,6 +260,7 @@ export function schemaAsTreeNodeValid(
|
|
|
253
260
|
export function createTreeNodeSchemaPrivateData(
|
|
254
261
|
schema: TreeNodeSchemaCore<string, NodeKind, boolean>,
|
|
255
262
|
childAnnotatedAllowedTypes: readonly ImplicitAnnotatedAllowedTypes[],
|
|
263
|
+
toStored: TreeNodeSchemaPrivateData["toStored"],
|
|
256
264
|
): TreeNodeSchemaPrivateData {
|
|
257
265
|
const schemaValid = schemaAsTreeNodeValid(schema);
|
|
258
266
|
// Since this closes over the schema, ensure this schema is marked as most derived
|
|
@@ -262,6 +270,7 @@ export function createTreeNodeSchemaPrivateData(
|
|
|
262
270
|
return {
|
|
263
271
|
idempotentInitialize: () => schemaValid.oneTimeInitialize().oneTimeInitialized,
|
|
264
272
|
childAnnotatedAllowedTypes,
|
|
273
|
+
toStored,
|
|
265
274
|
};
|
|
266
275
|
}
|
|
267
276
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
normalizeAnnotatedAllowedTypes,
|
|
8
|
+
type AnnotatedAllowedType,
|
|
8
9
|
type NormalizedAnnotatedAllowedTypes,
|
|
9
10
|
} from "./allowedTypes.js";
|
|
10
11
|
import { getTreeNodeSchemaPrivateData, type TreeNodeSchema } from "./treeNodeSchema.js";
|
|
@@ -50,26 +51,42 @@ export function walkAllowedTypes(
|
|
|
50
51
|
visitor: SchemaVisitor,
|
|
51
52
|
visitedSet: Set<TreeNodeSchema> = new Set(),
|
|
52
53
|
): void {
|
|
53
|
-
for (const
|
|
54
|
-
|
|
54
|
+
for (const allowedType of annotatedAllowedTypes.types) {
|
|
55
|
+
if ((visitor.allowedTypeFilter ?? (() => true))(allowedType)) {
|
|
56
|
+
walkNodeSchema(allowedType.type, visitor, visitedSet);
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
59
|
visitor.allowedTypes?.(annotatedAllowedTypes);
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
/**
|
|
60
|
-
* Callbacks for use in {@link walkFieldSchema} / {@link walkAllowedTypes} / {@link walkNodeSchema}.
|
|
63
|
+
* Callbacks and options for use in {@link walkFieldSchema} / {@link walkAllowedTypes} / {@link walkNodeSchema}.
|
|
61
64
|
* @internal
|
|
62
65
|
*/
|
|
63
66
|
export interface SchemaVisitor {
|
|
64
67
|
/**
|
|
65
|
-
* Called once for each node schema.
|
|
68
|
+
* Called once for each node schema reached.
|
|
66
69
|
*/
|
|
67
70
|
node?: (schema: TreeNodeSchema) => void;
|
|
68
71
|
/**
|
|
69
72
|
* Called once for each set of allowed types.
|
|
70
|
-
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* This includes every field, as well as the allowed types for maps and arrays nodes and the root if starting at {@link walkAllowedTypes}.
|
|
71
75
|
*
|
|
72
|
-
*
|
|
76
|
+
* Each allowed types in the schema is visited as it was in the original schema except for normalization.
|
|
77
|
+
*
|
|
78
|
+
* After this is called {@link SchemaVisitor.allowedTypeFilter} is applied to each allowed type in the schema to determine which of them are walked into.
|
|
73
79
|
*/
|
|
74
80
|
allowedTypes?: (allowedTypes: NormalizedAnnotatedAllowedTypes) => void;
|
|
81
|
+
/**
|
|
82
|
+
* If true, will walk into this `allowedType`.
|
|
83
|
+
* If false, the `allowedType` will not be walked into.
|
|
84
|
+
*
|
|
85
|
+
* If not provided, all allowedTypes will be walked into.
|
|
86
|
+
* @remarks
|
|
87
|
+
* Called after {@link SchemaVisitor.allowedTypes}.
|
|
88
|
+
* @privateRemarks
|
|
89
|
+
* It would be possible to combine this with `allowedTypes` into a single callback, but for the current usage this separation is more convenient.
|
|
90
|
+
*/
|
|
91
|
+
allowedTypeFilter?: (allowedType: AnnotatedAllowedType<TreeNodeSchema>) => boolean;
|
|
75
92
|
}
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
type TreeNodeSchemaInitializedData,
|
|
16
16
|
} from "./core/index.js";
|
|
17
17
|
import { normalizeFieldSchema, type ImplicitFieldSchema } from "./fieldSchema.js";
|
|
18
|
-
import { toStoredSchema } from "./toStoredSchema.js";
|
|
18
|
+
import { toStoredSchema, toUnhydratedSchema } from "./toStoredSchema.js";
|
|
19
19
|
|
|
20
20
|
const contextCache: WeakMap<ImplicitFieldSchema, Context> = new WeakMap();
|
|
21
21
|
|
|
@@ -28,7 +28,10 @@ export function getUnhydratedContext(schema: ImplicitFieldSchema): Context {
|
|
|
28
28
|
return getOrCreate(contextCache, schema, (s) => {
|
|
29
29
|
const normalized = normalizeFieldSchema(schema);
|
|
30
30
|
|
|
31
|
-
const flexContext = new UnhydratedContext(
|
|
31
|
+
const flexContext = new UnhydratedContext(
|
|
32
|
+
defaultSchemaPolicy,
|
|
33
|
+
toStoredSchema(schema, toUnhydratedSchema),
|
|
34
|
+
);
|
|
32
35
|
return new Context(
|
|
33
36
|
flexContext,
|
|
34
37
|
Context.schemaMapFromRootSchema(normalized.annotatedAllowedTypesNormalized),
|
|
@@ -468,7 +468,8 @@ export class FieldSchemaAlpha<
|
|
|
468
468
|
normalizeAnnotatedAllowedTypes(annotatedAllowedTypes),
|
|
469
469
|
);
|
|
470
470
|
this.lazyIdentifiers = new Lazy(
|
|
471
|
-
() =>
|
|
471
|
+
() =>
|
|
472
|
+
new Set(this.annotatedAllowedTypesNormalized.types.map(({ type }) => type.identifier)),
|
|
472
473
|
);
|
|
473
474
|
this.propsAlpha = props;
|
|
474
475
|
}
|
|
@@ -619,8 +620,9 @@ function arePersistedMetadataEqual(
|
|
|
619
620
|
export type ImplicitFieldSchema = FieldSchema | ImplicitAllowedTypes;
|
|
620
621
|
|
|
621
622
|
/**
|
|
622
|
-
*
|
|
623
|
+
* {@link ImplicitFieldSchema} which supports {@link AnnotatedAllowedTypes | annotations} on the allowed types.
|
|
623
624
|
* @alpha
|
|
625
|
+
* @input
|
|
624
626
|
*/
|
|
625
627
|
export type ImplicitAnnotatedFieldSchema = FieldSchema | ImplicitAnnotatedAllowedTypes;
|
|
626
628
|
|
package/src/simple-tree/index.ts
CHANGED
|
@@ -14,9 +14,7 @@ export {
|
|
|
14
14
|
type TreeNodeSchemaClass,
|
|
15
15
|
type TreeNodeSchemaNonClass,
|
|
16
16
|
type TreeNodeSchemaCore,
|
|
17
|
-
|
|
18
|
-
// See docs on TreeNode for more details.
|
|
19
|
-
type TreeNode,
|
|
17
|
+
TreeNode,
|
|
20
18
|
type Unhydrated,
|
|
21
19
|
type InternalTreeNode,
|
|
22
20
|
isTreeNode,
|
|
@@ -47,9 +45,9 @@ export {
|
|
|
47
45
|
type UnannotateAllowedTypes,
|
|
48
46
|
type UnannotateAllowedType,
|
|
49
47
|
type UnannotateAllowedTypesList,
|
|
50
|
-
type UnannotateAllowedTypeOrLazyItem,
|
|
51
48
|
type AllowedTypeMetadata,
|
|
52
49
|
type AnnotatedAllowedTypes,
|
|
50
|
+
type SchemaUpgrade,
|
|
53
51
|
type LazyItem,
|
|
54
52
|
type FlexList,
|
|
55
53
|
type FlexListToUnion,
|
|
@@ -57,6 +55,7 @@ export {
|
|
|
57
55
|
walkNodeSchema,
|
|
58
56
|
walkAllowedTypes,
|
|
59
57
|
type SchemaVisitor,
|
|
58
|
+
type SimpleNodeSchemaBase,
|
|
60
59
|
} from "./core/index.js";
|
|
61
60
|
export { walkFieldSchema } from "./walkFieldSchema.js";
|
|
62
61
|
export type { UnsafeUnknownSchema, Insertable } from "./unsafeUnknownSchema.js";
|
|
@@ -161,6 +160,7 @@ export {
|
|
|
161
160
|
type TreeChangeEvents,
|
|
162
161
|
type NodeSchemaOptions,
|
|
163
162
|
type NodeSchemaOptionsAlpha,
|
|
163
|
+
type SchemaStaticsAlpha,
|
|
164
164
|
} from "./api/index.js";
|
|
165
165
|
export type {
|
|
166
166
|
SimpleTreeSchema,
|
|
@@ -170,7 +170,6 @@ export type {
|
|
|
170
170
|
SimpleMapNodeSchema,
|
|
171
171
|
SimpleArrayNodeSchema,
|
|
172
172
|
SimpleObjectNodeSchema,
|
|
173
|
-
SimpleNodeSchemaBase,
|
|
174
173
|
SimpleNodeSchemaBaseAlpha,
|
|
175
174
|
SimpleObjectFieldSchema,
|
|
176
175
|
SimpleRecordNodeSchema,
|
|
@@ -240,7 +239,17 @@ export {
|
|
|
240
239
|
prepareForInsertion,
|
|
241
240
|
prepareForInsertionContextless,
|
|
242
241
|
} from "./prepareForInsertion.js";
|
|
243
|
-
export {
|
|
242
|
+
export {
|
|
243
|
+
toStoredSchema,
|
|
244
|
+
getStoredSchema,
|
|
245
|
+
convertFieldKind,
|
|
246
|
+
toUpgradeSchema,
|
|
247
|
+
toInitialSchema,
|
|
248
|
+
convertField,
|
|
249
|
+
toUnhydratedSchema,
|
|
250
|
+
restrictiveStoredSchemaGenerationOptions,
|
|
251
|
+
permissiveStoredSchemaGenerationOptions,
|
|
252
|
+
} from "./toStoredSchema.js";
|
|
244
253
|
export {
|
|
245
254
|
numberSchema,
|
|
246
255
|
stringSchema,
|
|
@@ -7,7 +7,7 @@ import { assert } from "@fluidframework/core-utils/internal";
|
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
import { isFluidHandle } from "@fluidframework/runtime-utils/internal";
|
|
9
9
|
|
|
10
|
-
import { type TreeValue, ValueSchema } from "../core/index.js";
|
|
10
|
+
import { LeafNodeStoredSchema, type TreeValue, ValueSchema } from "../core/index.js";
|
|
11
11
|
import {
|
|
12
12
|
type FlexTreeNode,
|
|
13
13
|
isFlexTreeNode,
|
|
@@ -64,6 +64,7 @@ export class LeafNodeSchema<Name extends string, const T extends ValueSchema>
|
|
|
64
64
|
): FlexContent => leafToFlexContent(data, this, allowedTypes),
|
|
65
65
|
})),
|
|
66
66
|
childAnnotatedAllowedTypes: [],
|
|
67
|
+
toStored: () => new LeafNodeStoredSchema(this.leafKind),
|
|
67
68
|
};
|
|
68
69
|
#initializedData: TreeNodeSchemaInitializedData | undefined;
|
|
69
70
|
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Lazy, oob, fail } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { Lazy, oob, fail, assert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
|
|
9
|
-
import { EmptyKey } from "../../../core/index.js";
|
|
9
|
+
import { EmptyKey, ObjectNodeStoredSchema } from "../../../core/index.js";
|
|
10
10
|
import type {
|
|
11
11
|
FlexibleFieldContent,
|
|
12
12
|
FlexTreeNode,
|
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
createTreeNodeSchemaPrivateData,
|
|
49
49
|
type FlexContent,
|
|
50
50
|
type TreeNodeSchemaPrivateData,
|
|
51
|
+
convertAllowedTypes,
|
|
51
52
|
} from "../../core/index.js";
|
|
52
53
|
import {
|
|
53
54
|
type FactoryContent,
|
|
@@ -68,6 +69,7 @@ import type {
|
|
|
68
69
|
} from "./arrayNodeTypes.js";
|
|
69
70
|
import { brand, type JsonCompatibleReadOnlyObject } from "../../../util/index.js";
|
|
70
71
|
import { nullSchema } from "../../leafNodeSchema.js";
|
|
72
|
+
import { arrayNodeStoredSchema } from "../../toStoredSchema.js";
|
|
71
73
|
|
|
72
74
|
/**
|
|
73
75
|
* A covariant base type for {@link (TreeArrayNode:interface)}.
|
|
@@ -848,19 +850,19 @@ type Insertable<T extends ImplicitAllowedTypes> = readonly (
|
|
|
848
850
|
| IterableTreeArrayContent<InsertableTreeNodeFromImplicitAllowedTypes<T>>
|
|
849
851
|
)[];
|
|
850
852
|
|
|
851
|
-
abstract class CustomArrayNodeBase<const T extends
|
|
853
|
+
abstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>
|
|
852
854
|
extends TreeNodeWithArrayFeatures<
|
|
853
|
-
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<
|
|
854
|
-
TreeNodeFromImplicitAllowedTypes<
|
|
855
|
+
Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,
|
|
856
|
+
TreeNodeFromImplicitAllowedTypes<T>
|
|
855
857
|
>
|
|
856
|
-
implements TreeArrayNode<
|
|
858
|
+
implements TreeArrayNode<T>
|
|
857
859
|
{
|
|
858
860
|
// Indexing must be provided by subclass.
|
|
859
|
-
[k: number]: TreeNodeFromImplicitAllowedTypes<
|
|
861
|
+
[k: number]: TreeNodeFromImplicitAllowedTypes<T>;
|
|
860
862
|
|
|
861
863
|
public static readonly kind = NodeKind.Array;
|
|
862
864
|
|
|
863
|
-
protected abstract get
|
|
865
|
+
protected abstract get childSchema(): ImplicitAnnotatedAllowedTypes;
|
|
864
866
|
protected abstract get allowedTypes(): ReadonlySet<TreeNodeSchema>;
|
|
865
867
|
|
|
866
868
|
public abstract override get [typeSchemaSymbol](): TreeNodeSchemaClass<
|
|
@@ -869,16 +871,12 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAnnotatedAllowedTypes
|
|
|
869
871
|
>;
|
|
870
872
|
|
|
871
873
|
public constructor(
|
|
872
|
-
input?:
|
|
873
|
-
| Iterable<InsertableTreeNodeFromImplicitAllowedTypes<UnannotateImplicitAllowedTypes<T>>>
|
|
874
|
-
| InternalTreeNode,
|
|
874
|
+
input?: Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>> | InternalTreeNode,
|
|
875
875
|
) {
|
|
876
876
|
super(input ?? []);
|
|
877
877
|
}
|
|
878
878
|
|
|
879
|
-
#mapTreesFromFieldData(
|
|
880
|
-
value: Insertable<UnannotateImplicitAllowedTypes<T>>,
|
|
881
|
-
): FlexibleFieldContent {
|
|
879
|
+
#mapTreesFromFieldData(value: Insertable<T>): FlexibleFieldContent {
|
|
882
880
|
const sequenceField = getSequenceField(this);
|
|
883
881
|
const content = value as readonly (
|
|
884
882
|
| InsertableContent
|
|
@@ -888,10 +886,27 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAnnotatedAllowedTypes
|
|
|
888
886
|
const contentArray = content.flatMap((c): InsertableContent[] =>
|
|
889
887
|
c instanceof IterableTreeArrayContent ? Array.from(c) : [c],
|
|
890
888
|
);
|
|
889
|
+
|
|
890
|
+
const kernel = getKernel(this);
|
|
891
|
+
const flexContext = kernel.getOrCreateInnerNode().context;
|
|
892
|
+
assert(
|
|
893
|
+
flexContext === kernel.context.flexContext,
|
|
894
|
+
0xc14 /* Expected flexContext to match */,
|
|
895
|
+
);
|
|
896
|
+
const innerSchema = kernel.context.flexContext.schema.nodeSchema.get(
|
|
897
|
+
brand(kernel.schema.identifier),
|
|
898
|
+
);
|
|
899
|
+
assert(
|
|
900
|
+
innerSchema instanceof ObjectNodeStoredSchema,
|
|
901
|
+
0xc15 /* Expected ObjectNodeStoredSchema */,
|
|
902
|
+
);
|
|
903
|
+
const fieldSchema = innerSchema.getFieldSchema(EmptyKey);
|
|
904
|
+
|
|
891
905
|
const mapTrees = prepareArrayContentForInsertion(
|
|
892
906
|
contentArray,
|
|
893
|
-
this.
|
|
907
|
+
this.childSchema,
|
|
894
908
|
sequenceField.context,
|
|
909
|
+
fieldSchema.types,
|
|
895
910
|
);
|
|
896
911
|
|
|
897
912
|
return mapTrees;
|
|
@@ -910,9 +925,7 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAnnotatedAllowedTypes
|
|
|
910
925
|
return fail(0xadb /* Proxy should intercept length */);
|
|
911
926
|
}
|
|
912
927
|
|
|
913
|
-
public [Symbol.iterator](): IterableIterator<
|
|
914
|
-
TreeNodeFromImplicitAllowedTypes<UnannotateImplicitAllowedTypes<T>>
|
|
915
|
-
> {
|
|
928
|
+
public [Symbol.iterator](): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {
|
|
916
929
|
return this.values();
|
|
917
930
|
}
|
|
918
931
|
|
|
@@ -924,9 +937,9 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAnnotatedAllowedTypes
|
|
|
924
937
|
}
|
|
925
938
|
|
|
926
939
|
public at(
|
|
927
|
-
this: TreeArrayNode<
|
|
940
|
+
this: TreeArrayNode<T>,
|
|
928
941
|
index: number,
|
|
929
|
-
): TreeNodeFromImplicitAllowedTypes<
|
|
942
|
+
): TreeNodeFromImplicitAllowedTypes<T> | undefined {
|
|
930
943
|
const field = getSequenceField(this);
|
|
931
944
|
const val = field.boxedAt(index);
|
|
932
945
|
|
|
@@ -934,23 +947,18 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAnnotatedAllowedTypes
|
|
|
934
947
|
return val;
|
|
935
948
|
}
|
|
936
949
|
|
|
937
|
-
return getOrCreateNodeFromInnerNode(val) as TreeNodeFromImplicitAllowedTypes<
|
|
938
|
-
UnannotateImplicitAllowedTypes<T>
|
|
939
|
-
>;
|
|
950
|
+
return getOrCreateNodeFromInnerNode(val) as TreeNodeFromImplicitAllowedTypes<T>;
|
|
940
951
|
}
|
|
941
|
-
public insertAt(
|
|
942
|
-
index: number,
|
|
943
|
-
...value: Insertable<UnannotateImplicitAllowedTypes<T>>
|
|
944
|
-
): void {
|
|
952
|
+
public insertAt(index: number, ...value: Insertable<T>): void {
|
|
945
953
|
const field = getSequenceField(this);
|
|
946
954
|
validateIndex(index, field, "insertAt", true);
|
|
947
955
|
const content = this.#mapTreesFromFieldData(value);
|
|
948
956
|
field.editor.insert(index, content);
|
|
949
957
|
}
|
|
950
|
-
public insertAtStart(...value: Insertable<
|
|
958
|
+
public insertAtStart(...value: Insertable<T>): void {
|
|
951
959
|
this.insertAt(0, ...value);
|
|
952
960
|
}
|
|
953
|
-
public insertAtEnd(...value: Insertable<
|
|
961
|
+
public insertAtEnd(...value: Insertable<T>): void {
|
|
954
962
|
this.insertAt(this.length, ...value);
|
|
955
963
|
}
|
|
956
964
|
public removeAt(index: number): void {
|
|
@@ -1029,6 +1037,11 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAnnotatedAllowedTypes
|
|
|
1029
1037
|
): void {
|
|
1030
1038
|
const destinationField = getSequenceField(this);
|
|
1031
1039
|
const destinationSchema = this.allowedTypes;
|
|
1040
|
+
const kernel = getKernel(this);
|
|
1041
|
+
const destinationStored = (
|
|
1042
|
+
kernel.context.flexContext.schema.nodeSchema.get(brand(kernel.schema.identifier)) ??
|
|
1043
|
+
fail(0xc16 /* missing schema for array node */)
|
|
1044
|
+
).getFieldSchema(EmptyKey).types;
|
|
1032
1045
|
const sourceField = source !== undefined ? getSequenceField(source) : destinationField;
|
|
1033
1046
|
|
|
1034
1047
|
validateIndex(destinationGap, destinationField, "moveRangeToIndex", true);
|
|
@@ -1040,7 +1053,15 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAnnotatedAllowedTypes
|
|
|
1040
1053
|
const sourceNode = sourceField.boxedAt(i) ?? oob();
|
|
1041
1054
|
const sourceSchema = getSimpleNodeSchemaFromInnerNode(sourceNode);
|
|
1042
1055
|
if (!destinationSchema.has(sourceSchema)) {
|
|
1043
|
-
throw new UsageError(
|
|
1056
|
+
throw new UsageError(
|
|
1057
|
+
`Type ${sourceNode.type} in source sequence is not allowed in destination.`,
|
|
1058
|
+
);
|
|
1059
|
+
}
|
|
1060
|
+
if (!destinationStored.has(sourceNode.type)) {
|
|
1061
|
+
// TODO: better and centralized messages for missing staged schema updates.
|
|
1062
|
+
throw new UsageError(
|
|
1063
|
+
`Type ${sourceNode.type} in source sequence is not allowed in destination's stored schema: this would likely require upgrading the document to permit a staged schema.`,
|
|
1064
|
+
);
|
|
1044
1065
|
}
|
|
1045
1066
|
}
|
|
1046
1067
|
}
|
|
@@ -1090,14 +1111,12 @@ abstract class CustomArrayNodeBase<const T extends ImplicitAnnotatedAllowedTypes
|
|
|
1090
1111
|
}
|
|
1091
1112
|
}
|
|
1092
1113
|
|
|
1093
|
-
public values(): IterableIterator<
|
|
1094
|
-
TreeNodeFromImplicitAllowedTypes<UnannotateImplicitAllowedTypes<T>>
|
|
1095
|
-
> {
|
|
1114
|
+
public values(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {
|
|
1096
1115
|
return this.generateValues(getKernel(this).generationNumber);
|
|
1097
1116
|
}
|
|
1098
1117
|
private *generateValues(
|
|
1099
1118
|
initialLastUpdatedStamp: number,
|
|
1100
|
-
): Generator<TreeNodeFromImplicitAllowedTypes<
|
|
1119
|
+
): Generator<TreeNodeFromImplicitAllowedTypes<T>> {
|
|
1101
1120
|
const kernel = getKernel(this);
|
|
1102
1121
|
if (initialLastUpdatedStamp !== kernel.generationNumber) {
|
|
1103
1122
|
throw new UsageError(`Concurrent editing and iteration is not allowed.`);
|
|
@@ -1151,7 +1170,7 @@ export function arraySchema<
|
|
|
1151
1170
|
|
|
1152
1171
|
// This class returns a proxy from its constructor to handle numeric indexing.
|
|
1153
1172
|
// Alternatively it could extend a normal class which gets tons of numeric properties added.
|
|
1154
|
-
class Schema extends CustomArrayNodeBase<T
|
|
1173
|
+
class Schema extends CustomArrayNodeBase<UnannotateImplicitAllowedTypes<T>> {
|
|
1155
1174
|
public static override prepareInstance<T2>(
|
|
1156
1175
|
this: typeof TreeNodeValid<T2>,
|
|
1157
1176
|
instance: TreeNodeValid<T2>,
|
|
@@ -1242,7 +1261,7 @@ export function arraySchema<
|
|
|
1242
1261
|
return Schema.constructorCached?.constructor as unknown as Output;
|
|
1243
1262
|
}
|
|
1244
1263
|
|
|
1245
|
-
protected get
|
|
1264
|
+
protected get childSchema(): T {
|
|
1246
1265
|
return info;
|
|
1247
1266
|
}
|
|
1248
1267
|
protected get allowedTypes(): ReadonlySet<TreeNodeSchema> {
|
|
@@ -1250,7 +1269,9 @@ export function arraySchema<
|
|
|
1250
1269
|
}
|
|
1251
1270
|
|
|
1252
1271
|
public static get [privateDataSymbol](): TreeNodeSchemaPrivateData {
|
|
1253
|
-
return (privateData ??= createTreeNodeSchemaPrivateData(this, [info])
|
|
1272
|
+
return (privateData ??= createTreeNodeSchemaPrivateData(this, [info], (storedOptions) =>
|
|
1273
|
+
arrayNodeStoredSchema(convertAllowedTypes(info, storedOptions), persistedMetadata),
|
|
1274
|
+
));
|
|
1254
1275
|
}
|
|
1255
1276
|
}
|
|
1256
1277
|
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Lazy } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import { assert, Lazy } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
+
FieldKinds,
|
|
10
11
|
isTreeValue,
|
|
11
12
|
type FlexibleNodeContent,
|
|
12
13
|
type FlexTreeNode,
|
|
@@ -44,6 +45,7 @@ import {
|
|
|
44
45
|
createTreeNodeSchemaPrivateData,
|
|
45
46
|
type FlexContent,
|
|
46
47
|
type TreeNodeSchemaPrivateData,
|
|
48
|
+
convertAllowedTypes,
|
|
47
49
|
} from "../../core/index.js";
|
|
48
50
|
import {
|
|
49
51
|
unhydratedFlexTreeFromInsertable,
|
|
@@ -65,6 +67,7 @@ import type {
|
|
|
65
67
|
MapNodeSchema,
|
|
66
68
|
} from "./mapNodeTypes.js";
|
|
67
69
|
import { recordLikeDataToFlexContent } from "../common.js";
|
|
70
|
+
import { MapNodeStoredSchema } from "../../../core/index.js";
|
|
68
71
|
|
|
69
72
|
/**
|
|
70
73
|
* A map of string keys to tree objects.
|
|
@@ -209,10 +212,19 @@ abstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends T
|
|
|
209
212
|
public set(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T>): this {
|
|
210
213
|
const kernel = getKernel(this);
|
|
211
214
|
const node = this.innerNode;
|
|
215
|
+
const innerSchema = this.innerNode.context.schema.nodeSchema.get(
|
|
216
|
+
brand(kernel.schema.identifier),
|
|
217
|
+
);
|
|
218
|
+
assert(
|
|
219
|
+
innerSchema instanceof MapNodeStoredSchema,
|
|
220
|
+
0xc17 /* Expected MapNodeStoredSchema */,
|
|
221
|
+
);
|
|
222
|
+
|
|
212
223
|
const mapTree = prepareForInsertion(
|
|
213
224
|
value as InsertableContent | undefined,
|
|
214
225
|
createFieldSchema(FieldKind.Optional, kernel.schema.info as ImplicitAllowedTypes),
|
|
215
226
|
node.context,
|
|
227
|
+
innerSchema.mapFields,
|
|
216
228
|
);
|
|
217
229
|
|
|
218
230
|
const field = node.getBoxed(brand(key));
|
|
@@ -328,7 +340,19 @@ export function mapSchema<
|
|
|
328
340
|
}
|
|
329
341
|
|
|
330
342
|
public static get [privateDataSymbol](): TreeNodeSchemaPrivateData {
|
|
331
|
-
return (privateData ??= createTreeNodeSchemaPrivateData(
|
|
343
|
+
return (privateData ??= createTreeNodeSchemaPrivateData(
|
|
344
|
+
this,
|
|
345
|
+
[info],
|
|
346
|
+
(storedOptions) =>
|
|
347
|
+
new MapNodeStoredSchema(
|
|
348
|
+
{
|
|
349
|
+
kind: FieldKinds.optional.identifier,
|
|
350
|
+
types: convertAllowedTypes(info, storedOptions),
|
|
351
|
+
persistedMetadata,
|
|
352
|
+
},
|
|
353
|
+
persistedMetadata,
|
|
354
|
+
),
|
|
355
|
+
));
|
|
332
356
|
}
|
|
333
357
|
}
|
|
334
358
|
const schemaErased: MapNodeCustomizableSchema<
|