@fluidframework/tree 2.72.0 → 2.73.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 (609) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/api-report/tree.alpha.api.md +17 -30
  3. package/dist/alpha.d.ts +3 -1
  4. package/dist/api.d.ts +6 -2
  5. package/dist/api.d.ts.map +1 -1
  6. package/dist/api.js +2 -11
  7. package/dist/api.js.map +1 -1
  8. package/dist/codec/codec.d.ts +9 -2
  9. package/dist/codec/codec.d.ts.map +1 -1
  10. package/dist/codec/codec.js +9 -2
  11. package/dist/codec/codec.js.map +1 -1
  12. package/dist/codec/index.d.ts +1 -1
  13. package/dist/codec/index.d.ts.map +1 -1
  14. package/dist/codec/index.js +2 -1
  15. package/dist/codec/index.js.map +1 -1
  16. package/dist/codec/versioned/codec.d.ts +7 -2
  17. package/dist/codec/versioned/codec.d.ts.map +1 -1
  18. package/dist/codec/versioned/codec.js +24 -1
  19. package/dist/codec/versioned/codec.js.map +1 -1
  20. package/dist/codec/versioned/index.d.ts +1 -1
  21. package/dist/codec/versioned/index.d.ts.map +1 -1
  22. package/dist/codec/versioned/index.js +2 -1
  23. package/dist/codec/versioned/index.js.map +1 -1
  24. package/dist/core/schema-stored/schema.d.ts +12 -1
  25. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  26. package/dist/core/schema-stored/schema.js.map +1 -1
  27. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  28. package/dist/core/tree/detachedFieldIndexCodecs.js +5 -3
  29. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  30. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
  31. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  32. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  34. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +1 -0
  35. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
  37. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
  40. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/codecs.js +31 -17
  42. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
  44. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -2
  46. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +156 -4
  48. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  49. package/dist/feature-libraries/chunked-forest/codec/format.js +7 -3
  50. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  51. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
  52. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  53. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
  54. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  55. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  56. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  58. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  59. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
  60. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +23 -6
  62. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
  64. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +20 -4
  66. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  67. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  68. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  69. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  70. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  71. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -17
  72. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  73. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +53 -55
  74. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  75. package/dist/feature-libraries/default-schema/index.d.ts +1 -3
  76. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  77. package/dist/feature-libraries/default-schema/index.js +2 -8
  78. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  79. package/dist/feature-libraries/forest-summary/format.d.ts +2 -2
  80. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  81. package/dist/feature-libraries/forest-summary/format.js +4 -2
  82. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  83. package/dist/feature-libraries/index.d.ts +4 -3
  84. package/dist/feature-libraries/index.d.ts.map +1 -1
  85. package/dist/feature-libraries/index.js +8 -7
  86. package/dist/feature-libraries/index.js.map +1 -1
  87. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  88. package/dist/feature-libraries/modular-schema/comparison.js +1 -2
  89. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  90. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
  91. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  92. package/dist/feature-libraries/modular-schema/fieldKind.js +29 -11
  93. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  94. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
  95. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  96. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  97. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
  98. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  99. package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -2
  100. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  101. package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
  102. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  103. package/dist/feature-libraries/modular-schema/index.js +1 -3
  104. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  105. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
  106. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  107. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  108. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
  109. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  110. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
  111. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  112. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
  113. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  114. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  115. package/dist/feature-libraries/object-forest/objectForest.js +3 -2
  116. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  117. package/dist/feature-libraries/optional-field/index.d.ts +1 -1
  118. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  119. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  120. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  121. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  122. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  123. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  124. package/dist/feature-libraries/schema-index/codec.js +5 -3
  125. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  126. package/dist/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
  127. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -0
  128. package/dist/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
  129. package/dist/feature-libraries/schemaChecker.js.map +1 -0
  130. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  131. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
  132. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  133. package/dist/index.d.ts +2 -2
  134. package/dist/index.d.ts.map +1 -1
  135. package/dist/index.js +5 -3
  136. package/dist/index.js.map +1 -1
  137. package/dist/packageVersion.d.ts +1 -1
  138. package/dist/packageVersion.js +1 -1
  139. package/dist/packageVersion.js.map +1 -1
  140. package/dist/shared-tree/index.d.ts +1 -1
  141. package/dist/shared-tree/index.d.ts.map +1 -1
  142. package/dist/shared-tree/index.js +1 -2
  143. package/dist/shared-tree/index.js.map +1 -1
  144. package/dist/shared-tree/sharedTree.d.ts +0 -44
  145. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  146. package/dist/shared-tree/sharedTree.js +1 -52
  147. package/dist/shared-tree/sharedTree.js.map +1 -1
  148. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  149. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  150. package/dist/shared-tree/sharedTreeChangeCodecs.js +0 -2
  151. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  152. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  153. package/dist/shared-tree-core/editManagerCodecs.js +12 -6
  154. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  155. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +3 -4
  156. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  157. package/dist/shared-tree-core/editManagerFormatCommons.js +5 -8
  158. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  159. package/dist/shared-tree-core/index.d.ts +2 -2
  160. package/dist/shared-tree-core/index.d.ts.map +1 -1
  161. package/dist/shared-tree-core/index.js +3 -2
  162. package/dist/shared-tree-core/index.js.map +1 -1
  163. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  164. package/dist/shared-tree-core/messageCodecs.js +20 -9
  165. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  166. package/dist/shared-tree-core/messageFormat.d.ts +4 -6
  167. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  168. package/dist/shared-tree-core/messageFormat.js +9 -7
  169. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  170. package/dist/simple-tree/api/configuration.d.ts +2 -0
  171. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  172. package/dist/simple-tree/api/configuration.js +10 -0
  173. package/dist/simple-tree/api/configuration.js.map +1 -1
  174. package/dist/simple-tree/api/index.d.ts +1 -0
  175. package/dist/simple-tree/api/index.d.ts.map +1 -1
  176. package/dist/simple-tree/api/index.js +5 -1
  177. package/dist/simple-tree/api/index.js.map +1 -1
  178. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  179. package/dist/simple-tree/api/schemaFromSimple.js +7 -1
  180. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  181. package/dist/simple-tree/api/simpleSchemaCodec.js +4 -6
  182. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  183. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
  184. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
  185. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +128 -0
  186. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
  187. package/dist/simple-tree/api/tree.d.ts +1 -1
  188. package/dist/simple-tree/api/tree.js +1 -1
  189. package/dist/simple-tree/api/tree.js.map +1 -1
  190. package/dist/simple-tree/core/allowedTypes.js +1 -1
  191. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  192. package/dist/simple-tree/core/index.d.ts +3 -3
  193. package/dist/simple-tree/core/index.d.ts.map +1 -1
  194. package/dist/simple-tree/core/index.js +3 -1
  195. package/dist/simple-tree/core/index.js.map +1 -1
  196. package/dist/simple-tree/core/toStored.d.ts +12 -5
  197. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  198. package/dist/simple-tree/core/toStored.js +26 -10
  199. package/dist/simple-tree/core/toStored.js.map +1 -1
  200. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -6
  201. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  202. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  203. package/dist/simple-tree/core/treeNodeValid.d.ts +1 -1
  204. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  205. package/dist/simple-tree/core/treeNodeValid.js +1 -2
  206. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  207. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  208. package/dist/simple-tree/fieldSchema.js +1 -8
  209. package/dist/simple-tree/fieldSchema.js.map +1 -1
  210. package/dist/simple-tree/index.d.ts +2 -2
  211. package/dist/simple-tree/index.d.ts.map +1 -1
  212. package/dist/simple-tree/index.js +9 -3
  213. package/dist/simple-tree/index.js.map +1 -1
  214. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  215. package/dist/simple-tree/leafNodeSchema.js +0 -1
  216. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  217. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  218. package/dist/simple-tree/node-kinds/array/arrayNode.js +13 -49
  219. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  220. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  221. package/dist/simple-tree/node-kinds/map/mapNode.js +1 -5
  222. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  223. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  224. package/dist/simple-tree/node-kinds/object/objectNode.js +2 -10
  225. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  226. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  227. package/dist/simple-tree/node-kinds/record/recordNode.js +1 -5
  228. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  229. package/dist/simple-tree/simpleSchema.d.ts +15 -3
  230. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  231. package/dist/simple-tree/simpleSchema.js.map +1 -1
  232. package/dist/simple-tree/toStoredSchema.d.ts +20 -8
  233. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  234. package/dist/simple-tree/toStoredSchema.js +27 -22
  235. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  236. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  237. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +18 -15
  238. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  239. package/dist/tableSchema.d.ts +22 -52
  240. package/dist/tableSchema.d.ts.map +1 -1
  241. package/dist/tableSchema.js +141 -277
  242. package/dist/tableSchema.js.map +1 -1
  243. package/dist/util/arrayUtilities.d.ts +45 -0
  244. package/dist/util/arrayUtilities.d.ts.map +1 -0
  245. package/dist/util/arrayUtilities.js +76 -0
  246. package/dist/util/arrayUtilities.js.map +1 -0
  247. package/dist/util/index.d.ts +1 -0
  248. package/dist/util/index.d.ts.map +1 -1
  249. package/dist/util/index.js +7 -2
  250. package/dist/util/index.js.map +1 -1
  251. package/lib/alpha.d.ts +3 -1
  252. package/lib/api.d.ts +6 -2
  253. package/lib/api.d.ts.map +1 -1
  254. package/lib/api.js +2 -13
  255. package/lib/api.js.map +1 -1
  256. package/lib/codec/codec.d.ts +9 -2
  257. package/lib/codec/codec.d.ts.map +1 -1
  258. package/lib/codec/codec.js +9 -2
  259. package/lib/codec/codec.js.map +1 -1
  260. package/lib/codec/index.d.ts +1 -1
  261. package/lib/codec/index.d.ts.map +1 -1
  262. package/lib/codec/index.js +1 -1
  263. package/lib/codec/index.js.map +1 -1
  264. package/lib/codec/versioned/codec.d.ts +7 -2
  265. package/lib/codec/versioned/codec.d.ts.map +1 -1
  266. package/lib/codec/versioned/codec.js +22 -0
  267. package/lib/codec/versioned/codec.js.map +1 -1
  268. package/lib/codec/versioned/index.d.ts +1 -1
  269. package/lib/codec/versioned/index.d.ts.map +1 -1
  270. package/lib/codec/versioned/index.js +1 -1
  271. package/lib/codec/versioned/index.js.map +1 -1
  272. package/lib/core/schema-stored/schema.d.ts +12 -1
  273. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  274. package/lib/core/schema-stored/schema.js.map +1 -1
  275. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  276. package/lib/core/tree/detachedFieldIndexCodecs.js +5 -3
  277. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  278. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
  279. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  280. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  281. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  282. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +2 -1
  283. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  284. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
  285. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  286. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  287. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +1 -1
  288. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  289. package/lib/feature-libraries/chunked-forest/codec/codecs.js +34 -20
  290. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  291. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
  292. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  293. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -2
  294. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  295. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +156 -4
  296. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  297. package/lib/feature-libraries/chunked-forest/codec/format.js +6 -2
  298. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  299. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
  300. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  301. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
  302. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  303. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  304. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  305. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  306. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  307. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
  308. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  309. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +22 -6
  310. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  311. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
  312. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  313. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +17 -2
  314. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  315. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  316. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  317. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  318. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  319. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -17
  320. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  321. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +55 -57
  322. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  323. package/lib/feature-libraries/default-schema/index.d.ts +1 -3
  324. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  325. package/lib/feature-libraries/default-schema/index.js +1 -3
  326. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  327. package/lib/feature-libraries/forest-summary/format.d.ts +2 -2
  328. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  329. package/lib/feature-libraries/forest-summary/format.js +4 -2
  330. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  331. package/lib/feature-libraries/index.d.ts +4 -3
  332. package/lib/feature-libraries/index.d.ts.map +1 -1
  333. package/lib/feature-libraries/index.js +4 -3
  334. package/lib/feature-libraries/index.js.map +1 -1
  335. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  336. package/lib/feature-libraries/modular-schema/comparison.js +1 -2
  337. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  338. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
  339. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  340. package/lib/feature-libraries/modular-schema/fieldKind.js +29 -11
  341. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  342. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
  343. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  344. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  345. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
  346. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  347. package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -2
  348. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  349. package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
  350. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  351. package/lib/feature-libraries/modular-schema/index.js +0 -1
  352. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  353. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
  354. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  355. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  356. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
  357. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  358. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
  359. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  360. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
  361. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  362. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  363. package/lib/feature-libraries/object-forest/objectForest.js +2 -1
  364. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  365. package/lib/feature-libraries/optional-field/index.d.ts +1 -1
  366. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  367. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  368. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  369. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  370. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  371. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  372. package/lib/feature-libraries/schema-index/codec.js +5 -3
  373. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  374. package/lib/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
  375. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -0
  376. package/lib/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
  377. package/lib/feature-libraries/schemaChecker.js.map +1 -0
  378. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  379. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
  380. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  381. package/lib/index.d.ts +2 -2
  382. package/lib/index.d.ts.map +1 -1
  383. package/lib/index.js +2 -2
  384. package/lib/index.js.map +1 -1
  385. package/lib/packageVersion.d.ts +1 -1
  386. package/lib/packageVersion.js +1 -1
  387. package/lib/packageVersion.js.map +1 -1
  388. package/lib/shared-tree/index.d.ts +1 -1
  389. package/lib/shared-tree/index.d.ts.map +1 -1
  390. package/lib/shared-tree/index.js +1 -1
  391. package/lib/shared-tree/index.js.map +1 -1
  392. package/lib/shared-tree/sharedTree.d.ts +0 -44
  393. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  394. package/lib/shared-tree/sharedTree.js +0 -51
  395. package/lib/shared-tree/sharedTree.js.map +1 -1
  396. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  397. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  398. package/lib/shared-tree/sharedTreeChangeCodecs.js +0 -2
  399. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  400. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  401. package/lib/shared-tree-core/editManagerCodecs.js +13 -7
  402. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  403. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +3 -4
  404. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  405. package/lib/shared-tree-core/editManagerFormatCommons.js +4 -7
  406. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  407. package/lib/shared-tree-core/index.d.ts +2 -2
  408. package/lib/shared-tree-core/index.d.ts.map +1 -1
  409. package/lib/shared-tree-core/index.js +2 -2
  410. package/lib/shared-tree-core/index.js.map +1 -1
  411. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  412. package/lib/shared-tree-core/messageCodecs.js +21 -10
  413. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  414. package/lib/shared-tree-core/messageFormat.d.ts +4 -6
  415. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  416. package/lib/shared-tree-core/messageFormat.js +8 -6
  417. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  418. package/lib/simple-tree/api/configuration.d.ts +2 -0
  419. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  420. package/lib/simple-tree/api/configuration.js +10 -0
  421. package/lib/simple-tree/api/configuration.js.map +1 -1
  422. package/lib/simple-tree/api/index.d.ts +1 -0
  423. package/lib/simple-tree/api/index.d.ts.map +1 -1
  424. package/lib/simple-tree/api/index.js +1 -0
  425. package/lib/simple-tree/api/index.js.map +1 -1
  426. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  427. package/lib/simple-tree/api/schemaFromSimple.js +8 -2
  428. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  429. package/lib/simple-tree/api/simpleSchemaCodec.js +5 -7
  430. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  431. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
  432. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
  433. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +122 -0
  434. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
  435. package/lib/simple-tree/api/tree.d.ts +1 -1
  436. package/lib/simple-tree/api/tree.js +1 -1
  437. package/lib/simple-tree/api/tree.js.map +1 -1
  438. package/lib/simple-tree/core/allowedTypes.js +1 -1
  439. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  440. package/lib/simple-tree/core/index.d.ts +3 -3
  441. package/lib/simple-tree/core/index.d.ts.map +1 -1
  442. package/lib/simple-tree/core/index.js +2 -2
  443. package/lib/simple-tree/core/index.js.map +1 -1
  444. package/lib/simple-tree/core/toStored.d.ts +12 -5
  445. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  446. package/lib/simple-tree/core/toStored.js +25 -9
  447. package/lib/simple-tree/core/toStored.js.map +1 -1
  448. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -6
  449. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  450. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  451. package/lib/simple-tree/core/treeNodeValid.d.ts +1 -1
  452. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  453. package/lib/simple-tree/core/treeNodeValid.js +1 -2
  454. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  455. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  456. package/lib/simple-tree/fieldSchema.js +2 -9
  457. package/lib/simple-tree/fieldSchema.js.map +1 -1
  458. package/lib/simple-tree/index.d.ts +2 -2
  459. package/lib/simple-tree/index.d.ts.map +1 -1
  460. package/lib/simple-tree/index.js +2 -2
  461. package/lib/simple-tree/index.js.map +1 -1
  462. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  463. package/lib/simple-tree/leafNodeSchema.js +1 -2
  464. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  465. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  466. package/lib/simple-tree/node-kinds/array/arrayNode.js +15 -51
  467. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  468. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  469. package/lib/simple-tree/node-kinds/map/mapNode.js +3 -7
  470. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  471. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  472. package/lib/simple-tree/node-kinds/object/objectNode.js +3 -11
  473. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  474. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  475. package/lib/simple-tree/node-kinds/record/recordNode.js +3 -7
  476. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  477. package/lib/simple-tree/simpleSchema.d.ts +15 -3
  478. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  479. package/lib/simple-tree/simpleSchema.js.map +1 -1
  480. package/lib/simple-tree/toStoredSchema.d.ts +20 -8
  481. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  482. package/lib/simple-tree/toStoredSchema.js +28 -24
  483. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  484. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  485. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +20 -17
  486. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  487. package/lib/tableSchema.d.ts +22 -52
  488. package/lib/tableSchema.d.ts.map +1 -1
  489. package/lib/tableSchema.js +143 -279
  490. package/lib/tableSchema.js.map +1 -1
  491. package/lib/util/arrayUtilities.d.ts +45 -0
  492. package/lib/util/arrayUtilities.d.ts.map +1 -0
  493. package/lib/util/arrayUtilities.js +69 -0
  494. package/lib/util/arrayUtilities.js.map +1 -0
  495. package/lib/util/index.d.ts +1 -0
  496. package/lib/util/index.d.ts.map +1 -1
  497. package/lib/util/index.js +1 -0
  498. package/lib/util/index.js.map +1 -1
  499. package/package.json +21 -21
  500. package/src/api.ts +22 -11
  501. package/src/codec/codec.ts +10 -2
  502. package/src/codec/index.ts +1 -0
  503. package/src/codec/versioned/codec.ts +40 -2
  504. package/src/codec/versioned/index.ts +1 -0
  505. package/src/core/schema-stored/schema.ts +12 -1
  506. package/src/core/tree/detachedFieldIndexCodecs.ts +10 -3
  507. package/src/feature-libraries/README.md +1 -1
  508. package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -3
  509. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +5 -0
  510. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -1
  511. package/src/feature-libraries/chunked-forest/codec/codecs.ts +52 -19
  512. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +8 -3
  513. package/src/feature-libraries/chunked-forest/codec/format.ts +14 -4
  514. package/src/feature-libraries/chunked-forest/codec/formatGeneric.ts +7 -2
  515. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -4
  516. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +62 -9
  517. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +24 -2
  518. package/src/feature-libraries/chunked-forest/index.ts +1 -1
  519. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +86 -74
  520. package/src/feature-libraries/default-schema/index.ts +1 -9
  521. package/src/feature-libraries/forest-summary/format.ts +15 -9
  522. package/src/feature-libraries/index.ts +7 -5
  523. package/src/feature-libraries/modular-schema/comparison.ts +2 -3
  524. package/src/feature-libraries/modular-schema/fieldKind.ts +90 -13
  525. package/src/feature-libraries/modular-schema/fieldKindConfiguration.ts +2 -3
  526. package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -6
  527. package/src/feature-libraries/modular-schema/index.ts +0 -1
  528. package/src/feature-libraries/modular-schema/isNeverTree.ts +7 -8
  529. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +13 -13
  530. package/src/feature-libraries/object-forest/objectForest.ts +2 -6
  531. package/src/feature-libraries/optional-field/index.ts +1 -0
  532. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +1 -5
  533. package/src/feature-libraries/schema-index/codec.ts +10 -3
  534. package/src/feature-libraries/{default-schema/schemaChecker.ts → schemaChecker.ts} +4 -4
  535. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +0 -2
  536. package/src/index.ts +3 -1
  537. package/src/packageVersion.ts +1 -1
  538. package/src/shared-tree/index.ts +0 -1
  539. package/src/shared-tree/sharedTree.ts +0 -70
  540. package/src/shared-tree/sharedTreeChangeCodecs.ts +1 -6
  541. package/src/shared-tree-core/editManagerCodecs.ts +19 -7
  542. package/src/shared-tree-core/editManagerFormatCommons.ts +11 -12
  543. package/src/shared-tree-core/index.ts +6 -2
  544. package/src/shared-tree-core/messageCodecs.ts +32 -17
  545. package/src/shared-tree-core/messageFormat.ts +8 -6
  546. package/src/simple-tree/api/configuration.ts +17 -4
  547. package/src/simple-tree/api/index.ts +5 -0
  548. package/src/simple-tree/api/schemaFromSimple.ts +14 -6
  549. package/src/simple-tree/api/simpleSchemaCodec.ts +10 -9
  550. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +135 -0
  551. package/src/simple-tree/api/tree.ts +1 -1
  552. package/src/simple-tree/core/allowedTypes.ts +1 -1
  553. package/src/simple-tree/core/index.ts +3 -1
  554. package/src/simple-tree/core/toStored.ts +42 -18
  555. package/src/simple-tree/core/treeNodeSchema.ts +1 -7
  556. package/src/simple-tree/core/treeNodeValid.ts +0 -2
  557. package/src/simple-tree/fieldSchema.ts +2 -11
  558. package/src/simple-tree/index.ts +6 -1
  559. package/src/simple-tree/leafNodeSchema.ts +1 -2
  560. package/src/simple-tree/node-kinds/array/arrayNode.ts +26 -75
  561. package/src/simple-tree/node-kinds/map/mapNode.ts +1 -15
  562. package/src/simple-tree/node-kinds/object/objectNode.ts +2 -17
  563. package/src/simple-tree/node-kinds/record/recordNode.ts +1 -15
  564. package/src/simple-tree/simpleSchema.ts +16 -3
  565. package/src/simple-tree/toStoredSchema.ts +54 -38
  566. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +22 -17
  567. package/src/tableSchema.ts +110 -334
  568. package/src/util/arrayUtilities.ts +88 -0
  569. package/src/util/index.ts +6 -0
  570. package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
  571. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
  572. package/dist/feature-libraries/default-schema/defaultSchema.js +0 -15
  573. package/dist/feature-libraries/default-schema/defaultSchema.js.map +0 -1
  574. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
  575. package/dist/feature-libraries/default-schema/schemaChecker.js.map +0 -1
  576. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
  577. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
  578. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -76
  579. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
  580. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
  581. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
  582. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -158
  583. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
  584. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
  585. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
  586. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -245
  587. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
  588. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
  589. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
  590. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -12
  591. package/lib/feature-libraries/default-schema/defaultSchema.js.map +0 -1
  592. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
  593. package/lib/feature-libraries/default-schema/schemaChecker.js.map +0 -1
  594. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
  595. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
  596. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -71
  597. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
  598. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
  599. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
  600. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -154
  601. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
  602. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
  603. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
  604. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -241
  605. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
  606. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -15
  607. package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +0 -108
  608. package/src/feature-libraries/optional-field/optionalFieldCodecV1.ts +0 -208
  609. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +0 -344
@@ -2,10 +2,16 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
6
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
7
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
8
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
9
+ };
5
10
  import { fail } from "@fluidframework/core-utils/internal";
6
11
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
- import { Tree, TreeAlpha } from "./shared-tree/index.js";
8
- import { TreeArrayNode, SchemaFactory, isArrayNodeSchema, withBufferedTreeEvents, } from "./simple-tree/index.js";
12
+ import { TreeAlpha } from "./shared-tree/index.js";
13
+ import { TreeArrayNode, SchemaFactory, withBufferedTreeEvents, } from "./simple-tree/index.js";
14
+ import { validateIndex, validateIndexRange } from "./util/index.js";
9
15
  // Future improvement TODOs:
10
16
  // - Omit `cells` property from Row insertion type.
11
17
  // - Record-like type parameters / input parameters?
@@ -16,32 +22,10 @@ import { TreeArrayNode, SchemaFactory, isArrayNodeSchema, withBufferedTreeEvents
16
22
  * The sub-scope applied to user-provided {@link SchemaFactory}s by table schema factories.
17
23
  */
18
24
  const tableSchemaFactorySubScope = "table";
19
- /**
20
- * Gets the table containing the provided row/column node, if the node is part of a table.
21
- * @remarks Assumes that the table is the grandparent of the row/column node.
22
- */
23
- function getParentTable(rowOrColumnNode) {
24
- const rowListNode = Tree.parent(rowOrColumnNode);
25
- if (rowListNode === undefined || !isArrayNodeSchema(Tree.schema(rowListNode))) {
26
- return undefined;
27
- }
28
- const tableNode = Tree.parent(rowListNode);
29
- if (tableNode === undefined || !isTableNode(tableNode)) {
30
- return undefined;
31
- }
32
- return tableNode;
33
- }
34
25
  /**
35
26
  * A private symbol put on table schema to help identify them.
36
27
  */
37
28
  const tableSchemaSymbol = Symbol("tableNode");
38
- /**
39
- * Type-guard to determine if a node is a table node.
40
- * @remarks Uses {@link tableSchemaSymbol} to identify table nodes.
41
- */
42
- function isTableNode(node) {
43
- return tableSchemaSymbol in Tree.schema(node);
44
- }
45
29
  /**
46
30
  * Not intended for use outside of this package.
47
31
  *
@@ -59,7 +43,7 @@ export var System_TableSchema;
59
43
  * @system @alpha
60
44
  */
61
45
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
62
- function createColumnSchema(inputSchemaFactory, cellSchema, propsSchema) {
46
+ function createColumnSchema(inputSchemaFactory, propsSchema) {
63
47
  const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
64
48
  // Note: `columnFields` is broken into two parts to work around a TypeScript bug
65
49
  // that results in broken `.d.ts` output.
@@ -92,23 +76,6 @@ export var System_TableSchema;
92
76
  // Will make it easier to evolve this schema in the future.
93
77
  allowUnknownOptionalFields: true,
94
78
  }) {
95
- getCells() {
96
- const tableNode = getParentTable(this);
97
- if (tableNode === undefined) {
98
- throw new UsageError(`Column with ID "${this.id}" is not contained in a table.`);
99
- }
100
- const result = [];
101
- for (const row of tableNode.rows) {
102
- const cell = row.getCell(this.id);
103
- if (cell !== undefined) {
104
- if (!Tree.is(cell, cellSchema)) {
105
- throw new UsageError("Parent table contains a cell with incompatible with this column.");
106
- }
107
- result.push({ rowId: row.id, cell });
108
- }
109
- }
110
- return result;
111
- }
112
79
  }
113
80
  // Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
114
81
  // for the private brand field of TreeNode.
@@ -146,7 +113,7 @@ export var System_TableSchema;
146
113
  props: propsSchema,
147
114
  };
148
115
  /**
149
- * {@link Row} fields.
116
+ * {@link RowSchema} fields.
150
117
  * @remarks Extracted for re-use in returned type signature defined later in this function.
151
118
  * The implicit typing is intentional.
152
119
  * Note: ideally we would add a satisfies clause here to ensure that this satisfies
@@ -160,57 +127,17 @@ export var System_TableSchema;
160
127
  /**
161
128
  * The Row schema - this is a map of Cells where the key is the column id
162
129
  */
163
- class Row extends schemaFactory.object("Row", rowFields, {
130
+ class RowSchema extends schemaFactory.object("Row", rowFields, {
164
131
  // Will make it easier to evolve this schema in the future.
165
132
  allowUnknownOptionalFields: true,
166
133
  }) {
167
- getCell(columnOrId) {
168
- const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
169
- // Unlike most objects, RecordNodes don't have the default inherited object properties, so this is safe
170
- return this.cells[columnId];
171
- }
172
- setCell(columnOrId, value) {
173
- // TODO: throw if column does not exist in the owning table.
174
- if (value === undefined) {
175
- this.removeCell(columnOrId);
176
- }
177
- else {
178
- const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
179
- // TypeScript is unable to narrow the types correctly here, hence the casts.
180
- // See: https://github.com/microsoft/TypeScript/issues/52144
181
- this.cells[columnId] = TreeAlpha.create(cellSchema, value);
182
- }
183
- }
184
- removeCell(columnOrId) {
185
- // TODO: throw if column does not exist in the owning table.
186
- const columnId = typeof columnOrId === "string" ? columnOrId : columnOrId.id;
187
- const cell = this.getCell(columnId);
188
- if (cell === undefined) {
189
- return undefined;
190
- }
191
- // 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.
192
- delete this.cells[columnId];
193
- return cell;
194
- }
195
- getCells() {
196
- const result = [];
197
- for (const [columnId, cell] of Object.entries(this.cells)) {
198
- if (cell !== undefined) {
199
- result.push({
200
- columnId,
201
- cell,
202
- });
203
- }
204
- }
205
- return result;
206
- }
207
134
  }
208
135
  // Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly "__#124291@#brand": unknown;`
209
136
  // for the private brand field of TreeNode.
210
137
  // This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.
211
138
  // This is avoided by doing this type conversion.
212
139
  // The conversion is done via assignment instead of `as` to get stronger type safety.
213
- const RowSchemaType = Row;
140
+ const RowSchemaType = RowSchema;
214
141
  return RowSchemaType;
215
142
  }
216
143
  System_TableSchema.createRowSchema = createRowSchema;
@@ -220,6 +147,7 @@ export var System_TableSchema;
220
147
  */
221
148
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify
222
149
  function createTableSchema(inputSchemaFactory, _cellSchema, columnSchema, rowSchema) {
150
+ var _Table_instances, _a, _Table_removeCells, _Table_applyEditsInBatch, _Table_tryGetColumn, _Table_getColumn, _Table_containsColumnWithId, _Table_tryGetRow, _Table_getRow;
223
151
  const schemaFactory = inputSchemaFactory.scopedFactory(tableSchemaFactorySubScope);
224
152
  /**
225
153
  * {@link Table} fields.
@@ -237,32 +165,32 @@ export var System_TableSchema;
237
165
  // Will make it easier to evolve this schema in the future.
238
166
  allowUnknownOptionalFields: true,
239
167
  }) {
168
+ constructor() {
169
+ super(...arguments);
170
+ _Table_instances.add(this);
171
+ }
240
172
  static empty() {
241
173
  return new this({ columns: [], rows: [] });
242
174
  }
243
175
  getColumn(indexOrId) {
244
- return this._tryGetColumn(indexOrId);
176
+ return __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetColumn).call(this, indexOrId);
245
177
  }
246
178
  getRow(indexOrId) {
247
- return this._tryGetRow(indexOrId);
179
+ return __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetRow).call(this, indexOrId);
248
180
  }
249
181
  getCell(key) {
250
182
  const { column: columnOrIdOrIndex, row: rowOrIdOrIndex } = key;
251
- const row = this._tryGetRow(rowOrIdOrIndex);
183
+ const row = __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetRow).call(this, rowOrIdOrIndex);
252
184
  if (row === undefined) {
253
185
  return undefined;
254
186
  }
255
- const column = this._tryGetColumn(columnOrIdOrIndex);
187
+ const column = __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetColumn).call(this, columnOrIdOrIndex);
256
188
  if (column === undefined) {
257
189
  return undefined;
258
190
  }
259
- return row.getCell(column);
191
+ return row.cells[column.id];
260
192
  }
261
193
  insertColumns({ columns, index, }) {
262
- // Ensure index is valid
263
- if (index !== undefined) {
264
- Table.validateInsertionIndex(index, this.columns);
265
- }
266
194
  // TypeScript is unable to narrow the column type correctly here, hence the casts below.
267
195
  // See: https://github.com/microsoft/TypeScript/issues/52144
268
196
  if (index === undefined) {
@@ -270,6 +198,8 @@ export var System_TableSchema;
270
198
  this.columns.insertAtEnd(TreeArrayNode.spread(columns));
271
199
  }
272
200
  else {
201
+ // Ensure specified index is valid
202
+ validateIndex(index, this.columns, "Table.insertColumns", true);
273
203
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
274
204
  this.columns.insertAt(index, TreeArrayNode.spread(columns));
275
205
  }
@@ -278,9 +208,9 @@ export var System_TableSchema;
278
208
  }
279
209
  insertRows({ index, rows, }) {
280
210
  // #region Input validation
281
- // Ensure index is valid
211
+ // Ensure specified index is valid
282
212
  if (index !== undefined) {
283
- Table.validateInsertionIndex(index, this.rows);
213
+ validateIndex(index, this.rows, "Table.insertRows", true);
284
214
  }
285
215
  // Note: TypeScript is unable to narrow the type of the row type correctly here, hence the casts below.
286
216
  // See: https://github.com/microsoft/TypeScript/issues/52144
@@ -292,7 +222,7 @@ export var System_TableSchema;
292
222
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
293
223
  const keys = Object.keys(newRow.cells);
294
224
  for (const key of keys) {
295
- if (!this._containsColumnWithId(key)) {
225
+ if (!__classPrivateFieldGet(this, _Table_instances, "m", _Table_containsColumnWithId).call(this, key)) {
296
226
  throw new UsageError(`Attempted to insert row a cell under column ID "${key}", but the table does not contain a column with that ID.`);
297
227
  }
298
228
  }
@@ -314,31 +244,28 @@ export var System_TableSchema;
314
244
  }
315
245
  setCell({ key, cell, }) {
316
246
  const { column: columnOrId, row: rowOrId } = key;
317
- const row = this._getRow(rowOrId);
318
- const column = this._getColumn(columnOrId);
319
- row.setCell(column, cell);
247
+ const row = __classPrivateFieldGet(this, _Table_instances, "m", _Table_getRow).call(this, rowOrId);
248
+ const column = __classPrivateFieldGet(this, _Table_instances, "m", _Table_getColumn).call(this, columnOrId);
249
+ row.cells[column.id] = cell;
320
250
  }
321
251
  removeColumns(indexOrColumns, count = undefined) {
322
252
  if (typeof indexOrColumns === "number" || indexOrColumns === undefined) {
323
253
  let removedColumns;
324
254
  const startIndex = indexOrColumns ?? 0;
325
- const _count = count ?? this.columns.length - startIndex;
255
+ const endIndex = count === undefined ? this.columns.length : startIndex + count;
326
256
  // If there are no columns to remove, do nothing
327
- if (_count === 0) {
257
+ if (startIndex === endIndex) {
328
258
  return [];
329
259
  }
330
- Table._assertValidRange({ index: startIndex, count: _count }, this.columns);
331
- this._applyEditsInBatch(() => {
332
- const columnsToRemove = this.columns.slice(startIndex, startIndex + _count);
260
+ validateIndexRange(startIndex, endIndex, this.columns, "Table.removeColumns");
261
+ __classPrivateFieldGet(this, _Table_instances, "m", _Table_applyEditsInBatch).call(this, () => {
262
+ const columnsToRemove = this.columns.slice(startIndex, endIndex);
333
263
  // First, remove all cells that correspond to each column from each row:
334
264
  for (const column of columnsToRemove) {
335
- this._removeCells(column);
265
+ __classPrivateFieldGet(this, _Table_instances, "m", _Table_removeCells).call(this, column);
336
266
  }
337
267
  // Second, remove the column nodes:
338
- Table._removeRange({
339
- index: startIndex,
340
- count: _count,
341
- }, this.columns);
268
+ removeRangeFromArray(startIndex, endIndex, this.columns, "Table.removeColumns");
342
269
  removedColumns = columnsToRemove;
343
270
  });
344
271
  return removedColumns ?? fail(0xc1f /* Transaction did not complete. */);
@@ -353,9 +280,9 @@ export var System_TableSchema;
353
280
  // This improves user-facing error experience.
354
281
  const columnsToRemove = [];
355
282
  for (const columnOrIdToRemove of indexOrColumns) {
356
- columnsToRemove.push(this._getColumn(columnOrIdToRemove));
283
+ columnsToRemove.push(__classPrivateFieldGet(this, _Table_instances, "m", _Table_getColumn).call(this, columnOrIdToRemove));
357
284
  }
358
- this._applyEditsInBatch(() => {
285
+ __classPrivateFieldGet(this, _Table_instances, "m", _Table_applyEditsInBatch).call(this, () => {
359
286
  // Note, throwing an error within a transaction will abort the entire transaction.
360
287
  // So if we throw an error here for any column, no columns will be removed.
361
288
  for (const columnToRemove of columnsToRemove) {
@@ -363,7 +290,10 @@ export var System_TableSchema;
363
290
  for (const row of this.rows) {
364
291
  // TypeScript is unable to narrow the row type correctly here, hence the cast.
365
292
  // See: https://github.com/microsoft/TypeScript/issues/52144
366
- row.removeCell(columnToRemove);
293
+ this.removeCell({
294
+ column: columnToRemove,
295
+ row: row,
296
+ });
367
297
  }
368
298
  // We have already validated that all of the columns exist above, so this is safe.
369
299
  this.columns.removeAt(this.columns.indexOf(columnToRemove));
@@ -375,15 +305,12 @@ export var System_TableSchema;
375
305
  removeRows(indexOrRows, count) {
376
306
  if (typeof indexOrRows === "number" || indexOrRows === undefined) {
377
307
  const startIndex = indexOrRows ?? 0;
378
- const _count = count ?? this.columns.length - startIndex;
308
+ const endIndex = count === undefined ? this.columns.length : startIndex + count;
379
309
  // If there are no rows to remove, do nothing
380
- if (_count === 0) {
310
+ if (startIndex === endIndex) {
381
311
  return [];
382
312
  }
383
- return Table._removeRange({
384
- index: startIndex,
385
- count: _count,
386
- }, this.rows);
313
+ return removeRangeFromArray(startIndex, endIndex, this.rows, "Table.removeRows");
387
314
  }
388
315
  // If there are no rows to remove, do nothing
389
316
  if (indexOrRows.length === 0) {
@@ -394,9 +321,9 @@ export var System_TableSchema;
394
321
  // This improves user-facing error experience.
395
322
  const rowsToRemove = [];
396
323
  for (const rowToRemove of indexOrRows) {
397
- rowsToRemove.push(this._getRow(rowToRemove));
324
+ rowsToRemove.push(__classPrivateFieldGet(this, _Table_instances, "m", _Table_getRow).call(this, rowToRemove));
398
325
  }
399
- this._applyEditsInBatch(() => {
326
+ __classPrivateFieldGet(this, _Table_instances, "m", _Table_applyEditsInBatch).call(this, () => {
400
327
  // Note, throwing an error within a transaction will abort the entire transaction.
401
328
  // So if we throw an error here for any row, no rows will be removed.
402
329
  for (const rowToRemove of rowsToRemove) {
@@ -409,110 +336,16 @@ export var System_TableSchema;
409
336
  }
410
337
  removeCell(key) {
411
338
  const { column: columnOrIdOrIndex, row: rowOrIdOrIndex } = key;
412
- const row = this._getRow(rowOrIdOrIndex);
413
- const column = this._getColumn(columnOrIdOrIndex);
414
- const cell = row.getCell(column.id);
339
+ const row = __classPrivateFieldGet(this, _Table_instances, "m", _Table_getRow).call(this, rowOrIdOrIndex);
340
+ const column = __classPrivateFieldGet(this, _Table_instances, "m", _Table_getColumn).call(this, columnOrIdOrIndex);
341
+ const cell = row.cells[column.id];
415
342
  if (cell === undefined) {
416
343
  return undefined;
417
344
  }
418
- row.removeCell(column.id);
345
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
346
+ delete row.cells[column.id];
419
347
  return cell;
420
348
  }
421
- /**
422
- * Removes the cell corresponding with the specified column from each row in the table.
423
- */
424
- _removeCells(column) {
425
- for (const row of this.rows) {
426
- // TypeScript is unable to narrow the row type correctly here, hence the cast.
427
- // See: https://github.com/microsoft/TypeScript/issues/52144
428
- row.removeCell(column);
429
- }
430
- }
431
- static _assertValidRange(range, array) {
432
- const { index, count } = range;
433
- if (index < 0 || index >= array.length) {
434
- throw new UsageError(`Start index out of bounds. Expected index to be on [0, ${array.length - 1}], but got ${index}.`);
435
- }
436
- if (count < 0) {
437
- throw new UsageError(`Expected non-negative count. Got ${count}.`);
438
- }
439
- const end = index + count; // exclusive
440
- if (end > array.length) {
441
- throw new UsageError(`End index out of bounds. Expected end to be on [${index}, ${array.length}], but got ${end}.`);
442
- }
443
- }
444
- /**
445
- * Applies the provided edits in a "batch".
446
- *
447
- * @remarks
448
- * For hydrated trees, this will be done in a transaction to ensure atomicity.
449
- *
450
- * Transactions are not supported for unhydrated trees, so we cannot run a transaction in that case.
451
- * But since there are no collaborators, this is not an issue.
452
- */
453
- _applyEditsInBatch(applyEdits) {
454
- const branch = TreeAlpha.branch(this);
455
- // Ensure events are paused until all of the edits are applied.
456
- // This ensures that the user sees the corresponding table-level edit as atomic,
457
- // and ensures they are not spammed with intermediate events.
458
- withBufferedTreeEvents(() => {
459
- if (branch === undefined) {
460
- // If this node does not have a corresponding branch, then it is unhydrated.
461
- // I.e., it is not part of a collaborative session yet.
462
- // Therefore, we don't need to run the edits as a transaction.
463
- applyEdits();
464
- }
465
- else {
466
- branch.runTransaction(() => {
467
- applyEdits();
468
- });
469
- }
470
- });
471
- }
472
- /**
473
- * Attempts to resolve the provided Column node or ID to a Column node in the table.
474
- * Returns `undefined` if there is no match.
475
- * @remarks Searches for a match based strictly on the ID and returns that result.
476
- */
477
- _tryGetColumn(columnOrIdOrIndex) {
478
- if (typeof columnOrIdOrIndex === "number") {
479
- if (columnOrIdOrIndex < 0 || columnOrIdOrIndex >= this.columns.length) {
480
- return undefined;
481
- }
482
- // TypeScript is unable to narrow the types correctly here, hence the cast.
483
- // See: https://github.com/microsoft/TypeScript/issues/52144
484
- return this.columns[columnOrIdOrIndex];
485
- }
486
- if (typeof columnOrIdOrIndex === "string") {
487
- const columnId = columnOrIdOrIndex;
488
- // TypeScript is unable to narrow the types correctly here, hence the casts.
489
- // See: https://github.com/microsoft/TypeScript/issues/52144
490
- return this.columns.find((col) => col.id === columnId);
491
- }
492
- // If the user provided a node, ensure it actually exists in this table.
493
- if (!this.columns.includes(columnOrIdOrIndex)) {
494
- return undefined;
495
- }
496
- return columnOrIdOrIndex;
497
- }
498
- /**
499
- * Attempts to resolve the provided Column node or ID to a Column node in the table.
500
- * @throws Throws a `UsageError` if there is no match.
501
- * @remarks Searches for a match based strictly on the ID and returns that result.
502
- */
503
- _getColumn(columnOrIdOrIndex) {
504
- const column = this._tryGetColumn(columnOrIdOrIndex);
505
- if (column === undefined) {
506
- Table._throwMissingColumnError(columnOrIdOrIndex);
507
- }
508
- return column;
509
- }
510
- /**
511
- * Checks if a Column with the specified ID exists in the table.
512
- */
513
- _containsColumnWithId(columnId) {
514
- return this._tryGetColumn(columnId) !== undefined;
515
- }
516
349
  /**
517
350
  * Throw a `UsageError` for a missing Column by its ID or index.
518
351
  */
@@ -525,44 +358,6 @@ export var System_TableSchema;
525
358
  }
526
359
  throw new UsageError(`The specified column node with ID "${columnOrIdOrIndex.id}" does not exist in the table.`);
527
360
  }
528
- /**
529
- * Attempts to resolve the provided Row node or ID to a Row node in the table.
530
- * Returns `undefined` if there is no match.
531
- * @remarks Searches for a match based strictly on the ID and returns that result.
532
- */
533
- _tryGetRow(rowOrIdOrIndex) {
534
- if (typeof rowOrIdOrIndex === "number") {
535
- if (rowOrIdOrIndex < 0 || rowOrIdOrIndex >= this.rows.length) {
536
- return undefined;
537
- }
538
- // TypeScript is unable to narrow the types correctly here, hence the cast.
539
- // See: https://github.com/microsoft/TypeScript/issues/52144
540
- return this.rows[rowOrIdOrIndex];
541
- }
542
- if (typeof rowOrIdOrIndex === "string") {
543
- const rowId = rowOrIdOrIndex;
544
- // TypeScript is unable to narrow the types correctly here, hence the casts.
545
- // See: https://github.com/microsoft/TypeScript/issues/52144
546
- return this.rows.find((row) => row.id === rowId);
547
- }
548
- // If the user provided a node, ensure it actually exists in this table.
549
- if (!this.rows.includes(rowOrIdOrIndex)) {
550
- return undefined;
551
- }
552
- return rowOrIdOrIndex;
553
- }
554
- /**
555
- * Attempts to resolve the provided Row node, ID, or index to a Row node in the table.
556
- * @throws Throws a `UsageError` if there is no match.
557
- * @remarks Searches for a match based strictly on the ID and returns that result.
558
- */
559
- _getRow(rowOrIdOrIndex) {
560
- const row = this._tryGetRow(rowOrIdOrIndex);
561
- if (row === undefined) {
562
- Table._throwMissingRowError(rowOrIdOrIndex);
563
- }
564
- return row;
565
- }
566
361
  /**
567
362
  * Throw a `UsageError` for a missing Row by its ID or index.
568
363
  */
@@ -575,32 +370,89 @@ export var System_TableSchema;
575
370
  }
576
371
  throw new UsageError(`The specified row node with ID "${rowOrIdOrIndex.id}" does not exist in the table.`);
577
372
  }
578
- static _removeRange(range, array) {
579
- Table._assertValidRange(range, array);
580
- const { index, count } = range;
581
- const end = index + count; // exclusive
582
- // TypeScript is unable to narrow the array element type correctly here, hence the cast.
373
+ }
374
+ _a = Table, _Table_instances = new WeakSet(), _Table_removeCells = function _Table_removeCells(column) {
375
+ for (const row of this.rows) {
376
+ // TypeScript is unable to narrow the row type correctly here, hence the cast.
583
377
  // See: https://github.com/microsoft/TypeScript/issues/52144
584
- const removedRows = array.slice(index, end);
585
- array.removeRange(index, end);
586
- return removedRows;
378
+ this.removeCell({
379
+ column,
380
+ row: row,
381
+ });
587
382
  }
588
- /**
589
- * Ensure that the specified index is a valid location for item insertion in the destination list.
590
- * @throws Throws a usage error if the destination is invalid.
591
- */
592
- static validateInsertionIndex(index, destinationList) {
593
- if (index < 0) {
594
- throw new UsageError("The index must be greater than or equal to 0.");
383
+ }, _Table_applyEditsInBatch = function _Table_applyEditsInBatch(applyEdits) {
384
+ const branch = TreeAlpha.branch(this);
385
+ // Ensure events are paused until all of the edits are applied.
386
+ // This ensures that the user sees the corresponding table-level edit as atomic,
387
+ // and ensures they are not spammed with intermediate events.
388
+ withBufferedTreeEvents(() => {
389
+ if (branch === undefined) {
390
+ // If this node does not have a corresponding branch, then it is unhydrated.
391
+ // I.e., it is not part of a collaborative session yet.
392
+ // Therefore, we don't need to run the edits as a transaction.
393
+ applyEdits();
595
394
  }
596
- if (index > destinationList.length) {
597
- throw new UsageError("The index specified for insertion is out of bounds.");
395
+ else {
396
+ branch.runTransaction(() => {
397
+ applyEdits();
398
+ });
598
399
  }
599
- if (!Number.isInteger(index)) {
600
- throw new UsageError("The index must be an integer.");
400
+ });
401
+ }, _Table_tryGetColumn = function _Table_tryGetColumn(columnOrIdOrIndex) {
402
+ if (typeof columnOrIdOrIndex === "number") {
403
+ if (columnOrIdOrIndex < 0 || columnOrIdOrIndex >= this.columns.length) {
404
+ return undefined;
601
405
  }
406
+ // TypeScript is unable to narrow the types correctly here, hence the cast.
407
+ // See: https://github.com/microsoft/TypeScript/issues/52144
408
+ return this.columns[columnOrIdOrIndex];
602
409
  }
603
- }
410
+ if (typeof columnOrIdOrIndex === "string") {
411
+ const columnId = columnOrIdOrIndex;
412
+ // TypeScript is unable to narrow the types correctly here, hence the casts.
413
+ // See: https://github.com/microsoft/TypeScript/issues/52144
414
+ return this.columns.find((col) => col.id === columnId);
415
+ }
416
+ // If the user provided a node, ensure it actually exists in this table.
417
+ if (!this.columns.includes(columnOrIdOrIndex)) {
418
+ return undefined;
419
+ }
420
+ return columnOrIdOrIndex;
421
+ }, _Table_getColumn = function _Table_getColumn(columnOrIdOrIndex) {
422
+ const column = __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetColumn).call(this, columnOrIdOrIndex);
423
+ if (column === undefined) {
424
+ _a._throwMissingColumnError(columnOrIdOrIndex);
425
+ }
426
+ return column;
427
+ }, _Table_containsColumnWithId = function _Table_containsColumnWithId(columnId) {
428
+ return __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetColumn).call(this, columnId) !== undefined;
429
+ }, _Table_tryGetRow = function _Table_tryGetRow(rowOrIdOrIndex) {
430
+ if (typeof rowOrIdOrIndex === "number") {
431
+ if (rowOrIdOrIndex < 0 || rowOrIdOrIndex >= this.rows.length) {
432
+ return undefined;
433
+ }
434
+ // TypeScript is unable to narrow the types correctly here, hence the cast.
435
+ // See: https://github.com/microsoft/TypeScript/issues/52144
436
+ return this.rows[rowOrIdOrIndex];
437
+ }
438
+ if (typeof rowOrIdOrIndex === "string") {
439
+ const rowId = rowOrIdOrIndex;
440
+ // TypeScript is unable to narrow the types correctly here, hence the casts.
441
+ // See: https://github.com/microsoft/TypeScript/issues/52144
442
+ return this.rows.find((row) => row.id === rowId);
443
+ }
444
+ // If the user provided a node, ensure it actually exists in this table.
445
+ if (!this.rows.includes(rowOrIdOrIndex)) {
446
+ return undefined;
447
+ }
448
+ return rowOrIdOrIndex;
449
+ }, _Table_getRow = function _Table_getRow(rowOrIdOrIndex) {
450
+ const row = __classPrivateFieldGet(this, _Table_instances, "m", _Table_tryGetRow).call(this, rowOrIdOrIndex);
451
+ if (row === undefined) {
452
+ _a._throwMissingRowError(rowOrIdOrIndex);
453
+ }
454
+ return row;
455
+ };
604
456
  // Set a private symbol on the schema class that marks it as having been generated by this factory.
605
457
  // Column / Row functionality use this to validate that they are being used in a table.
606
458
  // This is effectively a work-around that allows columns and rows to invoke table methods
@@ -619,6 +471,18 @@ export var System_TableSchema;
619
471
  System_TableSchema.createTableSchema = createTableSchema;
620
472
  // #endregion
621
473
  })(System_TableSchema || (System_TableSchema = {}));
474
+ /**
475
+ * Removes the specified range of elements from the array.
476
+ * @returns The removed elements.
477
+ */
478
+ function removeRangeFromArray(startIndex, endIndex, array, methodName) {
479
+ validateIndexRange(startIndex, endIndex, array, methodName);
480
+ // TypeScript is unable to narrow the array element type correctly here, hence the cast.
481
+ // See: https://github.com/microsoft/TypeScript/issues/52144
482
+ const removedRows = array.slice(startIndex, endIndex);
483
+ array.removeRange(startIndex, endIndex);
484
+ return removedRows;
485
+ }
622
486
  /**
623
487
  * Contains types and factories for creating schema to represent dynamic tabular data.
624
488
  *
@@ -740,7 +604,7 @@ export var TableSchema;
740
604
  * Overload implementation
741
605
  */
742
606
  function column({ schemaFactory, cell, props = SchemaFactory.optional(SchemaFactory.null), }) {
743
- return System_TableSchema.createColumnSchema(schemaFactory, cell, props);
607
+ return System_TableSchema.createColumnSchema(schemaFactory, props);
744
608
  }
745
609
  TableSchema.column = column;
746
610
  /**