@fluidframework/tree 2.53.1 → 2.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (424) hide show
  1. package/.eslintrc.cjs +0 -19
  2. package/.mocharc.customBenchmarks.cjs +1 -9
  3. package/CHANGELOG.md +56 -0
  4. package/api-report/tree.alpha.api.md +50 -36
  5. package/api-report/tree.beta.api.md +15 -1
  6. package/api-report/{tree.legacy.alpha.api.md → tree.legacy.beta.api.md} +5 -5
  7. package/api-report/tree.legacy.public.api.md +1 -1
  8. package/api-report/tree.public.api.md +1 -1
  9. package/dist/alpha.d.ts +8 -2
  10. package/dist/beta.d.ts +3 -0
  11. package/dist/codec/codec.d.ts +43 -6
  12. package/dist/codec/codec.d.ts.map +1 -1
  13. package/dist/codec/codec.js +22 -2
  14. package/dist/codec/codec.js.map +1 -1
  15. package/dist/codec/index.d.ts +1 -1
  16. package/dist/codec/index.d.ts.map +1 -1
  17. package/dist/codec/index.js +4 -1
  18. package/dist/codec/index.js.map +1 -1
  19. package/dist/external-utilities/index.d.ts +1 -1
  20. package/dist/external-utilities/index.d.ts.map +1 -1
  21. package/dist/external-utilities/index.js +2 -1
  22. package/dist/external-utilities/index.js.map +1 -1
  23. package/dist/external-utilities/typeboxValidator.d.ts +6 -1
  24. package/dist/external-utilities/typeboxValidator.d.ts.map +1 -1
  25. package/dist/external-utilities/typeboxValidator.js +7 -1
  26. package/dist/external-utilities/typeboxValidator.js.map +1 -1
  27. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +10 -1
  28. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  29. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +28 -5
  30. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  31. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +19 -2
  32. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +10 -2
  34. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  35. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +59 -4
  36. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  37. package/dist/feature-libraries/chunked-forest/codec/codecs.js +9 -2
  38. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +46 -8
  40. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +91 -16
  42. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +14 -0
  44. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/codec/format.js +10 -1
  46. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  48. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  49. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +8 -3
  51. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +17 -6
  53. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  55. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  57. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  58. package/dist/feature-libraries/forest-summary/codec.js +3 -0
  59. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  60. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +13 -8
  61. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  62. package/dist/feature-libraries/forest-summary/forestSummarizer.js +76 -38
  63. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  64. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +178 -0
  65. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -0
  66. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +322 -0
  67. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -0
  68. package/dist/feature-libraries/forest-summary/index.d.ts +1 -1
  69. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  70. package/dist/feature-libraries/forest-summary/index.js +2 -1
  71. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  72. package/dist/feature-libraries/index.d.ts +1 -1
  73. package/dist/feature-libraries/index.d.ts.map +1 -1
  74. package/dist/feature-libraries/index.js +2 -1
  75. package/dist/feature-libraries/index.js.map +1 -1
  76. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  77. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  78. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +1 -1
  79. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  80. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +6 -9
  81. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  82. package/dist/feature-libraries/treeCompressionUtils.d.ts +15 -0
  83. package/dist/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
  84. package/dist/feature-libraries/treeCompressionUtils.js +16 -1
  85. package/dist/feature-libraries/treeCompressionUtils.js.map +1 -1
  86. package/dist/index.d.ts +3 -3
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +6 -2
  89. package/dist/index.js.map +1 -1
  90. package/dist/jsonDomainSchema.d.ts +1 -1
  91. package/dist/jsonDomainSchema.d.ts.map +1 -1
  92. package/dist/packageVersion.d.ts +1 -1
  93. package/dist/packageVersion.js +1 -1
  94. package/dist/packageVersion.js.map +1 -1
  95. package/dist/shared-tree/schematizingTreeView.d.ts +1 -1
  96. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  97. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  98. package/dist/shared-tree/sharedTree.d.ts +23 -6
  99. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  100. package/dist/shared-tree/sharedTree.js +4 -1
  101. package/dist/shared-tree/sharedTree.js.map +1 -1
  102. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  103. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  104. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  105. package/dist/shared-tree/tree.d.ts.map +1 -1
  106. package/dist/shared-tree/tree.js +3 -0
  107. package/dist/shared-tree/tree.js.map +1 -1
  108. package/dist/shared-tree/treeAlpha.d.ts +9 -11
  109. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  110. package/dist/shared-tree/treeAlpha.js.map +1 -1
  111. package/dist/shared-tree/treeCheckout.d.ts +2 -2
  112. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  113. package/dist/shared-tree/treeCheckout.js.map +1 -1
  114. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  115. package/dist/shared-tree-core/sharedTreeCore.js +13 -0
  116. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  117. package/dist/sharedTreeAttributes.d.ts +2 -2
  118. package/dist/sharedTreeAttributes.js +2 -2
  119. package/dist/sharedTreeAttributes.js.map +1 -1
  120. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  121. package/dist/simple-tree/api/conciseTree.js +1 -1
  122. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  123. package/dist/simple-tree/api/customTree.d.ts +39 -11
  124. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  125. package/dist/simple-tree/api/customTree.js +79 -19
  126. package/dist/simple-tree/api/customTree.js.map +1 -1
  127. package/dist/simple-tree/api/getJsonSchema.d.ts +7 -2
  128. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  129. package/dist/simple-tree/api/getJsonSchema.js +1 -0
  130. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  131. package/dist/simple-tree/api/index.d.ts +2 -1
  132. package/dist/simple-tree/api/index.d.ts.map +1 -1
  133. package/dist/simple-tree/api/index.js +4 -1
  134. package/dist/simple-tree/api/index.js.map +1 -1
  135. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +1 -1
  136. package/dist/simple-tree/api/schemaCreationUtilities.js +1 -1
  137. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  138. package/dist/simple-tree/api/schemaFactory.d.ts +9 -6
  139. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  140. package/dist/simple-tree/api/schemaFactory.js +8 -7
  141. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  142. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +13 -17
  143. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  144. package/dist/simple-tree/api/schemaFactoryAlpha.js +21 -25
  145. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  146. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +20 -0
  147. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -0
  148. package/dist/simple-tree/api/schemaFactoryBeta.js +26 -0
  149. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -0
  150. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +0 -2
  151. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  152. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +6 -3
  153. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  154. package/dist/simple-tree/api/transactionTypes.d.ts +1 -0
  155. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  156. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  157. package/dist/simple-tree/api/tree.d.ts +68 -74
  158. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  159. package/dist/simple-tree/api/tree.js.map +1 -1
  160. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  161. package/dist/simple-tree/api/verboseTree.js +3 -3
  162. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  163. package/dist/simple-tree/core/simpleNodeSchemaBase.d.ts +6 -0
  164. package/dist/simple-tree/core/simpleNodeSchemaBase.d.ts.map +1 -1
  165. package/dist/simple-tree/core/simpleNodeSchemaBase.js.map +1 -1
  166. package/dist/simple-tree/fieldSchema.d.ts +3 -4
  167. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  168. package/dist/simple-tree/fieldSchema.js +0 -3
  169. package/dist/simple-tree/fieldSchema.js.map +1 -1
  170. package/dist/simple-tree/index.d.ts +1 -1
  171. package/dist/simple-tree/index.d.ts.map +1 -1
  172. package/dist/simple-tree/index.js +4 -2
  173. package/dist/simple-tree/index.js.map +1 -1
  174. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  175. package/dist/simple-tree/node-kinds/record/recordNode.js +2 -3
  176. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  177. package/dist/simple-tree/simpleSchema.d.ts +12 -0
  178. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  179. package/dist/simple-tree/simpleSchema.js.map +1 -1
  180. package/dist/simple-tree/toStoredSchema.d.ts +0 -3
  181. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  182. package/dist/simple-tree/toStoredSchema.js +0 -3
  183. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  184. package/dist/tableSchema.d.ts +11 -80
  185. package/dist/tableSchema.d.ts.map +1 -1
  186. package/dist/tableSchema.js +200 -117
  187. package/dist/tableSchema.js.map +1 -1
  188. package/dist/treeFactory.d.ts +1 -2
  189. package/dist/treeFactory.d.ts.map +1 -1
  190. package/dist/treeFactory.js +1 -2
  191. package/dist/treeFactory.js.map +1 -1
  192. package/lib/alpha.d.ts +8 -2
  193. package/lib/beta.d.ts +3 -0
  194. package/lib/codec/codec.d.ts +43 -6
  195. package/lib/codec/codec.d.ts.map +1 -1
  196. package/lib/codec/codec.js +19 -1
  197. package/lib/codec/codec.js.map +1 -1
  198. package/lib/codec/index.d.ts +1 -1
  199. package/lib/codec/index.d.ts.map +1 -1
  200. package/lib/codec/index.js +1 -1
  201. package/lib/codec/index.js.map +1 -1
  202. package/lib/external-utilities/index.d.ts +1 -1
  203. package/lib/external-utilities/index.d.ts.map +1 -1
  204. package/lib/external-utilities/index.js +1 -1
  205. package/lib/external-utilities/index.js.map +1 -1
  206. package/lib/external-utilities/typeboxValidator.d.ts +6 -1
  207. package/lib/external-utilities/typeboxValidator.d.ts.map +1 -1
  208. package/lib/external-utilities/typeboxValidator.js +6 -0
  209. package/lib/external-utilities/typeboxValidator.js.map +1 -1
  210. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +10 -1
  211. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  212. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +27 -5
  213. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  214. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +19 -2
  215. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  216. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js +10 -2
  217. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  218. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +59 -4
  219. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  220. package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -3
  221. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  222. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +46 -8
  223. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  224. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +87 -14
  225. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  226. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +14 -0
  227. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  228. package/lib/feature-libraries/chunked-forest/codec/format.js +9 -0
  229. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  230. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  231. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  232. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  233. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +8 -3
  234. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  235. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +18 -7
  236. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  237. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  238. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  239. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  240. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  241. package/lib/feature-libraries/forest-summary/codec.js +3 -0
  242. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  243. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +13 -8
  244. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  245. package/lib/feature-libraries/forest-summary/forestSummarizer.js +75 -37
  246. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  247. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +178 -0
  248. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -0
  249. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +318 -0
  250. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -0
  251. package/lib/feature-libraries/forest-summary/index.d.ts +1 -1
  252. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  253. package/lib/feature-libraries/forest-summary/index.js +1 -1
  254. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  255. package/lib/feature-libraries/index.d.ts +1 -1
  256. package/lib/feature-libraries/index.d.ts.map +1 -1
  257. package/lib/feature-libraries/index.js +1 -1
  258. package/lib/feature-libraries/index.js.map +1 -1
  259. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  260. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  261. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +3 -3
  262. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  263. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +6 -9
  264. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  265. package/lib/feature-libraries/treeCompressionUtils.d.ts +15 -0
  266. package/lib/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
  267. package/lib/feature-libraries/treeCompressionUtils.js +15 -0
  268. package/lib/feature-libraries/treeCompressionUtils.js.map +1 -1
  269. package/lib/index.d.ts +3 -3
  270. package/lib/index.d.ts.map +1 -1
  271. package/lib/index.js +4 -4
  272. package/lib/index.js.map +1 -1
  273. package/lib/jsonDomainSchema.d.ts +1 -1
  274. package/lib/jsonDomainSchema.d.ts.map +1 -1
  275. package/lib/packageVersion.d.ts +1 -1
  276. package/lib/packageVersion.js +1 -1
  277. package/lib/packageVersion.js.map +1 -1
  278. package/lib/shared-tree/schematizingTreeView.d.ts +1 -1
  279. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  280. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  281. package/lib/shared-tree/sharedTree.d.ts +23 -6
  282. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  283. package/lib/shared-tree/sharedTree.js +4 -1
  284. package/lib/shared-tree/sharedTree.js.map +1 -1
  285. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  286. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  287. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  288. package/lib/shared-tree/tree.d.ts.map +1 -1
  289. package/lib/shared-tree/tree.js +3 -0
  290. package/lib/shared-tree/tree.js.map +1 -1
  291. package/lib/shared-tree/treeAlpha.d.ts +9 -11
  292. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  293. package/lib/shared-tree/treeAlpha.js.map +1 -1
  294. package/lib/shared-tree/treeCheckout.d.ts +2 -2
  295. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  296. package/lib/shared-tree/treeCheckout.js.map +1 -1
  297. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  298. package/lib/shared-tree-core/sharedTreeCore.js +13 -0
  299. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  300. package/lib/sharedTreeAttributes.d.ts +2 -2
  301. package/lib/sharedTreeAttributes.js +2 -2
  302. package/lib/sharedTreeAttributes.js.map +1 -1
  303. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  304. package/lib/simple-tree/api/conciseTree.js +2 -2
  305. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  306. package/lib/simple-tree/api/customTree.d.ts +39 -11
  307. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  308. package/lib/simple-tree/api/customTree.js +79 -19
  309. package/lib/simple-tree/api/customTree.js.map +1 -1
  310. package/lib/simple-tree/api/getJsonSchema.d.ts +7 -2
  311. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  312. package/lib/simple-tree/api/getJsonSchema.js +1 -0
  313. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  314. package/lib/simple-tree/api/index.d.ts +2 -1
  315. package/lib/simple-tree/api/index.d.ts.map +1 -1
  316. package/lib/simple-tree/api/index.js +2 -1
  317. package/lib/simple-tree/api/index.js.map +1 -1
  318. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +1 -1
  319. package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
  320. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  321. package/lib/simple-tree/api/schemaFactory.d.ts +9 -6
  322. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  323. package/lib/simple-tree/api/schemaFactory.js +6 -6
  324. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  325. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +13 -17
  326. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  327. package/lib/simple-tree/api/schemaFactoryAlpha.js +22 -26
  328. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  329. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +20 -0
  330. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -0
  331. package/lib/simple-tree/api/schemaFactoryBeta.js +22 -0
  332. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -0
  333. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +0 -2
  334. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  335. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +6 -3
  336. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  337. package/lib/simple-tree/api/transactionTypes.d.ts +1 -0
  338. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  339. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  340. package/lib/simple-tree/api/tree.d.ts +68 -74
  341. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  342. package/lib/simple-tree/api/tree.js.map +1 -1
  343. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  344. package/lib/simple-tree/api/verboseTree.js +4 -4
  345. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  346. package/lib/simple-tree/core/simpleNodeSchemaBase.d.ts +6 -0
  347. package/lib/simple-tree/core/simpleNodeSchemaBase.d.ts.map +1 -1
  348. package/lib/simple-tree/core/simpleNodeSchemaBase.js.map +1 -1
  349. package/lib/simple-tree/fieldSchema.d.ts +3 -4
  350. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  351. package/lib/simple-tree/fieldSchema.js +0 -3
  352. package/lib/simple-tree/fieldSchema.js.map +1 -1
  353. package/lib/simple-tree/index.d.ts +1 -1
  354. package/lib/simple-tree/index.d.ts.map +1 -1
  355. package/lib/simple-tree/index.js +1 -1
  356. package/lib/simple-tree/index.js.map +1 -1
  357. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  358. package/lib/simple-tree/node-kinds/record/recordNode.js +2 -3
  359. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  360. package/lib/simple-tree/simpleSchema.d.ts +12 -0
  361. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  362. package/lib/simple-tree/simpleSchema.js.map +1 -1
  363. package/lib/simple-tree/toStoredSchema.d.ts +0 -3
  364. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  365. package/lib/simple-tree/toStoredSchema.js +0 -3
  366. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  367. package/lib/tableSchema.d.ts +11 -80
  368. package/lib/tableSchema.d.ts.map +1 -1
  369. package/lib/tableSchema.js +201 -118
  370. package/lib/tableSchema.js.map +1 -1
  371. package/lib/treeFactory.d.ts +1 -2
  372. package/lib/treeFactory.d.ts.map +1 -1
  373. package/lib/treeFactory.js +1 -2
  374. package/lib/treeFactory.js.map +1 -1
  375. package/package.json +21 -21
  376. package/src/codec/codec.ts +52 -7
  377. package/src/codec/index.ts +4 -0
  378. package/src/external-utilities/index.ts +1 -1
  379. package/src/external-utilities/typeboxValidator.ts +7 -1
  380. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +38 -4
  381. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +10 -3
  382. package/src/feature-libraries/chunked-forest/codec/codecs.ts +96 -8
  383. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +123 -19
  384. package/src/feature-libraries/chunked-forest/codec/format.ts +11 -0
  385. package/src/feature-libraries/chunked-forest/codec/index.ts +4 -0
  386. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +28 -3
  387. package/src/feature-libraries/chunked-forest/index.ts +2 -0
  388. package/src/feature-libraries/forest-summary/codec.ts +3 -0
  389. package/src/feature-libraries/forest-summary/forestSummarizer.ts +118 -50
  390. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +511 -0
  391. package/src/feature-libraries/forest-summary/index.ts +1 -1
  392. package/src/feature-libraries/index.ts +5 -1
  393. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +8 -4
  394. package/src/feature-libraries/treeCompressionUtils.ts +19 -0
  395. package/src/index.ts +6 -1
  396. package/src/packageVersion.ts +1 -1
  397. package/src/shared-tree/schematizingTreeView.ts +1 -1
  398. package/src/shared-tree/sharedTree.ts +37 -4
  399. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
  400. package/src/shared-tree/tree.ts +3 -0
  401. package/src/shared-tree/treeAlpha.ts +10 -11
  402. package/src/shared-tree/treeCheckout.ts +2 -2
  403. package/src/shared-tree-core/sharedTreeCore.ts +17 -0
  404. package/src/sharedTreeAttributes.ts +2 -2
  405. package/src/simple-tree/api/conciseTree.ts +2 -1
  406. package/src/simple-tree/api/customTree.ts +102 -32
  407. package/src/simple-tree/api/getJsonSchema.ts +7 -2
  408. package/src/simple-tree/api/index.ts +3 -0
  409. package/src/simple-tree/api/schemaCreationUtilities.ts +1 -1
  410. package/src/simple-tree/api/schemaFactory.ts +21 -14
  411. package/src/simple-tree/api/schemaFactoryAlpha.ts +29 -30
  412. package/src/simple-tree/api/schemaFactoryBeta.ts +28 -0
  413. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +7 -3
  414. package/src/simple-tree/api/transactionTypes.ts +1 -0
  415. package/src/simple-tree/api/tree.ts +75 -81
  416. package/src/simple-tree/api/verboseTree.ts +42 -39
  417. package/src/simple-tree/core/simpleNodeSchemaBase.ts +6 -0
  418. package/src/simple-tree/fieldSchema.ts +3 -4
  419. package/src/simple-tree/index.ts +3 -0
  420. package/src/simple-tree/node-kinds/record/recordNode.ts +2 -3
  421. package/src/simple-tree/simpleSchema.ts +12 -0
  422. package/src/simple-tree/toStoredSchema.ts +0 -3
  423. package/src/tableSchema.ts +261 -243
  424. package/src/treeFactory.ts +1 -2
@@ -1 +1 @@
1
- {"version":3,"file":"tableSchema.js","sourceRoot":"","sources":["../src/tableSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAkE;AAClE,uEAAsE;AAEtE,qDAAyD;AACzD,qDAsBgC;AAEhC,4BAA4B;AAC5B,mDAAmD;AACnD,oDAAoD;AACpD,2EAA2E;AAE3E,oBAAoB;AACpB,mGAAmG;AAEnG;;GAEG;AACH,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAE3C;;;GAGG;AACH,SAAS,cAAc,CACtB,eAAyB;IAUzB,MAAM,WAAW,GAAG,eAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACjD,IAAI,WAAW,KAAK,SAAS,IAAI,CAAC,IAAA,4BAAiB,EAAC,eAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QAC/E,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,SAAS,GAAG,eAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC3C,I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ensed under the MIT License.\n */\n\nimport { assert, oob } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { Tree, TreeAlpha } from \"./shared-tree/index.js\";\nimport {\n\ttype FieldHasDefault,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeKind,\n\ttype SchemaFactoryAlpha,\n\ttype ScopedSchemaName,\n\tTreeArrayNode,\n\ttype TreeNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaClass,\n\ttype WithType,\n\ttype TreeFieldFromImplicitField,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InternalTreeNode,\n\tSchemaFactory,\n\ttype ImplicitAnnotatedFieldSchema,\n\ttype UnannotateImplicitFieldSchema,\n\tisArrayNodeSchema,\n\ttype InsertableField,\n} from \"./simple-tree/index.js\";\n\n// Future improvement TODOs:\n// - Omit `cells` property from Row insertion type.\n// - Record-like type parameters / input parameters?\n// - Omit `props` properties from Row and Column schemas when not provided?\n\n// Longer-term work:\n// - Add constraint APIs to make it possible to avoid situations that could yield \"orphaned\" cells.\n\n/**\n * The sub-scope applied to user-provided {@link SchemaFactory}s by table schema factories.\n */\nconst tableSchemaFactorySubScope = \"table\";\n\n/**\n * Gets the table containing the provided row/column node, if the node is part of a table.\n * @remarks Assumes that the table is the grandparent of the row/column node.\n */\nfunction getParentTable(\n\trowOrColumnNode: TreeNode,\n):\n\t| (TreeNode &\n\t\t\tTableSchema.Table<\n\t\t\t\tstring | undefined,\n\t\t\t\tImplicitAllowedTypes,\n\t\t\t\tSystem_TableSchema.ColumnSchemaBase,\n\t\t\t\tSystem_TableSchema.RowSchemaBase\n\t\t\t>)\n\t| undefined {\n\tconst rowListNode = Tree.parent(rowOrColumnNode);\n\tif (rowListNode === undefined || !isArrayNodeSchema(Tree.schema(rowListNode))) {\n\t\treturn undefined;\n\t}\n\tconst tableNode = Tree.parent(rowListNode);\n\tif (tableNode === undefined || !isTableNode(tableNode)) {\n\t\treturn undefined;\n\t}\n\n\treturn tableNode;\n}\n\n/**\n * A private symbol put on table schema to help identify them.\n */\nconst tableSchemaSymbol: unique symbol = Symbol(\"tableNode\");\n\n/**\n * Type-guard to determine if a node is a table node.\n * @remarks Uses {@link tableSchemaSymbol} to identify table nodes.\n */\nfunction isTableNode(\n\tnode: TreeNode,\n): node is TreeNode &\n\tTableSchema.Table<\n\t\tstring | undefined,\n\t\tImplicitAllowedTypes,\n\t\tSystem_TableSchema.ColumnSchemaBase,\n\t\tSystem_TableSchema.RowSchemaBase\n\t> {\n\treturn tableSchemaSymbol in Tree.schema(node);\n}\n\n/**\n * Not intended for use outside of this package.\n *\n * @privateRemarks\n * This namespace is a collection of internal system types relate to {@link TableSchema}.\n * This namespace should be strictly type-exported by the package.\n * All members should be tagged with `@system`.\n *\n * @system @alpha\n */\nexport namespace System_TableSchema {\n\t/**\n\t * Default type used for column and row \"props\" fields.\n\t * @privateRemarks\n\t * Longer term, it would be better to simply omit \"props\" altogether by default.\n\t * For now, this ensures that the user doesn't have to specify a \"props\" entry when initializing column/row nodes\n\t * and ensures that they cannot set anything that might conflict with future evolutions of the schema.\n\t * @system @alpha\n\t */\n\texport type DefaultPropsType = ReturnType<typeof SchemaFactory.optional<[]>>;\n\n\t/**\n\t * A base interface for factory input options which include an schema factory.\n\t * @remarks This interface should not be referenced directly.\n\t * @privateRemarks This interface primarily exists to provide a single home for property documentation.\n\t * @system @alpha\n\t */\n\texport interface OptionsWithSchemaFactory<TSchemaFactory extends SchemaFactoryAlpha> {\n\t\t/**\n\t\t * Schema factory with which the Column schema will be associated.\n\t\t * @remarks Can be used to associate the resulting schema with an existing {@link SchemaFactory.scope|scope}.\n\t\t */\n\t\treadonly schemaFactory: TSchemaFactory;\n\t}\n\n\t/**\n\t * A base interface for factory input options which include the table cell schema.\n\t * @remarks This interface should not be referenced directly.\n\t * @privateRemarks This interface primarily exists to provide a single home for property documentation.\n\t * @system @alpha\n\t */\n\texport interface OptionsWithCellSchema<TCellSchema extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * Schema for the table's cells.\n\t\t */\n\t\treadonly cell: TCellSchema;\n\t}\n\n\t// #region Column\n\n\t/**\n\t * Base options for creating table cow schema.\n\t * @remarks Includes parameters common to all column factory overloads.\n\t * @system @alpha\n\t */\n\texport type CreateColumnOptionsBase<\n\t\tTSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,\n\t\tTCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;\n\n\t/**\n\t * Factory for creating column schema.\n\t * @system @alpha\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createColumnSchema<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TPropsSchema extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\tcellSchema: TCellSchema,\n\t\tpropsSchema: TPropsSchema,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\n\t\t// Note: `columnFields` is broken into two parts to work around a TypeScript bug\n\t\t// that results in broken `.d.ts` output.\n\t\t// See definition of `ColumnInsertableType` below.\n\t\tconst columnFieldsBuiltInParts = {\n\t\t\tid: schemaFactory.identifier,\n\t\t} as const;\n\t\tconst columnFieldsPropsPart = {\n\t\t\tprops: propsSchema,\n\t\t} as const;\n\n\t\t/**\n\t\t * {@link Column} fields.\n\t\t *\n\t\t * @remarks\n\t\t * Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t *\n\t\t * Note: ideally we would add a satisfies clause here to ensure that this satisfies\n\t\t * `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.\n\t\t * Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394\n\t\t */\n\t\tconst columnFields = {\n\t\t\t...columnFieldsBuiltInParts,\n\t\t\t...columnFieldsPropsPart,\n\t\t} as const; // satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * A column in a table.\n\t\t */\n\t\tclass Column\n\t\t\textends schemaFactory.objectAlpha(\"Column\", columnFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Column<TCellSchema, TPropsSchema>\n\t\t{\n\t\t\tpublic getCells(): {\n\t\t\t\trowId: string;\n\t\t\t\tcell: CellValueType;\n\t\t\t}[] {\n\t\t\t\tconst tableNode = getParentTable(this);\n\t\t\t\tif (tableNode === undefined) {\n\t\t\t\t\tthrow new UsageError(`Column with ID \"${this.id}\" is not contained in a table.`);\n\t\t\t\t}\n\n\t\t\t\tconst result = [];\n\t\t\t\tfor (const row of tableNode.rows) {\n\t\t\t\t\tconst cell = row.getCell(this.id);\n\t\t\t\t\tif (cell !== undefined) {\n\t\t\t\t\t\tif (!Tree.is(cell, cellSchema)) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\"Parent table contains a cell with incompatible with this column.\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresult.push({ rowId: row.id, cell: cell as CellValueType });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t\ttype ColumnValueType = TreeNode &\n\t\t\tTableSchema.Column<TCellSchema, TPropsSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Column\">>;\n\n\t\t// Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof columnFields>`,\n\t\t// but that results in broken `.d.ts` output due to a TypeScript bug.\n\t\t// See: https://github.com/microsoft/TypeScript/issues/58688.\n\t\t// Instead we extract and inline the typing of the \"props\" field here, which seems to sufficiently work around the issue.\n\t\t// type ColumnInsertableType = InsertableObjectFromSchemaRecord<typeof columnFields>;\n\t\ttype ColumnInsertableType = InsertableObjectFromSchemaRecord<\n\t\t\ttypeof columnFieldsBuiltInParts\n\t\t> &\n\t\t\t(FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true\n\t\t\t\t? // Note: The docs on the below properties are copied from `IColumn.props`' docs to ensure that the\n\t\t\t\t\t// documentation appears in the data insertion scenario.\n\t\t\t\t\t// The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly\n\t\t\t\t\t// support `@inheritDoc`.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/31267\n\t\t\t\t\t{\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The column's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops?: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The column's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t});\n\n\t\t// Modified version of `Column` that ensures the constructor (and `createFromInsertable`) are\n\t\t// typed correctly in terms of our insertable type.\n\t\t// This lets us be selective in our type-cast for the value returned from this function,\n\t\t// preserving as much type-safety as we reasonably can.\n\t\ttype ColumnSchemaModifiedType = Omit<\n\t\t\t// Use mapped type to omit the constructor\n\t\t\t{\n\t\t\t\t[Property in keyof typeof Column]: (typeof Column)[Property];\n\t\t\t},\n\t\t\t\"createFromInsertable\"\n\t\t> &\n\t\t\t(new (\n\t\t\t\tparameters: InternalTreeNode | ColumnInsertableType,\n\t\t\t) => Column) & {\n\t\t\t\tcreateFromInsertable(parameters: ColumnInsertableType): Column;\n\t\t\t};\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst ColumnSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Column\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ ColumnValueType,\n\t\t\t/* TInsertable */ object & ColumnInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof columnFields\n\t\t> = Column as ColumnSchemaModifiedType;\n\n\t\treturn ColumnSchemaType;\n\t}\n\n\t/**\n\t * Base column schema type.\n\t * @sealed @system @alpha\n\t */\n\texport type ColumnSchemaBase<\n\t\tTScope extends string | undefined = string | undefined,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\tTPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> = ReturnType<typeof createColumnSchema<TScope, TCellSchema, TPropsSchema>>;\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * Base options for creating table row schema.\n\t * @remarks Includes parameters common to all row factory overloads.\n\t * @system @alpha\n\t */\n\texport type CreateRowOptionsBase<\n\t\tTSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,\n\t\tTCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;\n\n\t/**\n\t * Factory for creating row schema.\n\t * @sealed @alpha\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createRowSchema<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TPropsSchema extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\tcellSchema: TCellSchema,\n\t\tpropsSchema: TPropsSchema,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\t\ttype CellInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\n\t\t// Note: `rowFields` is broken into two parts to work around a TypeScript bug\n\t\t// that results in broken `.d.ts` output.\n\t\t// See definition of `RowInsertableType` below.\n\t\tconst rowFieldsBuiltInParts = {\n\t\t\tid: schemaFactory.identifier,\n\t\t\t/**\n\t\t\t * The cells of the table row, keyed by column ID.\n\t\t\t * @remarks\n\t\t\t * The table row models its cells as a record, where each key is the ID of the column it belongs to. The choice of record (as opposed to a map) is intended to make interop with common table rendering libraries in TypeScript/JavaScript easier.\n\t\t\t */\n\t\t\tcells: schemaFactory.required(schemaFactory.record(\"Row.cells\", cellSchema), {\n\t\t\t\tmetadata: {\n\t\t\t\t\tdescription: \"The cells of the table row, keyed by column ID.\",\n\t\t\t\t},\n\t\t\t}),\n\t\t} as const;\n\t\tconst rowFieldsPropsPart = {\n\t\t\tprops: propsSchema,\n\t\t} as const;\n\n\t\t/**\n\t\t * {@link Row} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t * Note: ideally we would add a satisfies clause here to ensure that this satisfies\n\t\t * `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.\n\t\t * Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394\n\t\t */\n\t\tconst rowFields = {\n\t\t\t...rowFieldsBuiltInParts,\n\t\t\t...rowFieldsPropsPart,\n\t\t} as const; // satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * The Row schema - this is a map of Cells where the key is the column id\n\t\t */\n\t\tclass Row\n\t\t\textends schemaFactory.objectAlpha(\"Row\", rowFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Row<TCellSchema, TPropsSchema>\n\t\t{\n\t\t\tpublic getCell(\n\t\t\t\tcolumnOrId: TableSchema.Column<TCellSchema> | string,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst columnId = typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\t\t\t\t// Unlike most objects, RecordNodes don't have the default inherited object properties, so this is safe\n\t\t\t\treturn this.cells[columnId];\n\t\t\t}\n\n\t\t\tpublic setCell(\n\t\t\t\tcolumnOrId: TableSchema.Column<TCellSchema> | string,\n\t\t\t\tvalue: CellInsertableType | undefined,\n\t\t\t): void {\n\t\t\t\t// TODO: throw if column does not exist in the owning table.\n\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tthis.removeCell(columnOrId);\n\t\t\t\t} else {\n\t\t\t\t\tconst columnId = typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\tthis.cells[columnId] = TreeAlpha.create(\n\t\t\t\t\t\tcellSchema,\n\t\t\t\t\t\tvalue as InsertableField<TCellSchema>,\n\t\t\t\t\t) as CellValueType;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic removeCell(\n\t\t\t\tcolumnOrId: TableSchema.Column<TCellSchema> | string,\n\t\t\t): CellValueType | undefined {\n\t\t\t\t// TODO: throw if column does not exist in the owning table.\n\n\t\t\t\tconst columnId = typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\n\t\t\t\tconst cell: CellValueType | undefined = this.getCell(columnId);\n\t\t\t\tif (cell === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete -- The record's values are non-optional, so setting `undefined` as a means to remove the cell is not supported.\n\t\t\t\tdelete this.cells[columnId];\n\n\t\t\t\treturn cell;\n\t\t\t}\n\n\t\t\tpublic getCells(): {\n\t\t\t\tcolumnId: string;\n\t\t\t\tcell: CellValueType;\n\t\t\t}[] {\n\t\t\t\tconst result = [];\n\t\t\t\tfor (const [columnId, cell] of Object.entries(this.cells)) {\n\t\t\t\t\tif (cell !== undefined) {\n\t\t\t\t\t\tresult.push({\n\t\t\t\t\t\t\tcolumnId,\n\t\t\t\t\t\t\tcell,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t\ttype RowValueType = TreeNode &\n\t\t\tTableSchema.Row<TCellSchema, TPropsSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Row\">>;\n\n\t\t// Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof rowFields>`,\n\t\t// but that results in broken `.d.ts` output due to a TypeScript bug.\n\t\t// See: https://github.com/microsoft/TypeScript/issues/58688.\n\t\t// Instead we extract and inline the typing of the \"props\" field here, which seems to sufficiently work around\n\t\t// the issue.\n\t\t// type RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFields>;\n\t\ttype RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFieldsBuiltInParts> &\n\t\t\t(FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true\n\t\t\t\t? // Note: The docs on the below properties are copied from `IRow.props`' docs to ensure that the\n\t\t\t\t\t// documentation appears in the data insertion scenario.\n\t\t\t\t\t// The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly\n\t\t\t\t\t// support `@inheritDoc`.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/31267\n\t\t\t\t\t{\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information\n\t\t\t\t\t\t * about the row.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops?: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information\n\t\t\t\t\t\t * about the row.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t});\n\n\t\t// Modified version of `Row` that ensures the constructor (and `createFromInsertable`) are\n\t\t// typed correctly in terms of our insertable type.\n\t\t// This lets us be selective in our type-cast for the value returned from this function,\n\t\t// preserving as much type-safety as we reasonably can.\n\t\ttype RowSchemaModifiedType = Omit<\n\t\t\t// Use mapped type to omit the constructor\n\t\t\t{\n\t\t\t\t[Property in keyof typeof Row]: (typeof Row)[Property];\n\t\t\t},\n\t\t\t\"createFromInsertable\"\n\t\t> &\n\t\t\t(new (\n\t\t\t\tparameters: InternalTreeNode | RowInsertableType,\n\t\t\t) => Row) & {\n\t\t\t\tcreateFromInsertable(parameters: RowInsertableType): Row;\n\t\t\t};\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst RowSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Row\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ RowValueType,\n\t\t\t/* TInsertable */ object & RowInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof rowFields\n\t\t> = Row as RowSchemaModifiedType;\n\n\t\treturn RowSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @alpha\n\t */\n\texport type RowSchemaBase<\n\t\tTScope extends string | undefined = string | undefined,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\tTPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> = ReturnType<typeof createRowSchema<TScope, TCellSchema, TPropsSchema>>;\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * Base options for creating table schema.\n\t * @remarks Includes parameters common to all table factory overloads.\n\t * @system @alpha\n\t */\n\texport type TableFactoryOptionsBase<\n\t\tTSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,\n\t\tTCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;\n\n\t/**\n\t * Factory for creating table schema.\n\t * @system @alpha\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createTableSchema<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TColumnSchema extends ColumnSchemaBase<TInputScope, TCellSchema>,\n\t\tconst TRowSchema extends RowSchemaBase<TInputScope, TCellSchema>,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\t_cellSchema: TCellSchema,\n\t\tcolumnSchema: TColumnSchema,\n\t\trowSchema: TRowSchema,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\t\ttype ColumnValueType = TreeNodeFromImplicitAllowedTypes<TColumnSchema>;\n\t\ttype RowValueType = TreeNodeFromImplicitAllowedTypes<TRowSchema>;\n\n\t\t/**\n\t\t * {@link Table} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t */\n\t\tconst tableFields = {\n\t\t\trows: schemaFactory.array(\"Table.rows\", rowSchema),\n\t\t\tcolumns: schemaFactory.array(\"Table.columns\", columnSchema),\n\t\t} as const satisfies Record<string, ImplicitAnnotatedFieldSchema>;\n\n\t\t/**\n\t\t * The Table schema\n\t\t */\n\t\tclass Table\n\t\t\textends schemaFactory.objectAlpha(\"Table\", tableFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Table<TInputScope, TCellSchema, TColumnSchema, TRowSchema>\n\t\t{\n\t\t\tpublic static empty<TThis extends TableConstructorType>(\n\t\t\t\tthis: TThis,\n\t\t\t): InstanceType<TThis> {\n\t\t\t\treturn new this({ columns: [], rows: [] }) as InstanceType<TThis>;\n\t\t\t}\n\n\t\t\tpublic getColumn(id: string): ColumnValueType | undefined {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.columns.find((column) => (column as ColumnValueType).id === id) as\n\t\t\t\t\t| ColumnValueType\n\t\t\t\t\t| undefined;\n\t\t\t}\n\n\t\t\tpublic getRow(id: string): RowValueType | undefined {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.rows.find((_row) => (_row as RowValueType).id === id) as\n\t\t\t\t\t| RowValueType\n\t\t\t\t\t| undefined;\n\t\t\t}\n\n\t\t\tpublic getCell(\n\t\t\t\tkey: TableSchema.CellKey<TColumnSchema, TRowSchema>,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\t\t\t\tconst row = this._getRow(rowOrId);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn row.getCell(column);\n\t\t\t}\n\n\t\t\tpublic insertColumn({\n\t\t\t\tcolumn,\n\t\t\t\tindex,\n\t\t\t}: TableSchema.InsertColumnParameters<TColumnSchema>): ColumnValueType {\n\t\t\t\tconst inserted = this.insertColumns({\n\t\t\t\t\tcolumns: [column],\n\t\t\t\t\tindex,\n\t\t\t\t});\n\t\t\t\treturn inserted[0] ?? oob();\n\t\t\t}\n\n\t\t\tpublic insertColumns({\n\t\t\t\tcolumns,\n\t\t\t\tindex,\n\t\t\t}: TableSchema.InsertColumnsParameters<TColumnSchema>): ColumnValueType[] {\n\t\t\t\t// Ensure index is valid\n\t\t\t\tif (index !== undefined) {\n\t\t\t\t\tTable.validateInsertionIndex(index, this.columns);\n\t\t\t\t}\n\n\t\t\t\t// TypeScript is unable to narrow the column type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.columns.insertAtEnd(TreeArrayNode.spread(columns) as any);\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.columns.insertAt(index, TreeArrayNode.spread(columns) as any);\n\t\t\t\t}\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn columns as unknown as ColumnValueType[];\n\t\t\t}\n\n\t\t\tpublic insertRow({\n\t\t\t\trow,\n\t\t\t\tindex,\n\t\t\t}: TableSchema.InsertRowParameters<TRowSchema>): RowValueType {\n\t\t\t\tconst inserted = this.insertRows({\n\t\t\t\t\trows: [row],\n\t\t\t\t\tindex,\n\t\t\t\t});\n\t\t\t\treturn inserted[0] ?? oob();\n\t\t\t}\n\n\t\t\tpublic insertRows({\n\t\t\t\tindex,\n\t\t\t\trows,\n\t\t\t}: TableSchema.InsertRowsParameters<TRowSchema>): RowValueType[] {\n\t\t\t\t// #region Input validation\n\n\t\t\t\t// Ensure index is valid\n\t\t\t\tif (index !== undefined) {\n\t\t\t\t\tTable.validateInsertionIndex(index, this.rows);\n\t\t\t\t}\n\n\t\t\t\t// Note: TypeScript is unable to narrow the type of the row type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tfor (const newRow of rows) {\n\t\t\t\t\t// If the row contains cells, verify that the table contains the columns for those cells.\n\t\t\t\t\t// Note: we intentionally hide `cells` on `IRow` to avoid leaking the internal data representation as much as possible, so we have to cast here.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tif ((newRow as any).cells !== undefined) {\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\tconst keys: string[] = Object.keys((newRow as any).cells);\n\t\t\t\t\t\tfor (const key of keys) {\n\t\t\t\t\t\t\tif (!this.containsColumnWithId(key)) {\n\t\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\t`Attempted to insert row a cell under column ID \"${key}\", but the table does not contain a column with that ID.`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// #endregion\n\n\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.rows.insertAtEnd(TreeArrayNode.spread(rows) as any);\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.rows.insertAt(index, TreeArrayNode.spread(rows) as any);\n\t\t\t\t}\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn rows as unknown as RowValueType[];\n\t\t\t}\n\n\t\t\tpublic setCell({\n\t\t\t\tkey,\n\t\t\t\tcell,\n\t\t\t}: TableSchema.SetCellParameters<TCellSchema, TColumnSchema, TRowSchema>): void {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\n\t\t\t\tconst row = this._getRow(rowOrId);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\tconst rowId = this._getRowId(rowOrId);\n\t\t\t\t\tthrow new UsageError(`No row with ID \"${rowId}\" exists in the table.`);\n\t\t\t\t}\n\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\tconst columnId = this._getColumnId(columnOrId);\n\t\t\t\t\tthrow new UsageError(`No column with ID \"${columnId}\" exists in the table.`);\n\t\t\t\t}\n\n\t\t\t\trow.setCell(column, cell);\n\t\t\t}\n\n\t\t\tpublic removeColumns(\n\t\t\t\tcolumns: readonly string[] | readonly ColumnValueType[],\n\t\t\t): ColumnValueType[] {\n\t\t\t\t// If there are no columns to remove, do nothing\n\t\t\t\tif (columns.length === 0) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\t// If there is only one column to remove, remove it (and don't incur cost of transaction)\n\t\t\t\tif (columns.length === 1) {\n\t\t\t\t\tconst removedColumn = this.removeColumn(columns[0] ?? oob());\n\t\t\t\t\treturn [removedColumn];\n\t\t\t\t}\n\n\t\t\t\t// If there are multiple columns to remove, remove them in a transaction.\n\t\t\t\tconst removedColumns: ColumnValueType[] = [];\n\t\t\t\tTree.runTransaction(this, () => {\n\t\t\t\t\t// Note, throwing an error within a transaction will abort the entire transaction.\n\t\t\t\t\t// So if we throw an error here for any row, no columns will be removed.\n\t\t\t\t\tfor (const columnToRemove of columns) {\n\t\t\t\t\t\tconst removedRow = this.removeColumn(columnToRemove);\n\t\t\t\t\t\tremovedColumns.push(removedRow);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn removedColumns;\n\t\t\t}\n\n\t\t\tpublic removeColumn(columnOrId: string | ColumnValueType): ColumnValueType {\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\t\t\t\tconst index = column === undefined ? -1 : this.columns.indexOf(column);\n\t\t\t\tif (index === -1) {\n\t\t\t\t\tconst columnId = this._getColumnId(columnOrId);\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Specified column with ID \"${columnId}\" does not exist in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tassert(column !== undefined, 0xc10 /* column should not be undefined */);\n\n\t\t\t\tTree.runTransaction(this, () => {\n\t\t\t\t\t// Remove the corresponding cell from all rows.\n\t\t\t\t\tfor (const row of this.rows) {\n\t\t\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\t\t(row as RowValueType).removeCell(column);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.columns.removeAt(index);\n\t\t\t\t});\n\n\t\t\t\treturn column;\n\t\t\t}\n\n\t\t\tpublic removeAllColumns(): ColumnValueType[] {\n\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.removeColumns(this.columns as unknown as ColumnValueType[]);\n\t\t\t}\n\n\t\t\tpublic removeRows(rows: readonly string[] | readonly RowValueType[]): RowValueType[] {\n\t\t\t\t// If there are no rows to remove, do nothing\n\t\t\t\tif (rows.length === 0) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\t// If there is only one row to remove, remove it (and don't incur cost of transaction)\n\t\t\t\tif (rows.length === 1) {\n\t\t\t\t\tconst removedRow = this.removeRow(rows[0] ?? oob());\n\t\t\t\t\treturn [removedRow];\n\t\t\t\t}\n\n\t\t\t\t// If there are multiple rows to remove, remove them in a transaction.\n\t\t\t\tconst removedRows: RowValueType[] = [];\n\t\t\t\tTree.runTransaction(this, () => {\n\t\t\t\t\t// Note, throwing an error within a transaction will abort the entire transaction.\n\t\t\t\t\t// So if we throw an error here for any row, no rows will be removed.\n\t\t\t\t\tfor (const rowToRemove of rows) {\n\t\t\t\t\t\tconst removedRow = this.removeRow(rowToRemove);\n\t\t\t\t\t\tremovedRows.push(removedRow);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn removedRows;\n\t\t\t}\n\n\t\t\tpublic removeRow(rowOrId: string | RowValueType): RowValueType {\n\t\t\t\tconst rowToRemove = this._getRow(rowOrId);\n\t\t\t\tconst index = rowToRemove === undefined ? -1 : this.rows.indexOf(rowToRemove);\n\n\t\t\t\t// If the row does not exist in the table, throw an error.\n\t\t\t\tif (index === -1) {\n\t\t\t\t\tconst rowId = this._getRowId(rowOrId);\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Specified row with ID \"${rowId}\" does not exist in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.rows.removeAt(index);\n\t\t\t\treturn rowToRemove as RowValueType;\n\t\t\t}\n\n\t\t\tpublic removeAllRows(): RowValueType[] {\n\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.removeRows(this.rows as unknown as RowValueType[]);\n\t\t\t}\n\n\t\t\tpublic removeCell(\n\t\t\t\tkey: TableSchema.CellKey<TColumnSchema, TRowSchema>,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\t\t\t\tconst row = this._getRow(rowOrId);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\tconst rowId = this._getRowId(rowOrId);\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Specified row with ID \"${rowId}\" does not exist in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\tconst columnId = this._getColumnId(columnOrId);\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Specified column with ID \"${columnId}\" does not exist in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst cell: CellValueType | undefined = row.getCell(column.id);\n\t\t\t\tif (cell === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\trow.removeCell(column.id);\n\t\t\t\treturn cell;\n\t\t\t}\n\n\t\t\tprivate _getColumn(columnOrId: string | ColumnValueType): ColumnValueType | undefined {\n\t\t\t\treturn typeof columnOrId === \"string\" ? this.getColumn(columnOrId) : columnOrId;\n\t\t\t}\n\n\t\t\tprivate _getColumnId(columnOrId: string | ColumnValueType): string {\n\t\t\t\treturn typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\t\t\t}\n\n\t\t\tprivate _getRow(rowOrId: string | RowValueType): RowValueType | undefined {\n\t\t\t\treturn typeof rowOrId === \"string\" ? this.getRow(rowOrId) : rowOrId;\n\t\t\t}\n\n\t\t\tprivate _getRowId(rowOrId: string | RowValueType): string {\n\t\t\t\treturn typeof rowOrId === \"string\" ? rowOrId : rowOrId.id;\n\t\t\t}\n\n\t\t\tprivate containsColumnWithId(columnId: string): boolean {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn (\n\t\t\t\t\tthis.columns.find(\n\t\t\t\t\t\t(column) => (column as TableSchema.Column<TCellSchema>).id === columnId,\n\t\t\t\t\t) !== undefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tprivate containsRowWithId(rowId: string): boolean {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn (\n\t\t\t\t\tthis.rows.find((row) => (row as TableSchema.Row<TCellSchema>).id === rowId) !==\n\t\t\t\t\tundefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Ensure that the specified index is a valid location for item insertion in the destination list.\n\t\t\t * @throws Throws a usage error if the destination is invalid.\n\t\t\t */\n\t\t\tprivate static validateInsertionIndex(\n\t\t\t\tindex: number,\n\t\t\t\tdestinationList: readonly unknown[],\n\t\t\t): void {\n\t\t\t\tif (index < 0) {\n\t\t\t\t\tthrow new UsageError(\"The index must be greater than or equal to 0.\");\n\t\t\t\t}\n\n\t\t\t\tif (index > destinationList.length) {\n\t\t\t\t\tthrow new UsageError(\"The index specified for insertion is out of bounds.\");\n\t\t\t\t}\n\n\t\t\t\tif (!Number.isInteger(index)) {\n\t\t\t\t\tthrow new UsageError(\"The index must be an integer.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Set a private symbol on the schema class that marks it as having been generated by this factory.\n\t\t// Column / Row functionality use this to validate that they are being used in a table.\n\t\t// This is effectively a work-around that allows columns and rows to invoke table methods\n\t\t// without having to pass the table as a parameter to their construction, which isn't possible.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t(Table as any)[tableSchemaSymbol] = true;\n\n\t\ttype TableValueType = TreeNode &\n\t\t\tTableSchema.Table<TInputScope, TCellSchema, TColumnSchema, TRowSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Table\">>;\n\t\ttype TableInsertableType = InsertableObjectFromSchemaRecord<typeof tableFields>;\n\t\ttype TableConstructorType = new (data: TableInsertableType) => TableValueType;\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst TableSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Table\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ TableValueType,\n\t\t\t/* TInsertable */ object & TableInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof tableFields\n\t\t> & {\n\t\t\t/**\n\t\t\t * Create an empty table.\n\t\t\t */\n\t\t\tempty<TThis extends TableConstructorType>(this: TThis): InstanceType<TThis>;\n\t\t} = Table;\n\n\t\t// Return the table schema\n\t\treturn TableSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @alpha\n\t */\n\texport type TableSchemaBase<\n\t\tTScope extends string | undefined,\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends ColumnSchemaBase<TScope, TCell>,\n\t\tTRow extends RowSchemaBase<TScope, TCell>,\n\t> = ReturnType<typeof createTableSchema<TScope, TCell, TColumn, TRow>>;\n\n\t// #endregion\n}\n\n/**\n * Contains types and factories for creating schema to represent dynamic tabular data.\n *\n * @remarks\n *\n * WARNING: These APIs are in preview and are subject to change.\n * Until these APIs have stabilized, it is not recommended to use them in production code.\n * There may be breaking changes to these APIs and their underlying data format.\n * Using these APIs in production code may result in data loss or corruption.\n *\n * The primary APIs for create tabular data schema are:\n *\n * - {@link TableSchema.(table:1)}\n *\n * - {@link TableSchema.(column:1)}\n *\n * - {@link TableSchema.(row:1)}\n *\n * Tables created using these APIs are...\n *\n * - sparse, meaning that cells may be omitted, and new rows are empty by default.\n *\n * - dynamic, meaning that their structure can be modified at runtime.\n * Columns and rows can be inserted, removed, modified, and reordered.\n * Cells can be inserted, removed, and modified.\n *\n * - row-major, meaning that operating on rows (including inserts, removal, moves, and traversal) is more efficient than operating on columns.\n *\n * Column and Row schema created using these APIs are extensible via the `props` field.\n * This allows association of additional properties with column and row nodes.\n *\n * Cells in the table may become \"orphaned.\"\n * That is, it is possible to enter a state where one or more rows contain cells with no corresponding column.\n * To reduce the likelihood of this, you can manually remove corresponding cells when removing columns.\n * Either way, it is possible to enter such a state via the merging of edits.\n * For example: one client might add a row while another concurrently removes a column, orphaning the cell where the column and row intersected.\n *\n * @example Defining a Table schema\n *\n * ```typescript\n * class MyTable extends TableSchema.table({\n * \tschemaFactory,\n * \tcell: schemaFactory.string,\n * }) {}\n *\n * const table = new MyTable({\n * \tcolumns: [{ id: \"column-0\" }],\n * \trows: [{ id: \"row-0\", cells: { \"column-0\": \"Hello world!\" } }],\n * });\n * ```\n *\n * @example Customizing Column and Row schema\n *\n * ```typescript\n * const Cell = schemaFactory.string;\n *\n * class MyColumn extends TableSchema.column({\n * \tschemaFactory,\n * \tcell: Cell,\n * \tprops: schemaFactory.object(\"TableColumnProps\", {\n * \t\tlabel: schemaFactory.string,\n * \t}),\n * }) {}\n *\n * class MyRow extends TableSchema.row({\n * \tschemaFactory,\n * \tcell: Cell,\n * }) {}\n *\n * class MyTable extends TableSchema.table({\n * \tschemaFactory,\n * \tcell: Cell,\n * \tcolumn: MyColumn,\n * \trow: MyRow,\n * }) {}\n *\n * const table = new MyTable({\n * \tcolumns: [\n * \t\tnew MyColumn({ props: { label: \"Entry\" } }),\n * \t\tnew MyColumn({ props: { label: \"Date\" } }),\n * \t\tnew MyColumn({ props: { label: \"Amount\" } }),\n * \t],\n * \trows: [],\n * });\n * ```\n *\n * @example Listening for changes in the table\n *\n * ```typescript\n * // Listen for any changes to the table and its children.\n * // The \"treeChanged\" event will fire when the associated node or any of its descendants change.\n * Tree.on(table, \"treeChanged\", () => {\n * \t// Respond to the change.\n * });\n * ```\n *\n * @example Listening for changes to the rows list only\n *\n * ```typescript\n * // Listen for any changes to the list of rows.\n * // The \"nodeChanged\" event will fire only when the specified node itself changes (i.e., its own properties change).\n * // In this case, the event will fire when a row is added or removed, or the order of the list is changed.\n * // But it won't fire when a row's properties change, or when the row's cells change, etc.\n * Tree.on(table.rows, \"nodeChanged\", () => {\n * \t// Respond to the change.\n * });\n * ```\n *\n * @privateRemarks\n * The above examples are backed by tests in `tableSchema.spec.ts`.\n * Those tests and these examples should be kept in-sync to ensure that the examples are correct.\n *\n * @alpha\n */\nexport namespace TableSchema {\n\t// #region Column\n\n\t/**\n\t * A column in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.(column:2)}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the column.\n\t * @sealed @alpha\n\t */\n\texport interface Column<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the column.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * The column's properties.\n\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t * @privateRemarks\n\t\t * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createColumnSchema}.\n\t\t * If you update the docs here, please also update the inline type definitions.\n\t\t */\n\t\tget props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>;\n\t\tset props(value: InsertableTreeFieldFromImplicitField<\n\t\t\tUnannotateImplicitFieldSchema<TProps>\n\t\t>);\n\n\t\t/**\n\t\t * Gets all of the populated cells in the column, keyed by their associated row IDs.\n\t\t * @throws Throws an error if the column is not in a table.\n\t\t */\n\t\tgetCells(): readonly {\n\t\t\trowId: string;\n\t\t\tcell: TreeNodeFromImplicitAllowedTypes<TCell>;\n\t\t}[];\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @alpha\n\t */\n\texport function column<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>, TCell>,\n\t): System_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>;\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the column.\n\t * @alpha\n\t */\n\texport function column<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TProps extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tparams: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\t/**\n\t\t\t * Optional column properties.\n\t\t\t */\n\t\t\treadonly props: TProps;\n\t\t},\n\t): System_TableSchema.ColumnSchemaBase<TScope, TCell, TProps>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function column({\n\t\tschemaFactory,\n\t\tcell,\n\t\tprops = SchemaFactory.optional(SchemaFactory.null),\n\t}: System_TableSchema.CreateColumnOptionsBase & {\n\t\treadonly props?: ImplicitAnnotatedFieldSchema;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createColumnSchema(schemaFactory, cell, props);\n\t}\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * A row in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.(row:2)}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the row.\n\t * @sealed @alpha\n\t */\n\texport interface Row<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the row.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * Gets the cell in the specified column.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @privateRemarks TODO: throw if the column does not belong to the same table as the row.\n\t\t */\n\t\tgetCell(column: Column<TCell>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t\t/**\n\t\t * Gets the cell in the specified column, denoted by column ID.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t */\n\t\tgetCell(columnId: string): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * Gets all of the populated cells in the row, keyed by their associated column IDs.\n\t\t */\n\t\tgetCells(): readonly {\n\t\t\tcolumnId: string;\n\t\t\tcell: TreeNodeFromImplicitAllowedTypes<TCell>;\n\t\t}[];\n\n\t\t/**\n\t\t * Sets the cell in the specified column.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Row.(removeCell:1)} instead.\n\t\t * @privateRemarks TODO: Throw an error if the column does not exist in the table.\n\t\t */\n\t\tsetCell(\n\t\t\tcolumn: Column<TCell>,\n\t\t\tvalue: InsertableTreeNodeFromImplicitAllowedTypes<TCell>,\n\t\t): void;\n\t\t/**\n\t\t * Sets the cell in the specified column, denoted by column ID.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Row.(removeCell:2)} instead.\n\t\t */\n\t\tsetCell(columnId: string, value: InsertableTreeNodeFromImplicitAllowedTypes<TCell>): void;\n\n\t\t/**\n\t\t * Removes the cell in the specified column.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @privateRemarks TODO: Throw if the column does not belong to the same table as the row.\n\t\t */\n\t\tremoveCell(column: Column<TCell>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t\t/**\n\t\t * Removes the cell in the specified column, denoted by column ID.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t */\n\t\tremoveCell(columnId: string): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * The row's properties.\n\t\t * @remarks This is a user-defined schema that can be used to store additional information about the row.\n\t\t * @privateRemarks\n\t\t * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createRowSchema}.\n\t\t * If you update the docs here, please also update the inline type definitions.\n\t\t */\n\t\tget props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>;\n\t\tset props(value: InsertableTreeFieldFromImplicitField<\n\t\t\tUnannotateImplicitFieldSchema<TProps>\n\t\t>);\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @alpha\n\t */\n\texport function row<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.CreateRowOptionsBase<SchemaFactoryAlpha<TScope>, TCell>,\n\t): System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>;\n\t/**\n\t * Factory for creating new table row schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the row.\n\t * @alpha\n\t */\n\texport function row<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TProps extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tparams: System_TableSchema.CreateRowOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\t/**\n\t\t\t * Optional row properties.\n\t\t\t */\n\t\t\treadonly props: TProps;\n\t\t},\n\t): System_TableSchema.RowSchemaBase<TScope, TCell, TProps>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function row({\n\t\tschemaFactory,\n\t\tcell,\n\t\tprops = SchemaFactory.optional(SchemaFactory.null),\n\t}: System_TableSchema.CreateRowOptionsBase & {\n\t\treadonly props?: ImplicitAnnotatedFieldSchema;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createRowSchema(schemaFactory, cell, props);\n\t}\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * A key to uniquely identify a cell within a table.\n\t * @alpha\n\t */\n\texport interface CellKey<\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * {@link TableSchema.Column} or {@link TableSchema.Column.id} at which the cell is located.\n\t\t */\n\t\treadonly column: string | TreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\t/**\n\t\t * {@link TableSchema.Row} or {@link TableSchema.Row.id} at which the cell is located.\n\t\t */\n\t\treadonly row: string | TreeNodeFromImplicitAllowedTypes<TRow>;\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertColumn} parameters.\n\t * @alpha\n\t */\n\texport interface InsertColumnParameters<TColumn extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new column.\n\t\t * @remarks If not provided, the column will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The column to insert.\n\t\t */\n\t\treadonly column: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>;\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertColumns} parameters.\n\t * @alpha\n\t */\n\texport interface InsertColumnsParameters<TColumn extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new columns.\n\t\t * @remarks If not provided, the columns will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The columns to insert.\n\t\t */\n\t\treadonly columns: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertRow} parameters.\n\t * @alpha\n\t */\n\texport interface InsertRowParameters<TRow extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new row.\n\t\t * @remarks If not provided, the row will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The row to insert.\n\t\t */\n\t\treadonly row: InsertableTreeNodeFromImplicitAllowedTypes<TRow>;\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertRows} parameters.\n\t * @alpha\n\t */\n\texport interface InsertRowsParameters<TRow extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new rows.\n\t\t * @remarks If not provided, the rows will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The rows to insert.\n\t\t */\n\t\treadonly rows: InsertableTreeNodeFromImplicitAllowedTypes<TRow>[];\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.setCell} parameters.\n\t * @alpha\n\t */\n\texport interface SetCellParameters<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * The key to uniquely identify a cell in a table.\n\t\t */\n\t\treadonly key: CellKey<TColumn, TRow>;\n\n\t\t/**\n\t\t * The cell to set.\n\t\t */\n\t\treadonly cell: InsertableTreeNodeFromImplicitAllowedTypes<TCell>;\n\t}\n\n\t/**\n\t * A table.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @sealed @alpha\n\t */\n\texport interface Table<\n\t\tTScope extends string | undefined,\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>,\n\t\tTRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,\n\t> {\n\t\t/**\n\t\t * The table's columns.\n\t\t */\n\t\treadonly columns: TreeArrayNode<TColumn>;\n\n\t\t/**\n\t\t * The table's rows.\n\t\t */\n\t\treadonly rows: TreeArrayNode<TRow>;\n\n\t\t/**\n\t\t * Gets a table column by its {@link TableSchema.Column.id}.\n\t\t */\n\t\tgetColumn(id: string): TreeNodeFromImplicitAllowedTypes<TColumn> | undefined;\n\n\t\t/**\n\t\t * Gets a table row by its {@link TableSchema.Row.id}.\n\t\t */\n\t\tgetRow(id: string): TreeNodeFromImplicitAllowedTypes<TRow> | undefined;\n\n\t\t/**\n\t\t * Gets a cell in the table by column and row IDs.\n\t\t * @param key - A key that uniquely distinguishes a cell in the table, represented as a combination of the column ID and row ID.\n\t\t */\n\t\tgetCell(key: CellKey<TColumn, TRow>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * Inserts a column into the table.\n\t\t *\n\t\t * @throws Throws an error if the specified index is out of range.\n\t\t *\n\t\t * No column is inserted in this case.\n\t\t */\n\t\tinsertColumn(\n\t\t\tparams: InsertColumnParameters<TColumn>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\t/**\n\t\t * Inserts 0 or more columns into the table.\n\t\t *\n\t\t * @throws Throws an error if the specified index is out of range.\n\t\t *\n\t\t * No columns are inserted in this case.\n\t\t */\n\t\tinsertColumns(\n\t\t\tparams: InsertColumnsParameters<TColumn>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Inserts a row into the table.\n\t\t *\n\t\t * @throws\n\t\t * Throws an error in the following cases:\n\t\t *\n\t\t * - The row contains cells, but the table does not contain matching columns for one or more of those cells.\n\t\t *\n\t\t * - The specified index is out of range.\n\t\t *\n\t\t * No row is inserted in these cases.\n\t\t */\n\t\tinsertRow(params: InsertRowParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>;\n\n\t\t/**\n\t\t * Inserts 0 or more rows into the table.\n\t\t *\n\t\t * @throws\n\t\t * Throws an error in the following cases:\n\t\t *\n\t\t * - The row contains cells, but the table does not contain matching columns for one or more of those cells.\n\t\t *\n\t\t * - The specified index is out of range.\n\t\t *\n\t\t * No rows are inserted in these cases.\n\t\t */\n\t\tinsertRows(params: InsertRowsParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Sets the cell at the specified location in the table.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Table.removeCell} instead.\n\t\t */\n\t\tsetCell(params: SetCellParameters<TCell, TColumn, TRow>): void;\n\n\t\t/**\n\t\t * Removes the specified column from the table.\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t *\n\t\t * @param column - The {@link TableSchema.Column | column} or {@link TableSchema.Column.id | column ID} to remove.\n\t\t * @throws Throws an error if the column is not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumn(\n\t\t\tcolumn: string | TreeNodeFromImplicitAllowedTypes<TColumn>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\t/**\n\t\t * Removes 0 or more columns from the table.\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t *\n\t\t * @param columns - The columns to remove.\n\t\t * @throws Throws an error if any of the columns are not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(\n\t\t\tcolumns: readonly TreeNodeFromImplicitAllowedTypes<TColumn>[],\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t\t/**\n\t\t * Removes 0 or more columns from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t *\n\t\t * @param columns - The columns to remove, specified by their {@link TableSchema.Column.id}.\n\t\t * @throws Throws an error if any of the columns are not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(columns: readonly string[]): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Removes all columns from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t *\n\t\t * @returns The removed columns.\n\t\t */\n\t\tremoveAllColumns(): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Removes the specified row from the table.\n\t\t * @param row - The {@link TableSchema.Row | row} or {@link TableSchema.Row.id | row ID} to remove.\n\t\t * @throws Throws an error if the row is not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRow(\n\t\t\trow: string | TreeNodeFromImplicitAllowedTypes<TRow>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TRow>;\n\n\t\t/**\n\t\t * Removes 0 or more rows from the table.\n\t\t * @param rows - The rows to remove.\n\t\t * @throws Throws an error if any of the rows are not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(\n\t\t\trows: readonly TreeNodeFromImplicitAllowedTypes<TRow>[],\n\t\t): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\t\t/**\n\t\t * Removes 0 or more rows from the table.\n\t\t * @param rows - The rows to remove, specified by their {@link TableSchema.Row.id}.\n\t\t * @throws Throws an error if any of the rows are not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(rows: readonly string[]): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Removes all rows from the table.\n\t\t * @returns The removed rows.\n\t\t */\n\t\tremoveAllRows(): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Removes the cell at the specified location in the table.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @throws Throws an error if the location does not exist in the table.\n\t\t */\n\t\tremoveCell(\n\t\t\tkey: CellKey<TColumn, TRow>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t}\n\n\t/**\n\t * Factory for creating new table schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @alpha\n\t */\n\texport function table<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell>,\n\t): System_TableSchema.TableSchemaBase<\n\t\tTScope,\n\t\tTCell,\n\t\tSystem_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>,\n\t\tSystem_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom column schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @alpha\n\t */\n\texport function table<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\treadonly column: TColumn;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<\n\t\tTScope,\n\t\tTCell,\n\t\tTColumn,\n\t\tSystem_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom row schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @alpha\n\t */\n\texport function table<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\treadonly row: TRow;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<\n\t\tTScope,\n\t\tTCell,\n\t\tSystem_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>,\n\t\tTRow\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom column and row schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @alpha\n\t */\n\texport function table<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>,\n\t\tconst TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\treadonly column: TColumn;\n\t\t\treadonly row: TRow;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<TScope, TCell, TColumn, TRow>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function table({\n\t\tschemaFactory,\n\t\tcell: cellSchema,\n\t\tcolumn: columnSchema = column({\n\t\t\tschemaFactory,\n\t\t\tcell: cellSchema,\n\t\t}),\n\t\trow: rowSchema = row({\n\t\t\tschemaFactory,\n\t\t\tcell: cellSchema,\n\t\t}),\n\t}: System_TableSchema.TableFactoryOptionsBase & {\n\t\treadonly column?: System_TableSchema.ColumnSchemaBase;\n\t\treadonly row?: System_TableSchema.RowSchemaBase;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createTableSchema(\n\t\t\tschemaFactory,\n\t\t\tcellSchema,\n\t\t\tcolumnSchema,\n\t\t\trowSchema,\n\t\t);\n\t}\n\n\t// #endregion\n}\n"]}
1
+ {"version":3,"file":"tableSchema.js","sourceRoot":"","sources":["../src/tableSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA2D;AAC3D,uEAAsE;AAEtE,qDAAyD;AACzD,qDAsBgC;AAEhC,4BAA4B;AAC5B,mDAAmD;AACnD,oDAAoD;AACpD,2EAA2E;AAE3E,oBAAoB;AACpB,mGAAmG;AAEnG;;GAEG;AACH,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAE3C;;;GAGG;AACH,SAAS,cAAc,CACtB,eAAyB;IAUzB,MAAM,WAAW,GAAG,eAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACjD,IAAI,WAAW,KAAK,SAAS,IAAI,CAAC,IAAA,4BAAiB,EAAC,eAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QAC/E,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,SAAS,GAAG,eAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC3C,IAAI,SAAS,KAAK,SAAS,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QACxD,OAAO,SAAS,CAAC;IAClB,CAAC;IA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AQrB,CAAA;IAkHD;;OAEG;IACH,SAAgB,GAAG,CAAC,EACnB,aAAa,EACb,IAAI,EACJ,KAAK,GAAG,wBAAa,CAAC,QAAQ,CAAC,wBAAa,CAAC,IAAI,CAAC,GAGlD;QACA,OAAO,kBAAkB,CAAC,eAAe,CAAC,aAAa,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;IARe,eAAG,MAQlB,CAAA;IA0TD;;OAEG;IACH,SAAgB,KAAK,CAAC,EACrB,aAAa,EACb,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC;QAC7B,aAAa;QACb,IAAI,EAAE,UAAU;KAChB,CAAC,EACF,GAAG,EAAE,SAAS,GAAG,GAAG,CAAC;QACpB,aAAa;QACb,IAAI,EAAE,UAAU;KAChB,CAAC,GAIF;QACA,OAAO,kBAAkB,CAAC,iBAAiB,CAC1C,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,CACT,CAAC;IACH,CAAC;IArBe,iBAAK,QAqBpB,CAAA;IAED,aAAa;AACd,CAAC,EAtiBgB,WAAW,2BAAX,WAAW,QAsiB3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { Tree, TreeAlpha } from \"./shared-tree/index.js\";\nimport {\n\ttype FieldHasDefault,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeKind,\n\ttype SchemaFactoryAlpha,\n\ttype ScopedSchemaName,\n\tTreeArrayNode,\n\ttype TreeNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaClass,\n\ttype WithType,\n\ttype TreeFieldFromImplicitField,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InternalTreeNode,\n\tSchemaFactory,\n\ttype ImplicitAnnotatedFieldSchema,\n\ttype UnannotateImplicitFieldSchema,\n\tisArrayNodeSchema,\n\ttype InsertableField,\n} from \"./simple-tree/index.js\";\n\n// Future improvement TODOs:\n// - Omit `cells` property from Row insertion type.\n// - Record-like type parameters / input parameters?\n// - Omit `props` properties from Row and Column schemas when not provided?\n\n// Longer-term work:\n// - Add constraint APIs to make it possible to avoid situations that could yield \"orphaned\" cells.\n\n/**\n * The sub-scope applied to user-provided {@link SchemaFactory}s by table schema factories.\n */\nconst tableSchemaFactorySubScope = \"table\";\n\n/**\n * Gets the table containing the provided row/column node, if the node is part of a table.\n * @remarks Assumes that the table is the grandparent of the row/column node.\n */\nfunction getParentTable(\n\trowOrColumnNode: TreeNode,\n):\n\t| (TreeNode &\n\t\t\tTableSchema.Table<\n\t\t\t\tstring | undefined,\n\t\t\t\tImplicitAllowedTypes,\n\t\t\t\tSystem_TableSchema.ColumnSchemaBase,\n\t\t\t\tSystem_TableSchema.RowSchemaBase\n\t\t\t>)\n\t| undefined {\n\tconst rowListNode = Tree.parent(rowOrColumnNode);\n\tif (rowListNode === undefined || !isArrayNodeSchema(Tree.schema(rowListNode))) {\n\t\treturn undefined;\n\t}\n\tconst tableNode = Tree.parent(rowListNode);\n\tif (tableNode === undefined || !isTableNode(tableNode)) {\n\t\treturn undefined;\n\t}\n\n\treturn tableNode;\n}\n\n/**\n * A private symbol put on table schema to help identify them.\n */\nconst tableSchemaSymbol: unique symbol = Symbol(\"tableNode\");\n\n/**\n * Type-guard to determine if a node is a table node.\n * @remarks Uses {@link tableSchemaSymbol} to identify table nodes.\n */\nfunction isTableNode(\n\tnode: TreeNode,\n): node is TreeNode &\n\tTableSchema.Table<\n\t\tstring | undefined,\n\t\tImplicitAllowedTypes,\n\t\tSystem_TableSchema.ColumnSchemaBase,\n\t\tSystem_TableSchema.RowSchemaBase\n\t> {\n\treturn tableSchemaSymbol in Tree.schema(node);\n}\n\n/**\n * Not intended for use outside of this package.\n *\n * @privateRemarks\n * This namespace is a collection of internal system types relate to {@link TableSchema}.\n * This namespace should be strictly type-exported by the package.\n * All members should be tagged with `@system`.\n *\n * @system @alpha\n */\nexport namespace System_TableSchema {\n\t/**\n\t * Default type used for column and row \"props\" fields.\n\t * @privateRemarks\n\t * Longer term, it would be better to simply omit \"props\" altogether by default.\n\t * For now, this ensures that the user doesn't have to specify a \"props\" entry when initializing column/row nodes\n\t * and ensures that they cannot set anything that might conflict with future evolutions of the schema.\n\t * @system @alpha\n\t */\n\texport type DefaultPropsType = ReturnType<typeof SchemaFactory.optional<[]>>;\n\n\t/**\n\t * A base interface for factory input options which include an schema factory.\n\t * @remarks This interface should not be referenced directly.\n\t * @privateRemarks This interface primarily exists to provide a single home for property documentation.\n\t * @system @alpha\n\t */\n\texport interface OptionsWithSchemaFactory<TSchemaFactory extends SchemaFactoryAlpha> {\n\t\t/**\n\t\t * Schema factory with which the Column schema will be associated.\n\t\t * @remarks Can be used to associate the resulting schema with an existing {@link SchemaFactory.scope|scope}.\n\t\t */\n\t\treadonly schemaFactory: TSchemaFactory;\n\t}\n\n\t/**\n\t * A base interface for factory input options which include the table cell schema.\n\t * @remarks This interface should not be referenced directly.\n\t * @privateRemarks This interface primarily exists to provide a single home for property documentation.\n\t * @system @alpha\n\t */\n\texport interface OptionsWithCellSchema<TCellSchema extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * Schema for the table's cells.\n\t\t */\n\t\treadonly cell: TCellSchema;\n\t}\n\n\t// #region Column\n\n\t/**\n\t * Base options for creating table cow schema.\n\t * @remarks Includes parameters common to all column factory overloads.\n\t * @system @alpha\n\t */\n\texport type CreateColumnOptionsBase<\n\t\tTSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,\n\t\tTCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;\n\n\t/**\n\t * Factory for creating column schema.\n\t * @system @alpha\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createColumnSchema<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TPropsSchema extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\tcellSchema: TCellSchema,\n\t\tpropsSchema: TPropsSchema,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactoryAlpha(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\n\t\t// Note: `columnFields` is broken into two parts to work around a TypeScript bug\n\t\t// that results in broken `.d.ts` output.\n\t\t// See definition of `ColumnInsertableType` below.\n\t\tconst columnFieldsBuiltInParts = {\n\t\t\tid: schemaFactory.identifier,\n\t\t} as const;\n\t\tconst columnFieldsPropsPart = {\n\t\t\tprops: propsSchema,\n\t\t} as const;\n\n\t\t/**\n\t\t * {@link Column} fields.\n\t\t *\n\t\t * @remarks\n\t\t * Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t *\n\t\t * Note: ideally we would add a satisfies clause here to ensure that this satisfies\n\t\t * `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.\n\t\t * Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394\n\t\t */\n\t\tconst columnFields = {\n\t\t\t...columnFieldsBuiltInParts,\n\t\t\t...columnFieldsPropsPart,\n\t\t} as const; // satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * A column in a table.\n\t\t */\n\t\tclass Column\n\t\t\textends schemaFactory.objectAlpha(\"Column\", columnFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Column<TCellSchema, TPropsSchema>\n\t\t{\n\t\t\tpublic getCells(): {\n\t\t\t\trowId: string;\n\t\t\t\tcell: CellValueType;\n\t\t\t}[] {\n\t\t\t\tconst tableNode = getParentTable(this);\n\t\t\t\tif (tableNode === undefined) {\n\t\t\t\t\tthrow new UsageError(`Column with ID \"${this.id}\" is not contained in a table.`);\n\t\t\t\t}\n\n\t\t\t\tconst result = [];\n\t\t\t\tfor (const row of tableNode.rows) {\n\t\t\t\t\tconst cell = row.getCell(this.id);\n\t\t\t\t\tif (cell !== undefined) {\n\t\t\t\t\t\tif (!Tree.is(cell, cellSchema)) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\"Parent table contains a cell with incompatible with this column.\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tresult.push({ rowId: row.id, cell: cell as CellValueType });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t\ttype ColumnValueType = TreeNode &\n\t\t\tTableSchema.Column<TCellSchema, TPropsSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Column\">>;\n\n\t\t// Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof columnFields>`,\n\t\t// but that results in broken `.d.ts` output due to a TypeScript bug.\n\t\t// See: https://github.com/microsoft/TypeScript/issues/58688.\n\t\t// Instead we extract and inline the typing of the \"props\" field here, which seems to sufficiently work around the issue.\n\t\t// type ColumnInsertableType = InsertableObjectFromSchemaRecord<typeof columnFields>;\n\t\ttype ColumnInsertableType = InsertableObjectFromSchemaRecord<\n\t\t\ttypeof columnFieldsBuiltInParts\n\t\t> &\n\t\t\t(FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true\n\t\t\t\t? // Note: The docs on the below properties are copied from `IColumn.props`' docs to ensure that the\n\t\t\t\t\t// documentation appears in the data insertion scenario.\n\t\t\t\t\t// The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly\n\t\t\t\t\t// support `@inheritDoc`.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/31267\n\t\t\t\t\t{\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The column's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops?: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The column's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t});\n\n\t\t// Modified version of `Column` that ensures the constructor (and `createFromInsertable`) are\n\t\t// typed correctly in terms of our insertable type.\n\t\t// This lets us be selective in our type-cast for the value returned from this function,\n\t\t// preserving as much type-safety as we reasonably can.\n\t\ttype ColumnSchemaModifiedType = Omit<\n\t\t\t// Use mapped type to omit the constructor\n\t\t\t{\n\t\t\t\t[Property in keyof typeof Column]: (typeof Column)[Property];\n\t\t\t},\n\t\t\t\"createFromInsertable\"\n\t\t> &\n\t\t\t(new (\n\t\t\t\tparameters: InternalTreeNode | ColumnInsertableType,\n\t\t\t) => Column) & {\n\t\t\t\tcreateFromInsertable(parameters: ColumnInsertableType): Column;\n\t\t\t};\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst ColumnSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Column\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ ColumnValueType,\n\t\t\t/* TInsertable */ object & ColumnInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof columnFields\n\t\t> = Column as ColumnSchemaModifiedType;\n\n\t\treturn ColumnSchemaType;\n\t}\n\n\t/**\n\t * Base column schema type.\n\t * @sealed @system @alpha\n\t */\n\texport type ColumnSchemaBase<\n\t\tTScope extends string | undefined = string | undefined,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\tTPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> = ReturnType<typeof createColumnSchema<TScope, TCellSchema, TPropsSchema>>;\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * Base options for creating table row schema.\n\t * @remarks Includes parameters common to all row factory overloads.\n\t * @system @alpha\n\t */\n\texport type CreateRowOptionsBase<\n\t\tTSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,\n\t\tTCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;\n\n\t/**\n\t * Factory for creating row schema.\n\t * @sealed @alpha\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createRowSchema<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TPropsSchema extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\tcellSchema: TCellSchema,\n\t\tpropsSchema: TPropsSchema,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactoryAlpha(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\t\ttype CellInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\n\t\t// Note: `rowFields` is broken into two parts to work around a TypeScript bug\n\t\t// that results in broken `.d.ts` output.\n\t\t// See definition of `RowInsertableType` below.\n\t\tconst rowFieldsBuiltInParts = {\n\t\t\tid: schemaFactory.identifier,\n\t\t\t/**\n\t\t\t * The cells of the table row, keyed by column ID.\n\t\t\t * @remarks\n\t\t\t * The table row models its cells as a record, where each key is the ID of the column it belongs to. The choice of record (as opposed to a map) is intended to make interop with common table rendering libraries in TypeScript/JavaScript easier.\n\t\t\t */\n\t\t\tcells: schemaFactory.required(schemaFactory.record(\"Row.cells\", cellSchema), {\n\t\t\t\tmetadata: {\n\t\t\t\t\tdescription: \"The cells of the table row, keyed by column ID.\",\n\t\t\t\t},\n\t\t\t}),\n\t\t} as const;\n\t\tconst rowFieldsPropsPart = {\n\t\t\tprops: propsSchema,\n\t\t} as const;\n\n\t\t/**\n\t\t * {@link Row} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t * Note: ideally we would add a satisfies clause here to ensure that this satisfies\n\t\t * `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.\n\t\t * Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394\n\t\t */\n\t\tconst rowFields = {\n\t\t\t...rowFieldsBuiltInParts,\n\t\t\t...rowFieldsPropsPart,\n\t\t} as const; // satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * The Row schema - this is a map of Cells where the key is the column id\n\t\t */\n\t\tclass Row\n\t\t\textends schemaFactory.objectAlpha(\"Row\", rowFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Row<TCellSchema, TPropsSchema>\n\t\t{\n\t\t\tpublic getCell(\n\t\t\t\tcolumnOrId: TableSchema.Column<TCellSchema> | string,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst columnId = typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\t\t\t\t// Unlike most objects, RecordNodes don't have the default inherited object properties, so this is safe\n\t\t\t\treturn this.cells[columnId];\n\t\t\t}\n\n\t\t\tpublic setCell(\n\t\t\t\tcolumnOrId: TableSchema.Column<TCellSchema> | string,\n\t\t\t\tvalue: CellInsertableType | undefined,\n\t\t\t): void {\n\t\t\t\t// TODO: throw if column does not exist in the owning table.\n\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tthis.removeCell(columnOrId);\n\t\t\t\t} else {\n\t\t\t\t\tconst columnId = typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\tthis.cells[columnId] = TreeAlpha.create(\n\t\t\t\t\t\tcellSchema,\n\t\t\t\t\t\tvalue as InsertableField<TCellSchema>,\n\t\t\t\t\t) as CellValueType;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic removeCell(\n\t\t\t\tcolumnOrId: TableSchema.Column<TCellSchema> | string,\n\t\t\t): CellValueType | undefined {\n\t\t\t\t// TODO: throw if column does not exist in the owning table.\n\n\t\t\t\tconst columnId = typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\n\t\t\t\tconst cell: CellValueType | undefined = this.getCell(columnId);\n\t\t\t\tif (cell === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete -- The record's values are non-optional, so setting `undefined` as a means to remove the cell is not supported.\n\t\t\t\tdelete this.cells[columnId];\n\n\t\t\t\treturn cell;\n\t\t\t}\n\n\t\t\tpublic getCells(): {\n\t\t\t\tcolumnId: string;\n\t\t\t\tcell: CellValueType;\n\t\t\t}[] {\n\t\t\t\tconst result = [];\n\t\t\t\tfor (const [columnId, cell] of Object.entries(this.cells)) {\n\t\t\t\t\tif (cell !== undefined) {\n\t\t\t\t\t\tresult.push({\n\t\t\t\t\t\t\tcolumnId,\n\t\t\t\t\t\t\tcell,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\n\t\ttype RowValueType = TreeNode &\n\t\t\tTableSchema.Row<TCellSchema, TPropsSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Row\">>;\n\n\t\t// Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof rowFields>`,\n\t\t// but that results in broken `.d.ts` output due to a TypeScript bug.\n\t\t// See: https://github.com/microsoft/TypeScript/issues/58688.\n\t\t// Instead we extract and inline the typing of the \"props\" field here, which seems to sufficiently work around\n\t\t// the issue.\n\t\t// type RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFields>;\n\t\ttype RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFieldsBuiltInParts> &\n\t\t\t(FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true\n\t\t\t\t? // Note: The docs on the below properties are copied from `IRow.props`' docs to ensure that the\n\t\t\t\t\t// documentation appears in the data insertion scenario.\n\t\t\t\t\t// The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly\n\t\t\t\t\t// support `@inheritDoc`.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/31267\n\t\t\t\t\t{\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information\n\t\t\t\t\t\t * about the row.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops?: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information\n\t\t\t\t\t\t * about the row.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops: InsertableTreeFieldFromImplicitField<\n\t\t\t\t\t\t\tUnannotateImplicitFieldSchema<TPropsSchema>\n\t\t\t\t\t\t>;\n\t\t\t\t\t});\n\n\t\t// Modified version of `Row` that ensures the constructor (and `createFromInsertable`) are\n\t\t// typed correctly in terms of our insertable type.\n\t\t// This lets us be selective in our type-cast for the value returned from this function,\n\t\t// preserving as much type-safety as we reasonably can.\n\t\ttype RowSchemaModifiedType = Omit<\n\t\t\t// Use mapped type to omit the constructor\n\t\t\t{\n\t\t\t\t[Property in keyof typeof Row]: (typeof Row)[Property];\n\t\t\t},\n\t\t\t\"createFromInsertable\"\n\t\t> &\n\t\t\t(new (\n\t\t\t\tparameters: InternalTreeNode | RowInsertableType,\n\t\t\t) => Row) & {\n\t\t\t\tcreateFromInsertable(parameters: RowInsertableType): Row;\n\t\t\t};\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst RowSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Row\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ RowValueType,\n\t\t\t/* TInsertable */ object & RowInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof rowFields\n\t\t> = Row as RowSchemaModifiedType;\n\n\t\treturn RowSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @alpha\n\t */\n\texport type RowSchemaBase<\n\t\tTScope extends string | undefined = string | undefined,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\tTPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> = ReturnType<typeof createRowSchema<TScope, TCellSchema, TPropsSchema>>;\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * Base options for creating table schema.\n\t * @remarks Includes parameters common to all table factory overloads.\n\t * @system @alpha\n\t */\n\texport type TableFactoryOptionsBase<\n\t\tTSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha,\n\t\tTCell extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;\n\n\t/**\n\t * Factory for creating table schema.\n\t * @system @alpha\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createTableSchema<\n\t\tconst TInputScope extends string | undefined,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TColumnSchema extends ColumnSchemaBase<TInputScope, TCellSchema>,\n\t\tconst TRowSchema extends RowSchemaBase<TInputScope, TCellSchema>,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryAlpha<TInputScope>,\n\t\t_cellSchema: TCellSchema,\n\t\tcolumnSchema: TColumnSchema,\n\t\trowSchema: TRowSchema,\n\t) {\n\t\tconst schemaFactory = inputSchemaFactory.scopedFactoryAlpha(tableSchemaFactorySubScope);\n\t\ttype Scope = ScopedSchemaName<TInputScope, typeof tableSchemaFactorySubScope>;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\t\ttype ColumnValueType = TreeNodeFromImplicitAllowedTypes<TColumnSchema>;\n\t\ttype RowValueType = TreeNodeFromImplicitAllowedTypes<TRowSchema>;\n\n\t\t/**\n\t\t * {@link Table} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t */\n\t\tconst tableFields = {\n\t\t\trows: schemaFactory.array(\"Table.rows\", rowSchema),\n\t\t\tcolumns: schemaFactory.array(\"Table.columns\", columnSchema),\n\t\t} as const satisfies Record<string, ImplicitAnnotatedFieldSchema>;\n\n\t\t/**\n\t\t * The Table schema\n\t\t */\n\t\tclass Table\n\t\t\textends schemaFactory.objectAlpha(\"Table\", tableFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Table<TInputScope, TCellSchema, TColumnSchema, TRowSchema>\n\t\t{\n\t\t\tpublic static empty<TThis extends TableConstructorType>(\n\t\t\t\tthis: TThis,\n\t\t\t): InstanceType<TThis> {\n\t\t\t\treturn new this({ columns: [], rows: [] }) as InstanceType<TThis>;\n\t\t\t}\n\n\t\t\tpublic getColumn(id: string): ColumnValueType | undefined {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.columns.find((column) => (column as ColumnValueType).id === id) as\n\t\t\t\t\t| ColumnValueType\n\t\t\t\t\t| undefined;\n\t\t\t}\n\n\t\t\tpublic getRow(id: string): RowValueType | undefined {\n\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\treturn this.rows.find((_row) => (_row as RowValueType).id === id) as\n\t\t\t\t\t| RowValueType\n\t\t\t\t\t| undefined;\n\t\t\t}\n\n\t\t\tpublic getCell(\n\t\t\t\tkey: TableSchema.CellKey<TColumnSchema, TRowSchema>,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\t\t\t\tconst row = this._tryGetRow(rowOrId);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst column = this._tryGetColumn(columnOrId);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn row.getCell(column);\n\t\t\t}\n\n\t\t\tpublic insertColumns({\n\t\t\t\tcolumns,\n\t\t\t\tindex,\n\t\t\t}: TableSchema.InsertColumnsParameters<TColumnSchema>): ColumnValueType[] {\n\t\t\t\t// Ensure index is valid\n\t\t\t\tif (index !== undefined) {\n\t\t\t\t\tTable.validateInsertionIndex(index, this.columns);\n\t\t\t\t}\n\n\t\t\t\t// TypeScript is unable to narrow the column type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.columns.insertAtEnd(TreeArrayNode.spread(columns) as any);\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.columns.insertAt(index, TreeArrayNode.spread(columns) as any);\n\t\t\t\t}\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn columns as unknown as ColumnValueType[];\n\t\t\t}\n\n\t\t\tpublic insertRows({\n\t\t\t\tindex,\n\t\t\t\trows,\n\t\t\t}: TableSchema.InsertRowsParameters<TRowSchema>): RowValueType[] {\n\t\t\t\t// #region Input validation\n\n\t\t\t\t// Ensure index is valid\n\t\t\t\tif (index !== undefined) {\n\t\t\t\t\tTable.validateInsertionIndex(index, this.rows);\n\t\t\t\t}\n\n\t\t\t\t// Note: TypeScript is unable to narrow the type of the row type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tfor (const newRow of rows) {\n\t\t\t\t\t// If the row contains cells, verify that the table contains the columns for those cells.\n\t\t\t\t\t// Note: we intentionally hide `cells` on `IRow` to avoid leaking the internal data representation as much as possible, so we have to cast here.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tif ((newRow as any).cells !== undefined) {\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\tconst keys: string[] = Object.keys((newRow as any).cells);\n\t\t\t\t\t\tfor (const key of keys) {\n\t\t\t\t\t\t\tif (!this._containsColumnWithId(key)) {\n\t\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\t`Attempted to insert row a cell under column ID \"${key}\", but the table does not contain a column with that ID.`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// #endregion\n\n\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.rows.insertAtEnd(TreeArrayNode.spread(rows) as any);\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.rows.insertAt(index, TreeArrayNode.spread(rows) as any);\n\t\t\t\t}\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn rows as unknown as RowValueType[];\n\t\t\t}\n\n\t\t\tpublic setCell({\n\t\t\t\tkey,\n\t\t\t\tcell,\n\t\t\t}: TableSchema.SetCellParameters<TCellSchema, TColumnSchema, TRowSchema>): void {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\n\t\t\t\tconst row = this._getRow(rowOrId);\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\n\t\t\t\trow.setCell(column, cell);\n\t\t\t}\n\n\t\t\tpublic removeColumns(\n\t\t\t\tindexOrColumns: number | undefined | readonly string[] | readonly ColumnValueType[],\n\t\t\t\tcount: number | undefined = undefined,\n\t\t\t): ColumnValueType[] {\n\t\t\t\tif (typeof indexOrColumns === \"number\" || indexOrColumns === undefined) {\n\t\t\t\t\tlet removedColumns: ColumnValueType[] | undefined;\n\t\t\t\t\tconst startIndex = indexOrColumns ?? 0;\n\t\t\t\t\tconst _count = count ?? this.columns.length - startIndex;\n\n\t\t\t\t\t// If there are no columns to remove, do nothing\n\t\t\t\t\tif (_count === 0) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\n\t\t\t\t\tTable._assertValidRange({ index: startIndex, count: _count }, this.columns);\n\n\t\t\t\t\tthis._applyEditsInBatch(() => {\n\t\t\t\t\t\tconst columnsToRemove = this.columns.slice(\n\t\t\t\t\t\t\tstartIndex,\n\t\t\t\t\t\t\tstartIndex + _count,\n\t\t\t\t\t\t) as ColumnValueType[];\n\n\t\t\t\t\t\t// First, remove all cells that correspond to each column from each row:\n\t\t\t\t\t\tfor (const column of columnsToRemove) {\n\t\t\t\t\t\t\tthis._removeCells(column);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Second, remove the column nodes:\n\t\t\t\t\t\tTable._removeRange(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tindex: startIndex,\n\t\t\t\t\t\t\t\tcount: _count,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tthis.columns,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tremovedColumns = columnsToRemove;\n\t\t\t\t\t});\n\t\t\t\t\treturn removedColumns ?? fail(0xc1f /* Transaction did not complete. */);\n\t\t\t\t} else {\n\t\t\t\t\t// If there are no columns to remove, do nothing\n\t\t\t\t\tif (indexOrColumns.length === 0) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\n\t\t\t\t\t// Resolve any IDs to actual nodes.\n\t\t\t\t\t// This validates that all of the rows exist before starting transaction.\n\t\t\t\t\t// This improves user-facing error experience.\n\t\t\t\t\tconst columnsToRemove: ColumnValueType[] = [];\n\t\t\t\t\tfor (const columnOrIdToRemove of indexOrColumns) {\n\t\t\t\t\t\tcolumnsToRemove.push(this._getColumn(columnOrIdToRemove));\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._applyEditsInBatch(() => {\n\t\t\t\t\t\t// Note, throwing an error within a transaction will abort the entire transaction.\n\t\t\t\t\t\t// So if we throw an error here for any column, no columns will be removed.\n\t\t\t\t\t\tfor (const columnToRemove of columnsToRemove) {\n\t\t\t\t\t\t\t// Remove the corresponding cell from all rows.\n\t\t\t\t\t\t\tfor (const row of this.rows) {\n\t\t\t\t\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\t\t\t\t(row as RowValueType).removeCell(columnToRemove);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// We have already validated that all of the columns exist above, so this is safe.\n\t\t\t\t\t\t\tthis.columns.removeAt(this.columns.indexOf(columnToRemove));\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\treturn columnsToRemove;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic removeRows(\n\t\t\t\tindexOrRows: number | undefined | readonly string[] | readonly RowValueType[],\n\t\t\t\tcount?: number | undefined,\n\t\t\t): RowValueType[] {\n\t\t\t\tif (typeof indexOrRows === \"number\" || indexOrRows === undefined) {\n\t\t\t\t\tconst startIndex = indexOrRows ?? 0;\n\t\t\t\t\tconst _count = count ?? this.columns.length - startIndex;\n\n\t\t\t\t\t// If there are no rows to remove, do nothing\n\t\t\t\t\tif (_count === 0) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Table._removeRange(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tindex: startIndex,\n\t\t\t\t\t\t\tcount: _count,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tthis.rows,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// If there are no rows to remove, do nothing\n\t\t\t\tif (indexOrRows.length === 0) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\t// Resolve any IDs to actual nodes.\n\t\t\t\t// This validates that all of the rows exist before starting transaction.\n\t\t\t\t// This improves user-facing error experience.\n\t\t\t\tconst rowsToRemove: RowValueType[] = [];\n\t\t\t\tfor (const rowToRemove of indexOrRows) {\n\t\t\t\t\trowsToRemove.push(this._getRow(rowToRemove));\n\t\t\t\t}\n\n\t\t\t\tthis._applyEditsInBatch(() => {\n\t\t\t\t\t// Note, throwing an error within a transaction will abort the entire transaction.\n\t\t\t\t\t// So if we throw an error here for any row, no rows will be removed.\n\t\t\t\t\tfor (const rowToRemove of rowsToRemove) {\n\t\t\t\t\t\t// We have already validated that all of the rows exist above, so this is safe.\n\t\t\t\t\t\tthis.rows.removeAt(this.rows.indexOf(rowToRemove));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn rowsToRemove;\n\t\t\t}\n\n\t\t\tpublic removeCell(\n\t\t\t\tkey: TableSchema.CellKey<TColumnSchema, TRowSchema>,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\t\t\t\tconst row = this._getRow(rowOrId);\n\t\t\t\tconst column = this._getColumn(columnOrId);\n\n\t\t\t\tconst cell: CellValueType | undefined = row.getCell(column.id);\n\t\t\t\tif (cell === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\trow.removeCell(column.id);\n\t\t\t\treturn cell;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Removes the cell corresponding with the specified column from each row in the table.\n\t\t\t */\n\t\t\tprivate _removeCells(column: ColumnValueType): void {\n\t\t\t\tfor (const row of this.rows) {\n\t\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\t(row as RowValueType).removeCell(column);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprivate static _assertValidRange<T>(\n\t\t\t\trange: { index: number; count: number },\n\t\t\t\tarray: readonly T[],\n\t\t\t): void {\n\t\t\t\tconst { index, count } = range;\n\t\t\t\tif (index < 0 || index >= array.length) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Start index out of bounds. Expected index to be on [0, ${array.length - 1}], but got ${index}.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (count < 0) {\n\t\t\t\t\tthrow new UsageError(`Expected non-negative count. Got ${count}.`);\n\t\t\t\t}\n\n\t\t\t\tconst end = index + count; // exclusive\n\t\t\t\tif (end > array.length) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`End index out of bounds. Expected end to be on [${index}, ${array.length}], but got ${end}.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Applies the provided edits in a \"batch\".\n\t\t\t *\n\t\t\t * @remarks\n\t\t\t * For hydrated trees, this will be done in a transaction to ensure atomicity.\n\t\t\t *\n\t\t\t * Transactions are not supported for unhydrated trees, so we cannot run a transaction in that case.\n\t\t\t * But since there are no collaborators, this is not an issue.\n\t\t\t */\n\t\t\tprivate _applyEditsInBatch(applyEdits: () => void): void {\n\t\t\t\tconst branch = TreeAlpha.branch(this);\n\n\t\t\t\tif (branch === undefined) {\n\t\t\t\t\t// If this node does not have a corresponding branch, then it is unhydrated.\n\t\t\t\t\t// I.e., it is not part of a collaborative session yet.\n\t\t\t\t\t// Therefore, we don't need to run the edits as a transaction.\n\t\t\t\t\tapplyEdits();\n\t\t\t\t} else {\n\t\t\t\t\tbranch.runTransaction(() => {\n\t\t\t\t\t\tapplyEdits();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attempts to resolve the provided Column node or ID to a Column node in the table.\n\t\t\t * Returns `undefined` if there is no match.\n\t\t\t * @remarks Searches for a match based strictly on the ID and returns that result.\n\t\t\t */\n\t\t\tprivate _tryGetColumn(\n\t\t\t\tcolumnOrId: string | ColumnValueType,\n\t\t\t): ColumnValueType | undefined {\n\t\t\t\tconst columnId = this._getColumnId(columnOrId);\n\t\t\t\treturn this.getColumn(columnId);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attempts to resolve the provided Column node or ID to a Column node in the table.\n\t\t\t * @throws Throws a `UsageError` if there is no match.\n\t\t\t * @remarks Searches for a match based strictly on the ID and returns that result.\n\t\t\t */\n\t\t\tprivate _getColumn(columnOrId: string | ColumnValueType): ColumnValueType {\n\t\t\t\tconst column = this._tryGetColumn(columnOrId);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\tthis._throwMissingColumnError(this._getColumnId(columnOrId));\n\t\t\t\t}\n\t\t\t\treturn column;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Resolves a Column node or ID to its ID.\n\t\t\t * If an ID is provided, it is returned as-is.\n\t\t\t * If a node is provided, its ID is returned.\n\t\t\t */\n\t\t\tprivate _getColumnId(columnOrId: string | ColumnValueType): string {\n\t\t\t\treturn typeof columnOrId === \"string\" ? columnOrId : columnOrId.id;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Checks if a Column with the specified ID exists in the table.\n\t\t\t */\n\t\t\tprivate _containsColumnWithId(columnId: string): boolean {\n\t\t\t\treturn this._tryGetColumn(columnId) !== undefined;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Throw a `UsageError` for a missing Column by its ID.\n\t\t\t */\n\t\t\tprivate _throwMissingColumnError(columnId: string): never {\n\t\t\t\tthrow new UsageError(`No column with ID \"${columnId}\" exists in the table.`);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attempts to resolve the provided Row node or ID to a Row node in the table.\n\t\t\t * Returns `undefined` if there is no match.\n\t\t\t * @remarks Searches for a match based strictly on the ID and returns that result.\n\t\t\t */\n\t\t\tprivate _tryGetRow(rowOrId: string | RowValueType): RowValueType | undefined {\n\t\t\t\tconst rowId = this._getRowId(rowOrId);\n\t\t\t\treturn this.getRow(rowId);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attempts to resolve the provided Row node or ID to a Row node in the table.\n\t\t\t * @throws Throws a `UsageError` if there is no match.\n\t\t\t * @remarks Searches for a match based strictly on the ID and returns that result.\n\t\t\t */\n\t\t\tprivate _getRow(rowOrId: string | RowValueType): RowValueType {\n\t\t\t\tconst row = this._tryGetRow(rowOrId);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\tthis._throwMissingRowError(this._getRowId(rowOrId));\n\t\t\t\t}\n\t\t\t\treturn row;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Resolves a Row node or ID to its ID.\n\t\t\t * If an ID is provided, it is returned as-is.\n\t\t\t * If a node is provided, its ID is returned.\n\t\t\t */\n\t\t\tprivate _getRowId(rowOrId: string | RowValueType): string {\n\t\t\t\treturn typeof rowOrId === \"string\" ? rowOrId : rowOrId.id;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Throw a `UsageError` for a missing Row by its ID.\n\t\t\t */\n\t\t\tprivate _throwMissingRowError(rowId: string): never {\n\t\t\t\tthrow new UsageError(`No row with ID \"${rowId}\" exists in the table.`);\n\t\t\t}\n\n\t\t\tprivate static _removeRange<TNodeSchema extends ImplicitAllowedTypes>(\n\t\t\t\trange: { index: number; count: number },\n\t\t\t\tarray: TreeArrayNode<TNodeSchema>,\n\t\t\t): TreeNodeFromImplicitAllowedTypes<TNodeSchema>[] {\n\t\t\t\tTable._assertValidRange(range, array);\n\n\t\t\t\tconst { index, count } = range;\n\t\t\t\tconst end = index + count; // exclusive\n\n\t\t\t\t// TypeScript is unable to narrow the array element type correctly here, hence the cast.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tconst removedRows = array.slice(\n\t\t\t\t\tindex,\n\t\t\t\t\tend,\n\t\t\t\t) as TreeNodeFromImplicitAllowedTypes<TNodeSchema>[];\n\t\t\t\tarray.removeRange(index, end);\n\n\t\t\t\treturn removedRows;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Ensure that the specified index is a valid location for item insertion in the destination list.\n\t\t\t * @throws Throws a usage error if the destination is invalid.\n\t\t\t */\n\t\t\tprivate static validateInsertionIndex(\n\t\t\t\tindex: number,\n\t\t\t\tdestinationList: readonly unknown[],\n\t\t\t): void {\n\t\t\t\tif (index < 0) {\n\t\t\t\t\tthrow new UsageError(\"The index must be greater than or equal to 0.\");\n\t\t\t\t}\n\n\t\t\t\tif (index > destinationList.length) {\n\t\t\t\t\tthrow new UsageError(\"The index specified for insertion is out of bounds.\");\n\t\t\t\t}\n\n\t\t\t\tif (!Number.isInteger(index)) {\n\t\t\t\t\tthrow new UsageError(\"The index must be an integer.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Set a private symbol on the schema class that marks it as having been generated by this factory.\n\t\t// Column / Row functionality use this to validate that they are being used in a table.\n\t\t// This is effectively a work-around that allows columns and rows to invoke table methods\n\t\t// without having to pass the table as a parameter to their construction, which isn't possible.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t(Table as any)[tableSchemaSymbol] = true;\n\n\t\ttype TableValueType = TreeNode &\n\t\t\tTableSchema.Table<TInputScope, TCellSchema, TColumnSchema, TRowSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Table\">>;\n\t\ttype TableInsertableType = InsertableObjectFromSchemaRecord<typeof tableFields>;\n\t\ttype TableConstructorType = new (data: TableInsertableType) => TableValueType;\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst TableSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Table\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ TableValueType,\n\t\t\t/* TInsertable */ object & TableInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof tableFields\n\t\t> & {\n\t\t\t/**\n\t\t\t * Create an empty table.\n\t\t\t */\n\t\t\tempty<TThis extends TableConstructorType>(this: TThis): InstanceType<TThis>;\n\t\t} = Table;\n\n\t\t// Return the table schema\n\t\treturn TableSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @alpha\n\t */\n\texport type TableSchemaBase<\n\t\tTScope extends string | undefined,\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends ColumnSchemaBase<TScope, TCell>,\n\t\tTRow extends RowSchemaBase<TScope, TCell>,\n\t> = ReturnType<typeof createTableSchema<TScope, TCell, TColumn, TRow>>;\n\n\t// #endregion\n}\n\n/**\n * Contains types and factories for creating schema to represent dynamic tabular data.\n *\n * @remarks\n *\n * WARNING: These APIs are in preview and are subject to change.\n * Until these APIs have stabilized, it is not recommended to use them in production code.\n * There may be breaking changes to these APIs and their underlying data format.\n * Using these APIs in production code may result in data loss or corruption.\n *\n * The primary APIs for create tabular data schema are:\n *\n * - {@link TableSchema.(table:1)}\n *\n * - {@link TableSchema.(column:1)}\n *\n * - {@link TableSchema.(row:1)}\n *\n * Tables created using these APIs are...\n *\n * - sparse, meaning that cells may be omitted, and new rows are empty by default.\n *\n * - dynamic, meaning that their structure can be modified at runtime.\n * Columns and rows can be inserted, removed, modified, and reordered.\n * Cells can be inserted, removed, and modified.\n *\n * - row-major, meaning that operating on rows (including inserts, removal, moves, and traversal) is more efficient than operating on columns.\n *\n * Column and Row schema created using these APIs are extensible via the `props` field.\n * This allows association of additional properties with column and row nodes.\n *\n * Cells in the table may become \"orphaned.\"\n * That is, it is possible to enter a state where one or more rows contain cells with no corresponding column.\n * To reduce the likelihood of this, you can manually remove corresponding cells when removing columns.\n * Either way, it is possible to enter such a state via the merging of edits.\n * For example: one client might add a row while another concurrently removes a column, orphaning the cell where the column and row intersected.\n *\n * @example Defining a Table schema\n *\n * ```typescript\n * class MyTable extends TableSchema.table({\n * \tschemaFactory,\n * \tcell: schemaFactory.string,\n * }) {}\n *\n * const table = new MyTable({\n * \tcolumns: [{ id: \"column-0\" }],\n * \trows: [{ id: \"row-0\", cells: { \"column-0\": \"Hello world!\" } }],\n * });\n * ```\n *\n * @example Customizing Column and Row schema\n *\n * ```typescript\n * const Cell = schemaFactory.string;\n *\n * class MyColumn extends TableSchema.column({\n * \tschemaFactory,\n * \tcell: Cell,\n * \tprops: schemaFactory.object(\"TableColumnProps\", {\n * \t\tlabel: schemaFactory.string,\n * \t}),\n * }) {}\n *\n * class MyRow extends TableSchema.row({\n * \tschemaFactory,\n * \tcell: Cell,\n * }) {}\n *\n * class MyTable extends TableSchema.table({\n * \tschemaFactory,\n * \tcell: Cell,\n * \tcolumn: MyColumn,\n * \trow: MyRow,\n * }) {}\n *\n * const table = new MyTable({\n * \tcolumns: [\n * \t\tnew MyColumn({ props: { label: \"Entry\" } }),\n * \t\tnew MyColumn({ props: { label: \"Date\" } }),\n * \t\tnew MyColumn({ props: { label: \"Amount\" } }),\n * \t],\n * \trows: [],\n * });\n * ```\n *\n * @example Listening for changes in the table\n *\n * ```typescript\n * // Listen for any changes to the table and its children.\n * // The \"treeChanged\" event will fire when the associated node or any of its descendants change.\n * Tree.on(table, \"treeChanged\", () => {\n * \t// Respond to the change.\n * });\n * ```\n *\n * @example Listening for changes to the rows list only\n *\n * ```typescript\n * // Listen for any changes to the list of rows.\n * // The \"nodeChanged\" event will fire only when the specified node itself changes (i.e., its own properties change).\n * // In this case, the event will fire when a row is added or removed, or the order of the list is changed.\n * // But it won't fire when a row's properties change, or when the row's cells change, etc.\n * Tree.on(table.rows, \"nodeChanged\", () => {\n * \t// Respond to the change.\n * });\n * ```\n *\n * @privateRemarks\n * The above examples are backed by tests in `tableSchema.spec.ts`.\n * Those tests and these examples should be kept in-sync to ensure that the examples are correct.\n *\n * @alpha\n */\nexport namespace TableSchema {\n\t// #region Column\n\n\t/**\n\t * A column in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.(column:2)}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the column.\n\t * @sealed @alpha\n\t */\n\texport interface Column<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the column.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * The column's properties.\n\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t * @privateRemarks\n\t\t * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createColumnSchema}.\n\t\t * If you update the docs here, please also update the inline type definitions.\n\t\t */\n\t\tget props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>;\n\t\tset props(value: InsertableTreeFieldFromImplicitField<\n\t\t\tUnannotateImplicitFieldSchema<TProps>\n\t\t>);\n\n\t\t/**\n\t\t * Gets all of the populated cells in the column, keyed by their associated row IDs.\n\t\t * @throws Throws an error if the column is not in a table.\n\t\t */\n\t\tgetCells(): readonly {\n\t\t\trowId: string;\n\t\t\tcell: TreeNodeFromImplicitAllowedTypes<TCell>;\n\t\t}[];\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @alpha\n\t */\n\texport function column<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>, TCell>,\n\t): System_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>;\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the column.\n\t * @alpha\n\t */\n\texport function column<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TProps extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tparams: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\t/**\n\t\t\t * Optional column properties.\n\t\t\t */\n\t\t\treadonly props: TProps;\n\t\t},\n\t): System_TableSchema.ColumnSchemaBase<TScope, TCell, TProps>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function column({\n\t\tschemaFactory,\n\t\tcell,\n\t\tprops = SchemaFactory.optional(SchemaFactory.null),\n\t}: System_TableSchema.CreateColumnOptionsBase & {\n\t\treadonly props?: ImplicitAnnotatedFieldSchema;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createColumnSchema(schemaFactory, cell, props);\n\t}\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * A row in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.(row:2)}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the row.\n\t * @sealed @alpha\n\t */\n\texport interface Row<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the row.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * Gets the cell in the specified column.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @privateRemarks TODO: throw if the column does not belong to the same table as the row.\n\t\t */\n\t\tgetCell(column: Column<TCell>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t\t/**\n\t\t * Gets the cell in the specified column, denoted by column ID.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t */\n\t\tgetCell(columnId: string): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * Gets all of the populated cells in the row, keyed by their associated column IDs.\n\t\t */\n\t\tgetCells(): readonly {\n\t\t\tcolumnId: string;\n\t\t\tcell: TreeNodeFromImplicitAllowedTypes<TCell>;\n\t\t}[];\n\n\t\t/**\n\t\t * Sets the cell in the specified column.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Row.(removeCell:1)} instead.\n\t\t * @privateRemarks TODO: Throw an error if the column does not exist in the table.\n\t\t */\n\t\tsetCell(\n\t\t\tcolumn: Column<TCell>,\n\t\t\tvalue: InsertableTreeNodeFromImplicitAllowedTypes<TCell>,\n\t\t): void;\n\t\t/**\n\t\t * Sets the cell in the specified column, denoted by column ID.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Row.(removeCell:2)} instead.\n\t\t */\n\t\tsetCell(columnId: string, value: InsertableTreeNodeFromImplicitAllowedTypes<TCell>): void;\n\n\t\t/**\n\t\t * Removes the cell in the specified column.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @privateRemarks TODO: Throw if the column does not belong to the same table as the row.\n\t\t */\n\t\tremoveCell(column: Column<TCell>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t\t/**\n\t\t * Removes the cell in the specified column, denoted by column ID.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t */\n\t\tremoveCell(columnId: string): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * The row's properties.\n\t\t * @remarks This is a user-defined schema that can be used to store additional information about the row.\n\t\t * @privateRemarks\n\t\t * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createRowSchema}.\n\t\t * If you update the docs here, please also update the inline type definitions.\n\t\t */\n\t\tget props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>;\n\t\tset props(value: InsertableTreeFieldFromImplicitField<\n\t\t\tUnannotateImplicitFieldSchema<TProps>\n\t\t>);\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @alpha\n\t */\n\texport function row<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.CreateRowOptionsBase<SchemaFactoryAlpha<TScope>, TCell>,\n\t): System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>;\n\t/**\n\t * Factory for creating new table row schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the row.\n\t * @alpha\n\t */\n\texport function row<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TProps extends ImplicitAnnotatedFieldSchema,\n\t>(\n\t\tparams: System_TableSchema.CreateRowOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\t/**\n\t\t\t * Optional row properties.\n\t\t\t */\n\t\t\treadonly props: TProps;\n\t\t},\n\t): System_TableSchema.RowSchemaBase<TScope, TCell, TProps>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function row({\n\t\tschemaFactory,\n\t\tcell,\n\t\tprops = SchemaFactory.optional(SchemaFactory.null),\n\t}: System_TableSchema.CreateRowOptionsBase & {\n\t\treadonly props?: ImplicitAnnotatedFieldSchema;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createRowSchema(schemaFactory, cell, props);\n\t}\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * A key to uniquely identify a cell within a table.\n\t * @alpha\n\t */\n\texport interface CellKey<\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * {@link TableSchema.Column} or {@link TableSchema.Column.id} at which the cell is located.\n\t\t */\n\t\treadonly column: string | TreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\t/**\n\t\t * {@link TableSchema.Row} or {@link TableSchema.Row.id} at which the cell is located.\n\t\t */\n\t\treadonly row: string | TreeNodeFromImplicitAllowedTypes<TRow>;\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertColumns} parameters.\n\t * @alpha\n\t */\n\texport interface InsertColumnsParameters<TColumn extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new columns.\n\t\t * @remarks If not provided, the columns will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The columns to insert.\n\t\t */\n\t\treadonly columns: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertRows} parameters.\n\t * @alpha\n\t */\n\texport interface InsertRowsParameters<TRow extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new rows.\n\t\t * @remarks If not provided, the rows will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The rows to insert.\n\t\t */\n\t\treadonly rows: InsertableTreeNodeFromImplicitAllowedTypes<TRow>[];\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.setCell} parameters.\n\t * @alpha\n\t */\n\texport interface SetCellParameters<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * The key to uniquely identify a cell in a table.\n\t\t */\n\t\treadonly key: CellKey<TColumn, TRow>;\n\n\t\t/**\n\t\t * The cell to set.\n\t\t */\n\t\treadonly cell: InsertableTreeNodeFromImplicitAllowedTypes<TCell>;\n\t}\n\n\t/**\n\t * A table.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @sealed @alpha\n\t */\n\texport interface Table<\n\t\tTScope extends string | undefined,\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>,\n\t\tTRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,\n\t> {\n\t\t/**\n\t\t * The table's columns.\n\t\t */\n\t\treadonly columns: TreeArrayNode<TColumn>;\n\n\t\t/**\n\t\t * The table's rows.\n\t\t */\n\t\treadonly rows: TreeArrayNode<TRow>;\n\n\t\t/**\n\t\t * Gets a table column by its {@link TableSchema.Column.id}.\n\t\t */\n\t\tgetColumn(id: string): TreeNodeFromImplicitAllowedTypes<TColumn> | undefined;\n\n\t\t/**\n\t\t * Gets a table row by its {@link TableSchema.Row.id}.\n\t\t */\n\t\tgetRow(id: string): TreeNodeFromImplicitAllowedTypes<TRow> | undefined;\n\n\t\t/**\n\t\t * Gets a cell in the table by column and row IDs.\n\t\t * @param key - A key that uniquely distinguishes a cell in the table, represented as a combination of the column ID and row ID.\n\t\t */\n\t\tgetCell(key: CellKey<TColumn, TRow>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * Inserts 0 or more columns into the table.\n\t\t *\n\t\t * @throws Throws an error if the specified index is out of range.\n\t\t *\n\t\t * No columns are inserted in this case.\n\t\t */\n\t\tinsertColumns(\n\t\t\tparams: InsertColumnsParameters<TColumn>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Inserts 0 or more rows into the table.\n\t\t *\n\t\t * @throws\n\t\t * Throws an error in the following cases:\n\t\t *\n\t\t * - The row contains cells, but the table does not contain matching columns for one or more of those cells.\n\t\t *\n\t\t * - The specified index is out of range.\n\t\t *\n\t\t * No rows are inserted in these cases.\n\t\t */\n\t\tinsertRows(params: InsertRowsParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Sets the cell at the specified location in the table.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Table.removeCell} instead.\n\t\t */\n\t\tsetCell(params: SetCellParameters<TCell, TColumn, TRow>): void;\n\n\t\t/**\n\t\t * Removes a range of columns from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t * @param index - The starting index of the range to remove. Default: `0`.\n\t\t * @param count - The number of columns to remove. Default: all remaining columns starting from `index`.\n\t\t * @throws Throws an error if the specified range is invalid. In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(\n\t\t\tindex?: number | undefined,\n\t\t\tcount?: number | undefined,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t\t/**\n\t\t * Removes 0 or more columns from the table.\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t *\n\t\t * @param columns - The columns to remove.\n\t\t * @throws Throws an error if any of the columns are not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(\n\t\t\tcolumns: readonly TreeNodeFromImplicitAllowedTypes<TColumn>[],\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t\t/**\n\t\t * Removes 0 or more columns from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t *\n\t\t * @param columns - The columns to remove, specified by their {@link TableSchema.Column.id}.\n\t\t * @throws Throws an error if any of the columns are not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(columns: readonly string[]): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Removes a range of rows from the table.\n\t\t * @param index - The starting index of the range to remove. Default: `0`.\n\t\t * @param count - The number of rows to remove. Default: all remaining rows starting from `index`.\n\t\t * @throws Throws an error if the specified range is invalid. In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(\n\t\t\tindex?: number | undefined,\n\t\t\tcount?: number | undefined,\n\t\t): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\t\t/**\n\t\t * Removes 0 or more rows from the table.\n\t\t * @param rows - The rows to remove.\n\t\t * @throws Throws an error if any of the rows are not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(\n\t\t\trows: readonly TreeNodeFromImplicitAllowedTypes<TRow>[],\n\t\t): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\t\t/**\n\t\t * Removes 0 or more rows from the table.\n\t\t * @param rows - The rows to remove, specified by their {@link TableSchema.Row.id}.\n\t\t * @throws Throws an error if any of the rows are not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(rows: readonly string[]): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Removes the cell at the specified location in the table.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @throws Throws an error if the location does not exist in the table.\n\t\t */\n\t\tremoveCell(\n\t\t\tkey: CellKey<TColumn, TRow>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t}\n\n\t/**\n\t * Factory for creating new table schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @alpha\n\t */\n\texport function table<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell>,\n\t): System_TableSchema.TableSchemaBase<\n\t\tTScope,\n\t\tTCell,\n\t\tSystem_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>,\n\t\tSystem_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom column schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @alpha\n\t */\n\texport function table<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\treadonly column: TColumn;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<\n\t\tTScope,\n\t\tTCell,\n\t\tTColumn,\n\t\tSystem_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom row schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @alpha\n\t */\n\texport function table<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\treadonly row: TRow;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<\n\t\tTScope,\n\t\tTCell,\n\t\tSystem_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>,\n\t\tTRow\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom column and row schema.\n\t * @typeParam TScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @alpha\n\t */\n\texport function table<\n\t\tconst TScope extends string | undefined,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>,\n\t\tconst TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {\n\t\t\treadonly column: TColumn;\n\t\t\treadonly row: TRow;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<TScope, TCell, TColumn, TRow>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function table({\n\t\tschemaFactory,\n\t\tcell: cellSchema,\n\t\tcolumn: columnSchema = column({\n\t\t\tschemaFactory,\n\t\t\tcell: cellSchema,\n\t\t}),\n\t\trow: rowSchema = row({\n\t\t\tschemaFactory,\n\t\t\tcell: cellSchema,\n\t\t}),\n\t}: System_TableSchema.TableFactoryOptionsBase & {\n\t\treadonly column?: System_TableSchema.ColumnSchemaBase;\n\t\treadonly row?: System_TableSchema.RowSchemaBase;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createTableSchema(\n\t\t\tschemaFactory,\n\t\t\tcellSchema,\n\t\t\tcolumnSchema,\n\t\t\trowSchema,\n\t\t);\n\t}\n\n\t// #endregion\n}\n"]}
@@ -16,8 +16,7 @@ export interface ISharedTree extends ISharedObject, ITreePrivate {
16
16
  /**
17
17
  * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees
18
18
  * of objects, arrays, and other data types.
19
- * @legacy
20
- * @alpha
19
+ * @legacy @beta
21
20
  */
22
21
  export declare const SharedTree: ISharedObjectKind<ITree> & SharedObjectKind<ITree>;
23
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"treeFactory.d.ts","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAMtB,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAGtB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAIpD;;;;GAIG;AACH,MAAM,WAAW,WAAY,SAAQ,aAAa,EAAE,YAAY;CAAG;AAgDnE;;;;;GAKG;AACH,eAAO,MAAM,UAAU,oDAA2B,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,iBAAiB,GACxB,iBAAiB,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,CASpD"}
1
+ {"version":3,"file":"treeFactory.d.ts","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAMtB,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAGtB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAIpD;;;;GAIG;AACH,MAAM,WAAW,WAAY,SAAQ,aAAa,EAAE,YAAY;CAAG;AAgDnE;;;;GAIG;AACH,eAAO,MAAM,UAAU,oDAA2B,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,iBAAiB,GACxB,iBAAiB,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,CASpD"}
@@ -43,8 +43,7 @@ function treeKernelFactory(options) {
43
43
  /**
44
44
  * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees
45
45
  * of objects, arrays, and other data types.
46
- * @legacy
47
- * @alpha
46
+ * @legacy @beta
48
47
  */
49
48
  exports.SharedTree = configuredSharedTree({});
50
49
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"treeFactory.js","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,0EAQqD;AACrD,uEAAsE;AAEtE,qDAMgC;AAChC,uEAAwF;AAExF,8CAA4C;AAC5C,+CAAsD;AAStD;;;;;GAKG;AACH,SAAS,iBAAiB,CACzB,OAAkC;IAElC,SAAS,kBAAkB,CAAC,IAAgB;QAC3C,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACrC,MAAM,IAAI,qBAAU,CAAC,gDAAgD,CAAC,CAAC;QACxE,CAAC;QACD,MAAM,eAAe,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;QACvC,4FAA4F;QAC5F,kFAAkF;QAClF,eAAe,CAAC,sBAAsB,KAAK,6BAAkB,CAAC,IAAI,CAAC;QACnE,OAAO,IAAI,2BAAgB,CAC1B,IAAI,oBAAS,CAAC,YAAY,CAAC,EAC3B,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,YAAY,EACjB,eAAe,CACf,CAAC;IACH,CAAC;IAED,OAAO;QACN,MAAM,EAAE,CAAC,IAAgB,EAAoC,EAAE;YAC9D,MAAM,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;YACnC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACpC,CAAC;QAED,KAAK,CAAC,QAAQ,CACb,IAAgB,EAChB,OAA+B;YAE/B,MAAM,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;YACnC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC1B,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACpC,CAAC;KACD,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACU,QAAA,UAAU,GAAG,oBAAoB,CAAC,EAAE,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,oBAAoB,CACnC,OAA0B;IAE1B,MAAM,mBAAmB,GAA+B;QACvD,IAAI,EAAE,+CAAqB;QAC3B,UAAU,EAAE,8CAAoB;QAChC,sBAAsB,EAAE,mBAAmB;QAC3C,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC;KACnC,CAAC;IAEF,OAAO,IAAA,+BAAoB,EAAQ,mBAAmB,CAAC,CAAC;AACzD,CAAC;AAXD,oDAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport {\n\ttype ISharedObject,\n\ttype ISharedObjectKind,\n\tmakeSharedObjectKind,\n\ttype KernelArgs,\n\ttype SharedKernelFactory,\n\ttype SharedObjectOptions,\n\ttype FactoryOut,\n} from \"@fluidframework/shared-object-base/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tSharedTreeKernel,\n\ttype ITreePrivate,\n\ttype SharedTreeOptions,\n\ttype SharedTreeOptionsInternal,\n\ttype SharedTreeKernelView,\n} from \"./shared-tree/index.js\";\nimport { SharedTreeFactoryType, SharedTreeAttributes } from \"./sharedTreeAttributes.js\";\nimport type { ITree } from \"./simple-tree/index.js\";\nimport { Breakable } from \"./util/index.js\";\nimport { FluidClientVersion } from \"./codec/index.js\";\n\n/**\n * {@link ITreePrivate} extended with ISharedObject.\n * @remarks\n * This is used when integration testing this package with the Fluid runtime as it exposes the APIs the runtime consumes to manipulate the tree.\n */\nexport interface ISharedTree extends ISharedObject, ITreePrivate {}\n\n/**\n * Creates a factory for shared tree kernels with the given options.\n * @remarks\n * Exposes {@link ITreePrivate} to allow access to internals in tests without a cast.\n * Code exposing this beyond this package will need to update to a more public type.\n */\nfunction treeKernelFactory(\n\toptions: SharedTreeOptionsInternal,\n): SharedKernelFactory<SharedTreeKernelView> {\n\tfunction treeFromKernelArgs(args: KernelArgs): SharedTreeKernel {\n\t\tif (args.idCompressor === undefined) {\n\t\t\tthrow new UsageError(\"IdCompressor must be enabled to use SharedTree\");\n\t\t}\n\t\tconst adjustedOptions = { ...options };\n\t\t// TODO: get default from runtime once something like runtime.oldestCompatibleClient exists.\n\t\t// Using default of 2.0 since that is the oldest version that supports SharedTree.\n\t\tadjustedOptions.oldestCompatibleClient ??= FluidClientVersion.v2_0;\n\t\treturn new SharedTreeKernel(\n\t\t\tnew Breakable(\"SharedTree\"),\n\t\t\targs.sharedObject,\n\t\t\targs.serializer,\n\t\t\targs.submitLocalMessage,\n\t\t\targs.lastSequenceNumber,\n\t\t\targs.logger,\n\t\t\targs.idCompressor,\n\t\t\tadjustedOptions,\n\t\t);\n\t}\n\n\treturn {\n\t\tcreate: (args: KernelArgs): FactoryOut<SharedTreeKernelView> => {\n\t\t\tconst k = treeFromKernelArgs(args);\n\t\t\treturn { kernel: k, view: k.view };\n\t\t},\n\n\t\tasync loadCore(\n\t\t\targs: KernelArgs,\n\t\t\tstorage: IChannelStorageService,\n\t\t): Promise<FactoryOut<SharedTreeKernelView>> {\n\t\t\tconst k = treeFromKernelArgs(args);\n\t\t\tawait k.loadCore(storage);\n\t\t\treturn { kernel: k, view: k.view };\n\t\t},\n\t};\n}\n\n/**\n * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees\n * of objects, arrays, and other data types.\n * @legacy\n * @alpha\n */\nexport const SharedTree = configuredSharedTree({});\n\n/**\n * {@link SharedTree} but allowing a non-default configuration.\n * @remarks\n * This is useful for debugging and testing to opt into extra validation or see if opting out of some optimizations fixes an issue.\n * @example\n * ```typescript\n * import {\n * \tForestType,\n * \tTreeCompressionStrategy,\n * \tconfiguredSharedTree,\n * \ttypeboxValidator,\n * } from \"@fluidframework/tree/internal\";\n * const SharedTree = configuredSharedTree({\n * \tforest: ForestTypeReference,\n * \tjsonValidator: typeboxValidator,\n * \ttreeEncodeType: TreeCompressionStrategy.Uncompressed,\n * });\n * ```\n * @privateRemarks\n * This should be legacy, but has to be internal due to limitations of API tagging preventing it from being both alpha and alpha+legacy.\n * TODO:\n * Expose Ajv validator for better error message quality somehow.\n * Maybe as part of a test utils or dev-tool package?\n * @internal\n */\nexport function configuredSharedTree(\n\toptions: SharedTreeOptions,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\tconst sharedObjectOptions: SharedObjectOptions<ITree> = {\n\t\ttype: SharedTreeFactoryType,\n\t\tattributes: SharedTreeAttributes,\n\t\ttelemetryContextPrefix: \"fluid_sharedTree_\",\n\t\tfactory: treeKernelFactory(options),\n\t};\n\n\treturn makeSharedObjectKind<ITree>(sharedObjectOptions);\n}\n"]}
1
+ {"version":3,"file":"treeFactory.js","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,0EAQqD;AACrD,uEAAsE;AAEtE,qDAMgC;AAChC,uEAAwF;AAExF,8CAA4C;AAC5C,+CAAsD;AAStD;;;;;GAKG;AACH,SAAS,iBAAiB,CACzB,OAAkC;IAElC,SAAS,kBAAkB,CAAC,IAAgB;QAC3C,IAAI,IAAI,C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B;QAC3C,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC;KACnC,CAAC;IAEF,OAAO,IAAA,+BAAoB,EAAQ,mBAAmB,CAAC,CAAC;AACzD,CAAC;AAXD,oDAWC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport {\n\ttype ISharedObject,\n\ttype ISharedObjectKind,\n\tmakeSharedObjectKind,\n\ttype KernelArgs,\n\ttype SharedKernelFactory,\n\ttype SharedObjectOptions,\n\ttype FactoryOut,\n} from \"@fluidframework/shared-object-base/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tSharedTreeKernel,\n\ttype ITreePrivate,\n\ttype SharedTreeOptions,\n\ttype SharedTreeOptionsInternal,\n\ttype SharedTreeKernelView,\n} from \"./shared-tree/index.js\";\nimport { SharedTreeFactoryType, SharedTreeAttributes } from \"./sharedTreeAttributes.js\";\nimport type { ITree } from \"./simple-tree/index.js\";\nimport { Breakable } from \"./util/index.js\";\nimport { FluidClientVersion } from \"./codec/index.js\";\n\n/**\n * {@link ITreePrivate} extended with ISharedObject.\n * @remarks\n * This is used when integration testing this package with the Fluid runtime as it exposes the APIs the runtime consumes to manipulate the tree.\n */\nexport interface ISharedTree extends ISharedObject, ITreePrivate {}\n\n/**\n * Creates a factory for shared tree kernels with the given options.\n * @remarks\n * Exposes {@link ITreePrivate} to allow access to internals in tests without a cast.\n * Code exposing this beyond this package will need to update to a more public type.\n */\nfunction treeKernelFactory(\n\toptions: SharedTreeOptionsInternal,\n): SharedKernelFactory<SharedTreeKernelView> {\n\tfunction treeFromKernelArgs(args: KernelArgs): SharedTreeKernel {\n\t\tif (args.idCompressor === undefined) {\n\t\t\tthrow new UsageError(\"IdCompressor must be enabled to use SharedTree\");\n\t\t}\n\t\tconst adjustedOptions = { ...options };\n\t\t// TODO: get default from runtime once something like runtime.oldestCompatibleClient exists.\n\t\t// Using default of 2.0 since that is the oldest version that supports SharedTree.\n\t\tadjustedOptions.oldestCompatibleClient ??= FluidClientVersion.v2_0;\n\t\treturn new SharedTreeKernel(\n\t\t\tnew Breakable(\"SharedTree\"),\n\t\t\targs.sharedObject,\n\t\t\targs.serializer,\n\t\t\targs.submitLocalMessage,\n\t\t\targs.lastSequenceNumber,\n\t\t\targs.logger,\n\t\t\targs.idCompressor,\n\t\t\tadjustedOptions,\n\t\t);\n\t}\n\n\treturn {\n\t\tcreate: (args: KernelArgs): FactoryOut<SharedTreeKernelView> => {\n\t\t\tconst k = treeFromKernelArgs(args);\n\t\t\treturn { kernel: k, view: k.view };\n\t\t},\n\n\t\tasync loadCore(\n\t\t\targs: KernelArgs,\n\t\t\tstorage: IChannelStorageService,\n\t\t): Promise<FactoryOut<SharedTreeKernelView>> {\n\t\t\tconst k = treeFromKernelArgs(args);\n\t\t\tawait k.loadCore(storage);\n\t\t\treturn { kernel: k, view: k.view };\n\t\t},\n\t};\n}\n\n/**\n * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees\n * of objects, arrays, and other data types.\n * @legacy @beta\n */\nexport const SharedTree = configuredSharedTree({});\n\n/**\n * {@link SharedTree} but allowing a non-default configuration.\n * @remarks\n * This is useful for debugging and testing to opt into extra validation or see if opting out of some optimizations fixes an issue.\n * @example\n * ```typescript\n * import {\n * \tForestType,\n * \tTreeCompressionStrategy,\n * \tconfiguredSharedTree,\n * \ttypeboxValidator,\n * } from \"@fluidframework/tree/internal\";\n * const SharedTree = configuredSharedTree({\n * \tforest: ForestTypeReference,\n * \tjsonValidator: typeboxValidator,\n * \ttreeEncodeType: TreeCompressionStrategy.Uncompressed,\n * });\n * ```\n * @privateRemarks\n * This should be legacy, but has to be internal due to limitations of API tagging preventing it from being both alpha and alpha+legacy.\n * TODO:\n * Expose Ajv validator for better error message quality somehow.\n * Maybe as part of a test utils or dev-tool package?\n * @internal\n */\nexport function configuredSharedTree(\n\toptions: SharedTreeOptions,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\tconst sharedObjectOptions: SharedObjectOptions<ITree> = {\n\t\ttype: SharedTreeFactoryType,\n\t\tattributes: SharedTreeAttributes,\n\t\ttelemetryContextPrefix: \"fluid_sharedTree_\",\n\t\tfactory: treeKernelFactory(options),\n\t};\n\n\treturn makeSharedObjectKind<ITree>(sharedObjectOptions);\n}\n"]}
package/lib/alpha.d.ts CHANGED
@@ -89,8 +89,11 @@ export {
89
89
  typeSchemaSymbol,
90
90
 
91
91
  // @beta APIs
92
+ ForestOptions,
93
+ ForestType,
92
94
  NodeChangedData,
93
95
  PopUnion,
96
+ SchemaFactoryBeta,
94
97
  TreeBeta,
95
98
  TreeChangeEventsBeta,
96
99
  UnionToTuple,
@@ -117,11 +120,12 @@ export {
117
120
  FieldSchemaAlphaUnsafe,
118
121
  FixRecursiveArraySchema,
119
122
  FluidClientVersion,
120
- ForestOptions,
121
- ForestType,
122
123
  ForestTypeExpensiveDebug,
123
124
  ForestTypeOptimized,
124
125
  ForestTypeReference,
126
+ FormatValidator,
127
+ FormatValidatorBasic,
128
+ FormatValidatorNoOp,
125
129
  HandleConverter,
126
130
  ICodecOptions,
127
131
  ITreeAlpha,
@@ -153,6 +157,7 @@ export {
153
157
  JsonStringKeyPatternProperties,
154
158
  JsonTreeSchema,
155
159
  JsonValidator,
160
+ KeyEncodingOptions,
156
161
  MapNodeCustomizableSchema,
157
162
  MapNodeCustomizableSchemaUnsafe,
158
163
  MapNodePojoEmulationSchema,
@@ -205,6 +210,7 @@ export {
205
210
  TreeIndex,
206
211
  TreeIndexKey,
207
212
  TreeIndexNodes,
213
+ TreeParsingOptions,
208
214
  TreeRecordNode,
209
215
  TreeRecordNodeUnsafe,
210
216
  TreeSchema,
package/lib/beta.d.ts CHANGED
@@ -89,8 +89,11 @@ export {
89
89
  typeSchemaSymbol,
90
90
 
91
91
  // @beta APIs
92
+ ForestOptions,
93
+ ForestType,
92
94
  NodeChangedData,
93
95
  PopUnion,
96
+ SchemaFactoryBeta,
94
97
  TreeBeta,
95
98
  TreeChangeEventsBeta,
96
99
  UnionToTuple,
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import type { ErasedType } from "@fluidframework/core-interfaces/internal";
5
6
  import { IsoBuffer } from "@fluid-internal/client-utils";
6
7
  import type { Static, TAnySchema, TSchema } from "@sinclair/typebox";
7
8
  import type { ChangeEncodingContext } from "../core/index.js";
@@ -37,6 +38,39 @@ export interface SchemaValidationFunction<Schema extends TSchema> {
37
38
  */
38
39
  check(data: unknown): data is Static<Schema>;
39
40
  }
41
+ /**
42
+ * A kind of validator for SharedTree's internal data formats.
43
+ * @remarks
44
+ * Assuming no data corruption or type confusion, such validation should never fail.
45
+ * Any client version compatibility issues should instead be detected by the data format versioning which Shared Tree does internally independent of data format validation.
46
+ * However, persisted data can sometimes be corrupted, bugs can produce invalid data, or users can mix up which data is compatible with which APIs.
47
+ * In such cases, a format validator can help catch issues.
48
+ *
49
+ * Current options are {@link FormatValidatorNoOp} and {@link FormatValidatorBasic}.
50
+ * @privateRemarks
51
+ * Implement using {@link toFormatValidator}.
52
+ * Consume using {@link extractJsonValidator}.
53
+ *
54
+ * Exposing this as the stable API entry point (instead of {@link JsonValidator}) means that we avoid leaking the reference to TypeBox to the API surface.
55
+ * Additionally, if we adopt non JSON formats, we can just update the validators as needed without breaking the API.
56
+ * This also allows us to avoid stabilizing or documenting how handles interact with JSON validation since that is not exposed through this type.
57
+ * @sealed @alpha
58
+ */
59
+ export interface FormatValidator extends ErasedType<"FormatValidator"> {
60
+ }
61
+ /**
62
+ * A {@link FormatValidator} which does no validation.
63
+ * @alpha
64
+ */
65
+ export declare const FormatValidatorNoOp: FormatValidator;
66
+ /**
67
+ * Type erase a {@link JsonValidator} to a {@link FormatValidator}.
68
+ */
69
+ export declare function toFormatValidator(factory: JsonValidator): FormatValidator;
70
+ /**
71
+ * Un-type-erase the {@link FormatValidator}.
72
+ */
73
+ export declare function extractJsonValidator(input: FormatValidator | JsonValidator): JsonValidator;
40
74
  /**
41
75
  * JSON schema validator compliant with draft 6 schema. See https://json-schema.org.
42
76
  * @alpha @input
@@ -61,19 +95,22 @@ export interface JsonValidator {
61
95
  */
62
96
  export interface ICodecOptions {
63
97
  /**
64
- * {@link JsonValidator} which SharedTree uses to validate persisted data it reads & writes
98
+ * {@link FormatValidator} which SharedTree uses to validate persisted data it reads & writes
65
99
  * matches the expected encoded format (i.e. the wire format for ops and summaries).
66
- *
67
- * See {@link noopValidator} and {@link typeboxValidator} for out-of-the-box implementations.
100
+ * @remarks
101
+ * See {@link FormatValidatorNoOp} and {@link FormatValidatorBasic} for out-of-the-box implementations.
68
102
  *
69
103
  * This option is not "on-by-default" because JSON schema validation comes with a small but noticeable
70
104
  * runtime performance cost, and popular schema validation libraries have relatively large bundle size.
71
105
  *
72
- * SharedTree users are still encouraged to use a non-trivial validator (i.e. not `noopValidator`)
106
+ * SharedTree users are still encouraged to use a non-trivial validator (i.e. not `FormatValidatorNoOp`)
73
107
  * whenever reasonable: it gives better fail-fast behavior when unexpected encoded data is found,
74
108
  * which reduces the risk of unrecoverable data corruption.
109
+ *
110
+ * Use of {@link JsonValidator} here is deprecated and will be removed:
111
+ * it is recommended to use {@link FormatValidator} instead.
75
112
  */
76
- readonly jsonValidator: JsonValidator;
113
+ readonly jsonValidator: JsonValidator | FormatValidator;
77
114
  }
78
115
  /**
79
116
  * Options relating to encoding of persisted data.
@@ -199,7 +236,7 @@ export declare const unitCodec: IMultiFormatCodec<0, JsonCompatibleReadOnly, Jso
199
236
  * Wraps a codec with JSON schema validation for its encoded type.
200
237
  * @returns An {@link IJsonCodec} which validates the data it encodes and decodes matches the provided schema.
201
238
  */
202
- export declare function withSchemaValidation<TInMemoryFormat, EncodedSchema extends TSchema, TEncodedFormat = JsonCompatibleReadOnly, TValidate = TEncodedFormat, TContext = ChangeEncodingContext>(schema: EncodedSchema, codec: IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext>, validator?: JsonValidator): IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext>;
239
+ export declare function withSchemaValidation<TInMemoryFormat, EncodedSchema extends TSchema, TEncodedFormat = JsonCompatibleReadOnly, TValidate = TEncodedFormat, TContext = ChangeEncodingContext>(schema: EncodedSchema, codec: IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext>, validator?: JsonValidator | FormatValidator): IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext>;
203
240
  /**
204
241
  * Versions of Fluid Framework client packages.
205
242
  * @remarks