@fluidframework/tree 2.40.0-336023 → 2.41.0-337492

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 (457) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/api-report/tree.alpha.api.md +4 -1
  3. package/dist/alpha.d.ts +1 -0
  4. package/dist/codec/codec.d.ts +5 -1
  5. package/dist/codec/codec.d.ts.map +1 -1
  6. package/dist/codec/codec.js +6 -2
  7. package/dist/codec/codec.js.map +1 -1
  8. package/dist/codec/index.d.ts +1 -1
  9. package/dist/codec/index.d.ts.map +1 -1
  10. package/dist/codec/index.js +2 -1
  11. package/dist/codec/index.js.map +1 -1
  12. package/dist/core/index.d.ts +2 -2
  13. package/dist/core/index.d.ts.map +1 -1
  14. package/dist/core/index.js +2 -3
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/core/schema-stored/{format.d.ts → formatV1.d.ts} +1 -1
  17. package/dist/core/schema-stored/formatV1.d.ts.map +1 -0
  18. package/dist/core/schema-stored/{format.js → formatV1.js} +1 -1
  19. package/dist/core/schema-stored/formatV1.js.map +1 -0
  20. package/dist/core/schema-stored/index.d.ts +3 -3
  21. package/dist/core/schema-stored/index.d.ts.map +1 -1
  22. package/dist/core/schema-stored/index.js +3 -3
  23. package/dist/core/schema-stored/index.js.map +1 -1
  24. package/dist/core/schema-stored/schema.d.ts +3 -1
  25. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  26. package/dist/core/schema-stored/schema.js +8 -6
  27. package/dist/core/schema-stored/schema.js.map +1 -1
  28. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  29. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  30. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  31. package/dist/core/schema-view/index.d.ts +1 -1
  32. package/dist/core/schema-view/index.d.ts.map +1 -1
  33. package/dist/core/schema-view/index.js +1 -2
  34. package/dist/core/schema-view/index.js.map +1 -1
  35. package/dist/core/schema-view/view.d.ts +0 -27
  36. package/dist/core/schema-view/view.d.ts.map +1 -1
  37. package/dist/core/schema-view/view.js +1 -35
  38. package/dist/core/schema-view/view.js.map +1 -1
  39. package/dist/core/tree/persistedTreeTextFormat.d.ts +4 -4
  40. package/dist/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
  41. package/dist/core/tree/persistedTreeTextFormat.js +1 -1
  42. package/dist/core/tree/persistedTreeTextFormat.js.map +1 -1
  43. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  44. package/dist/feature-libraries/default-schema/schemaChecker.js +0 -7
  45. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  46. package/dist/feature-libraries/forest-summary/format.d.ts +2 -2
  47. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  48. package/dist/feature-libraries/forest-summary/format.js +1 -1
  49. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  50. package/dist/feature-libraries/index.d.ts +1 -1
  51. package/dist/feature-libraries/index.d.ts.map +1 -1
  52. package/dist/feature-libraries/index.js +4 -2
  53. package/dist/feature-libraries/index.js.map +1 -1
  54. package/dist/feature-libraries/mapTreeCursor.d.ts +3 -3
  55. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  56. package/dist/feature-libraries/mapTreeCursor.js +2 -2
  57. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  58. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +9 -9
  59. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  60. package/dist/feature-libraries/modular-schema/modularChangeFormat.js +2 -2
  61. package/dist/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
  62. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +14 -1
  63. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  64. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +26 -5
  65. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  66. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  67. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  68. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  69. package/dist/feature-libraries/schema-index/codec.d.ts +34 -5
  70. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  71. package/dist/feature-libraries/schema-index/codec.js +63 -9
  72. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  73. package/{lib/feature-libraries/schema-index/format.d.ts → dist/feature-libraries/schema-index/formatV1.d.ts} +9 -9
  74. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -0
  75. package/dist/feature-libraries/schema-index/{format.js → formatV1.js} +4 -4
  76. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -0
  77. package/dist/feature-libraries/schema-index/index.d.ts +2 -2
  78. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  79. package/dist/feature-libraries/schema-index/index.js +6 -3
  80. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  81. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +5 -5
  82. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  83. package/dist/feature-libraries/schema-index/schemaSummarizer.js +4 -4
  84. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  85. package/dist/index.d.ts +1 -0
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +10 -8
  88. package/dist/index.js.map +1 -1
  89. package/dist/packageVersion.d.ts +1 -1
  90. package/dist/packageVersion.js +1 -1
  91. package/dist/packageVersion.js.map +1 -1
  92. package/dist/shared-tree/independentView.d.ts.map +1 -1
  93. package/dist/shared-tree/independentView.js +1 -1
  94. package/dist/shared-tree/independentView.js.map +1 -1
  95. package/dist/shared-tree/index.d.ts +1 -1
  96. package/dist/shared-tree/index.d.ts.map +1 -1
  97. package/dist/shared-tree/index.js +2 -1
  98. package/dist/shared-tree/index.js.map +1 -1
  99. package/dist/shared-tree/schematizeTree.d.ts +9 -10
  100. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  101. package/dist/shared-tree/schematizeTree.js +10 -34
  102. package/dist/shared-tree/schematizeTree.js.map +1 -1
  103. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  104. package/dist/shared-tree/schematizingTreeView.js +4 -6
  105. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  106. package/dist/shared-tree/sharedTree.d.ts +28 -3
  107. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  108. package/dist/shared-tree/sharedTree.js +29 -3
  109. package/dist/shared-tree/sharedTree.js.map +1 -1
  110. package/dist/shared-tree/tree.d.ts +24 -0
  111. package/dist/shared-tree/tree.d.ts.map +1 -1
  112. package/dist/shared-tree/tree.js.map +1 -1
  113. package/dist/shared-tree/treeAlpha.d.ts +2 -0
  114. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  115. package/dist/shared-tree/treeAlpha.js +3 -2
  116. package/dist/shared-tree/treeAlpha.js.map +1 -1
  117. package/dist/shared-tree-core/branchCommitEnricher.d.ts +0 -1
  118. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  119. package/dist/shared-tree-core/branchCommitEnricher.js +0 -1
  120. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  121. package/dist/shared-tree-core/transactionEnricher.d.ts +1 -1
  122. package/dist/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  123. package/dist/shared-tree-core/transactionEnricher.js +4 -1
  124. package/dist/shared-tree-core/transactionEnricher.js.map +1 -1
  125. package/dist/simple-tree/api/index.d.ts +2 -1
  126. package/dist/simple-tree/api/index.d.ts.map +1 -1
  127. package/dist/simple-tree/api/index.js +2 -1
  128. package/dist/simple-tree/api/index.js.map +1 -1
  129. package/dist/simple-tree/api/schemaFactory.d.ts +9 -0
  130. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  131. package/dist/simple-tree/api/schemaFactory.js +7 -0
  132. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  133. package/dist/simple-tree/api/storedSchema.d.ts +8 -7
  134. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  135. package/dist/simple-tree/api/storedSchema.js +13 -9
  136. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  137. package/dist/simple-tree/api/tree.d.ts +25 -0
  138. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  139. package/dist/simple-tree/api/tree.js.map +1 -1
  140. package/dist/simple-tree/api/treeBeta.d.ts +4 -1
  141. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  142. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  143. package/dist/simple-tree/api/treeChangeEvents.d.ts +83 -0
  144. package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -0
  145. package/dist/simple-tree/api/treeChangeEvents.js +7 -0
  146. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -0
  147. package/dist/simple-tree/api/treeNodeApi.d.ts +2 -1
  148. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  149. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  150. package/dist/simple-tree/arrayNode.d.ts +28 -0
  151. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  152. package/dist/simple-tree/arrayNode.js.map +1 -1
  153. package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
  154. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  155. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  156. package/dist/simple-tree/core/index.d.ts +2 -1
  157. package/dist/simple-tree/core/index.d.ts.map +1 -1
  158. package/dist/simple-tree/core/index.js +5 -5
  159. package/dist/simple-tree/core/index.js.map +1 -1
  160. package/dist/simple-tree/core/treeNode.d.ts +94 -0
  161. package/dist/simple-tree/core/treeNode.d.ts.map +1 -0
  162. package/dist/simple-tree/core/treeNode.js +123 -0
  163. package/dist/simple-tree/core/treeNode.js.map +1 -0
  164. package/dist/simple-tree/core/treeNodeKernel.d.ts +2 -1
  165. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  166. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  167. package/dist/simple-tree/core/treeNodeSchema.d.ts +3 -1
  168. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  169. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  170. package/dist/simple-tree/core/types.d.ts +0 -165
  171. package/dist/simple-tree/core/types.d.ts.map +1 -1
  172. package/dist/simple-tree/core/types.js +1 -113
  173. package/dist/simple-tree/core/types.js.map +1 -1
  174. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  175. package/dist/simple-tree/core/unhydratedFlexTree.js +5 -1
  176. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  177. package/dist/simple-tree/core/withType.d.ts +1 -1
  178. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  179. package/dist/simple-tree/core/withType.js.map +1 -1
  180. package/dist/simple-tree/index.d.ts +2 -2
  181. package/dist/simple-tree/index.d.ts.map +1 -1
  182. package/dist/simple-tree/index.js +3 -2
  183. package/dist/simple-tree/index.js.map +1 -1
  184. package/dist/simple-tree/schemaTypes.d.ts +1 -0
  185. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  186. package/dist/simple-tree/schemaTypes.js.map +1 -1
  187. package/dist/simple-tree/toStoredSchema.d.ts +8 -8
  188. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  189. package/dist/simple-tree/toStoredSchema.js +27 -32
  190. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  191. package/dist/tableSchema.d.ts +309 -91
  192. package/dist/tableSchema.d.ts.map +1 -1
  193. package/dist/tableSchema.js +319 -78
  194. package/dist/tableSchema.js.map +1 -1
  195. package/dist/treeFactory.d.ts +1 -1
  196. package/dist/treeFactory.d.ts.map +1 -1
  197. package/dist/treeFactory.js +30 -75
  198. package/dist/treeFactory.js.map +1 -1
  199. package/lib/alpha.d.ts +1 -0
  200. package/lib/codec/codec.d.ts +5 -1
  201. package/lib/codec/codec.d.ts.map +1 -1
  202. package/lib/codec/codec.js +5 -1
  203. package/lib/codec/codec.js.map +1 -1
  204. package/lib/codec/index.d.ts +1 -1
  205. package/lib/codec/index.d.ts.map +1 -1
  206. package/lib/codec/index.js +1 -1
  207. package/lib/codec/index.js.map +1 -1
  208. package/lib/core/index.d.ts +2 -2
  209. package/lib/core/index.d.ts.map +1 -1
  210. package/lib/core/index.js +2 -2
  211. package/lib/core/index.js.map +1 -1
  212. package/lib/core/schema-stored/{format.d.ts → formatV1.d.ts} +1 -1
  213. package/lib/core/schema-stored/formatV1.d.ts.map +1 -0
  214. package/lib/core/schema-stored/{format.js → formatV1.js} +1 -1
  215. package/lib/core/schema-stored/formatV1.js.map +1 -0
  216. package/lib/core/schema-stored/index.d.ts +3 -3
  217. package/lib/core/schema-stored/index.d.ts.map +1 -1
  218. package/lib/core/schema-stored/index.js +2 -2
  219. package/lib/core/schema-stored/index.js.map +1 -1
  220. package/lib/core/schema-stored/schema.d.ts +3 -1
  221. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  222. package/lib/core/schema-stored/schema.js +3 -1
  223. package/lib/core/schema-stored/schema.js.map +1 -1
  224. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  225. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  226. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  227. package/lib/core/schema-view/index.d.ts +1 -1
  228. package/lib/core/schema-view/index.d.ts.map +1 -1
  229. package/lib/core/schema-view/index.js +1 -1
  230. package/lib/core/schema-view/index.js.map +1 -1
  231. package/lib/core/schema-view/view.d.ts +0 -27
  232. package/lib/core/schema-view/view.d.ts.map +1 -1
  233. package/lib/core/schema-view/view.js +0 -34
  234. package/lib/core/schema-view/view.js.map +1 -1
  235. package/lib/core/tree/persistedTreeTextFormat.d.ts +4 -4
  236. package/lib/core/tree/persistedTreeTextFormat.d.ts.map +1 -1
  237. package/lib/core/tree/persistedTreeTextFormat.js +2 -2
  238. package/lib/core/tree/persistedTreeTextFormat.js.map +1 -1
  239. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  240. package/lib/feature-libraries/default-schema/schemaChecker.js +0 -7
  241. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  242. package/lib/feature-libraries/forest-summary/format.d.ts +2 -2
  243. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  244. package/lib/feature-libraries/forest-summary/format.js +2 -2
  245. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  246. package/lib/feature-libraries/index.d.ts +1 -1
  247. package/lib/feature-libraries/index.d.ts.map +1 -1
  248. package/lib/feature-libraries/index.js +1 -1
  249. package/lib/feature-libraries/index.js.map +1 -1
  250. package/lib/feature-libraries/mapTreeCursor.d.ts +3 -3
  251. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  252. package/lib/feature-libraries/mapTreeCursor.js +2 -2
  253. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  254. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +9 -9
  255. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  256. package/lib/feature-libraries/modular-schema/modularChangeFormat.js +3 -3
  257. package/lib/feature-libraries/modular-schema/modularChangeFormat.js.map +1 -1
  258. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +14 -1
  259. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  260. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +26 -6
  261. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  262. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  263. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  264. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js +3 -3
  265. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  266. package/lib/feature-libraries/schema-index/codec.d.ts +34 -5
  267. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  268. package/lib/feature-libraries/schema-index/codec.js +61 -9
  269. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  270. package/{dist/feature-libraries/schema-index/format.d.ts → lib/feature-libraries/schema-index/formatV1.d.ts} +9 -9
  271. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -0
  272. package/lib/feature-libraries/schema-index/{format.js → formatV1.js} +5 -5
  273. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -0
  274. package/lib/feature-libraries/schema-index/index.d.ts +2 -2
  275. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  276. package/lib/feature-libraries/schema-index/index.js +2 -2
  277. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  278. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +5 -5
  279. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  280. package/lib/feature-libraries/schema-index/schemaSummarizer.js +5 -5
  281. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  282. package/lib/index.d.ts +1 -0
  283. package/lib/index.d.ts.map +1 -1
  284. package/lib/index.js +1 -0
  285. package/lib/index.js.map +1 -1
  286. package/lib/packageVersion.d.ts +1 -1
  287. package/lib/packageVersion.js +1 -1
  288. package/lib/packageVersion.js.map +1 -1
  289. package/lib/shared-tree/independentView.d.ts.map +1 -1
  290. package/lib/shared-tree/independentView.js +2 -2
  291. package/lib/shared-tree/independentView.js.map +1 -1
  292. package/lib/shared-tree/index.d.ts +1 -1
  293. package/lib/shared-tree/index.d.ts.map +1 -1
  294. package/lib/shared-tree/index.js +1 -1
  295. package/lib/shared-tree/index.js.map +1 -1
  296. package/lib/shared-tree/schematizeTree.d.ts +9 -10
  297. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  298. package/lib/shared-tree/schematizeTree.js +11 -35
  299. package/lib/shared-tree/schematizeTree.js.map +1 -1
  300. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  301. package/lib/shared-tree/schematizingTreeView.js +5 -7
  302. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  303. package/lib/shared-tree/sharedTree.d.ts +28 -3
  304. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  305. package/lib/shared-tree/sharedTree.js +29 -4
  306. package/lib/shared-tree/sharedTree.js.map +1 -1
  307. package/lib/shared-tree/tree.d.ts +24 -0
  308. package/lib/shared-tree/tree.d.ts.map +1 -1
  309. package/lib/shared-tree/tree.js.map +1 -1
  310. package/lib/shared-tree/treeAlpha.d.ts +2 -0
  311. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  312. package/lib/shared-tree/treeAlpha.js +4 -3
  313. package/lib/shared-tree/treeAlpha.js.map +1 -1
  314. package/lib/shared-tree-core/branchCommitEnricher.d.ts +0 -1
  315. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  316. package/lib/shared-tree-core/branchCommitEnricher.js +0 -1
  317. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  318. package/lib/shared-tree-core/transactionEnricher.d.ts +1 -1
  319. package/lib/shared-tree-core/transactionEnricher.d.ts.map +1 -1
  320. package/lib/shared-tree-core/transactionEnricher.js +4 -1
  321. package/lib/shared-tree-core/transactionEnricher.js.map +1 -1
  322. package/lib/simple-tree/api/index.d.ts +2 -1
  323. package/lib/simple-tree/api/index.d.ts.map +1 -1
  324. package/lib/simple-tree/api/index.js +1 -1
  325. package/lib/simple-tree/api/index.js.map +1 -1
  326. package/lib/simple-tree/api/schemaFactory.d.ts +9 -0
  327. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  328. package/lib/simple-tree/api/schemaFactory.js +7 -0
  329. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  330. package/lib/simple-tree/api/storedSchema.d.ts +8 -7
  331. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  332. package/lib/simple-tree/api/storedSchema.js +17 -11
  333. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  334. package/lib/simple-tree/api/tree.d.ts +25 -0
  335. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  336. package/lib/simple-tree/api/tree.js.map +1 -1
  337. package/lib/simple-tree/api/treeBeta.d.ts +4 -1
  338. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  339. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  340. package/lib/simple-tree/api/treeChangeEvents.d.ts +83 -0
  341. package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -0
  342. package/lib/simple-tree/api/treeChangeEvents.js +6 -0
  343. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -0
  344. package/lib/simple-tree/api/treeNodeApi.d.ts +2 -1
  345. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  346. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  347. package/lib/simple-tree/arrayNode.d.ts +28 -0
  348. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  349. package/lib/simple-tree/arrayNode.js.map +1 -1
  350. package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
  351. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  352. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  353. package/lib/simple-tree/core/index.d.ts +2 -1
  354. package/lib/simple-tree/core/index.d.ts.map +1 -1
  355. package/lib/simple-tree/core/index.js +1 -1
  356. package/lib/simple-tree/core/index.js.map +1 -1
  357. package/lib/simple-tree/core/treeNode.d.ts +94 -0
  358. package/lib/simple-tree/core/treeNode.d.ts.map +1 -0
  359. package/lib/simple-tree/core/treeNode.js +118 -0
  360. package/lib/simple-tree/core/treeNode.js.map +1 -0
  361. package/lib/simple-tree/core/treeNodeKernel.d.ts +2 -1
  362. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  363. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  364. package/lib/simple-tree/core/treeNodeSchema.d.ts +3 -1
  365. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  366. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  367. package/lib/simple-tree/core/types.d.ts +0 -165
  368. package/lib/simple-tree/core/types.d.ts.map +1 -1
  369. package/lib/simple-tree/core/types.js +0 -110
  370. package/lib/simple-tree/core/types.js.map +1 -1
  371. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  372. package/lib/simple-tree/core/unhydratedFlexTree.js +5 -1
  373. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  374. package/lib/simple-tree/core/withType.d.ts +1 -1
  375. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  376. package/lib/simple-tree/core/withType.js.map +1 -1
  377. package/lib/simple-tree/index.d.ts +2 -2
  378. package/lib/simple-tree/index.d.ts.map +1 -1
  379. package/lib/simple-tree/index.js +1 -1
  380. package/lib/simple-tree/index.js.map +1 -1
  381. package/lib/simple-tree/schemaTypes.d.ts +1 -0
  382. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  383. package/lib/simple-tree/schemaTypes.js.map +1 -1
  384. package/lib/simple-tree/toStoredSchema.d.ts +8 -8
  385. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  386. package/lib/simple-tree/toStoredSchema.js +26 -31
  387. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  388. package/lib/tableSchema.d.ts +309 -91
  389. package/lib/tableSchema.d.ts.map +1 -1
  390. package/lib/tableSchema.js +319 -78
  391. package/lib/tableSchema.js.map +1 -1
  392. package/lib/treeFactory.d.ts +1 -1
  393. package/lib/treeFactory.d.ts.map +1 -1
  394. package/lib/treeFactory.js +30 -75
  395. package/lib/treeFactory.js.map +1 -1
  396. package/package.json +21 -21
  397. package/src/codec/codec.ts +6 -1
  398. package/src/codec/index.ts +1 -0
  399. package/src/core/index.ts +1 -2
  400. package/src/core/schema-stored/index.ts +3 -3
  401. package/src/core/schema-stored/schema.ts +3 -1
  402. package/src/core/schema-stored/storedSchemaRepository.ts +1 -1
  403. package/src/core/schema-view/index.ts +0 -1
  404. package/src/core/schema-view/view.ts +0 -31
  405. package/src/core/tree/persistedTreeTextFormat.ts +2 -2
  406. package/src/feature-libraries/default-schema/schemaChecker.ts +0 -8
  407. package/src/feature-libraries/forest-summary/format.ts +2 -2
  408. package/src/feature-libraries/index.ts +7 -1
  409. package/src/feature-libraries/mapTreeCursor.ts +3 -3
  410. package/src/feature-libraries/modular-schema/modularChangeFormat.ts +3 -3
  411. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +38 -9
  412. package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +3 -4
  413. package/src/feature-libraries/schema-index/codec.ts +80 -12
  414. package/src/feature-libraries/schema-index/{format.ts → formatV1.ts} +4 -4
  415. package/src/feature-libraries/schema-index/index.ts +7 -2
  416. package/src/feature-libraries/schema-index/schemaSummarizer.ts +9 -9
  417. package/src/index.ts +1 -0
  418. package/src/packageVersion.ts +1 -1
  419. package/src/shared-tree/independentView.ts +3 -2
  420. package/src/shared-tree/index.ts +2 -0
  421. package/src/shared-tree/schematizeTree.ts +6 -36
  422. package/src/shared-tree/schematizingTreeView.ts +5 -12
  423. package/src/shared-tree/sharedTree.ts +67 -6
  424. package/src/shared-tree/tree.ts +24 -0
  425. package/src/shared-tree/treeAlpha.ts +6 -3
  426. package/src/shared-tree-core/branchCommitEnricher.ts +0 -1
  427. package/src/shared-tree-core/transactionEnricher.ts +4 -1
  428. package/src/simple-tree/api/index.ts +2 -0
  429. package/src/simple-tree/api/schemaFactory.ts +9 -0
  430. package/src/simple-tree/api/storedSchema.ts +24 -13
  431. package/src/simple-tree/api/tree.ts +25 -0
  432. package/src/simple-tree/api/treeBeta.ts +3 -1
  433. package/src/simple-tree/api/treeChangeEvents.ts +84 -0
  434. package/src/simple-tree/api/treeNodeApi.ts +1 -1
  435. package/src/simple-tree/arrayNode.ts +28 -0
  436. package/src/simple-tree/core/getOrCreateNode.ts +1 -1
  437. package/src/simple-tree/core/index.ts +5 -4
  438. package/src/simple-tree/core/treeNode.ts +163 -0
  439. package/src/simple-tree/core/treeNodeKernel.ts +2 -1
  440. package/src/simple-tree/core/treeNodeSchema.ts +3 -1
  441. package/src/simple-tree/core/types.ts +0 -234
  442. package/src/simple-tree/core/unhydratedFlexTree.ts +6 -1
  443. package/src/simple-tree/core/withType.ts +1 -1
  444. package/src/simple-tree/index.ts +2 -1
  445. package/src/simple-tree/schemaTypes.ts +1 -0
  446. package/src/simple-tree/toStoredSchema.ts +42 -41
  447. package/src/tableSchema.ts +713 -259
  448. package/src/treeFactory.ts +56 -173
  449. package/dist/core/schema-stored/format.d.ts.map +0 -1
  450. package/dist/core/schema-stored/format.js.map +0 -1
  451. package/dist/feature-libraries/schema-index/format.d.ts.map +0 -1
  452. package/dist/feature-libraries/schema-index/format.js.map +0 -1
  453. package/lib/core/schema-stored/format.d.ts.map +0 -1
  454. package/lib/core/schema-stored/format.js.map +0 -1
  455. package/lib/feature-libraries/schema-index/format.d.ts.map +0 -1
  456. package/lib/feature-libraries/schema-index/format.js.map +0 -1
  457. /package/src/core/schema-stored/{format.ts → formatV1.ts} +0 -0
@@ -4,12 +4,12 @@
4
4
  */
5
5
 
6
6
  import { oob } from "@fluidframework/core-utils/internal";
7
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
8
 
8
9
  import { Tree } from "./shared-tree/index.js";
9
10
  import {
10
11
  type FieldHasDefault,
11
12
  type ImplicitAllowedTypes,
12
- type ImplicitFieldSchema,
13
13
  type InsertableObjectFromSchemaRecord,
14
14
  type InsertableTreeNodeFromImplicitAllowedTypes,
15
15
  type NodeKind,
@@ -24,17 +24,22 @@ import {
24
24
  type TreeFieldFromImplicitField,
25
25
  type InsertableTreeFieldFromImplicitField,
26
26
  type InternalTreeNode,
27
- type FieldSchema,
28
- type FieldKind,
29
27
  SchemaFactory,
30
28
  type ImplicitAnnotatedFieldSchema,
31
29
  type UnannotateImplicitFieldSchema,
32
30
  } from "./simple-tree/index.js";
33
31
 
34
- // Future improvement TODOs (ideally to be done before promoting these APIs to `@alpha`):
32
+ // Future improvement TODOs:
33
+ // - Omit `cells` property from Row insertion type.
35
34
  // - Record-like type parameters / input parameters?
36
35
  // - Omit `props` properties from Row and Column schemas when not provided?
37
36
 
37
+ // Longer-term work:
38
+ // - Add constraint APIs to make it possible to avoid situations that could yield "orphaned" cells.
39
+
40
+ /**
41
+ * The sub-scope applied to user-provided {@link SchemaFactory}s by table schema factories.
42
+ */
38
43
  const tableSchemaFactorySubScope = "table";
39
44
 
40
45
  /**
@@ -48,20 +53,28 @@ const tableSchemaFactorySubScope = "table";
48
53
  * @system @internal
49
54
  */
50
55
  export namespace System_TableSchema {
56
+ /**
57
+ * Default type used for column and row "props" fields.
58
+ * @privateRemarks
59
+ * Longer term, it would be better to simply omit "props" altogether by default.
60
+ * For now, this ensures that the user doesn't have to specify a "props" entry when initializing column/row nodes
61
+ * and ensures that they cannot set anything that might conflict with future evolutions of the schema.
62
+ * @system @internal
63
+ */
64
+ export type DefaultPropsType = ReturnType<typeof SchemaFactory.optional<[]>>;
65
+
51
66
  /**
52
67
  * A base interface for factory input options which include an schema factory.
53
68
  * @remarks This interface should not be referenced directly.
54
69
  * @privateRemarks This interface primarily exists to provide a single home for property documentation.
55
70
  * @system @internal
56
71
  */
57
- export interface OptionsWithSchemaFactory<
58
- TScope extends string | undefined = string | undefined,
59
- > {
72
+ export interface OptionsWithSchemaFactory<TSchemaFactory extends SchemaFactoryAlpha> {
60
73
  /**
61
74
  * Schema factory with which the Column schema will be associated.
62
75
  * @remarks Can be used to associate the resulting schema with an existing {@link SchemaFactory.scope|scope}.
63
76
  */
64
- readonly schemaFactory: SchemaFactoryAlpha<TScope>;
77
+ readonly schemaFactory: TSchemaFactory;
65
78
  }
66
79
 
67
80
  /**
@@ -70,9 +83,7 @@ export namespace System_TableSchema {
70
83
  * @privateRemarks This interface primarily exists to provide a single home for property documentation.
71
84
  * @system @internal
72
85
  */
73
- export interface OptionsWithCellSchema<
74
- TCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,
75
- > {
86
+ export interface OptionsWithCellSchema<TCellSchema extends ImplicitAllowedTypes> {
76
87
  /**
77
88
  * Schema for the table's cells.
78
89
  */
@@ -87,15 +98,15 @@ export namespace System_TableSchema {
87
98
  * @system @internal
88
99
  */
89
100
  export type CreateColumnOptionsBase<
90
- TInputScope extends string | undefined = string | undefined,
91
- > = OptionsWithSchemaFactory<TInputScope>;
101
+ TSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,
102
+ > = OptionsWithSchemaFactory<TSchemaFactory>;
92
103
 
93
104
  /**
94
- * Factory for creating new table column schema.
105
+ * Factory for creating column schema.
95
106
  * @system @internal
96
107
  */
97
108
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
98
- export function createColumnInternal<
109
+ export function createColumnSchema<
99
110
  const TInputScope extends string | undefined,
100
111
  const TPropsSchema extends ImplicitAnnotatedFieldSchema,
101
112
  >(inputSchemaFactory: SchemaFactoryAlpha<TInputScope>, propsSchema: TPropsSchema) {
@@ -136,10 +147,10 @@ export namespace System_TableSchema {
136
147
  // Will make it easier to evolve this schema in the future.
137
148
  allowUnknownOptionalFields: true,
138
149
  })
139
- implements TableSchema.IColumn<TPropsSchema> {}
150
+ implements TableSchema.Column<TPropsSchema> {}
140
151
 
141
152
  type ColumnValueType = TreeNode &
142
- TableSchema.IColumn<TPropsSchema> &
153
+ TableSchema.Column<TPropsSchema> &
143
154
  WithType<ScopedSchemaName<Scope, "Column">>;
144
155
 
145
156
  // Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof columnFields>`,
@@ -151,7 +162,7 @@ export namespace System_TableSchema {
151
162
  typeof columnFieldsBuiltInParts
152
163
  > &
153
164
  (FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true
154
- ? // Note: The docs on the below properties are copied from `IRow.props`' docs to ensure that the
165
+ ? // Note: The docs on the below properties are copied from `IColumn.props`' docs to ensure that the
155
166
  // documentation appears in the data insertion scenario.
156
167
  // The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly
157
168
  // support `@inheritDoc`.
@@ -215,8 +226,8 @@ export namespace System_TableSchema {
215
226
  */
216
227
  export type ColumnSchemaBase<
217
228
  TScope extends string | undefined = string | undefined,
218
- TPropsSchema extends ImplicitFieldSchema = ImplicitFieldSchema,
219
- > = ReturnType<typeof TableSchema.createColumn<TScope, TPropsSchema>>;
229
+ TPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,
230
+ > = ReturnType<typeof createColumnSchema<TScope, TPropsSchema>>;
220
231
 
221
232
  // #endregion
222
233
 
@@ -228,20 +239,19 @@ export namespace System_TableSchema {
228
239
  * @system @internal
229
240
  */
230
241
  export type CreateRowOptionsBase<
231
- TScope extends string | undefined = string | undefined,
242
+ TSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,
232
243
  TCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,
233
- > = OptionsWithSchemaFactory<TScope> & OptionsWithCellSchema<TCell>;
244
+ > = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;
234
245
 
235
246
  /**
236
- * Factory for creating new table row schema.
237
- *
247
+ * Factory for creating row schema.
238
248
  * @sealed @internal
239
249
  */
240
250
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
241
- export function createRowInternal<
251
+ export function createRowSchema<
242
252
  const TInputScope extends string | undefined,
243
253
  const TCellSchema extends ImplicitAllowedTypes,
244
- const TPropsSchema extends ImplicitFieldSchema,
254
+ const TPropsSchema extends ImplicitAnnotatedFieldSchema,
245
255
  >(
246
256
  inputSchemaFactory: SchemaFactoryAlpha<TInputScope>,
247
257
  cellSchema: TCellSchema,
@@ -289,32 +299,40 @@ export namespace System_TableSchema {
289
299
  // Will make it easier to evolve this schema in the future.
290
300
  allowUnknownOptionalFields: true,
291
301
  })
292
- implements TableSchema.IRow<TCellSchema, TPropsSchema>
302
+ implements TableSchema.Row<TCellSchema, TPropsSchema>
293
303
  {
294
- public getCell(columnOrId: TableSchema.IColumn | string): CellValueType | undefined {
304
+ public getCell(columnOrId: TableSchema.Column | string): CellValueType | undefined {
295
305
  const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
296
306
  return this.cells.get(columnId) as CellValueType | undefined;
297
307
  }
298
308
 
299
309
  public setCell(
300
- columnOrId: TableSchema.IColumn | string,
310
+ columnOrId: TableSchema.Column | string,
301
311
  value: CellInsertableType | undefined,
302
312
  ): void {
313
+ // TODO: throw if column does not exist in the owning table.
314
+
303
315
  const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
304
316
  this.cells.set(columnId, value);
305
317
  }
306
318
 
307
- public removeCell(columnOrId: TableSchema.IColumn | string): void {
319
+ public removeCell(columnOrId: TableSchema.Column | string): CellValueType | undefined {
320
+ // TODO: throw if column does not exist in the owning table.
321
+
308
322
  const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
309
- if (!this.cells.has(columnId)) {
310
- return;
323
+
324
+ const cell: CellValueType | undefined = this.cells.get(columnId);
325
+ if (cell === undefined) {
326
+ return undefined;
311
327
  }
328
+
312
329
  this.cells.delete(columnId);
330
+ return cell;
313
331
  }
314
332
  }
315
333
 
316
334
  type RowValueType = TreeNode &
317
- TableSchema.IRow<TCellSchema, TPropsSchema> &
335
+ TableSchema.Row<TCellSchema, TPropsSchema> &
318
336
  WithType<ScopedSchemaName<Scope, "Row">>;
319
337
 
320
338
  // Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof rowFields>`,
@@ -324,7 +342,7 @@ export namespace System_TableSchema {
324
342
  // the issue.
325
343
  // type RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFields>;
326
344
  type RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFieldsBuiltInParts> &
327
- (FieldHasDefault<TPropsSchema> extends true
345
+ (FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true
328
346
  ? // Note: The docs on the below properties are copied from `IRow.props`' docs to ensure that the
329
347
  // documentation appears in the data insertion scenario.
330
348
  // The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly
@@ -336,7 +354,9 @@ export namespace System_TableSchema {
336
354
  * @remarks This is a user-defined schema that can be used to store additional information
337
355
  * about the row.
338
356
  */
339
- props?: InsertableTreeFieldFromImplicitField<TPropsSchema>;
357
+ props?: InsertableTreeFieldFromImplicitField<
358
+ UnannotateImplicitFieldSchema<TPropsSchema>
359
+ >;
340
360
  }
341
361
  : {
342
362
  /**
@@ -344,10 +364,12 @@ export namespace System_TableSchema {
344
364
  * @remarks This is a user-defined schema that can be used to store additional information
345
365
  * about the row.
346
366
  */
347
- props: InsertableTreeFieldFromImplicitField<TPropsSchema>;
367
+ props: InsertableTreeFieldFromImplicitField<
368
+ UnannotateImplicitFieldSchema<TPropsSchema>
369
+ >;
348
370
  });
349
371
 
350
- // Modified version of `Column` that ensures the constructor (and `createFromInsertable`) are
372
+ // Modified version of `Row` that ensures the constructor (and `createFromInsertable`) are
351
373
  // typed correctly in terms of our insertable type.
352
374
  // This lets us be selective in our type-cast for the value returned from this function,
353
375
  // preserving as much type-safety as we reasonably can.
@@ -388,8 +410,8 @@ export namespace System_TableSchema {
388
410
  export type RowSchemaBase<
389
411
  TScope extends string | undefined = string | undefined,
390
412
  TCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,
391
- TPropsSchema extends ImplicitFieldSchema = ImplicitFieldSchema,
392
- > = ReturnType<typeof TableSchema.createRow<TScope, TCellSchema, TPropsSchema>>;
413
+ TPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,
414
+ > = ReturnType<typeof createRowSchema<TScope, TCellSchema, TPropsSchema>>;
393
415
 
394
416
  // #endregion
395
417
 
@@ -401,23 +423,20 @@ export namespace System_TableSchema {
401
423
  * @system @internal
402
424
  */
403
425
  export type TableFactoryOptionsBase<
404
- TScope extends string | undefined = string | undefined,
426
+ TSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,
405
427
  TCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,
406
- > = OptionsWithSchemaFactory<TScope> & OptionsWithCellSchema<TCell>;
428
+ > = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;
407
429
 
408
430
  /**
409
- * Factory for creating new table schema.
431
+ * Factory for creating table schema.
410
432
  * @system @internal
411
433
  */
412
434
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
413
- export function createTableInternal<
435
+ export function createTableSchema<
414
436
  const TInputScope extends string | undefined,
415
437
  const TCellSchema extends ImplicitAllowedTypes,
416
- const TColumnSchema extends ColumnSchemaBase<TInputScope> = ColumnSchemaBase<TInputScope>,
417
- const TRowSchema extends RowSchemaBase<TInputScope, TCellSchema> = RowSchemaBase<
418
- TInputScope,
419
- TCellSchema
420
- >,
438
+ const TColumnSchema extends ColumnSchemaBase<TInputScope>,
439
+ const TRowSchema extends RowSchemaBase<TInputScope, TCellSchema>,
421
440
  >(
422
441
  inputSchemaFactory: SchemaFactoryAlpha<TInputScope>,
423
442
  _cellSchema: TCellSchema,
@@ -428,13 +447,8 @@ export namespace System_TableSchema {
428
447
  type Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;
429
448
 
430
449
  type CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;
431
- type CellInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TCellSchema>;
432
-
433
450
  type ColumnValueType = TreeNodeFromImplicitAllowedTypes<TColumnSchema>;
434
- type ColumnInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>;
435
-
436
451
  type RowValueType = TreeNodeFromImplicitAllowedTypes<TRowSchema>;
437
- type RowInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>;
438
452
 
439
453
  /**
440
454
  * {@link Table} fields.
@@ -444,7 +458,7 @@ export namespace System_TableSchema {
444
458
  const tableFields = {
445
459
  rows: schemaFactory.array("Table.rows", rowSchema),
446
460
  columns: schemaFactory.array("Table.columns", columnSchema),
447
- } as const satisfies Record<string, ImplicitFieldSchema>;
461
+ } as const satisfies Record<string, ImplicitAnnotatedFieldSchema>;
448
462
 
449
463
  /**
450
464
  * The Table schema
@@ -454,7 +468,7 @@ export namespace System_TableSchema {
454
468
  // Will make it easier to evolve this schema in the future.
455
469
  allowUnknownOptionalFields: true,
456
470
  })
457
- implements TableSchema.ITable<TCellSchema, TColumnSchema, TRowSchema>
471
+ implements TableSchema.Table<TCellSchema, TColumnSchema, TRowSchema>
458
472
  {
459
473
  public getColumn(id: string): ColumnValueType | undefined {
460
474
  // TypeScript is unable to narrow the types correctly here, hence the casts.
@@ -472,51 +486,130 @@ export namespace System_TableSchema {
472
486
  | undefined;
473
487
  }
474
488
 
475
- public getCell(key: TableSchema.CellKey): CellValueType | undefined {
476
- const { columnId, rowId } = key;
477
- const row = this.getRow(rowId);
478
- if (row !== undefined) {
479
- const column = this.getColumn(columnId);
480
- if (column !== undefined) {
481
- return row.getCell(column.id);
482
- }
489
+ public getCell(
490
+ key: TableSchema.CellKey<TColumnSchema, TRowSchema>,
491
+ ): CellValueType | undefined {
492
+ const { column: columnOrId, row: rowOrId } = key;
493
+ const row = this._getRow(rowOrId);
494
+ if (row === undefined) {
495
+ return undefined;
496
+ }
497
+
498
+ const column = this._getColumn(columnOrId);
499
+ if (column === undefined) {
500
+ return undefined;
483
501
  }
484
- // If the cell does not exist return undefined
485
- return undefined;
502
+
503
+ return row.getCell(column);
486
504
  }
487
505
 
488
506
  public insertColumn({
489
507
  column,
490
508
  index,
491
- }: TableSchema.InsertColumnParameters<ColumnInsertableType>): ColumnValueType {
492
- if (index === undefined) {
493
- // TypeScript is unable to narrow the types correctly here, hence the cast.
509
+ }: TableSchema.InsertColumnParameters<TColumnSchema>): ColumnValueType {
510
+ const inserted = this.insertColumns({
511
+ columns: [column],
512
+ index,
513
+ });
514
+ return inserted[0] ?? oob();
515
+ }
516
+
517
+ public insertColumns({
518
+ columns,
519
+ index,
520
+ }: TableSchema.InsertColumnsParameters<TColumnSchema>): ColumnValueType[] {
521
+ // #region Input validation
522
+
523
+ // Ensure index is valid
524
+ if (index !== undefined) {
525
+ Table.validateInsertionIndex(index, this.columns);
526
+ }
527
+
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.
494
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
+ // TypeScript is unable to narrow the column type correctly here, hence the casts below.
543
+ // See: https://github.com/microsoft/TypeScript/issues/52144
544
+ if (index === undefined) {
495
545
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
496
- this.columns.insertAtEnd(column as any);
546
+ this.columns.insertAtEnd(TreeArrayNode.spread(columns) as any);
497
547
  } else {
498
- // TypeScript is unable to narrow the types correctly here, hence the cast.
499
- // See: https://github.com/microsoft/TypeScript/issues/52144
500
548
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
501
- this.columns.insertAt(index, column as any);
549
+ this.columns.insertAt(index, TreeArrayNode.spread(columns) as any);
502
550
  }
503
551
 
504
- // Inserting the input node into the tree hydrates it, making it usable as a node.
505
- return column as ColumnValueType;
552
+ // Inserting the input nodes into the tree hydrates them, making them usable as nodes.
553
+ return columns as unknown as ColumnValueType[];
554
+ }
555
+
556
+ public insertRow({
557
+ row,
558
+ index,
559
+ }: TableSchema.InsertRowParameters<TRowSchema>): RowValueType {
560
+ const inserted = this.insertRows({
561
+ rows: [row],
562
+ index,
563
+ });
564
+ return inserted[0] ?? oob();
506
565
  }
507
566
 
508
567
  public insertRows({
509
568
  index,
510
569
  rows,
511
- }: TableSchema.InsertRowsParameters<RowInsertableType>): RowValueType[] {
570
+ }: TableSchema.InsertRowsParameters<TRowSchema>): RowValueType[] {
571
+ // #region Input validation
572
+
573
+ // Ensure index is valid
574
+ if (index !== undefined) {
575
+ Table.validateInsertionIndex(index, this.rows);
576
+ }
577
+
578
+ // Note: TypeScript is unable to narrow the type of the row type correctly here, hence the casts below.
579
+ // See: https://github.com/microsoft/TypeScript/issues/52144
580
+ 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
+ // If the row contains cells, verify that the table contains the columns for those cells.
590
+ // 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
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
592
+ if ((newRow as any).cells !== undefined) {
593
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
594
+ const keys: string[] = Object.keys((newRow as any).cells);
595
+ for (const key of keys) {
596
+ if (!this.containsColumnWithId(key)) {
597
+ throw new UsageError(
598
+ `Attempted to insert row a cell under column ID "${key}", but the table does not contain a column with that ID.`,
599
+ );
600
+ }
601
+ }
602
+ }
603
+ }
604
+
605
+ // #endregion
606
+
607
+ // TypeScript is unable to narrow the row type correctly here, hence the casts below.
608
+ // See: https://github.com/microsoft/TypeScript/issues/52144
512
609
  if (index === undefined) {
513
- // TypeScript is unable to narrow the types correctly here, hence the cast.
514
- // See: https://github.com/microsoft/TypeScript/issues/52144
515
610
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
516
611
  this.rows.insertAtEnd(TreeArrayNode.spread(rows) as any);
517
612
  } else {
518
- // TypeScript is unable to narrow the types correctly here, hence the cast.
519
- // See: https://github.com/microsoft/TypeScript/issues/52144
520
613
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
521
614
  this.rows.insertAt(index, TreeArrayNode.spread(rows) as any);
522
615
  }
@@ -525,65 +618,204 @@ export namespace System_TableSchema {
525
618
  return rows as unknown as RowValueType[];
526
619
  }
527
620
 
528
- public setCell({ key, cell }: TableSchema.SetCellParameters<CellInsertableType>): void {
529
- const { columnId, rowId } = key;
530
- const row = this.getRow(rowId);
531
- if (row !== undefined) {
532
- const column = this.getColumn(columnId);
533
- if (column !== undefined) {
534
- row.setCell(column.id, cell);
535
- }
621
+ public setCell({
622
+ key,
623
+ cell,
624
+ }: TableSchema.SetCellParameters<TCellSchema, TColumnSchema, TRowSchema>): void {
625
+ const { column: columnOrId, row: rowOrId } = key;
626
+
627
+ const row = this._getRow(rowOrId);
628
+ if (row === undefined) {
629
+ const rowId = this._getRowId(rowOrId);
630
+ throw new UsageError(`No row with ID "${rowId}" exists in the table.`);
536
631
  }
632
+
633
+ const column = this._getColumn(columnOrId);
634
+ if (column === undefined) {
635
+ const columnId = this._getColumnId(columnOrId);
636
+ throw new UsageError(`No column with ID "${columnId}" exists in the table.`);
637
+ }
638
+
639
+ row.setCell(column, cell);
537
640
  }
538
641
 
539
- public removeColumn(column: ColumnValueType): void {
540
- const index = this.columns.indexOf(column);
541
- // If the column is not in the table, do nothing
542
- if (index === -1) return;
642
+ public removeColumns(
643
+ columns: readonly string[] | readonly ColumnValueType[],
644
+ ): ColumnValueType[] {
645
+ // If there are no columns to remove, do nothing
646
+ if (columns.length === 0) {
647
+ return [];
648
+ }
649
+
650
+ // If there is only one column to remove, remove it (and don't incur cost of transaction)
651
+ if (columns.length === 1) {
652
+ const removedColumn = this.removeColumn(columns[0] ?? oob());
653
+ return [removedColumn];
654
+ }
655
+
656
+ // If there are multiple columns to remove, remove them in a transaction.
657
+ const removedColumns: ColumnValueType[] = [];
658
+ Tree.runTransaction(this, () => {
659
+ // Note, throwing an error within a transaction will abort the entire transaction.
660
+ // So if we throw an error here for any row, no columns will be removed.
661
+ for (const columnToRemove of columns) {
662
+ const removedRow = this.removeColumn(columnToRemove);
663
+ removedColumns.push(removedRow);
664
+ }
665
+ });
666
+ return removedColumns;
667
+ }
668
+
669
+ public removeColumn(columnOrId: string | ColumnValueType): ColumnValueType {
670
+ const column = this._getColumn(columnOrId);
671
+ const index = column === undefined ? -1 : this.columns.indexOf(column);
672
+ if (index === -1) {
673
+ const columnId = this._getColumnId(columnOrId);
674
+ throw new UsageError(
675
+ `Specified column with ID "${columnId}" does not exist in the table.`,
676
+ );
677
+ }
543
678
  this.columns.removeAt(index);
679
+ return column as ColumnValueType;
680
+ }
681
+
682
+ public removeAllColumns(): ColumnValueType[] {
683
+ // TypeScript is unable to narrow the row type correctly here, hence the cast.
684
+ // See: https://github.com/microsoft/TypeScript/issues/52144
685
+ return this.removeColumns(this.columns as unknown as ColumnValueType[]);
544
686
  }
545
687
 
546
- public removeRows(rows: readonly RowValueType[]): void {
688
+ public removeRows(rows: readonly string[] | readonly RowValueType[]): RowValueType[] {
547
689
  // If there are no rows to remove, do nothing
548
690
  if (rows.length === 0) {
549
- return;
691
+ return [];
550
692
  }
551
693
 
552
- // If there is only one row to remove, remove it
694
+ // If there is only one row to remove, remove it (and don't incur cost of transaction)
553
695
  if (rows.length === 1) {
554
- const index = this.rows.indexOf(rows[0] ?? oob());
555
- this.rows.removeAt(index);
556
- return;
696
+ const removedRow = this.removeRow(rows[0] ?? oob());
697
+ return [removedRow];
557
698
  }
558
- // If there are multiple rows to remove, remove them in a transaction
559
- // This is to avoid the performance issues of deleting multiple rows at once
699
+
700
+ // If there are multiple rows to remove, remove them in a transaction.
701
+ const removedRows: RowValueType[] = [];
560
702
  Tree.runTransaction(this, () => {
561
- // Iterate over the rows and remove them
562
- for (const row of rows) {
563
- const index = this.rows.indexOf(row);
564
- this.rows.removeAt(index);
703
+ // Note, throwing an error within a transaction will abort the entire transaction.
704
+ // So if we throw an error here for any row, no rows will be removed.
705
+ for (const rowToRemove of rows) {
706
+ const removedRow = this.removeRow(rowToRemove);
707
+ removedRows.push(removedRow);
565
708
  }
566
709
  });
710
+ return removedRows;
711
+ }
712
+
713
+ public removeRow(rowOrId: string | RowValueType): RowValueType {
714
+ const rowToRemove = this._getRow(rowOrId);
715
+ const index = rowToRemove === undefined ? -1 : this.rows.indexOf(rowToRemove);
716
+
717
+ // If the row does not exist in the table, throw an error.
718
+ if (index === -1) {
719
+ const rowId = this._getRowId(rowOrId);
720
+ throw new UsageError(
721
+ `Specified row with ID "${rowId}" does not exist in the table.`,
722
+ );
723
+ }
724
+
725
+ this.rows.removeAt(index);
726
+ return rowToRemove as RowValueType;
567
727
  }
568
728
 
569
- public removeAllRows(): void {
570
- this.rows.removeRange();
729
+ public removeAllRows(): RowValueType[] {
730
+ // TypeScript is unable to narrow the row type correctly here, hence the cast.
731
+ // See: https://github.com/microsoft/TypeScript/issues/52144
732
+ return this.removeRows(this.rows as unknown as RowValueType[]);
571
733
  }
572
734
 
573
- public removeCell(key: TableSchema.CellKey): void {
574
- const { columnId, rowId } = key;
575
- const row = this.getRow(rowId);
576
- if (row !== undefined) {
577
- const column = this.getColumn(columnId);
578
- if (column !== undefined) {
579
- row.removeCell(column.id);
580
- }
735
+ public removeCell(
736
+ key: TableSchema.CellKey<TColumnSchema, TRowSchema>,
737
+ ): CellValueType | undefined {
738
+ const { column: columnOrId, row: rowOrId } = key;
739
+ const row = this._getRow(rowOrId);
740
+ if (row === undefined) {
741
+ const rowId = this._getRowId(rowOrId);
742
+ throw new UsageError(
743
+ `Specified row with ID "${rowId}" does not exist in the table.`,
744
+ );
745
+ }
746
+
747
+ const column = this._getColumn(columnOrId);
748
+ if (column === undefined) {
749
+ const columnId = this._getColumnId(columnOrId);
750
+ throw new UsageError(
751
+ `Specified column with ID "${columnId}" does not exist in the table.`,
752
+ );
753
+ }
754
+
755
+ const cell: CellValueType | undefined = row.getCell(column.id);
756
+ if (cell === undefined) {
757
+ return undefined;
758
+ }
759
+
760
+ row.removeCell(column.id);
761
+ return cell;
762
+ }
763
+
764
+ private _getColumn(columnOrId: string | ColumnValueType): ColumnValueType | undefined {
765
+ return typeof columnOrId === "string" ? this.getColumn(columnOrId) : columnOrId;
766
+ }
767
+
768
+ private _getColumnId(columnOrId: string | ColumnValueType): string {
769
+ return typeof columnOrId === "string" ? columnOrId : columnOrId.id;
770
+ }
771
+
772
+ private _getRow(rowOrId: string | RowValueType): RowValueType | undefined {
773
+ return typeof rowOrId === "string" ? this.getRow(rowOrId) : rowOrId;
774
+ }
775
+
776
+ private _getRowId(rowOrId: string | RowValueType): string {
777
+ return typeof rowOrId === "string" ? rowOrId : rowOrId.id;
778
+ }
779
+
780
+ private containsColumnWithId(columnId: string): boolean {
781
+ // TypeScript is unable to narrow the types correctly here, hence the cast.
782
+ // See: https://github.com/microsoft/TypeScript/issues/52144
783
+ return (
784
+ this.columns.find((column) => (column as TableSchema.Column).id === columnId) !==
785
+ undefined
786
+ );
787
+ }
788
+
789
+ private containsRowWithId(rowId: string): boolean {
790
+ // TypeScript is unable to narrow the types correctly here, hence the cast.
791
+ // See: https://github.com/microsoft/TypeScript/issues/52144
792
+ return this.rows.find((row) => (row as TableSchema.Row).id === rowId) !== undefined;
793
+ }
794
+
795
+ /**
796
+ * Ensure that the specified index is a valid location for item insertion in the destination list.
797
+ * @throws Throws a usage error if the destination is invalid.
798
+ */
799
+ private static validateInsertionIndex(
800
+ index: number,
801
+ destinationList: readonly unknown[],
802
+ ): void {
803
+ if (index < 0) {
804
+ throw new UsageError("The index must be greater than or equal to 0.");
805
+ }
806
+
807
+ if (index > destinationList.length) {
808
+ throw new UsageError("The index specified for insertion is out of bounds.");
809
+ }
810
+
811
+ if (!Number.isInteger(index)) {
812
+ throw new UsageError("The index must be an integer.");
581
813
  }
582
814
  }
583
815
  }
584
816
 
585
817
  type TableValueType = TreeNode &
586
- TableSchema.ITable<TCellSchema, TColumnSchema, TRowSchema> &
818
+ TableSchema.Table<TCellSchema, TColumnSchema, TRowSchema> &
587
819
  WithType<ScopedSchemaName<Scope, "Table">>;
588
820
  type TableInsertableType = InsertableObjectFromSchemaRecord<typeof tableFields>;
589
821
 
@@ -612,20 +844,100 @@ export namespace System_TableSchema {
612
844
  export type TableSchemaBase<
613
845
  TScope extends string | undefined,
614
846
  TCell extends ImplicitAllowedTypes,
615
- TColumn extends ColumnSchemaBase<TScope> = ColumnSchemaBase<TScope>,
616
- TRow extends RowSchemaBase<TScope, TCell, ImplicitAllowedTypes> = RowSchemaBase<
617
- TScope,
618
- TCell,
619
- ImplicitAllowedTypes
620
- >,
621
- > = ReturnType<typeof TableSchema.createTable<TScope, TCell, TColumn, TRow>>;
847
+ TColumn extends ColumnSchemaBase<TScope>,
848
+ TRow extends RowSchemaBase<TScope, TCell>,
849
+ > = ReturnType<typeof createTableSchema<TScope, TCell, TColumn, TRow>>;
622
850
 
623
851
  // #endregion
624
852
  }
625
853
 
626
854
  /**
627
855
  * Contains types and factories for creating schema to represent dynamic tabular data.
628
- * @privateRemarks TODO: document in more detail and add `@example`s.
856
+ *
857
+ * @remarks
858
+ *
859
+ * Tables created using these APIs are...
860
+ *
861
+ * - sparse, meaning that cells may be omitted, and new rows are empty by default.
862
+ *
863
+ * - dynamic, meaning that their structure can be modified at runtime.
864
+ * Columns and rows can be inserted, removed, modified, and reordered.
865
+ * Cells can be inserted, removed, and modified.
866
+ *
867
+ * - row-major, meaning that operating on rows (including inserts, removal, moves, and traversal) is more efficient than operating on columns.
868
+ *
869
+ * Column and Row schema created using these APIs are extensible via the `props` field.
870
+ * This allows association of additional properties with column and row nodes.
871
+ *
872
+ * Note: for now it is possible for table cells to become "orphaned".
873
+ * 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.
875
+ * Either way, it is possible to enter such a state via the merging of edits.
876
+ * For example: one client might add a row while another concurrently removes a column, orphaning the cell where the column and row intersected.
877
+ *
878
+ * @example Using default Column and Row schema
879
+ *
880
+ * ```typescript
881
+ * class Cell extends schemaFactory.object("TableCell", {
882
+ * value: schemaFactory.string,
883
+ * }) {}
884
+ *
885
+ * class Table extends TableSchema.table({
886
+ * schemaFactory,
887
+ * cell: Cell,
888
+ * }) {}
889
+ *
890
+ * const table = new Table({
891
+ * columns: [{ id: "column-0" }],
892
+ * rows: [{ id: "row-0", cells: {} }],
893
+ * });
894
+ * ```
895
+ *
896
+ * @example Customizing Column and Row schema
897
+ *
898
+ * ```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
+ * }) {}
909
+ *
910
+ * class Column extends TableSchema.column({
911
+ * schemaFactory,
912
+ * props: ColumnProps,
913
+ * }) {}
914
+ *
915
+ * class Row extends TableSchema.row({
916
+ * schemaFactory,
917
+ * cell: Cell,
918
+ * }) {}
919
+ *
920
+ * class Table extends TableSchema.table({
921
+ * schemaFactory,
922
+ * cell: Cell,
923
+ * column: Column,
924
+ * row: Row,
925
+ * }) {}
926
+ *
927
+ * const table = new Table({
928
+ * 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" } }),
932
+ * ],
933
+ * rows: [],
934
+ * });
935
+ * ```
936
+ *
937
+ * @privateRemarks
938
+ * The above examples are backed by tests in `tableSchema.spec.ts`.
939
+ * Those tests and these examples should be kept in-sync to ensure that the examples are correct.
940
+ *
629
941
  * @internal
630
942
  */
631
943
  export namespace TableSchema {
@@ -633,10 +945,10 @@ export namespace TableSchema {
633
945
 
634
946
  /**
635
947
  * A column in a table.
636
- * @remarks Implemented by the schema class returned from {@link TableSchema.(createColumn:2)}.
948
+ * @remarks Implemented by the schema class returned from {@link TableSchema.(column:2)}.
637
949
  * @sealed @internal
638
950
  */
639
- export interface IColumn<
951
+ export interface Column<
640
952
  TProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,
641
953
  > {
642
954
  /**
@@ -649,10 +961,10 @@ export namespace TableSchema {
649
961
  * The column's properties.
650
962
  * @remarks This is a user-defined schema that can be used to store additional information about the column.
651
963
  * @privateRemarks
652
- * Note: these docs are duplicated on the inline type definitions in {@link createColumn}.
964
+ * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createColumnSchema}.
653
965
  * If you update the docs here, please also update the inline type definitions.
654
966
  */
655
- get props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>> | undefined;
967
+ get props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>;
656
968
  set props(value: InsertableTreeFieldFromImplicitField<
657
969
  UnannotateImplicitFieldSchema<TProps>
658
970
  >);
@@ -662,40 +974,34 @@ export namespace TableSchema {
662
974
  * Factory for creating new table column schema.
663
975
  * @internal
664
976
  */
665
- export function createColumn<const TScope extends string | undefined>({
666
- schemaFactory,
667
- }: System_TableSchema.CreateColumnOptionsBase<TScope>): ReturnType<
668
- typeof System_TableSchema.createColumnInternal<
669
- TScope,
670
- FieldSchema<FieldKind.Optional, typeof SchemaFactoryAlpha.null>
671
- >
672
- >;
977
+ export function column<const TScope extends string | undefined>(
978
+ params: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>>,
979
+ ): System_TableSchema.ColumnSchemaBase<TScope, System_TableSchema.DefaultPropsType>;
673
980
  /**
674
981
  * Factory for creating new table column schema.
675
982
  * @internal
676
983
  */
677
- export function createColumn<
984
+ export function column<
678
985
  const TScope extends string | undefined,
679
- const TProps extends ImplicitFieldSchema,
680
- >({
681
- schemaFactory,
682
- props,
683
- }: System_TableSchema.CreateColumnOptionsBase<TScope> & {
684
- /**
685
- * Optional column properties.
686
- */
687
- readonly props: TProps;
688
- }): ReturnType<typeof System_TableSchema.createColumnInternal<TScope, TProps>>;
986
+ const TProps extends ImplicitAnnotatedFieldSchema,
987
+ >(
988
+ params: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>> & {
989
+ /**
990
+ * Optional column properties.
991
+ */
992
+ readonly props: TProps;
993
+ },
994
+ ): System_TableSchema.ColumnSchemaBase<TScope, TProps>;
689
995
  /**
690
996
  * Overload implementation
691
997
  */
692
- export function createColumn({
998
+ export function column({
693
999
  schemaFactory,
694
1000
  props = SchemaFactory.optional(SchemaFactory.null),
695
1001
  }: System_TableSchema.CreateColumnOptionsBase & {
696
- readonly props?: ImplicitFieldSchema;
1002
+ readonly props?: ImplicitAnnotatedFieldSchema;
697
1003
  }): TreeNodeSchema {
698
- return System_TableSchema.createColumnInternal(schemaFactory, props);
1004
+ return System_TableSchema.createColumnSchema(schemaFactory, props);
699
1005
  }
700
1006
 
701
1007
  // #endregion
@@ -707,8 +1013,8 @@ export namespace TableSchema {
707
1013
  * @remarks Implemented by the schema class returned from {@link TableSchema.(createRow:2)}.
708
1014
  * @sealed @internal
709
1015
  */
710
- export interface IRow<
711
- TCell extends ImplicitAllowedTypes,
1016
+ export interface Row<
1017
+ TCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,
712
1018
  TProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,
713
1019
  > {
714
1020
  /**
@@ -720,8 +1026,9 @@ export namespace TableSchema {
720
1026
  /**
721
1027
  * Gets the cell in the specified column.
722
1028
  * @returns The cell if it exists, otherwise undefined.
1029
+ * @privateRemarks TODO: throw if the column does not belong to the same table as the row.
723
1030
  */
724
- getCell(column: IColumn): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1031
+ getCell(column: Column): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
725
1032
  /**
726
1033
  * Gets the cell in the specified column, denoted by column ID.
727
1034
  * @returns The cell if it exists, otherwise undefined.
@@ -730,31 +1037,33 @@ export namespace TableSchema {
730
1037
 
731
1038
  /**
732
1039
  * Sets the cell in the specified column.
733
- * @remarks To remove a cell, call {@link TableSchema.IRow.(removeCell:1)} instead.
1040
+ * @remarks To remove a cell, call {@link TableSchema.Row.(removeCell:1)} instead.
1041
+ * @privateRemarks TODO: Throw an error if the column does not exist in the table.
734
1042
  */
735
- setCell(column: IColumn, value: InsertableTreeNodeFromImplicitAllowedTypes<TCell>): void;
1043
+ setCell(column: Column, value: InsertableTreeNodeFromImplicitAllowedTypes<TCell>): void;
736
1044
  /**
737
1045
  * Sets the cell in the specified column, denoted by column ID.
738
- * @remarks To remove a cell, call {@link TableSchema.IRow.(removeCell:2)} instead.
1046
+ * @remarks To remove a cell, call {@link TableSchema.Row.(removeCell:2)} instead.
739
1047
  */
740
1048
  setCell(columnId: string, value: InsertableTreeNodeFromImplicitAllowedTypes<TCell>): void;
741
1049
 
742
1050
  /**
743
1051
  * Removes the cell in the specified column.
744
- * @privateRemarks TODO: return removed cell
1052
+ * @returns The cell if it exists, otherwise undefined.
1053
+ * @privateRemarks TODO: Throw if the column does not belong to the same table as the row.
745
1054
  */
746
- removeCell(column: IColumn): void;
1055
+ removeCell(column: Column): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
747
1056
  /**
748
1057
  * Removes the cell in the specified column, denoted by column ID.
749
- * @privateRemarks TODO: return removed cell
1058
+ * @returns The cell if it exists, otherwise undefined.
750
1059
  */
751
- removeCell(columnId: string): void;
1060
+ removeCell(columnId: string): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
752
1061
 
753
1062
  /**
754
1063
  * The row's properties.
755
1064
  * @remarks This is a user-defined schema that can be used to store additional information about the row.
756
1065
  * @privateRemarks
757
- * Note: these docs are duplicated on the inline type definitions in {@link createColumn}.
1066
+ * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createRowSchema}.
758
1067
  * If you update the docs here, please also update the inline type definitions.
759
1068
  */
760
1069
  get props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>;
@@ -767,48 +1076,39 @@ export namespace TableSchema {
767
1076
  * Factory for creating new table column schema.
768
1077
  * @internal
769
1078
  */
770
- export function createRow<
1079
+ export function row<
771
1080
  const TScope extends string | undefined,
772
1081
  const TCell extends ImplicitAllowedTypes,
773
- >({
774
- schemaFactory,
775
- cell,
776
- }: System_TableSchema.CreateRowOptionsBase<TScope, TCell>): ReturnType<
777
- typeof System_TableSchema.createRowInternal<
778
- TScope,
779
- TCell,
780
- FieldSchema<FieldKind.Optional, typeof SchemaFactoryAlpha.null>
781
- >
782
- >;
1082
+ >(
1083
+ params: System_TableSchema.CreateRowOptionsBase<SchemaFactoryAlpha<TScope>, TCell>,
1084
+ ): System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>;
783
1085
  /**
784
- * Factory for creating new table column schema.
1086
+ * Factory for creating new table row schema.
785
1087
  * @internal
786
1088
  */
787
- export function createRow<
1089
+ export function row<
788
1090
  const TScope extends string | undefined,
789
1091
  const TCell extends ImplicitAllowedTypes,
790
- const TProps extends ImplicitFieldSchema,
791
- >({
792
- schemaFactory,
793
- cell,
794
- props,
795
- }: System_TableSchema.CreateRowOptionsBase<TScope, TCell> & {
796
- /**
797
- * Optional row properties.
798
- */
799
- readonly props: TProps;
800
- }): ReturnType<typeof System_TableSchema.createRowInternal<TScope, TCell, TProps>>;
1092
+ const TProps extends ImplicitAnnotatedFieldSchema,
1093
+ >(
1094
+ params: System_TableSchema.CreateRowOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {
1095
+ /**
1096
+ * Optional row properties.
1097
+ */
1098
+ readonly props: TProps;
1099
+ },
1100
+ ): System_TableSchema.RowSchemaBase<TScope, TCell, TProps>;
801
1101
  /**
802
1102
  * Overload implementation
803
1103
  */
804
- export function createRow({
1104
+ export function row({
805
1105
  schemaFactory,
806
1106
  cell,
807
1107
  props = SchemaFactory.optional(SchemaFactory.null),
808
1108
  }: System_TableSchema.CreateRowOptionsBase & {
809
- readonly props?: ImplicitFieldSchema;
1109
+ readonly props?: ImplicitAnnotatedFieldSchema;
810
1110
  }): TreeNodeSchema {
811
- return System_TableSchema.createRowInternal(schemaFactory, cell, props);
1111
+ return System_TableSchema.createRowSchema(schemaFactory, cell, props);
812
1112
  }
813
1113
 
814
1114
  // #endregion
@@ -816,26 +1116,29 @@ export namespace TableSchema {
816
1116
  // #region Table
817
1117
 
818
1118
  /**
819
- * A key to uniquely identify a cell in a table.
1119
+ * A key to uniquely identify a cell within a table.
820
1120
  * @internal
821
1121
  */
822
- export interface CellKey {
1122
+ export interface CellKey<
1123
+ TColumn extends ImplicitAllowedTypes,
1124
+ TRow extends ImplicitAllowedTypes,
1125
+ > {
823
1126
  /**
824
- * {@link TableSchema.IColumn.id} of the containing {@link TableSchema.IColumn}.
1127
+ * {@link TableSchema.Column} or {@link TableSchema.Column.id} at which the cell is located.
825
1128
  */
826
- readonly columnId: string;
1129
+ readonly column: string | TreeNodeFromImplicitAllowedTypes<TColumn>;
827
1130
 
828
1131
  /**
829
- * {@link TableSchema.IRow.id} of the containing {@link TableSchema.IRow}.
1132
+ * {@link TableSchema.Row} or {@link TableSchema.Row.id} at which the cell is located.
830
1133
  */
831
- readonly rowId: string;
1134
+ readonly row: string | TreeNodeFromImplicitAllowedTypes<TRow>;
832
1135
  }
833
1136
 
834
1137
  /**
835
- * {@link TableSchema.ITable.insertColumn} parameters.
1138
+ * {@link TableSchema.Table.insertColumn} parameters.
836
1139
  * @internal
837
1140
  */
838
- export interface InsertColumnParameters<TInsertableColumn> {
1141
+ export interface InsertColumnParameters<TColumn extends ImplicitAllowedTypes> {
839
1142
  /**
840
1143
  * The index at which to insert the new column.
841
1144
  * @remarks If not provided, the column will be appended to the end of the table.
@@ -845,14 +1148,48 @@ export namespace TableSchema {
845
1148
  /**
846
1149
  * The column to insert.
847
1150
  */
848
- readonly column: TInsertableColumn;
1151
+ readonly column: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>;
849
1152
  }
850
1153
 
851
1154
  /**
852
- * {@link TableSchema.ITable.insertRows} parameters.
1155
+ * {@link TableSchema.Table.insertColumns} parameters.
853
1156
  * @internal
854
1157
  */
855
- export interface InsertRowsParameters<TInsertableRow> {
1158
+ export interface InsertColumnsParameters<TColumn extends ImplicitAllowedTypes> {
1159
+ /**
1160
+ * The index at which to insert the new columns.
1161
+ * @remarks If not provided, the columns will be appended to the end of the table.
1162
+ */
1163
+ readonly index?: number | undefined;
1164
+
1165
+ /**
1166
+ * The columns to insert.
1167
+ */
1168
+ readonly columns: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>[];
1169
+ }
1170
+
1171
+ /**
1172
+ * {@link TableSchema.Table.insertRow} parameters.
1173
+ * @internal
1174
+ */
1175
+ export interface InsertRowParameters<TRow extends ImplicitAllowedTypes> {
1176
+ /**
1177
+ * The index at which to insert the new row.
1178
+ * @remarks If not provided, the row will be appended to the end of the table.
1179
+ */
1180
+ readonly index?: number | undefined;
1181
+
1182
+ /**
1183
+ * The row to insert.
1184
+ */
1185
+ readonly row: InsertableTreeNodeFromImplicitAllowedTypes<TRow>;
1186
+ }
1187
+
1188
+ /**
1189
+ * {@link TableSchema.Table.insertRows} parameters.
1190
+ * @internal
1191
+ */
1192
+ export interface InsertRowsParameters<TRow extends ImplicitAllowedTypes> {
856
1193
  /**
857
1194
  * The index at which to insert the new rows.
858
1195
  * @remarks If not provided, the rows will be appended to the end of the table.
@@ -862,30 +1199,34 @@ export namespace TableSchema {
862
1199
  /**
863
1200
  * The rows to insert.
864
1201
  */
865
- readonly rows: TInsertableRow[];
1202
+ readonly rows: InsertableTreeNodeFromImplicitAllowedTypes<TRow>[];
866
1203
  }
867
1204
 
868
1205
  /**
869
- * {@link TableSchema.ITable.setCell} parameters.
1206
+ * {@link TableSchema.Table.setCell} parameters.
870
1207
  * @internal
871
1208
  */
872
- export interface SetCellParameters<TInsertableCell> {
1209
+ export interface SetCellParameters<
1210
+ TCell extends ImplicitAllowedTypes,
1211
+ TColumn extends ImplicitAllowedTypes,
1212
+ TRow extends ImplicitAllowedTypes,
1213
+ > {
873
1214
  /**
874
1215
  * The key to uniquely identify a cell in a table.
875
1216
  */
876
- readonly key: CellKey;
1217
+ readonly key: CellKey<TColumn, TRow>;
877
1218
 
878
1219
  /**
879
1220
  * The cell to set.
880
1221
  */
881
- readonly cell: TInsertableCell;
1222
+ readonly cell: InsertableTreeNodeFromImplicitAllowedTypes<TCell>;
882
1223
  }
883
1224
 
884
1225
  /**
885
1226
  * A table.
886
1227
  * @sealed @internal
887
1228
  */
888
- export interface ITable<
1229
+ export interface Table<
889
1230
  TCell extends ImplicitAllowedTypes,
890
1231
  TColumn extends ImplicitAllowedTypes,
891
1232
  TRow extends ImplicitAllowedTypes,
@@ -901,139 +1242,252 @@ export namespace TableSchema {
901
1242
  readonly rows: TreeArrayNode<TRow>;
902
1243
 
903
1244
  /**
904
- * Gets a table column by its {@link TableSchema.IRow.id}.
1245
+ * Gets a table column by its {@link TableSchema.Column.id}.
905
1246
  */
906
1247
  getColumn(id: string): TreeNodeFromImplicitAllowedTypes<TColumn> | undefined;
907
1248
 
908
1249
  /**
909
- * Gets a table row by its {@link TableSchema.IRow.id}.
1250
+ * Gets a table row by its {@link TableSchema.Row.id}.
910
1251
  */
911
1252
  getRow(id: string): TreeNodeFromImplicitAllowedTypes<TRow> | undefined;
912
1253
 
913
1254
  /**
914
1255
  * Gets a cell in the table by column and row IDs.
915
1256
  * @param key - A key that uniquely distinguishes a cell in the table, represented as a combination of the column ID and row ID.
916
- * @privateRemarks TODO: add overload that takes row and column nodes.
917
1257
  */
918
- getCell(key: CellKey): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1258
+ getCell(key: CellKey<TColumn, TRow>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
919
1259
 
920
1260
  /**
921
1261
  * Inserts a column into the table.
922
- * @throws Throws an error if the column is already in the tree, or if the specified index is out of range.
1262
+ *
1263
+ * @throws
1264
+ * Throws an error in the following cases:
1265
+ *
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.
923
1271
  */
924
1272
  insertColumn(
925
- params: InsertColumnParameters<InsertableTreeNodeFromImplicitAllowedTypes<TColumn>>,
1273
+ params: InsertColumnParameters<TColumn>,
926
1274
  ): TreeNodeFromImplicitAllowedTypes<TColumn>;
927
1275
 
1276
+ /**
1277
+ * Inserts 0 or more columns into the table.
1278
+ *
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.
1283
+ *
1284
+ * - The specified index is out of range.
1285
+ *
1286
+ * No columns are inserted in these cases.
1287
+ */
1288
+ insertColumns(
1289
+ params: InsertColumnsParameters<TColumn>,
1290
+ ): TreeNodeFromImplicitAllowedTypes<TColumn>[];
1291
+
1292
+ /**
1293
+ * Inserts a row into the table.
1294
+ *
1295
+ * @throws
1296
+ * Throws an error in the following cases:
1297
+ *
1298
+ * - The row, or a row with the same ID is already in the tree.
1299
+ *
1300
+ * - The row contains cells, but the table does not contain matching columns for one or more of those cells.
1301
+ *
1302
+ * - The specified index is out of range.
1303
+ *
1304
+ * No row is inserted in these cases.
1305
+ */
1306
+ insertRow(params: InsertRowParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>;
1307
+
928
1308
  /**
929
1309
  * Inserts 0 or more rows into the table.
930
- * @throws Throws an error if any of the rows are already in the tree, or if the specified index is out of range.
1310
+ *
1311
+ * @throws
1312
+ * Throws an error in the following cases:
1313
+ *
1314
+ * - At least one row, or a row with the same ID is already in the tree.
1315
+ *
1316
+ * - The row contains cells, but the table does not contain matching columns for one or more of those cells.
1317
+ *
1318
+ * - The specified index is out of range.
1319
+ *
1320
+ * No rows are inserted in these cases.
931
1321
  */
932
- insertRows(
933
- params: InsertRowsParameters<InsertableTreeNodeFromImplicitAllowedTypes<TRow>>,
934
- ): TreeNodeFromImplicitAllowedTypes<TRow>[];
1322
+ insertRows(params: InsertRowsParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>[];
935
1323
 
936
1324
  /**
937
1325
  * Sets the cell at the specified location in the table.
938
- * @remarks To remove a cell, call {@link TableSchema.ITable.removeCell} instead.
939
- * @privateRemarks TODO: add overload that takes column/row nodes?
1326
+ * @remarks To remove a cell, call {@link TableSchema.Table.removeCell} instead.
940
1327
  */
941
- setCell(
942
- params: SetCellParameters<InsertableTreeNodeFromImplicitAllowedTypes<TCell>>,
943
- ): void;
1328
+ setCell(params: SetCellParameters<TCell, TColumn, TRow>): void;
944
1329
 
945
1330
  /**
946
1331
  * Removes the specified column from the table.
947
- * @remarks Note: this does not remove any cells from the table's rows.
948
- * @privateRemarks
949
- * TODO:
950
- * - Policy for when the column is not in the table.
951
- * - Actually remove corresponding cells from table rows.
1332
+ *
1333
+ * @remarks
1334
+ * Note: this does not remove any cells from the table's rows.
1335
+ * To remove the corresponding cells, use {@link TableSchema.Table.removeCell}.
1336
+ *
1337
+ * @param column - The {@link TableSchema.Column | column} or {@link TableSchema.Column.id | column ID} to remove.
1338
+ * @throws Throws an error if the column is not in the table.
1339
+ * @privateRemarks TODO (future): Actually remove corresponding cells from table rows.
952
1340
  */
953
- removeColumn: (column: TreeNodeFromImplicitAllowedTypes<TColumn>) => void;
1341
+ removeColumn(
1342
+ column: string | TreeNodeFromImplicitAllowedTypes<TColumn>,
1343
+ ): TreeNodeFromImplicitAllowedTypes<TColumn>;
954
1344
 
1345
+ /**
1346
+ * Removes 0 or more columns from the table.
1347
+ *
1348
+ * @remarks
1349
+ * Note: this does not remove any cells from the table's rows.
1350
+ * To remove the corresponding cells, use {@link TableSchema.Table.removeCell}.
1351
+ *
1352
+ * @param columns - The columns to remove.
1353
+ * @throws Throws an error if any of the columns are not in the table.
1354
+ * In this case, no columns are removed.
1355
+ */
1356
+ removeColumns(
1357
+ columns: readonly TreeNodeFromImplicitAllowedTypes<TColumn>[],
1358
+ ): TreeNodeFromImplicitAllowedTypes<TColumn>[];
1359
+ /**
1360
+ * Removes 0 or more columns from the table.
1361
+ *
1362
+ * @remarks
1363
+ * Note: this does not remove any cells from the table's rows.
1364
+ * To remove the corresponding cells, use {@link TableSchema.Table.removeCell}.
1365
+ *
1366
+ * @param columns - The columns to remove, specified by their {@link TableSchema.Column.id}.
1367
+ * @throws Throws an error if any of the columns are not in the table.
1368
+ * In this case, no columns are removed.
1369
+ */
1370
+ removeColumns(columns: readonly string[]): TreeNodeFromImplicitAllowedTypes<TColumn>[];
1371
+
1372
+ /**
1373
+ * Removes all columns from the table.
1374
+ * @returns The removed columns.
1375
+ */
1376
+ removeAllColumns(): TreeNodeFromImplicitAllowedTypes<TColumn>[];
1377
+
1378
+ /**
1379
+ * Removes the specified row from the table.
1380
+ * @param row - The {@link TableSchema.Row | row} or {@link TableSchema.Row.id | row ID} to remove.
1381
+ * @throws Throws an error if the row is not in the table.
1382
+ */
1383
+ removeRow(
1384
+ row: string | TreeNodeFromImplicitAllowedTypes<TRow>,
1385
+ ): TreeNodeFromImplicitAllowedTypes<TRow>;
1386
+
1387
+ /**
1388
+ * Removes 0 or more rows from the table.
1389
+ * @param rows - The rows to remove.
1390
+ * @throws Throws an error if any of the rows are not in the table.
1391
+ * In this case, no rows are removed.
1392
+ */
1393
+ removeRows(
1394
+ rows: readonly TreeNodeFromImplicitAllowedTypes<TRow>[],
1395
+ ): TreeNodeFromImplicitAllowedTypes<TRow>[];
955
1396
  /**
956
1397
  * Removes 0 or more rows from the table.
957
- * @privateRemarks TODO: policy for when 1 or more rows are not in the table.
1398
+ * @param rows - The rows to remove, specified by their {@link TableSchema.Row.id}.
1399
+ * @throws Throws an error if any of the rows are not in the table.
1400
+ * In this case, no rows are removed.
958
1401
  */
959
- removeRows: (rows: readonly TreeNodeFromImplicitAllowedTypes<TRow>[]) => void;
1402
+ removeRows(rows: readonly string[]): TreeNodeFromImplicitAllowedTypes<TRow>[];
960
1403
 
961
1404
  /**
962
1405
  * Removes all rows from the table.
1406
+ * @returns The removed rows.
963
1407
  */
964
- removeAllRows: () => void;
1408
+ removeAllRows(): TreeNodeFromImplicitAllowedTypes<TRow>[];
965
1409
 
966
1410
  /**
967
1411
  * Removes the cell at the specified location in the table.
968
- * @privateRemarks TODO: add overload that takes column/row nodes?
1412
+ * @returns The cell if it exists, otherwise undefined.
1413
+ * @throws Throws an error if the location does not exist in the table.
969
1414
  */
970
- removeCell: (key: CellKey) => void;
1415
+ removeCell(
1416
+ key: CellKey<TColumn, TRow>,
1417
+ ): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
971
1418
  }
972
1419
 
973
1420
  /**
974
1421
  * Factory for creating new table schema without specifying row or column schema.
975
1422
  * @internal
976
1423
  */
977
- export function createTable<
1424
+ export function table<
978
1425
  const TScope extends string | undefined,
979
1426
  const TCell extends ImplicitAllowedTypes,
980
- >({
981
- schemaFactory,
982
- cell,
983
- }: System_TableSchema.TableFactoryOptionsBase<TScope, TCell>): ReturnType<
984
- typeof System_TableSchema.createTableInternal<TScope, TCell>
1427
+ >(
1428
+ params: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell>,
1429
+ ): System_TableSchema.TableSchemaBase<
1430
+ TScope,
1431
+ TCell,
1432
+ System_TableSchema.ColumnSchemaBase<TScope, System_TableSchema.DefaultPropsType>,
1433
+ System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>
985
1434
  >;
986
1435
  /**
987
1436
  * Factory for creating new table schema without specifying row schema.
988
1437
  * @internal
989
1438
  */
990
- export function createTable<
1439
+ export function table<
991
1440
  const TScope extends string | undefined,
992
1441
  const TCell extends ImplicitAllowedTypes,
993
1442
  const TColumn extends System_TableSchema.ColumnSchemaBase<TScope>,
994
- >({
995
- schemaFactory,
996
- cell,
997
- column,
998
- }: System_TableSchema.TableFactoryOptionsBase<TScope, TCell> & {
999
- readonly column: TColumn;
1000
- }): ReturnType<typeof System_TableSchema.createTableInternal<TScope, TCell, TColumn>>;
1443
+ >(
1444
+ params: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {
1445
+ readonly column: TColumn;
1446
+ },
1447
+ ): System_TableSchema.TableSchemaBase<
1448
+ TScope,
1449
+ TCell,
1450
+ TColumn,
1451
+ System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>
1452
+ >;
1001
1453
  /**
1002
1454
  * Factory for creating new table schema.
1003
1455
  * @internal
1004
1456
  */
1005
- export function createTable<
1457
+ export function table<
1006
1458
  const TScope extends string | undefined,
1007
1459
  const TCell extends ImplicitAllowedTypes,
1008
1460
  const TColumn extends System_TableSchema.ColumnSchemaBase<TScope>,
1009
1461
  const TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,
1010
- >({
1011
- schemaFactory,
1012
- cell,
1013
- column,
1014
- row,
1015
- }: System_TableSchema.TableFactoryOptionsBase<TScope, TCell> & {
1016
- readonly column: TColumn;
1017
- readonly row: TRow;
1018
- }): ReturnType<typeof System_TableSchema.createTableInternal<TScope, TCell, TColumn, TRow>>;
1462
+ >(
1463
+ params: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {
1464
+ readonly column: TColumn;
1465
+ readonly row: TRow;
1466
+ },
1467
+ ): System_TableSchema.TableSchemaBase<TScope, TCell, TColumn, TRow>;
1019
1468
  /**
1020
1469
  * Overload implementation
1021
1470
  */
1022
- export function createTable({
1471
+ export function table({
1023
1472
  schemaFactory,
1024
- cell,
1025
- column = createColumn({
1473
+ cell: cellSchema,
1474
+ column: columnSchema = column({
1026
1475
  schemaFactory,
1027
1476
  }),
1028
- row = createRow({
1477
+ row: rowSchema = row({
1029
1478
  schemaFactory,
1030
- cell,
1479
+ cell: cellSchema,
1031
1480
  }),
1032
1481
  }: System_TableSchema.TableFactoryOptionsBase & {
1033
1482
  readonly column?: System_TableSchema.ColumnSchemaBase;
1034
1483
  readonly row?: System_TableSchema.RowSchemaBase;
1035
1484
  }): TreeNodeSchema {
1036
- return System_TableSchema.createTableInternal(schemaFactory, cell, column, row);
1485
+ return System_TableSchema.createTableSchema(
1486
+ schemaFactory,
1487
+ cellSchema,
1488
+ columnSchema,
1489
+ rowSchema,
1490
+ );
1037
1491
  }
1038
1492
 
1039
1493
  // #endregion