@fluidframework/tree 2.40.0 → 2.41.0-338186

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.
Files changed (198) hide show
  1. package/api-report/tree.alpha.api.md +1 -1
  2. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  3. package/dist/feature-libraries/default-schema/schemaChecker.js +0 -7
  4. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  5. package/dist/feature-libraries/flex-tree/context.d.ts +16 -14
  6. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  7. package/dist/feature-libraries/flex-tree/context.js +12 -18
  8. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  9. package/dist/feature-libraries/flex-tree/index.d.ts +1 -1
  10. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  11. package/dist/feature-libraries/flex-tree/index.js +1 -2
  12. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  13. package/dist/feature-libraries/flex-tree/lazyField.d.ts +1 -5
  14. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  15. package/dist/feature-libraries/flex-tree/lazyField.js +2 -16
  16. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  17. package/dist/feature-libraries/flex-tree/utilities.d.ts +6 -6
  18. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  19. package/dist/feature-libraries/flex-tree/utilities.js +6 -7
  20. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  21. package/dist/feature-libraries/index.d.ts +1 -1
  22. package/dist/feature-libraries/index.d.ts.map +1 -1
  23. package/dist/feature-libraries/index.js +1 -2
  24. package/dist/feature-libraries/index.js.map +1 -1
  25. package/dist/packageVersion.d.ts +1 -1
  26. package/dist/packageVersion.d.ts.map +1 -1
  27. package/dist/packageVersion.js +1 -1
  28. package/dist/packageVersion.js.map +1 -1
  29. package/dist/shared-tree/checkoutFlexTreeView.d.ts +7 -3
  30. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  31. package/dist/shared-tree/checkoutFlexTreeView.js +11 -2
  32. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  33. package/dist/shared-tree/schematizeTree.d.ts +1 -1
  34. package/dist/shared-tree/schematizeTree.js +1 -1
  35. package/dist/shared-tree/schematizeTree.js.map +1 -1
  36. package/dist/shared-tree/schematizingTreeView.d.ts +3 -0
  37. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  38. package/dist/shared-tree/schematizingTreeView.js +13 -7
  39. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  40. package/dist/shared-tree/treeAlpha.d.ts +1 -4
  41. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  42. package/dist/shared-tree/treeAlpha.js +6 -1
  43. package/dist/shared-tree/treeAlpha.js.map +1 -1
  44. package/dist/simple-tree/api/create.d.ts +5 -1
  45. package/dist/simple-tree/api/create.d.ts.map +1 -1
  46. package/dist/simple-tree/api/create.js +10 -11
  47. package/dist/simple-tree/api/create.js.map +1 -1
  48. package/dist/simple-tree/api/index.d.ts +2 -2
  49. package/dist/simple-tree/api/index.d.ts.map +1 -1
  50. package/dist/simple-tree/api/index.js +2 -2
  51. package/dist/simple-tree/api/index.js.map +1 -1
  52. package/dist/simple-tree/api/storedSchema.d.ts +1 -8
  53. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  54. package/dist/simple-tree/api/storedSchema.js +3 -14
  55. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  56. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  57. package/dist/simple-tree/arrayNode.js +3 -9
  58. package/dist/simple-tree/arrayNode.js.map +1 -1
  59. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +4 -4
  60. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  61. package/dist/simple-tree/core/unhydratedFlexTree.js +9 -5
  62. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  63. package/dist/simple-tree/index.d.ts +3 -2
  64. package/dist/simple-tree/index.d.ts.map +1 -1
  65. package/dist/simple-tree/index.js +6 -4
  66. package/dist/simple-tree/index.js.map +1 -1
  67. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  68. package/dist/simple-tree/mapNode.js +17 -20
  69. package/dist/simple-tree/mapNode.js.map +1 -1
  70. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  71. package/dist/simple-tree/objectNode.js +2 -4
  72. package/dist/simple-tree/objectNode.js.map +1 -1
  73. package/dist/simple-tree/prepareForInsertion.d.ts +30 -0
  74. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -0
  75. package/dist/simple-tree/prepareForInsertion.js +137 -0
  76. package/dist/simple-tree/prepareForInsertion.js.map +1 -0
  77. package/dist/simple-tree/proxies.d.ts +1 -12
  78. package/dist/simple-tree/proxies.d.ts.map +1 -1
  79. package/dist/simple-tree/proxies.js +10 -106
  80. package/dist/simple-tree/proxies.js.map +1 -1
  81. package/dist/simple-tree/toMapTree.d.ts +1 -1
  82. package/dist/simple-tree/toMapTree.js +1 -1
  83. package/dist/simple-tree/toMapTree.js.map +1 -1
  84. package/dist/tableSchema.d.ts +108 -59
  85. package/dist/tableSchema.d.ts.map +1 -1
  86. package/dist/tableSchema.js +93 -44
  87. package/dist/tableSchema.js.map +1 -1
  88. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  89. package/lib/feature-libraries/default-schema/schemaChecker.js +0 -7
  90. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  91. package/lib/feature-libraries/flex-tree/context.d.ts +16 -14
  92. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  93. package/lib/feature-libraries/flex-tree/context.js +11 -16
  94. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  95. package/lib/feature-libraries/flex-tree/index.d.ts +1 -1
  96. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  97. package/lib/feature-libraries/flex-tree/index.js +1 -1
  98. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  99. package/lib/feature-libraries/flex-tree/lazyField.d.ts +1 -5
  100. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  101. package/lib/feature-libraries/flex-tree/lazyField.js +1 -14
  102. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  103. package/lib/feature-libraries/flex-tree/utilities.d.ts +6 -6
  104. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  105. package/lib/feature-libraries/flex-tree/utilities.js +6 -7
  106. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  107. package/lib/feature-libraries/index.d.ts +1 -1
  108. package/lib/feature-libraries/index.d.ts.map +1 -1
  109. package/lib/feature-libraries/index.js +1 -1
  110. package/lib/feature-libraries/index.js.map +1 -1
  111. package/lib/packageVersion.d.ts +1 -1
  112. package/lib/packageVersion.d.ts.map +1 -1
  113. package/lib/packageVersion.js +1 -1
  114. package/lib/packageVersion.js.map +1 -1
  115. package/lib/shared-tree/checkoutFlexTreeView.d.ts +7 -3
  116. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  117. package/lib/shared-tree/checkoutFlexTreeView.js +12 -3
  118. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  119. package/lib/shared-tree/schematizeTree.d.ts +1 -1
  120. package/lib/shared-tree/schematizeTree.js +1 -1
  121. package/lib/shared-tree/schematizeTree.js.map +1 -1
  122. package/lib/shared-tree/schematizingTreeView.d.ts +3 -0
  123. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  124. package/lib/shared-tree/schematizingTreeView.js +14 -8
  125. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  126. package/lib/shared-tree/treeAlpha.d.ts +1 -4
  127. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  128. package/lib/shared-tree/treeAlpha.js +7 -2
  129. package/lib/shared-tree/treeAlpha.js.map +1 -1
  130. package/lib/simple-tree/api/create.d.ts +5 -1
  131. package/lib/simple-tree/api/create.d.ts.map +1 -1
  132. package/lib/simple-tree/api/create.js +8 -10
  133. package/lib/simple-tree/api/create.js.map +1 -1
  134. package/lib/simple-tree/api/index.d.ts +2 -2
  135. package/lib/simple-tree/api/index.d.ts.map +1 -1
  136. package/lib/simple-tree/api/index.js +2 -2
  137. package/lib/simple-tree/api/index.js.map +1 -1
  138. package/lib/simple-tree/api/storedSchema.d.ts +1 -8
  139. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  140. package/lib/simple-tree/api/storedSchema.js +2 -12
  141. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  142. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  143. package/lib/simple-tree/arrayNode.js +4 -10
  144. package/lib/simple-tree/arrayNode.js.map +1 -1
  145. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +4 -4
  146. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  147. package/lib/simple-tree/core/unhydratedFlexTree.js +9 -5
  148. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  149. package/lib/simple-tree/index.d.ts +3 -2
  150. package/lib/simple-tree/index.d.ts.map +1 -1
  151. package/lib/simple-tree/index.js +3 -2
  152. package/lib/simple-tree/index.js.map +1 -1
  153. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  154. package/lib/simple-tree/mapNode.js +3 -6
  155. package/lib/simple-tree/mapNode.js.map +1 -1
  156. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  157. package/lib/simple-tree/objectNode.js +4 -6
  158. package/lib/simple-tree/objectNode.js.map +1 -1
  159. package/lib/simple-tree/prepareForInsertion.d.ts +30 -0
  160. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -0
  161. package/lib/simple-tree/prepareForInsertion.js +131 -0
  162. package/lib/simple-tree/prepareForInsertion.js.map +1 -0
  163. package/lib/simple-tree/proxies.d.ts +1 -12
  164. package/lib/simple-tree/proxies.d.ts.map +1 -1
  165. package/lib/simple-tree/proxies.js +1 -96
  166. package/lib/simple-tree/proxies.js.map +1 -1
  167. package/lib/simple-tree/toMapTree.d.ts +1 -1
  168. package/lib/simple-tree/toMapTree.js +1 -1
  169. package/lib/simple-tree/toMapTree.js.map +1 -1
  170. package/lib/tableSchema.d.ts +108 -59
  171. package/lib/tableSchema.d.ts.map +1 -1
  172. package/lib/tableSchema.js +94 -45
  173. package/lib/tableSchema.js.map +1 -1
  174. package/lib/tsdoc-metadata.json +1 -1
  175. package/package.json +25 -25
  176. package/src/feature-libraries/default-schema/schemaChecker.ts +0 -8
  177. package/src/feature-libraries/flex-tree/context.ts +18 -20
  178. package/src/feature-libraries/flex-tree/index.ts +0 -1
  179. package/src/feature-libraries/flex-tree/lazyField.ts +2 -14
  180. package/src/feature-libraries/flex-tree/utilities.ts +8 -8
  181. package/src/feature-libraries/index.ts +0 -1
  182. package/src/packageVersion.ts +1 -1
  183. package/src/shared-tree/checkoutFlexTreeView.ts +10 -6
  184. package/src/shared-tree/schematizeTree.ts +1 -1
  185. package/src/shared-tree/schematizingTreeView.ts +14 -14
  186. package/src/shared-tree/treeAlpha.ts +21 -5
  187. package/src/simple-tree/api/create.ts +15 -15
  188. package/src/simple-tree/api/index.ts +6 -2
  189. package/src/simple-tree/api/storedSchema.ts +2 -19
  190. package/src/simple-tree/arrayNode.ts +9 -20
  191. package/src/simple-tree/core/unhydratedFlexTree.ts +10 -5
  192. package/src/simple-tree/index.ts +6 -5
  193. package/src/simple-tree/mapNode.ts +8 -12
  194. package/src/simple-tree/objectNode.ts +3 -12
  195. package/src/simple-tree/prepareForInsertion.ts +236 -0
  196. package/src/simple-tree/proxies.ts +2 -147
  197. package/src/simple-tree/toMapTree.ts +1 -1
  198. package/src/tableSchema.ts +310 -158
@@ -1 +1 @@
1
- {"version":3,"file":"tableSchema.js","sourceRoot":"","sources":["../src/tableSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;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AM,KAAW,WAAW,CAojB3B;AApjBD,WAAiB,WAAW;IAC3B,iBAAiB;IAsDjB;;OAEG;IACH,SAAgB,YAAY,CAAC,EAC5B,aAAa,EACb,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,GAGlD;QACA,OAAO,kBAAkB,CAAC,oBAAoB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAPe,wBAAY,eAO3B,CAAA;IAsGD;;OAEG;IACH,SAAgB,SAAS,CAAC,EACzB,aAAa,EACb,IAAI,EACJ,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,GAGlD;QACA,OAAO,kBAAkB,CAAC,iBAAiB,CAAC,aAAa,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;IARe,qBAAS,YAQxB,CAAA;IA6WD;;OAEG;IACH,SAAgB,WAAW,CAAC,EAC3B,aAAa,EACb,IAAI,EACJ,MAAM,GAAG,YAAY,CAAC;QACrB,aAAa;KACb,CAAC,EACF,GAAG,GAAG,SAAS,CAAC;QACf,aAAa;QACb,IAAI;KACJ,CAAC,GAIF;QACA,OAAO,kBAAkB,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IACjF,CAAC;IAfe,uBAAW,cAe1B,CAAA;IAED,aAAa;AACd,CAAC,EApjBgB,WAAW,KAAX,WAAW,QAojB3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { oob } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { Tree } from \"./shared-tree/index.js\";\nimport {\n\ttype FieldHasDefault,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeKind,\n\ttype SchemaFactoryAlpha,\n\ttype ScopedSchemaName,\n\tTreeArrayNode,\n\ttype TreeNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaClass,\n\ttype WithType,\n\ttype TreeFieldFromImplicitField,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InternalTreeNode,\n\tSchemaFactory,\n\ttype ImplicitAnnotatedFieldSchema,\n\ttype UnannotateImplicitFieldSchema,\n} from \"./simple-tree/index.js\";\n\n// Future improvement TODOs:\n// - Omit `cells` property from Row insertion type.\n// - Record-like type parameters / input parameters?\n// - Omit `props` properties from Row and Column schemas when not provided?\n\n// Longer-term work:\n// - Add constraint APIs to make it possible to avoid situations that could yield \"orphaned\" cells.\n\n/**\n * The sub-scope applied to user-provided {@link SchemaFactory}s by table schema factories.\n */\nconst tableSchemaFactorySubScope = \"table\";\n\n/**\n * Not intended for use outside of this package.\n *\n * @privateRemarks\n * This namespace is a collection of internal system types relate to {@link TableSchema}.\n * This namespace should be strictly type-exported by the package.\n * All members should be tagged with `@system`.\n *\n * @system @internal\n */\nexport namespace System_TableSchema {\n\t/**\n\t * Default type used for column and row \"props\" fields.\n\t * @privateRemarks\n\t * Longer term, it would be better to simply omit \"props\" altogether by default.\n\t * For now, this ensures that the user doesn't have to specify a \"props\" entry when initializing column/row nodes\n\t * and ensures that they cannot set anything that might conflict with future evolutions of the schema.\n\t * @system @internal\n\t */\n\texport type DefaultPropsType = ReturnType<typeof SchemaFactory.optional<[]>>;\n\n\t/**\n\t * A base interface for factory input options which include an schema factory.\n\t * @remarks This interface should not be referenced directly.\n\t * @privateRemarks This interface primarily exists to provide a single home for property documentation.\n\t * @system @internal\n\t */\n\texport interface OptionsWithSchemaFactory<TSchemaFactory extends SchemaFactoryAlpha> {\n\t\t/**\n\t\t * Schema factory with which the Column schema will be associated.\n\t\t * @remarks Can be used to associate the resulting schema with an existing {@link SchemaFactory.scope|scope}.\n\t\t */\n\t\treadonly schemaFactory: TSchemaFactory;\n\t}\n\n\t/**\n\t * A base interface for factory input options which include the table cell schema.\n\t * @remarks This interface should not be referenced directly.\n\t * @privateRemarks This interface primarily exists to provide a single home for property documentation.\n\t * @system @internal\n\t */\n\texport interface OptionsWithCellSchema<TCellSchema extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * Schema for the table's cells.\n\t\t */\n\t\treadonly cell: TCellSchema;\n\t}\n\n\t// #region Column\n\n\t/**\n\t * Base options for creating table cow schema.\n\t * @remarks Includes parameters common to all column factory overloads.\n\t * @system @internal\n\t */\n\texport type CreateColumnOptionsBase<\n\t\tTSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,\n\t> = OptionsWithSchemaFactory<TSchemaFactory>;\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @system @internal\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createColumnInternal<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TPropsSchema extends ImplicitAnnotatedFieldSchema,\n\t>(inputSchemaFactory: SchemaFactoryAlpha<TInputScope>, propsSchema: TPropsSchema) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\t// Note: `columnFields` is broken into two parts to work around a TypeScript bug\n\t\t// that results in broken `.d.ts` output.\n\t\t// See definition of `ColumnInsertableType` below.\n\t\tconst columnFieldsBuiltInParts = {\n\t\t\tid: schemaFactory.identifier,\n\t\t} as const;\n\t\tconst columnFieldsPropsPart = {\n\t\t\tprops: propsSchema,\n\t\t} as const;\n\n\t\t/**\n\t\t * {@link Column} fields.\n\t\t *\n\t\t * @remarks\n\t\t * Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t *\n\t\t * Note: ideally we would add a satisfies clause here to ensure that this satisfies\n\t\t * `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.\n\t\t * Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394\n\t\t */\n\t\tconst columnFields = {\n\t\t\t...columnFieldsBuiltInParts,\n\t\t\t...columnFieldsPropsPart,\n\t\t} as const; // satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * A column in a table.\n\t\t */\n\t\tclass Column\n\t\t\textends schemaFactory.objectAlpha(\"Column\", columnFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Column<TPropsSchema> {}\n\n\t\ttype ColumnValueType = TreeNode &\n\t\t\tTableSchema.Column<TPropsSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Column\">>;\n\n\t\t// Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof columnFields>`,\n\t\t// but that results in broken `.d.ts` output due to a TypeScript bug.\n\t\t// See: https://github.com/microsoft/TypeScript/issues/58688.\n\t\t// Instead we extract and inline the typing of the \"props\" field here, which seems to sufficiently work around the issue.\n\t\t// type ColumnInsertableType = InsertableObjectFromSchemaRecord<typeof columnFields>;\n\t\ttype ColumnInsertableType = InsertableObjectFromSchemaRecord<\n\t\t\ttypeof columnFieldsBuiltInParts\n\t\t> &\n\t\t\t(FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true\n\t\t\t\t? // Note: The docs on the below properties are copied from `IColumn.props`' docs to ensure that the\n\t\t\t\t\t// documentation appears in the data insertion scenario.\n\t\t\t\t\t// The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly\n\t\t\t\t\t// support `@inheritDoc`.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/31267\n\t\t\t\t\t{\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The column's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops?: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The column's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t});\n\n\t\t// Modified version of `Column` that ensures the constructor (and `createFromInsertable`) are\n\t\t// typed correctly in terms of our insertable type.\n\t\t// This lets us be selective in our type-cast for the value returned from this function,\n\t\t// preserving as much type-safety as we reasonably can.\n\t\ttype ColumnSchemaModifiedType = Omit<\n\t\t\t// Use mapped type to omit the constructor\n\t\t\t{\n\t\t\t\t[Property in keyof typeof Column]: (typeof Column)[Property];\n\t\t\t},\n\t\t\t\"createFromInsertable\"\n\t\t> &\n\t\t\t(new (\n\t\t\t\tparameters: InternalTreeNode | ColumnInsertableType,\n\t\t\t) => Column) & {\n\t\t\t\tcreateFromInsertable(parameters: ColumnInsertableType): Column;\n\t\t\t};\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst ColumnSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Column\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ ColumnValueType,\n\t\t\t/* TInsertable */ object & ColumnInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof columnFields\n\t\t> = Column as ColumnSchemaModifiedType;\n\n\t\treturn ColumnSchemaType;\n\t}\n\n\t/**\n\t * Base column schema type.\n\t * @sealed @system @internal\n\t */\n\texport type ColumnSchemaBase<\n\t\tTScope extends string | undefined = string | undefined,\n\t\tTPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> = ReturnType<typeof createColumnInternal<TScope, TPropsSchema>>;\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * Base options for creating table row schema.\n\t * @remarks Includes parameters common to all row factory overloads.\n\t * @system @internal\n\t */\n\texport type CreateRowOptionsBase<\n\t\tTSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,\n\t\tTCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;\n\n\t/**\n\t * Factory for creating new table row schema.\n\t *\n\t * @sealed @internal\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createRowInternal<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TPropsSchema extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\tcellSchema: TCellSchema,\n\t\tpropsSchema: TPropsSchema,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\t\ttype CellInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\n\t\t// Note: `rowFields` is broken into two parts to work around a TypeScript bug\n\t\t// that results in broken `.d.ts` output.\n\t\t// See definition of `RowInsertableType` below.\n\t\tconst rowFieldsBuiltInParts = {\n\t\t\tid: schemaFactory.identifier,\n\t\t\tcells: schemaFactory.required(schemaFactory.map(\"Row.cells\", cellSchema), {\n\t\t\t\tmetadata: {\n\t\t\t\t\tdescription: \"The cells of the table row, keyed by column ID.\",\n\t\t\t\t},\n\t\t\t}),\n\t\t} as const;\n\t\tconst rowFieldsPropsPart = {\n\t\t\tprops: propsSchema,\n\t\t} as const;\n\n\t\t/**\n\t\t * {@link Row} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t * Note: ideally we would add a satisfies clause here to ensure that this satisfies\n\t\t * `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.\n\t\t * Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394\n\t\t */\n\t\tconst rowFields = {\n\t\t\t...rowFieldsBuiltInParts,\n\t\t\t...rowFieldsPropsPart,\n\t\t} as const; // satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * The Row schema - this is a map of Cells where the key is the column id\n\t\t */\n\t\tclass Row\n\t\t\textends schemaFactory.objectAlpha(\"Row\", rowFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Row<TCellSchema, TPropsSchema>\n\t\t{\n\t\t\tpublic getCell(columnOrId: TableSchema.Column | string): CellValueType | undefined {\n\t\t\t\tconst columnId = typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\t\t\t\treturn this.cells.get(columnId) as CellValueType | undefined;\n\t\t\t}\n\n\t\t\tpublic setCell(\n\t\t\t\tcolumnOrId: TableSchema.Column | string,\n\t\t\t\tvalue: CellInsertableType | undefined,\n\t\t\t): void {\n\t\t\t\t// TODO: throw if column does not exist in the owning table.\n\n\t\t\t\tconst columnId = typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\t\t\t\tthis.cells.set(columnId, value);\n\t\t\t}\n\n\t\t\tpublic removeCell(columnOrId: TableSchema.Column | string): CellValueType | undefined {\n\t\t\t\t// TODO: throw if column does not exist in the owning table.\n\n\t\t\t\tconst columnId = typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\n\t\t\t\tconst cell: CellValueType | undefined = this.cells.get(columnId);\n\t\t\t\tif (cell === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tthis.cells.delete(columnId);\n\t\t\t\treturn cell;\n\t\t\t}\n\t\t}\n\n\t\ttype RowValueType = TreeNode &\n\t\t\tTableSchema.Row<TCellSchema, TPropsSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Row\">>;\n\n\t\t// Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof rowFields>`,\n\t\t// but that results in broken `.d.ts` output due to a TypeScript bug.\n\t\t// See: https://github.com/microsoft/TypeScript/issues/58688.\n\t\t// Instead we extract and inline the typing of the \"props\" field here, which seems to sufficiently work around\n\t\t// the issue.\n\t\t// type RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFields>;\n\t\ttype RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFieldsBuiltInParts> &\n\t\t\t(FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true\n\t\t\t\t? // Note: The docs on the below properties are copied from `IRow.props`' docs to ensure that the\n\t\t\t\t\t// documentation appears in the data insertion scenario.\n\t\t\t\t\t// The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly\n\t\t\t\t\t// support `@inheritDoc`.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/31267\n\t\t\t\t\t{\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information\n\t\t\t\t\t\t * about the row.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops?: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information\n\t\t\t\t\t\t * about the row.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t});\n\n\t\t// Modified version of `Row` that ensures the constructor (and `createFromInsertable`) are\n\t\t// typed correctly in terms of our insertable type.\n\t\t// This lets us be selective in our type-cast for the value returned from this function,\n\t\t// preserving as much type-safety as we reasonably can.\n\t\ttype RowSchemaModifiedType = Omit<\n\t\t\t// Use mapped type to omit the constructor\n\t\t\t{\n\t\t\t\t[Property in keyof typeof Row]: (typeof Row)[Property];\n\t\t\t},\n\t\t\t\"createFromInsertable\"\n\t\t> &\n\t\t\t(new (\n\t\t\t\tparameters: InternalTreeNode | RowInsertableType,\n\t\t\t) => Row) & {\n\t\t\t\tcreateFromInsertable(parameters: RowInsertableType): Row;\n\t\t\t};\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst RowSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Row\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ RowValueType,\n\t\t\t/* TInsertable */ object & RowInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof rowFields\n\t\t> = Row as RowSchemaModifiedType;\n\n\t\treturn RowSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @internal\n\t */\n\texport type RowSchemaBase<\n\t\tTScope extends string | undefined = string | undefined,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\tTPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> = ReturnType<typeof createRowInternal<TScope, TCellSchema, TPropsSchema>>;\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * Base options for creating table schema.\n\t * @remarks Includes parameters common to all table factory overloads.\n\t * @system @internal\n\t */\n\texport type TableFactoryOptionsBase<\n\t\tTSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,\n\t\tTCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;\n\n\t/**\n\t * Factory for creating new table schema.\n\t * @system @internal\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createTableInternal<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TColumnSchema extends ColumnSchemaBase<TInputScope>,\n\t\tconst TRowSchema extends RowSchemaBase<TInputScope, TCellSchema>,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\t_cellSchema: TCellSchema,\n\t\tcolumnSchema: TColumnSchema,\n\t\trowSchema: TRowSchema,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\t\ttype ColumnValueType = TreeNodeFromImplicitAllowedTypes<TColumnSchema>;\n\t\ttype RowValueType = TreeNodeFromImplicitAllowedTypes<TRowSchema>;\n\n\t\t/**\n\t\t * {@link Table} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t */\n\t\tconst tableFields = {\n\t\t\trows: schemaFactory.array(\"Table.rows\", rowSchema),\n\t\t\tcolumns: schemaFactory.array(\"Table.columns\", columnSchema),\n\t\t} as const satisfies Record<string, ImplicitAnnotatedFieldSchema>;\n\n\t\t/**\n\t\t * The Table schema\n\t\t */\n\t\tclass Table\n\t\t\textends schemaFactory.objectAlpha(\"Table\", tableFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Table<TCellSchema, TColumnSchema, TRowSchema>\n\t\t{\n\t\t\tpublic getColumn(id: string): ColumnValueType | undefined {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.columns.find((column) => (column as ColumnValueType).id === id) as\n\t\t\t\t\t| ColumnValueType\n\t\t\t\t\t| undefined;\n\t\t\t}\n\n\t\t\tpublic getRow(id: string): RowValueType | undefined {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.rows.find((_row) => (_row as RowValueType).id === id) as\n\t\t\t\t\t| RowValueType\n\t\t\t\t\t| undefined;\n\t\t\t}\n\n\t\t\tpublic getCell(\n\t\t\t\tkey: TableSchema.CellKey<TColumnSchema, TRowSchema>,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\t\t\t\tconst row = this._getRow(rowOrId);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn row.getCell(column);\n\t\t\t}\n\n\t\t\tpublic insertColumn({\n\t\t\t\tcolumn,\n\t\t\t\tindex,\n\t\t\t}: TableSchema.InsertColumnParameters<TColumnSchema>): ColumnValueType {\n\t\t\t\tconst inserted = this.insertColumns({\n\t\t\t\t\tcolumns: [column],\n\t\t\t\t\tindex,\n\t\t\t\t});\n\t\t\t\treturn inserted[0] ?? oob();\n\t\t\t}\n\n\t\t\tpublic insertColumns({\n\t\t\t\tcolumns,\n\t\t\t\tindex,\n\t\t\t}: TableSchema.InsertColumnsParameters<TColumnSchema>): ColumnValueType[] {\n\t\t\t\t// #region Input validation\n\n\t\t\t\t// Ensure index is valid\n\t\t\t\tif (index !== undefined) {\n\t\t\t\t\tTable.validateInsertionIndex(index, this.columns);\n\t\t\t\t}\n\n\t\t\t\t// Check all of the columns being inserted an ensure the table does not already contain any with the same ID.\n\t\t\t\tfor (const column of columns) {\n\t\t\t\t\t// TypeScript is unable to narrow the type of the column type correctly here, hence the casts below.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\tconst maybeId = (column as ColumnValueType).id;\n\t\t\t\t\tif (maybeId !== undefined && this.containsColumnWithId(maybeId)) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`A column with ID \"${(column as ColumnValueType).id}\" already exists in the table.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// #endregion\n\n\t\t\t\t// TypeScript is unable to narrow the column type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.columns.insertAtEnd(TreeArrayNode.spread(columns) as any);\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.columns.insertAt(index, TreeArrayNode.spread(columns) as any);\n\t\t\t\t}\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn columns as unknown as ColumnValueType[];\n\t\t\t}\n\n\t\t\tpublic insertRow({\n\t\t\t\trow,\n\t\t\t\tindex,\n\t\t\t}: TableSchema.InsertRowParameters<TRowSchema>): RowValueType {\n\t\t\t\tconst inserted = this.insertRows({\n\t\t\t\t\trows: [row],\n\t\t\t\t\tindex,\n\t\t\t\t});\n\t\t\t\treturn inserted[0] ?? oob();\n\t\t\t}\n\n\t\t\tpublic insertRows({\n\t\t\t\tindex,\n\t\t\t\trows,\n\t\t\t}: TableSchema.InsertRowsParameters<TRowSchema>): RowValueType[] {\n\t\t\t\t// #region Input validation\n\n\t\t\t\t// Ensure index is valid\n\t\t\t\tif (index !== undefined) {\n\t\t\t\t\tTable.validateInsertionIndex(index, this.rows);\n\t\t\t\t}\n\n\t\t\t\t// Note: TypeScript is unable to narrow the type of the row type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tfor (const newRow of rows) {\n\t\t\t\t\t// Check all of the rows being inserted an ensure the table does not already contain any with the same ID.\n\t\t\t\t\tconst maybeId = (newRow as RowValueType).id;\n\t\t\t\t\tif (maybeId !== undefined && this.containsRowWithId(maybeId)) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`A row with ID \"${(newRow as RowValueType).id}\" already exists in the table.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// If the row contains cells, verify that the table contains the columns for those cells.\n\t\t\t\t\t// Note: we intentionally hide `cells` on `IRow` to avoid leaking the internal data representation as much as possible, so we have to cast here.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tif ((newRow as any).cells !== undefined) {\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\tconst keys: string[] = Object.keys((newRow as any).cells);\n\t\t\t\t\t\tfor (const key of keys) {\n\t\t\t\t\t\t\tif (!this.containsColumnWithId(key)) {\n\t\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\t`Attempted to insert row a cell under column ID \"${key}\", but the table does not contain a column with that ID.`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// #endregion\n\n\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.rows.insertAtEnd(TreeArrayNode.spread(rows) as any);\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.rows.insertAt(index, TreeArrayNode.spread(rows) as any);\n\t\t\t\t}\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn rows as unknown as RowValueType[];\n\t\t\t}\n\n\t\t\tpublic setCell({\n\t\t\t\tkey,\n\t\t\t\tcell,\n\t\t\t}: TableSchema.SetCellParameters<TCellSchema, TColumnSchema, TRowSchema>): void {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\n\t\t\t\tconst row = this._getRow(rowOrId);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\tconst rowId = this._getRowId(rowOrId);\n\t\t\t\t\tthrow new UsageError(`No row with ID \"${rowId}\" exists in the table.`);\n\t\t\t\t}\n\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\tconst columnId = this._getColumnId(columnOrId);\n\t\t\t\t\tthrow new UsageError(`No column with ID \"${columnId}\" exists in the table.`);\n\t\t\t\t}\n\n\t\t\t\trow.setCell(column, cell);\n\t\t\t}\n\n\t\t\tpublic removeColumns(\n\t\t\t\tcolumns: readonly string[] | readonly ColumnValueType[],\n\t\t\t): ColumnValueType[] {\n\t\t\t\t// If there are no columns to remove, do nothing\n\t\t\t\tif (columns.length === 0) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\t// If there is only one column to remove, remove it (and don't incur cost of transaction)\n\t\t\t\tif (columns.length === 1) {\n\t\t\t\t\tconst removedColumn = this.removeColumn(columns[0] ?? oob());\n\t\t\t\t\treturn [removedColumn];\n\t\t\t\t}\n\n\t\t\t\t// If there are multiple columns to remove, remove them in a transaction.\n\t\t\t\tconst removedColumns: ColumnValueType[] = [];\n\t\t\t\tTree.runTransaction(this, () => {\n\t\t\t\t\t// Note, throwing an error within a transaction will abort the entire transaction.\n\t\t\t\t\t// So if we throw an error here for any row, no columns will be removed.\n\t\t\t\t\tfor (const columnToRemove of columns) {\n\t\t\t\t\t\tconst removedRow = this.removeColumn(columnToRemove);\n\t\t\t\t\t\tremovedColumns.push(removedRow);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn removedColumns;\n\t\t\t}\n\n\t\t\tpublic removeColumn(columnOrId: string | ColumnValueType): ColumnValueType {\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\t\t\t\tconst index = column === undefined ? -1 : this.columns.indexOf(column);\n\t\t\t\tif (index === -1) {\n\t\t\t\t\tconst columnId = this._getColumnId(columnOrId);\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Specified column with ID \"${columnId}\" does not exist in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.columns.removeAt(index);\n\t\t\t\treturn column as ColumnValueType;\n\t\t\t}\n\n\t\t\tpublic removeAllColumns(): ColumnValueType[] {\n\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.removeColumns(this.columns as unknown as ColumnValueType[]);\n\t\t\t}\n\n\t\t\tpublic removeRows(rows: readonly string[] | readonly RowValueType[]): RowValueType[] {\n\t\t\t\t// If there are no rows to remove, do nothing\n\t\t\t\tif (rows.length === 0) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\t// If there is only one row to remove, remove it (and don't incur cost of transaction)\n\t\t\t\tif (rows.length === 1) {\n\t\t\t\t\tconst removedRow = this.removeRow(rows[0] ?? oob());\n\t\t\t\t\treturn [removedRow];\n\t\t\t\t}\n\n\t\t\t\t// If there are multiple rows to remove, remove them in a transaction.\n\t\t\t\tconst removedRows: RowValueType[] = [];\n\t\t\t\tTree.runTransaction(this, () => {\n\t\t\t\t\t// Note, throwing an error within a transaction will abort the entire transaction.\n\t\t\t\t\t// So if we throw an error here for any row, no rows will be removed.\n\t\t\t\t\tfor (const rowToRemove of rows) {\n\t\t\t\t\t\tconst removedRow = this.removeRow(rowToRemove);\n\t\t\t\t\t\tremovedRows.push(removedRow);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn removedRows;\n\t\t\t}\n\n\t\t\tpublic removeRow(rowOrId: string | RowValueType): RowValueType {\n\t\t\t\tconst rowToRemove = this._getRow(rowOrId);\n\t\t\t\tconst index = rowToRemove === undefined ? -1 : this.rows.indexOf(rowToRemove);\n\n\t\t\t\t// If the row does not exist in the table, throw an error.\n\t\t\t\tif (index === -1) {\n\t\t\t\t\tconst rowId = this._getRowId(rowOrId);\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Specified row with ID \"${rowId}\" does not exist in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.rows.removeAt(index);\n\t\t\t\treturn rowToRemove as RowValueType;\n\t\t\t}\n\n\t\t\tpublic removeAllRows(): RowValueType[] {\n\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.removeRows(this.rows as unknown as RowValueType[]);\n\t\t\t}\n\n\t\t\tpublic removeCell(\n\t\t\t\tkey: TableSchema.CellKey<TColumnSchema, TRowSchema>,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\t\t\t\tconst row = this._getRow(rowOrId);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\tconst rowId = this._getRowId(rowOrId);\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Specified row with ID \"${rowId}\" does not exist in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\tconst columnId = this._getColumnId(columnOrId);\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Specified column with ID \"${columnId}\" does not exist in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst cell: CellValueType | undefined = row.getCell(column.id);\n\t\t\t\tif (cell === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\trow.removeCell(column.id);\n\t\t\t\treturn cell;\n\t\t\t}\n\n\t\t\tprivate _getColumn(columnOrId: string | ColumnValueType): ColumnValueType | undefined {\n\t\t\t\treturn typeof columnOrId === \"string\" ? this.getColumn(columnOrId) : columnOrId;\n\t\t\t}\n\n\t\t\tprivate _getColumnId(columnOrId: string | ColumnValueType): string {\n\t\t\t\treturn typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\t\t\t}\n\n\t\t\tprivate _getRow(rowOrId: string | RowValueType): RowValueType | undefined {\n\t\t\t\treturn typeof rowOrId === \"string\" ? this.getRow(rowOrId) : rowOrId;\n\t\t\t}\n\n\t\t\tprivate _getRowId(rowOrId: string | RowValueType): string {\n\t\t\t\treturn typeof rowOrId === \"string\" ? rowOrId : rowOrId.id;\n\t\t\t}\n\n\t\t\tprivate containsColumnWithId(columnId: string): boolean {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn (\n\t\t\t\t\tthis.columns.find((column) => (column as TableSchema.Column).id === columnId) !==\n\t\t\t\t\tundefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tprivate containsRowWithId(rowId: string): boolean {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.rows.find((row) => (row as TableSchema.Row).id === rowId) !== undefined;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Ensure that the specified index is a valid location for item insertion in the destination list.\n\t\t\t * @throws Throws a usage error if the destination is invalid.\n\t\t\t */\n\t\t\tprivate static validateInsertionIndex(\n\t\t\t\tindex: number,\n\t\t\t\tdestinationList: readonly unknown[],\n\t\t\t): void {\n\t\t\t\tif (index < 0) {\n\t\t\t\t\tthrow new UsageError(\"The index must be greater than or equal to 0.\");\n\t\t\t\t}\n\n\t\t\t\tif (index > destinationList.length) {\n\t\t\t\t\tthrow new UsageError(\"The index specified for insertion is out of bounds.\");\n\t\t\t\t}\n\n\t\t\t\tif (!Number.isInteger(index)) {\n\t\t\t\t\tthrow new UsageError(\"The index must be an integer.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttype TableValueType = TreeNode &\n\t\t\tTableSchema.Table<TCellSchema, TColumnSchema, TRowSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Table\">>;\n\t\ttype TableInsertableType = InsertableObjectFromSchemaRecord<typeof tableFields>;\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst TableSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Table\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ TableValueType,\n\t\t\t/* TInsertable */ object & TableInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof tableFields\n\t\t> = Table;\n\n\t\t// Return the table schema\n\t\treturn TableSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @internal\n\t */\n\texport type TableSchemaBase<\n\t\tTScope extends string | undefined,\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends ColumnSchemaBase<TScope>,\n\t\tTRow extends RowSchemaBase<TScope, TCell>,\n\t> = ReturnType<typeof createTableInternal<TScope, TCell, TColumn, TRow>>;\n\n\t// #endregion\n}\n\n/**\n * Contains types and factories for creating schema to represent dynamic tabular data.\n *\n * @remarks\n *\n * Tables created using these APIs are...\n *\n * - sparse, meaning that cells may be omitted, and new rows are empty by default.\n *\n * - dynamic, meaning that their structure can be modified at runtime.\n * Columns and rows can be inserted, removed, modified, and reordered.\n * Cells can be inserted, removed, and modified.\n *\n * - row-major, meaning that operating on rows (including inserts, removal, moves, and traversal) is more efficient than operating on columns.\n *\n * Column and Row schema created using these APIs are extensible via the `props` field.\n * This allows association of additional properties with column and row nodes.\n *\n * Note: for now it is possible for table cells to become \"orphaned\".\n * That is, it is possible to enter a state where one or more rows contain cells with no corresponding column.\n * To help avoid this situation, you can manually remove corresponding cells when removing columns.\n * Either way, it is possible to enter such a state via the merging of edits.\n * For example: one client might add a row while another concurrently removes a column, orphaning the cell where the column and row intersected.\n *\n * @example Using default Column and Row schema\n *\n * ```typescript\n * class Cell extends schemaFactory.object(\"TableCell\", {\n * \tvalue: schemaFactory.string,\n * }) {}\n *\n * class Table extends TableSchema.createTable({\n * \tschemaFactory,\n * \tcell: Cell,\n * }) {}\n *\n * const table = new Table({\n * \tcolumns: [{ id: \"column-0\" }],\n * \trows: [{ id: \"row-0\", cells: {} }],\n * });\n * ```\n *\n * @example Customizing Column and Row schema\n *\n * ```typescript\n * class Cell extends schemaFactory.object(\"TableCell\", {\n * \tvalue: schemaFactory.string,\n * }) {}\n *\n * class ColumnProps extends schemaFactory.object(\"TableColumnProps\", {\n * \t// Column label to display.\n * \tlabel: schemaFactory.string,\n * \t// The type of data represented by the cells. Default: string.\n * \tdataType: schemaFactory.optional(schemaFactory.string),\n * }) {}\n *\n * class Column extends TableSchema.createColumn({\n * \tschemaFactory,\n * \tprops: ColumnProps,\n * }) {}\n *\n * class Row extends TableSchema.createRow({\n * \tschemaFactory,\n * \tcell: Cell,\n * }) {}\n *\n * class Table extends TableSchema.createTable({\n * \tschemaFactory,\n * \tcell: Cell,\n * \tcolumn: Column,\n * \trow: Row,\n * }) {}\n *\n * const table = new Table({\n * \tcolumns: [\n * \t\tnew Column({ props: { label: \"Entry\", dataType: \"string\" } }),\n * \t\tnew Column({ props: { label: \"Date\", dataType: \"date\" } }),\n * \t\tnew Column({ props: { label: \"Amount\", dataType: \"number\" } }),\n * \t],\n * \trows: [],\n * });\n * ```\n *\n * @privateRemarks\n * The above examples are backed by tests in `tableSchema.spec.ts`.\n * Those tests and these examples should be kept in-sync to ensure that the examples are correct.\n *\n * @internal\n */\nexport namespace TableSchema {\n\t// #region Column\n\n\t/**\n\t * A column in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.(createColumn:2)}.\n\t * @sealed @internal\n\t */\n\texport interface Column<\n\t\tTProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the column.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * The column's properties.\n\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t * @privateRemarks\n\t\t * Note: these docs are duplicated on the inline type definitions in {@link createColumn}.\n\t\t * If you update the docs here, please also update the inline type definitions.\n\t\t */\n\t\tget props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>;\n\t\tset props(value: InsertableTreeFieldFromImplicitField<\n\t\t\tUnannotateImplicitFieldSchema<TProps>\n\t\t>);\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @internal\n\t */\n\texport function createColumn<const TScope extends string | undefined>({\n\t\tschemaFactory,\n\t}: System_TableSchema.CreateColumnOptionsBase<\n\t\tSchemaFactoryAlpha<TScope>\n\t>): System_TableSchema.ColumnSchemaBase<TScope, System_TableSchema.DefaultPropsType>;\n\t/**\n\t * Factory for creating new table column schema.\n\t * @internal\n\t */\n\texport function createColumn<\n\t\tconst TScope extends string | undefined,\n\t\tconst TProps extends ImplicitAnnotatedFieldSchema,\n\t>({\n\t\tschemaFactory,\n\t\tprops,\n\t}: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>> & {\n\t\t/**\n\t\t * Optional column properties.\n\t\t */\n\t\treadonly props: TProps;\n\t}): System_TableSchema.ColumnSchemaBase<TScope, TProps>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function createColumn({\n\t\tschemaFactory,\n\t\tprops = SchemaFactory.optional(SchemaFactory.null),\n\t}: System_TableSchema.CreateColumnOptionsBase & {\n\t\treadonly props?: ImplicitAnnotatedFieldSchema;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createColumnInternal(schemaFactory, props);\n\t}\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * A row in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.(createRow:2)}.\n\t * @sealed @internal\n\t */\n\texport interface Row<\n\t\tTCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\tTProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the row.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * Gets the cell in the specified column.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @privateRemarks TODO: throw if the column does not belong to the same table as the row.\n\t\t */\n\t\tgetCell(column: Column): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t\t/**\n\t\t * Gets the cell in the specified column, denoted by column ID.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t */\n\t\tgetCell(columnId: string): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * Sets the cell in the specified column.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Row.(removeCell:1)} instead.\n\t\t * @privateRemarks TODO: Throw an error if the column does not exist in the table.\n\t\t */\n\t\tsetCell(column: Column, value: InsertableTreeNodeFromImplicitAllowedTypes<TCell>): void;\n\t\t/**\n\t\t * Sets the cell in the specified column, denoted by column ID.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Row.(removeCell:2)} instead.\n\t\t */\n\t\tsetCell(columnId: string, value: InsertableTreeNodeFromImplicitAllowedTypes<TCell>): void;\n\n\t\t/**\n\t\t * Removes the cell in the specified column.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @privateRemarks TODO: Throw if the column does not belong to the same table as the row.\n\t\t */\n\t\tremoveCell(column: Column): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t\t/**\n\t\t * Removes the cell in the specified column, denoted by column ID.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t */\n\t\tremoveCell(columnId: string): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * The row's properties.\n\t\t * @remarks This is a user-defined schema that can be used to store additional information about the row.\n\t\t * @privateRemarks\n\t\t * Note: these docs are duplicated on the inline type definitions in {@link createColumn}.\n\t\t * If you update the docs here, please also update the inline type definitions.\n\t\t */\n\t\tget props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>;\n\t\tset props(value: InsertableTreeFieldFromImplicitField<\n\t\t\tUnannotateImplicitFieldSchema<TProps>\n\t\t>);\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @internal\n\t */\n\texport function createRow<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>({\n\t\tschemaFactory,\n\t\tcell,\n\t}: System_TableSchema.CreateRowOptionsBase<\n\t\tSchemaFactoryAlpha<TScope>,\n\t\tTCell\n\t>): System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>;\n\t/**\n\t * Factory for creating new table column schema.\n\t * @internal\n\t */\n\texport function createRow<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TProps extends ImplicitAnnotatedFieldSchema,\n\t>({\n\t\tschemaFactory,\n\t\tcell,\n\t\tprops,\n\t}: System_TableSchema.CreateRowOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t/**\n\t\t * Optional row properties.\n\t\t */\n\t\treadonly props: TProps;\n\t}): System_TableSchema.RowSchemaBase<TScope, TCell, TProps>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function createRow({\n\t\tschemaFactory,\n\t\tcell,\n\t\tprops = SchemaFactory.optional(SchemaFactory.null),\n\t}: System_TableSchema.CreateRowOptionsBase & {\n\t\treadonly props?: ImplicitAnnotatedFieldSchema;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createRowInternal(schemaFactory, cell, props);\n\t}\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * A key to uniquely identify a cell within a table.\n\t * @internal\n\t */\n\texport interface CellKey<\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * {@link TableSchema.Column} or {@link TableSchema.Column.id} at which the cell is located.\n\t\t */\n\t\treadonly column: string | TreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\t/**\n\t\t * {@link TableSchema.Row} or {@link TableSchema.Row.id} at which the cell is located.\n\t\t */\n\t\treadonly row: string | TreeNodeFromImplicitAllowedTypes<TRow>;\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertColumn} parameters.\n\t * @internal\n\t */\n\texport interface InsertColumnParameters<TColumn extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new column.\n\t\t * @remarks If not provided, the column will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The column to insert.\n\t\t */\n\t\treadonly column: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>;\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertColumns} parameters.\n\t * @internal\n\t */\n\texport interface InsertColumnsParameters<TColumn extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new columns.\n\t\t * @remarks If not provided, the columns will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The columns to insert.\n\t\t */\n\t\treadonly columns: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertRow} parameters.\n\t * @internal\n\t */\n\texport interface InsertRowParameters<TRow extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new row.\n\t\t * @remarks If not provided, the row will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The row to insert.\n\t\t */\n\t\treadonly row: InsertableTreeNodeFromImplicitAllowedTypes<TRow>;\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertRows} parameters.\n\t * @internal\n\t */\n\texport interface InsertRowsParameters<TRow extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new rows.\n\t\t * @remarks If not provided, the rows will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The rows to insert.\n\t\t */\n\t\treadonly rows: InsertableTreeNodeFromImplicitAllowedTypes<TRow>[];\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.setCell} parameters.\n\t * @internal\n\t */\n\texport interface SetCellParameters<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * The key to uniquely identify a cell in a table.\n\t\t */\n\t\treadonly key: CellKey<TColumn, TRow>;\n\n\t\t/**\n\t\t * The cell to set.\n\t\t */\n\t\treadonly cell: InsertableTreeNodeFromImplicitAllowedTypes<TCell>;\n\t}\n\n\t/**\n\t * A table.\n\t * @sealed @internal\n\t */\n\texport interface Table<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * The table's columns.\n\t\t */\n\t\treadonly columns: TreeArrayNode<TColumn>;\n\n\t\t/**\n\t\t * The table's rows.\n\t\t */\n\t\treadonly rows: TreeArrayNode<TRow>;\n\n\t\t/**\n\t\t * Gets a table column by its {@link TableSchema.Column.id}.\n\t\t */\n\t\tgetColumn(id: string): TreeNodeFromImplicitAllowedTypes<TColumn> | undefined;\n\n\t\t/**\n\t\t * Gets a table row by its {@link TableSchema.Row.id}.\n\t\t */\n\t\tgetRow(id: string): TreeNodeFromImplicitAllowedTypes<TRow> | undefined;\n\n\t\t/**\n\t\t * Gets a cell in the table by column and row IDs.\n\t\t * @param key - A key that uniquely distinguishes a cell in the table, represented as a combination of the column ID and row ID.\n\t\t */\n\t\tgetCell(key: CellKey<TColumn, TRow>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * Inserts a column into the table.\n\t\t *\n\t\t * @throws\n\t\t * Throws an error in the following cases:\n\t\t *\n\t\t * - The column, or a column with the same ID is already in the tree.\n\t\t *\n\t\t * - The specified index is out of range.\n\t\t *\n\t\t * No column is inserted in these cases.\n\t\t */\n\t\tinsertColumn(\n\t\t\tparams: InsertColumnParameters<TColumn>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\t/**\n\t\t * Inserts 0 or more columns into the table.\n\t\t *\n\t\t * @throws\n\t\t * Throws an error in the following cases:\n\t\t *\n\t\t * - At least one column, or a column with the same ID is already in the tree.\n\t\t *\n\t\t * - The specified index is out of range.\n\t\t *\n\t\t * No columns are inserted in these cases.\n\t\t */\n\t\tinsertColumns(\n\t\t\tparams: InsertColumnsParameters<TColumn>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Inserts a row into the table.\n\t\t *\n\t\t * @throws\n\t\t * Throws an error in the following cases:\n\t\t *\n\t\t * - The row, or a row with the same ID is already in the tree.\n\t\t *\n\t\t * - The row contains cells, but the table does not contain matching columns for one or more of those cells.\n\t\t *\n\t\t * - The specified index is out of range.\n\t\t *\n\t\t * No row is inserted in these cases.\n\t\t */\n\t\tinsertRow(params: InsertRowParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>;\n\n\t\t/**\n\t\t * Inserts 0 or more rows into the table.\n\t\t *\n\t\t * @throws\n\t\t * Throws an error in the following cases:\n\t\t *\n\t\t * - At least one row, or a row with the same ID is already in the tree.\n\t\t *\n\t\t * - The row contains cells, but the table does not contain matching columns for one or more of those cells.\n\t\t *\n\t\t * - The specified index is out of range.\n\t\t *\n\t\t * No rows are inserted in these cases.\n\t\t */\n\t\tinsertRows(params: InsertRowsParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Sets the cell at the specified location in the table.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Table.removeCell} instead.\n\t\t */\n\t\tsetCell(params: SetCellParameters<TCell, TColumn, TRow>): void;\n\n\t\t/**\n\t\t * Removes the specified column from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Note: this does not remove any cells from the table's rows.\n\t\t * To remove the corresponding cells, use {@link TableSchema.Table.removeCell}.\n\t\t *\n\t\t * @param column - The {@link TableSchema.Column | column} or {@link TableSchema.Column.id | column ID} to remove.\n\t\t * @throws Throws an error if the column is not in the table.\n\t\t * @privateRemarks TODO (future): Actually remove corresponding cells from table rows.\n\t\t */\n\t\tremoveColumn(\n\t\t\tcolumn: string | TreeNodeFromImplicitAllowedTypes<TColumn>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\t/**\n\t\t * Removes 0 or more columns from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Note: this does not remove any cells from the table's rows.\n\t\t * To remove the corresponding cells, use {@link TableSchema.Table.removeCell}.\n\t\t *\n\t\t * @param columns - The columns to remove.\n\t\t * @throws Throws an error if any of the columns are not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(\n\t\t\tcolumns: readonly TreeNodeFromImplicitAllowedTypes<TColumn>[],\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t\t/**\n\t\t * Removes 0 or more columns from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Note: this does not remove any cells from the table's rows.\n\t\t * To remove the corresponding cells, use {@link TableSchema.Table.removeCell}.\n\t\t *\n\t\t * @param columns - The columns to remove, specified by their {@link TableSchema.Column.id}.\n\t\t * @throws Throws an error if any of the columns are not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(columns: readonly string[]): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Removes all columns from the table.\n\t\t * @returns The removed columns.\n\t\t */\n\t\tremoveAllColumns(): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Removes the specified row from the table.\n\t\t * @param row - The {@link TableSchema.Row | row} or {@link TableSchema.Row.id | row ID} to remove.\n\t\t * @throws Throws an error if the row is not in the table.\n\t\t */\n\t\tremoveRow(\n\t\t\trow: string | TreeNodeFromImplicitAllowedTypes<TRow>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TRow>;\n\n\t\t/**\n\t\t * Removes 0 or more rows from the table.\n\t\t * @param rows - The rows to remove.\n\t\t * @throws Throws an error if any of the rows are not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(\n\t\t\trows: readonly TreeNodeFromImplicitAllowedTypes<TRow>[],\n\t\t): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\t\t/**\n\t\t * Removes 0 or more rows from the table.\n\t\t * @param rows - The rows to remove, specified by their {@link TableSchema.Row.id}.\n\t\t * @throws Throws an error if any of the rows are not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(rows: readonly string[]): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Removes all rows from the table.\n\t\t * @returns The removed rows.\n\t\t */\n\t\tremoveAllRows(): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Removes the cell at the specified location in the table.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @throws Throws an error if the location does not exist in the table.\n\t\t */\n\t\tremoveCell(\n\t\t\tkey: CellKey<TColumn, TRow>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t}\n\n\t/**\n\t * Factory for creating new table schema without specifying row or column schema.\n\t * @internal\n\t */\n\texport function createTable<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>({\n\t\tschemaFactory,\n\t\tcell,\n\t}: System_TableSchema.TableFactoryOptionsBase<\n\t\tSchemaFactoryAlpha<TScope>,\n\t\tTCell\n\t>): System_TableSchema.TableSchemaBase<\n\t\tTScope,\n\t\tTCell,\n\t\tSystem_TableSchema.ColumnSchemaBase<TScope, System_TableSchema.DefaultPropsType>,\n\t\tSystem_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>\n\t>;\n\t/**\n\t * Factory for creating new table schema without specifying row schema.\n\t * @internal\n\t */\n\texport function createTable<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends System_TableSchema.ColumnSchemaBase<TScope>,\n\t>({\n\t\tschemaFactory,\n\t\tcell,\n\t\tcolumn,\n\t}: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\treadonly column: TColumn;\n\t}): System_TableSchema.TableSchemaBase<\n\t\tTScope,\n\t\tTCell,\n\t\tTColumn,\n\t\tSystem_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>\n\t>;\n\t/**\n\t * Factory for creating new table schema.\n\t * @internal\n\t */\n\texport function createTable<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends System_TableSchema.ColumnSchemaBase<TScope>,\n\t\tconst TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,\n\t>({\n\t\tschemaFactory,\n\t\tcell,\n\t\tcolumn,\n\t\trow,\n\t}: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\treadonly column: TColumn;\n\t\treadonly row: TRow;\n\t}): System_TableSchema.TableSchemaBase<TScope, TCell, TColumn, TRow>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function createTable({\n\t\tschemaFactory,\n\t\tcell,\n\t\tcolumn = createColumn({\n\t\t\tschemaFactory,\n\t\t}),\n\t\trow = createRow({\n\t\t\tschemaFactory,\n\t\t\tcell,\n\t\t}),\n\t}: System_TableSchema.TableFactoryOptionsBase & {\n\t\treadonly column?: System_TableSchema.ColumnSchemaBase;\n\t\treadonly row?: System_TableSchema.RowSchemaBase;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createTableInternal(schemaFactory, cell, column, row);\n\t}\n\n\t// #endregion\n}\n"]}
1
+ {"version":3,"file":"tableSchema.js","sourceRoot":"","sources":["../src/tableSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAQN,aAAa,E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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,MAAM,KAAW,WAAW,CAqmB3B;AArmBD,WAAiB,WAAW;IAC3B,iBAAiB;IAwEjB;;OAEG;IACH,SAAgB,MAAM,CAAC,EACtB,aAAa,EACb,IAAI,EACJ,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,GAGlD;QACA,OAAO,kBAAkB,CAAC,kBAAkB,CAAC,aAAa,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1E,CAAC;IARe,kBAAM,SAQrB,CAAA;IAkHD;;OAEG;IACH,SAAgB,GAAG,CAAC,EACnB,aAAa,EACb,IAAI,EACJ,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,GAGlD;QACA,OAAO,kBAAkB,CAAC,eAAe,CAAC,aAAa,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;IARe,eAAG,MAQlB,CAAA;IAyXD;;OAEG;IACH,SAAgB,KAAK,CAAC,EACrB,aAAa,EACb,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC;QAC7B,aAAa;QACb,IAAI,EAAE,UAAU;KAChB,CAAC,EACF,GAAG,EAAE,SAAS,GAAG,GAAG,CAAC;QACpB,aAAa;QACb,IAAI,EAAE,UAAU;KAChB,CAAC,GAIF;QACA,OAAO,kBAAkB,CAAC,iBAAiB,CAC1C,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,CACT,CAAC;IACH,CAAC;IArBe,iBAAK,QAqBpB,CAAA;IAED,aAAa;AACd,CAAC,EArmBgB,WAAW,KAAX,WAAW,QAqmB3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { oob } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { Tree } from \"./shared-tree/index.js\";\nimport {\n\ttype FieldHasDefault,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeKind,\n\ttype SchemaFactoryAlpha,\n\ttype ScopedSchemaName,\n\tTreeArrayNode,\n\ttype TreeNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaClass,\n\ttype WithType,\n\ttype TreeFieldFromImplicitField,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InternalTreeNode,\n\tSchemaFactory,\n\ttype ImplicitAnnotatedFieldSchema,\n\ttype UnannotateImplicitFieldSchema,\n\tisArrayNodeSchema,\n} from \"./simple-tree/index.js\";\n\n// Future improvement TODOs:\n// - Omit `cells` property from Row insertion type.\n// - Record-like type parameters / input parameters?\n// - Omit `props` properties from Row and Column schemas when not provided?\n\n// Longer-term work:\n// - Add constraint APIs to make it possible to avoid situations that could yield \"orphaned\" cells.\n\n/**\n * The sub-scope applied to user-provided {@link SchemaFactory}s by table schema factories.\n */\nconst tableSchemaFactorySubScope = \"table\";\n\n/**\n * Gets the table containing the provided row/column node, if the node is part of a table.\n * @remarks Assumes that the table is the grandparent of the row/column node.\n */\nfunction getParentTable(\n\trowOrColumnNode: TreeNode,\n):\n\t| (TreeNode &\n\t\t\tTableSchema.Table<\n\t\t\t\tstring | undefined,\n\t\t\t\tImplicitAllowedTypes,\n\t\t\t\tSystem_TableSchema.ColumnSchemaBase,\n\t\t\t\tSystem_TableSchema.RowSchemaBase\n\t\t\t>)\n\t| undefined {\n\tconst rowListNode = Tree.parent(rowOrColumnNode);\n\tif (rowListNode === undefined || !isArrayNodeSchema(Tree.schema(rowListNode))) {\n\t\treturn undefined;\n\t}\n\tconst tableNode = Tree.parent(rowListNode);\n\tif (tableNode === undefined || !isTableNode(tableNode)) {\n\t\treturn undefined;\n\t}\n\n\treturn tableNode;\n}\n\n/**\n * A private symbol put on table schema to help identify them.\n */\nconst tableSchemaSymbol: unique symbol = Symbol(\"tableNode\");\n\n/**\n * Type-guard to determine if a node is a table node.\n * @remarks Uses {@link tableSchemaSymbol} to identify table nodes.\n */\nfunction isTableNode(\n\tnode: TreeNode,\n): node is TreeNode &\n\tTableSchema.Table<\n\t\tstring | undefined,\n\t\tImplicitAllowedTypes,\n\t\tSystem_TableSchema.ColumnSchemaBase,\n\t\tSystem_TableSchema.RowSchemaBase\n\t> {\n\treturn tableSchemaSymbol in Tree.schema(node);\n}\n\n/**\n * Not intended for use outside of this package.\n *\n * @privateRemarks\n * This namespace is a collection of internal system types relate to {@link TableSchema}.\n * This namespace should be strictly type-exported by the package.\n * All members should be tagged with `@system`.\n *\n * @system @internal\n */\nexport namespace System_TableSchema {\n\t/**\n\t * Default type used for column and row \"props\" fields.\n\t * @privateRemarks\n\t * Longer term, it would be better to simply omit \"props\" altogether by default.\n\t * For now, this ensures that the user doesn't have to specify a \"props\" entry when initializing column/row nodes\n\t * and ensures that they cannot set anything that might conflict with future evolutions of the schema.\n\t * @system @internal\n\t */\n\texport type DefaultPropsType = ReturnType<typeof SchemaFactory.optional<[]>>;\n\n\t/**\n\t * A base interface for factory input options which include an schema factory.\n\t * @remarks This interface should not be referenced directly.\n\t * @privateRemarks This interface primarily exists to provide a single home for property documentation.\n\t * @system @internal\n\t */\n\texport interface OptionsWithSchemaFactory<TSchemaFactory extends SchemaFactoryAlpha> {\n\t\t/**\n\t\t * Schema factory with which the Column schema will be associated.\n\t\t * @remarks Can be used to associate the resulting schema with an existing {@link SchemaFactory.scope|scope}.\n\t\t */\n\t\treadonly schemaFactory: TSchemaFactory;\n\t}\n\n\t/**\n\t * A base interface for factory input options which include the table cell schema.\n\t * @remarks This interface should not be referenced directly.\n\t * @privateRemarks This interface primarily exists to provide a single home for property documentation.\n\t * @system @internal\n\t */\n\texport interface OptionsWithCellSchema<TCellSchema extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * Schema for the table's cells.\n\t\t */\n\t\treadonly cell: TCellSchema;\n\t}\n\n\t// #region Column\n\n\t/**\n\t * Base options for creating table cow schema.\n\t * @remarks Includes parameters common to all column factory overloads.\n\t * @system @internal\n\t */\n\texport type CreateColumnOptionsBase<\n\t\tTSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,\n\t\tTCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;\n\n\t/**\n\t * Factory for creating column schema.\n\t * @system @internal\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createColumnSchema<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TPropsSchema extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\tcellSchema: TCellSchema,\n\t\tpropsSchema: TPropsSchema,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\n\t\t// Note: `columnFields` is broken into two parts to work around a TypeScript bug\n\t\t// that results in broken `.d.ts` output.\n\t\t// See definition of `ColumnInsertableType` below.\n\t\tconst columnFieldsBuiltInParts = {\n\t\t\tid: schemaFactory.identifier,\n\t\t} as const;\n\t\tconst columnFieldsPropsPart = {\n\t\t\tprops: propsSchema,\n\t\t} as const;\n\n\t\t/**\n\t\t * {@link Column} fields.\n\t\t *\n\t\t * @remarks\n\t\t * Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t *\n\t\t * Note: ideally we would add a satisfies clause here to ensure that this satisfies\n\t\t * `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.\n\t\t * Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394\n\t\t */\n\t\tconst columnFields = {\n\t\t\t...columnFieldsBuiltInParts,\n\t\t\t...columnFieldsPropsPart,\n\t\t} as const; // satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * A column in a table.\n\t\t */\n\t\tclass Column\n\t\t\textends schemaFactory.objectAlpha(\"Column\", columnFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Column<TCellSchema, TPropsSchema>\n\t\t{\n\t\t\tpublic getCells(): {\n\t\t\t\trowId: string;\n\t\t\t\tcell: CellValueType;\n\t\t\t}[] {\n\t\t\t\tconst tableNode = getParentTable(this);\n\t\t\t\tif (tableNode === undefined) {\n\t\t\t\t\tthrow new UsageError(`Column with ID \"${this.id}\" is not contained in a table.`);\n\t\t\t\t}\n\n\t\t\t\tconst result = [];\n\t\t\t\tfor (const row of tableNode.rows) {\n\t\t\t\t\tconst cell = row.getCell(this.id);\n\t\t\t\t\tif (cell !== undefined) {\n\t\t\t\t\t\tif (!Tree.is(cell, cellSchema)) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\"Parent table contains a cell with incompatible with this column.\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresult.push({ rowId: row.id, cell: cell as CellValueType });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t\ttype ColumnValueType = TreeNode &\n\t\t\tTableSchema.Column<TCellSchema, TPropsSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Column\">>;\n\n\t\t// Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof columnFields>`,\n\t\t// but that results in broken `.d.ts` output due to a TypeScript bug.\n\t\t// See: https://github.com/microsoft/TypeScript/issues/58688.\n\t\t// Instead we extract and inline the typing of the \"props\" field here, which seems to sufficiently work around the issue.\n\t\t// type ColumnInsertableType = InsertableObjectFromSchemaRecord<typeof columnFields>;\n\t\ttype ColumnInsertableType = InsertableObjectFromSchemaRecord<\n\t\t\ttypeof columnFieldsBuiltInParts\n\t\t> &\n\t\t\t(FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true\n\t\t\t\t? // Note: The docs on the below properties are copied from `IColumn.props`' docs to ensure that the\n\t\t\t\t\t// documentation appears in the data insertion scenario.\n\t\t\t\t\t// The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly\n\t\t\t\t\t// support `@inheritDoc`.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/31267\n\t\t\t\t\t{\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The column's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops?: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The column's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t});\n\n\t\t// Modified version of `Column` that ensures the constructor (and `createFromInsertable`) are\n\t\t// typed correctly in terms of our insertable type.\n\t\t// This lets us be selective in our type-cast for the value returned from this function,\n\t\t// preserving as much type-safety as we reasonably can.\n\t\ttype ColumnSchemaModifiedType = Omit<\n\t\t\t// Use mapped type to omit the constructor\n\t\t\t{\n\t\t\t\t[Property in keyof typeof Column]: (typeof Column)[Property];\n\t\t\t},\n\t\t\t\"createFromInsertable\"\n\t\t> &\n\t\t\t(new (\n\t\t\t\tparameters: InternalTreeNode | ColumnInsertableType,\n\t\t\t) => Column) & {\n\t\t\t\tcreateFromInsertable(parameters: ColumnInsertableType): Column;\n\t\t\t};\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst ColumnSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Column\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ ColumnValueType,\n\t\t\t/* TInsertable */ object & ColumnInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof columnFields\n\t\t> = Column as ColumnSchemaModifiedType;\n\n\t\treturn ColumnSchemaType;\n\t}\n\n\t/**\n\t * Base column schema type.\n\t * @sealed @system @internal\n\t */\n\texport type ColumnSchemaBase<\n\t\tTScope extends string | undefined = string | undefined,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\tTPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> = ReturnType<typeof createColumnSchema<TScope, TCellSchema, TPropsSchema>>;\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * Base options for creating table row schema.\n\t * @remarks Includes parameters common to all row factory overloads.\n\t * @system @internal\n\t */\n\texport type CreateRowOptionsBase<\n\t\tTSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,\n\t\tTCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;\n\n\t/**\n\t * Factory for creating row schema.\n\t * @sealed @internal\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createRowSchema<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TPropsSchema extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\tcellSchema: TCellSchema,\n\t\tpropsSchema: TPropsSchema,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\t\ttype CellInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\n\t\t// Note: `rowFields` is broken into two parts to work around a TypeScript bug\n\t\t// that results in broken `.d.ts` output.\n\t\t// See definition of `RowInsertableType` below.\n\t\tconst rowFieldsBuiltInParts = {\n\t\t\tid: schemaFactory.identifier,\n\t\t\tcells: schemaFactory.required(schemaFactory.map(\"Row.cells\", cellSchema), {\n\t\t\t\tmetadata: {\n\t\t\t\t\tdescription: \"The cells of the table row, keyed by column ID.\",\n\t\t\t\t},\n\t\t\t}),\n\t\t} as const;\n\t\tconst rowFieldsPropsPart = {\n\t\t\tprops: propsSchema,\n\t\t} as const;\n\n\t\t/**\n\t\t * {@link Row} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t * Note: ideally we would add a satisfies clause here to ensure that this satisfies\n\t\t * `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.\n\t\t * Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394\n\t\t */\n\t\tconst rowFields = {\n\t\t\t...rowFieldsBuiltInParts,\n\t\t\t...rowFieldsPropsPart,\n\t\t} as const; // satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * The Row schema - this is a map of Cells where the key is the column id\n\t\t */\n\t\tclass Row\n\t\t\textends schemaFactory.objectAlpha(\"Row\", rowFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Row<TCellSchema, TPropsSchema>\n\t\t{\n\t\t\tpublic getCell(\n\t\t\t\tcolumnOrId: TableSchema.Column<TCellSchema> | string,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst columnId = typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\t\t\t\treturn this.cells.get(columnId) as CellValueType | undefined;\n\t\t\t}\n\n\t\t\tpublic setCell(\n\t\t\t\tcolumnOrId: TableSchema.Column<TCellSchema> | string,\n\t\t\t\tvalue: CellInsertableType | undefined,\n\t\t\t): void {\n\t\t\t\t// TODO: throw if column does not exist in the owning table.\n\n\t\t\t\tconst columnId = typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\t\t\t\tthis.cells.set(columnId, value);\n\t\t\t}\n\n\t\t\tpublic removeCell(\n\t\t\t\tcolumnOrId: TableSchema.Column<TCellSchema> | string,\n\t\t\t): CellValueType | undefined {\n\t\t\t\t// TODO: throw if column does not exist in the owning table.\n\n\t\t\t\tconst columnId = typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\n\t\t\t\tconst cell: CellValueType | undefined = this.cells.get(columnId);\n\t\t\t\tif (cell === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tthis.cells.delete(columnId);\n\t\t\t\treturn cell;\n\t\t\t}\n\n\t\t\tpublic getCells(): {\n\t\t\t\tcolumnId: string;\n\t\t\t\tcell: CellValueType;\n\t\t\t}[] {\n\t\t\t\tconst result = [];\n\t\t\t\tfor (const [columnId, cell] of this.cells.entries()) {\n\t\t\t\t\tif (cell !== undefined) {\n\t\t\t\t\t\tresult.push({\n\t\t\t\t\t\t\tcolumnId,\n\t\t\t\t\t\t\tcell,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t\ttype RowValueType = TreeNode &\n\t\t\tTableSchema.Row<TCellSchema, TPropsSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Row\">>;\n\n\t\t// Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof rowFields>`,\n\t\t// but that results in broken `.d.ts` output due to a TypeScript bug.\n\t\t// See: https://github.com/microsoft/TypeScript/issues/58688.\n\t\t// Instead we extract and inline the typing of the \"props\" field here, which seems to sufficiently work around\n\t\t// the issue.\n\t\t// type RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFields>;\n\t\ttype RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFieldsBuiltInParts> &\n\t\t\t(FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true\n\t\t\t\t? // Note: The docs on the below properties are copied from `IRow.props`' docs to ensure that the\n\t\t\t\t\t// documentation appears in the data insertion scenario.\n\t\t\t\t\t// The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly\n\t\t\t\t\t// support `@inheritDoc`.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/31267\n\t\t\t\t\t{\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information\n\t\t\t\t\t\t * about the row.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops?: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information\n\t\t\t\t\t\t * about the row.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t});\n\n\t\t// Modified version of `Row` that ensures the constructor (and `createFromInsertable`) are\n\t\t// typed correctly in terms of our insertable type.\n\t\t// This lets us be selective in our type-cast for the value returned from this function,\n\t\t// preserving as much type-safety as we reasonably can.\n\t\ttype RowSchemaModifiedType = Omit<\n\t\t\t// Use mapped type to omit the constructor\n\t\t\t{\n\t\t\t\t[Property in keyof typeof Row]: (typeof Row)[Property];\n\t\t\t},\n\t\t\t\"createFromInsertable\"\n\t\t> &\n\t\t\t(new (\n\t\t\t\tparameters: InternalTreeNode | RowInsertableType,\n\t\t\t) => Row) & {\n\t\t\t\tcreateFromInsertable(parameters: RowInsertableType): Row;\n\t\t\t};\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst RowSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Row\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ RowValueType,\n\t\t\t/* TInsertable */ object & RowInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof rowFields\n\t\t> = Row as RowSchemaModifiedType;\n\n\t\treturn RowSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @internal\n\t */\n\texport type RowSchemaBase<\n\t\tTScope extends string | undefined = string | undefined,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\tTPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> = ReturnType<typeof createRowSchema<TScope, TCellSchema, TPropsSchema>>;\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * Base options for creating table schema.\n\t * @remarks Includes parameters common to all table factory overloads.\n\t * @system @internal\n\t */\n\texport type TableFactoryOptionsBase<\n\t\tTSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,\n\t\tTCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;\n\n\t/**\n\t * Factory for creating table schema.\n\t * @system @internal\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createTableSchema<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TColumnSchema extends ColumnSchemaBase<TInputScope, TCellSchema>,\n\t\tconst TRowSchema extends RowSchemaBase<TInputScope, TCellSchema>,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\t_cellSchema: TCellSchema,\n\t\tcolumnSchema: TColumnSchema,\n\t\trowSchema: TRowSchema,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\t\ttype ColumnValueType = TreeNodeFromImplicitAllowedTypes<TColumnSchema>;\n\t\ttype RowValueType = TreeNodeFromImplicitAllowedTypes<TRowSchema>;\n\n\t\t/**\n\t\t * {@link Table} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t */\n\t\tconst tableFields = {\n\t\t\trows: schemaFactory.array(\"Table.rows\", rowSchema),\n\t\t\tcolumns: schemaFactory.array(\"Table.columns\", columnSchema),\n\t\t} as const satisfies Record<string, ImplicitAnnotatedFieldSchema>;\n\n\t\t/**\n\t\t * The Table schema\n\t\t */\n\t\tclass Table\n\t\t\textends schemaFactory.objectAlpha(\"Table\", tableFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Table<TInputScope, TCellSchema, TColumnSchema, TRowSchema>\n\t\t{\n\t\t\tpublic static empty<TThis extends TableConstructorType>(\n\t\t\t\tthis: TThis,\n\t\t\t): InstanceType<TThis> {\n\t\t\t\treturn new this({ columns: [], rows: [] }) as InstanceType<TThis>;\n\t\t\t}\n\n\t\t\tpublic getColumn(id: string): ColumnValueType | undefined {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.columns.find((column) => (column as ColumnValueType).id === id) as\n\t\t\t\t\t| ColumnValueType\n\t\t\t\t\t| undefined;\n\t\t\t}\n\n\t\t\tpublic getRow(id: string): RowValueType | undefined {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.rows.find((_row) => (_row as RowValueType).id === id) as\n\t\t\t\t\t| RowValueType\n\t\t\t\t\t| undefined;\n\t\t\t}\n\n\t\t\tpublic getCell(\n\t\t\t\tkey: TableSchema.CellKey<TColumnSchema, TRowSchema>,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\t\t\t\tconst row = this._getRow(rowOrId);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn row.getCell(column);\n\t\t\t}\n\n\t\t\tpublic insertColumn({\n\t\t\t\tcolumn,\n\t\t\t\tindex,\n\t\t\t}: TableSchema.InsertColumnParameters<TColumnSchema>): ColumnValueType {\n\t\t\t\tconst inserted = this.insertColumns({\n\t\t\t\t\tcolumns: [column],\n\t\t\t\t\tindex,\n\t\t\t\t});\n\t\t\t\treturn inserted[0] ?? oob();\n\t\t\t}\n\n\t\t\tpublic insertColumns({\n\t\t\t\tcolumns,\n\t\t\t\tindex,\n\t\t\t}: TableSchema.InsertColumnsParameters<TColumnSchema>): ColumnValueType[] {\n\t\t\t\t// Ensure index is valid\n\t\t\t\tif (index !== undefined) {\n\t\t\t\t\tTable.validateInsertionIndex(index, this.columns);\n\t\t\t\t}\n\n\t\t\t\t// TypeScript is unable to narrow the column type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.columns.insertAtEnd(TreeArrayNode.spread(columns) as any);\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.columns.insertAt(index, TreeArrayNode.spread(columns) as any);\n\t\t\t\t}\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn columns as unknown as ColumnValueType[];\n\t\t\t}\n\n\t\t\tpublic insertRow({\n\t\t\t\trow,\n\t\t\t\tindex,\n\t\t\t}: TableSchema.InsertRowParameters<TRowSchema>): RowValueType {\n\t\t\t\tconst inserted = this.insertRows({\n\t\t\t\t\trows: [row],\n\t\t\t\t\tindex,\n\t\t\t\t});\n\t\t\t\treturn inserted[0] ?? oob();\n\t\t\t}\n\n\t\t\tpublic insertRows({\n\t\t\t\tindex,\n\t\t\t\trows,\n\t\t\t}: TableSchema.InsertRowsParameters<TRowSchema>): RowValueType[] {\n\t\t\t\t// #region Input validation\n\n\t\t\t\t// Ensure index is valid\n\t\t\t\tif (index !== undefined) {\n\t\t\t\t\tTable.validateInsertionIndex(index, this.rows);\n\t\t\t\t}\n\n\t\t\t\t// Note: TypeScript is unable to narrow the type of the row type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tfor (const newRow of rows) {\n\t\t\t\t\t// If the row contains cells, verify that the table contains the columns for those cells.\n\t\t\t\t\t// Note: we intentionally hide `cells` on `IRow` to avoid leaking the internal data representation as much as possible, so we have to cast here.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tif ((newRow as any).cells !== undefined) {\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\tconst keys: string[] = Object.keys((newRow as any).cells);\n\t\t\t\t\t\tfor (const key of keys) {\n\t\t\t\t\t\t\tif (!this.containsColumnWithId(key)) {\n\t\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\t`Attempted to insert row a cell under column ID \"${key}\", but the table does not contain a column with that ID.`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// #endregion\n\n\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.rows.insertAtEnd(TreeArrayNode.spread(rows) as any);\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.rows.insertAt(index, TreeArrayNode.spread(rows) as any);\n\t\t\t\t}\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn rows as unknown as RowValueType[];\n\t\t\t}\n\n\t\t\tpublic setCell({\n\t\t\t\tkey,\n\t\t\t\tcell,\n\t\t\t}: TableSchema.SetCellParameters<TCellSchema, TColumnSchema, TRowSchema>): void {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\n\t\t\t\tconst row = this._getRow(rowOrId);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\tconst rowId = this._getRowId(rowOrId);\n\t\t\t\t\tthrow new UsageError(`No row with ID \"${rowId}\" exists in the table.`);\n\t\t\t\t}\n\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\tconst columnId = this._getColumnId(columnOrId);\n\t\t\t\t\tthrow new UsageError(`No column with ID \"${columnId}\" exists in the table.`);\n\t\t\t\t}\n\n\t\t\t\trow.setCell(column, cell);\n\t\t\t}\n\n\t\t\tpublic removeColumns(\n\t\t\t\tcolumns: readonly string[] | readonly ColumnValueType[],\n\t\t\t): ColumnValueType[] {\n\t\t\t\t// If there are no columns to remove, do nothing\n\t\t\t\tif (columns.length === 0) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\t// If there is only one column to remove, remove it (and don't incur cost of transaction)\n\t\t\t\tif (columns.length === 1) {\n\t\t\t\t\tconst removedColumn = this.removeColumn(columns[0] ?? oob());\n\t\t\t\t\treturn [removedColumn];\n\t\t\t\t}\n\n\t\t\t\t// If there are multiple columns to remove, remove them in a transaction.\n\t\t\t\tconst removedColumns: ColumnValueType[] = [];\n\t\t\t\tTree.runTransaction(this, () => {\n\t\t\t\t\t// Note, throwing an error within a transaction will abort the entire transaction.\n\t\t\t\t\t// So if we throw an error here for any row, no columns will be removed.\n\t\t\t\t\tfor (const columnToRemove of columns) {\n\t\t\t\t\t\tconst removedRow = this.removeColumn(columnToRemove);\n\t\t\t\t\t\tremovedColumns.push(removedRow);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn removedColumns;\n\t\t\t}\n\n\t\t\tpublic removeColumn(columnOrId: string | ColumnValueType): ColumnValueType {\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\t\t\t\tconst index = column === undefined ? -1 : this.columns.indexOf(column);\n\t\t\t\tif (index === -1) {\n\t\t\t\t\tconst columnId = this._getColumnId(columnOrId);\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Specified column with ID \"${columnId}\" does not exist in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.columns.removeAt(index);\n\t\t\t\treturn column as ColumnValueType;\n\t\t\t}\n\n\t\t\tpublic removeAllColumns(): ColumnValueType[] {\n\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.removeColumns(this.columns as unknown as ColumnValueType[]);\n\t\t\t}\n\n\t\t\tpublic removeRows(rows: readonly string[] | readonly RowValueType[]): RowValueType[] {\n\t\t\t\t// If there are no rows to remove, do nothing\n\t\t\t\tif (rows.length === 0) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\t// If there is only one row to remove, remove it (and don't incur cost of transaction)\n\t\t\t\tif (rows.length === 1) {\n\t\t\t\t\tconst removedRow = this.removeRow(rows[0] ?? oob());\n\t\t\t\t\treturn [removedRow];\n\t\t\t\t}\n\n\t\t\t\t// If there are multiple rows to remove, remove them in a transaction.\n\t\t\t\tconst removedRows: RowValueType[] = [];\n\t\t\t\tTree.runTransaction(this, () => {\n\t\t\t\t\t// Note, throwing an error within a transaction will abort the entire transaction.\n\t\t\t\t\t// So if we throw an error here for any row, no rows will be removed.\n\t\t\t\t\tfor (const rowToRemove of rows) {\n\t\t\t\t\t\tconst removedRow = this.removeRow(rowToRemove);\n\t\t\t\t\t\tremovedRows.push(removedRow);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn removedRows;\n\t\t\t}\n\n\t\t\tpublic removeRow(rowOrId: string | RowValueType): RowValueType {\n\t\t\t\tconst rowToRemove = this._getRow(rowOrId);\n\t\t\t\tconst index = rowToRemove === undefined ? -1 : this.rows.indexOf(rowToRemove);\n\n\t\t\t\t// If the row does not exist in the table, throw an error.\n\t\t\t\tif (index === -1) {\n\t\t\t\t\tconst rowId = this._getRowId(rowOrId);\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Specified row with ID \"${rowId}\" does not exist in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.rows.removeAt(index);\n\t\t\t\treturn rowToRemove as RowValueType;\n\t\t\t}\n\n\t\t\tpublic removeAllRows(): RowValueType[] {\n\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.removeRows(this.rows as unknown as RowValueType[]);\n\t\t\t}\n\n\t\t\tpublic removeCell(\n\t\t\t\tkey: TableSchema.CellKey<TColumnSchema, TRowSchema>,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\t\t\t\tconst row = this._getRow(rowOrId);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\tconst rowId = this._getRowId(rowOrId);\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Specified row with ID \"${rowId}\" does not exist in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\tconst columnId = this._getColumnId(columnOrId);\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Specified column with ID \"${columnId}\" does not exist in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst cell: CellValueType | undefined = row.getCell(column.id);\n\t\t\t\tif (cell === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\trow.removeCell(column.id);\n\t\t\t\treturn cell;\n\t\t\t}\n\n\t\t\tprivate _getColumn(columnOrId: string | ColumnValueType): ColumnValueType | undefined {\n\t\t\t\treturn typeof columnOrId === \"string\" ? this.getColumn(columnOrId) : columnOrId;\n\t\t\t}\n\n\t\t\tprivate _getColumnId(columnOrId: string | ColumnValueType): string {\n\t\t\t\treturn typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\t\t\t}\n\n\t\t\tprivate _getRow(rowOrId: string | RowValueType): RowValueType | undefined {\n\t\t\t\treturn typeof rowOrId === \"string\" ? this.getRow(rowOrId) : rowOrId;\n\t\t\t}\n\n\t\t\tprivate _getRowId(rowOrId: string | RowValueType): string {\n\t\t\t\treturn typeof rowOrId === \"string\" ? rowOrId : rowOrId.id;\n\t\t\t}\n\n\t\t\tprivate containsColumnWithId(columnId: string): boolean {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn (\n\t\t\t\t\tthis.columns.find(\n\t\t\t\t\t\t(column) => (column as TableSchema.Column<TCellSchema>).id === columnId,\n\t\t\t\t\t) !== undefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tprivate containsRowWithId(rowId: string): boolean {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn (\n\t\t\t\t\tthis.rows.find((row) => (row as TableSchema.Row<TCellSchema>).id === rowId) !==\n\t\t\t\t\tundefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Ensure that the specified index is a valid location for item insertion in the destination list.\n\t\t\t * @throws Throws a usage error if the destination is invalid.\n\t\t\t */\n\t\t\tprivate static validateInsertionIndex(\n\t\t\t\tindex: number,\n\t\t\t\tdestinationList: readonly unknown[],\n\t\t\t): void {\n\t\t\t\tif (index < 0) {\n\t\t\t\t\tthrow new UsageError(\"The index must be greater than or equal to 0.\");\n\t\t\t\t}\n\n\t\t\t\tif (index > destinationList.length) {\n\t\t\t\t\tthrow new UsageError(\"The index specified for insertion is out of bounds.\");\n\t\t\t\t}\n\n\t\t\t\tif (!Number.isInteger(index)) {\n\t\t\t\t\tthrow new UsageError(\"The index must be an integer.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Set a private symbol on the schema class that marks it as having been generated by this factory.\n\t\t// Column / Row functionality use this to validate that they are being used in a table.\n\t\t// This is effectively a work-around that allows columns and rows to invoke table methods\n\t\t// without having to pass the table as a parameter to their construction, which isn't possible.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t(Table as any)[tableSchemaSymbol] = true;\n\n\t\ttype TableValueType = TreeNode &\n\t\t\tTableSchema.Table<TInputScope, TCellSchema, TColumnSchema, TRowSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Table\">>;\n\t\ttype TableInsertableType = InsertableObjectFromSchemaRecord<typeof tableFields>;\n\t\ttype TableConstructorType = new (data: TableInsertableType) => TableValueType;\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst TableSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Table\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ TableValueType,\n\t\t\t/* TInsertable */ object & TableInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof tableFields\n\t\t> & {\n\t\t\t/**\n\t\t\t * Create an empty table.\n\t\t\t */\n\t\t\tempty<TThis extends TableConstructorType>(this: TThis): InstanceType<TThis>;\n\t\t} = Table;\n\n\t\t// Return the table schema\n\t\treturn TableSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @internal\n\t */\n\texport type TableSchemaBase<\n\t\tTScope extends string | undefined,\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends ColumnSchemaBase<TScope, TCell>,\n\t\tTRow extends RowSchemaBase<TScope, TCell>,\n\t> = ReturnType<typeof createTableSchema<TScope, TCell, TColumn, TRow>>;\n\n\t// #endregion\n}\n\n/**\n * Contains types and factories for creating schema to represent dynamic tabular data.\n *\n * @remarks\n *\n * Tables created using these APIs are...\n *\n * - sparse, meaning that cells may be omitted, and new rows are empty by default.\n *\n * - dynamic, meaning that their structure can be modified at runtime.\n * Columns and rows can be inserted, removed, modified, and reordered.\n * Cells can be inserted, removed, and modified.\n *\n * - row-major, meaning that operating on rows (including inserts, removal, moves, and traversal) is more efficient than operating on columns.\n *\n * Column and Row schema created using these APIs are extensible via the `props` field.\n * This allows association of additional properties with column and row nodes.\n *\n * Note: for now it is possible for table cells to become \"orphaned\".\n * That is, it is possible to enter a state where one or more rows contain cells with no corresponding column.\n * To help avoid this situation, you can manually remove corresponding cells when removing columns.\n * Either way, it is possible to enter such a state via the merging of edits.\n * For example: one client might add a row while another concurrently removes a column, orphaning the cell where the column and row intersected.\n *\n * @example Using default Column and Row schema\n *\n * ```typescript\n * class Cell extends schemaFactory.object(\"TableCell\", {\n * \tvalue: schemaFactory.string,\n * }) {}\n *\n * class Table extends TableSchema.table({\n * \tschemaFactory,\n * \tcell: Cell,\n * }) {}\n *\n * const table = new Table({\n * \tcolumns: [{ id: \"column-0\" }],\n * \trows: [{ id: \"row-0\", cells: {} }],\n * });\n * ```\n *\n * @example Customizing Column and Row schema\n *\n * ```typescript\n * class Cell extends schemaFactory.object(\"TableCell\", {\n * \tvalue: schemaFactory.string,\n * }) {}\n *\n * class ColumnProps extends schemaFactory.object(\"TableColumnProps\", {\n * \t// Column label to display.\n * \tlabel: schemaFactory.string,\n * \t// The type of data represented by the cells. Default: string.\n * \tdataType: schemaFactory.optional(schemaFactory.string),\n * }) {}\n *\n * class Column extends TableSchema.column({\n * \tschemaFactory,\n * \tcell: Cell,\n * \tprops: ColumnProps,\n * }) {}\n *\n * class Row extends TableSchema.row({\n * \tschemaFactory,\n * \tcell: Cell,\n * }) {}\n *\n * class Table extends TableSchema.table({\n * \tschemaFactory,\n * \tcell: Cell,\n * \tcolumn: Column,\n * \trow: Row,\n * }) {}\n *\n * const table = new Table({\n * \tcolumns: [\n * \t\tnew Column({ props: { label: \"Entry\", dataType: \"string\" } }),\n * \t\tnew Column({ props: { label: \"Date\", dataType: \"date\" } }),\n * \t\tnew Column({ props: { label: \"Amount\", dataType: \"number\" } }),\n * \t],\n * \trows: [],\n * });\n * ```\n *\n * @privateRemarks\n * The above examples are backed by tests in `tableSchema.spec.ts`.\n * Those tests and these examples should be kept in-sync to ensure that the examples are correct.\n *\n * @internal\n */\nexport namespace TableSchema {\n\t// #region Column\n\n\t/**\n\t * A column in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.(column:2)}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the column.\n\t * @sealed @internal\n\t */\n\texport interface Column<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the column.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * The column's properties.\n\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t * @privateRemarks\n\t\t * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createColumnSchema}.\n\t\t * If you update the docs here, please also update the inline type definitions.\n\t\t */\n\t\tget props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>;\n\t\tset props(value: InsertableTreeFieldFromImplicitField<\n\t\t\tUnannotateImplicitFieldSchema<TProps>\n\t\t>);\n\n\t\t/**\n\t\t * Gets all of the populated cells in the column, keyed by their associated row IDs.\n\t\t * @throws Throws an error if the column is not in a table.\n\t\t */\n\t\tgetCells(): readonly {\n\t\t\trowId: string;\n\t\t\tcell: TreeNodeFromImplicitAllowedTypes<TCell>;\n\t\t}[];\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @internal\n\t */\n\texport function column<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>, TCell>,\n\t): System_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>;\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the column.\n\t * @internal\n\t */\n\texport function column<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TProps extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tparams: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\t/**\n\t\t\t * Optional column properties.\n\t\t\t */\n\t\t\treadonly props: TProps;\n\t\t},\n\t): System_TableSchema.ColumnSchemaBase<TScope, TCell, TProps>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function column({\n\t\tschemaFactory,\n\t\tcell,\n\t\tprops = SchemaFactory.optional(SchemaFactory.null),\n\t}: System_TableSchema.CreateColumnOptionsBase & {\n\t\treadonly props?: ImplicitAnnotatedFieldSchema;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createColumnSchema(schemaFactory, cell, props);\n\t}\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * A row in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.(row:2)}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the row.\n\t * @sealed @internal\n\t */\n\texport interface Row<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the row.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * Gets the cell in the specified column.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @privateRemarks TODO: throw if the column does not belong to the same table as the row.\n\t\t */\n\t\tgetCell(column: Column<TCell>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t\t/**\n\t\t * Gets the cell in the specified column, denoted by column ID.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t */\n\t\tgetCell(columnId: string): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * Gets all of the populated cells in the row, keyed by their associated column IDs.\n\t\t */\n\t\tgetCells(): readonly {\n\t\t\tcolumnId: string;\n\t\t\tcell: TreeNodeFromImplicitAllowedTypes<TCell>;\n\t\t}[];\n\n\t\t/**\n\t\t * Sets the cell in the specified column.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Row.(removeCell:1)} instead.\n\t\t * @privateRemarks TODO: Throw an error if the column does not exist in the table.\n\t\t */\n\t\tsetCell(\n\t\t\tcolumn: Column<TCell>,\n\t\t\tvalue: InsertableTreeNodeFromImplicitAllowedTypes<TCell>,\n\t\t): void;\n\t\t/**\n\t\t * Sets the cell in the specified column, denoted by column ID.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Row.(removeCell:2)} instead.\n\t\t */\n\t\tsetCell(columnId: string, value: InsertableTreeNodeFromImplicitAllowedTypes<TCell>): void;\n\n\t\t/**\n\t\t * Removes the cell in the specified column.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @privateRemarks TODO: Throw if the column does not belong to the same table as the row.\n\t\t */\n\t\tremoveCell(column: Column<TCell>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t\t/**\n\t\t * Removes the cell in the specified column, denoted by column ID.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t */\n\t\tremoveCell(columnId: string): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * The row's properties.\n\t\t * @remarks This is a user-defined schema that can be used to store additional information about the row.\n\t\t * @privateRemarks\n\t\t * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createRowSchema}.\n\t\t * If you update the docs here, please also update the inline type definitions.\n\t\t */\n\t\tget props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>;\n\t\tset props(value: InsertableTreeFieldFromImplicitField<\n\t\t\tUnannotateImplicitFieldSchema<TProps>\n\t\t>);\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @internal\n\t */\n\texport function row<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.CreateRowOptionsBase<SchemaFactoryAlpha<TScope>, TCell>,\n\t): System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>;\n\t/**\n\t * Factory for creating new table row schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the row.\n\t * @internal\n\t */\n\texport function row<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TProps extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tparams: System_TableSchema.CreateRowOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\t/**\n\t\t\t * Optional row properties.\n\t\t\t */\n\t\t\treadonly props: TProps;\n\t\t},\n\t): System_TableSchema.RowSchemaBase<TScope, TCell, TProps>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function row({\n\t\tschemaFactory,\n\t\tcell,\n\t\tprops = SchemaFactory.optional(SchemaFactory.null),\n\t}: System_TableSchema.CreateRowOptionsBase & {\n\t\treadonly props?: ImplicitAnnotatedFieldSchema;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createRowSchema(schemaFactory, cell, props);\n\t}\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * A key to uniquely identify a cell within a table.\n\t * @internal\n\t */\n\texport interface CellKey<\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * {@link TableSchema.Column} or {@link TableSchema.Column.id} at which the cell is located.\n\t\t */\n\t\treadonly column: string | TreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\t/**\n\t\t * {@link TableSchema.Row} or {@link TableSchema.Row.id} at which the cell is located.\n\t\t */\n\t\treadonly row: string | TreeNodeFromImplicitAllowedTypes<TRow>;\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertColumn} parameters.\n\t * @internal\n\t */\n\texport interface InsertColumnParameters<TColumn extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new column.\n\t\t * @remarks If not provided, the column will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The column to insert.\n\t\t */\n\t\treadonly column: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>;\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertColumns} parameters.\n\t * @internal\n\t */\n\texport interface InsertColumnsParameters<TColumn extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new columns.\n\t\t * @remarks If not provided, the columns will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The columns to insert.\n\t\t */\n\t\treadonly columns: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertRow} parameters.\n\t * @internal\n\t */\n\texport interface InsertRowParameters<TRow extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new row.\n\t\t * @remarks If not provided, the row will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The row to insert.\n\t\t */\n\t\treadonly row: InsertableTreeNodeFromImplicitAllowedTypes<TRow>;\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertRows} parameters.\n\t * @internal\n\t */\n\texport interface InsertRowsParameters<TRow extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new rows.\n\t\t * @remarks If not provided, the rows will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The rows to insert.\n\t\t */\n\t\treadonly rows: InsertableTreeNodeFromImplicitAllowedTypes<TRow>[];\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.setCell} parameters.\n\t * @internal\n\t */\n\texport interface SetCellParameters<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * The key to uniquely identify a cell in a table.\n\t\t */\n\t\treadonly key: CellKey<TColumn, TRow>;\n\n\t\t/**\n\t\t * The cell to set.\n\t\t */\n\t\treadonly cell: InsertableTreeNodeFromImplicitAllowedTypes<TCell>;\n\t}\n\n\t/**\n\t * A table.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @sealed @internal\n\t */\n\texport interface Table<\n\t\tTScope extends string | undefined,\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>,\n\t\tTRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,\n\t> {\n\t\t/**\n\t\t * The table's columns.\n\t\t */\n\t\treadonly columns: TreeArrayNode<TColumn>;\n\n\t\t/**\n\t\t * The table's rows.\n\t\t */\n\t\treadonly rows: TreeArrayNode<TRow>;\n\n\t\t/**\n\t\t * Gets a table column by its {@link TableSchema.Column.id}.\n\t\t */\n\t\tgetColumn(id: string): TreeNodeFromImplicitAllowedTypes<TColumn> | undefined;\n\n\t\t/**\n\t\t * Gets a table row by its {@link TableSchema.Row.id}.\n\t\t */\n\t\tgetRow(id: string): TreeNodeFromImplicitAllowedTypes<TRow> | undefined;\n\n\t\t/**\n\t\t * Gets a cell in the table by column and row IDs.\n\t\t * @param key - A key that uniquely distinguishes a cell in the table, represented as a combination of the column ID and row ID.\n\t\t */\n\t\tgetCell(key: CellKey<TColumn, TRow>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * Inserts a column into the table.\n\t\t *\n\t\t * @throws Throws an error if the specified index is out of range.\n\t\t *\n\t\t * No column is inserted in this case.\n\t\t */\n\t\tinsertColumn(\n\t\t\tparams: InsertColumnParameters<TColumn>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\t/**\n\t\t * Inserts 0 or more columns into the table.\n\t\t *\n\t\t * @throws Throws an error if the specified index is out of range.\n\t\t *\n\t\t * No columns are inserted in this case.\n\t\t */\n\t\tinsertColumns(\n\t\t\tparams: InsertColumnsParameters<TColumn>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Inserts a row into the table.\n\t\t *\n\t\t * @throws\n\t\t * Throws an error in the following cases:\n\t\t *\n\t\t * - The row contains cells, but the table does not contain matching columns for one or more of those cells.\n\t\t *\n\t\t * - The specified index is out of range.\n\t\t *\n\t\t * No row is inserted in these cases.\n\t\t */\n\t\tinsertRow(params: InsertRowParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>;\n\n\t\t/**\n\t\t * Inserts 0 or more rows into the table.\n\t\t *\n\t\t * @throws\n\t\t * Throws an error in the following cases:\n\t\t *\n\t\t * - The row contains cells, but the table does not contain matching columns for one or more of those cells.\n\t\t *\n\t\t * - The specified index is out of range.\n\t\t *\n\t\t * No rows are inserted in these cases.\n\t\t */\n\t\tinsertRows(params: InsertRowsParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Sets the cell at the specified location in the table.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Table.removeCell} instead.\n\t\t */\n\t\tsetCell(params: SetCellParameters<TCell, TColumn, TRow>): void;\n\n\t\t/**\n\t\t * Removes the specified column from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Note: this does not remove any cells from the table's rows.\n\t\t * To remove the corresponding cells, use {@link TableSchema.Table.removeCell}.\n\t\t *\n\t\t * @param column - The {@link TableSchema.Column | column} or {@link TableSchema.Column.id | column ID} to remove.\n\t\t * @throws Throws an error if the column is not in the table.\n\t\t * @privateRemarks TODO (future): Actually remove corresponding cells from table rows.\n\t\t */\n\t\tremoveColumn(\n\t\t\tcolumn: string | TreeNodeFromImplicitAllowedTypes<TColumn>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\t/**\n\t\t * Removes 0 or more columns from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Note: this does not remove any cells from the table's rows.\n\t\t * To remove the corresponding cells, use {@link TableSchema.Table.removeCell}.\n\t\t *\n\t\t * @param columns - The columns to remove.\n\t\t * @throws Throws an error if any of the columns are not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(\n\t\t\tcolumns: readonly TreeNodeFromImplicitAllowedTypes<TColumn>[],\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t\t/**\n\t\t * Removes 0 or more columns from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Note: this does not remove any cells from the table's rows.\n\t\t * To remove the corresponding cells, use {@link TableSchema.Table.removeCell}.\n\t\t *\n\t\t * @param columns - The columns to remove, specified by their {@link TableSchema.Column.id}.\n\t\t * @throws Throws an error if any of the columns are not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(columns: readonly string[]): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Removes all columns from the table.\n\t\t * @returns The removed columns.\n\t\t */\n\t\tremoveAllColumns(): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Removes the specified row from the table.\n\t\t * @param row - The {@link TableSchema.Row | row} or {@link TableSchema.Row.id | row ID} to remove.\n\t\t * @throws Throws an error if the row is not in the table.\n\t\t */\n\t\tremoveRow(\n\t\t\trow: string | TreeNodeFromImplicitAllowedTypes<TRow>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TRow>;\n\n\t\t/**\n\t\t * Removes 0 or more rows from the table.\n\t\t * @param rows - The rows to remove.\n\t\t * @throws Throws an error if any of the rows are not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(\n\t\t\trows: readonly TreeNodeFromImplicitAllowedTypes<TRow>[],\n\t\t): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\t\t/**\n\t\t * Removes 0 or more rows from the table.\n\t\t * @param rows - The rows to remove, specified by their {@link TableSchema.Row.id}.\n\t\t * @throws Throws an error if any of the rows are not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(rows: readonly string[]): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Removes all rows from the table.\n\t\t * @returns The removed rows.\n\t\t */\n\t\tremoveAllRows(): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Removes the cell at the specified location in the table.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @throws Throws an error if the location does not exist in the table.\n\t\t */\n\t\tremoveCell(\n\t\t\tkey: CellKey<TColumn, TRow>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t}\n\n\t/**\n\t * Factory for creating new table schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @internal\n\t */\n\texport function table<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell>,\n\t): System_TableSchema.TableSchemaBase<\n\t\tTScope,\n\t\tTCell,\n\t\tSystem_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>,\n\t\tSystem_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom column schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @internal\n\t */\n\texport function table<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\treadonly column: TColumn;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<\n\t\tTScope,\n\t\tTCell,\n\t\tTColumn,\n\t\tSystem_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom row schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @internal\n\t */\n\texport function table<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\treadonly row: TRow;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<\n\t\tTScope,\n\t\tTCell,\n\t\tSystem_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>,\n\t\tTRow\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom column and row schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @internal\n\t */\n\texport function table<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>,\n\t\tconst TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\treadonly column: TColumn;\n\t\t\treadonly row: TRow;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<TScope, TCell, TColumn, TRow>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function table({\n\t\tschemaFactory,\n\t\tcell: cellSchema,\n\t\tcolumn: columnSchema = column({\n\t\t\tschemaFactory,\n\t\t\tcell: cellSchema,\n\t\t}),\n\t\trow: rowSchema = row({\n\t\t\tschemaFactory,\n\t\t\tcell: cellSchema,\n\t\t}),\n\t}: System_TableSchema.TableFactoryOptionsBase & {\n\t\treadonly column?: System_TableSchema.ColumnSchemaBase;\n\t\treadonly row?: System_TableSchema.RowSchemaBase;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createTableSchema(\n\t\t\tschemaFactory,\n\t\t\tcellSchema,\n\t\t\tcolumnSchema,\n\t\t\trowSchema,\n\t\t);\n\t}\n\n\t// #endregion\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.5"
8
+ "packageVersion": "7.52.8"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/tree",
3
- "version": "2.40.0",
3
+ "version": "2.41.0-338186",
4
4
  "description": "Distributed tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -89,17 +89,17 @@
89
89
  "temp-directory": "nyc/.nyc_output"
90
90
  },
91
91
  "dependencies": {
92
- "@fluid-internal/client-utils": "~2.40.0",
93
- "@fluidframework/container-runtime": "~2.40.0",
94
- "@fluidframework/core-interfaces": "~2.40.0",
95
- "@fluidframework/core-utils": "~2.40.0",
96
- "@fluidframework/datastore-definitions": "~2.40.0",
97
- "@fluidframework/driver-definitions": "~2.40.0",
98
- "@fluidframework/id-compressor": "~2.40.0",
99
- "@fluidframework/runtime-definitions": "~2.40.0",
100
- "@fluidframework/runtime-utils": "~2.40.0",
101
- "@fluidframework/shared-object-base": "~2.40.0",
102
- "@fluidframework/telemetry-utils": "~2.40.0",
92
+ "@fluid-internal/client-utils": "2.41.0-338186",
93
+ "@fluidframework/container-runtime": "2.41.0-338186",
94
+ "@fluidframework/core-interfaces": "2.41.0-338186",
95
+ "@fluidframework/core-utils": "2.41.0-338186",
96
+ "@fluidframework/datastore-definitions": "2.41.0-338186",
97
+ "@fluidframework/driver-definitions": "2.41.0-338186",
98
+ "@fluidframework/id-compressor": "2.41.0-338186",
99
+ "@fluidframework/runtime-definitions": "2.41.0-338186",
100
+ "@fluidframework/runtime-utils": "2.41.0-338186",
101
+ "@fluidframework/shared-object-base": "2.41.0-338186",
102
+ "@fluidframework/telemetry-utils": "2.41.0-338186",
103
103
  "@sinclair/typebox": "^0.34.13",
104
104
  "@tylerbu/sorted-btree-es6": "^1.8.0",
105
105
  "@types/ungap__structured-clone": "^1.2.0",
@@ -109,21 +109,21 @@
109
109
  "devDependencies": {
110
110
  "@arethetypeswrong/cli": "^0.17.1",
111
111
  "@biomejs/biome": "~1.9.3",
112
- "@fluid-internal/mocha-test-setup": "~2.40.0",
113
- "@fluid-private/stochastic-test-utils": "~2.40.0",
114
- "@fluid-private/test-dds-utils": "~2.40.0",
115
- "@fluid-private/test-drivers": "~2.40.0",
112
+ "@fluid-internal/mocha-test-setup": "2.41.0-338186",
113
+ "@fluid-private/stochastic-test-utils": "2.41.0-338186",
114
+ "@fluid-private/test-dds-utils": "2.41.0-338186",
115
+ "@fluid-private/test-drivers": "2.41.0-338186",
116
116
  "@fluid-tools/benchmark": "^0.51.0",
117
117
  "@fluid-tools/build-cli": "^0.55.0",
118
118
  "@fluidframework/build-common": "^2.0.3",
119
119
  "@fluidframework/build-tools": "^0.55.0",
120
- "@fluidframework/container-definitions": "~2.40.0",
121
- "@fluidframework/container-loader": "~2.40.0",
120
+ "@fluidframework/container-definitions": "2.41.0-338186",
121
+ "@fluidframework/container-loader": "2.41.0-338186",
122
122
  "@fluidframework/eslint-config-fluid": "^5.7.3",
123
- "@fluidframework/test-runtime-utils": "~2.40.0",
124
- "@fluidframework/test-utils": "~2.40.0",
125
- "@fluidframework/tree-previous": "npm:@fluidframework/tree@2.33.0",
126
- "@microsoft/api-extractor": "7.52.5",
123
+ "@fluidframework/test-runtime-utils": "2.41.0-338186",
124
+ "@fluidframework/test-utils": "2.41.0-338186",
125
+ "@fluidframework/tree-previous": "npm:@fluidframework/tree@2.40.0",
126
+ "@microsoft/api-extractor": "7.52.8",
127
127
  "@types/diff": "^3.5.1",
128
128
  "@types/easy-table": "^0.0.32",
129
129
  "@types/mocha": "^10.0.10",
@@ -168,8 +168,8 @@
168
168
  "api": "fluid-build . --task api",
169
169
  "api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
170
170
  "api-extractor:esnext": "flub generate entrypoints --outDir ./lib --node10TypeCompat",
171
- "bench": "mocha --timeout 999999 --perfMode --parentProcess --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js",
172
- "bench:profile": "mocha --v8-prof --v8-logfile=profile.log --v8-no-logfile-per-isolate --timeout 999999 --perfMode --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js && node --prof-process profile.log > profile.txt && rimraf profile.log && echo See results in profile.txt",
171
+ "bench": "mocha --timeout 999999 --perfMode --parentProcess --fgrep @Benchmark --fgrep @ExecutionTime --reporter @fluid-tools/benchmark/dist/MochaReporter.js",
172
+ "bench:profile": "mocha --v8-prof --v8-logfile=profile.log --v8-no-logfile-per-isolate --timeout 999999 --perfMode --fgrep @Benchmark --fgrep @ExecutionTime --reporter @fluid-tools/benchmark/dist/MochaReporter.js && node --prof-process profile.log > profile.txt && rimraf profile.log && echo See results in profile.txt",
173
173
  "build": "fluid-build . --task build",
174
174
  "build:api-reports": "concurrently \"npm:build:api-reports:*\"",
175
175
  "build:api-reports:current": "api-extractor run --local --config api-extractor/api-extractor.current.json",
@@ -210,7 +210,7 @@
210
210
  "lint:fix": "fluid-build . --task eslint:fix --task format",
211
211
  "pack:tests": "tar -cf ./tree.test-files.tar ./src/test ./dist/test ./lib/test",
212
212
  "test": "npm run test:mocha",
213
- "test:benchmark:report": "mocha --exit --perfMode --parentProcess --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js --timeout 60000",
213
+ "test:benchmark:report": "mocha --exit --perfMode --parentProcess --fgrep @Benchmark --fgrep @ExecutionTime --reporter @fluid-tools/benchmark/dist/MochaReporter.js --timeout 60000",
214
214
  "test:coverage": "c8 npm test",
215
215
  "test:customBenchmarks": "mocha --config ./.mocharc.customBenchmarks.cjs",
216
216
  "test:customBenchmarks:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:customBenchmarks",
@@ -35,14 +35,6 @@ export function isNodeInSchema(
35
35
  node: MapTree,
36
36
  schemaAndPolicy: SchemaAndPolicy,
37
37
  ): SchemaValidationErrors {
38
- // If the stored schema is completely empty it _probably_ (in almost all cases?) means the tree is brand new and we
39
- // shouldn't validate the data.
40
- // TODO: AB#8197
41
- // See https://github.com/microsoft/FluidFramework/pull/21305#discussion_r1626595991 for further discussion.
42
- if (schemaAndPolicy.schema.nodeSchema.size === 0) {
43
- return SchemaValidationErrors.NoError;
44
- }
45
-
46
38
  // Validate the schema declared by the node exists
47
39
  const schema = schemaAndPolicy.schema.nodeSchema.get(node.type);
48
40
  if (schema === undefined) {
@@ -79,6 +79,9 @@ export const ContextSlot = anchorSlot<Context>();
79
79
  * Implementation of `FlexTreeContext`.
80
80
  *
81
81
  * @remarks An editor is required to edit the FlexTree.
82
+ *
83
+ * A {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:
84
+ * This is necessary for supporting using this tree across edits to the forest, and not leaking memory.
82
85
  */
83
86
  export class Context implements FlexTreeHydratedContext, IDisposable {
84
87
  public readonly withCursors: Set<LazyEntity> = new Set();
@@ -88,13 +91,19 @@ export class Context implements FlexTreeHydratedContext, IDisposable {
88
91
  private disposed = false;
89
92
 
90
93
  /**
91
- * @param flexSchema - Schema to use when working with the tree.
92
- * @param checkout - The checkout.
93
- * @param nodeKeyManager - An object which handles node key generation and conversion
94
+ * Stores the last accessed version of the root.
95
+ * @remarks
96
+ * Anything which can delete this field must clear it.
97
+ * Currently "clear" is the only case.
94
98
  */
99
+ private lazyRootCache: FlexTreeField | undefined;
100
+
95
101
  public constructor(
96
102
  public readonly schemaPolicy: SchemaPolicy,
97
103
  public readonly checkout: ITreeCheckout,
104
+ /**
105
+ * An object which handles node key generation and conversion
106
+ */
98
107
  public readonly nodeKeyManager: NodeIdentifierManager,
99
108
  ) {
100
109
  this.eventUnregister = [
@@ -158,16 +167,22 @@ export class Context implements FlexTreeHydratedContext, IDisposable {
158
167
  for (const target of this.withAnchors) {
159
168
  target[disposeSymbol]();
160
169
  }
170
+ this.lazyRootCache = undefined;
161
171
  assert(this.withCursors.size === 0, 0x774 /* free should remove all cursors */);
162
172
  assert(this.withAnchors.size === 0, 0x775 /* free should remove all anchors */);
163
173
  }
164
174
 
165
175
  public get root(): FlexTreeField {
166
176
  assert(this.disposed === false, 0x804 /* use after dispose */);
177
+ if (this.lazyRootCache !== undefined) {
178
+ return this.lazyRootCache;
179
+ }
180
+
167
181
  const cursor = this.checkout.forest.allocateCursor("root");
168
182
  moveToDetachedField(this.checkout.forest, cursor);
169
183
  const field = makeField(this, this.schema.rootFieldSchema.kind, cursor);
170
184
  cursor.free();
185
+ this.lazyRootCache = field;
171
186
  return field;
172
187
  }
173
188
 
@@ -175,20 +190,3 @@ export class Context implements FlexTreeHydratedContext, IDisposable {
175
190
  return this.checkout.forest.events;
176
191
  }
177
192
  }
178
-
179
- /**
180
- * A simple API for a Forest to interact with the tree.
181
- *
182
- * @param forest - the Forest
183
- * @param editor - an editor that makes changes to the forest.
184
- * @param nodeKeyManager - an object which handles node key generation and conversion.
185
- * @returns {@link FlexTreeContext} which is used to manage the cursors and anchors within the FlexTrees:
186
- * This is necessary for supporting using this tree across edits to the forest, and not leaking memory.
187
- */
188
- export function getTreeContext(
189
- schema: SchemaPolicy,
190
- checkout: ITreeCheckout,
191
- nodeKeyManager: NodeIdentifierManager,
192
- ): Context {
193
- return new Context(schema, checkout, nodeKeyManager);
194
- }
@@ -28,7 +28,6 @@ export {
28
28
  } from "./navigation.js";
29
29
 
30
30
  export {
31
- getTreeContext,
32
31
  type FlexTreeContext,
33
32
  type FlexTreeHydratedContext,
34
33
  Context,
@@ -278,20 +278,8 @@ export class LazySequence extends LazyField implements FlexTreeSequenceField {
278
278
  }
279
279
  }
280
280
 
281
- export class ReadonlyLazyValueField extends LazyField implements FlexTreeRequiredField {
281
+ export class LazyValueField extends LazyField implements FlexTreeRequiredField {
282
282
  public editor: ValueFieldEditBuilder<ExclusiveMapTree> = {
283
- set: (newContent) => {
284
- assert(false, 0xa0c /* Unexpected set of readonly field */);
285
- },
286
- };
287
-
288
- public get content(): FlexTreeUnknownUnboxed {
289
- return this.atIndex(0);
290
- }
291
- }
292
-
293
- export class LazyValueField extends ReadonlyLazyValueField implements FlexTreeRequiredField {
294
- public override editor: ValueFieldEditBuilder<ExclusiveMapTree> = {
295
283
  set: (newContent) => {
296
284
  this.valueFieldEditor().set(cursorForMapTreeField([newContent]));
297
285
  },
@@ -303,7 +291,7 @@ export class LazyValueField extends ReadonlyLazyValueField implements FlexTreeRe
303
291
  return fieldEditor;
304
292
  }
305
293
 
306
- public override get content(): FlexTreeUnknownUnboxed {
294
+ public get content(): FlexTreeUnknownUnboxed {
307
295
  return this.atIndex(0);
308
296
  }
309
297
  }