@fluidframework/tree 2.50.0-345060 → 2.51.0-347100

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 (620) hide show
  1. package/.vscode/Tree.code-workspace +14 -1
  2. package/.vscode/settings.json +16 -0
  3. package/CHANGELOG.md +102 -2
  4. package/api-report/tree.alpha.api.md +7 -7
  5. package/dist/core/schema-stored/schema.d.ts +14 -1
  6. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  7. package/dist/core/schema-stored/schema.js.map +1 -1
  8. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  9. package/dist/feature-libraries/default-schema/schemaChecker.js +3 -0
  10. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  11. package/dist/feature-libraries/flex-tree/context.d.ts +7 -2
  12. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  13. package/dist/feature-libraries/flex-tree/context.js +4 -4
  14. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  15. package/dist/feature-libraries/flex-tree/index.d.ts +1 -0
  16. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  17. package/dist/feature-libraries/flex-tree/index.js +3 -1
  18. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  19. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  20. package/dist/feature-libraries/flex-tree/lazyField.js +5 -5
  21. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  22. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
  23. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  24. package/dist/feature-libraries/flex-tree/lazyNode.js +5 -3
  25. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  26. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  27. package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -4
  28. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  29. package/dist/feature-libraries/index.d.ts +1 -1
  30. package/dist/feature-libraries/index.d.ts.map +1 -1
  31. package/dist/feature-libraries/index.js +2 -1
  32. package/dist/feature-libraries/index.js.map +1 -1
  33. package/dist/packageVersion.d.ts +1 -1
  34. package/dist/packageVersion.js +1 -1
  35. package/dist/packageVersion.js.map +1 -1
  36. package/dist/shared-tree/index.d.ts +0 -1
  37. package/dist/shared-tree/index.d.ts.map +1 -1
  38. package/dist/shared-tree/index.js +1 -3
  39. package/dist/shared-tree/index.js.map +1 -1
  40. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  41. package/dist/shared-tree/schematizeTree.js +2 -6
  42. package/dist/shared-tree/schematizeTree.js.map +1 -1
  43. package/dist/shared-tree/schematizingTreeView.d.ts +11 -13
  44. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  45. package/dist/shared-tree/schematizingTreeView.js +58 -81
  46. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  47. package/dist/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
  48. package/dist/shared-tree/sharedTreeChangeTypes.js.map +1 -1
  49. package/dist/shared-tree/tree.d.ts.map +1 -1
  50. package/dist/shared-tree/tree.js +4 -3
  51. package/dist/shared-tree/tree.js.map +1 -1
  52. package/dist/shared-tree/treeAlpha.d.ts +7 -1
  53. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  54. package/dist/shared-tree/treeAlpha.js.map +1 -1
  55. package/dist/shared-tree/treeCheckout.d.ts +7 -2
  56. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  57. package/dist/shared-tree/treeCheckout.js +4 -1
  58. package/dist/shared-tree/treeCheckout.js.map +1 -1
  59. package/dist/shared-tree-core/defaultResubmitMachine.d.ts +8 -12
  60. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  61. package/dist/shared-tree-core/defaultResubmitMachine.js +54 -46
  62. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  63. package/dist/shared-tree-core/resubmitMachine.d.ts +6 -0
  64. package/dist/shared-tree-core/resubmitMachine.d.ts.map +1 -1
  65. package/dist/shared-tree-core/resubmitMachine.js.map +1 -1
  66. package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -0
  67. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  68. package/dist/shared-tree-core/sharedTreeCore.js +16 -3
  69. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  70. package/dist/simple-tree/api/conciseTree.d.ts +1 -1
  71. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  72. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  73. package/dist/simple-tree/api/configuration.d.ts +1 -1
  74. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  75. package/dist/simple-tree/api/configuration.js +9 -9
  76. package/dist/simple-tree/api/configuration.js.map +1 -1
  77. package/dist/simple-tree/api/create.d.ts +3 -1
  78. package/dist/simple-tree/api/create.d.ts.map +1 -1
  79. package/dist/simple-tree/api/create.js +2 -0
  80. package/dist/simple-tree/api/create.js.map +1 -1
  81. package/dist/simple-tree/api/customTree.d.ts +1 -2
  82. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  83. package/dist/simple-tree/api/customTree.js.map +1 -1
  84. package/dist/simple-tree/api/getJsonSchema.d.ts +1 -1
  85. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  86. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  87. package/dist/simple-tree/api/getSimpleSchema.d.ts +1 -1
  88. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  89. package/dist/simple-tree/api/identifierIndex.d.ts +1 -1
  90. package/dist/simple-tree/api/identifierIndex.js +2 -2
  91. package/dist/simple-tree/api/identifierIndex.js.map +1 -1
  92. package/dist/simple-tree/api/index.d.ts +1 -1
  93. package/dist/simple-tree/api/index.d.ts.map +1 -1
  94. package/dist/simple-tree/api/index.js.map +1 -1
  95. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
  96. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  97. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
  98. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  99. package/dist/simple-tree/api/schemaCreationUtilities.js +41 -4
  100. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  101. package/dist/simple-tree/api/schemaFactory.d.ts +36 -3
  102. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  103. package/dist/simple-tree/api/schemaFactory.js +18 -18
  104. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  105. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
  106. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  107. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  108. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  109. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  110. package/dist/simple-tree/api/schemaFactoryRecursive.js +2 -2
  111. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  112. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  113. package/dist/simple-tree/api/schemaFromSimple.js +4 -4
  114. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  115. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +2 -2
  116. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  117. package/dist/simple-tree/api/simpleTreeIndex.d.ts +2 -2
  118. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  119. package/dist/simple-tree/api/simpleTreeIndex.js +1 -1
  120. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  121. package/dist/simple-tree/api/storedSchema.d.ts +1 -1
  122. package/dist/simple-tree/api/storedSchema.js +2 -2
  123. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  124. package/dist/simple-tree/api/tree.d.ts +2 -1
  125. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  126. package/dist/simple-tree/api/tree.js.map +1 -1
  127. package/dist/simple-tree/api/treeBeta.d.ts +4 -1
  128. package/dist/simple-tree/api/treeBeta.d.ts.map +1 -1
  129. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  130. package/dist/simple-tree/api/treeNodeApi.d.ts +1 -2
  131. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  132. package/dist/simple-tree/api/treeNodeApi.js +3 -3
  133. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  134. package/dist/simple-tree/api/typesUnsafe.d.ts +2 -3
  135. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  136. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  137. package/dist/simple-tree/api/verboseTree.d.ts +2 -1
  138. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  139. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  140. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
  141. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +2 -2
  142. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  143. package/dist/simple-tree/core/allowedTypes.d.ts +316 -0
  144. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -0
  145. package/dist/simple-tree/core/allowedTypes.js +173 -0
  146. package/dist/simple-tree/core/allowedTypes.js.map +1 -0
  147. package/dist/simple-tree/core/context.d.ts +3 -9
  148. package/dist/simple-tree/core/context.d.ts.map +1 -1
  149. package/dist/simple-tree/core/context.js +3 -11
  150. package/dist/simple-tree/core/context.js.map +1 -1
  151. package/dist/simple-tree/core/flexList.d.ts.map +1 -0
  152. package/dist/simple-tree/core/flexList.js.map +1 -0
  153. package/dist/simple-tree/core/getOrCreateNode.d.ts +1 -1
  154. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  155. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  156. package/dist/simple-tree/core/index.d.ts +9 -3
  157. package/dist/simple-tree/core/index.d.ts.map +1 -1
  158. package/dist/simple-tree/core/index.js +19 -3
  159. package/dist/simple-tree/core/index.js.map +1 -1
  160. package/dist/simple-tree/core/treeNodeKernel.d.ts +8 -1
  161. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  162. package/dist/simple-tree/core/treeNodeKernel.js +24 -20
  163. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  164. package/dist/simple-tree/core/treeNodeSchema.d.ts +182 -39
  165. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  166. package/dist/simple-tree/core/treeNodeSchema.js +47 -17
  167. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  168. package/dist/simple-tree/{treeNodeValid.d.ts → core/treeNodeValid.d.ts} +18 -4
  169. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -0
  170. package/dist/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +41 -11
  171. package/dist/simple-tree/core/treeNodeValid.js.map +1 -0
  172. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  173. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  174. package/dist/simple-tree/core/walkSchema.d.ts +2 -1
  175. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  176. package/dist/simple-tree/core/walkSchema.js +6 -2
  177. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  178. package/dist/simple-tree/createContext.d.ts +6 -2
  179. package/dist/simple-tree/createContext.d.ts.map +1 -1
  180. package/dist/simple-tree/createContext.js +15 -3
  181. package/dist/simple-tree/createContext.js.map +1 -1
  182. package/dist/simple-tree/fieldSchema.d.ts +423 -0
  183. package/dist/simple-tree/fieldSchema.d.ts.map +1 -0
  184. package/dist/simple-tree/{schemaTypes.js → fieldSchema.js} +5 -195
  185. package/dist/simple-tree/fieldSchema.js.map +1 -0
  186. package/dist/simple-tree/index.d.ts +5 -5
  187. package/dist/simple-tree/index.d.ts.map +1 -1
  188. package/dist/simple-tree/index.js +11 -11
  189. package/dist/simple-tree/index.js.map +1 -1
  190. package/dist/simple-tree/leafNodeSchema.d.ts +14 -5
  191. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  192. package/dist/simple-tree/leafNodeSchema.js +117 -2
  193. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  194. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
  195. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  196. package/dist/simple-tree/node-kinds/array/arrayNode.js +97 -26
  197. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  198. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
  199. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  200. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  201. package/dist/simple-tree/node-kinds/common.d.ts +16 -0
  202. package/dist/simple-tree/node-kinds/common.d.ts.map +1 -0
  203. package/dist/simple-tree/node-kinds/common.js +42 -0
  204. package/dist/simple-tree/node-kinds/common.js.map +1 -0
  205. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  206. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  207. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  208. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
  209. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  210. package/dist/simple-tree/node-kinds/map/mapNode.js +64 -26
  211. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  212. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
  213. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  214. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  215. package/dist/simple-tree/node-kinds/object/index.d.ts +1 -1
  216. package/dist/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  217. package/dist/simple-tree/node-kinds/object/index.js.map +1 -1
  218. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
  219. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  220. package/dist/simple-tree/node-kinds/object/objectNode.js +131 -27
  221. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  222. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
  223. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  224. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  225. package/dist/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
  226. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  227. package/dist/simple-tree/node-kinds/record/recordNode.js +41 -13
  228. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  229. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  230. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  231. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  232. package/dist/simple-tree/prepareForInsertion.d.ts +2 -2
  233. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  234. package/dist/simple-tree/prepareForInsertion.js +3 -3
  235. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  236. package/dist/simple-tree/simpleSchema.d.ts +2 -2
  237. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  238. package/dist/simple-tree/simpleSchema.js.map +1 -1
  239. package/dist/simple-tree/toStoredSchema.d.ts +1 -1
  240. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  241. package/dist/simple-tree/toStoredSchema.js +6 -7
  242. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  243. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
  244. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  245. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +25 -395
  246. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  247. package/dist/simple-tree/unsafeUnknownSchema.d.ts +52 -0
  248. package/dist/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
  249. package/dist/simple-tree/unsafeUnknownSchema.js +13 -0
  250. package/dist/simple-tree/unsafeUnknownSchema.js.map +1 -0
  251. package/dist/simple-tree/walkFieldSchema.d.ts +1 -1
  252. package/dist/simple-tree/walkFieldSchema.js +2 -2
  253. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  254. package/dist/tableSchema.d.ts +12 -12
  255. package/dist/treeFactory.d.ts +0 -1
  256. package/dist/treeFactory.d.ts.map +1 -1
  257. package/dist/treeFactory.js +0 -1
  258. package/dist/treeFactory.js.map +1 -1
  259. package/lib/core/schema-stored/schema.d.ts +14 -1
  260. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  261. package/lib/core/schema-stored/schema.js.map +1 -1
  262. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  263. package/lib/feature-libraries/default-schema/schemaChecker.js +3 -0
  264. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  265. package/lib/feature-libraries/flex-tree/context.d.ts +7 -2
  266. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  267. package/lib/feature-libraries/flex-tree/context.js +4 -4
  268. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  269. package/lib/feature-libraries/flex-tree/index.d.ts +1 -0
  270. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  271. package/lib/feature-libraries/flex-tree/index.js +1 -0
  272. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  273. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  274. package/lib/feature-libraries/flex-tree/lazyField.js +6 -6
  275. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  276. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +3 -1
  277. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  278. package/lib/feature-libraries/flex-tree/lazyNode.js +3 -1
  279. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  280. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  281. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -2
  282. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  283. package/lib/feature-libraries/index.d.ts +1 -1
  284. package/lib/feature-libraries/index.d.ts.map +1 -1
  285. package/lib/feature-libraries/index.js +1 -1
  286. package/lib/feature-libraries/index.js.map +1 -1
  287. package/lib/packageVersion.d.ts +1 -1
  288. package/lib/packageVersion.js +1 -1
  289. package/lib/packageVersion.js.map +1 -1
  290. package/lib/shared-tree/index.d.ts +0 -1
  291. package/lib/shared-tree/index.d.ts.map +1 -1
  292. package/lib/shared-tree/index.js +0 -1
  293. package/lib/shared-tree/index.js.map +1 -1
  294. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  295. package/lib/shared-tree/schematizeTree.js +2 -6
  296. package/lib/shared-tree/schematizeTree.js.map +1 -1
  297. package/lib/shared-tree/schematizingTreeView.d.ts +11 -13
  298. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  299. package/lib/shared-tree/schematizingTreeView.js +59 -81
  300. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  301. package/lib/shared-tree/sharedTreeChangeTypes.d.ts +1 -1
  302. package/lib/shared-tree/sharedTreeChangeTypes.js.map +1 -1
  303. package/lib/shared-tree/tree.d.ts.map +1 -1
  304. package/lib/shared-tree/tree.js +4 -3
  305. package/lib/shared-tree/tree.js.map +1 -1
  306. package/lib/shared-tree/treeAlpha.d.ts +7 -1
  307. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  308. package/lib/shared-tree/treeAlpha.js.map +1 -1
  309. package/lib/shared-tree/treeCheckout.d.ts +7 -2
  310. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  311. package/lib/shared-tree/treeCheckout.js +5 -2
  312. package/lib/shared-tree/treeCheckout.js.map +1 -1
  313. package/lib/shared-tree-core/defaultResubmitMachine.d.ts +8 -12
  314. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  315. package/lib/shared-tree-core/defaultResubmitMachine.js +55 -47
  316. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  317. package/lib/shared-tree-core/resubmitMachine.d.ts +6 -0
  318. package/lib/shared-tree-core/resubmitMachine.d.ts.map +1 -1
  319. package/lib/shared-tree-core/resubmitMachine.js.map +1 -1
  320. package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -0
  321. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  322. package/lib/shared-tree-core/sharedTreeCore.js +16 -3
  323. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  324. package/lib/simple-tree/api/conciseTree.d.ts +1 -1
  325. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  326. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  327. package/lib/simple-tree/api/configuration.d.ts +1 -1
  328. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  329. package/lib/simple-tree/api/configuration.js +6 -6
  330. package/lib/simple-tree/api/configuration.js.map +1 -1
  331. package/lib/simple-tree/api/create.d.ts +3 -1
  332. package/lib/simple-tree/api/create.d.ts.map +1 -1
  333. package/lib/simple-tree/api/create.js +2 -0
  334. package/lib/simple-tree/api/create.js.map +1 -1
  335. package/lib/simple-tree/api/customTree.d.ts +1 -2
  336. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  337. package/lib/simple-tree/api/customTree.js.map +1 -1
  338. package/lib/simple-tree/api/getJsonSchema.d.ts +1 -1
  339. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  340. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  341. package/lib/simple-tree/api/getSimpleSchema.d.ts +1 -1
  342. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  343. package/lib/simple-tree/api/identifierIndex.d.ts +1 -1
  344. package/lib/simple-tree/api/identifierIndex.js +1 -1
  345. package/lib/simple-tree/api/identifierIndex.js.map +1 -1
  346. package/lib/simple-tree/api/index.d.ts +1 -1
  347. package/lib/simple-tree/api/index.d.ts.map +1 -1
  348. package/lib/simple-tree/api/index.js.map +1 -1
  349. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
  350. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  351. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +14 -2
  352. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  353. package/lib/simple-tree/api/schemaCreationUtilities.js +40 -4
  354. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  355. package/lib/simple-tree/api/schemaFactory.d.ts +36 -3
  356. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  357. package/lib/simple-tree/api/schemaFactory.js +2 -2
  358. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  359. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +16 -16
  360. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  361. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  362. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +2 -2
  363. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  364. package/lib/simple-tree/api/schemaFactoryRecursive.js +1 -1
  365. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  366. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  367. package/lib/simple-tree/api/schemaFromSimple.js +1 -1
  368. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  369. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +1 -1
  370. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  371. package/lib/simple-tree/api/simpleTreeIndex.d.ts +2 -2
  372. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  373. package/lib/simple-tree/api/simpleTreeIndex.js +2 -2
  374. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  375. package/lib/simple-tree/api/storedSchema.d.ts +1 -1
  376. package/lib/simple-tree/api/storedSchema.js +1 -1
  377. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  378. package/lib/simple-tree/api/tree.d.ts +2 -1
  379. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  380. package/lib/simple-tree/api/tree.js.map +1 -1
  381. package/lib/simple-tree/api/treeBeta.d.ts +4 -1
  382. package/lib/simple-tree/api/treeBeta.d.ts.map +1 -1
  383. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  384. package/lib/simple-tree/api/treeNodeApi.d.ts +1 -2
  385. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  386. package/lib/simple-tree/api/treeNodeApi.js +2 -2
  387. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  388. package/lib/simple-tree/api/typesUnsafe.d.ts +2 -3
  389. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  390. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  391. package/lib/simple-tree/api/verboseTree.d.ts +2 -1
  392. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  393. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  394. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +1 -1
  395. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +1 -1
  396. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  397. package/lib/simple-tree/core/allowedTypes.d.ts +316 -0
  398. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -0
  399. package/lib/simple-tree/core/allowedTypes.js +162 -0
  400. package/lib/simple-tree/core/allowedTypes.js.map +1 -0
  401. package/lib/simple-tree/core/context.d.ts +3 -9
  402. package/lib/simple-tree/core/context.d.ts.map +1 -1
  403. package/lib/simple-tree/core/context.js +0 -8
  404. package/lib/simple-tree/core/context.js.map +1 -1
  405. package/lib/simple-tree/core/flexList.d.ts.map +1 -0
  406. package/lib/simple-tree/core/flexList.js.map +1 -0
  407. package/lib/simple-tree/core/getOrCreateNode.d.ts +1 -1
  408. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  409. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  410. package/lib/simple-tree/core/index.d.ts +9 -3
  411. package/lib/simple-tree/core/index.d.ts.map +1 -1
  412. package/lib/simple-tree/core/index.js +6 -3
  413. package/lib/simple-tree/core/index.js.map +1 -1
  414. package/lib/simple-tree/core/treeNodeKernel.d.ts +8 -1
  415. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  416. package/lib/simple-tree/core/treeNodeKernel.js +10 -6
  417. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  418. package/lib/simple-tree/core/treeNodeSchema.d.ts +182 -39
  419. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  420. package/lib/simple-tree/core/treeNodeSchema.js +44 -14
  421. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  422. package/lib/simple-tree/{treeNodeValid.d.ts → core/treeNodeValid.d.ts} +18 -4
  423. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -0
  424. package/lib/simple-tree/{treeNodeValid.js → core/treeNodeValid.js} +31 -3
  425. package/lib/simple-tree/core/treeNodeValid.js.map +1 -0
  426. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +1 -1
  427. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  428. package/lib/simple-tree/core/walkSchema.d.ts +2 -1
  429. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  430. package/lib/simple-tree/core/walkSchema.js +7 -3
  431. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  432. package/lib/simple-tree/createContext.d.ts +6 -2
  433. package/lib/simple-tree/createContext.d.ts.map +1 -1
  434. package/lib/simple-tree/createContext.js +13 -2
  435. package/lib/simple-tree/createContext.js.map +1 -1
  436. package/lib/simple-tree/fieldSchema.d.ts +423 -0
  437. package/lib/simple-tree/fieldSchema.d.ts.map +1 -0
  438. package/lib/simple-tree/{schemaTypes.js → fieldSchema.js} +3 -183
  439. package/lib/simple-tree/fieldSchema.js.map +1 -0
  440. package/lib/simple-tree/index.d.ts +5 -5
  441. package/lib/simple-tree/index.d.ts.map +1 -1
  442. package/lib/simple-tree/index.js +2 -2
  443. package/lib/simple-tree/index.js.map +1 -1
  444. package/lib/simple-tree/leafNodeSchema.d.ts +14 -5
  445. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  446. package/lib/simple-tree/leafNodeSchema.js +117 -3
  447. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  448. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -4
  449. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  450. package/lib/simple-tree/node-kinds/array/arrayNode.js +86 -15
  451. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  452. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +2 -2
  453. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  454. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js +1 -1
  455. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  456. package/lib/simple-tree/node-kinds/common.d.ts +16 -0
  457. package/lib/simple-tree/node-kinds/common.d.ts.map +1 -0
  458. package/lib/simple-tree/node-kinds/common.js +38 -0
  459. package/lib/simple-tree/node-kinds/common.js.map +1 -0
  460. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  461. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  462. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  463. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +2 -3
  464. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  465. package/lib/simple-tree/node-kinds/map/mapNode.js +51 -13
  466. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  467. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +2 -2
  468. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  469. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js +1 -1
  470. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  471. package/lib/simple-tree/node-kinds/object/index.d.ts +1 -1
  472. package/lib/simple-tree/node-kinds/object/index.d.ts.map +1 -1
  473. package/lib/simple-tree/node-kinds/object/index.js.map +1 -1
  474. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +19 -5
  475. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  476. package/lib/simple-tree/node-kinds/object/objectNode.js +116 -14
  477. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  478. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +11 -4
  479. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  480. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js +1 -1
  481. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  482. package/lib/simple-tree/node-kinds/record/recordNode.d.ts +2 -2
  483. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  484. package/lib/simple-tree/node-kinds/record/recordNode.js +40 -12
  485. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  486. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +2 -2
  487. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  488. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js +1 -1
  489. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  490. package/lib/simple-tree/prepareForInsertion.d.ts +2 -2
  491. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  492. package/lib/simple-tree/prepareForInsertion.js +2 -2
  493. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  494. package/lib/simple-tree/simpleSchema.d.ts +2 -2
  495. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  496. package/lib/simple-tree/simpleSchema.js.map +1 -1
  497. package/lib/simple-tree/toStoredSchema.d.ts +1 -1
  498. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  499. package/lib/simple-tree/toStoredSchema.js +2 -3
  500. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  501. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +5 -11
  502. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  503. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +10 -381
  504. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  505. package/lib/simple-tree/unsafeUnknownSchema.d.ts +52 -0
  506. package/lib/simple-tree/unsafeUnknownSchema.d.ts.map +1 -0
  507. package/lib/simple-tree/unsafeUnknownSchema.js +10 -0
  508. package/lib/simple-tree/unsafeUnknownSchema.js.map +1 -0
  509. package/lib/simple-tree/walkFieldSchema.d.ts +1 -1
  510. package/lib/simple-tree/walkFieldSchema.js +1 -1
  511. package/lib/simple-tree/walkFieldSchema.js.map +1 -1
  512. package/lib/tableSchema.d.ts +12 -12
  513. package/lib/treeFactory.d.ts +0 -1
  514. package/lib/treeFactory.d.ts.map +1 -1
  515. package/lib/treeFactory.js +0 -1
  516. package/lib/treeFactory.js.map +1 -1
  517. package/package.json +22 -23
  518. package/src/core/schema-stored/schema.ts +14 -1
  519. package/src/feature-libraries/default-schema/schemaChecker.ts +3 -0
  520. package/src/feature-libraries/flex-tree/context.ts +10 -5
  521. package/src/feature-libraries/flex-tree/index.ts +2 -0
  522. package/src/feature-libraries/flex-tree/lazyField.ts +10 -6
  523. package/src/feature-libraries/flex-tree/lazyNode.ts +6 -1
  524. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -2
  525. package/src/feature-libraries/index.ts +1 -0
  526. package/src/packageVersion.ts +1 -1
  527. package/src/shared-tree/index.ts +0 -2
  528. package/src/shared-tree/schematizeTree.ts +2 -6
  529. package/src/shared-tree/schematizingTreeView.ts +72 -107
  530. package/src/shared-tree/sharedTreeChangeTypes.ts +1 -1
  531. package/src/shared-tree/tree.ts +4 -3
  532. package/src/shared-tree/treeAlpha.ts +7 -1
  533. package/src/shared-tree/treeCheckout.ts +15 -2
  534. package/src/shared-tree-core/defaultResubmitMachine.ts +99 -52
  535. package/src/shared-tree-core/resubmitMachine.ts +7 -0
  536. package/src/shared-tree-core/sharedTreeCore.ts +18 -6
  537. package/src/simple-tree/api/conciseTree.ts +1 -2
  538. package/src/simple-tree/api/configuration.ts +11 -8
  539. package/src/simple-tree/api/create.ts +3 -1
  540. package/src/simple-tree/api/customTree.ts +1 -2
  541. package/src/simple-tree/api/getJsonSchema.ts +1 -1
  542. package/src/simple-tree/api/getSimpleSchema.ts +1 -1
  543. package/src/simple-tree/api/identifierIndex.ts +1 -1
  544. package/src/simple-tree/api/index.ts +2 -0
  545. package/src/simple-tree/api/schemaCompatibilityTester.ts +1 -1
  546. package/src/simple-tree/api/schemaCreationUtilities.ts +47 -5
  547. package/src/simple-tree/api/schemaFactory.ts +45 -10
  548. package/src/simple-tree/api/schemaFactoryAlpha.ts +4 -7
  549. package/src/simple-tree/api/schemaFactoryRecursive.ts +9 -4
  550. package/src/simple-tree/api/schemaFromSimple.ts +2 -3
  551. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
  552. package/src/simple-tree/api/simpleTreeIndex.ts +8 -3
  553. package/src/simple-tree/api/storedSchema.ts +1 -1
  554. package/src/simple-tree/api/tree.ts +2 -2
  555. package/src/simple-tree/api/treeBeta.ts +4 -1
  556. package/src/simple-tree/api/treeNodeApi.ts +5 -8
  557. package/src/simple-tree/api/typesUnsafe.ts +5 -4
  558. package/src/simple-tree/api/verboseTree.ts +3 -6
  559. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +1 -1
  560. package/src/simple-tree/core/README.md +1 -1
  561. package/src/simple-tree/core/allowedTypes.ts +496 -0
  562. package/src/simple-tree/core/context.ts +3 -10
  563. package/src/simple-tree/core/getOrCreateNode.ts +1 -1
  564. package/src/simple-tree/core/index.ts +62 -9
  565. package/src/simple-tree/core/treeNodeKernel.ts +12 -6
  566. package/src/simple-tree/core/treeNodeSchema.ts +247 -63
  567. package/src/simple-tree/{treeNodeValid.ts → core/treeNodeValid.ts} +59 -15
  568. package/src/simple-tree/core/unhydratedFlexTree.ts +1 -1
  569. package/src/simple-tree/core/walkSchema.ts +9 -5
  570. package/src/simple-tree/createContext.ts +26 -2
  571. package/src/simple-tree/fieldSchema.ts +734 -0
  572. package/src/simple-tree/index.ts +32 -30
  573. package/src/simple-tree/leafNodeSchema.ts +137 -5
  574. package/src/simple-tree/node-kinds/array/arrayNode.ts +141 -30
  575. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +5 -7
  576. package/src/simple-tree/node-kinds/common.ts +60 -0
  577. package/src/simple-tree/node-kinds/index.ts +1 -0
  578. package/src/simple-tree/node-kinds/map/mapNode.ts +91 -33
  579. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +5 -7
  580. package/src/simple-tree/node-kinds/object/index.ts +1 -0
  581. package/src/simple-tree/node-kinds/object/objectNode.ts +205 -25
  582. package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +22 -5
  583. package/src/simple-tree/node-kinds/record/recordNode.ts +68 -26
  584. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +6 -8
  585. package/src/simple-tree/prepareForInsertion.ts +7 -6
  586. package/src/simple-tree/simpleSchema.ts +2 -2
  587. package/src/simple-tree/toStoredSchema.ts +2 -3
  588. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +12 -494
  589. package/src/simple-tree/unsafeUnknownSchema.ts +70 -0
  590. package/src/simple-tree/walkFieldSchema.ts +1 -1
  591. package/src/treeFactory.ts +0 -1
  592. package/dist/shared-tree/checkoutFlexTreeView.d.ts +0 -58
  593. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
  594. package/dist/shared-tree/checkoutFlexTreeView.js +0 -77
  595. package/dist/shared-tree/checkoutFlexTreeView.js.map +0 -1
  596. package/dist/simple-tree/flexList.d.ts.map +0 -1
  597. package/dist/simple-tree/flexList.js.map +0 -1
  598. package/dist/simple-tree/schemaTypes.d.ts +0 -856
  599. package/dist/simple-tree/schemaTypes.d.ts.map +0 -1
  600. package/dist/simple-tree/schemaTypes.js.map +0 -1
  601. package/dist/simple-tree/treeNodeValid.d.ts.map +0 -1
  602. package/dist/simple-tree/treeNodeValid.js.map +0 -1
  603. package/lib/shared-tree/checkoutFlexTreeView.d.ts +0 -58
  604. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +0 -1
  605. package/lib/shared-tree/checkoutFlexTreeView.js +0 -72
  606. package/lib/shared-tree/checkoutFlexTreeView.js.map +0 -1
  607. package/lib/simple-tree/flexList.d.ts.map +0 -1
  608. package/lib/simple-tree/flexList.js.map +0 -1
  609. package/lib/simple-tree/schemaTypes.d.ts +0 -856
  610. package/lib/simple-tree/schemaTypes.d.ts.map +0 -1
  611. package/lib/simple-tree/schemaTypes.js.map +0 -1
  612. package/lib/simple-tree/treeNodeValid.d.ts.map +0 -1
  613. package/lib/simple-tree/treeNodeValid.js.map +0 -1
  614. package/src/shared-tree/checkoutFlexTreeView.ts +0 -100
  615. package/src/simple-tree/schemaTypes.ts +0 -1420
  616. /package/dist/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
  617. /package/dist/simple-tree/{flexList.js → core/flexList.js} +0 -0
  618. /package/lib/simple-tree/{flexList.d.ts → core/flexList.d.ts} +0 -0
  619. /package/lib/simple-tree/{flexList.js → core/flexList.js} +0 -0
  620. /package/src/simple-tree/{flexList.ts → core/flexList.ts} +0 -0
@@ -16,10 +16,9 @@ import { anchorSlot, type SchemaPolicy } from "../core/index.js";
16
16
  import {
17
17
  type NodeIdentifierManager,
18
18
  defaultSchemaPolicy,
19
- ContextSlot,
20
19
  cursorForMapTreeNode,
21
- type FullSchemaPolicy,
22
20
  TreeStatus,
21
+ Context,
23
22
  } from "../feature-libraries/index.js";
24
23
  import {
25
24
  type ImplicitFieldSchema,
@@ -53,6 +52,7 @@ import {
53
52
  createUnknownOptionalFieldPolicy,
54
53
  prepareForInsertionContextless,
55
54
  type FieldSchema,
55
+ tryDisposeTreeNode,
56
56
  } from "../simple-tree/index.js";
57
57
  import {
58
58
  type Breakable,
@@ -61,7 +61,6 @@ import {
61
61
  type WithBreakable,
62
62
  } from "../util/index.js";
63
63
 
64
- import { CheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
65
64
  import { canInitialize, ensureSchema, initialize } from "./schematizeTree.js";
66
65
  import type { ITreeCheckout, TreeCheckout } from "./treeCheckout.js";
67
66
 
@@ -80,11 +79,11 @@ export class SchematizingSimpleTreeView<
80
79
  > implements TreeBranch, TreeViewAlpha<TRootSchema>, WithBreakable
81
80
  {
82
81
  /**
83
- * The view is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.
82
+ * This is set to undefined when this object is disposed or the view schema does not support viewing the document's stored schema.
84
83
  *
85
84
  * The view schema may be incompatible with the stored schema. Use `compatibility` to check.
86
85
  */
87
- private view: CheckoutFlexTreeView | undefined;
86
+ private flexTreeContext: Context | undefined;
88
87
 
89
88
  /**
90
89
  * Undefined iff uninitialized or disposed.
@@ -97,6 +96,11 @@ export class SchematizingSimpleTreeView<
97
96
 
98
97
  private readonly viewSchema: SchemaCompatibilityTester;
99
98
 
99
+ /**
100
+ * Events to unregister upon flex-tree view disposal.
101
+ */
102
+ private readonly flexTreeViewUnregisterCallbacks = new Set<() => void>();
103
+
100
104
  /**
101
105
  * Events to unregister upon disposal.
102
106
  */
@@ -203,7 +207,7 @@ export class SchematizingSimpleTreeView<
203
207
 
204
208
  if (!compatibility.canUpgrade) {
205
209
  throw new UsageError(
206
- "Existing stored schema can not be upgraded (see TreeView.compatibility.canUpgrade).",
210
+ "Existing stored schema cannot be upgraded (see TreeView.compatibility.canUpgrade).",
207
211
  );
208
212
  }
209
213
 
@@ -214,12 +218,12 @@ export class SchematizingSimpleTreeView<
214
218
  }
215
219
 
216
220
  /**
217
- * Gets the view. Throws when disposed.
221
+ * Gets the flex-tree context. Throws when disposed or out of schema.
218
222
  */
219
- public getView(): CheckoutFlexTreeView {
223
+ public getFlexTreeContext(): Context {
220
224
  this.ensureUndisposed();
221
- assert(this.view !== undefined, 0x8c0 /* unexpected getViewOrError */);
222
- return this.view;
225
+ assert(this.flexTreeContext !== undefined, 0x8c0 /* unexpected getViewOrError */);
226
+ return this.flexTreeContext;
223
227
  }
224
228
 
225
229
  /**
@@ -301,82 +305,65 @@ export class SchematizingSimpleTreeView<
301
305
  * If implicit initialization (or some other edit) is desired, it should be done outside of this method.
302
306
  */
303
307
  private update(): void {
304
- this.disposeView();
308
+ this.disposeFlexView();
305
309
 
306
310
  const compatibility = this.viewSchema.checkCompatibility(this.checkout.storedSchema);
307
311
 
308
- let lastRoot =
309
- this.compatibility.canView && this.view !== undefined ? this.root : undefined;
310
312
  this.currentCompatibility = {
311
313
  ...compatibility,
312
314
  canInitialize: canInitialize(this.checkout),
313
315
  };
314
316
 
315
- if (compatibility.canView) {
316
- // Trigger "rootChanged" if the root changes in the future.
317
- // Currently there is no good way to do this as FlexTreeField has no events for changes.
318
- // this.view.flexTree.on(????)
319
- // As a workaround for the above, trigger "rootChanged" in "afterBatch"
320
- // which isn't the correct time since we normally do events during the batch when the forest is modified, but its better than nothing.
321
- // TODO: provide a better event: this.view.flexTree.on(????)
322
- const cleanupCheckOutEvents = this.checkout.events.on("afterBatch", () => {
323
- // In the initialization flow, this event is raised before the correct compatibility w.r.t the new schema is calculated.
324
- // Accessing `this.root` in that case can throw. It's OK to ignore this because:
325
- // - The rootChanged event will already be raised at the end of the current upgrade
326
- // - It doesn't matter that `lastRoot` isn't updated in this case, because `update` will be called again before the upgrade
327
- // completes (at which point this callback and the `lastRoot` captured here will be out of scope anyway)
328
- if (!this.midUpgrade && lastRoot !== this.root) {
329
- lastRoot = this.root;
330
- this.events.emit("rootChanged");
331
- }
332
- });
333
-
334
- const onViewDispose = (): void => {
335
- cleanupCheckOutEvents();
336
- this.view = undefined;
337
- if (!this.disposed) {
338
- this.update();
339
- }
340
- };
317
+ const anchors = this.checkout.forest.anchors;
318
+ const slots = anchors.slots;
341
319
 
342
- const view = requireSchema(
320
+ if (compatibility.canView) {
321
+ this.flexTreeContext = new Context(
322
+ this.schemaPolicy,
343
323
  this.checkout,
344
- this.viewSchema,
345
- onViewDispose,
346
324
  this.nodeKeyManager,
347
- this.schemaPolicy,
348
- );
349
- this.view = view;
350
- assert(
351
- !this.checkout.forest.anchors.slots.has(SimpleContextSlot),
352
- 0xa47 /* extra simple tree context */,
353
325
  );
354
- this.checkout.forest.anchors.slots.set(
326
+ assert(!slots.has(SimpleContextSlot), 0xa47 /* extra simple tree context */);
327
+ slots.set(
355
328
  SimpleContextSlot,
356
329
  new HydratedContext(
357
330
  normalizeFieldSchema(this.rootFieldSchema).annotatedAllowedTypesNormalized,
358
- view.context,
331
+ this.flexTreeContext,
359
332
  ),
360
333
  );
361
334
 
362
- const unregister = this.checkout.storedSchema.events.on("afterSchemaChange", () => {
363
- unregister();
364
- this.unregisterCallbacks.delete(unregister);
365
- view[disposeSymbol]();
366
- });
367
- this.unregisterCallbacks.add(unregister);
368
- } else {
369
- this.view = undefined;
370
- this.checkout.forest.anchors.slots.delete(SimpleContextSlot);
371
-
372
- const unregister = this.checkout.storedSchema.events.on("afterSchemaChange", () => {
373
- unregister();
374
- this.unregisterCallbacks.delete(unregister);
375
- this.update();
376
- });
377
- this.unregisterCallbacks.add(unregister);
335
+ // Trigger "rootChanged" events if the root changes in the future.
336
+ {
337
+ // Currently there is no good way to do this as FlexTreeField has no events for changes.
338
+ // this.root.on(????)
339
+ // As a workaround for the above, trigger "rootChanged" in "afterBatch".
340
+ // Ideally these events would be just events for changes within the root.
341
+ // TODO: provide a better event: this.view.flexTree.on(????) and/or integrate with with the normal event code paths.
342
+
343
+ // Track what the root was before to be able to detect changes.
344
+ let lastRoot: ReadableField<TRootSchema> = this.root;
345
+
346
+ this.flexTreeViewUnregisterCallbacks.add(
347
+ this.checkout.events.on("afterBatch", () => {
348
+ // In the initialization flow, this event is raised before the correct compatibility w.r.t the new schema is calculated.
349
+ // Accessing `this.root` in that case can throw. It's OK to ignore this because:
350
+ // - The rootChanged event will already be raised at the end of the current upgrade
351
+ // - It doesn't matter that `lastRoot` isn't updated in this case, because `update` will be called again before the upgrade
352
+ // completes (at which point this callback and the `lastRoot` captured here will be out of scope anyway)
353
+ if (!this.midUpgrade && lastRoot !== this.root) {
354
+ lastRoot = this.root;
355
+ this.events.emit("rootChanged");
356
+ }
357
+ }),
358
+ );
359
+ }
378
360
  }
379
361
 
362
+ this.flexTreeViewUnregisterCallbacks.add(
363
+ // Will dispose the old view (if there is one) when its no longer valid, and create a new one if appropriate.
364
+ this.checkout.storedSchema.events.on("afterSchemaChange", () => this.update()),
365
+ );
366
+
380
367
  if (!this.midUpgrade) {
381
368
  this.events.emit("schemaChanged");
382
369
  this.events.emit("rootChanged");
@@ -394,14 +381,20 @@ export class SchematizingSimpleTreeView<
394
381
  this.events.emit("rootChanged");
395
382
  }
396
383
 
397
- private disposeView(): void {
398
- if (this.view !== undefined) {
399
- this.view[disposeSymbol]();
400
- this.view = undefined;
401
- this.checkout.forest.anchors.slots.delete(SimpleContextSlot);
402
- this.unregisterCallbacks.forEach((unregister) => unregister());
384
+ private disposeFlexView(): void {
385
+ const anchors = this.checkout.forest.anchors;
386
+ if (this.flexTreeContext !== undefined) {
387
+ // Cleanup any TreeNodes cached in the AnchorSet when disposing the flex-tree which they wrap.
388
+ for (const anchorNode of anchors) {
389
+ tryDisposeTreeNode(anchorNode);
390
+ }
391
+
392
+ this.flexTreeContext[disposeSymbol]();
393
+ this.flexTreeContext = undefined;
403
394
  }
404
- this.checkout.forest.anchors.slots.delete(SimpleContextSlot);
395
+ this.flexTreeViewUnregisterCallbacks.forEach((unregister) => unregister());
396
+ this.flexTreeViewUnregisterCallbacks.clear();
397
+ anchors.slots.delete(SimpleContextSlot);
405
398
  }
406
399
 
407
400
  public get compatibility(): SchemaCompatibilityStatus {
@@ -413,7 +406,8 @@ export class SchematizingSimpleTreeView<
413
406
 
414
407
  public dispose(): void {
415
408
  this.disposed = true;
416
- this.disposeView();
409
+ this.disposeFlexView();
410
+ this.unregisterCallbacks.forEach((unregister) => unregister());
417
411
  this.checkout.forest.anchors.slots.delete(ViewSlot);
418
412
  this.currentCompatibility = undefined;
419
413
  this.onDispose?.();
@@ -430,8 +424,8 @@ export class SchematizingSimpleTreeView<
430
424
  "Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.",
431
425
  );
432
426
  }
433
- const view = this.getView();
434
- return tryGetTreeNodeForField(view.flexTree) as ReadableField<TRootSchema>;
427
+ const view = this.getFlexTreeContext();
428
+ return tryGetTreeNodeForField(view.root) as ReadableField<TRootSchema>;
435
429
  }
436
430
 
437
431
  public set root(newRoot: InsertableField<TRootSchema>) {
@@ -441,12 +435,8 @@ export class SchematizingSimpleTreeView<
441
435
  "Document is out of schema. Check TreeView.compatibility before accessing TreeView.root.",
442
436
  );
443
437
  }
444
- const view = this.getView();
445
- setField(
446
- view.context.root,
447
- this.rootFieldSchema,
448
- newRoot as InsertableContent | undefined,
449
- );
438
+ const view = this.getFlexTreeContext();
439
+ setField(view.root, this.rootFieldSchema, newRoot as InsertableContent | undefined);
450
440
  }
451
441
 
452
442
  // #region Branching
@@ -478,31 +468,6 @@ export function getCheckout(context: TreeBranch): TreeCheckout {
478
468
  throw new UsageError("Unsupported context implementation");
479
469
  }
480
470
 
481
- /**
482
- * Creates a view that self-disposes whenever the stored schema changes.
483
- * This may only be called when the schema is already known to be compatible (typically via ensureSchema).
484
- */
485
- export function requireSchema(
486
- checkout: ITreeCheckout,
487
- viewSchema: SchemaCompatibilityTester,
488
- onDispose: () => void,
489
- nodeKeyManager: NodeIdentifierManager,
490
- schemaPolicy: FullSchemaPolicy,
491
- ): CheckoutFlexTreeView {
492
- const slots = checkout.forest.anchors.slots;
493
- assert(!slots.has(ContextSlot), 0x8c2 /* Cannot create second view from checkout */);
494
-
495
- {
496
- const compatibility = viewSchema.checkCompatibility(checkout.storedSchema);
497
- assert(compatibility.canView, 0x8c3 /* requireSchema invoked with incompatible schema */);
498
- }
499
-
500
- const view = new CheckoutFlexTreeView(checkout, schemaPolicy, nodeKeyManager, onDispose);
501
- assert(slots.has(ContextSlot), 0x90d /* Context should be tracked in slot */);
502
-
503
- return view;
504
- }
505
-
506
471
  /**
507
472
  * Adds constraints to a `checkout`'s pending transaction.
508
473
  *
@@ -16,7 +16,7 @@ export type SharedTreeInnerChange =
16
16
  export interface SharedTreeChange {
17
17
  /**
18
18
  * The changes to apply.
19
- * @remarks while not expressable in TypeScript, these changes should never have two `ModularChangeset`s adjacent in the list.
19
+ * @remarks while not expressible in TypeScript, these changes should never have two `ModularChangeset`s adjacent in the list.
20
20
  * This restriction exists because this change type should preserve the composition behavior of `ModularChangeFamily`, which
21
21
  * always composes runs of `ModularChangeset`s into a single `ModularChangeset`.
22
22
  */
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
7
+ import { assert } from "@fluidframework/core-utils/internal";
7
8
 
8
9
  import {
9
10
  type ImplicitFieldSchema,
@@ -16,12 +17,12 @@ import {
16
17
  type TransactionConstraint,
17
18
  } from "../simple-tree/index.js";
18
19
 
19
- import { getCheckoutFlexTreeView } from "./checkoutFlexTreeView.js";
20
20
  import {
21
21
  addConstraintsToTransaction,
22
22
  SchematizingSimpleTreeView,
23
23
  } from "./schematizingTreeView.js";
24
24
  import type { ITreeCheckout } from "./treeCheckout.js";
25
+ import { Context } from "../feature-libraries/index.js";
25
26
 
26
27
  /**
27
28
  * Provides various functions for interacting with {@link TreeNode}s.
@@ -449,8 +450,8 @@ export function runTransaction<
449
450
  "Transactions cannot be run on Unhydrated nodes. Transactions apply to a TreeView and Unhydrated nodes are not part of a TreeView.",
450
451
  );
451
452
  }
452
- const treeView = getCheckoutFlexTreeView(context);
453
- return runTransactionInCheckout(treeView.checkout, () => t(node), preconditions);
453
+ assert(context instanceof Context, "Expected context to be a Context instance.");
454
+ return runTransactionInCheckout(context.checkout, () => t(node), preconditions);
454
455
  }
455
456
  }
456
457
 
@@ -191,6 +191,12 @@ export interface TreeIdentifierUtils {
191
191
  * Extensions to {@link (Tree:interface)} and {@link (TreeBeta:interface)} which are not yet stable.
192
192
  * @remarks
193
193
  * Use via the {@link (TreeAlpha:variable)} singleton.
194
+ * @privateRemarks
195
+ * TODO: AB#43548:
196
+ * How all the create and all the import and export APIs handle unknown optional fields needs to be figured out, tested and documented.
197
+ * This will need to be extended/generalized to cover other future schema evolution options as well once they exist.
198
+ * See also TreeBeta.clone with a similar issue.
199
+ *
194
200
  * @system @sealed @alpha
195
201
  */
196
202
  export interface TreeAlpha {
@@ -214,7 +220,7 @@ export interface TreeAlpha {
214
220
  * This function exists as a generalization that can be used in other cases as well,
215
221
  * such as when `undefined` might be allowed (for an optional field), or when the type should be inferred from the data when more than one type is possible.
216
222
  * @privateRemarks
217
- * There should be a way to provide a source for defaulted identifiers, either via this API or some way to add them to its output later.
223
+ * TODO: AB#43548: There should be a way to provide a source for defaulted identifiers, either via this API or some way to add them to its output later.
218
224
  */
219
225
  create<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(
220
226
  schema: UnsafeUnknownSchema extends TSchema
@@ -46,8 +46,10 @@ import {
46
46
  import {
47
47
  type FieldBatchCodec,
48
48
  type TreeCompressionStrategy,
49
+ allowsRepoSuperset,
49
50
  buildForest,
50
51
  createNodeIdentifierManager,
52
+ defaultSchemaPolicy,
51
53
  intoDelta,
52
54
  jsonableTreeFromCursor,
53
55
  makeFieldBatchCodec,
@@ -229,8 +231,13 @@ export interface ITreeCheckout extends AnchorLocator, ViewableTree, WithBreakabl
229
231
  /**
230
232
  * Replaces all schema with the provided schema.
231
233
  * Can over-write preexisting schema, and removes unmentioned schema.
234
+ *
235
+ * @param newSchema - The new schema to replace the existing schema.
236
+ * @param allowNonSupersetSchema - Whether to allow non-superset schemas.
237
+ * Defaults to false.
238
+ * If false, an assert will be thrown if the new schema does not permit all possible documents which were permitted under the old schema.
232
239
  */
233
- updateSchema(newSchema: TreeStoredSchema): void;
240
+ updateSchema(newSchema: TreeStoredSchema, allowNonSupersetSchema?: true): void;
234
241
 
235
242
  /**
236
243
  * Events about this view.
@@ -776,8 +783,14 @@ export class TreeCheckout implements ITreeCheckoutFork {
776
783
  }
777
784
  }
778
785
 
779
- public updateSchema(newSchema: TreeStoredSchema): void {
786
+ public updateSchema(newSchema: TreeStoredSchema, allowNonSupersetSchema?: true): void {
780
787
  this.checkNotDisposed();
788
+ if (allowNonSupersetSchema !== true) {
789
+ assert(
790
+ allowsRepoSuperset(defaultSchemaPolicy, this.storedSchema.clone(), newSchema),
791
+ "New schema must allow all documents allowed by old schema",
792
+ );
793
+ }
781
794
  this.editor.schema.setStoredSchema(this.storedSchema.clone(), newSchema);
782
795
  }
783
796
 
@@ -3,13 +3,25 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { assert, oob } from "@fluidframework/core-utils/internal";
6
+ import {
7
+ assert,
8
+ DoublyLinkedList,
9
+ oob,
10
+ type ListNode,
11
+ type ListNodeRange,
12
+ } from "@fluidframework/core-utils/internal";
7
13
 
8
14
  import type { GraphCommit, TaggedChange } from "../core/index.js";
9
15
  import { disposeSymbol, hasSome } from "../util/index.js";
10
16
 
11
17
  import type { ChangeEnricherReadonlyCheckout, ResubmitMachine } from "./index.js";
12
18
 
19
+ interface PendingChange<TChange> {
20
+ commit: GraphCommit<TChange>;
21
+ lastEnrichment: number;
22
+ }
23
+ type PendingChangeNode<TChange> = ListNode<PendingChange<TChange>>;
24
+
13
25
  /**
14
26
  * Default implementation of {@link ResubmitMachine}.
15
27
  */
@@ -17,24 +29,20 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
17
29
  /**
18
30
  * The list of commits (from oldest to most recent) that have been submitted but not sequenced.
19
31
  */
20
- private inFlightQueue: GraphCommit<TChange>[] = [];
32
+ private readonly inFlightQueue: DoublyLinkedList<PendingChange<TChange>> =
33
+ new DoublyLinkedList();
21
34
 
22
35
  /**
23
- * The list of commits (from oldest to most recent) that should be resubmitted.
36
+ * The range of in-flight commits that are currently being resubmitted.
37
+ * Defined only during the resubmit phase.
24
38
  */
25
- private resubmitQueue: GraphCommit<TChange>[] = [];
39
+ private pendingResubmitRange: ListNodeRange<PendingChange<TChange>> | undefined;
26
40
 
27
41
  /**
28
- * Represents the index in the `inFlightQueue` array of the most recent in flight commit that has
29
- * undergone rebasing but whose enrichments have not been updated.
30
- * All in-flight commits with an index inferior or equal to this number have stale enrichments.
31
- *
32
- * Is -1 when *any* of the following is true:
33
- * - There are no in-flight commits (i.e., no local commits have been made or they have all been sequenced)
34
- * - None of the in-flight commits have been rebased
35
- * - In-flight commits that have been rebased have all had their enrichments updated
42
+ * The current enrichment version for in-flight commits.
43
+ * Incremented when a peer commit is sequenced.
36
44
  */
37
- private latestInFlightCommitWithStaleEnrichments: number = -1;
45
+ private currentEnrichment: number = 0;
38
46
 
39
47
  public constructor(
40
48
  /**
@@ -49,14 +57,31 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
49
57
  ) {}
50
58
 
51
59
  public onCommitSubmitted(commit: GraphCommit<TChange>): void {
52
- if (this.isInResubmitPhase) {
53
- const toResubmit = this.resubmitQueue.shift();
60
+ if (this.pendingResubmitRange !== undefined) {
61
+ const toResubmit = this.pendingResubmitRange?.first;
54
62
  assert(
55
- toResubmit === commit,
63
+ toResubmit?.data.commit === commit,
56
64
  0x981 /* Unexpected commit submitted during resubmit phase */,
57
65
  );
66
+ // If we are not at the last commit to resubmit, advance the range to the next node.
67
+ // Otherwise, clear the resubmit range as we are done resubmitting.
68
+ if (toResubmit !== this.pendingResubmitRange.last) {
69
+ assert(toResubmit.next !== undefined, 0xbd6 /* must be more in the list */);
70
+ this.pendingResubmitRange.first = toResubmit.next;
71
+ } else {
72
+ this.pendingResubmitRange = undefined;
73
+ }
74
+ toResubmit.remove();
58
75
  }
59
- this.inFlightQueue.push(commit);
76
+ this.inFlightQueue.push({ commit, lastEnrichment: this.currentEnrichment });
77
+ }
78
+
79
+ public onCommitRollback(commit: GraphCommit<TChange>): void {
80
+ assert(
81
+ commit.revision === this.inFlightQueue.last?.data.commit.revision,
82
+ 0xbd7 /* must rollback latest commit in the in flight queue */,
83
+ );
84
+ this.inFlightQueue.pop();
60
85
  }
61
86
 
62
87
  public prepareForResubmit(toResubmit: readonly GraphCommit<TChange>[]): void {
@@ -64,16 +89,33 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
64
89
  !this.isInResubmitPhase,
65
90
  0x957 /* Invalid resubmit phase start during incomplete resubmit phase */,
66
91
  );
92
+
93
+ if (!hasSome(toResubmit)) {
94
+ return;
95
+ }
96
+
67
97
  assert(
68
- toResubmit.length === this.inFlightQueue.length,
69
- 0x958 /* Unexpected resubmit of more or fewer commits than are in flight */,
98
+ toResubmit.length <= this.inFlightQueue.length,
99
+ 0xbd8 /* Unexpected resubmit of more commits than are in flight */,
70
100
  );
71
- if (this.latestInFlightCommitWithStaleEnrichments === -1) {
72
- // No in-flight commits have stale enrichments, so we can resubmit them as is
73
- this.resubmitQueue = this.inFlightQueue;
74
- this.inFlightQueue = [];
75
- } else {
101
+
102
+ // Find the first in-flight commit to resubmit.
103
+ const first = this.inFlightQueue.find(
104
+ (v) => v.data.commit.revision === toResubmit[0].revision,
105
+ );
106
+ // Always resubmit to the end of all outstanding ops, but the list may grow during resubmit,
107
+ // so we must track the current end at the start of the phase.
108
+ const last = this.inFlightQueue.last;
109
+ assert(
110
+ first !== undefined && last !== undefined,
111
+ 0xbd9 /* there must be inflight commits to resubmit */,
112
+ );
113
+
114
+ this.pendingResubmitRange = { first, last };
115
+ // If any in-flight commits have stale enrichments, recompute them.
116
+ if (first.data.lastEnrichment < this.currentEnrichment) {
76
117
  const checkout = this.tip.fork();
118
+
77
119
  // Roll back the checkout to the state before the oldest commit
78
120
  for (let iCommit = toResubmit.length - 1; iCommit >= 0; iCommit -= 1) {
79
121
  const commit = toResubmit[iCommit] ?? oob();
@@ -83,32 +125,37 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
83
125
  // forwards from an earlier fork instead of backwards.
84
126
  checkout.applyTipChange(rollback);
85
127
  }
86
- // Update the enrichments of the stale commits
87
- for (
88
- let iCommit = 0;
89
- iCommit <= this.latestInFlightCommitWithStaleEnrichments;
90
- iCommit += 1
91
- ) {
92
- const commit = toResubmit[iCommit] ?? oob();
93
- const enrichedChange = checkout.updateChangeEnrichments(
94
- commit.change,
95
- commit.revision,
128
+
129
+ // Update the enrichments of the stale commits in the in-flight queue.
130
+ let current: PendingChangeNode<TChange> | undefined = first;
131
+ for (const commit of toResubmit) {
132
+ assert(
133
+ current !== undefined,
134
+ 0xbda /* there must be an inflight commit for each resubmit commit */,
96
135
  );
97
- const enrichedCommit = { ...commit, change: enrichedChange };
98
- this.resubmitQueue.push(enrichedCommit);
99
- if (iCommit < this.latestInFlightCommitWithStaleEnrichments) {
100
- checkout.applyTipChange(enrichedChange, commit.revision);
136
+ current.data.commit = commit;
137
+ if (current.data.lastEnrichment < this.currentEnrichment) {
138
+ const enrichedChange = checkout.updateChangeEnrichments(
139
+ commit.change,
140
+ commit.revision,
141
+ );
142
+ const enrichedCommit = { ...commit, change: enrichedChange };
143
+
144
+ // Optimization: only apply the enriched change if the next commit also needs enrichment.
145
+ if (
146
+ current.next !== undefined &&
147
+ current.next.data.lastEnrichment < this.currentEnrichment
148
+ ) {
149
+ checkout.applyTipChange(enrichedChange, commit.revision);
150
+ }
151
+
152
+ current.data.commit = enrichedCommit;
153
+ current.data.lastEnrichment = this.currentEnrichment;
101
154
  }
102
- this.inFlightQueue.shift();
155
+ current = current.next;
103
156
  }
104
157
  checkout[disposeSymbol]();
105
- // Whatever commits are left do not have stale enrichments
106
- for (const commit of this.inFlightQueue) {
107
- this.resubmitQueue.push(commit);
108
- }
109
- this.inFlightQueue.length = 0;
110
158
  }
111
- this.latestInFlightCommitWithStaleEnrichments = -1;
112
159
  }
113
160
 
114
161
  public peekNextCommit(): GraphCommit<TChange> {
@@ -116,12 +163,15 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
116
163
  this.isInResubmitPhase,
117
164
  0x982 /* No available commit to resubmit outside of resubmit phase */,
118
165
  );
119
- assert(hasSome(this.resubmitQueue), 0xa87 /* Expected resubmit queue to be non-empty */);
120
- return this.resubmitQueue[0];
166
+ assert(
167
+ this.pendingResubmitRange !== undefined,
168
+ 0xa87 /* Expected resubmit queue to be non-empty */,
169
+ );
170
+ return this.pendingResubmitRange.first.data.commit;
121
171
  }
122
172
 
123
173
  public get isInResubmitPhase(): boolean {
124
- return this.resubmitQueue.length !== 0;
174
+ return this.pendingResubmitRange !== undefined;
125
175
  }
126
176
 
127
177
  public onSequencedCommitApplied(isLocal: boolean): void {
@@ -129,12 +179,9 @@ export class DefaultResubmitMachine<TChange> implements ResubmitMachine<TChange>
129
179
  // The oldest in-flight commit has been sequenced
130
180
  assert(this.inFlightQueue.length > 0, 0x959 /* Sequencing of unknown local commit */);
131
181
  this.inFlightQueue.shift();
132
- if (this.latestInFlightCommitWithStaleEnrichments >= 0) {
133
- this.latestInFlightCommitWithStaleEnrichments -= 1;
134
- }
135
182
  } else {
136
183
  // A peer commit has been sequenced
137
- this.latestInFlightCommitWithStaleEnrichments = this.inFlightQueue.length - 1;
184
+ this.currentEnrichment++;
138
185
  }
139
186
  }
140
187
  }
@@ -37,6 +37,13 @@ export interface ResubmitMachine<TChange> {
37
37
  */
38
38
  onCommitSubmitted(commit: GraphCommit<TChange>): void;
39
39
 
40
+ /**
41
+ * Must be called on a commit after rollback, so it can be removed
42
+ * as it will never be (re)submitted.
43
+ * @param commit - The commit that was rolled back
44
+ */
45
+ onCommitRollback(commit: GraphCommit<TChange>): void;
46
+
40
47
  /**
41
48
  * Must be called after a sequenced commit is applied.
42
49
  * Note that this may be called multiples times in a row after a number of sequenced commits have been applied