@fluidframework/tree 2.81.0 → 2.82.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/CHANGELOG.md +125 -0
- package/api-report/tree.alpha.api.md +54 -22
- package/api-report/tree.beta.api.md +150 -1
- package/api-report/tree.legacy.beta.api.md +150 -1
- package/api-report/tree.legacy.public.api.md +1 -0
- package/api-report/tree.public.api.md +1 -0
- package/dist/alpha.d.ts +8 -2
- package/dist/beta.d.ts +3 -0
- package/dist/codec/codec.d.ts +17 -8
- package/dist/codec/codec.d.ts.map +1 -1
- package/dist/codec/codec.js +8 -1
- package/dist/codec/codec.js.map +1 -1
- package/dist/codec/index.d.ts +1 -1
- package/dist/codec/index.d.ts.map +1 -1
- package/dist/codec/index.js +2 -1
- package/dist/codec/index.js.map +1 -1
- package/dist/codec/versioned/codec.d.ts +1 -1
- package/dist/codec/versioned/codec.d.ts.map +1 -1
- package/dist/codec/versioned/codec.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +4 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/changeRebaser.d.ts +3 -2
- package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
- package/dist/core/rebase/changeRebaser.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +4 -2
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +23 -3
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +30 -16
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/core/schema-stored/formatV1.d.ts +2 -2
- package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV1.js +0 -5
- package/dist/core/schema-stored/formatV1.js.map +1 -1
- package/dist/core/schema-stored/formatV2.d.ts +11 -10
- package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
- package/dist/core/schema-stored/formatV2.js +1 -6
- package/dist/core/schema-stored/formatV2.js.map +1 -1
- package/dist/core/schema-stored/index.d.ts.map +1 -1
- package/dist/core/schema-stored/index.js.map +1 -1
- package/dist/core/schema-stored/schema.d.ts.map +1 -1
- package/dist/core/schema-stored/schema.js.map +1 -1
- package/dist/core/tree/anchorSet.d.ts.map +1 -1
- package/dist/core/tree/anchorSet.js.map +1 -1
- package/dist/core/tree/delta.d.ts +9 -7
- package/dist/core/tree/delta.d.ts.map +1 -1
- package/dist/core/tree/delta.js.map +1 -1
- package/dist/core/tree/deltaUtil.js +1 -1
- package/dist/core/tree/deltaUtil.js.map +1 -1
- package/dist/core/tree/visitDelta.js +2 -2
- package/dist/core/tree/visitDelta.js.map +1 -1
- package/dist/extensibleSchemaUnion.d.ts +72 -0
- package/dist/extensibleSchemaUnion.d.ts.map +1 -0
- package/dist/extensibleSchemaUnion.js +79 -0
- package/dist/extensibleSchemaUnion.js.map +1 -0
- package/dist/feature-libraries/changeAtomIdBTree.d.ts +4 -2
- package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/dist/feature-libraries/changeAtomIdBTree.js +9 -1
- package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -3
- package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js +20 -21
- package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts +1 -1
- package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/default-schema/index.js.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts +2 -1
- package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/forestSummarizer.js +5 -2
- package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts +1 -39
- package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatCommon.js +1 -2
- package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV1.d.ts +1 -39
- package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/formatV2.d.ts +1 -39
- package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +1 -1
- package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/dist/feature-libraries/index.d.ts +3 -3
- package/dist/feature-libraries/index.d.ts.map +1 -1
- package/dist/feature-libraries/index.js +4 -3
- package/dist/feature-libraries/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +2 -2
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +42 -22
- package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js +1 -1
- package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/index.js +2 -1
- package/dist/feature-libraries/modular-schema/index.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -5
- package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +11 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +30 -7
- package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js +38 -27
- package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +10 -127
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -4
- package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +3 -79
- package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js +1 -1
- package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/dist/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
- package/dist/feature-libraries/optional-field/requiredField.js.map +1 -1
- package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
- package/dist/feature-libraries/schema-index/codec.js.map +1 -1
- package/dist/feature-libraries/schema-index/formatV2.d.ts +4 -4
- package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -1
- package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/dist/feature-libraries/sequence-field/invert.js +2 -2
- package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
- package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -16
- package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -1
- package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +3 -0
- 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 +36 -13
- package/dist/shared-tree/independentView.d.ts.map +1 -1
- package/dist/shared-tree/independentView.js +1 -0
- package/dist/shared-tree/independentView.js.map +1 -1
- package/dist/shared-tree/index.d.ts +1 -1
- package/dist/shared-tree/index.d.ts.map +1 -1
- package/dist/shared-tree/index.js.map +1 -1
- package/dist/shared-tree/schematizingTreeView.d.ts +10 -0
- package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/dist/shared-tree/schematizingTreeView.js +25 -9
- package/dist/shared-tree/schematizingTreeView.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +3 -3
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +8 -32
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +11 -3
- package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/dist/shared-tree/sharedTreeChangeCodecs.js +38 -4
- package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/dist/shared-tree/sharedTreeChangeFormat.d.ts +4 -4
- package/dist/shared-tree/tree.js +1 -1
- package/dist/shared-tree/tree.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +20 -0
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +39 -3
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js +1 -1
- package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/dist/shared-tree-core/messageCodecV1ToV4.js +2 -2
- package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/dist/shared-tree-core/transaction.d.ts +14 -3
- package/dist/shared-tree-core/transaction.d.ts.map +1 -1
- package/dist/shared-tree-core/transaction.js +59 -16
- package/dist/shared-tree-core/transaction.js.map +1 -1
- package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
- package/dist/shared-tree-core/versionedSummarizer.js +1 -1
- package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- 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/schemaCreationUtilities.d.ts +9 -0
- package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js +16 -1
- package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/dist/simple-tree/api/transactionTypes.d.ts +10 -0
- package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/dist/simple-tree/api/transactionTypes.js.map +1 -1
- package/dist/simple-tree/api/tree.d.ts +81 -6
- 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/core/treeNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +4 -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.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +63 -0
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +43 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/index.d.ts +1 -1
- package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/index.js +2 -1
- package/dist/simple-tree/node-kinds/array/index.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 +2 -1
- package/dist/simple-tree/node-kinds/index.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/tableSchema.d.ts +71 -48
- package/dist/tableSchema.d.ts.map +1 -1
- package/dist/tableSchema.js +200 -98
- package/dist/tableSchema.js.map +1 -1
- package/dist/text/textDomainFormatted.js +1 -1
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/util/bTreeUtils.d.ts +30 -4
- package/dist/util/bTreeUtils.d.ts.map +1 -1
- package/dist/util/bTreeUtils.js +29 -17
- package/dist/util/bTreeUtils.js.map +1 -1
- package/dist/util/brand.d.ts.map +1 -1
- package/dist/util/brand.js.map +1 -1
- package/dist/util/brandedMap.d.ts.map +1 -1
- package/dist/util/brandedMap.js.map +1 -1
- package/dist/util/breakable.d.ts.map +1 -1
- package/dist/util/breakable.js +2 -1
- package/dist/util/breakable.js.map +1 -1
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.d.ts.map +1 -1
- package/dist/util/index.js +6 -3
- package/dist/util/index.js.map +1 -1
- package/dist/util/opaque.d.ts.map +1 -1
- package/dist/util/opaque.js.map +1 -1
- package/dist/util/rangeMap.d.ts +3 -2
- package/dist/util/rangeMap.d.ts.map +1 -1
- package/dist/util/rangeMap.js +7 -1
- package/dist/util/rangeMap.js.map +1 -1
- package/dist/util/readSnapshotBlob.d.ts +1 -1
- package/dist/util/readSnapshotBlob.d.ts.map +1 -1
- package/dist/util/readSnapshotBlob.js.map +1 -1
- package/dist/util/typeCheck.d.ts.map +1 -1
- package/dist/util/typeCheck.js.map +1 -1
- package/dist/util/utils.d.ts +20 -16
- package/dist/util/utils.d.ts.map +1 -1
- package/dist/util/utils.js +49 -17
- package/dist/util/utils.js.map +1 -1
- package/eslint.config.mts +0 -9
- package/lib/alpha.d.ts +8 -2
- package/lib/beta.d.ts +3 -0
- package/lib/codec/codec.d.ts +17 -8
- package/lib/codec/codec.d.ts.map +1 -1
- package/lib/codec/codec.js +6 -0
- package/lib/codec/codec.js.map +1 -1
- package/lib/codec/index.d.ts +1 -1
- package/lib/codec/index.d.ts.map +1 -1
- package/lib/codec/index.js +1 -1
- package/lib/codec/index.js.map +1 -1
- package/lib/codec/versioned/codec.d.ts +1 -1
- package/lib/codec/versioned/codec.d.ts.map +1 -1
- package/lib/codec/versioned/codec.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/changeRebaser.d.ts +3 -2
- package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
- package/lib/core/rebase/changeRebaser.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +23 -3
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +27 -15
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/core/schema-stored/formatV1.d.ts +2 -2
- package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
- package/lib/core/schema-stored/formatV1.js +0 -5
- package/lib/core/schema-stored/formatV1.js.map +1 -1
- package/lib/core/schema-stored/formatV2.d.ts +11 -10
- package/lib/core/schema-stored/formatV2.d.ts.map +1 -1
- package/lib/core/schema-stored/formatV2.js +1 -6
- package/lib/core/schema-stored/formatV2.js.map +1 -1
- package/lib/core/schema-stored/index.d.ts.map +1 -1
- package/lib/core/schema-stored/index.js +2 -0
- package/lib/core/schema-stored/index.js.map +1 -1
- package/lib/core/schema-stored/schema.d.ts.map +1 -1
- package/lib/core/schema-stored/schema.js.map +1 -1
- package/lib/core/tree/anchorSet.d.ts.map +1 -1
- package/lib/core/tree/anchorSet.js.map +1 -1
- package/lib/core/tree/delta.d.ts +9 -7
- package/lib/core/tree/delta.d.ts.map +1 -1
- package/lib/core/tree/delta.js.map +1 -1
- package/lib/core/tree/deltaUtil.js +1 -1
- package/lib/core/tree/deltaUtil.js.map +1 -1
- package/lib/core/tree/visitDelta.js +2 -2
- package/lib/core/tree/visitDelta.js.map +1 -1
- package/lib/extensibleSchemaUnion.d.ts +72 -0
- package/lib/extensibleSchemaUnion.d.ts.map +1 -0
- package/lib/extensibleSchemaUnion.js +76 -0
- package/lib/extensibleSchemaUnion.js.map +1 -0
- package/lib/feature-libraries/changeAtomIdBTree.d.ts +4 -2
- package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
- package/lib/feature-libraries/changeAtomIdBTree.js +7 -0
- package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -3
- package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js +4 -5
- package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts +1 -1
- package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/default-schema/index.js.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts +2 -1
- package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -3
- package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts +1 -39
- package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatCommon.js +2 -3
- package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV1.d.ts +1 -39
- package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/formatV2.d.ts +1 -39
- package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +1 -1
- package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
- package/lib/feature-libraries/index.d.ts +3 -3
- package/lib/feature-libraries/index.d.ts.map +1 -1
- package/lib/feature-libraries/index.js +3 -3
- package/lib/feature-libraries/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +2 -2
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +41 -21
- package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js +1 -1
- package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/index.js +1 -1
- package/lib/feature-libraries/modular-schema/index.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -6
- package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +11 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +29 -6
- package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js +41 -30
- package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +10 -127
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -4
- package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +3 -79
- package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js +1 -1
- package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
- package/lib/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
- package/lib/feature-libraries/optional-field/requiredField.js.map +1 -1
- package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
- package/lib/feature-libraries/schema-index/codec.js.map +1 -1
- package/lib/feature-libraries/schema-index/formatV2.d.ts +4 -4
- package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -1
- package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
- package/lib/feature-libraries/sequence-field/invert.js +2 -2
- package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
- package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -16
- package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -1
- package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
- package/lib/index.d.ts +5 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +3 -0
- 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 +36 -13
- package/lib/shared-tree/independentView.d.ts.map +1 -1
- package/lib/shared-tree/independentView.js +1 -0
- package/lib/shared-tree/independentView.js.map +1 -1
- package/lib/shared-tree/index.d.ts +1 -1
- package/lib/shared-tree/index.d.ts.map +1 -1
- package/lib/shared-tree/index.js.map +1 -1
- package/lib/shared-tree/schematizingTreeView.d.ts +10 -0
- package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
- package/lib/shared-tree/schematizingTreeView.js +25 -9
- package/lib/shared-tree/schematizingTreeView.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +3 -3
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +10 -34
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +11 -3
- package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
- package/lib/shared-tree/sharedTreeChangeCodecs.js +39 -5
- package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
- package/lib/shared-tree/sharedTreeChangeFormat.d.ts +4 -4
- package/lib/shared-tree/tree.js +1 -1
- package/lib/shared-tree/tree.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +20 -0
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +39 -3
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js +1 -1
- package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
- package/lib/shared-tree-core/messageCodecV1ToV4.js +2 -2
- package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
- package/lib/shared-tree-core/transaction.d.ts +14 -3
- package/lib/shared-tree-core/transaction.d.ts.map +1 -1
- package/lib/shared-tree-core/transaction.js +61 -18
- package/lib/shared-tree-core/transaction.js.map +1 -1
- package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
- package/lib/shared-tree-core/versionedSummarizer.js +1 -1
- package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- 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/schemaCreationUtilities.d.ts +9 -0
- package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaCreationUtilities.js +14 -0
- package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
- package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
- package/lib/simple-tree/api/transactionTypes.d.ts +10 -0
- package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
- package/lib/simple-tree/api/transactionTypes.js.map +1 -1
- package/lib/simple-tree/api/tree.d.ts +81 -6
- 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/core/treeNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- 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.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +63 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +41 -0
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/index.js +1 -1
- package/lib/simple-tree/node-kinds/array/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts +1 -1
- package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/index.js +1 -1
- package/lib/simple-tree/node-kinds/index.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/tableSchema.d.ts +71 -48
- package/lib/tableSchema.d.ts.map +1 -1
- package/lib/tableSchema.js +201 -99
- package/lib/tableSchema.js.map +1 -1
- package/lib/text/textDomainFormatted.js +1 -1
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/util/bTreeUtils.d.ts +30 -4
- package/lib/util/bTreeUtils.d.ts.map +1 -1
- package/lib/util/bTreeUtils.js +27 -16
- package/lib/util/bTreeUtils.js.map +1 -1
- package/lib/util/brand.d.ts.map +1 -1
- package/lib/util/brand.js.map +1 -1
- package/lib/util/brandedMap.d.ts.map +1 -1
- package/lib/util/brandedMap.js.map +1 -1
- package/lib/util/breakable.d.ts.map +1 -1
- package/lib/util/breakable.js +2 -1
- package/lib/util/breakable.js.map +1 -1
- package/lib/util/index.d.ts +2 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/opaque.d.ts.map +1 -1
- package/lib/util/opaque.js.map +1 -1
- package/lib/util/rangeMap.d.ts +3 -2
- package/lib/util/rangeMap.d.ts.map +1 -1
- package/lib/util/rangeMap.js +7 -1
- package/lib/util/rangeMap.js.map +1 -1
- package/lib/util/readSnapshotBlob.d.ts +1 -1
- package/lib/util/readSnapshotBlob.d.ts.map +1 -1
- package/lib/util/readSnapshotBlob.js.map +1 -1
- package/lib/util/typeCheck.d.ts.map +1 -1
- package/lib/util/typeCheck.js.map +1 -1
- package/lib/util/utils.d.ts +20 -16
- package/lib/util/utils.d.ts.map +1 -1
- package/lib/util/utils.js +44 -15
- package/lib/util/utils.js.map +1 -1
- package/package.json +23 -23
- package/src/codec/codec.ts +30 -11
- package/src/codec/index.ts +2 -0
- package/src/codec/versioned/codec.ts +9 -13
- package/src/core/index.ts +3 -1
- package/src/core/rebase/changeRebaser.ts +3 -2
- package/src/core/rebase/index.ts +3 -1
- package/src/core/rebase/types.ts +51 -13
- package/src/core/schema-stored/formatV1.ts +2 -4
- package/src/core/schema-stored/formatV2.ts +9 -7
- package/src/core/schema-stored/index.ts +2 -0
- package/src/core/schema-stored/schema.ts +4 -1
- package/src/core/tree/anchorSet.ts +1 -3
- package/src/core/tree/delta.ts +9 -7
- package/src/core/tree/deltaUtil.ts +1 -1
- package/src/core/tree/visitDelta.ts +2 -2
- package/src/extensibleSchemaUnion.ts +135 -0
- package/src/feature-libraries/changeAtomIdBTree.ts +17 -2
- package/src/feature-libraries/default-schema/defaultFieldKinds.ts +5 -6
- package/src/feature-libraries/default-schema/index.ts +0 -1
- package/src/feature-libraries/forest-summary/codec.ts +7 -2
- package/src/feature-libraries/forest-summary/forestSummarizer.ts +15 -3
- package/src/feature-libraries/forest-summary/formatCommon.ts +2 -3
- package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +4 -5
- package/src/feature-libraries/index.ts +3 -2
- package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +57 -31
- package/src/feature-libraries/modular-schema/genericFieldKind.ts +1 -1
- package/src/feature-libraries/modular-schema/index.ts +4 -1
- package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +7 -6
- package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +32 -7
- package/src/feature-libraries/modular-schema/modularChangeFamily.ts +54 -33
- package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +2 -4
- package/src/feature-libraries/optional-field/optionalField.ts +1 -1
- package/src/feature-libraries/optional-field/requiredField.ts +2 -4
- package/src/feature-libraries/schema-index/codec.ts +1 -1
- package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -1
- package/src/feature-libraries/sequence-field/invert.ts +2 -2
- package/src/feature-libraries/sequence-field/replaceRevisions.ts +17 -10
- package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +1 -1
- package/src/index.ts +12 -7
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/independentView.ts +42 -6
- package/src/shared-tree/index.ts +2 -0
- package/src/shared-tree/schematizingTreeView.ts +63 -18
- package/src/shared-tree/sharedTree.ts +19 -37
- package/src/shared-tree/sharedTreeChangeCodecs.ts +43 -9
- package/src/shared-tree/tree.ts +1 -1
- package/src/shared-tree/treeCheckout.ts +50 -3
- package/src/shared-tree-core/editManagerSummarizer.ts +1 -1
- package/src/shared-tree-core/messageCodecV1ToV4.ts +4 -3
- package/src/shared-tree-core/transaction.ts +125 -23
- package/src/shared-tree-core/versionedSummarizer.ts +3 -2
- package/src/simple-tree/api/index.ts +1 -0
- package/src/simple-tree/api/schemaCreationUtilities.ts +35 -5
- package/src/simple-tree/api/simpleTreeIndex.ts +1 -1
- package/src/simple-tree/api/transactionTypes.ts +10 -0
- package/src/simple-tree/api/tree.ts +88 -6
- package/src/simple-tree/core/treeNodeSchema.ts +5 -8
- package/src/simple-tree/index.ts +3 -0
- package/src/simple-tree/leafNodeSchema.ts +3 -2
- package/src/simple-tree/node-kinds/array/arrayNode.ts +86 -0
- package/src/simple-tree/node-kinds/array/index.ts +2 -0
- package/src/simple-tree/node-kinds/index.ts +2 -0
- package/src/simple-tree/node-kinds/object/objectNode.ts +19 -18
- package/src/tableSchema.ts +280 -140
- package/src/text/textDomainFormatted.ts +1 -1
- package/src/util/bTreeUtils.ts +45 -26
- package/src/util/brand.ts +4 -12
- package/src/util/brandedMap.ts +2 -6
- package/src/util/breakable.ts +3 -2
- package/src/util/index.ts +9 -3
- package/src/util/opaque.ts +2 -6
- package/src/util/rangeMap.ts +11 -5
- package/src/util/readSnapshotBlob.ts +3 -3
- package/src/util/typeCheck.ts +11 -9
- package/src/util/utils.ts +57 -28
- package/biome.jsonc +0 -4
package/src/tableSchema.ts
CHANGED
|
@@ -3,20 +3,18 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access -- This file uses intentional `as any` casts to access hidden internal properties (cells, tableSchemaSymbol) */
|
|
7
|
-
|
|
8
6
|
import { fail } from "@fluidframework/core-utils/internal";
|
|
9
7
|
import { UsageError } from "@fluidframework/telemetry-utils/internal";
|
|
10
8
|
|
|
11
9
|
import { EmptyKey } from "./core/index.js";
|
|
12
10
|
import { TreeAlpha } from "./shared-tree/index.js";
|
|
11
|
+
import type { SchemaFactoryBeta } from "./simple-tree/index.js";
|
|
13
12
|
import {
|
|
14
13
|
type FieldHasDefault,
|
|
15
14
|
type ImplicitAllowedTypes,
|
|
16
15
|
type InsertableObjectFromSchemaRecord,
|
|
17
16
|
type InsertableTreeNodeFromImplicitAllowedTypes,
|
|
18
17
|
type NodeKind,
|
|
19
|
-
SchemaFactoryBeta,
|
|
20
18
|
type ScopedSchemaName,
|
|
21
19
|
TreeArrayNode,
|
|
22
20
|
type TreeNode,
|
|
@@ -36,6 +34,8 @@ import {
|
|
|
36
34
|
eraseSchemaDetailsSubclassable,
|
|
37
35
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports -- This makes the API report slightly cleaner.
|
|
38
36
|
TreeNodeSchemaCore,
|
|
37
|
+
type TransactionConstraintAlpha,
|
|
38
|
+
createCustomizedFluidFrameworkScopedFactory,
|
|
39
39
|
} from "./simple-tree/index.js";
|
|
40
40
|
import { validateIndex, validateIndexRange } from "./util/index.js";
|
|
41
41
|
|
|
@@ -45,18 +45,7 @@ import { validateIndex, validateIndexRange } from "./util/index.js";
|
|
|
45
45
|
// - Omit `props` properties from Row and Column schemas when not provided?
|
|
46
46
|
|
|
47
47
|
// Longer-term work:
|
|
48
|
-
// -
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Scope for table schema built-in types.
|
|
52
|
-
* @remarks User-provided factory scoping will be applied as `com.fluidframework.table<user-scope>`.
|
|
53
|
-
*/
|
|
54
|
-
const baseSchemaScope = "com.fluidframework.table";
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* A private symbol put on table schema to help identify them.
|
|
58
|
-
*/
|
|
59
|
-
const tableSchemaSymbol: unique symbol = Symbol("tableNode");
|
|
48
|
+
// - Use more focused constraint APIs to protect against leaked cells
|
|
60
49
|
|
|
61
50
|
/**
|
|
62
51
|
* A row in a table.
|
|
@@ -88,7 +77,14 @@ export interface RowPrivate<
|
|
|
88
77
|
* This namespace should be strictly type-exported by the package.
|
|
89
78
|
* All members should be tagged with `@system`.
|
|
90
79
|
*
|
|
91
|
-
*
|
|
80
|
+
* Orphaned Cells:
|
|
81
|
+
* Without safeguards, it is possible for cells to become "orphaned".
|
|
82
|
+
* An orphaned cell is a cell that does not correspond to a valid row and column.
|
|
83
|
+
* In order to preserve the invariant that all cells must have a valid row and column, table operations
|
|
84
|
+
* (eg, inserting/removing rows/columns, or setting/removing a cell) will automatically include constraints that
|
|
85
|
+
* guard transactions from producing orphaned cells.
|
|
86
|
+
*
|
|
87
|
+
* @system @beta
|
|
92
88
|
*/
|
|
93
89
|
export namespace System_TableSchema {
|
|
94
90
|
/**
|
|
@@ -99,7 +95,7 @@ export namespace System_TableSchema {
|
|
|
99
95
|
* Note: this can't reasonably be implemented via `Pick<ArrayNode<...>>` because we only want to include the
|
|
100
96
|
* subset of its method overloads which do not support moving items between lists.
|
|
101
97
|
*
|
|
102
|
-
* @
|
|
98
|
+
* @beta @system
|
|
103
99
|
*/
|
|
104
100
|
export type RearrangeableList<TItemSchema extends ImplicitAllowedTypes> = TreeNode &
|
|
105
101
|
readonly TreeNodeFromImplicitAllowedTypes<TItemSchema>[] & {
|
|
@@ -127,7 +123,7 @@ export namespace System_TableSchema {
|
|
|
127
123
|
* Longer term, it would be better to simply omit "props" altogether by default.
|
|
128
124
|
* For now, this ensures that the user doesn't have to specify a "props" entry when initializing column/row nodes
|
|
129
125
|
* and ensures that they cannot set anything that might conflict with future evolutions of the schema.
|
|
130
|
-
* @system @
|
|
126
|
+
* @system @beta
|
|
131
127
|
*/
|
|
132
128
|
export type DefaultPropsType = ReturnType<typeof SchemaFactory.optional<[]>>;
|
|
133
129
|
|
|
@@ -135,7 +131,7 @@ export namespace System_TableSchema {
|
|
|
135
131
|
* A base interface for factory input options which include an schema factory.
|
|
136
132
|
* @remarks This interface should not be referenced directly.
|
|
137
133
|
* @privateRemarks This interface primarily exists to provide a single home for property documentation.
|
|
138
|
-
* @system @
|
|
134
|
+
* @system @beta
|
|
139
135
|
*/
|
|
140
136
|
export interface OptionsWithSchemaFactory<TSchemaFactory extends SchemaFactoryBeta> {
|
|
141
137
|
/**
|
|
@@ -150,7 +146,7 @@ export namespace System_TableSchema {
|
|
|
150
146
|
* A base interface for factory input options which include the table cell schema.
|
|
151
147
|
* @remarks This interface should not be referenced directly.
|
|
152
148
|
* @privateRemarks This interface primarily exists to provide a single home for property documentation.
|
|
153
|
-
* @system @
|
|
149
|
+
* @system @beta
|
|
154
150
|
*/
|
|
155
151
|
export interface OptionsWithCellSchema<TCellSchema extends ImplicitAllowedTypes> {
|
|
156
152
|
/**
|
|
@@ -164,7 +160,7 @@ export namespace System_TableSchema {
|
|
|
164
160
|
/**
|
|
165
161
|
* Base options for creating table column schema.
|
|
166
162
|
* @remarks Includes parameters common to all column factory overloads.
|
|
167
|
-
* @system @
|
|
163
|
+
* @system @beta
|
|
168
164
|
*/
|
|
169
165
|
export type CreateColumnOptionsBase<
|
|
170
166
|
TUserScope extends string = string,
|
|
@@ -174,7 +170,7 @@ export namespace System_TableSchema {
|
|
|
174
170
|
|
|
175
171
|
/**
|
|
176
172
|
* Factory for creating column schema.
|
|
177
|
-
* @system @
|
|
173
|
+
* @system @beta
|
|
178
174
|
*/
|
|
179
175
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
180
176
|
export function createColumnSchema<
|
|
@@ -290,7 +286,7 @@ export namespace System_TableSchema {
|
|
|
290
286
|
|
|
291
287
|
/**
|
|
292
288
|
* Base column schema type.
|
|
293
|
-
* @sealed @system @
|
|
289
|
+
* @sealed @system @beta
|
|
294
290
|
*/
|
|
295
291
|
export type ColumnSchemaBase<
|
|
296
292
|
TUserScope extends string = string,
|
|
@@ -305,7 +301,7 @@ export namespace System_TableSchema {
|
|
|
305
301
|
/**
|
|
306
302
|
* Base options for creating table row schema.
|
|
307
303
|
* @remarks Includes parameters common to all row factory overloads.
|
|
308
|
-
* @system @
|
|
304
|
+
* @system @beta
|
|
309
305
|
*/
|
|
310
306
|
export type CreateRowOptionsBase<
|
|
311
307
|
TUserScope extends string = string,
|
|
@@ -315,7 +311,7 @@ export namespace System_TableSchema {
|
|
|
315
311
|
|
|
316
312
|
/**
|
|
317
313
|
* Factory for creating row schema.
|
|
318
|
-
* @
|
|
314
|
+
* @system @beta
|
|
319
315
|
*/
|
|
320
316
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
321
317
|
export function createRowSchema<
|
|
@@ -443,7 +439,7 @@ export namespace System_TableSchema {
|
|
|
443
439
|
|
|
444
440
|
/**
|
|
445
441
|
* Base row schema type.
|
|
446
|
-
* @sealed @system @
|
|
442
|
+
* @sealed @system @beta
|
|
447
443
|
*/
|
|
448
444
|
export type RowSchemaBase<
|
|
449
445
|
TUserScope extends string = string,
|
|
@@ -458,7 +454,7 @@ export namespace System_TableSchema {
|
|
|
458
454
|
/**
|
|
459
455
|
* Base options for creating table schema.
|
|
460
456
|
* @remarks Includes parameters common to all table factory overloads.
|
|
461
|
-
* @system @
|
|
457
|
+
* @system @beta
|
|
462
458
|
*/
|
|
463
459
|
export type TableFactoryOptionsBase<
|
|
464
460
|
TUserScope extends string = string,
|
|
@@ -468,7 +464,7 @@ export namespace System_TableSchema {
|
|
|
468
464
|
|
|
469
465
|
/**
|
|
470
466
|
* Factory for creating table schema.
|
|
471
|
-
* @system @
|
|
467
|
+
* @system @beta
|
|
472
468
|
*/
|
|
473
469
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
|
|
474
470
|
export function createTableSchema<
|
|
@@ -643,15 +639,33 @@ export namespace System_TableSchema {
|
|
|
643
639
|
|
|
644
640
|
// #endregion
|
|
645
641
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
642
|
+
this.#applyEditsInBatch({
|
|
643
|
+
applyEdits: () => {
|
|
644
|
+
// TypeScript is unable to narrow the column type correctly here, hence the casts below.
|
|
645
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
646
|
+
if (index === undefined) {
|
|
647
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
648
|
+
this.table.columns.insertAtEnd(TreeArrayNode.spread(columns) as any);
|
|
649
|
+
} else {
|
|
650
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
651
|
+
this.table.columns.insertAt(index, TreeArrayNode.spread(columns) as any);
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
// Relevant invariant: each cell corresponds to an existing row and column
|
|
655
|
+
// Scenarios that this constraint is intended to prevent:
|
|
656
|
+
// * Client A inserts a column, then client B adds row with a cell for that column, then client A reverts the column insertion.
|
|
657
|
+
// * Client A inserts a column, then client B populates a cell for that column within an existing row, then client A reverts the column insertion.
|
|
658
|
+
// Notes:
|
|
659
|
+
// * In either scenario, A and B may be the same client.
|
|
660
|
+
// * In either scenario, B's edit and the revert may or may not be concurrent.
|
|
661
|
+
// Collateral scenarios that this constraint also prevents:
|
|
662
|
+
// * Any other scenario where client A inserts a column, then client B edits _any_ part of the tree, then client A reverts the column insertion.
|
|
663
|
+
// Future improvements:
|
|
664
|
+
// Use both...
|
|
665
|
+
// * A "no attach on revert" constraint on the row array
|
|
666
|
+
// * A "no shallow change" constraint on every cell that corresponds to the new column in every existing row
|
|
667
|
+
preconditionsOnRevert: [{ type: "noChange" }],
|
|
668
|
+
});
|
|
655
669
|
|
|
656
670
|
// Inserting the input nodes into the tree hydrates them, making them usable as nodes.
|
|
657
671
|
return columns as unknown as ColumnValueType[];
|
|
@@ -673,15 +687,33 @@ export namespace System_TableSchema {
|
|
|
673
687
|
|
|
674
688
|
// #endregion
|
|
675
689
|
|
|
676
|
-
//
|
|
677
|
-
//
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
690
|
+
// Relevant invariant: each cell corresponds to an existing row and column
|
|
691
|
+
// Prevents cell leaks from concurrently removed columns.
|
|
692
|
+
// Example scenario: Client A removes a column while concurrently Client B adds a row with cells for those columns (including the one A removed).
|
|
693
|
+
// If client B is sequenced after A, then B's row could have cells that do not correspond to existing columns.
|
|
694
|
+
// This constraint ensures all columns that existed when creating the row still exist when the row insertion is applied.
|
|
695
|
+
// TODO: Replace with "no detach" constraint on the column array when available.
|
|
696
|
+
const columnConstraints: TransactionConstraintAlpha[] = this.table.columns.map(
|
|
697
|
+
(column) => ({
|
|
698
|
+
type: "nodeInDocument",
|
|
699
|
+
node: column as ColumnValueType,
|
|
700
|
+
}),
|
|
701
|
+
);
|
|
702
|
+
|
|
703
|
+
this.#applyEditsInBatch({
|
|
704
|
+
applyEdits: () => {
|
|
705
|
+
// TypeScript is unable to narrow the row type correctly here, hence the casts below.
|
|
706
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
707
|
+
if (index === undefined) {
|
|
708
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
709
|
+
this.table.rows.insertAtEnd(TreeArrayNode.spread(rows) as any);
|
|
710
|
+
} else {
|
|
711
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
712
|
+
this.table.rows.insertAt(index, TreeArrayNode.spread(rows) as any);
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
preconditions: columnConstraints.length > 0 ? columnConstraints : undefined,
|
|
716
|
+
});
|
|
685
717
|
|
|
686
718
|
// Inserting the input nodes into the tree hydrates them, making them usable as nodes.
|
|
687
719
|
return rows as unknown as RowValueType[];
|
|
@@ -696,13 +728,48 @@ export namespace System_TableSchema {
|
|
|
696
728
|
const row = this.#getRow(rowOrId);
|
|
697
729
|
const column = this.#getColumn(columnOrId);
|
|
698
730
|
|
|
699
|
-
(
|
|
731
|
+
this.#applyEditsInBatch({
|
|
732
|
+
applyEdits: () => {
|
|
733
|
+
(row as RowValueInternalType).cells[column.id] = cell as CellValueType;
|
|
734
|
+
},
|
|
735
|
+
// Relevant invariant: each cell corresponds to an existing row and column
|
|
736
|
+
// Prevents cell leaks from concurrently removed columns in earlier-sequenced edits.
|
|
737
|
+
// Example scenario: Client A removes a column, then Client B concurrently sets a cell in that column (sequenced after A's edit).
|
|
738
|
+
// If both edits are applied, B's cell would not correspond to an existing column.
|
|
739
|
+
preconditions: [
|
|
740
|
+
{
|
|
741
|
+
type: "nodeInDocument",
|
|
742
|
+
node: column,
|
|
743
|
+
},
|
|
744
|
+
],
|
|
745
|
+
// Relevant invariant: each cell corresponds to an existing row and column
|
|
746
|
+
// Example scenario: Client A overwrites a populated cell, then Client B removes the column associated with the A's cell (this clears the cell).
|
|
747
|
+
// If Client A then reverts their edit, the overwritten value is restored in the cell despite the absence of column for that cell.
|
|
748
|
+
preconditionsOnRevert:
|
|
749
|
+
(row as RowValueInternalType).cells[column.id] === undefined
|
|
750
|
+
? undefined
|
|
751
|
+
: [
|
|
752
|
+
{
|
|
753
|
+
type: "nodeInDocument",
|
|
754
|
+
node: column,
|
|
755
|
+
},
|
|
756
|
+
],
|
|
757
|
+
});
|
|
700
758
|
}
|
|
701
759
|
|
|
702
760
|
public removeColumns(
|
|
703
761
|
indexOrColumns: number | undefined | readonly string[] | readonly ColumnValueType[],
|
|
704
762
|
count: number | undefined = undefined,
|
|
705
763
|
): ColumnValueType[] {
|
|
764
|
+
// Relevant invariant: each cell corresponds to an existing row and column
|
|
765
|
+
// Prevents cell leaks from concurrently added rows in earlier-sequenced edits.
|
|
766
|
+
// Example scenario: Client A adds a row, Client B concurrently removes a column that is populated in A's row.
|
|
767
|
+
// If Client A's edit is sequenced before Client B's edit, then B's removal would orphan the cell in A's row.
|
|
768
|
+
// We have the same problem if Client A populates a cell for one of the columns removed by B
|
|
769
|
+
// This constraint ensures no rows were added.
|
|
770
|
+
// TODO: Replace with "no attach" constraint on the row array when available.
|
|
771
|
+
const preconditions: TransactionConstraintAlpha[] = [{ type: "noChange" }];
|
|
772
|
+
|
|
706
773
|
if (typeof indexOrColumns === "number" || indexOrColumns === undefined) {
|
|
707
774
|
let removedColumns: ColumnValueType[] | undefined;
|
|
708
775
|
const startIndex = indexOrColumns ?? 0;
|
|
@@ -716,25 +783,28 @@ export namespace System_TableSchema {
|
|
|
716
783
|
|
|
717
784
|
validateIndexRange(startIndex, endIndex, this.table.columns, "Table.removeColumns");
|
|
718
785
|
|
|
719
|
-
this.#applyEditsInBatch(
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
786
|
+
this.#applyEditsInBatch({
|
|
787
|
+
applyEdits: () => {
|
|
788
|
+
const columnsToRemove = this.table.columns.slice(
|
|
789
|
+
startIndex,
|
|
790
|
+
endIndex,
|
|
791
|
+
) as ColumnValueType[];
|
|
724
792
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
793
|
+
// First, remove all cells that correspond to each column from each row:
|
|
794
|
+
for (const column of columnsToRemove) {
|
|
795
|
+
this.#removeCells(column);
|
|
796
|
+
}
|
|
729
797
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
798
|
+
// Second, remove the column nodes:
|
|
799
|
+
removeRangeFromArray(
|
|
800
|
+
startIndex,
|
|
801
|
+
endIndex,
|
|
802
|
+
this.table.columns,
|
|
803
|
+
"Table.removeColumns",
|
|
804
|
+
);
|
|
805
|
+
removedColumns = columnsToRemove;
|
|
806
|
+
},
|
|
807
|
+
preconditions,
|
|
738
808
|
});
|
|
739
809
|
return removedColumns ?? fail(0xc1f /* Transaction did not complete. */);
|
|
740
810
|
} else {
|
|
@@ -751,23 +821,26 @@ export namespace System_TableSchema {
|
|
|
751
821
|
columnsToRemove.push(this.#getColumn(columnOrIdToRemove));
|
|
752
822
|
}
|
|
753
823
|
|
|
754
|
-
this.#applyEditsInBatch(
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
824
|
+
this.#applyEditsInBatch({
|
|
825
|
+
applyEdits: () => {
|
|
826
|
+
// Note, throwing an error within a transaction will abort the entire transaction.
|
|
827
|
+
// So if we throw an error here for any column, no columns will be removed.
|
|
828
|
+
for (const columnToRemove of columnsToRemove) {
|
|
829
|
+
// Remove the corresponding cell from all rows.
|
|
830
|
+
for (const row of this.table.rows) {
|
|
831
|
+
// TypeScript is unable to narrow the row type correctly here, hence the cast.
|
|
832
|
+
// See: https://github.com/microsoft/TypeScript/issues/52144
|
|
833
|
+
this.removeCell({
|
|
834
|
+
column: columnToRemove,
|
|
835
|
+
row: row as RowValueType,
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
// We have already validated that all of the columns exist above, so this is safe.
|
|
840
|
+
this.table.columns.removeAt(this.table.columns.indexOf(columnToRemove));
|
|
766
841
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
this.table.columns.removeAt(this.table.columns.indexOf(columnToRemove));
|
|
770
|
-
}
|
|
842
|
+
},
|
|
843
|
+
preconditions,
|
|
771
844
|
});
|
|
772
845
|
return columnsToRemove;
|
|
773
846
|
}
|
|
@@ -777,7 +850,21 @@ export namespace System_TableSchema {
|
|
|
777
850
|
indexOrRows: number | undefined | readonly string[] | readonly RowValueType[],
|
|
778
851
|
count?: number | undefined,
|
|
779
852
|
): RowValueType[] {
|
|
853
|
+
// Relevant invariant: each cell corresponds to an existing row and column
|
|
854
|
+
// Adding a constraint on columns here to prevent cells being orphaned. The relevant scenario is:
|
|
855
|
+
// Client A removes rows
|
|
856
|
+
// Client B (either concurrently or not, so long as B's edit is sequenced after A's edit) removes a column,
|
|
857
|
+
// Client A reverts the removal of the rows
|
|
858
|
+
// TODO: Replace with "no detach on revert" constraint on the column array when available.
|
|
859
|
+
const columnConstraints: TransactionConstraintAlpha[] = this.table.columns.map(
|
|
860
|
+
(column) => ({
|
|
861
|
+
type: "nodeInDocument",
|
|
862
|
+
node: column as ColumnValueType,
|
|
863
|
+
}),
|
|
864
|
+
);
|
|
865
|
+
|
|
780
866
|
if (typeof indexOrRows === "number" || indexOrRows === undefined) {
|
|
867
|
+
let removedRows: RowValueType[] | undefined;
|
|
781
868
|
const startIndex = indexOrRows ?? 0;
|
|
782
869
|
const endIndex = count === undefined ? this.table.rows.length : startIndex + count;
|
|
783
870
|
|
|
@@ -786,12 +873,20 @@ export namespace System_TableSchema {
|
|
|
786
873
|
return [];
|
|
787
874
|
}
|
|
788
875
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
876
|
+
validateIndexRange(startIndex, endIndex, this.table.rows, "Table.removeRows");
|
|
877
|
+
this.#applyEditsInBatch({
|
|
878
|
+
applyEdits: () => {
|
|
879
|
+
removedRows = removeRangeFromArray(
|
|
880
|
+
startIndex,
|
|
881
|
+
endIndex,
|
|
882
|
+
this.table.rows,
|
|
883
|
+
"Table.removeRows",
|
|
884
|
+
);
|
|
885
|
+
},
|
|
886
|
+
preconditionsOnRevert:
|
|
887
|
+
columnConstraints.length > 0 ? columnConstraints : undefined,
|
|
888
|
+
});
|
|
889
|
+
return removedRows ?? fail(0xccd /* Transaction did not complete */);
|
|
795
890
|
}
|
|
796
891
|
|
|
797
892
|
// If there are no rows to remove, do nothing
|
|
@@ -806,15 +901,17 @@ export namespace System_TableSchema {
|
|
|
806
901
|
for (const rowToRemove of indexOrRows) {
|
|
807
902
|
rowsToRemove.push(this.#getRow(rowToRemove));
|
|
808
903
|
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
904
|
+
this.#applyEditsInBatch({
|
|
905
|
+
applyEdits: () => {
|
|
906
|
+
// Note, throwing an error within a transaction will abort the entire transaction.
|
|
907
|
+
// So if we throw an error here for any row, no rows will be removed.
|
|
908
|
+
for (const rowToRemove of rowsToRemove) {
|
|
909
|
+
// We have already validated that all of the rows exist above, so this is safe.
|
|
910
|
+
const index = this.table.rows.indexOf(rowToRemove);
|
|
911
|
+
this.table.rows.removeAt(index);
|
|
912
|
+
}
|
|
913
|
+
},
|
|
914
|
+
preconditionsOnRevert: columnConstraints.length > 0 ? columnConstraints : undefined,
|
|
818
915
|
});
|
|
819
916
|
return rowsToRemove;
|
|
820
917
|
}
|
|
@@ -831,8 +928,24 @@ export namespace System_TableSchema {
|
|
|
831
928
|
return undefined;
|
|
832
929
|
}
|
|
833
930
|
|
|
834
|
-
|
|
835
|
-
|
|
931
|
+
this.#applyEditsInBatch({
|
|
932
|
+
applyEdits: () => {
|
|
933
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
934
|
+
delete row.cells[column.id];
|
|
935
|
+
},
|
|
936
|
+
// Relevant invariant: each cell corresponds to an existing row and column
|
|
937
|
+
// Prevents cell leaks from concurrently removed columns in earlier-sequenced edits when this cell removal is reverted.
|
|
938
|
+
// Example scenario: Client A removes a cell, then Client B removes the column for that cell.
|
|
939
|
+
// If A's cell removal is later reverted, the cell would be restored but B's column removal means there's no column for it.
|
|
940
|
+
// This constraint on revert ensures the column still exists, ensuring restored cells correspond to existing columns.
|
|
941
|
+
preconditionsOnRevert: [
|
|
942
|
+
{
|
|
943
|
+
type: "nodeInDocument",
|
|
944
|
+
node: column,
|
|
945
|
+
},
|
|
946
|
+
],
|
|
947
|
+
});
|
|
948
|
+
|
|
836
949
|
return cell;
|
|
837
950
|
}
|
|
838
951
|
|
|
@@ -859,7 +972,15 @@ export namespace System_TableSchema {
|
|
|
859
972
|
* Transactions are not supported for unhydrated trees, so we cannot run a transaction in that case.
|
|
860
973
|
* But since there are no collaborators, this is not an issue.
|
|
861
974
|
*/
|
|
862
|
-
#applyEditsInBatch(
|
|
975
|
+
#applyEditsInBatch(options: {
|
|
976
|
+
/** The edits to apply. */
|
|
977
|
+
applyEdits: () => void;
|
|
978
|
+
/** Optional constraints that must be satisfied for the transaction to proceed. */
|
|
979
|
+
preconditions?: readonly TransactionConstraintAlpha[];
|
|
980
|
+
/** Optional constraints that must be satisfied on revert for the transaction to proceed. */
|
|
981
|
+
preconditionsOnRevert?: readonly TransactionConstraintAlpha[];
|
|
982
|
+
}): void {
|
|
983
|
+
const { applyEdits, preconditions, preconditionsOnRevert } = options;
|
|
863
984
|
const branch = TreeAlpha.branch(this);
|
|
864
985
|
|
|
865
986
|
// Ensure events are paused until all of the edits are applied.
|
|
@@ -872,9 +993,15 @@ export namespace System_TableSchema {
|
|
|
872
993
|
// Therefore, we don't need to run the edits as a transaction.
|
|
873
994
|
applyEdits();
|
|
874
995
|
} else {
|
|
875
|
-
branch.runTransaction(
|
|
876
|
-
|
|
877
|
-
|
|
996
|
+
branch.runTransaction(
|
|
997
|
+
() => {
|
|
998
|
+
applyEdits();
|
|
999
|
+
if (preconditionsOnRevert !== undefined) {
|
|
1000
|
+
return { preconditionsOnRevert };
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
1003
|
+
preconditions === undefined ? undefined : { preconditions },
|
|
1004
|
+
);
|
|
878
1005
|
}
|
|
879
1006
|
});
|
|
880
1007
|
}
|
|
@@ -1078,9 +1205,9 @@ export namespace System_TableSchema {
|
|
|
1078
1205
|
// #region If the row contains cells, verify that the table contains the columns for those cells
|
|
1079
1206
|
|
|
1080
1207
|
// Note: we intentionally hide `cells` on `IRow` to avoid leaking the internal data representation as much as possible, so we have to cast here.
|
|
1081
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1208
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
1082
1209
|
if ((newRow as any).cells !== undefined) {
|
|
1083
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1210
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
1084
1211
|
const keys: string[] = Object.keys((newRow as any).cells);
|
|
1085
1212
|
for (const key of keys) {
|
|
1086
1213
|
if (!columnIds.has(key)) {
|
|
@@ -1115,13 +1242,6 @@ export namespace System_TableSchema {
|
|
|
1115
1242
|
}
|
|
1116
1243
|
}
|
|
1117
1244
|
|
|
1118
|
-
// Set a private symbol on the schema class that marks it as having been generated by this factory.
|
|
1119
|
-
// Column / Row functionality use this to validate that they are being used in a table.
|
|
1120
|
-
// This is effectively a work-around that allows columns and rows to invoke table methods
|
|
1121
|
-
// without having to pass the table as a parameter to their construction, which isn't possible.
|
|
1122
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1123
|
-
(Table as any)[tableSchemaSymbol] = true;
|
|
1124
|
-
|
|
1125
1245
|
// Named interfaces here do not compile.
|
|
1126
1246
|
type Statics = {
|
|
1127
1247
|
/**
|
|
@@ -1158,7 +1278,7 @@ export namespace System_TableSchema {
|
|
|
1158
1278
|
|
|
1159
1279
|
/**
|
|
1160
1280
|
* Base row schema type.
|
|
1161
|
-
* @sealed @system @
|
|
1281
|
+
* @sealed @system @beta
|
|
1162
1282
|
*/
|
|
1163
1283
|
export type TableSchemaBase<
|
|
1164
1284
|
TUserScope extends string,
|
|
@@ -1170,10 +1290,15 @@ export namespace System_TableSchema {
|
|
|
1170
1290
|
// #endregion
|
|
1171
1291
|
}
|
|
1172
1292
|
|
|
1293
|
+
/**
|
|
1294
|
+
* Sets up scope for table schema built-in types.
|
|
1295
|
+
* @remarks User-provided factory scoping will be applied as `com.fluidframework.table<user-scope>`.
|
|
1296
|
+
*/
|
|
1297
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
1173
1298
|
function createTableScopedFactory<TUserScope extends string>(
|
|
1174
1299
|
inputSchemaFactory: SchemaFactoryBeta<TUserScope>,
|
|
1175
|
-
)
|
|
1176
|
-
return
|
|
1300
|
+
) {
|
|
1301
|
+
return createCustomizedFluidFrameworkScopedFactory(inputSchemaFactory, "tableV2");
|
|
1177
1302
|
}
|
|
1178
1303
|
|
|
1179
1304
|
/**
|
|
@@ -1204,10 +1329,16 @@ function removeRangeFromArray<TNodeSchema extends ImplicitAllowedTypes>(
|
|
|
1204
1329
|
*
|
|
1205
1330
|
* @remarks
|
|
1206
1331
|
*
|
|
1207
|
-
*
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
1210
|
-
*
|
|
1332
|
+
* Note: the APIs produced by this module ensure various tabular data invariants are maintained that the raw, underlying tree structures do not.
|
|
1333
|
+
* For example, they ensure that cells always correspond to existing rows and columns (and do not become "orphaned" due to row/column deletion, etc.).
|
|
1334
|
+
* For this reason, direct manipulation of the underlying tree structures is not supported.
|
|
1335
|
+
* To modify the data, only the APIs provided here may be used.
|
|
1336
|
+
*
|
|
1337
|
+
* Also note: these APIs leverage `SharedTree` functionality that was added in version `2.80.0`,
|
|
1338
|
+
* which is not compatible with previous versions of this library.
|
|
1339
|
+
* To ensure safe collaboration, you will need to configure the {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}
|
|
1340
|
+
* for the Fluid Runtime and/or `SharedTree` to at least `2.80.0`.
|
|
1341
|
+
* To set this minimum version for `SharedTree`, use {@link configuredSharedTreeBeta}.
|
|
1211
1342
|
*
|
|
1212
1343
|
* The primary APIs for create tabular data schema are:
|
|
1213
1344
|
*
|
|
@@ -1230,12 +1361,6 @@ function removeRangeFromArray<TNodeSchema extends ImplicitAllowedTypes>(
|
|
|
1230
1361
|
* Column and Row schema created using these APIs are extensible via the `props` field.
|
|
1231
1362
|
* This allows association of additional properties with column and row nodes.
|
|
1232
1363
|
*
|
|
1233
|
-
* Cells in the table may become "orphaned."
|
|
1234
|
-
* That is, it is possible to enter a state where one or more rows contain cells with no corresponding column.
|
|
1235
|
-
* To reduce the likelihood of this, you can manually remove corresponding cells when removing columns.
|
|
1236
|
-
* Either way, it is possible to enter such a state via the merging of edits.
|
|
1237
|
-
* For example: one client might add a row while another concurrently removes a column, orphaning the cell where the column and row intersected.
|
|
1238
|
-
*
|
|
1239
1364
|
* @example Defining a Table schema
|
|
1240
1365
|
*
|
|
1241
1366
|
* ```typescript
|
|
@@ -1311,7 +1436,7 @@ function removeRangeFromArray<TNodeSchema extends ImplicitAllowedTypes>(
|
|
|
1311
1436
|
* The above examples are backed by tests in `tableSchema.spec.ts`.
|
|
1312
1437
|
* Those tests and these examples should be kept in-sync to ensure that the examples are correct.
|
|
1313
1438
|
*
|
|
1314
|
-
* @
|
|
1439
|
+
* @beta
|
|
1315
1440
|
*/
|
|
1316
1441
|
export namespace TableSchema {
|
|
1317
1442
|
// #region Column
|
|
@@ -1321,7 +1446,7 @@ export namespace TableSchema {
|
|
|
1321
1446
|
* @remarks Implemented by the schema class returned from {@link TableSchema.(column:2)}.
|
|
1322
1447
|
* @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.
|
|
1323
1448
|
* @typeParam TProps - Additional properties to associate with the column.
|
|
1324
|
-
* @sealed @
|
|
1449
|
+
* @sealed @beta
|
|
1325
1450
|
*/
|
|
1326
1451
|
export interface Column<
|
|
1327
1452
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Reserving this for future use.
|
|
@@ -1349,7 +1474,7 @@ export namespace TableSchema {
|
|
|
1349
1474
|
* Factory for creating new table column schema.
|
|
1350
1475
|
* @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.
|
|
1351
1476
|
* @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.
|
|
1352
|
-
* @
|
|
1477
|
+
* @beta
|
|
1353
1478
|
*/
|
|
1354
1479
|
export function column<
|
|
1355
1480
|
const TUserScope extends string,
|
|
@@ -1370,7 +1495,7 @@ export namespace TableSchema {
|
|
|
1370
1495
|
* @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.
|
|
1371
1496
|
* @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.
|
|
1372
1497
|
* @typeParam TProps - Additional properties to associate with the column.
|
|
1373
|
-
* @
|
|
1498
|
+
* @beta
|
|
1374
1499
|
*/
|
|
1375
1500
|
export function column<
|
|
1376
1501
|
const TUserScope extends string,
|
|
@@ -1410,7 +1535,7 @@ export namespace TableSchema {
|
|
|
1410
1535
|
* @remarks Implemented by the schema class returned from {@link TableSchema.(row:2)}.
|
|
1411
1536
|
* @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.
|
|
1412
1537
|
* @typeParam TProps - Additional properties to associate with the row.
|
|
1413
|
-
* @sealed @
|
|
1538
|
+
* @sealed @beta
|
|
1414
1539
|
*/
|
|
1415
1540
|
export interface Row<
|
|
1416
1541
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Reserving this for future use.
|
|
@@ -1438,7 +1563,7 @@ export namespace TableSchema {
|
|
|
1438
1563
|
* Factory for creating new table column schema.
|
|
1439
1564
|
* @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.
|
|
1440
1565
|
* @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.
|
|
1441
|
-
* @
|
|
1566
|
+
* @beta
|
|
1442
1567
|
*/
|
|
1443
1568
|
export function row<
|
|
1444
1569
|
const TUserScope extends string,
|
|
@@ -1455,7 +1580,7 @@ export namespace TableSchema {
|
|
|
1455
1580
|
* @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.
|
|
1456
1581
|
* @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.
|
|
1457
1582
|
* @typeParam TProps - Additional properties to associate with the row.
|
|
1458
|
-
* @
|
|
1583
|
+
* @beta
|
|
1459
1584
|
*/
|
|
1460
1585
|
export function row<
|
|
1461
1586
|
const TUserScope extends string,
|
|
@@ -1492,7 +1617,12 @@ export namespace TableSchema {
|
|
|
1492
1617
|
|
|
1493
1618
|
/**
|
|
1494
1619
|
* A key to uniquely identify a cell within a table.
|
|
1495
|
-
*
|
|
1620
|
+
*
|
|
1621
|
+
* @remarks
|
|
1622
|
+
* Note that edits to the table structure (including edits by collaborators) can cause indexes to refer to different cells over time.
|
|
1623
|
+
* Therefore, it is recommended to use IDs or node references whenever possible to identify cells.
|
|
1624
|
+
*
|
|
1625
|
+
* @input @beta
|
|
1496
1626
|
*/
|
|
1497
1627
|
export interface CellKey<
|
|
1498
1628
|
TColumn extends ImplicitAllowedTypes,
|
|
@@ -1511,7 +1641,7 @@ export namespace TableSchema {
|
|
|
1511
1641
|
|
|
1512
1642
|
/**
|
|
1513
1643
|
* {@link TableSchema.Table.insertColumns} parameters.
|
|
1514
|
-
* @input @
|
|
1644
|
+
* @input @beta
|
|
1515
1645
|
*/
|
|
1516
1646
|
export interface InsertColumnsParameters<TColumn extends ImplicitAllowedTypes> {
|
|
1517
1647
|
/**
|
|
@@ -1528,7 +1658,7 @@ export namespace TableSchema {
|
|
|
1528
1658
|
|
|
1529
1659
|
/**
|
|
1530
1660
|
* {@link TableSchema.Table.insertRows} parameters.
|
|
1531
|
-
* @input @
|
|
1661
|
+
* @input @beta
|
|
1532
1662
|
*/
|
|
1533
1663
|
export interface InsertRowsParameters<TRow extends ImplicitAllowedTypes> {
|
|
1534
1664
|
/**
|
|
@@ -1545,7 +1675,7 @@ export namespace TableSchema {
|
|
|
1545
1675
|
|
|
1546
1676
|
/**
|
|
1547
1677
|
* {@link TableSchema.Table.setCell} parameters.
|
|
1548
|
-
* @input @
|
|
1678
|
+
* @input @beta
|
|
1549
1679
|
*/
|
|
1550
1680
|
export interface SetCellParameters<
|
|
1551
1681
|
TCell extends ImplicitAllowedTypes,
|
|
@@ -1575,7 +1705,7 @@ export namespace TableSchema {
|
|
|
1575
1705
|
* @typeParam TColumn - The type of the columns in the table.
|
|
1576
1706
|
* @typeParam TRow - The type of the rows in the table.
|
|
1577
1707
|
*
|
|
1578
|
-
* @sealed @
|
|
1708
|
+
* @sealed @beta
|
|
1579
1709
|
*/
|
|
1580
1710
|
export interface Table<
|
|
1581
1711
|
TUserScope extends string,
|
|
@@ -1600,6 +1730,11 @@ export namespace TableSchema {
|
|
|
1600
1730
|
getColumn(id: string): TreeNodeFromImplicitAllowedTypes<TColumn> | undefined;
|
|
1601
1731
|
/**
|
|
1602
1732
|
* Gets a table column by its index in the table.
|
|
1733
|
+
*
|
|
1734
|
+
* @remarks
|
|
1735
|
+
* Note that edits to the table structure (including edits by collaborators) can cause indexes to refer to different columns over time.
|
|
1736
|
+
* Therefore, it is recommended to use IDs whenever possible to identify columns.
|
|
1737
|
+
*
|
|
1603
1738
|
* @returns The column, if it exists. Otherwise, `undefined`.
|
|
1604
1739
|
*/
|
|
1605
1740
|
getColumn(index: number): TreeNodeFromImplicitAllowedTypes<TColumn> | undefined;
|
|
@@ -1611,6 +1746,11 @@ export namespace TableSchema {
|
|
|
1611
1746
|
getRow(id: string): TreeNodeFromImplicitAllowedTypes<TRow> | undefined;
|
|
1612
1747
|
/**
|
|
1613
1748
|
* Gets a table row by its index in the table.
|
|
1749
|
+
*
|
|
1750
|
+
* @remarks
|
|
1751
|
+
* Note that edits to the table structure (including edits by collaborators) can cause indexes to refer to different rows over time.
|
|
1752
|
+
* Therefore, it is recommended to use IDs whenever possible to identify rows.
|
|
1753
|
+
*
|
|
1614
1754
|
* @returns The row, if it exists. Otherwise, `undefined`.
|
|
1615
1755
|
*/
|
|
1616
1756
|
getRow(index: number): TreeNodeFromImplicitAllowedTypes<TRow> | undefined;
|
|
@@ -1741,7 +1881,7 @@ export namespace TableSchema {
|
|
|
1741
1881
|
|
|
1742
1882
|
/**
|
|
1743
1883
|
* Input parameters for {@link TableSchema.Table}'s `create` factory method.
|
|
1744
|
-
* @input @
|
|
1884
|
+
* @input @beta
|
|
1745
1885
|
*/
|
|
1746
1886
|
export interface TableFactoryMethodParameters<
|
|
1747
1887
|
TUserScope extends string,
|
|
@@ -1768,7 +1908,7 @@ export namespace TableSchema {
|
|
|
1768
1908
|
* @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.
|
|
1769
1909
|
* The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.Table`.
|
|
1770
1910
|
* @typeParam TCell - The type of the cells in the table.
|
|
1771
|
-
* @
|
|
1911
|
+
* @beta
|
|
1772
1912
|
*/
|
|
1773
1913
|
export function table<
|
|
1774
1914
|
const TUserScope extends string,
|
|
@@ -1795,7 +1935,7 @@ export namespace TableSchema {
|
|
|
1795
1935
|
* The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.Table`.
|
|
1796
1936
|
* @typeParam TCell - The type of the cells in the table.
|
|
1797
1937
|
* @typeParam TColumn - The type of the columns in the table.
|
|
1798
|
-
* @
|
|
1938
|
+
* @beta
|
|
1799
1939
|
*/
|
|
1800
1940
|
export function table<
|
|
1801
1941
|
const TUserScope extends string,
|
|
@@ -1821,7 +1961,7 @@ export namespace TableSchema {
|
|
|
1821
1961
|
* The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.Table`.
|
|
1822
1962
|
* @typeParam TCell - The type of the cells in the table.
|
|
1823
1963
|
* @typeParam TRow - The type of the rows in the table.
|
|
1824
|
-
* @
|
|
1964
|
+
* @beta
|
|
1825
1965
|
*/
|
|
1826
1966
|
export function table<
|
|
1827
1967
|
const TUserScope extends string,
|
|
@@ -1852,7 +1992,7 @@ export namespace TableSchema {
|
|
|
1852
1992
|
* @typeParam TCell - The type of the cells in the table.
|
|
1853
1993
|
* @typeParam TColumn - The type of the columns in the table.
|
|
1854
1994
|
* @typeParam TRow - The type of the rows in the table.
|
|
1855
|
-
* @
|
|
1995
|
+
* @beta
|
|
1856
1996
|
*/
|
|
1857
1997
|
export function table<
|
|
1858
1998
|
const TUserScope extends string,
|