@fluidframework/tree 2.41.0-337492 → 2.41.0-338401

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 (491) hide show
  1. package/api-report/tree.alpha.api.md +165 -5
  2. package/dist/alpha.d.ts +2 -0
  3. package/dist/codec/codec.d.ts +42 -7
  4. package/dist/codec/codec.d.ts.map +1 -1
  5. package/dist/codec/codec.js +50 -8
  6. package/dist/codec/codec.js.map +1 -1
  7. package/dist/core/change-family/editBuilder.d.ts.map +1 -1
  8. package/dist/core/change-family/editBuilder.js.map +1 -1
  9. package/dist/core/forest/forest.d.ts.map +1 -1
  10. package/dist/core/forest/forest.js.map +1 -1
  11. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  12. package/dist/core/schema-stored/schema.js.map +1 -1
  13. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  14. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  15. package/dist/core/schema-stored/storedSchemaRepository.js +1 -1
  16. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  17. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  18. package/dist/core/tree/anchorSet.js +2 -2
  19. package/dist/core/tree/anchorSet.js.map +1 -1
  20. package/dist/core/tree/chunk.d.ts.map +1 -1
  21. package/dist/core/tree/chunk.js.map +1 -1
  22. package/dist/core/tree/delta.d.ts.map +1 -1
  23. package/dist/core/tree/delta.js.map +1 -1
  24. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  25. package/dist/core/tree/deltaUtil.js.map +1 -1
  26. package/dist/core/tree/detachedFieldIndex.d.ts +1 -1
  27. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  28. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  29. package/dist/core/tree/detachedFieldIndexCodec.d.ts +1 -1
  30. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  31. package/dist/core/tree/detachedFieldIndexCodec.js +1 -1
  32. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  33. package/dist/core/tree/pathTree.d.ts.map +1 -1
  34. package/dist/core/tree/pathTree.js.map +1 -1
  35. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  36. package/dist/core/tree/treeTextFormat.js.map +1 -1
  37. package/dist/core/tree/visitDelta.d.ts +1 -1
  38. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  39. package/dist/core/tree/visitDelta.js.map +1 -1
  40. package/dist/core/tree/visitorUtils.d.ts +2 -2
  41. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  42. package/dist/core/tree/visitorUtils.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
  44. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/chunkTree.js +1 -1
  46. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  48. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  49. package/dist/feature-libraries/chunked-forest/chunkedForest.js +1 -1
  50. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  51. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
  52. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  53. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +2 -2
  55. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  59. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -2
  60. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/codecs.js +12 -1
  62. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  67. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  69. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +1 -1
  72. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  74. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  75. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  77. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  79. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  81. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  82. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  83. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  84. package/dist/feature-libraries/chunked-forest/sequenceChunk.js +4 -4
  85. package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  86. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -1
  87. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  88. package/dist/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  89. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  90. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  91. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  92. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  93. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  94. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  95. package/dist/feature-libraries/default-schema/index.js +2 -1
  96. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  97. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  98. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  99. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +4 -0
  100. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  101. package/dist/feature-libraries/default-schema/schemaChecker.js +35 -26
  102. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  103. package/dist/feature-libraries/flex-tree/context.d.ts +16 -14
  104. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  105. package/dist/feature-libraries/flex-tree/context.js +12 -18
  106. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  107. package/dist/feature-libraries/flex-tree/index.d.ts +1 -1
  108. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  109. package/dist/feature-libraries/flex-tree/index.js +1 -2
  110. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  111. package/dist/feature-libraries/flex-tree/lazyField.d.ts +1 -5
  112. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  113. package/dist/feature-libraries/flex-tree/lazyField.js +2 -16
  114. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  115. package/dist/feature-libraries/flex-tree/utilities.d.ts +6 -6
  116. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  117. package/dist/feature-libraries/flex-tree/utilities.js +6 -7
  118. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  119. package/dist/feature-libraries/index.d.ts +3 -3
  120. package/dist/feature-libraries/index.d.ts.map +1 -1
  121. package/dist/feature-libraries/index.js +3 -2
  122. package/dist/feature-libraries/index.js.map +1 -1
  123. package/dist/feature-libraries/initializeForest.d.ts.map +1 -1
  124. package/dist/feature-libraries/initializeForest.js.map +1 -1
  125. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  126. package/dist/feature-libraries/treeCursorUtils.js +1 -1
  127. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  128. package/dist/feature-libraries/valueUtilities.d.ts.map +1 -1
  129. package/dist/feature-libraries/valueUtilities.js +6 -6
  130. package/dist/feature-libraries/valueUtilities.js.map +1 -1
  131. package/dist/jsonDomainSchema.d.ts.map +1 -1
  132. package/dist/jsonDomainSchema.js.map +1 -1
  133. package/dist/packageVersion.d.ts +1 -1
  134. package/dist/packageVersion.js +1 -1
  135. package/dist/packageVersion.js.map +1 -1
  136. package/dist/serializableDomainSchema.d.ts.map +1 -1
  137. package/dist/serializableDomainSchema.js.map +1 -1
  138. package/dist/shared-tree/checkoutFlexTreeView.d.ts +7 -3
  139. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  140. package/dist/shared-tree/checkoutFlexTreeView.js +11 -2
  141. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  142. package/dist/shared-tree/schematizingTreeView.d.ts +3 -0
  143. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  144. package/dist/shared-tree/schematizingTreeView.js +10 -5
  145. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  146. package/dist/shared-tree/treeAlpha.d.ts +9 -4
  147. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  148. package/dist/shared-tree/treeAlpha.js +20 -8
  149. package/dist/shared-tree/treeAlpha.js.map +1 -1
  150. package/dist/sharedTreeAttributes.d.ts.map +1 -1
  151. package/dist/sharedTreeAttributes.js.map +1 -1
  152. package/dist/simple-tree/api/create.d.ts +5 -1
  153. package/dist/simple-tree/api/create.d.ts.map +1 -1
  154. package/dist/simple-tree/api/create.js +11 -12
  155. package/dist/simple-tree/api/create.js.map +1 -1
  156. package/dist/simple-tree/api/index.d.ts +3 -3
  157. package/dist/simple-tree/api/index.d.ts.map +1 -1
  158. package/dist/simple-tree/api/index.js +4 -2
  159. package/dist/simple-tree/api/index.js.map +1 -1
  160. package/dist/simple-tree/api/storedSchema.d.ts +1 -8
  161. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  162. package/dist/simple-tree/api/storedSchema.js +3 -14
  163. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  164. package/dist/simple-tree/api/treeNodeApi.d.ts +8 -0
  165. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  166. package/dist/simple-tree/api/treeNodeApi.js +3 -1
  167. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  168. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  169. package/dist/simple-tree/arrayNode.js +3 -9
  170. package/dist/simple-tree/arrayNode.js.map +1 -1
  171. package/dist/simple-tree/core/getOrCreateNode.js +1 -1
  172. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  173. package/dist/simple-tree/core/treeNodeKernel.d.ts +5 -17
  174. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  175. package/dist/simple-tree/core/treeNodeKernel.js +17 -48
  176. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  177. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +4 -4
  178. package/dist/simple-tree/core/unhydratedFlexTree.js +4 -4
  179. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  180. package/dist/simple-tree/getTreeNodeForField.d.ts +12 -0
  181. package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -0
  182. package/dist/simple-tree/getTreeNodeForField.js +39 -0
  183. package/dist/simple-tree/getTreeNodeForField.js.map +1 -0
  184. package/dist/simple-tree/index.d.ts +3 -2
  185. package/dist/simple-tree/index.d.ts.map +1 -1
  186. package/dist/simple-tree/index.js +10 -6
  187. package/dist/simple-tree/index.js.map +1 -1
  188. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  189. package/dist/simple-tree/mapNode.js +21 -24
  190. package/dist/simple-tree/mapNode.js.map +1 -1
  191. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  192. package/dist/simple-tree/objectNode.js +5 -7
  193. package/dist/simple-tree/objectNode.js.map +1 -1
  194. package/dist/simple-tree/prepareForInsertion.d.ts +42 -0
  195. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -0
  196. package/dist/simple-tree/prepareForInsertion.js +166 -0
  197. package/dist/simple-tree/prepareForInsertion.js.map +1 -0
  198. package/dist/simple-tree/toMapTree.d.ts +4 -9
  199. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  200. package/dist/simple-tree/toMapTree.js +4 -23
  201. package/dist/simple-tree/toMapTree.js.map +1 -1
  202. package/dist/tableSchema.d.ts +201 -104
  203. package/dist/tableSchema.d.ts.map +1 -1
  204. package/dist/tableSchema.js +155 -58
  205. package/dist/tableSchema.js.map +1 -1
  206. package/dist/treeFactory.d.ts.map +1 -1
  207. package/dist/treeFactory.js +2 -2
  208. package/dist/treeFactory.js.map +1 -1
  209. package/lib/alpha.d.ts +2 -0
  210. package/lib/codec/codec.d.ts +42 -7
  211. package/lib/codec/codec.d.ts.map +1 -1
  212. package/lib/codec/codec.js +50 -8
  213. package/lib/codec/codec.js.map +1 -1
  214. package/lib/core/change-family/editBuilder.d.ts.map +1 -1
  215. package/lib/core/change-family/editBuilder.js.map +1 -1
  216. package/lib/core/forest/forest.d.ts.map +1 -1
  217. package/lib/core/forest/forest.js.map +1 -1
  218. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  219. package/lib/core/schema-stored/schema.js.map +1 -1
  220. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  221. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  222. package/lib/core/schema-stored/storedSchemaRepository.js +1 -1
  223. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  224. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  225. package/lib/core/tree/anchorSet.js +2 -2
  226. package/lib/core/tree/anchorSet.js.map +1 -1
  227. package/lib/core/tree/chunk.d.ts.map +1 -1
  228. package/lib/core/tree/chunk.js.map +1 -1
  229. package/lib/core/tree/delta.d.ts.map +1 -1
  230. package/lib/core/tree/delta.js.map +1 -1
  231. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  232. package/lib/core/tree/deltaUtil.js.map +1 -1
  233. package/lib/core/tree/detachedFieldIndex.d.ts +1 -1
  234. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  235. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  236. package/lib/core/tree/detachedFieldIndexCodec.d.ts +1 -1
  237. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  238. package/lib/core/tree/detachedFieldIndexCodec.js +1 -1
  239. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  240. package/lib/core/tree/pathTree.d.ts.map +1 -1
  241. package/lib/core/tree/pathTree.js.map +1 -1
  242. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  243. package/lib/core/tree/treeTextFormat.js.map +1 -1
  244. package/lib/core/tree/visitDelta.d.ts +1 -1
  245. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  246. package/lib/core/tree/visitDelta.js.map +1 -1
  247. package/lib/core/tree/visitorUtils.d.ts +2 -2
  248. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  249. package/lib/core/tree/visitorUtils.js.map +1 -1
  250. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
  251. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  252. package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -1
  253. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  254. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  255. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  256. package/lib/feature-libraries/chunked-forest/chunkedForest.js +1 -1
  257. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  258. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
  259. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  260. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  261. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +2 -2
  262. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  263. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  264. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  265. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  266. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -2
  267. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  268. package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -0
  269. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  270. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  271. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  272. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  273. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  274. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  275. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  276. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  277. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  278. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +1 -1
  279. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  280. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  281. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  282. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  283. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  284. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  285. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  286. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  287. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  288. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  289. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  290. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  291. package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -1
  292. package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  293. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -1
  294. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  295. package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  296. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  297. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  298. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  299. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  300. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  301. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  302. package/lib/feature-libraries/default-schema/index.js +1 -1
  303. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  304. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  305. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  306. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +4 -0
  307. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  308. package/lib/feature-libraries/default-schema/schemaChecker.js +33 -25
  309. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  310. package/lib/feature-libraries/flex-tree/context.d.ts +16 -14
  311. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  312. package/lib/feature-libraries/flex-tree/context.js +11 -16
  313. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  314. package/lib/feature-libraries/flex-tree/index.d.ts +1 -1
  315. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  316. package/lib/feature-libraries/flex-tree/index.js +1 -1
  317. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  318. package/lib/feature-libraries/flex-tree/lazyField.d.ts +1 -5
  319. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  320. package/lib/feature-libraries/flex-tree/lazyField.js +1 -14
  321. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  322. package/lib/feature-libraries/flex-tree/utilities.d.ts +6 -6
  323. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  324. package/lib/feature-libraries/flex-tree/utilities.js +6 -7
  325. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  326. package/lib/feature-libraries/index.d.ts +3 -3
  327. package/lib/feature-libraries/index.d.ts.map +1 -1
  328. package/lib/feature-libraries/index.js +3 -3
  329. package/lib/feature-libraries/index.js.map +1 -1
  330. package/lib/feature-libraries/initializeForest.d.ts.map +1 -1
  331. package/lib/feature-libraries/initializeForest.js.map +1 -1
  332. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  333. package/lib/feature-libraries/treeCursorUtils.js +1 -1
  334. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  335. package/lib/feature-libraries/valueUtilities.d.ts.map +1 -1
  336. package/lib/feature-libraries/valueUtilities.js +1 -1
  337. package/lib/feature-libraries/valueUtilities.js.map +1 -1
  338. package/lib/jsonDomainSchema.d.ts.map +1 -1
  339. package/lib/jsonDomainSchema.js.map +1 -1
  340. package/lib/packageVersion.d.ts +1 -1
  341. package/lib/packageVersion.js +1 -1
  342. package/lib/packageVersion.js.map +1 -1
  343. package/lib/serializableDomainSchema.d.ts.map +1 -1
  344. package/lib/serializableDomainSchema.js.map +1 -1
  345. package/lib/shared-tree/checkoutFlexTreeView.d.ts +7 -3
  346. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  347. package/lib/shared-tree/checkoutFlexTreeView.js +12 -3
  348. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  349. package/lib/shared-tree/schematizingTreeView.d.ts +3 -0
  350. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  351. package/lib/shared-tree/schematizingTreeView.js +11 -6
  352. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  353. package/lib/shared-tree/treeAlpha.d.ts +9 -4
  354. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  355. package/lib/shared-tree/treeAlpha.js +22 -10
  356. package/lib/shared-tree/treeAlpha.js.map +1 -1
  357. package/lib/sharedTreeAttributes.d.ts.map +1 -1
  358. package/lib/sharedTreeAttributes.js.map +1 -1
  359. package/lib/simple-tree/api/create.d.ts +5 -1
  360. package/lib/simple-tree/api/create.d.ts.map +1 -1
  361. package/lib/simple-tree/api/create.js +9 -11
  362. package/lib/simple-tree/api/create.js.map +1 -1
  363. package/lib/simple-tree/api/index.d.ts +3 -3
  364. package/lib/simple-tree/api/index.d.ts.map +1 -1
  365. package/lib/simple-tree/api/index.js +3 -3
  366. package/lib/simple-tree/api/index.js.map +1 -1
  367. package/lib/simple-tree/api/storedSchema.d.ts +1 -8
  368. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  369. package/lib/simple-tree/api/storedSchema.js +2 -12
  370. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  371. package/lib/simple-tree/api/treeNodeApi.d.ts +8 -0
  372. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  373. package/lib/simple-tree/api/treeNodeApi.js +2 -2
  374. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  375. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  376. package/lib/simple-tree/arrayNode.js +4 -10
  377. package/lib/simple-tree/arrayNode.js.map +1 -1
  378. package/lib/simple-tree/core/getOrCreateNode.js +2 -2
  379. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  380. package/lib/simple-tree/core/treeNodeKernel.d.ts +5 -17
  381. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  382. package/lib/simple-tree/core/treeNodeKernel.js +16 -47
  383. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  384. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +4 -4
  385. package/lib/simple-tree/core/unhydratedFlexTree.js +4 -4
  386. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  387. package/lib/simple-tree/getTreeNodeForField.d.ts +12 -0
  388. package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -0
  389. package/lib/simple-tree/getTreeNodeForField.js +35 -0
  390. package/lib/simple-tree/getTreeNodeForField.js.map +1 -0
  391. package/lib/simple-tree/index.d.ts +3 -2
  392. package/lib/simple-tree/index.d.ts.map +1 -1
  393. package/lib/simple-tree/index.js +3 -2
  394. package/lib/simple-tree/index.js.map +1 -1
  395. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  396. package/lib/simple-tree/mapNode.js +3 -6
  397. package/lib/simple-tree/mapNode.js.map +1 -1
  398. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  399. package/lib/simple-tree/objectNode.js +4 -6
  400. package/lib/simple-tree/objectNode.js.map +1 -1
  401. package/lib/simple-tree/prepareForInsertion.d.ts +42 -0
  402. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -0
  403. package/lib/simple-tree/prepareForInsertion.js +160 -0
  404. package/lib/simple-tree/prepareForInsertion.js.map +1 -0
  405. package/lib/simple-tree/toMapTree.d.ts +4 -9
  406. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  407. package/lib/simple-tree/toMapTree.js +4 -22
  408. package/lib/simple-tree/toMapTree.js.map +1 -1
  409. package/lib/tableSchema.d.ts +201 -104
  410. package/lib/tableSchema.d.ts.map +1 -1
  411. package/lib/tableSchema.js +156 -59
  412. package/lib/tableSchema.js.map +1 -1
  413. package/lib/treeFactory.d.ts.map +1 -1
  414. package/lib/treeFactory.js +2 -2
  415. package/lib/treeFactory.js.map +1 -1
  416. package/lib/tsdoc-metadata.json +1 -1
  417. package/package.json +25 -25
  418. package/src/codec/codec.ts +54 -8
  419. package/src/core/change-family/editBuilder.ts +1 -0
  420. package/src/core/forest/forest.ts +1 -1
  421. package/src/core/schema-stored/schema.ts +2 -0
  422. package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
  423. package/src/core/tree/anchorSet.ts +4 -4
  424. package/src/core/tree/chunk.ts +2 -1
  425. package/src/core/tree/delta.ts +1 -0
  426. package/src/core/tree/deltaUtil.ts +1 -1
  427. package/src/core/tree/detachedFieldIndex.ts +1 -1
  428. package/src/core/tree/detachedFieldIndexCodec.ts +2 -2
  429. package/src/core/tree/pathTree.ts +1 -1
  430. package/src/core/tree/treeTextFormat.ts +1 -0
  431. package/src/core/tree/visitDelta.ts +1 -1
  432. package/src/core/tree/visitorUtils.ts +3 -2
  433. package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -2
  434. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -3
  435. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +5 -5
  436. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +2 -2
  437. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -0
  438. package/src/feature-libraries/chunked-forest/codec/codecs.ts +15 -1
  439. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -1
  440. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
  441. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +1 -1
  442. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +1 -1
  443. package/src/feature-libraries/chunked-forest/emptyChunk.ts +1 -0
  444. package/src/feature-libraries/chunked-forest/index.ts +1 -0
  445. package/src/feature-libraries/chunked-forest/sequenceChunk.ts +1 -1
  446. package/src/feature-libraries/chunked-forest/uniformChunk.ts +2 -3
  447. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +1 -1
  448. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -0
  449. package/src/feature-libraries/default-schema/index.ts +6 -1
  450. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +1 -0
  451. package/src/feature-libraries/default-schema/schemaChecker.ts +37 -26
  452. package/src/feature-libraries/flex-tree/context.ts +18 -20
  453. package/src/feature-libraries/flex-tree/index.ts +0 -1
  454. package/src/feature-libraries/flex-tree/lazyField.ts +2 -14
  455. package/src/feature-libraries/flex-tree/utilities.ts +8 -8
  456. package/src/feature-libraries/index.ts +2 -1
  457. package/src/feature-libraries/initializeForest.ts +1 -1
  458. package/src/feature-libraries/treeCursorUtils.ts +1 -1
  459. package/src/feature-libraries/valueUtilities.ts +1 -1
  460. package/src/jsonDomainSchema.ts +0 -1
  461. package/src/packageVersion.ts +1 -1
  462. package/src/serializableDomainSchema.ts +1 -0
  463. package/src/shared-tree/checkoutFlexTreeView.ts +10 -6
  464. package/src/shared-tree/schematizingTreeView.ts +11 -12
  465. package/src/shared-tree/treeAlpha.ts +50 -13
  466. package/src/sharedTreeAttributes.ts +1 -0
  467. package/src/simple-tree/api/create.ts +17 -16
  468. package/src/simple-tree/api/index.ts +13 -3
  469. package/src/simple-tree/api/storedSchema.ts +2 -19
  470. package/src/simple-tree/api/treeNodeApi.ts +2 -2
  471. package/src/simple-tree/arrayNode.ts +9 -20
  472. package/src/simple-tree/core/getOrCreateNode.ts +2 -2
  473. package/src/simple-tree/core/treeNodeKernel.ts +22 -53
  474. package/src/simple-tree/core/unhydratedFlexTree.ts +4 -4
  475. package/src/simple-tree/getTreeNodeForField.ts +46 -0
  476. package/src/simple-tree/index.ts +8 -5
  477. package/src/simple-tree/mapNode.ts +8 -12
  478. package/src/simple-tree/objectNode.ts +3 -12
  479. package/src/simple-tree/prepareForInsertion.ts +276 -0
  480. package/src/simple-tree/toMapTree.ts +3 -27
  481. package/src/tableSchema.ts +351 -138
  482. package/src/treeFactory.ts +2 -4
  483. package/dist/simple-tree/proxies.d.ts +0 -23
  484. package/dist/simple-tree/proxies.d.ts.map +0 -1
  485. package/dist/simple-tree/proxies.js +0 -135
  486. package/dist/simple-tree/proxies.js.map +0 -1
  487. package/lib/simple-tree/proxies.d.ts +0 -23
  488. package/lib/simple-tree/proxies.d.ts.map +0 -1
  489. package/lib/simple-tree/proxies.js +0 -130
  490. package/lib/simple-tree/proxies.js.map +0 -1
  491. package/src/simple-tree/proxies.ts +0 -191
@@ -27,6 +27,7 @@ import {
27
27
  SchemaFactory,
28
28
  type ImplicitAnnotatedFieldSchema,
29
29
  type UnannotateImplicitFieldSchema,
30
+ isArrayNodeSchema,
30
31
  } from "./simple-tree/index.js";
31
32
 
32
33
  // Future improvement TODOs:
@@ -42,6 +43,54 @@ import {
42
43
  */
43
44
  const tableSchemaFactorySubScope = "table";
44
45
 
46
+ /**
47
+ * Gets the table containing the provided row/column node, if the node is part of a table.
48
+ * @remarks Assumes that the table is the grandparent of the row/column node.
49
+ */
50
+ function getParentTable(
51
+ rowOrColumnNode: TreeNode,
52
+ ):
53
+ | (TreeNode &
54
+ TableSchema.Table<
55
+ string | undefined,
56
+ ImplicitAllowedTypes,
57
+ System_TableSchema.ColumnSchemaBase,
58
+ System_TableSchema.RowSchemaBase
59
+ >)
60
+ | undefined {
61
+ const rowListNode = Tree.parent(rowOrColumnNode);
62
+ if (rowListNode === undefined || !isArrayNodeSchema(Tree.schema(rowListNode))) {
63
+ return undefined;
64
+ }
65
+ const tableNode = Tree.parent(rowListNode);
66
+ if (tableNode === undefined || !isTableNode(tableNode)) {
67
+ return undefined;
68
+ }
69
+
70
+ return tableNode;
71
+ }
72
+
73
+ /**
74
+ * A private symbol put on table schema to help identify them.
75
+ */
76
+ const tableSchemaSymbol: unique symbol = Symbol("tableNode");
77
+
78
+ /**
79
+ * Type-guard to determine if a node is a table node.
80
+ * @remarks Uses {@link tableSchemaSymbol} to identify table nodes.
81
+ */
82
+ function isTableNode(
83
+ node: TreeNode,
84
+ ): node is TreeNode &
85
+ TableSchema.Table<
86
+ string | undefined,
87
+ ImplicitAllowedTypes,
88
+ System_TableSchema.ColumnSchemaBase,
89
+ System_TableSchema.RowSchemaBase
90
+ > {
91
+ return tableSchemaSymbol in Tree.schema(node);
92
+ }
93
+
45
94
  /**
46
95
  * Not intended for use outside of this package.
47
96
  *
@@ -50,7 +99,7 @@ const tableSchemaFactorySubScope = "table";
50
99
  * This namespace should be strictly type-exported by the package.
51
100
  * All members should be tagged with `@system`.
52
101
  *
53
- * @system @internal
102
+ * @system @alpha
54
103
  */
55
104
  export namespace System_TableSchema {
56
105
  /**
@@ -59,7 +108,7 @@ export namespace System_TableSchema {
59
108
  * Longer term, it would be better to simply omit "props" altogether by default.
60
109
  * For now, this ensures that the user doesn't have to specify a "props" entry when initializing column/row nodes
61
110
  * and ensures that they cannot set anything that might conflict with future evolutions of the schema.
62
- * @system @internal
111
+ * @system @alpha
63
112
  */
64
113
  export type DefaultPropsType = ReturnType<typeof SchemaFactory.optional<[]>>;
65
114
 
@@ -67,7 +116,7 @@ export namespace System_TableSchema {
67
116
  * A base interface for factory input options which include an schema factory.
68
117
  * @remarks This interface should not be referenced directly.
69
118
  * @privateRemarks This interface primarily exists to provide a single home for property documentation.
70
- * @system @internal
119
+ * @system @alpha
71
120
  */
72
121
  export interface OptionsWithSchemaFactory<TSchemaFactory extends SchemaFactoryAlpha> {
73
122
  /**
@@ -81,7 +130,7 @@ export namespace System_TableSchema {
81
130
  * A base interface for factory input options which include the table cell schema.
82
131
  * @remarks This interface should not be referenced directly.
83
132
  * @privateRemarks This interface primarily exists to provide a single home for property documentation.
84
- * @system @internal
133
+ * @system @alpha
85
134
  */
86
135
  export interface OptionsWithCellSchema<TCellSchema extends ImplicitAllowedTypes> {
87
136
  /**
@@ -95,24 +144,32 @@ export namespace System_TableSchema {
95
144
  /**
96
145
  * Base options for creating table cow schema.
97
146
  * @remarks Includes parameters common to all column factory overloads.
98
- * @system @internal
147
+ * @system @alpha
99
148
  */
100
149
  export type CreateColumnOptionsBase<
101
150
  TSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,
102
- > = OptionsWithSchemaFactory<TSchemaFactory>;
151
+ TCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,
152
+ > = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;
103
153
 
104
154
  /**
105
155
  * Factory for creating column schema.
106
- * @system @internal
156
+ * @system @alpha
107
157
  */
108
158
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
109
159
  export function createColumnSchema<
110
160
  const TInputScope extends string | undefined,
161
+ const TCellSchema extends ImplicitAllowedTypes,
111
162
  const TPropsSchema extends ImplicitAnnotatedFieldSchema,
112
- >(inputSchemaFactory: SchemaFactoryAlpha<TInputScope>, propsSchema: TPropsSchema) {
163
+ >(
164
+ inputSchemaFactory: SchemaFactoryAlpha<TInputScope>,
165
+ cellSchema: TCellSchema,
166
+ propsSchema: TPropsSchema,
167
+ ) {
113
168
  const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
114
169
  type Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;
115
170
 
171
+ type CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;
172
+
116
173
  // Note: `columnFields` is broken into two parts to work around a TypeScript bug
117
174
  // that results in broken `.d.ts` output.
118
175
  // See definition of `ColumnInsertableType` below.
@@ -147,10 +204,36 @@ export namespace System_TableSchema {
147
204
  // Will make it easier to evolve this schema in the future.
148
205
  allowUnknownOptionalFields: true,
149
206
  })
150
- implements TableSchema.Column<TPropsSchema> {}
207
+ implements TableSchema.Column<TCellSchema, TPropsSchema>
208
+ {
209
+ public getCells(): {
210
+ rowId: string;
211
+ cell: CellValueType;
212
+ }[] {
213
+ const tableNode = getParentTable(this);
214
+ if (tableNode === undefined) {
215
+ throw new UsageError(`Column with ID "${this.id}" is not contained in a table.`);
216
+ }
217
+
218
+ const result = [];
219
+ for (const row of tableNode.rows) {
220
+ const cell = row.getCell(this.id);
221
+ if (cell !== undefined) {
222
+ if (!Tree.is(cell, cellSchema)) {
223
+ throw new UsageError(
224
+ "Parent table contains a cell with incompatible with this column.",
225
+ );
226
+ }
227
+
228
+ result.push({ rowId: row.id, cell: cell as CellValueType });
229
+ }
230
+ }
231
+ return result;
232
+ }
233
+ }
151
234
 
152
235
  type ColumnValueType = TreeNode &
153
- TableSchema.Column<TPropsSchema> &
236
+ TableSchema.Column<TCellSchema, TPropsSchema> &
154
237
  WithType<ScopedSchemaName<Scope, "Column">>;
155
238
 
156
239
  // Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof columnFields>`,
@@ -222,12 +305,13 @@ export namespace System_TableSchema {
222
305
 
223
306
  /**
224
307
  * Base column schema type.
225
- * @sealed @system @internal
308
+ * @sealed @system @alpha
226
309
  */
227
310
  export type ColumnSchemaBase<
228
311
  TScope extends string | undefined = string | undefined,
312
+ TCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,
229
313
  TPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,
230
- > = ReturnType<typeof createColumnSchema<TScope, TPropsSchema>>;
314
+ > = ReturnType<typeof createColumnSchema<TScope, TCellSchema, TPropsSchema>>;
231
315
 
232
316
  // #endregion
233
317
 
@@ -236,7 +320,7 @@ export namespace System_TableSchema {
236
320
  /**
237
321
  * Base options for creating table row schema.
238
322
  * @remarks Includes parameters common to all row factory overloads.
239
- * @system @internal
323
+ * @system @alpha
240
324
  */
241
325
  export type CreateRowOptionsBase<
242
326
  TSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,
@@ -245,7 +329,7 @@ export namespace System_TableSchema {
245
329
 
246
330
  /**
247
331
  * Factory for creating row schema.
248
- * @sealed @internal
332
+ * @sealed @alpha
249
333
  */
250
334
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
251
335
  export function createRowSchema<
@@ -301,13 +385,15 @@ export namespace System_TableSchema {
301
385
  })
302
386
  implements TableSchema.Row<TCellSchema, TPropsSchema>
303
387
  {
304
- public getCell(columnOrId: TableSchema.Column | string): CellValueType | undefined {
388
+ public getCell(
389
+ columnOrId: TableSchema.Column<TCellSchema> | string,
390
+ ): CellValueType | undefined {
305
391
  const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
306
392
  return this.cells.get(columnId) as CellValueType | undefined;
307
393
  }
308
394
 
309
395
  public setCell(
310
- columnOrId: TableSchema.Column | string,
396
+ columnOrId: TableSchema.Column<TCellSchema> | string,
311
397
  value: CellInsertableType | undefined,
312
398
  ): void {
313
399
  // TODO: throw if column does not exist in the owning table.
@@ -316,7 +402,9 @@ export namespace System_TableSchema {
316
402
  this.cells.set(columnId, value);
317
403
  }
318
404
 
319
- public removeCell(columnOrId: TableSchema.Column | string): CellValueType | undefined {
405
+ public removeCell(
406
+ columnOrId: TableSchema.Column<TCellSchema> | string,
407
+ ): CellValueType | undefined {
320
408
  // TODO: throw if column does not exist in the owning table.
321
409
 
322
410
  const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
@@ -329,6 +417,22 @@ export namespace System_TableSchema {
329
417
  this.cells.delete(columnId);
330
418
  return cell;
331
419
  }
420
+
421
+ public getCells(): {
422
+ columnId: string;
423
+ cell: CellValueType;
424
+ }[] {
425
+ const result = [];
426
+ for (const [columnId, cell] of this.cells.entries()) {
427
+ if (cell !== undefined) {
428
+ result.push({
429
+ columnId,
430
+ cell,
431
+ });
432
+ }
433
+ }
434
+ return result;
435
+ }
332
436
  }
333
437
 
334
438
  type RowValueType = TreeNode &
@@ -405,7 +509,7 @@ export namespace System_TableSchema {
405
509
 
406
510
  /**
407
511
  * Base row schema type.
408
- * @sealed @system @internal
512
+ * @sealed @system @alpha
409
513
  */
410
514
  export type RowSchemaBase<
411
515
  TScope extends string | undefined = string | undefined,
@@ -420,7 +524,7 @@ export namespace System_TableSchema {
420
524
  /**
421
525
  * Base options for creating table schema.
422
526
  * @remarks Includes parameters common to all table factory overloads.
423
- * @system @internal
527
+ * @system @alpha
424
528
  */
425
529
  export type TableFactoryOptionsBase<
426
530
  TSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,
@@ -429,13 +533,13 @@ export namespace System_TableSchema {
429
533
 
430
534
  /**
431
535
  * Factory for creating table schema.
432
- * @system @internal
536
+ * @system @alpha
433
537
  */
434
538
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
435
539
  export function createTableSchema<
436
540
  const TInputScope extends string | undefined,
437
541
  const TCellSchema extends ImplicitAllowedTypes,
438
- const TColumnSchema extends ColumnSchemaBase<TInputScope>,
542
+ const TColumnSchema extends ColumnSchemaBase<TInputScope, TCellSchema>,
439
543
  const TRowSchema extends RowSchemaBase<TInputScope, TCellSchema>,
440
544
  >(
441
545
  inputSchemaFactory: SchemaFactoryAlpha<TInputScope>,
@@ -468,8 +572,14 @@ export namespace System_TableSchema {
468
572
  // Will make it easier to evolve this schema in the future.
469
573
  allowUnknownOptionalFields: true,
470
574
  })
471
- implements TableSchema.Table<TCellSchema, TColumnSchema, TRowSchema>
575
+ implements TableSchema.Table<TInputScope, TCellSchema, TColumnSchema, TRowSchema>
472
576
  {
577
+ public static empty<TThis extends TableConstructorType>(
578
+ this: TThis,
579
+ ): InstanceType<TThis> {
580
+ return new this({ columns: [], rows: [] }) as InstanceType<TThis>;
581
+ }
582
+
473
583
  public getColumn(id: string): ColumnValueType | undefined {
474
584
  // TypeScript is unable to narrow the types correctly here, hence the casts.
475
585
  // See: https://github.com/microsoft/TypeScript/issues/52144
@@ -518,27 +628,11 @@ export namespace System_TableSchema {
518
628
  columns,
519
629
  index,
520
630
  }: TableSchema.InsertColumnsParameters<TColumnSchema>): ColumnValueType[] {
521
- // #region Input validation
522
-
523
631
  // Ensure index is valid
524
632
  if (index !== undefined) {
525
633
  Table.validateInsertionIndex(index, this.columns);
526
634
  }
527
635
 
528
- // Check all of the columns being inserted an ensure the table does not already contain any with the same ID.
529
- for (const column of columns) {
530
- // TypeScript is unable to narrow the type of the column type correctly here, hence the casts below.
531
- // See: https://github.com/microsoft/TypeScript/issues/52144
532
- const maybeId = (column as ColumnValueType).id;
533
- if (maybeId !== undefined && this.containsColumnWithId(maybeId)) {
534
- throw new UsageError(
535
- `A column with ID "${(column as ColumnValueType).id}" already exists in the table.`,
536
- );
537
- }
538
- }
539
-
540
- // #endregion
541
-
542
636
  // TypeScript is unable to narrow the column type correctly here, hence the casts below.
543
637
  // See: https://github.com/microsoft/TypeScript/issues/52144
544
638
  if (index === undefined) {
@@ -578,14 +672,6 @@ export namespace System_TableSchema {
578
672
  // Note: TypeScript is unable to narrow the type of the row type correctly here, hence the casts below.
579
673
  // See: https://github.com/microsoft/TypeScript/issues/52144
580
674
  for (const newRow of rows) {
581
- // Check all of the rows being inserted an ensure the table does not already contain any with the same ID.
582
- const maybeId = (newRow as RowValueType).id;
583
- if (maybeId !== undefined && this.containsRowWithId(maybeId)) {
584
- throw new UsageError(
585
- `A row with ID "${(newRow as RowValueType).id}" already exists in the table.`,
586
- );
587
- }
588
-
589
675
  // If the row contains cells, verify that the table contains the columns for those cells.
590
676
  // Note: we intentionally hide `cells` on `IRow` to avoid leaking the internal data representation as much as possible, so we have to cast here.
591
677
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -781,15 +867,19 @@ export namespace System_TableSchema {
781
867
  // TypeScript is unable to narrow the types correctly here, hence the cast.
782
868
  // See: https://github.com/microsoft/TypeScript/issues/52144
783
869
  return (
784
- this.columns.find((column) => (column as TableSchema.Column).id === columnId) !==
785
- undefined
870
+ this.columns.find(
871
+ (column) => (column as TableSchema.Column<TCellSchema>).id === columnId,
872
+ ) !== undefined
786
873
  );
787
874
  }
788
875
 
789
876
  private containsRowWithId(rowId: string): boolean {
790
877
  // TypeScript is unable to narrow the types correctly here, hence the cast.
791
878
  // See: https://github.com/microsoft/TypeScript/issues/52144
792
- return this.rows.find((row) => (row as TableSchema.Row).id === rowId) !== undefined;
879
+ return (
880
+ this.rows.find((row) => (row as TableSchema.Row<TCellSchema>).id === rowId) !==
881
+ undefined
882
+ );
793
883
  }
794
884
 
795
885
  /**
@@ -814,10 +904,18 @@ export namespace System_TableSchema {
814
904
  }
815
905
  }
816
906
 
907
+ // Set a private symbol on the schema class that marks it as having been generated by this factory.
908
+ // Column / Row functionality use this to validate that they are being used in a table.
909
+ // This is effectively a work-around that allows columns and rows to invoke table methods
910
+ // without having to pass the table as a parameter to their construction, which isn't possible.
911
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
912
+ (Table as any)[tableSchemaSymbol] = true;
913
+
817
914
  type TableValueType = TreeNode &
818
- TableSchema.Table<TCellSchema, TColumnSchema, TRowSchema> &
915
+ TableSchema.Table<TInputScope, TCellSchema, TColumnSchema, TRowSchema> &
819
916
  WithType<ScopedSchemaName<Scope, "Table">>;
820
917
  type TableInsertableType = InsertableObjectFromSchemaRecord<typeof tableFields>;
918
+ type TableConstructorType = new (data: TableInsertableType) => TableValueType;
821
919
 
822
920
  // Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
823
921
  // for the private brand field of TreeNode.
@@ -831,7 +929,12 @@ export namespace System_TableSchema {
831
929
  /* TInsertable */ object & TableInsertableType,
832
930
  /* ImplicitlyConstructable */ true,
833
931
  /* Info */ typeof tableFields
834
- > = Table;
932
+ > & {
933
+ /**
934
+ * Create an empty table.
935
+ */
936
+ empty<TThis extends TableConstructorType>(this: TThis): InstanceType<TThis>;
937
+ } = Table;
835
938
 
836
939
  // Return the table schema
837
940
  return TableSchemaType;
@@ -839,12 +942,12 @@ export namespace System_TableSchema {
839
942
 
840
943
  /**
841
944
  * Base row schema type.
842
- * @sealed @system @internal
945
+ * @sealed @system @alpha
843
946
  */
844
947
  export type TableSchemaBase<
845
948
  TScope extends string | undefined,
846
949
  TCell extends ImplicitAllowedTypes,
847
- TColumn extends ColumnSchemaBase<TScope>,
950
+ TColumn extends ColumnSchemaBase<TScope, TCell>,
848
951
  TRow extends RowSchemaBase<TScope, TCell>,
849
952
  > = ReturnType<typeof createTableSchema<TScope, TCell, TColumn, TRow>>;
850
953
 
@@ -856,6 +959,19 @@ export namespace System_TableSchema {
856
959
  *
857
960
  * @remarks
858
961
  *
962
+ * WARNING: These APIs are in preview and are subject to change.
963
+ * Until these APIs have stabilized, it is not recommended to use them in production code.
964
+ * There may be breaking changes to these APIs and their underlying data format.
965
+ * Using these APIs in production code may result in data loss or corruption.
966
+ *
967
+ * The primary APIs for create tabular data schema are:
968
+ *
969
+ * - {@link TableSchema.(table:1)}
970
+ *
971
+ * - {@link TableSchema.(column:1)}
972
+ *
973
+ * - {@link TableSchema.(row:1)}
974
+ *
859
975
  * Tables created using these APIs are...
860
976
  *
861
977
  * - sparse, meaning that cells may be omitted, and new rows are empty by default.
@@ -869,76 +985,111 @@ export namespace System_TableSchema {
869
985
  * Column and Row schema created using these APIs are extensible via the `props` field.
870
986
  * This allows association of additional properties with column and row nodes.
871
987
  *
872
- * Note: for now it is possible for table cells to become "orphaned".
988
+ * Cells in the table may become "orphaned."
873
989
  * That is, it is possible to enter a state where one or more rows contain cells with no corresponding column.
874
- * To help avoid this situation, you can manually remove corresponding cells when removing columns.
990
+ * To reduce the likelihood of this, you can manually remove corresponding cells when removing columns.
875
991
  * Either way, it is possible to enter such a state via the merging of edits.
876
992
  * For example: one client might add a row while another concurrently removes a column, orphaning the cell where the column and row intersected.
877
993
  *
878
- * @example Using default Column and Row schema
994
+ * @example Defining a Table schema
879
995
  *
880
996
  * ```typescript
881
- * class Cell extends schemaFactory.object("TableCell", {
882
- * value: schemaFactory.string,
883
- * }) {}
884
- *
885
- * class Table extends TableSchema.table({
997
+ * class MyTable extends TableSchema.table({
886
998
  * schemaFactory,
887
- * cell: Cell,
999
+ * cell: schemaFactory.string,
888
1000
  * }) {}
889
1001
  *
890
- * const table = new Table({
1002
+ * const table = new MyTable({
891
1003
  * columns: [{ id: "column-0" }],
892
- * rows: [{ id: "row-0", cells: {} }],
1004
+ * rows: [{ id: "row-0", cells: { "column-0": "Hello world!" } }],
893
1005
  * });
894
1006
  * ```
895
1007
  *
896
1008
  * @example Customizing Column and Row schema
897
1009
  *
898
1010
  * ```typescript
899
- * class Cell extends schemaFactory.object("TableCell", {
900
- * value: schemaFactory.string,
901
- * }) {}
902
- *
903
- * class ColumnProps extends schemaFactory.object("TableColumnProps", {
904
- * // Column label to display.
905
- * label: schemaFactory.string,
906
- * // The type of data represented by the cells. Default: string.
907
- * dataType: schemaFactory.optional(schemaFactory.string),
908
- * }) {}
1011
+ * const Cell = schemaFactory.string;
909
1012
  *
910
- * class Column extends TableSchema.column({
1013
+ * class MyColumn extends TableSchema.column({
911
1014
  * schemaFactory,
912
- * props: ColumnProps,
1015
+ * cell: Cell,
1016
+ * props: schemaFactory.object("TableColumnProps", {
1017
+ * label: schemaFactory.string,
1018
+ * }),
913
1019
  * }) {}
914
1020
  *
915
- * class Row extends TableSchema.row({
1021
+ * class MyRow extends TableSchema.row({
916
1022
  * schemaFactory,
917
1023
  * cell: Cell,
918
1024
  * }) {}
919
1025
  *
920
- * class Table extends TableSchema.table({
1026
+ * class MyTable extends TableSchema.table({
921
1027
  * schemaFactory,
922
1028
  * cell: Cell,
923
- * column: Column,
924
- * row: Row,
1029
+ * column: MyColumn,
1030
+ * row: MyRow,
925
1031
  * }) {}
926
1032
  *
927
- * const table = new Table({
1033
+ * const table = new MyTable({
928
1034
  * columns: [
929
- * new Column({ props: { label: "Entry", dataType: "string" } }),
930
- * new Column({ props: { label: "Date", dataType: "date" } }),
931
- * new Column({ props: { label: "Amount", dataType: "number" } }),
1035
+ * new MyColumn({ props: { label: "Entry" } }),
1036
+ * new MyColumn({ props: { label: "Date" } }),
1037
+ * new MyColumn({ props: { label: "Amount" } }),
932
1038
  * ],
933
1039
  * rows: [],
934
1040
  * });
935
1041
  * ```
936
1042
  *
1043
+ * @example Listening for changes in the table
1044
+ *
1045
+ * ```typescript
1046
+ * // Listen for any changes to the table and its children.
1047
+ * // The "treeChanged" event will fire when the associated node or any of its descendants change.
1048
+ * Tree.on(table, "treeChanged", () => {
1049
+ * // Respond to the change.
1050
+ * });
1051
+ * ```
1052
+ *
1053
+ * @example Listening for changes to the rows list only
1054
+ *
1055
+ * ```typescript
1056
+ * // Listen for any changes to the list of rows.
1057
+ * // The "nodeChanged" event will fire only when the specified node itself changes (i.e., its own properties change).
1058
+ * // In this case, the event will fire when a row is added or removed, or the order of the list is changed.
1059
+ * // But it won't fire when a row's properties change, or when the row's cells change, etc.
1060
+ * Tree.on(table.rows, "nodeChanged", () => {
1061
+ * // Respond to the change.
1062
+ * });
1063
+ * ```
1064
+ *
1065
+ * @example Removing column and cells in a transaction
1066
+ *
1067
+ * When removing a column, if you wish to ensure that all of its corresponding cells are also removed (and not
1068
+ * orphaned), you can remove the column and all of the relevant cells in a transaction.
1069
+ * Note that there are performance implications to this.
1070
+ *
1071
+ * ```typescript
1072
+ * // Remove column1 and all of its cells.
1073
+ * // The "transaction" method will ensure that all changes are applied atomically.
1074
+ * Tree.runTransaction(table, () => {
1075
+ * // Remove column1.
1076
+ * table.removeColumn(column1);
1077
+ *
1078
+ * // Remove the cell at column1 for each row.
1079
+ * for (const row of table.rows) {
1080
+ * table.removeCell({
1081
+ * column: column1,
1082
+ * row,
1083
+ * });
1084
+ * }
1085
+ * });
1086
+ * ```
1087
+ *
937
1088
  * @privateRemarks
938
1089
  * The above examples are backed by tests in `tableSchema.spec.ts`.
939
1090
  * Those tests and these examples should be kept in-sync to ensure that the examples are correct.
940
1091
  *
941
- * @internal
1092
+ * @alpha
942
1093
  */
943
1094
  export namespace TableSchema {
944
1095
  // #region Column
@@ -946,9 +1097,12 @@ export namespace TableSchema {
946
1097
  /**
947
1098
  * A column in a table.
948
1099
  * @remarks Implemented by the schema class returned from {@link TableSchema.(column:2)}.
949
- * @sealed @internal
1100
+ * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.
1101
+ * @typeParam TProps - Additional properties to associate with the column.
1102
+ * @sealed @alpha
950
1103
  */
951
1104
  export interface Column<
1105
+ TCell extends ImplicitAllowedTypes,
952
1106
  TProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,
953
1107
  > {
954
1108
  /**
@@ -968,40 +1122,59 @@ export namespace TableSchema {
968
1122
  set props(value: InsertableTreeFieldFromImplicitField<
969
1123
  UnannotateImplicitFieldSchema<TProps>
970
1124
  >);
1125
+
1126
+ /**
1127
+ * Gets all of the populated cells in the column, keyed by their associated row IDs.
1128
+ * @throws Throws an error if the column is not in a table.
1129
+ */
1130
+ getCells(): readonly {
1131
+ rowId: string;
1132
+ cell: TreeNodeFromImplicitAllowedTypes<TCell>;
1133
+ }[];
971
1134
  }
972
1135
 
973
1136
  /**
974
1137
  * Factory for creating new table column schema.
975
- * @internal
1138
+ * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.
1139
+ * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.
1140
+ * @alpha
976
1141
  */
977
- export function column<const TScope extends string | undefined>(
978
- params: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>>,
979
- ): System_TableSchema.ColumnSchemaBase<TScope, System_TableSchema.DefaultPropsType>;
1142
+ export function column<
1143
+ const TScope extends string | undefined,
1144
+ const TCell extends ImplicitAllowedTypes,
1145
+ >(
1146
+ params: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>, TCell>,
1147
+ ): System_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>;
980
1148
  /**
981
1149
  * Factory for creating new table column schema.
982
- * @internal
1150
+ * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.
1151
+ * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.
1152
+ * @typeParam TProps - Additional properties to associate with the column.
1153
+ * @alpha
983
1154
  */
984
1155
  export function column<
985
1156
  const TScope extends string | undefined,
1157
+ const TCell extends ImplicitAllowedTypes,
986
1158
  const TProps extends ImplicitAnnotatedFieldSchema,
987
1159
  >(
988
- params: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>> & {
1160
+ params: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {
989
1161
  /**
990
1162
  * Optional column properties.
991
1163
  */
992
1164
  readonly props: TProps;
993
1165
  },
994
- ): System_TableSchema.ColumnSchemaBase<TScope, TProps>;
1166
+ ): System_TableSchema.ColumnSchemaBase<TScope, TCell, TProps>;
995
1167
  /**
996
1168
  * Overload implementation
997
1169
  */
998
1170
  export function column({
999
1171
  schemaFactory,
1172
+ cell,
1000
1173
  props = SchemaFactory.optional(SchemaFactory.null),
1001
1174
  }: System_TableSchema.CreateColumnOptionsBase & {
1002
1175
  readonly props?: ImplicitAnnotatedFieldSchema;
1003
1176
  }): TreeNodeSchema {
1004
- return System_TableSchema.createColumnSchema(schemaFactory, props);
1177
+ return System_TableSchema.createColumnSchema(schemaFactory, cell, props);
1005
1178
  }
1006
1179
 
1007
1180
  // #endregion
@@ -1010,11 +1183,13 @@ export namespace TableSchema {
1010
1183
 
1011
1184
  /**
1012
1185
  * A row in a table.
1013
- * @remarks Implemented by the schema class returned from {@link TableSchema.(createRow:2)}.
1014
- * @sealed @internal
1186
+ * @remarks Implemented by the schema class returned from {@link TableSchema.(row:2)}.
1187
+ * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.
1188
+ * @typeParam TProps - Additional properties to associate with the row.
1189
+ * @sealed @alpha
1015
1190
  */
1016
1191
  export interface Row<
1017
- TCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,
1192
+ TCell extends ImplicitAllowedTypes,
1018
1193
  TProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,
1019
1194
  > {
1020
1195
  /**
@@ -1028,19 +1203,30 @@ export namespace TableSchema {
1028
1203
  * @returns The cell if it exists, otherwise undefined.
1029
1204
  * @privateRemarks TODO: throw if the column does not belong to the same table as the row.
1030
1205
  */
1031
- getCell(column: Column): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1206
+ getCell(column: Column<TCell>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1032
1207
  /**
1033
1208
  * Gets the cell in the specified column, denoted by column ID.
1034
1209
  * @returns The cell if it exists, otherwise undefined.
1035
1210
  */
1036
1211
  getCell(columnId: string): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1037
1212
 
1213
+ /**
1214
+ * Gets all of the populated cells in the row, keyed by their associated column IDs.
1215
+ */
1216
+ getCells(): readonly {
1217
+ columnId: string;
1218
+ cell: TreeNodeFromImplicitAllowedTypes<TCell>;
1219
+ }[];
1220
+
1038
1221
  /**
1039
1222
  * Sets the cell in the specified column.
1040
1223
  * @remarks To remove a cell, call {@link TableSchema.Row.(removeCell:1)} instead.
1041
1224
  * @privateRemarks TODO: Throw an error if the column does not exist in the table.
1042
1225
  */
1043
- setCell(column: Column, value: InsertableTreeNodeFromImplicitAllowedTypes<TCell>): void;
1226
+ setCell(
1227
+ column: Column<TCell>,
1228
+ value: InsertableTreeNodeFromImplicitAllowedTypes<TCell>,
1229
+ ): void;
1044
1230
  /**
1045
1231
  * Sets the cell in the specified column, denoted by column ID.
1046
1232
  * @remarks To remove a cell, call {@link TableSchema.Row.(removeCell:2)} instead.
@@ -1052,7 +1238,7 @@ export namespace TableSchema {
1052
1238
  * @returns The cell if it exists, otherwise undefined.
1053
1239
  * @privateRemarks TODO: Throw if the column does not belong to the same table as the row.
1054
1240
  */
1055
- removeCell(column: Column): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1241
+ removeCell(column: Column<TCell>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1056
1242
  /**
1057
1243
  * Removes the cell in the specified column, denoted by column ID.
1058
1244
  * @returns The cell if it exists, otherwise undefined.
@@ -1074,7 +1260,9 @@ export namespace TableSchema {
1074
1260
 
1075
1261
  /**
1076
1262
  * Factory for creating new table column schema.
1077
- * @internal
1263
+ * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.
1264
+ * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.
1265
+ * @alpha
1078
1266
  */
1079
1267
  export function row<
1080
1268
  const TScope extends string | undefined,
@@ -1084,7 +1272,10 @@ export namespace TableSchema {
1084
1272
  ): System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>;
1085
1273
  /**
1086
1274
  * Factory for creating new table row schema.
1087
- * @internal
1275
+ * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.
1276
+ * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.
1277
+ * @typeParam TProps - Additional properties to associate with the row.
1278
+ * @alpha
1088
1279
  */
1089
1280
  export function row<
1090
1281
  const TScope extends string | undefined,
@@ -1117,7 +1308,7 @@ export namespace TableSchema {
1117
1308
 
1118
1309
  /**
1119
1310
  * A key to uniquely identify a cell within a table.
1120
- * @internal
1311
+ * @alpha
1121
1312
  */
1122
1313
  export interface CellKey<
1123
1314
  TColumn extends ImplicitAllowedTypes,
@@ -1136,7 +1327,7 @@ export namespace TableSchema {
1136
1327
 
1137
1328
  /**
1138
1329
  * {@link TableSchema.Table.insertColumn} parameters.
1139
- * @internal
1330
+ * @alpha
1140
1331
  */
1141
1332
  export interface InsertColumnParameters<TColumn extends ImplicitAllowedTypes> {
1142
1333
  /**
@@ -1153,7 +1344,7 @@ export namespace TableSchema {
1153
1344
 
1154
1345
  /**
1155
1346
  * {@link TableSchema.Table.insertColumns} parameters.
1156
- * @internal
1347
+ * @alpha
1157
1348
  */
1158
1349
  export interface InsertColumnsParameters<TColumn extends ImplicitAllowedTypes> {
1159
1350
  /**
@@ -1170,7 +1361,7 @@ export namespace TableSchema {
1170
1361
 
1171
1362
  /**
1172
1363
  * {@link TableSchema.Table.insertRow} parameters.
1173
- * @internal
1364
+ * @alpha
1174
1365
  */
1175
1366
  export interface InsertRowParameters<TRow extends ImplicitAllowedTypes> {
1176
1367
  /**
@@ -1187,7 +1378,7 @@ export namespace TableSchema {
1187
1378
 
1188
1379
  /**
1189
1380
  * {@link TableSchema.Table.insertRows} parameters.
1190
- * @internal
1381
+ * @alpha
1191
1382
  */
1192
1383
  export interface InsertRowsParameters<TRow extends ImplicitAllowedTypes> {
1193
1384
  /**
@@ -1204,7 +1395,7 @@ export namespace TableSchema {
1204
1395
 
1205
1396
  /**
1206
1397
  * {@link TableSchema.Table.setCell} parameters.
1207
- * @internal
1398
+ * @alpha
1208
1399
  */
1209
1400
  export interface SetCellParameters<
1210
1401
  TCell extends ImplicitAllowedTypes,
@@ -1224,12 +1415,17 @@ export namespace TableSchema {
1224
1415
 
1225
1416
  /**
1226
1417
  * A table.
1227
- * @sealed @internal
1418
+ * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.
1419
+ * @typeParam TCell - The type of the cells in the table.
1420
+ * @typeParam TColumn - The type of the columns in the table.
1421
+ * @typeParam TRow - The type of the rows in the table.
1422
+ * @sealed @alpha
1228
1423
  */
1229
1424
  export interface Table<
1425
+ TScope extends string | undefined,
1230
1426
  TCell extends ImplicitAllowedTypes,
1231
- TColumn extends ImplicitAllowedTypes,
1232
- TRow extends ImplicitAllowedTypes,
1427
+ TColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>,
1428
+ TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,
1233
1429
  > {
1234
1430
  /**
1235
1431
  * The table's columns.
@@ -1260,14 +1456,9 @@ export namespace TableSchema {
1260
1456
  /**
1261
1457
  * Inserts a column into the table.
1262
1458
  *
1263
- * @throws
1264
- * Throws an error in the following cases:
1459
+ * @throws Throws an error if the specified index is out of range.
1265
1460
  *
1266
- * - The column, or a column with the same ID is already in the tree.
1267
- *
1268
- * - The specified index is out of range.
1269
- *
1270
- * No column is inserted in these cases.
1461
+ * No column is inserted in this case.
1271
1462
  */
1272
1463
  insertColumn(
1273
1464
  params: InsertColumnParameters<TColumn>,
@@ -1276,14 +1467,9 @@ export namespace TableSchema {
1276
1467
  /**
1277
1468
  * Inserts 0 or more columns into the table.
1278
1469
  *
1279
- * @throws
1280
- * Throws an error in the following cases:
1281
- *
1282
- * - At least one column, or a column with the same ID is already in the tree.
1470
+ * @throws Throws an error if the specified index is out of range.
1283
1471
  *
1284
- * - The specified index is out of range.
1285
- *
1286
- * No columns are inserted in these cases.
1472
+ * No columns are inserted in this case.
1287
1473
  */
1288
1474
  insertColumns(
1289
1475
  params: InsertColumnsParameters<TColumn>,
@@ -1295,8 +1481,6 @@ export namespace TableSchema {
1295
1481
  * @throws
1296
1482
  * Throws an error in the following cases:
1297
1483
  *
1298
- * - The row, or a row with the same ID is already in the tree.
1299
- *
1300
1484
  * - The row contains cells, but the table does not contain matching columns for one or more of those cells.
1301
1485
  *
1302
1486
  * - The specified index is out of range.
@@ -1311,8 +1495,6 @@ export namespace TableSchema {
1311
1495
  * @throws
1312
1496
  * Throws an error in the following cases:
1313
1497
  *
1314
- * - At least one row, or a row with the same ID is already in the tree.
1315
- *
1316
1498
  * - The row contains cells, but the table does not contain matching columns for one or more of those cells.
1317
1499
  *
1318
1500
  * - The specified index is out of range.
@@ -1418,8 +1600,10 @@ export namespace TableSchema {
1418
1600
  }
1419
1601
 
1420
1602
  /**
1421
- * Factory for creating new table schema without specifying row or column schema.
1422
- * @internal
1603
+ * Factory for creating new table schema.
1604
+ * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.
1605
+ * @typeParam TCell - The type of the cells in the table.
1606
+ * @alpha
1423
1607
  */
1424
1608
  export function table<
1425
1609
  const TScope extends string | undefined,
@@ -1429,17 +1613,20 @@ export namespace TableSchema {
1429
1613
  ): System_TableSchema.TableSchemaBase<
1430
1614
  TScope,
1431
1615
  TCell,
1432
- System_TableSchema.ColumnSchemaBase<TScope, System_TableSchema.DefaultPropsType>,
1616
+ System_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>,
1433
1617
  System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>
1434
1618
  >;
1435
1619
  /**
1436
- * Factory for creating new table schema without specifying row schema.
1437
- * @internal
1620
+ * Factory for creating new table schema with custom column schema.
1621
+ * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.
1622
+ * @typeParam TCell - The type of the cells in the table.
1623
+ * @typeParam TColumn - The type of the columns in the table.
1624
+ * @alpha
1438
1625
  */
1439
1626
  export function table<
1440
1627
  const TScope extends string | undefined,
1441
1628
  const TCell extends ImplicitAllowedTypes,
1442
- const TColumn extends System_TableSchema.ColumnSchemaBase<TScope>,
1629
+ const TColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>,
1443
1630
  >(
1444
1631
  params: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {
1445
1632
  readonly column: TColumn;
@@ -1451,13 +1638,38 @@ export namespace TableSchema {
1451
1638
  System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>
1452
1639
  >;
1453
1640
  /**
1454
- * Factory for creating new table schema.
1455
- * @internal
1641
+ * Factory for creating new table schema with custom row schema.
1642
+ * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.
1643
+ * @typeParam TCell - The type of the cells in the table.
1644
+ * @typeParam TRow - The type of the rows in the table.
1645
+ * @alpha
1456
1646
  */
1457
1647
  export function table<
1458
1648
  const TScope extends string | undefined,
1459
1649
  const TCell extends ImplicitAllowedTypes,
1460
- const TColumn extends System_TableSchema.ColumnSchemaBase<TScope>,
1650
+ const TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,
1651
+ >(
1652
+ params: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {
1653
+ readonly row: TRow;
1654
+ },
1655
+ ): System_TableSchema.TableSchemaBase<
1656
+ TScope,
1657
+ TCell,
1658
+ System_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>,
1659
+ TRow
1660
+ >;
1661
+ /**
1662
+ * Factory for creating new table schema with custom column and row schema.
1663
+ * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.
1664
+ * @typeParam TCell - The type of the cells in the table.
1665
+ * @typeParam TColumn - The type of the columns in the table.
1666
+ * @typeParam TRow - The type of the rows in the table.
1667
+ * @alpha
1668
+ */
1669
+ export function table<
1670
+ const TScope extends string | undefined,
1671
+ const TCell extends ImplicitAllowedTypes,
1672
+ const TColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>,
1461
1673
  const TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,
1462
1674
  >(
1463
1675
  params: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {
@@ -1473,6 +1685,7 @@ export namespace TableSchema {
1473
1685
  cell: cellSchema,
1474
1686
  column: columnSchema = column({
1475
1687
  schemaFactory,
1688
+ cell: cellSchema,
1476
1689
  }),
1477
1690
  row: rowSchema = row({
1478
1691
  schemaFactory,