@fluidframework/tree 2.63.0-358419 → 2.63.0-359461

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 (352) hide show
  1. package/.eslintrc.cjs +4 -0
  2. package/api-report/tree.alpha.api.md +31 -5
  3. package/api-report/tree.beta.api.md +26 -0
  4. package/api-report/tree.legacy.beta.api.md +26 -0
  5. package/dist/alpha.d.ts +4 -3
  6. package/dist/beta.d.ts +3 -0
  7. package/dist/codec/codec.d.ts +32 -0
  8. package/dist/codec/codec.d.ts.map +1 -1
  9. package/dist/codec/codec.js +32 -1
  10. package/dist/codec/codec.js.map +1 -1
  11. package/dist/codec/index.d.ts +1 -1
  12. package/dist/codec/index.d.ts.map +1 -1
  13. package/dist/codec/index.js +3 -1
  14. package/dist/codec/index.js.map +1 -1
  15. package/dist/core/index.d.ts +2 -2
  16. package/dist/core/index.d.ts.map +1 -1
  17. package/dist/core/index.js +4 -3
  18. package/dist/core/index.js.map +1 -1
  19. package/dist/core/schema-stored/index.d.ts +1 -1
  20. package/dist/core/schema-stored/index.d.ts.map +1 -1
  21. package/dist/core/schema-stored/index.js.map +1 -1
  22. package/dist/core/schema-stored/schema.d.ts +5 -7
  23. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  24. package/dist/core/schema-stored/schema.js +3 -6
  25. package/dist/core/schema-stored/schema.js.map +1 -1
  26. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +4 -1
  27. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  28. package/dist/core/tree/detachedFieldIndexCodecs.js +5 -1
  29. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  30. package/dist/core/tree/index.d.ts +1 -0
  31. package/dist/core/tree/index.d.ts.map +1 -1
  32. package/dist/core/tree/index.js +3 -1
  33. package/dist/core/tree/index.js.map +1 -1
  34. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +3 -2
  35. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/codecs.js +5 -1
  37. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +2 -0
  39. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  40. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  42. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  44. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  46. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  48. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  49. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +5 -1
  50. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  51. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +19 -5
  52. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  53. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  54. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  55. package/dist/feature-libraries/default-schema/index.js +2 -1
  56. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  57. package/dist/feature-libraries/forest-summary/codec.d.ts +4 -1
  58. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  59. package/dist/feature-libraries/forest-summary/codec.js +5 -1
  60. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  61. package/dist/feature-libraries/forest-summary/index.d.ts +1 -0
  62. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  63. package/dist/feature-libraries/forest-summary/index.js +3 -1
  64. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  65. package/dist/feature-libraries/index.d.ts +5 -5
  66. package/dist/feature-libraries/index.d.ts.map +1 -1
  67. package/dist/feature-libraries/index.js +7 -2
  68. package/dist/feature-libraries/index.js.map +1 -1
  69. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1 -1
  70. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  71. package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
  72. package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
  73. package/dist/feature-libraries/schema-edits/index.js +2 -1
  74. package/dist/feature-libraries/schema-edits/index.js.map +1 -1
  75. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +4 -1
  76. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  77. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +9 -1
  78. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  79. package/dist/feature-libraries/schema-index/codec.d.ts +2 -1
  80. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  81. package/dist/feature-libraries/schema-index/codec.js +5 -1
  82. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  83. package/dist/feature-libraries/schema-index/index.d.ts +1 -1
  84. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  85. package/dist/feature-libraries/schema-index/index.js +2 -1
  86. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  87. package/dist/legacy.d.ts +3 -0
  88. package/dist/packageVersion.d.ts +1 -1
  89. package/dist/packageVersion.js +1 -1
  90. package/dist/packageVersion.js.map +1 -1
  91. package/dist/serializableDomainSchema.d.ts +12 -16
  92. package/dist/serializableDomainSchema.d.ts.map +1 -1
  93. package/dist/serializableDomainSchema.js +8 -8
  94. package/dist/serializableDomainSchema.js.map +1 -1
  95. package/dist/shared-tree/index.d.ts +2 -1
  96. package/dist/shared-tree/index.d.ts.map +1 -1
  97. package/dist/shared-tree/index.js +4 -1
  98. package/dist/shared-tree/index.js.map +1 -1
  99. package/dist/shared-tree/sharedTree.d.ts +18 -2
  100. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  101. package/dist/shared-tree/sharedTree.js +122 -8
  102. package/dist/shared-tree/sharedTree.js.map +1 -1
  103. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +17 -2
  104. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  105. package/dist/shared-tree/sharedTreeChangeCodecs.js +31 -18
  106. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  107. package/dist/shared-tree/treeCheckout.js.map +1 -1
  108. package/dist/shared-tree-core/defaultResubmitMachine.d.ts +7 -12
  109. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  110. package/dist/shared-tree-core/defaultResubmitMachine.js +53 -73
  111. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  112. package/dist/shared-tree-core/editManagerCodecs.d.ts +7 -4
  113. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  114. package/dist/shared-tree-core/editManagerCodecs.js +42 -11
  115. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  116. package/dist/shared-tree-core/index.d.ts +2 -1
  117. package/dist/shared-tree-core/index.d.ts.map +1 -1
  118. package/dist/shared-tree-core/index.js +6 -1
  119. package/dist/shared-tree-core/index.js.map +1 -1
  120. package/dist/shared-tree-core/messageCodecs.d.ts +7 -4
  121. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  122. package/dist/shared-tree-core/messageCodecs.js +44 -23
  123. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  124. package/dist/shared-tree-core/resubmitMachine.d.ts +9 -18
  125. package/dist/shared-tree-core/resubmitMachine.d.ts.map +1 -1
  126. package/dist/shared-tree-core/resubmitMachine.js.map +1 -1
  127. package/dist/shared-tree-core/sharedTreeCore.d.ts +6 -4
  128. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  129. package/dist/shared-tree-core/sharedTreeCore.js +12 -13
  130. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  131. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +7 -166
  132. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  133. package/dist/simple-tree/api/schemaFactoryAlpha.js +11 -44
  134. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  135. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +90 -1
  136. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  137. package/dist/simple-tree/api/schemaFactoryBeta.js +55 -0
  138. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  139. package/dist/simple-tree/api/tree.d.ts +37 -18
  140. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  141. package/dist/simple-tree/api/tree.js.map +1 -1
  142. package/dist/simple-tree/api/treeBeta.d.ts +12 -2
  143. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  144. package/dist/simple-tree/api/treeBeta.js +6 -0
  145. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  146. package/dist/simple-tree/api/typesUnsafe.d.ts +1 -1
  147. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  148. package/dist/simple-tree/core/treeNode.d.ts +3 -2
  149. package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
  150. package/dist/simple-tree/core/treeNode.js +3 -2
  151. package/dist/simple-tree/core/treeNode.js.map +1 -1
  152. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  153. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  154. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  155. package/dist/util/brand.d.ts +1 -1
  156. package/dist/util/brand.js.map +1 -1
  157. package/docs/main/compatibility.md +8 -0
  158. package/lib/alpha.d.ts +4 -3
  159. package/lib/beta.d.ts +3 -0
  160. package/lib/codec/codec.d.ts +32 -0
  161. package/lib/codec/codec.d.ts.map +1 -1
  162. package/lib/codec/codec.js +28 -0
  163. package/lib/codec/codec.js.map +1 -1
  164. package/lib/codec/index.d.ts +1 -1
  165. package/lib/codec/index.d.ts.map +1 -1
  166. package/lib/codec/index.js +1 -1
  167. package/lib/codec/index.js.map +1 -1
  168. package/lib/core/index.d.ts +2 -2
  169. package/lib/core/index.d.ts.map +1 -1
  170. package/lib/core/index.js +1 -1
  171. package/lib/core/index.js.map +1 -1
  172. package/lib/core/schema-stored/index.d.ts +1 -1
  173. package/lib/core/schema-stored/index.d.ts.map +1 -1
  174. package/lib/core/schema-stored/index.js.map +1 -1
  175. package/lib/core/schema-stored/schema.d.ts +5 -7
  176. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  177. package/lib/core/schema-stored/schema.js +3 -6
  178. package/lib/core/schema-stored/schema.js.map +1 -1
  179. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +4 -1
  180. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  181. package/lib/core/tree/detachedFieldIndexCodecs.js +3 -0
  182. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  183. package/lib/core/tree/index.d.ts +1 -0
  184. package/lib/core/tree/index.d.ts.map +1 -1
  185. package/lib/core/tree/index.js +1 -0
  186. package/lib/core/tree/index.js.map +1 -1
  187. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +3 -2
  188. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  189. package/lib/feature-libraries/chunked-forest/codec/codecs.js +3 -0
  190. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  191. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +2 -0
  192. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  193. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  194. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  195. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  196. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  197. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  198. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  199. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  200. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  201. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  202. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +5 -1
  203. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  204. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +17 -4
  205. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  206. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  207. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  208. package/lib/feature-libraries/default-schema/index.js +1 -1
  209. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  210. package/lib/feature-libraries/forest-summary/codec.d.ts +4 -1
  211. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  212. package/lib/feature-libraries/forest-summary/codec.js +3 -0
  213. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  214. package/lib/feature-libraries/forest-summary/index.d.ts +1 -0
  215. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  216. package/lib/feature-libraries/forest-summary/index.js +1 -0
  217. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  218. package/lib/feature-libraries/index.d.ts +5 -5
  219. package/lib/feature-libraries/index.d.ts.map +1 -1
  220. package/lib/feature-libraries/index.js +5 -5
  221. package/lib/feature-libraries/index.js.map +1 -1
  222. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1 -1
  223. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  224. package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
  225. package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
  226. package/lib/feature-libraries/schema-edits/index.js +1 -1
  227. package/lib/feature-libraries/schema-edits/index.js.map +1 -1
  228. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +4 -1
  229. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  230. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -1
  231. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  232. package/lib/feature-libraries/schema-index/codec.d.ts +2 -1
  233. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  234. package/lib/feature-libraries/schema-index/codec.js +3 -0
  235. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  236. package/lib/feature-libraries/schema-index/index.d.ts +1 -1
  237. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  238. package/lib/feature-libraries/schema-index/index.js +1 -1
  239. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  240. package/lib/legacy.d.ts +3 -0
  241. package/lib/packageVersion.d.ts +1 -1
  242. package/lib/packageVersion.js +1 -1
  243. package/lib/packageVersion.js.map +1 -1
  244. package/lib/serializableDomainSchema.d.ts +12 -16
  245. package/lib/serializableDomainSchema.d.ts.map +1 -1
  246. package/lib/serializableDomainSchema.js +9 -9
  247. package/lib/serializableDomainSchema.js.map +1 -1
  248. package/lib/shared-tree/index.d.ts +2 -1
  249. package/lib/shared-tree/index.d.ts.map +1 -1
  250. package/lib/shared-tree/index.js +2 -1
  251. package/lib/shared-tree/index.js.map +1 -1
  252. package/lib/shared-tree/sharedTree.d.ts +18 -2
  253. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  254. package/lib/shared-tree/sharedTree.js +126 -13
  255. package/lib/shared-tree/sharedTree.js.map +1 -1
  256. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +17 -2
  257. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  258. package/lib/shared-tree/sharedTreeChangeCodecs.js +30 -18
  259. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  260. package/lib/shared-tree/treeCheckout.js.map +1 -1
  261. package/lib/shared-tree-core/defaultResubmitMachine.d.ts +7 -12
  262. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  263. package/lib/shared-tree-core/defaultResubmitMachine.js +55 -75
  264. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  265. package/lib/shared-tree-core/editManagerCodecs.d.ts +7 -4
  266. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  267. package/lib/shared-tree-core/editManagerCodecs.js +40 -10
  268. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  269. package/lib/shared-tree-core/index.d.ts +2 -1
  270. package/lib/shared-tree-core/index.d.ts.map +1 -1
  271. package/lib/shared-tree-core/index.js +2 -1
  272. package/lib/shared-tree-core/index.js.map +1 -1
  273. package/lib/shared-tree-core/messageCodecs.d.ts +7 -4
  274. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  275. package/lib/shared-tree-core/messageCodecs.js +42 -22
  276. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  277. package/lib/shared-tree-core/resubmitMachine.d.ts +9 -18
  278. package/lib/shared-tree-core/resubmitMachine.d.ts.map +1 -1
  279. package/lib/shared-tree-core/resubmitMachine.js.map +1 -1
  280. package/lib/shared-tree-core/sharedTreeCore.d.ts +6 -4
  281. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  282. package/lib/shared-tree-core/sharedTreeCore.js +13 -14
  283. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  284. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +7 -166
  285. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  286. package/lib/simple-tree/api/schemaFactoryAlpha.js +12 -45
  287. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  288. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +90 -1
  289. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  290. package/lib/simple-tree/api/schemaFactoryBeta.js +56 -1
  291. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  292. package/lib/simple-tree/api/tree.d.ts +37 -18
  293. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  294. package/lib/simple-tree/api/tree.js.map +1 -1
  295. package/lib/simple-tree/api/treeBeta.d.ts +12 -2
  296. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  297. package/lib/simple-tree/api/treeBeta.js +7 -1
  298. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  299. package/lib/simple-tree/api/typesUnsafe.d.ts +1 -1
  300. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  301. package/lib/simple-tree/core/treeNode.d.ts +3 -2
  302. package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
  303. package/lib/simple-tree/core/treeNode.js +3 -2
  304. package/lib/simple-tree/core/treeNode.js.map +1 -1
  305. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  306. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  307. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  308. package/lib/util/brand.d.ts +1 -1
  309. package/lib/util/brand.js.map +1 -1
  310. package/package.json +21 -21
  311. package/src/codec/codec.ts +60 -0
  312. package/src/codec/index.ts +3 -0
  313. package/src/core/index.ts +3 -0
  314. package/src/core/schema-stored/index.ts +1 -0
  315. package/src/core/schema-stored/schema.ts +5 -6
  316. package/src/core/tree/detachedFieldIndexCodecs.ts +9 -0
  317. package/src/core/tree/index.ts +6 -0
  318. package/src/feature-libraries/chunked-forest/codec/codecs.ts +6 -1
  319. package/src/feature-libraries/chunked-forest/codec/format.ts +2 -0
  320. package/src/feature-libraries/chunked-forest/codec/index.ts +2 -1
  321. package/src/feature-libraries/chunked-forest/index.ts +2 -0
  322. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +29 -5
  323. package/src/feature-libraries/default-schema/index.ts +2 -0
  324. package/src/feature-libraries/forest-summary/codec.ts +7 -0
  325. package/src/feature-libraries/forest-summary/index.ts +1 -0
  326. package/src/feature-libraries/index.ts +12 -1
  327. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +1 -1
  328. package/src/feature-libraries/schema-edits/index.ts +5 -1
  329. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +17 -1
  330. package/src/feature-libraries/schema-index/codec.ts +5 -0
  331. package/src/feature-libraries/schema-index/index.ts +1 -0
  332. package/src/packageVersion.ts +1 -1
  333. package/src/serializableDomainSchema.ts +12 -11
  334. package/src/shared-tree/index.ts +6 -0
  335. package/src/shared-tree/sharedTree.ts +151 -11
  336. package/src/shared-tree/sharedTreeChangeCodecs.ts +68 -30
  337. package/src/shared-tree/treeCheckout.ts +1 -1
  338. package/src/shared-tree-core/defaultResubmitMachine.ts +77 -120
  339. package/src/shared-tree-core/editManagerCodecs.ts +62 -9
  340. package/src/shared-tree-core/index.ts +12 -1
  341. package/src/shared-tree-core/messageCodecs.ts +70 -27
  342. package/src/shared-tree-core/resubmitMachine.ts +12 -20
  343. package/src/shared-tree-core/sharedTreeCore.ts +26 -18
  344. package/src/simple-tree/api/schemaFactoryAlpha.ts +16 -296
  345. package/src/simple-tree/api/schemaFactoryBeta.ts +269 -1
  346. package/src/simple-tree/api/tree.ts +37 -18
  347. package/src/simple-tree/api/treeBeta.ts +36 -1
  348. package/src/simple-tree/api/typesUnsafe.ts +1 -1
  349. package/src/simple-tree/core/treeNode.ts +3 -2
  350. package/src/simple-tree/core/treeNodeKernel.ts +1 -1
  351. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +2 -2
  352. package/src/util/brand.ts +1 -1
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type { GraphCommit } from "../core/index.js";
6
+ import type { GraphCommit, RevisionTag } from "../core/index.js";
7
7
 
8
8
  /**
9
9
  * Encapsulates a state machine that can be used by a {@link SharedTreeCore} manage resubmit phases,
@@ -11,25 +11,16 @@ import type { GraphCommit } from "../core/index.js";
11
11
  */
12
12
  export interface ResubmitMachine<TChange> {
13
13
  /**
14
- * Must be called before calling `enrichCommit` as part of a resubmit phase.
15
- * @param toResubmit - the commits that will be resubmitted (from oldest to newest).
16
- * This must be the most rebased version of these commits (i.e., rebased over all known concurrent edits)
17
- * as opposed to the version which was last submitted.
18
- * `toResubmit` can be safely mutated by the caller after this call returns.
14
+ * @param revision - the revision of the commit that should be enriched
15
+ * @param getLocalCommitsSince - the local commits on this branch from oldest to newest, starting with the `revision`.
16
+ * @returns a version of the commit with updated enrichment, or undefined if this revision does not need to be resubmitted.
17
+ * A revision does not need to be resubmitted if it has already been sequenced, which can happen if it was also submitted by another client.
18
+ * Two clients can submit the same revision by both merging from the same shared branch.
19
19
  */
20
- prepareForResubmit(toResubmit: readonly GraphCommit<TChange>[]): void;
21
-
22
- /**
23
- * @returns the next commit that should be resubmitted.
24
- *
25
- * Throws when invoked outside of a resubmit phase.
26
- */
27
- peekNextCommit(): GraphCommit<TChange>;
28
-
29
- /**
30
- * Is true iff the commit enricher is currently in a resubmit phase.
31
- */
32
- readonly isInResubmitPhase: boolean;
20
+ getEnrichedCommit(
21
+ revision: RevisionTag,
22
+ getLocalCommitsSince: () => readonly GraphCommit<TChange>[],
23
+ ): GraphCommit<TChange> | undefined;
33
24
 
34
25
  /**
35
26
  * Must be when a commit is submitted or resubmitted.
@@ -48,7 +39,8 @@ export interface ResubmitMachine<TChange> {
48
39
  * Must be called after a sequenced commit is applied.
49
40
  * Note that this may be called multiples times in a row after a number of sequenced commits have been applied
50
41
  * (as opposed to always being called before the next sequenced commit is applied).
42
+ * @param revision - the revision of the sequenced commit.
51
43
  * @param isLocal - whether the sequenced commit was generated by the local session.
52
44
  */
53
- onSequencedCommitApplied(isLocal: boolean): void;
45
+ onSequencedCommitApplied(revision: RevisionTag, isLocal: boolean): void;
54
46
  }
@@ -25,7 +25,7 @@ import type {
25
25
  } from "@fluidframework/shared-object-base/internal";
26
26
  import { createChildLogger } from "@fluidframework/telemetry-utils/internal";
27
27
 
28
- import type { ICodecOptions, IJsonCodec } from "../codec/index.js";
28
+ import type { DependentFormatVersion, ICodecOptions, IJsonCodec } from "../codec/index.js";
29
29
  import {
30
30
  type ChangeFamily,
31
31
  type ChangeFamilyEditor,
@@ -51,10 +51,14 @@ import { BranchCommitEnricher } from "./branchCommitEnricher.js";
51
51
  import { type ChangeEnricherReadonlyCheckout, NoOpChangeEnricher } from "./changeEnricher.js";
52
52
  import { DefaultResubmitMachine } from "./defaultResubmitMachine.js";
53
53
  import { EditManager, minimumPossibleSequenceNumber } from "./editManager.js";
54
- import { makeEditManagerCodec } from "./editManagerCodecs.js";
54
+ import { makeEditManagerCodec, type EditManagerFormatVersion } from "./editManagerCodecs.js";
55
55
  import type { SeqNumber } from "./editManagerFormatCommons.js";
56
56
  import { EditManagerSummarizer } from "./editManagerSummarizer.js";
57
- import { type MessageEncodingContext, makeMessageCodec } from "./messageCodecs.js";
57
+ import {
58
+ type MessageEncodingContext,
59
+ type MessageFormatVersion,
60
+ makeMessageCodec,
61
+ } from "./messageCodecs.js";
58
62
  import type { DecodedMessage } from "./messageTypes.js";
59
63
  import type { ResubmitMachine } from "./resubmitMachine.js";
60
64
 
@@ -62,8 +66,8 @@ import type { ResubmitMachine } from "./resubmitMachine.js";
62
66
  const summarizablesTreeKey = "indexes";
63
67
 
64
68
  export interface ExplicitCoreCodecVersions {
65
- editManager: number;
66
- message: number;
69
+ editManager: EditManagerFormatVersion;
70
+ message: MessageFormatVersion;
67
71
  }
68
72
 
69
73
  export interface ClonableSchemaAndPolicy extends SchemaAndPolicy {
@@ -126,6 +130,8 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
126
130
  protected readonly changeFamily: ChangeFamily<TEditor, TChange>,
127
131
  options: ICodecOptions,
128
132
  formatOptions: ExplicitCoreCodecVersions,
133
+ changeFormatVersionForEditManager: DependentFormatVersion<EditManagerFormatVersion>,
134
+ changeFormatVersionForMessage: DependentFormatVersion<MessageFormatVersion>,
129
135
  protected readonly idCompressor: IIdCompressor,
130
136
  schema: TreeStoredSchemaRepository,
131
137
  schemaPolicy: SchemaPolicy,
@@ -163,6 +169,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
163
169
  const revisionTagCodec = new RevisionTagCodec(idCompressor);
164
170
  const editManagerCodec = makeEditManagerCodec(
165
171
  this.editManager.changeFamily.codecs,
172
+ changeFormatVersionForEditManager,
166
173
  revisionTagCodec,
167
174
  options,
168
175
  formatOptions.editManager,
@@ -183,6 +190,7 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
183
190
 
184
191
  this.messageCodec = makeMessageCodec(
185
192
  changeFamily.codecs,
193
+ changeFormatVersionForMessage,
186
194
  new RevisionTagCodec(idCompressor),
187
195
  options,
188
196
  formatOptions.message,
@@ -451,8 +459,8 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
451
459
  );
452
460
 
453
461
  // Update the resubmit machine for each commit applied.
454
- for (const _ of commits) {
455
- this.tryGetResubmitMachine(branchId)?.onSequencedCommitApplied(isLocal);
462
+ for (const commit of commits) {
463
+ this.tryGetResubmitMachine(branchId)?.onSequencedCommitApplied(commit.revision, isLocal);
456
464
  }
457
465
  }
458
466
 
@@ -500,24 +508,24 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange>
500
508
  } = message;
501
509
 
502
510
  const resubmitMachine = this.getResubmitMachine(branchId);
503
- // If a resubmit phase is not already in progress, then this must be the first commit of a new resubmit phase.
504
- if (resubmitMachine.isInResubmitPhase === false) {
511
+
512
+ const getLocalCommits = (): GraphCommit<TChange>[] => {
505
513
  const localCommits = this.editManager.getLocalCommits(branchId);
506
514
  const revisionIndex = localCommits.findIndex((c) => c.revision === revision);
507
515
  assert(revisionIndex >= 0, 0xbdb /* revision must exist in local commits */);
508
- const toResubmit = localCommits.slice(revisionIndex);
509
- resubmitMachine.prepareForResubmit(toResubmit);
510
- }
516
+ return localCommits.slice(revisionIndex);
517
+ };
518
+
511
519
  assert(
512
520
  isClonableSchemaPolicy(localOpMetadata),
513
521
  0x95e /* Local metadata must contain schema and policy. */,
514
522
  );
515
- assert(
516
- resubmitMachine.isInResubmitPhase !== false,
517
- 0x984 /* Invalid resubmit outside of resubmit phase */,
518
- );
519
- const enrichedCommit = resubmitMachine.peekNextCommit();
520
- this.submitCommit(branchId, enrichedCommit, localOpMetadata, true);
523
+
524
+ const enrichedCommit = resubmitMachine.getEnrichedCommit(revision, getLocalCommits);
525
+ if (enrichedCommit !== undefined) {
526
+ this.submitCommit(branchId, enrichedCommit, localOpMetadata, true);
527
+ }
528
+
521
529
  break;
522
530
  }
523
531
  case "branch": {
@@ -11,14 +11,11 @@ import {
11
11
  type ObjectNodeSchema,
12
12
  objectSchema,
13
13
  type RecordNodeCustomizableSchema,
14
- type RecordNodeInsertableData,
15
14
  recordSchema,
16
- type TreeRecordNode,
17
15
  } from "../node-kinds/index.js";
18
16
  import {
19
17
  defaultSchemaFactoryObjectOptions,
20
18
  scoped,
21
- structuralName,
22
19
  type NodeSchemaOptionsAlpha,
23
20
  type SchemaFactoryObjectOptions,
24
21
  type ScopedSchemaName,
@@ -29,14 +26,12 @@ import type { RestrictiveStringRecord } from "../../util/index.js";
29
26
  import type {
30
27
  NodeKind,
31
28
  TreeNodeSchema,
32
- TreeNodeSchemaBoth,
33
29
  TreeNodeSchemaClass,
34
- TreeNodeSchemaNonClass,
35
- WithType,
36
30
  ImplicitAllowedTypes,
37
31
  ImplicitAnnotatedAllowedTypes,
38
32
  AnnotatedAllowedType,
39
33
  LazyItem,
34
+ WithType,
40
35
  } from "../core/index.js";
41
36
  import { normalizeToAnnotatedAllowedType, createSchemaUpgrade } from "../core/index.js";
42
37
  import type {
@@ -48,7 +43,7 @@ import type {
48
43
  import type { SimpleObjectNodeSchema } from "../simpleSchema.js";
49
44
  import { SchemaFactoryBeta } from "./schemaFactoryBeta.js";
50
45
 
51
- // This import prevents a large number of type references in the API reports from showing up as *_2.
46
+ // These imports prevent a large number of type references in the API reports from showing up as *_2.
52
47
  /* eslint-disable unused-imports/no-unused-imports, @typescript-eslint/no-unused-vars, import/no-duplicates */
53
48
  import type {
54
49
  FieldProps,
@@ -73,8 +68,9 @@ export interface SchemaStaticsAlpha {
73
68
  * Declares a staged type in a set of {@link AllowedTypes}.
74
69
  *
75
70
  * @remarks
76
- * Staged allowed types add support for loading documents which may or may not permit an allowed type in a location in a schema.
71
+ * Staged allowed types add support for loading documents which may contain that type at the declared location.
77
72
  * This allows for an incremental rollout of a schema change to add a {@link TreeNodeSchema} to an {@link AllowedTypes} without breaking cross version collaboration.
73
+ * A guide on this process can be found here: https://fluidframework.com/docs/data-structures/tree/schema-evolution/allowed-types-rollout
78
74
  *
79
75
  * Once enough clients have the type staged (and thus can read documents which allow it), documents can start being created and upgraded to allow the staged type.
80
76
  * This is done by deploying a new version of the app which removes the `staged` wrapper around the allowed type in the the schema definition.
@@ -85,107 +81,17 @@ export interface SchemaStaticsAlpha {
85
81
  * 1. {@link TreeView.initialize} will omit the staged allowed type from the newly created stored schema.
86
82
  * 2. {@link TreeView.upgradeSchema} will omit the staged allowed type from the the upgraded stored schema.
87
83
  * 3. When evaluating {@link TreeView.compatibility}, it will be viewable even if the staged allowed type is not present in the stored schema's corresponding allowed types.
88
- * 4. Because of the above, it is possible to get errors when inserting content which uses the staged allowed type when inserting the content into a tree who's stored schema does not permit it.
84
+ * 4. Because of the above, it is possible to get errors when inserting content which uses the staged allowed type into a tree whose stored schema does not permit it.
89
85
  *
90
86
  * Currently, `staged` is not supported in the recursive type APIs: this is a known limitation which future versions of the API will address.
91
87
  *
92
88
  * @example
93
- * Suppose you have a schema which has a field that allows some type `A`, but you want to add support for type `B`.
94
- *
95
- * The first change is to used to mark the new type as staged, replacing `A` in the schema with `[A, SchemaStaticsAlpha.staged(B)]`.
96
- * Once this is done, and any code which reads contents from documents is updated to handle any `B` content that may be present, this version of the code can be deployed.
97
- *
98
- * Once all users have the above changes, the schema can be updated again to `[A, B]`, and the app can be updated to allow creating of `B` content.
99
- * This updated version of the app will need to call {@link TreeView.upgradeSchema} when opening documents created by earlier versions.
100
- *
101
- * Adding a `B` schema as an option in the root could look like this:
102
- * ```typescript
103
- * const factory = new SchemaFactoryAlpha("test");
104
- * class A extends factory.objectAlpha("A", {}) {}
105
- * class B extends factory.objectAlpha("B", {}) {}
106
- *
107
- * // Does not support B
108
- * const configBefore = new TreeViewConfigurationAlpha({
109
- * schema: A,
110
- * });
111
- *
112
- * // Supports documents with or without B
113
- * const configStaged = new TreeViewConfigurationAlpha({
114
- * // Adds staged support for B.
115
- * // Currently this requires wrapping the root field with `SchemaFactoryAlpha.required`:
116
- * // this is normally implicitly included, but is currently required while the "staged" APIs are `@alpha`.
117
- * schema: SchemaFactoryAlpha.required([A, SchemaFactoryAlpha.staged(B)]),
118
- * });
119
- *
120
- * // Only supports documents with A and B: can be used to upgrade schema to add B.
121
- * const configAfter = new TreeViewConfigurationAlpha({
122
- * schema: [A, B],
123
- * });
124
- * ```
125
- * @example
126
- * Below is a full example of how the schema migration process works.
127
- * This can also be found in our {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/test/simple-tree/api/stagedSchemaUpgrade.spec.ts | tests}.
128
- * ```typescript
129
- * // Schema A: only number allowed
130
- * const schemaA = SchemaFactoryAlpha.optional([SchemaFactoryAlpha.number]);
131
- *
132
- * // Schema B: number or string (string is staged)
133
- * const schemaB = SchemaFactoryAlpha.optional([
134
- * SchemaFactoryAlpha.number,
135
- * SchemaFactoryAlpha.staged(SchemaFactoryAlpha.string),
136
- * ]);
89
+ * A full code example of the schema migration process can be found in our {@link https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/test/simple-tree/api/stagedSchemaUpgrade.spec.ts | tests}.
137
90
  *
138
- * // Schema C: number or string, both fully allowed
139
- * const schemaC = SchemaFactoryAlpha.optional([
140
- * SchemaFactoryAlpha.number,
141
- * SchemaFactoryAlpha.string,
142
- * ]);
143
- *
144
- * // Initialize with schema A.
145
- * const configA = new TreeViewConfiguration({
146
- * schema: schemaA,
147
- * });
148
- * const viewA = treeA.viewWith(configA);
149
- * viewA.initialize(5);
150
- *
151
- * // Since we are running all the different versions of the app in the same process making changes synchronously,
152
- * // an explicit flush is needed to make them available to each other.
153
- * synchronizeTrees();
154
- *
155
- * assert.deepEqual(viewA.root, 5);
156
- *
157
- * // View the same document with a second tree using schema B.
158
- * const configB = new TreeViewConfiguration({
159
- * schema: schemaB,
160
- * });
161
- * const viewB = treeB.viewWith(configB);
162
- * // B cannot write strings to the root.
163
- * assert.throws(() => (viewB.root = "test"));
164
- *
165
- * // View the same document with a third tree using schema C.
166
- * const configC = new TreeViewConfiguration({
167
- * schema: schemaC,
168
- * });
169
- * const viewC = treeC.viewWith(configC);
170
- * // Upgrade to schema C
171
- * viewC.upgradeSchema();
172
- * // Use the newly enabled schema.
173
- * viewC.root = "test";
174
- *
175
- * synchronizeTrees();
176
- *
177
- * // View A is now incompatible with the stored schema:
178
- * assert.equal(viewA.compatibility.canView, false);
179
- *
180
- * // View B can still read the document, and now sees the string root which relies on the staged schema.
181
- * assert.deepEqual(viewB.root, "test");
182
- * ```
183
91
  * @privateRemarks
184
92
  * TODO:#44317 staged allowed types rely on schema validation of stored schema to output errors, these errors are not very
185
93
  * user friendly and should be improved, particularly in the case of staged allowed types
186
94
  *
187
- * TODO: the example above does not work tell in intellisense: its formatted to work onm the website. We should find a solution that works well for both.
188
- *
189
95
  * TODO: AB#45711: Update the docs above when recursive type support is added.
190
96
  */
191
97
  staged: <const T extends LazyItem<TreeNodeSchema>>(
@@ -485,193 +391,6 @@ export class SchemaFactoryAlpha<
485
391
  >;
486
392
  }
487
393
 
488
- /**
489
- * Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeRecordNode:interface)}.
490
- *
491
- * @param allowedTypes - The types that may appear in the record.
492
- *
493
- * @remarks
494
- * The identifier for this record is defined as a function of the provided types.
495
- * It is still scoped to this `SchemaFactory`, but multiple calls with the same arguments will return the same
496
- * schema object, providing somewhat structural typing.
497
- * This does not support recursive types.
498
- *
499
- * If using these structurally named records, other types in this schema builder should avoid names of the form `Record<${string}>`.
500
- *
501
- * @example
502
- * The returned schema should be used as a schema directly:
503
- * ```typescript
504
- * const MyRecord = factory.record(factory.number);
505
- * type MyRecord = NodeFromSchema<typeof Record>;
506
- * ```
507
- * Or inline:
508
- * ```typescript
509
- * factory.object("Foo", { myRecord: factory.record(factory.number) });
510
- * ```
511
- *
512
- * @privateRemarks
513
- * The name produced at the type-level here is not as specific as it could be; however, doing type-level sorting and escaping is a real mess.
514
- * There are cases where not having this full type provided will be less than ideal, since TypeScript's structural types will allow assignment between runtime incompatible types at compile time.
515
- * For example, attempts to narrow unions of structural records by name won't work.
516
- * Planned future changes to move to a class based schema system as well as factor function based node construction should mostly avoid these issues,
517
- * though there may still be some problematic cases even after that work is done.
518
- *
519
- * The return value is a class, but its type is intentionally not specific enough to indicate it is a class.
520
- * This prevents callers of this from sub-classing it, which is unlikely to work well (due to the ease of accidentally giving two different calls to this different subclasses)
521
- * when working with structural typing.
522
- *
523
- * {@label STRUCTURAL}
524
- */
525
- public record<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(
526
- allowedTypes: T,
527
- ): TreeNodeSchemaNonClass<
528
- /* Name */ ScopedSchemaName<TScope, `Record<${string}>`>,
529
- /* Kind */ NodeKind.Record,
530
- /* TNode */ TreeRecordNode<T> &
531
- WithType<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record>,
532
- /* TInsertable */ RecordNodeInsertableData<T>,
533
- /* ImplicitlyConstructable */ true,
534
- /* Info */ T,
535
- /* TConstructorExtra */ undefined
536
- >;
537
- /**
538
- * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeRecordNode:interface)}.
539
- *
540
- * @param name - Unique identifier for this schema within this factory's scope.
541
- * @param allowedTypes - The types that may appear in the record.
542
- *
543
- * @remarks
544
- * Like TypeScript `Record`s, record nodes have some potential pitfalls.
545
- * For example: TypeScript makes assumptions about built-in keys being present (e.g. `toString`, `hasOwnProperty`, etc.).
546
- * Since these are otherwise valid keys in a record, this can lead to unexpected behavior.
547
- * To prevent inconsistent behavior, these built-ins are hidden by record nodes.
548
- * This means that if you try to call these built-ins (e.g. `toString()`) on a record node, you will get an error.
549
- *
550
- * In most cases, it is probably preferable to use {@link SchemaFactory.(map:2)} instead.
551
- *
552
- * @example
553
- * ```typescript
554
- * class NamedRecord extends factory.record("name", factory.number) {}
555
- * ```
556
- *
557
- * {@label NAMED}
558
- */
559
- public record<const Name extends TName, const T extends ImplicitAllowedTypes>(
560
- name: Name,
561
- allowedTypes: T,
562
- ): TreeNodeSchemaClass<
563
- /* Name */ ScopedSchemaName<TScope, Name>,
564
- /* Kind */ NodeKind.Record,
565
- /* TNode */ TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>,
566
- /* TInsertable */ RecordNodeInsertableData<T>,
567
- /* ImplicitlyConstructable */ true,
568
- /* Info */ T,
569
- /* TConstructorExtra */ undefined
570
- >;
571
- /**
572
- * {@link SchemaFactory.array} implementation.
573
- *
574
- * @privateRemarks
575
- * This should return TreeNodeSchemaBoth: see note on "map" implementation for details.
576
- */
577
- public record<const T extends ImplicitAllowedTypes>(
578
- nameOrAllowedTypes: TName | ((T & TreeNodeSchema) | readonly TreeNodeSchema[]),
579
- maybeAllowedTypes?: T,
580
- ): TreeNodeSchema<
581
- /* Name */ ScopedSchemaName<TScope, string>,
582
- /* Kind */ NodeKind.Record,
583
- /* TNode */ TreeRecordNode<T>,
584
- /* TInsertable */ RecordNodeInsertableData<T>,
585
- /* ImplicitlyConstructable */ true,
586
- /* Info */ T
587
- > {
588
- if (maybeAllowedTypes === undefined) {
589
- const types = nameOrAllowedTypes as (T & TreeNodeSchema) | readonly TreeNodeSchema[];
590
- const fullName = structuralName("Record", types);
591
- return this.getStructuralType(fullName, types, () =>
592
- this.namedRecord(
593
- fullName,
594
- nameOrAllowedTypes as T,
595
- /* customizable */ false,
596
- /* implicitlyConstructable */ true,
597
- ),
598
- ) as TreeNodeSchemaClass<
599
- /* Name */ ScopedSchemaName<TScope, string>,
600
- /* Kind */ NodeKind.Record,
601
- /* TNode */ TreeRecordNode<T>,
602
- /* TInsertable */ RecordNodeInsertableData<T>,
603
- /* ImplicitlyConstructable */ true,
604
- /* Info */ T,
605
- /* TConstructorExtra */ undefined
606
- >;
607
- }
608
- const out: TreeNodeSchemaBoth<
609
- /* Name */ ScopedSchemaName<TScope, string>,
610
- /* Kind */ NodeKind.Record,
611
- /* TNode */ TreeRecordNode<T>,
612
- /* TInsertable */ RecordNodeInsertableData<T>,
613
- /* ImplicitlyConstructable */ true,
614
- /* Info */ T,
615
- /* TConstructorExtra */ undefined
616
- > = this.namedRecord(
617
- nameOrAllowedTypes as TName,
618
- maybeAllowedTypes,
619
- /* customizable */ true,
620
- /* implicitlyConstructable */ true,
621
- );
622
- return out;
623
- }
624
-
625
- /**
626
- * Define a {@link TreeNodeSchema} for a {@link (TreeRecordNode:interface)}.
627
- *
628
- * @param name - Unique identifier for this schema within this factory's scope.
629
- *
630
- * @remarks
631
- * This is not intended to be used directly, use the overload of `record` which takes a name instead.
632
- */
633
- private namedRecord<
634
- Name extends TName | string,
635
- const T extends ImplicitAllowedTypes,
636
- const ImplicitlyConstructable extends boolean,
637
- const TCustomMetadata = unknown,
638
- >(
639
- name: Name,
640
- allowedTypes: T,
641
- customizable: boolean,
642
- implicitlyConstructable: ImplicitlyConstructable,
643
- options?: NodeSchemaOptionsAlpha<TCustomMetadata>,
644
- ): TreeNodeSchemaBoth<
645
- /* Name */ ScopedSchemaName<TScope, Name>,
646
- /* Kind */ NodeKind.Record,
647
- /* TNode */ TreeRecordNode<T> &
648
- WithType<ScopedSchemaName<TScope, string>, NodeKind.Record>,
649
- /* TInsertable */ RecordNodeInsertableData<T>,
650
- /* ImplicitlyConstructable */ ImplicitlyConstructable,
651
- /* Info */ T,
652
- /* TConstructorExtra */ undefined
653
- > {
654
- const record = recordSchema({
655
- identifier: scoped<TScope, TName, Name>(this, name),
656
- info: allowedTypes,
657
- customizable,
658
- implicitlyConstructable,
659
- metadata: options?.metadata,
660
- persistedMetadata: options?.persistedMetadata,
661
- });
662
-
663
- return record as TreeNodeSchemaBoth<
664
- /* Name */ ScopedSchemaName<TScope, Name>,
665
- /* Kind */ NodeKind.Record,
666
- /* TNode */ TreeRecordNode<T> &
667
- WithType<ScopedSchemaName<TScope, string>, NodeKind.Record>,
668
- /* TInsertable */ RecordNodeInsertableData<T>,
669
- /* ImplicitlyConstructable */ ImplicitlyConstructable,
670
- /* Info */ T,
671
- /* TConstructorExtra */ undefined
672
- >;
673
- }
674
-
675
394
  /**
676
395
  * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeRecordNode:interface)}.
677
396
  *
@@ -704,27 +423,28 @@ export class SchemaFactoryAlpha<
704
423
  }
705
424
 
706
425
  /**
707
- * {@link SchemaFactoryAlpha.(record:2)} except tweaked to work better for recursive types.
426
+ * {@link SchemaFactoryBeta.(record:2)} except tweaked to work better for recursive types.
708
427
  * Use with {@link ValidateRecursiveSchema} for improved type safety.
709
428
  * @remarks
710
429
  * This version of `SchemaFactory.record` uses the same workarounds as {@link SchemaFactory.objectRecursive}.
711
430
  * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
712
431
  */
713
432
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
714
- public recordRecursive<
433
+ public override recordRecursive<
715
434
  Name extends TName,
716
435
  const T extends System_Unsafe.ImplicitAllowedTypesUnsafe,
717
436
  const TCustomMetadata = unknown,
718
437
  >(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {
719
- const RecordSchema = this.namedRecord(
720
- name,
721
- allowedTypes as T & ImplicitAllowedTypes,
722
- /* customizable */ true,
438
+ const RecordSchema = recordSchema({
439
+ identifier: scoped<TScope, TName, Name>(this, name),
440
+ info: allowedTypes as T & ImplicitAllowedTypes,
441
+ customizable: true,
723
442
  // Setting this to true seems to work ok currently, but not for other node kinds.
724
443
  // Supporting this could be fragile and might break other future changes, so it's being kept as false for now.
725
- /* implicitlyConstructable */ false,
726
- options,
727
- );
444
+ implicitlyConstructable: false,
445
+ metadata: options?.metadata,
446
+ persistedMetadata: options?.persistedMetadata,
447
+ });
728
448
 
729
449
  return RecordSchema as TreeNodeSchemaClass<
730
450
  /* Name */ ScopedSchemaName<TScope, Name>,