@fluidframework/tree 2.111.0 → 2.112.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/CHANGELOG.md +145 -0
  2. package/api-report/tree.alpha.api.md +48 -5
  3. package/api-report/tree.beta.api.md +1 -1
  4. package/api-report/tree.legacy.beta.api.md +1 -1
  5. package/api-report/tree.legacy.public.api.md +1 -1
  6. package/api-report/tree.public.api.md +1 -1
  7. package/dist/componentApi.d.ts +198 -0
  8. package/dist/componentApi.d.ts.map +1 -0
  9. package/dist/componentApi.js +138 -0
  10. package/dist/componentApi.js.map +1 -0
  11. package/dist/entrypoints/alpha.d.ts +1 -1
  12. package/dist/entrypoints/alpha.d.ts.map +1 -1
  13. package/dist/entrypoints/alpha.js +4 -2
  14. package/dist/entrypoints/alpha.js.map +1 -1
  15. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -25
  16. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  17. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  18. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
  19. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  20. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  21. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +6 -18
  22. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  23. package/dist/feature-libraries/chunked-forest/codec/codecs.js +9 -16
  24. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  25. package/dist/feature-libraries/index.d.ts +2 -2
  26. package/dist/feature-libraries/index.d.ts.map +1 -1
  27. package/dist/feature-libraries/index.js +3 -2
  28. package/dist/feature-libraries/index.js.map +1 -1
  29. package/dist/feature-libraries/modular-schema/index.d.ts +1 -0
  30. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  31. package/dist/feature-libraries/modular-schema/index.js +3 -1
  32. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  33. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
  34. package/dist/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
  35. package/dist/feature-libraries/modular-schema/minimizeModularChange.js +29 -0
  36. package/dist/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
  37. package/dist/feature-libraries/schemaChecker.d.ts +22 -3
  38. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -1
  39. package/dist/feature-libraries/schemaChecker.js +48 -5
  40. package/dist/feature-libraries/schemaChecker.js.map +1 -1
  41. package/dist/index.d.ts +2 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +5 -2
  44. package/dist/index.js.map +1 -1
  45. package/dist/packageVersion.d.ts +1 -1
  46. package/dist/packageVersion.js +1 -1
  47. package/dist/packageVersion.js.map +1 -1
  48. package/dist/shared-tree/independentView.d.ts +17 -4
  49. package/dist/shared-tree/independentView.d.ts.map +1 -1
  50. package/dist/shared-tree/independentView.js +11 -5
  51. package/dist/shared-tree/independentView.js.map +1 -1
  52. package/dist/shared-tree/index.d.ts +2 -1
  53. package/dist/shared-tree/index.d.ts.map +1 -1
  54. package/dist/shared-tree/index.js +3 -1
  55. package/dist/shared-tree/index.js.map +1 -1
  56. package/dist/shared-tree/schematizingTreeView.d.ts +1 -0
  57. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  58. package/dist/shared-tree/schematizingTreeView.js +6 -3
  59. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  60. package/dist/shared-tree/serializedChange.d.ts +41 -0
  61. package/dist/shared-tree/serializedChange.d.ts.map +1 -0
  62. package/dist/shared-tree/serializedChange.js +87 -0
  63. package/dist/shared-tree/serializedChange.js.map +1 -0
  64. package/dist/shared-tree/sharedTree.d.ts +13 -0
  65. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  66. package/dist/shared-tree/sharedTree.js +2 -0
  67. package/dist/shared-tree/sharedTree.js.map +1 -1
  68. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
  69. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  70. package/dist/shared-tree/sharedTreeChangeFamily.js +8 -1
  71. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  72. package/dist/shared-tree/transactionMinimize.d.ts +35 -0
  73. package/dist/shared-tree/transactionMinimize.d.ts.map +1 -0
  74. package/dist/shared-tree/transactionMinimize.js +65 -0
  75. package/dist/shared-tree/transactionMinimize.js.map +1 -0
  76. package/dist/shared-tree/treeCheckout.d.ts +3 -1
  77. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  78. package/dist/shared-tree/treeCheckout.js +36 -62
  79. package/dist/shared-tree/treeCheckout.js.map +1 -1
  80. package/dist/shared-tree-core/editManager.d.ts +6 -3
  81. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  82. package/dist/shared-tree-core/editManager.js +35 -14
  83. package/dist/shared-tree-core/editManager.js.map +1 -1
  84. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
  85. package/dist/shared-tree-core/editManagerFormatCommons.js +1 -1
  86. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  87. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  88. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  89. package/dist/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  90. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  91. package/dist/shared-tree-core/messageFormat.d.ts +1 -1
  92. package/dist/shared-tree-core/messageFormat.js +1 -1
  93. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  94. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
  95. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  96. package/dist/shared-tree-core/messageFormatVSharedBranches.js +1 -0
  97. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  98. package/dist/shared-tree-core/messageTypes.d.ts +1 -0
  99. package/dist/shared-tree-core/messageTypes.d.ts.map +1 -1
  100. package/dist/shared-tree-core/messageTypes.js.map +1 -1
  101. package/dist/shared-tree-core/sharedTreeCore.d.ts +9 -3
  102. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  103. package/dist/shared-tree-core/sharedTreeCore.js +24 -11
  104. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  105. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  106. package/dist/shared-tree-core/transaction.js +16 -2
  107. package/dist/shared-tree-core/transaction.js.map +1 -1
  108. package/dist/simple-tree/api/index.d.ts +1 -1
  109. package/dist/simple-tree/api/index.d.ts.map +1 -1
  110. package/dist/simple-tree/api/index.js +2 -2
  111. package/dist/simple-tree/api/index.js.map +1 -1
  112. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
  113. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  114. package/dist/simple-tree/api/schemaCompatibilityTester.js +31 -44
  115. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  116. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
  117. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  118. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  119. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
  120. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  121. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  122. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  123. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +1 -2
  124. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  125. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  126. package/dist/simple-tree/api/storedSchema.js +1 -2
  127. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  128. package/dist/simple-tree/api/tree.d.ts +22 -2
  129. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  130. package/dist/simple-tree/api/tree.js.map +1 -1
  131. package/dist/simple-tree/api/typesUnsafe.d.ts +2 -2
  132. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  133. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  134. package/dist/simple-tree/index.d.ts +1 -1
  135. package/dist/simple-tree/index.d.ts.map +1 -1
  136. package/dist/simple-tree/index.js +2 -2
  137. package/dist/simple-tree/index.js.map +1 -1
  138. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
  139. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  140. package/dist/simple-tree/node-kinds/array/arrayNode.js +39 -0
  141. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  142. package/dist/simple-tree/simpleSchemaFormatV1.js +1 -1
  143. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  144. package/dist/treeFactory.js +1 -1
  145. package/dist/treeFactory.js.map +1 -1
  146. package/dist/util/breakable.d.ts +16 -1
  147. package/dist/util/breakable.d.ts.map +1 -1
  148. package/dist/util/breakable.js +9 -1
  149. package/dist/util/breakable.js.map +1 -1
  150. package/dist/util/compressedIds.d.ts +69 -2
  151. package/dist/util/compressedIds.d.ts.map +1 -1
  152. package/dist/util/compressedIds.js +32 -1
  153. package/dist/util/compressedIds.js.map +1 -1
  154. package/dist/util/index.d.ts +2 -2
  155. package/dist/util/index.d.ts.map +1 -1
  156. package/dist/util/index.js +2 -2
  157. package/dist/util/index.js.map +1 -1
  158. package/dist/util/nestedMap.d.ts.map +1 -1
  159. package/dist/util/nestedMap.js +16 -3
  160. package/dist/util/nestedMap.js.map +1 -1
  161. package/dist/util/nestedSet.d.ts +1 -1
  162. package/dist/util/nestedSet.d.ts.map +1 -1
  163. package/dist/util/nestedSet.js.map +1 -1
  164. package/dist/util/utils.d.ts +0 -6
  165. package/dist/util/utils.d.ts.map +1 -1
  166. package/dist/util/utils.js +1 -15
  167. package/dist/util/utils.js.map +1 -1
  168. package/lib/componentApi.d.ts +198 -0
  169. package/lib/componentApi.d.ts.map +1 -0
  170. package/lib/componentApi.js +135 -0
  171. package/lib/componentApi.js.map +1 -0
  172. package/lib/entrypoints/alpha.d.ts +1 -1
  173. package/lib/entrypoints/alpha.d.ts.map +1 -1
  174. package/lib/entrypoints/alpha.js +1 -1
  175. package/lib/entrypoints/alpha.js.map +1 -1
  176. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -25
  177. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  178. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +1 -1
  179. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  180. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -2
  181. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  182. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  183. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +6 -18
  184. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  185. package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -17
  186. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  187. package/lib/feature-libraries/index.d.ts +2 -2
  188. package/lib/feature-libraries/index.d.ts.map +1 -1
  189. package/lib/feature-libraries/index.js +1 -1
  190. package/lib/feature-libraries/index.js.map +1 -1
  191. package/lib/feature-libraries/modular-schema/index.d.ts +1 -0
  192. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  193. package/lib/feature-libraries/modular-schema/index.js +1 -0
  194. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  195. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts +25 -0
  196. package/lib/feature-libraries/modular-schema/minimizeModularChange.d.ts.map +1 -0
  197. package/lib/feature-libraries/modular-schema/minimizeModularChange.js +25 -0
  198. package/lib/feature-libraries/modular-schema/minimizeModularChange.js.map +1 -0
  199. package/lib/feature-libraries/schemaChecker.d.ts +22 -3
  200. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -1
  201. package/lib/feature-libraries/schemaChecker.js +48 -5
  202. package/lib/feature-libraries/schemaChecker.js.map +1 -1
  203. package/lib/index.d.ts +2 -1
  204. package/lib/index.d.ts.map +1 -1
  205. package/lib/index.js +2 -1
  206. package/lib/index.js.map +1 -1
  207. package/lib/packageVersion.d.ts +1 -1
  208. package/lib/packageVersion.js +1 -1
  209. package/lib/packageVersion.js.map +1 -1
  210. package/lib/shared-tree/independentView.d.ts +17 -4
  211. package/lib/shared-tree/independentView.d.ts.map +1 -1
  212. package/lib/shared-tree/independentView.js +9 -3
  213. package/lib/shared-tree/independentView.js.map +1 -1
  214. package/lib/shared-tree/index.d.ts +2 -1
  215. package/lib/shared-tree/index.d.ts.map +1 -1
  216. package/lib/shared-tree/index.js +1 -0
  217. package/lib/shared-tree/index.js.map +1 -1
  218. package/lib/shared-tree/schematizingTreeView.d.ts +1 -0
  219. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  220. package/lib/shared-tree/schematizingTreeView.js +7 -4
  221. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  222. package/lib/shared-tree/serializedChange.d.ts +41 -0
  223. package/lib/shared-tree/serializedChange.d.ts.map +1 -0
  224. package/lib/shared-tree/serializedChange.js +84 -0
  225. package/lib/shared-tree/serializedChange.js.map +1 -0
  226. package/lib/shared-tree/sharedTree.d.ts +13 -0
  227. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  228. package/lib/shared-tree/sharedTree.js +2 -0
  229. package/lib/shared-tree/sharedTree.js.map +1 -1
  230. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +7 -0
  231. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  232. package/lib/shared-tree/sharedTreeChangeFamily.js +7 -1
  233. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  234. package/lib/shared-tree/transactionMinimize.d.ts +35 -0
  235. package/lib/shared-tree/transactionMinimize.d.ts.map +1 -0
  236. package/lib/shared-tree/transactionMinimize.js +62 -0
  237. package/lib/shared-tree/transactionMinimize.js.map +1 -0
  238. package/lib/shared-tree/treeCheckout.d.ts +3 -1
  239. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  240. package/lib/shared-tree/treeCheckout.js +18 -44
  241. package/lib/shared-tree/treeCheckout.js.map +1 -1
  242. package/lib/shared-tree-core/editManager.d.ts +6 -3
  243. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  244. package/lib/shared-tree-core/editManager.js +36 -15
  245. package/lib/shared-tree-core/editManager.js.map +1 -1
  246. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +1 -1
  247. package/lib/shared-tree-core/editManagerFormatCommons.js +1 -1
  248. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  249. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts +1 -1
  250. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -1
  251. package/lib/shared-tree-core/messageCodecVSharedBranches.js +8 -2
  252. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -1
  253. package/lib/shared-tree-core/messageFormat.d.ts +1 -1
  254. package/lib/shared-tree-core/messageFormat.js +1 -1
  255. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  256. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts +10 -1
  257. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -1
  258. package/lib/shared-tree-core/messageFormatVSharedBranches.js +1 -0
  259. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -1
  260. package/lib/shared-tree-core/messageTypes.d.ts +1 -0
  261. package/lib/shared-tree-core/messageTypes.d.ts.map +1 -1
  262. package/lib/shared-tree-core/messageTypes.js.map +1 -1
  263. package/lib/shared-tree-core/sharedTreeCore.d.ts +9 -3
  264. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  265. package/lib/shared-tree-core/sharedTreeCore.js +25 -12
  266. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  267. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  268. package/lib/shared-tree-core/transaction.js +16 -2
  269. package/lib/shared-tree-core/transaction.js.map +1 -1
  270. package/lib/simple-tree/api/index.d.ts +1 -1
  271. package/lib/simple-tree/api/index.d.ts.map +1 -1
  272. package/lib/simple-tree/api/index.js +1 -1
  273. package/lib/simple-tree/api/index.js.map +1 -1
  274. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +9 -24
  275. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  276. package/lib/simple-tree/api/schemaCompatibilityTester.js +29 -42
  277. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  278. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +56 -15
  279. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  280. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  281. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +0 -3
  282. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  283. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  284. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  285. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +2 -3
  286. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  287. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  288. package/lib/simple-tree/api/storedSchema.js +2 -3
  289. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  290. package/lib/simple-tree/api/tree.d.ts +22 -2
  291. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  292. package/lib/simple-tree/api/tree.js.map +1 -1
  293. package/lib/simple-tree/api/typesUnsafe.d.ts +2 -2
  294. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  295. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  296. package/lib/simple-tree/index.d.ts +1 -1
  297. package/lib/simple-tree/index.d.ts.map +1 -1
  298. package/lib/simple-tree/index.js +1 -1
  299. package/lib/simple-tree/index.js.map +1 -1
  300. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +83 -4
  301. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  302. package/lib/simple-tree/node-kinds/array/arrayNode.js +39 -0
  303. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  304. package/lib/simple-tree/simpleSchemaFormatV1.js +1 -1
  305. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  306. package/lib/treeFactory.js +1 -1
  307. package/lib/treeFactory.js.map +1 -1
  308. package/lib/util/breakable.d.ts +16 -1
  309. package/lib/util/breakable.d.ts.map +1 -1
  310. package/lib/util/breakable.js +9 -1
  311. package/lib/util/breakable.js.map +1 -1
  312. package/lib/util/compressedIds.d.ts +69 -2
  313. package/lib/util/compressedIds.d.ts.map +1 -1
  314. package/lib/util/compressedIds.js +30 -0
  315. package/lib/util/compressedIds.js.map +1 -1
  316. package/lib/util/index.d.ts +2 -2
  317. package/lib/util/index.d.ts.map +1 -1
  318. package/lib/util/index.js +2 -2
  319. package/lib/util/index.js.map +1 -1
  320. package/lib/util/nestedMap.d.ts.map +1 -1
  321. package/lib/util/nestedMap.js +17 -4
  322. package/lib/util/nestedMap.js.map +1 -1
  323. package/lib/util/nestedSet.d.ts +1 -1
  324. package/lib/util/nestedSet.d.ts.map +1 -1
  325. package/lib/util/nestedSet.js.map +1 -1
  326. package/lib/util/utils.d.ts +0 -6
  327. package/lib/util/utils.d.ts.map +1 -1
  328. package/lib/util/utils.js +0 -13
  329. package/lib/util/utils.js.map +1 -1
  330. package/package.json +22 -22
  331. package/src/componentApi.ts +354 -0
  332. package/src/entrypoints/alpha.ts +3 -0
  333. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +6 -27
  334. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -2
  335. package/src/feature-libraries/chunked-forest/codec/codecs.ts +17 -44
  336. package/src/feature-libraries/index.ts +2 -0
  337. package/src/feature-libraries/modular-schema/index.ts +1 -0
  338. package/src/feature-libraries/modular-schema/minimizeModularChange.ts +33 -0
  339. package/src/feature-libraries/schemaChecker.ts +86 -9
  340. package/src/index.ts +3 -0
  341. package/src/packageVersion.ts +1 -1
  342. package/src/shared-tree/independentView.ts +35 -5
  343. package/src/shared-tree/index.ts +3 -0
  344. package/src/shared-tree/schematizingTreeView.ts +15 -5
  345. package/src/shared-tree/serializedChange.ts +127 -0
  346. package/src/shared-tree/sharedTree.ts +16 -0
  347. package/src/shared-tree/sharedTreeChangeFamily.ts +7 -1
  348. package/src/shared-tree/transactionMinimize.ts +74 -0
  349. package/src/shared-tree/treeCheckout.ts +42 -57
  350. package/src/shared-tree-core/editManager.ts +42 -6
  351. package/src/shared-tree-core/editManagerFormatCommons.ts +1 -1
  352. package/src/shared-tree-core/messageCodecVSharedBranches.ts +8 -1
  353. package/src/shared-tree-core/messageFormat.ts +1 -1
  354. package/src/shared-tree-core/messageFormatVSharedBranches.ts +10 -0
  355. package/src/shared-tree-core/messageTypes.ts +1 -0
  356. package/src/shared-tree-core/sharedTreeCore.ts +33 -10
  357. package/src/shared-tree-core/transaction.ts +19 -2
  358. package/src/simple-tree/api/index.ts +1 -1
  359. package/src/simple-tree/api/schemaCompatibilityTester.ts +36 -48
  360. package/src/simple-tree/api/schemaFactoryAlpha.ts +56 -15
  361. package/src/simple-tree/api/schemaFactoryBeta.ts +0 -3
  362. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +2 -3
  363. package/src/simple-tree/api/storedSchema.ts +2 -3
  364. package/src/simple-tree/api/tree.ts +24 -2
  365. package/src/simple-tree/api/typesUnsafe.ts +2 -1
  366. package/src/simple-tree/index.ts +1 -1
  367. package/src/simple-tree/node-kinds/array/arrayNode.ts +168 -4
  368. package/src/simple-tree/simpleSchemaFormatV1.ts +1 -1
  369. package/src/treeFactory.ts +1 -1
  370. package/src/util/breakable.ts +8 -1
  371. package/src/util/compressedIds.ts +90 -2
  372. package/src/util/index.ts +3 -1
  373. package/src/util/nestedMap.ts +21 -4
  374. package/src/util/nestedSet.ts +1 -1
  375. package/src/util/utils.ts +0 -18
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/shared-tree-core/transaction.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,+DAA6D;AAE7D,kEAA8E;AAC9E,uEAAsE;AAEtE,+CAU0B;AAC1B,+CAAwD;AAIxD;;;GAGG;AACH,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC5B;;OAEG;IACH,2DAAK,CAAA;IACL;;OAEG;IACH,6DAAM,CAAA;AACP,CAAC,EATW,iBAAiB,iCAAjB,iBAAiB,QAS5B;AAmGD;;;;GAIG;AACH,MAAa,gBAAgB;IAK5B,IAAW,MAAM;QAChB,OAAO,+BAAA,IAAI,gCAAQ,CAAC;IACrB,CAAC;IAGD,IAAW,QAAQ;QAClB,OAAO,+BAAA,IAAI,kCAAU,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,YAAmB,MAAyB;QAjBnC,kCAA4C,EAAE,EAAC;QAC/C,2CAA2B;QAE3B,mCAAU,IAAA,4BAAa,GAAqB,EAAC;QAKtD,qCAAY,KAAK,EAAC;QAUjB,+BAAA,IAAI,4BAAW,MAAM,MAAA,CAAC;IACvB,CAAC;IAED,IAAW,IAAI;QACd,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,OAAO,+BAAA,IAAI,+BAAO,CAAC,MAAM,CAAC;IAC3B,C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,0BAAe,EAAC,MAAM,CAAC,CAAC;4BACzB,CAAC;wBACF,CAAC;wBACD,gBAAgB,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;oBACvC,CAAC;iBACD,CAAC;YACH,CAAC,CAAC;YACF,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;QAC1E,CAAC,CACD,CAAC;QAvMc,WAAM,GAAN,MAAM,CAAoC;QAhE3D,+DAAwD;QAExD;;;;WAIG;QACa,uBAAkB,GAAG,IAAI,KAAK,CAAU,EAAwB,EAAE;YACjF,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE;gBACvB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;YAC3D,CAAC;SACD,CAAC,CAAC;QAoCM,wDAAsB,IAAI,GAAG,EAKnC,EAAC;IAoNJ,CAAC;IAED,sGAAsG;IAC9F,oBAAoB,CAC3B,iBAAiE;QAEjE,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC;QAC1C,+BAAA,IAAI,gDAAsB,iBAAiB,MAAA,CAAC;QAC5C,KAAK,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,+BAAA,IAAI,qDAAoB,EAAE,CAAC;YAC/D,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBAClC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;gBAChD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAClD,CAAC;QACF,CAAC;IACF,CAAC;CACD;AA3RD,8DA2RC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { IDisposable, Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tdiffHistories,\n\tfindAncestor,\n\tfindCommonAncestor,\n\tmintCommit,\n\trebaseBranch,\n\ttagChange,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n} from \"../core/index.js\";\nimport { getLast, getOrCreate } from \"../util/index.js\";\n\nimport type { SharedTreeBranch, SharedTreeBranchEvents } from \"./branch.js\";\n\n/**\n * Describes the result of a transaction.\n * Transactions may either succeed and commit, or fail and abort.\n */\nexport enum TransactionResult {\n\t/**\n\t * Indicates the transaction failed.\n\t */\n\tAbort,\n\t/**\n\t * Indicates the transaction succeeded.\n\t */\n\tCommit,\n}\n\n/**\n * A simple API for managing transactions.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n */\nexport interface Transactor<TOptions> {\n\t/**\n\t * Start a new transaction.\n\t * @param options - Options controlling how the transaction is committed.\n\t * @remarks\n\t * If a transaction is already in progress when this new transaction starts, then this transaction will be \"nested\" inside of it,\n\t * i.e. the outer transaction will still be in progress after this new transaction is committed or aborted.\n\t */\n\tstart(options?: TOptions): void;\n\t/**\n\t * Close this transaction by squashing its edits and committing them as a single edit.\n\t * @remarks If this is the root checkout and there are no ongoing transactions remaining, the squashed edit will be submitted to Fluid.\n\t */\n\tcommit(): void;\n\t/**\n\t * Close this transaction and revert the state of the tree to what it was before this transaction began.\n\t */\n\tabort(): void;\n\t/**\n\t * The number of transactions currently in progress, including any nested transactions.\n\t * @remarks This is 0 when no transaction is in progress, 1 when a single transaction is in progress, 2 when a transaction is nested inside another, etc.\n\t */\n\tsize: number;\n\t/**\n\t * Provides events for changes in transaction progress.\n\t */\n\tevents: Listenable<TransactionEvents>;\n}\n\nexport interface TransactionEvents {\n\t/**\n\t * Raised just after a transaction has begun.\n\t * @remarks When this event fires, {@link Transactor.size} will be greater than 0 because the transaction has already begun.\n\t */\n\tstarted(): void;\n\t/**\n\t * Raised just before a transaction is aborted.\n\t * @remarks When this event fires, {@link Transactor.size} will still be greater than 0 because the transaction has not yet ended.\n\t */\n\taborting(): void;\n\t/**\n\t * Raised just before a transaction is committed.\n\t * @remarks When this event fires, {@link Transactor.size} will still be greater than 0 because the transaction has not yet ended.\n\t */\n\tcommitting(): void;\n}\n\n/**\n * Callbacks for transaction lifecycle events.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n */\nexport interface Callbacks<TOptions> {\n\t/**\n\t * Called when the current transaction is popped from the {@link TransactionStack | stack}.\n\t */\n\treadonly onPop?: OnPop;\n\t/**\n\t * Called when a nested transaction is pushed onto the {@link TransactionStack | stack}.\n\t * @remarks\n\t * Transactions may be arbitrarily nested (by {@link TransactionStack.start | start}ing a transaction within a transaction that is already in progress).\n\t * The `OnPush` callback for an (outer) transaction may optionally return another `OnPush` callback that is associated with any nested (inner) transaction(s).\n\t * In that case, the inner `OnPush` will be called when those inner transactions are pushed and the outer `OnPush` will not be called.\n\t * Put another way, a transaction always results in a call to exactly one `OnPush` callback - whichever is closest to the transaction.\n\t * The event \"bubbles up\" to (and no further past) its first registered callback.\n\t */\n\treadonly onPush?: OnPush<TOptions>;\n}\n\n/**\n * A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.\n * @remarks This function may return other functions that will be called when the transaction is popped from the stack or a nested transaction is pushed onto the stack.\n * This function runs just before the transaction begins, so if this is the beginning of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n * @param options - The options passed to {@link Transactor.start | start}.\n */\nexport type OnPush<TOptions> = (options?: TOptions) => Callbacks<TOptions> | void;\n\n/**\n * A function that will be called when a transaction is popped from the {@link TransactionStack | stack}.\n * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.\n * @param result - The result of the transaction.\n */\nexport type OnPop = (result: TransactionResult) => void;\n\n/**\n * A frame in the transaction stack.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n */\ninterface TransactionStackFrame<TOptions> {\n\t/** The callbacks provided when this transaction frame was pushed onto the stack. */\n\treadonly callbacks: Callbacks<TOptions>;\n}\n\n/**\n * An implementation of {@link Transactor} that uses a stack to manage transactions.\n * @remarks Using a stack allows transactions to nest - i.e. an inner transaction may be started while an outer transaction is already in progress.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n */\nexport class TransactionStack<TOptions> implements Transactor<TOptions>, IDisposable {\n\treadonly #stack: TransactionStackFrame<TOptions>[] = [];\n\treadonly #onPush?: OnPush<TOptions>;\n\n\treadonly #events = createEmitter<TransactionEvents>();\n\tpublic get events(): Listenable<TransactionEvents> {\n\t\treturn this.#events;\n\t}\n\n\t#disposed = false;\n\tpublic get disposed(): boolean {\n\t\treturn this.#disposed;\n\t}\n\n\t/**\n\t * Construct a new {@link TransactionStack}.\n\t * @param onPush - A {@link OnPush | function} that will be called when a transaction begins.\n\t */\n\tpublic constructor(onPush?: OnPush<TOptions>) {\n\t\tthis.#onPush = onPush;\n\t}\n\n\tpublic get size(): number {\n\t\tthis.ensureNotDisposed();\n\t\treturn this.#stack.length;\n\t}\n\n\tpublic start(options?: TOptions): void {\n\t\tthis.ensureNotDisposed();\n\t\tconst last = getLast(this.#stack);\n\t\tconst onPushCurrent = last === undefined ? this.#onPush : last.callbacks.onPush;\n\t\tconst { onPush, onPop } = onPushCurrent?.(options) ?? {};\n\t\tthis.#stack.push({\n\t\t\tcallbacks: { onPop, onPush: onPush ?? onPushCurrent },\n\t\t});\n\t\tthis.#events.emit(\"started\");\n\t}\n\n\tpublic commit(): void {\n\t\tthis.ensureNotDisposed();\n\t\tif (this.size === 0) {\n\t\t\tthrow new UsageError(\"No transaction to commit\");\n\t\t}\n\t\tthis.#events.emit(\"committing\");\n\t\tthis.#stack.pop()?.callbacks.onPop?.(TransactionResult.Commit);\n\t}\n\n\tpublic abort(): void {\n\t\tthis.ensureNotDisposed();\n\t\tif (this.size === 0) {\n\t\t\tthrow new UsageError(\"No transaction to abort\");\n\t\t}\n\t\tthis.#events.emit(\"aborting\");\n\t\tthis.#stack.pop()?.callbacks.onPop?.(TransactionResult.Abort);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.ensureNotDisposed();\n\t\twhile (this.size > 0) {\n\t\t\tthis.abort();\n\t\t}\n\t\tthis.#disposed = true;\n\t}\n\n\tprivate ensureNotDisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthrow new UsageError(\"Transactor is disposed\");\n\t\t}\n\t}\n}\n\n/**\n * A function that will be called when a transaction is popped from the {@link SquashingTransactionStack | stack}.\n * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.\n * @param result - The result of the transaction.\n * @param viewUpdate - The change that needs to be applied to the view to keep it up-to-date with the branch after the transaction ends.\n * This is needed in asynchronous transactions where new commits have been added to the branch while the transaction was in progress.\n * This will be `undefined` if no such change is necessary.\n */\nexport type OnPopWithViewUpdate<TChange> = (\n\tresult: TransactionResult,\n\tviewUpdate: TChange | undefined,\n) => void;\n\n/**\n * Informs the caller of {@link ChangeProcessor} what context it should be invoked for.\n * @remarks This is purely a recommendation to the caller of the processor and\n * not a strict rule.\n */\nexport enum ChangeProcessorApplicability {\n\t/**\n\t * Invoke the processor if no later (outer) instance of this change processor\n\t * may be applied to related changes before changes are \"visible\".\n\t *\n\t * @remarks\n\t * This designation is meant for processors that only need to be applied\n\t * once to a set of related changes independent of scope or nesting,\n\t * with the understanding that the processor should still be applied no\n\t * later than when the changes are \"visible\" (e.g. committed to a branch).\n\t * For example, a processor that removes extraneous information from a\n\t * change (e.g. data for nodes that were both created and removed within a\n\t * transaction) only needs to be applied once to the squashed change\n\t * produced by the outermost transaction.\n\t */\n\tIfOutermost,\n\t/**\n\t * Invoke the processor in all contexts.\n\t */\n\tAlways,\n}\n\n/**\n * Processes a change altering its representation.\n *\n * @remarks\n * A change processor receives a change and returns a change with the\n * same observable effect but otherwise transformed.\n *\n * Currently this is the internal counterpart of the type-erased post-processor\n * exposed on the public transaction API. The public boundary type-erases this\n * (see the conversion helpers in the `shared-tree` layer) so that its internal\n * change representation does not leak into the public API.\n */\nexport interface ChangeProcessor<TChange> {\n\t/**\n\t * Informs what context it should be invoked for.\n\t */\n\treadonly applicability: ChangeProcessorApplicability;\n\t/**\n\t * Processes the given change, returning a change with the same observable effect.\n\t */\n\treadonly processChange: (change: TChange) => TChange;\n}\n\n/**\n * Options for {@link Transactor.start | starting} a transaction.\n */\nexport interface SquashingTransactionOptions<TChange> {\n\t/**\n\t * An optional {@link ChangeProcessor} applied to the squashed change produced when a transaction that was started\n\t * with this option is committed.\n\t *\n\t * @remarks\n\t * When omitted, the transaction's edits are squashed without any post-processing.\n\t *\n\t * How often the processor is invoked across nested transactions is governed by its\n\t * {@link ChangeProcessor.applicability | applicability}.\n\t */\n\treadonly postProcessor?: ChangeProcessor<TChange>;\n}\n\n/**\n * An implementation of {@link Transactor} that {@link TransactionStack | uses a stack} and a {@link SharedTreeBranch | branch} to manage transactions.\n * @remarks Given a branch, this class will fork the branch when a transaction begins and squash the forked branch back into the original branch when the transaction ends.\n * This class provides conveniences for interacting with the {@link SquashingTransactionStack.activeBranch | active branch} in a way that is stable across transaction boundaries.\n * For example, see {@link SquashingTransactionStack.activeBranchEditor | activeBranchEditor} and {@link SquashingTransactionStack.activeBranchEvents | activeBranchEvents}.\n */\nexport class SquashingTransactionStack<\n\tTEditor extends ChangeFamilyEditor,\n\tTChange,\n> extends TransactionStack<SquashingTransactionOptions<TChange>> {\n\t#transactionBranch?: SharedTreeBranch<TEditor, TChange>;\n\n\t/**\n\t * An editor for whichever branch is currently the {@link SquashingTransactionStack.activeBranch | active branch}.\n\t * @remarks This editor can safely be held on to across transaction boundaries, as it will properly delegate to the correct branch.\n\t * In contrast, it is not safe to hold onto e.g. `activeBranch.editor` across transaction boundaries, since the active branch may change.\n\t */\n\tpublic readonly activeBranchEditor = new Proxy<TEditor>({} as unknown as TEditor, {\n\t\tget: (_, p, receiver) => {\n\t\t\treturn Reflect.get(this.activeBranch.editor, p, receiver);\n\t\t},\n\t});\n\n\t/**\n\t * Get the \"active branch\" for this transactor - either the transaction branch if a transaction is in progress, or the original branch otherwise.\n\t */\n\tpublic get activeBranch(): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.#transactionBranch ?? this.branch;\n\t}\n\n\t/**\n\t * Provides events for changes in the {@link SquashingTransactionStack.activeBranch | active branch}.\n\t * @remarks When the active branch changes, the listeners for these events will automatically be transferred to the new active branch.\n\t * In contrast, binding an event to the {@link SquashingTransactionStack.activeBranch | active branch} directly will not automatically transfer the listener when the active branch changes.\n\t */\n\tpublic get activeBranchEvents(): Listenable<SharedTreeBranchEvents<TEditor, TChange>> {\n\t\tconst off = (\n\t\t\teventName: keyof SharedTreeBranchEvents<TEditor, TChange>,\n\t\t\tlistener: SharedTreeBranchEvents<TEditor, TChange>[typeof eventName],\n\t\t): void => {\n\t\t\tthis.activeBranch.events.off(eventName, listener);\n\t\t\tconst listeners = this.#activeBranchEvents.get(eventName);\n\t\t\tif (listeners?.delete(listener) === true && listeners.size === 0) {\n\t\t\t\tthis.#activeBranchEvents.delete(eventName);\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\ton: (eventName, listener) => {\n\t\t\t\tconst listeners = getOrCreate(this.#activeBranchEvents, eventName, () => new Set());\n\t\t\t\tlisteners.add(listener);\n\t\t\t\tthis.activeBranch.events.on(eventName, listener);\n\t\t\t\treturn () => off(eventName, listener);\n\t\t\t},\n\t\t\toff,\n\t\t};\n\t}\n\treadonly #activeBranchEvents = new Map<\n\t\tkeyof SharedTreeBranchEvents<TEditor, TChange>,\n\t\tSet<\n\t\t\tSharedTreeBranchEvents<TEditor, TChange>[keyof SharedTreeBranchEvents<TEditor, TChange>]\n\t\t>\n\t>();\n\n\t/**\n\t * Construct a new {@link SquashingTransactionStack}.\n\t * @param branch - The {@link SquashingTransactionStack.branch | branch} that will be forked off of when a transaction begins.\n\t * @param onPush - A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.\n\t * @remarks To post-process the squashed change produced when a transaction is committed (for example, to \"minimize\"\n\t * it so that it contains no extraneous information), start the transaction with a\n\t * {@link SquashingTransactionOptions.postProcessor | post-processor}. The post-processor is injected via the transaction\n\t * options rather than baked into this stack, so different transactions may supply different post-processors (or none).\n\t */\n\tpublic constructor(\n\t\tpublic readonly branch: SharedTreeBranch<TEditor, TChange>,\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tonPush?: () => OnPopWithViewUpdate<TChange> | void,\n\t) {\n\t\t// A stack of the post-processors to apply when each in-progress transaction commits, ordered from outermost to\n\t\t// innermost. Each in-progress transaction contributes exactly one entry: either the processor to apply when it\n\t\t// commits, or `undefined` when none should be applied.\n\t\tconst postProcessorStack: (ChangeProcessor<TChange> | undefined)[] = [];\n\t\t// Determines the entry to push for a transaction that was started with the given `requested` processor (if any).\n\t\t// A processor with \"outermost\" applicability that is already active in an enclosing transaction resolves to\n\t\t// `undefined` so that it is only applied once (at the outermost transaction that supplied it).\n\t\tconst resolvePostProcessor = (\n\t\t\trequested: ChangeProcessor<TChange> | undefined,\n\t\t): ChangeProcessor<TChange> | undefined => {\n\t\t\tif (\n\t\t\t\trequested?.applicability === ChangeProcessorApplicability.IfOutermost &&\n\t\t\t\tpostProcessorStack.includes(requested)\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn requested;\n\t\t};\n\n\t\tsuper(\n\t\t\t// Invoked when an outer transaction starts\n\t\t\t(\n\t\t\t\tstartOptions?: SquashingTransactionOptions<TChange>,\n\t\t\t): Callbacks<SquashingTransactionOptions<TChange>> => {\n\t\t\t\tpostProcessorStack.push(resolvePostProcessor(startOptions?.postProcessor));\n\t\t\t\t// Keep track of the commit that each transaction was on when it started\n\t\t\t\tconst startHead = this.activeBranch.getHead();\n\t\t\t\tconst rebaser = this.branch.changeFamily.rebaser;\n\t\t\t\tconst outerOnPop = onPush?.();\n\t\t\t\tlet transactionRevision: RevisionTag | undefined;\n\t\t\t\tconst transactionBranch = this.branch.fork(\n\t\t\t\t\tstartHead,\n\t\t\t\t\t// Lazily mint the revision tag for the transaction when it is first needed\n\t\t\t\t\t() => (transactionRevision ??= mintRevisionTag()),\n\t\t\t\t);\n\t\t\t\tthis.setTransactionBranch(transactionBranch);\n\t\t\t\ttransactionBranch.editor.enterTransaction();\n\n\t\t\t\t// Invoked when an outer transaction ends\n\t\t\t\tconst onOuterTransactionPop: OnPop = (result) => {\n\t\t\t\t\tassert(this.size === 0, 0xcae /* The outer transaction should be ending */);\n\t\t\t\t\tconst postProcessor = postProcessorStack.pop();\n\t\t\t\t\ttransactionBranch.editor.exitTransaction();\n\n\t\t\t\t\tconst sourcePath: GraphCommit<TChange>[] = [];\n\t\t\t\t\tconst targetPath: GraphCommit<TChange>[] = [];\n\t\t\t\t\tconst ancestor = findCommonAncestor(\n\t\t\t\t\t\t[startHead, sourcePath],\n\t\t\t\t\t\t[branch.getHead(), targetPath],\n\t\t\t\t\t);\n\t\t\t\t\tassert(ancestor !== undefined, 0xcce /* branches must be related */);\n\n\t\t\t\t\tconst transactionSteps: GraphCommit<TChange>[] = [];\n\t\t\t\t\tfindAncestor(\n\t\t\t\t\t\t[transactionBranch.getHead(), transactionSteps],\n\t\t\t\t\t\t(c) => c === startHead,\n\t\t\t\t\t);\n\n\t\t\t\t\tlet viewUpdate: TChange | undefined;\n\t\t\t\t\tswitch (result) {\n\t\t\t\t\t\tcase TransactionResult.Abort: {\n\t\t\t\t\t\t\t// When a transaction is aborted, roll back all the transaction's changes on the current branch.\n\t\t\t\t\t\t\t// It is important that this happens before and separately from updating the view because the `TreeCheckout` needs to\n\t\t\t\t\t\t\t// revert some internal (state to match what it was before the transaction began) before applying the view update (if any).\n\t\t\t\t\t\t\ttransactionBranch.removeAfter(startHead);\n\t\t\t\t\t\t\t// If changes were made on `branch` since the transaction began, the view will need to be updated to reflect those changes.\n\t\t\t\t\t\t\tif (targetPath.length > 0) {\n\t\t\t\t\t\t\t\tviewUpdate = diffHistories(\n\t\t\t\t\t\t\t\t\trebaser,\n\t\t\t\t\t\t\t\t\tstartHead,\n\t\t\t\t\t\t\t\t\tthis.branch.getHead(),\n\t\t\t\t\t\t\t\t\tmintRevisionTag,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TransactionResult.Commit: {\n\t\t\t\t\t\t\tif (transactionSteps.length > 0) {\n\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\ttransactionRevision !== undefined,\n\t\t\t\t\t\t\t\t\t0xccf /* Expected transaction revision in the presence of transaction steps */,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tfor (const commit of transactionSteps) {\n\t\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t\tcommit.revision === transactionRevision,\n\t\t\t\t\t\t\t\t\t\t0xcaf /* Unexpected commit in transaction */,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Squash all the new commits on the transaction branch into a new commit on the original branch\n\t\t\t\t\t\t\t\tconst squash = rebaser.compose(transactionSteps);\n\t\t\t\t\t\t\t\t// Apply this transaction's post-processor (if any) to the squashed change (for example, to\n\t\t\t\t\t\t\t\t// \"minimize\" it so that it contains no extraneous information).\n\t\t\t\t\t\t\t\tconst change =\n\t\t\t\t\t\t\t\t\tpostProcessor === undefined ? squash : postProcessor.processChange(squash);\n\n\t\t\t\t\t\t\t\tif (targetPath.length === 0) {\n\t\t\t\t\t\t\t\t\t// No changes were made on the original branch since the transaction began\n\t\t\t\t\t\t\t\t\t// The transaction commit can be applied directly\n\t\t\t\t\t\t\t\t\tthis.branch.apply(tagChange(change, transactionRevision));\n\t\t\t\t\t\t\t\t\t// The view is already up-to-date so there's nothing more to do\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Some changes were made on `branch` since the transaction began\n\t\t\t\t\t\t\t\t\tconst unrebasedHead = mintCommit(startHead, {\n\t\t\t\t\t\t\t\t\t\tchange,\n\t\t\t\t\t\t\t\t\t\trevision: transactionRevision,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t// We need to rebase the transaction commit on top of the new changes\n\t\t\t\t\t\t\t\t\tconst rebased = rebaseBranch(\n\t\t\t\t\t\t\t\t\t\tmintRevisionTag,\n\t\t\t\t\t\t\t\t\t\trebaser,\n\t\t\t\t\t\t\t\t\t\tunrebasedHead,\n\t\t\t\t\t\t\t\t\t\tbranch.getHead(),\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t\trebased.newSourceHead.revision === transactionRevision,\n\t\t\t\t\t\t\t\t\t\t0xcd0 /* The transaction commit should be rebased to the tip */,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tthis.branch.apply(rebased.newSourceHead);\n\t\t\t\t\t\t\t\t\tviewUpdate = rebased.sourceChange;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (targetPath.length > 0) {\n\t\t\t\t\t\t\t\t\t// Changes were made on `branch` since the transaction began.\n\t\t\t\t\t\t\t\t\t// The view will need to be updated to reflect those changes.\n\t\t\t\t\t\t\t\t\tviewUpdate = diffHistories(\n\t\t\t\t\t\t\t\t\t\trebaser,\n\t\t\t\t\t\t\t\t\t\tstartHead,\n\t\t\t\t\t\t\t\t\t\tthis.branch.getHead(),\n\t\t\t\t\t\t\t\t\t\tmintRevisionTag,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tunreachableCase(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttransactionBranch.dispose();\n\t\t\t\t\tthis.setTransactionBranch(undefined);\n\t\t\t\t\touterOnPop?.(result, viewUpdate);\n\t\t\t\t};\n\t\t\t\t// Invoked when a nested transaction begins\n\t\t\t\tconst onNestedTransactionPush: OnPush<SquashingTransactionOptions<TChange>> = (\n\t\t\t\t\tnestedStartOptions,\n\t\t\t\t) => {\n\t\t\t\t\tpostProcessorStack.push(resolvePostProcessor(nestedStartOptions?.postProcessor));\n\t\t\t\t\tconst nestedStartHead = this.activeBranch.getHead();\n\t\t\t\t\tconst nestedOuterOnPop = onPush?.();\n\t\t\t\t\ttransactionBranch.editor.enterTransaction();\n\t\t\t\t\treturn {\n\t\t\t\t\t\t// Invoked when a nested transaction ends\n\t\t\t\t\t\tonPop: (result) => {\n\t\t\t\t\t\t\tconst nestedPostProcessor = postProcessorStack.pop();\n\t\t\t\t\t\t\ttransactionBranch.editor.exitTransaction();\n\t\t\t\t\t\t\tswitch (result) {\n\t\t\t\t\t\t\t\tcase TransactionResult.Abort: {\n\t\t\t\t\t\t\t\t\t// When a transaction is aborted, roll back all the transaction's changes on the current branch\n\t\t\t\t\t\t\t\t\ttransactionBranch.removeAfter(nestedStartHead);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase TransactionResult.Commit: {\n\t\t\t\t\t\t\t\t\t// When this nested transaction supplied a post-processor that should be applied here, squash its\n\t\t\t\t\t\t\t\t\t// edits into a single (post-processed) commit on the transaction branch rather than leaving them to\n\t\t\t\t\t\t\t\t\t// be squashed only when the outermost transaction is committed.\n\t\t\t\t\t\t\t\t\tif (nestedPostProcessor !== undefined) {\n\t\t\t\t\t\t\t\t\t\tconst nestedSteps: GraphCommit<TChange>[] = [];\n\t\t\t\t\t\t\t\t\t\tfindAncestor(\n\t\t\t\t\t\t\t\t\t\t\t[transactionBranch.getHead(), nestedSteps],\n\t\t\t\t\t\t\t\t\t\t\t(c) => c === nestedStartHead,\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tif (nestedSteps.length > 0) {\n\t\t\t\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t\t\t\ttransactionRevision !== undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t0xd07 /* Expected transaction revision in the presence of transaction steps */,\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tconst squash = rebaser.compose(nestedSteps);\n\t\t\t\t\t\t\t\t\t\t\tconst processedSquash = nestedPostProcessor.processChange(squash);\n\t\t\t\t\t\t\t\t\t\t\ttransactionBranch.removeAfter(nestedStartHead);\n\t\t\t\t\t\t\t\t\t\t\ttransactionBranch.apply(tagChange(processedSquash, transactionRevision));\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t\tunreachableCase(result);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnestedOuterOnPop?.(result, undefined);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t\treturn { onPop: onOuterTransactionPop, onPush: onNestedTransactionPush };\n\t\t\t},\n\t\t);\n\t}\n\n\t/** Updates the transaction branch (and therefore the active branch) and rebinds the branch events. */\n\tprivate setTransactionBranch(\n\t\ttransactionBranch: SharedTreeBranch<TEditor, TChange> | undefined,\n\t): void {\n\t\tconst oldActiveBranch = this.activeBranch;\n\t\tthis.#transactionBranch = transactionBranch;\n\t\tfor (const [eventName, listeners] of this.#activeBranchEvents) {\n\t\t\tfor (const listener of listeners) {\n\t\t\t\toldActiveBranch.events.off(eventName, listener);\n\t\t\t\tthis.activeBranch.events.on(eventName, listener);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/shared-tree-core/transaction.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,+DAA6D;AAE7D,kEAA8E;AAC9E,uEAAsE;AAEtE,+CAU0B;AAC1B,+CAAwD;AAIxD;;;GAGG;AACH,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC5B;;OAEG;IACH,2DAAK,CAAA;IACL;;OAEG;IACH,6DAAM,CAAA;AACP,CAAC,EATW,iBAAiB,iCAAjB,iBAAiB,QAS5B;AAmGD;;;;GAIG;AACH,MAAa,gBAAgB;IAK5B,IAAW,MAAM;QAChB,OAAO,+BAAA,IAAI,gCAAQ,CAAC;IACrB,CAAC;IAGD,IAAW,QAAQ;QAClB,OAAO,+BAAA,IAAI,kCAAU,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,YAAmB,MAAyB;QAjBnC,kCAA4C,EAAE,EAAC;QAC/C,2CAA2B;QAE3B,mCAAU,IAAA,4BAAa,GAAqB,EAAC;QAKtD,qCAAY,KAAK,EAAC;QAUjB,+BAAA,IAAI,4BAAW,MAAM,MAAA,CAAC;IACvB,CAAC;IAED,IAAW,IAAI;QACd,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,OAAO,+BAAA,IAAI,+BAAO,CAAC,MAAM,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,OAAkB;QAC9B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAA,kBAAO,EAAC,+BAAA,IAAI,+BAAO,CAAC,CAAC;QAClC,MAAM,aAAa,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,+BAAA,IAAI,gCAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAChF,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa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under the MIT License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport type { IDisposable, Listenable } from \"@fluidframework/core-interfaces\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tdiffHistories,\n\tfindAncestor,\n\tfindCommonAncestor,\n\tmintCommit,\n\trebaseBranch,\n\ttagChange,\n\ttype ChangeFamilyEditor,\n\ttype GraphCommit,\n\ttype RevisionTag,\n} from \"../core/index.js\";\nimport { getLast, getOrCreate } from \"../util/index.js\";\n\nimport type { SharedTreeBranch, SharedTreeBranchEvents } from \"./branch.js\";\n\n/**\n * Describes the result of a transaction.\n * Transactions may either succeed and commit, or fail and abort.\n */\nexport enum TransactionResult {\n\t/**\n\t * Indicates the transaction failed.\n\t */\n\tAbort,\n\t/**\n\t * Indicates the transaction succeeded.\n\t */\n\tCommit,\n}\n\n/**\n * A simple API for managing transactions.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n */\nexport interface Transactor<TOptions> {\n\t/**\n\t * Start a new transaction.\n\t * @param options - Options controlling how the transaction is committed.\n\t * @remarks\n\t * If a transaction is already in progress when this new transaction starts, then this transaction will be \"nested\" inside of it,\n\t * i.e. the outer transaction will still be in progress after this new transaction is committed or aborted.\n\t */\n\tstart(options?: TOptions): void;\n\t/**\n\t * Close this transaction by squashing its edits and committing them as a single edit.\n\t * @remarks If this is the root checkout and there are no ongoing transactions remaining, the squashed edit will be submitted to Fluid.\n\t */\n\tcommit(): void;\n\t/**\n\t * Close this transaction and revert the state of the tree to what it was before this transaction began.\n\t */\n\tabort(): void;\n\t/**\n\t * The number of transactions currently in progress, including any nested transactions.\n\t * @remarks This is 0 when no transaction is in progress, 1 when a single transaction is in progress, 2 when a transaction is nested inside another, etc.\n\t */\n\tsize: number;\n\t/**\n\t * Provides events for changes in transaction progress.\n\t */\n\tevents: Listenable<TransactionEvents>;\n}\n\nexport interface TransactionEvents {\n\t/**\n\t * Raised just after a transaction has begun.\n\t * @remarks When this event fires, {@link Transactor.size} will be greater than 0 because the transaction has already begun.\n\t */\n\tstarted(): void;\n\t/**\n\t * Raised just before a transaction is aborted.\n\t * @remarks When this event fires, {@link Transactor.size} will still be greater than 0 because the transaction has not yet ended.\n\t */\n\taborting(): void;\n\t/**\n\t * Raised just before a transaction is committed.\n\t * @remarks When this event fires, {@link Transactor.size} will still be greater than 0 because the transaction has not yet ended.\n\t */\n\tcommitting(): void;\n}\n\n/**\n * Callbacks for transaction lifecycle events.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n */\nexport interface Callbacks<TOptions> {\n\t/**\n\t * Called when the current transaction is popped from the {@link TransactionStack | stack}.\n\t */\n\treadonly onPop?: OnPop;\n\t/**\n\t * Called when a nested transaction is pushed onto the {@link TransactionStack | stack}.\n\t * @remarks\n\t * Transactions may be arbitrarily nested (by {@link TransactionStack.start | start}ing a transaction within a transaction that is already in progress).\n\t * The `OnPush` callback for an (outer) transaction may optionally return another `OnPush` callback that is associated with any nested (inner) transaction(s).\n\t * In that case, the inner `OnPush` will be called when those inner transactions are pushed and the outer `OnPush` will not be called.\n\t * Put another way, a transaction always results in a call to exactly one `OnPush` callback - whichever is closest to the transaction.\n\t * The event \"bubbles up\" to (and no further past) its first registered callback.\n\t */\n\treadonly onPush?: OnPush<TOptions>;\n}\n\n/**\n * A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.\n * @remarks This function may return other functions that will be called when the transaction is popped from the stack or a nested transaction is pushed onto the stack.\n * This function runs just before the transaction begins, so if this is the beginning of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n * @param options - The options passed to {@link Transactor.start | start}.\n */\nexport type OnPush<TOptions> = (options?: TOptions) => Callbacks<TOptions> | void;\n\n/**\n * A function that will be called when a transaction is popped from the {@link TransactionStack | stack}.\n * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.\n * @param result - The result of the transaction.\n */\nexport type OnPop = (result: TransactionResult) => void;\n\n/**\n * A frame in the transaction stack.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n */\ninterface TransactionStackFrame<TOptions> {\n\t/** The callbacks provided when this transaction frame was pushed onto the stack. */\n\treadonly callbacks: Callbacks<TOptions>;\n}\n\n/**\n * An implementation of {@link Transactor} that uses a stack to manage transactions.\n * @remarks Using a stack allows transactions to nest - i.e. an inner transaction may be started while an outer transaction is already in progress.\n * @typeParam TOptions - The type of the options passed to {@link Transactor.start | start}.\n */\nexport class TransactionStack<TOptions> implements Transactor<TOptions>, IDisposable {\n\treadonly #stack: TransactionStackFrame<TOptions>[] = [];\n\treadonly #onPush?: OnPush<TOptions>;\n\n\treadonly #events = createEmitter<TransactionEvents>();\n\tpublic get events(): Listenable<TransactionEvents> {\n\t\treturn this.#events;\n\t}\n\n\t#disposed = false;\n\tpublic get disposed(): boolean {\n\t\treturn this.#disposed;\n\t}\n\n\t/**\n\t * Construct a new {@link TransactionStack}.\n\t * @param onPush - A {@link OnPush | function} that will be called when a transaction begins.\n\t */\n\tpublic constructor(onPush?: OnPush<TOptions>) {\n\t\tthis.#onPush = onPush;\n\t}\n\n\tpublic get size(): number {\n\t\tthis.ensureNotDisposed();\n\t\treturn this.#stack.length;\n\t}\n\n\tpublic start(options?: TOptions): void {\n\t\tthis.ensureNotDisposed();\n\t\tconst last = getLast(this.#stack);\n\t\tconst onPushCurrent = last === undefined ? this.#onPush : last.callbacks.onPush;\n\t\tconst { onPush, onPop } = onPushCurrent?.(options) ?? {};\n\t\tthis.#stack.push({\n\t\t\tcallbacks: { onPop, onPush: onPush ?? onPushCurrent },\n\t\t});\n\t\tthis.#events.emit(\"started\");\n\t}\n\n\tpublic commit(): void {\n\t\tthis.ensureNotDisposed();\n\t\tif (this.size === 0) {\n\t\t\tthrow new UsageError(\"No transaction to commit\");\n\t\t}\n\t\tthis.#events.emit(\"committing\");\n\t\tthis.#stack.pop()?.callbacks.onPop?.(TransactionResult.Commit);\n\t}\n\n\tpublic abort(): void {\n\t\tthis.ensureNotDisposed();\n\t\tif (this.size === 0) {\n\t\t\tthrow new UsageError(\"No transaction to abort\");\n\t\t}\n\t\tthis.#events.emit(\"aborting\");\n\t\tthis.#stack.pop()?.callbacks.onPop?.(TransactionResult.Abort);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.ensureNotDisposed();\n\t\twhile (this.size > 0) {\n\t\t\tthis.abort();\n\t\t}\n\t\tthis.#disposed = true;\n\t}\n\n\tprivate ensureNotDisposed(): void {\n\t\tif (this.disposed) {\n\t\t\tthrow new UsageError(\"Transactor is disposed\");\n\t\t}\n\t}\n}\n\n/**\n * A function that will be called when a transaction is popped from the {@link SquashingTransactionStack | stack}.\n * @remarks This function runs just after the transaction ends, so if this is the end of an outermost (not nested) transaction then {@link Transactor.size} will be 0 during its execution.\n * @param result - The result of the transaction.\n * @param viewUpdate - The change that needs to be applied to the view to keep it up-to-date with the branch after the transaction ends.\n * This is needed in asynchronous transactions where new commits have been added to the branch while the transaction was in progress.\n * This will be `undefined` if no such change is necessary.\n */\nexport type OnPopWithViewUpdate<TChange> = (\n\tresult: TransactionResult,\n\tviewUpdate: TChange | undefined,\n) => void;\n\n/**\n * Informs the caller of {@link ChangeProcessor} what context it should be invoked for.\n * @remarks This is purely a recommendation to the caller of the processor and\n * not a strict rule.\n */\nexport enum ChangeProcessorApplicability {\n\t/**\n\t * Invoke the processor if no later (outer) instance of this change processor\n\t * may be applied to related changes before changes are \"visible\".\n\t *\n\t * @remarks\n\t * This designation is meant for processors that only need to be applied\n\t * once to a set of related changes independent of scope or nesting,\n\t * with the understanding that the processor should still be applied no\n\t * later than when the changes are \"visible\" (e.g. committed to a branch).\n\t * For example, a processor that removes extraneous information from a\n\t * change (e.g. data for nodes that were both created and removed within a\n\t * transaction) only needs to be applied once to the squashed change\n\t * produced by the outermost transaction.\n\t */\n\tIfOutermost,\n\t/**\n\t * Invoke the processor in all contexts.\n\t */\n\tAlways,\n}\n\n/**\n * Processes a change altering its representation.\n *\n * @remarks\n * A change processor receives a change and returns a change with the\n * same observable effect but otherwise transformed.\n *\n * Currently this is the internal counterpart of the type-erased post-processor\n * exposed on the public transaction API. The public boundary type-erases this\n * (see the conversion helpers in the `shared-tree` layer) so that its internal\n * change representation does not leak into the public API.\n */\nexport interface ChangeProcessor<TChange> {\n\t/**\n\t * Informs what context it should be invoked for.\n\t */\n\treadonly applicability: ChangeProcessorApplicability;\n\t/**\n\t * Processes the given change, returning a change with the same observable effect.\n\t */\n\treadonly processChange: (change: TChange) => TChange;\n}\n\n/**\n * Options for {@link Transactor.start | starting} a transaction.\n */\nexport interface SquashingTransactionOptions<TChange> {\n\t/**\n\t * An optional {@link ChangeProcessor} applied to the squashed change produced when a transaction that was started\n\t * with this option is committed.\n\t *\n\t * @remarks\n\t * When omitted, the transaction's edits are squashed without any post-processing.\n\t *\n\t * How often the processor is invoked across nested transactions is governed by its\n\t * {@link ChangeProcessor.applicability | applicability}.\n\t */\n\treadonly postProcessor?: ChangeProcessor<TChange>;\n}\n\n/**\n * An implementation of {@link Transactor} that {@link TransactionStack | uses a stack} and a {@link SharedTreeBranch | branch} to manage transactions.\n * @remarks Given a branch, this class will fork the branch when a transaction begins and squash the forked branch back into the original branch when the transaction ends.\n * This class provides conveniences for interacting with the {@link SquashingTransactionStack.activeBranch | active branch} in a way that is stable across transaction boundaries.\n * For example, see {@link SquashingTransactionStack.activeBranchEditor | activeBranchEditor} and {@link SquashingTransactionStack.activeBranchEvents | activeBranchEvents}.\n */\nexport class SquashingTransactionStack<\n\tTEditor extends ChangeFamilyEditor,\n\tTChange,\n> extends TransactionStack<SquashingTransactionOptions<TChange>> {\n\t#transactionBranch?: SharedTreeBranch<TEditor, TChange>;\n\n\t/**\n\t * An editor for whichever branch is currently the {@link SquashingTransactionStack.activeBranch | active branch}.\n\t * @remarks This editor can safely be held on to across transaction boundaries, as it will properly delegate to the correct branch.\n\t * In contrast, it is not safe to hold onto e.g. `activeBranch.editor` across transaction boundaries, since the active branch may change.\n\t */\n\tpublic readonly activeBranchEditor = new Proxy<TEditor>({} as unknown as TEditor, {\n\t\tget: (_, p, receiver) => {\n\t\t\treturn Reflect.get(this.activeBranch.editor, p, receiver);\n\t\t},\n\t});\n\n\t/**\n\t * Get the \"active branch\" for this transactor - either the transaction branch if a transaction is in progress, or the original branch otherwise.\n\t */\n\tpublic get activeBranch(): SharedTreeBranch<TEditor, TChange> {\n\t\treturn this.#transactionBranch ?? this.branch;\n\t}\n\n\t/**\n\t * Provides events for changes in the {@link SquashingTransactionStack.activeBranch | active branch}.\n\t * @remarks When the active branch changes, the listeners for these events will automatically be transferred to the new active branch.\n\t * In contrast, binding an event to the {@link SquashingTransactionStack.activeBranch | active branch} directly will not automatically transfer the listener when the active branch changes.\n\t */\n\tpublic get activeBranchEvents(): Listenable<SharedTreeBranchEvents<TEditor, TChange>> {\n\t\tconst off = (\n\t\t\teventName: keyof SharedTreeBranchEvents<TEditor, TChange>,\n\t\t\tlistener: SharedTreeBranchEvents<TEditor, TChange>[typeof eventName],\n\t\t): void => {\n\t\t\tthis.activeBranch.events.off(eventName, listener);\n\t\t\tconst listeners = this.#activeBranchEvents.get(eventName);\n\t\t\tif (listeners?.delete(listener) === true && listeners.size === 0) {\n\t\t\t\tthis.#activeBranchEvents.delete(eventName);\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\ton: (eventName, listener) => {\n\t\t\t\tconst listeners = getOrCreate(this.#activeBranchEvents, eventName, () => new Set());\n\t\t\t\tlisteners.add(listener);\n\t\t\t\tthis.activeBranch.events.on(eventName, listener);\n\t\t\t\treturn () => off(eventName, listener);\n\t\t\t},\n\t\t\toff,\n\t\t};\n\t}\n\treadonly #activeBranchEvents = new Map<\n\t\tkeyof SharedTreeBranchEvents<TEditor, TChange>,\n\t\tSet<\n\t\t\tSharedTreeBranchEvents<TEditor, TChange>[keyof SharedTreeBranchEvents<TEditor, TChange>]\n\t\t>\n\t>();\n\n\t/**\n\t * Construct a new {@link SquashingTransactionStack}.\n\t * @param branch - The {@link SquashingTransactionStack.branch | branch} that will be forked off of when a transaction begins.\n\t * @param onPush - A function that will be called when a transaction is pushed to the {@link TransactionStack | stack}.\n\t * @remarks To post-process the squashed change produced when a transaction is committed (for example, to \"minimize\"\n\t * it so that it contains no extraneous information), start the transaction with a\n\t * {@link SquashingTransactionOptions.postProcessor | post-processor}. The post-processor is injected via the transaction\n\t * options rather than baked into this stack, so different transactions may supply different post-processors (or none).\n\t */\n\tpublic constructor(\n\t\tpublic readonly branch: SharedTreeBranch<TEditor, TChange>,\n\t\tmintRevisionTag: () => RevisionTag,\n\t\tonPush?: () => OnPopWithViewUpdate<TChange> | void,\n\t) {\n\t\t// A stack of the post-processors to apply when each in-progress transaction commits, ordered from outermost to\n\t\t// innermost. Each in-progress transaction contributes exactly one entry: either the processor to apply when it\n\t\t// commits, or `undefined` when none should be applied.\n\t\tconst postProcessorStack: (ChangeProcessor<TChange> | undefined)[] = [];\n\t\t// Determines the entry to push for a transaction that was started with the given `requested` processor (if any).\n\t\t// A processor with \"outermost\" applicability that is already active in an enclosing transaction resolves to\n\t\t// `undefined` so that it is only applied once (at the outermost transaction that supplied it).\n\t\tconst resolvePostProcessor = (\n\t\t\trequested: ChangeProcessor<TChange> | undefined,\n\t\t): ChangeProcessor<TChange> | undefined => {\n\t\t\tif (\n\t\t\t\trequested?.applicability === ChangeProcessorApplicability.IfOutermost &&\n\t\t\t\tpostProcessorStack.includes(requested)\n\t\t\t) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn requested;\n\t\t};\n\n\t\tsuper(\n\t\t\t// Invoked when an outer transaction starts\n\t\t\t(\n\t\t\t\tstartOptions?: SquashingTransactionOptions<TChange>,\n\t\t\t): Callbacks<SquashingTransactionOptions<TChange>> => {\n\t\t\t\tpostProcessorStack.push(resolvePostProcessor(startOptions?.postProcessor));\n\t\t\t\t// Keep track of the commit that each transaction was on when it started\n\t\t\t\tconst startHead = this.activeBranch.getHead();\n\t\t\t\tconst rebaser = this.branch.changeFamily.rebaser;\n\t\t\t\tconst outerOnPop = onPush?.();\n\t\t\t\tlet transactionRevision: RevisionTag | undefined;\n\t\t\t\tconst transactionBranch = this.branch.fork(\n\t\t\t\t\tstartHead,\n\t\t\t\t\t// Lazily mint the revision tag for the transaction when it is first needed\n\t\t\t\t\t() => (transactionRevision ??= mintRevisionTag()),\n\t\t\t\t);\n\t\t\t\tthis.setTransactionBranch(transactionBranch);\n\t\t\t\ttransactionBranch.editor.enterTransaction();\n\n\t\t\t\t// Invoked when an outer transaction ends\n\t\t\t\tconst onOuterTransactionPop: OnPop = (result) => {\n\t\t\t\t\tassert(this.size === 0, 0xcae /* The outer transaction should be ending */);\n\t\t\t\t\tconst postProcessor = postProcessorStack.pop();\n\t\t\t\t\ttransactionBranch.editor.exitTransaction();\n\n\t\t\t\t\tconst sourcePath: GraphCommit<TChange>[] = [];\n\t\t\t\t\tconst targetPath: GraphCommit<TChange>[] = [];\n\t\t\t\t\tconst ancestor = findCommonAncestor(\n\t\t\t\t\t\t[startHead, sourcePath],\n\t\t\t\t\t\t[branch.getHead(), targetPath],\n\t\t\t\t\t);\n\t\t\t\t\tassert(ancestor !== undefined, 0xcce /* branches must be related */);\n\n\t\t\t\t\tconst transactionSteps: GraphCommit<TChange>[] = [];\n\t\t\t\t\tfindAncestor(\n\t\t\t\t\t\t[transactionBranch.getHead(), transactionSteps],\n\t\t\t\t\t\t(c) => c === startHead,\n\t\t\t\t\t);\n\n\t\t\t\t\tlet viewUpdate: TChange | undefined;\n\t\t\t\t\tswitch (result) {\n\t\t\t\t\t\tcase TransactionResult.Abort: {\n\t\t\t\t\t\t\t// When a transaction is aborted, roll back all the transaction's changes on the current branch.\n\t\t\t\t\t\t\t// It is important that this happens before and separately from updating the view because the `TreeCheckout` needs to\n\t\t\t\t\t\t\t// revert some internal (state to match what it was before the transaction began) before applying the view update (if any).\n\t\t\t\t\t\t\ttransactionBranch.removeAfter(startHead);\n\t\t\t\t\t\t\t// If changes were made on `branch` since the transaction began, the view will need to be updated to reflect those changes.\n\t\t\t\t\t\t\tif (targetPath.length > 0) {\n\t\t\t\t\t\t\t\tviewUpdate = diffHistories(\n\t\t\t\t\t\t\t\t\trebaser,\n\t\t\t\t\t\t\t\t\tstartHead,\n\t\t\t\t\t\t\t\t\tthis.branch.getHead(),\n\t\t\t\t\t\t\t\t\tmintRevisionTag,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TransactionResult.Commit: {\n\t\t\t\t\t\t\tif (transactionSteps.length > 0) {\n\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\ttransactionRevision !== undefined,\n\t\t\t\t\t\t\t\t\t0xccf /* Expected transaction revision in the presence of transaction steps */,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tfor (const commit of transactionSteps) {\n\t\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t\tcommit.revision === transactionRevision,\n\t\t\t\t\t\t\t\t\t\t0xcaf /* Unexpected commit in transaction */,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Squash all the new commits on the transaction branch into a new commit on the original branch\n\t\t\t\t\t\t\t\tconst squash = rebaser.compose(transactionSteps);\n\t\t\t\t\t\t\t\t// Apply this transaction's post-processor (if any) to the squashed change (for example, to\n\t\t\t\t\t\t\t\t// \"minimize\" it so that it contains no extraneous information).\n\t\t\t\t\t\t\t\tconst change =\n\t\t\t\t\t\t\t\t\tpostProcessor === undefined ? squash : postProcessor.processChange(squash);\n\n\t\t\t\t\t\t\t\tif (change !== squash) {\n\t\t\t\t\t\t\t\t\t// The post-processor produced a change that differs from the\n\t\t\t\t\t\t\t\t\t// one that was applied to the view as the transaction's edits\n\t\t\t\t\t\t\t\t\t// were made. Roll back the transaction's changes on the transaction\n\t\t\t\t\t\t\t\t\t// branch (which rolls back the view) and apply the post-processed\n\t\t\t\t\t\t\t\t\t// change in their place so that the view fully reflects the modified\n\t\t\t\t\t\t\t\t\t// `change`.\n\t\t\t\t\t\t\t\t\ttransactionBranch.removeAfter(startHead);\n\t\t\t\t\t\t\t\t\ttransactionBranch.apply(tagChange(change, transactionRevision));\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (targetPath.length === 0) {\n\t\t\t\t\t\t\t\t\t// No changes were made on the original branch since the transaction began\n\t\t\t\t\t\t\t\t\t// The transaction commit can be applied directly\n\t\t\t\t\t\t\t\t\tthis.branch.apply(tagChange(change, transactionRevision));\n\t\t\t\t\t\t\t\t\t// The view is already up-to-date so there's nothing more to do\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// Some changes were made on `branch` since the transaction began\n\t\t\t\t\t\t\t\t\tconst unrebasedHead = mintCommit(startHead, {\n\t\t\t\t\t\t\t\t\t\tchange,\n\t\t\t\t\t\t\t\t\t\trevision: transactionRevision,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t// We need to rebase the transaction commit on top of the new changes\n\t\t\t\t\t\t\t\t\tconst rebased = rebaseBranch(\n\t\t\t\t\t\t\t\t\t\tmintRevisionTag,\n\t\t\t\t\t\t\t\t\t\trebaser,\n\t\t\t\t\t\t\t\t\t\tunrebasedHead,\n\t\t\t\t\t\t\t\t\t\tbranch.getHead(),\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t\trebased.newSourceHead.revision === transactionRevision,\n\t\t\t\t\t\t\t\t\t\t0xcd0 /* The transaction commit should be rebased to the tip */,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tthis.branch.apply(rebased.newSourceHead);\n\t\t\t\t\t\t\t\t\tviewUpdate = rebased.sourceChange;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (targetPath.length > 0) {\n\t\t\t\t\t\t\t\t\t// Changes were made on `branch` since the transaction began.\n\t\t\t\t\t\t\t\t\t// The view will need to be updated to reflect those changes.\n\t\t\t\t\t\t\t\t\tviewUpdate = diffHistories(\n\t\t\t\t\t\t\t\t\t\trebaser,\n\t\t\t\t\t\t\t\t\t\tstartHead,\n\t\t\t\t\t\t\t\t\t\tthis.branch.getHead(),\n\t\t\t\t\t\t\t\t\t\tmintRevisionTag,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tunreachableCase(result);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttransactionBranch.dispose();\n\t\t\t\t\tthis.setTransactionBranch(undefined);\n\t\t\t\t\touterOnPop?.(result, viewUpdate);\n\t\t\t\t};\n\t\t\t\t// Invoked when a nested transaction begins\n\t\t\t\tconst onNestedTransactionPush: OnPush<SquashingTransactionOptions<TChange>> = (\n\t\t\t\t\tnestedStartOptions,\n\t\t\t\t) => {\n\t\t\t\t\tpostProcessorStack.push(resolvePostProcessor(nestedStartOptions?.postProcessor));\n\t\t\t\t\tconst nestedStartHead = this.activeBranch.getHead();\n\t\t\t\t\tconst nestedOuterOnPop = onPush?.();\n\t\t\t\t\ttransactionBranch.editor.enterTransaction();\n\t\t\t\t\treturn {\n\t\t\t\t\t\t// Invoked when a nested transaction ends\n\t\t\t\t\t\tonPop: (result) => {\n\t\t\t\t\t\t\tconst nestedPostProcessor = postProcessorStack.pop();\n\t\t\t\t\t\t\ttransactionBranch.editor.exitTransaction();\n\t\t\t\t\t\t\tswitch (result) {\n\t\t\t\t\t\t\t\tcase TransactionResult.Abort: {\n\t\t\t\t\t\t\t\t\t// When a transaction is aborted, roll back all the transaction's changes on the current branch\n\t\t\t\t\t\t\t\t\ttransactionBranch.removeAfter(nestedStartHead);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase TransactionResult.Commit: {\n\t\t\t\t\t\t\t\t\t// When this nested transaction supplied a post-processor that should be applied here, squash its\n\t\t\t\t\t\t\t\t\t// edits into a single (post-processed) commit on the transaction branch rather than leaving them to\n\t\t\t\t\t\t\t\t\t// be squashed only when the outermost transaction is committed.\n\t\t\t\t\t\t\t\t\tif (nestedPostProcessor !== undefined) {\n\t\t\t\t\t\t\t\t\t\tconst nestedSteps: GraphCommit<TChange>[] = [];\n\t\t\t\t\t\t\t\t\t\tfindAncestor(\n\t\t\t\t\t\t\t\t\t\t\t[transactionBranch.getHead(), nestedSteps],\n\t\t\t\t\t\t\t\t\t\t\t(c) => c === nestedStartHead,\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tif (nestedSteps.length > 0) {\n\t\t\t\t\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\t\t\t\t\ttransactionRevision !== undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t0xd07 /* Expected transaction revision in the presence of transaction steps */,\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tconst squash = rebaser.compose(nestedSteps);\n\t\t\t\t\t\t\t\t\t\t\tconst processedSquash = nestedPostProcessor.processChange(squash);\n\t\t\t\t\t\t\t\t\t\t\t// Roll back the transaction branch to the nested start head and apply the\n\t\t\t\t\t\t\t\t\t\t\t// processed change if it differs from the original change.\n\t\t\t\t\t\t\t\t\t\t\tif (processedSquash !== squash) {\n\t\t\t\t\t\t\t\t\t\t\t\ttransactionBranch.removeAfter(nestedStartHead);\n\t\t\t\t\t\t\t\t\t\t\t\ttransactionBranch.apply(\n\t\t\t\t\t\t\t\t\t\t\t\t\ttagChange(processedSquash, transactionRevision),\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t\tunreachableCase(result);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnestedOuterOnPop?.(result, undefined);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t\treturn { onPop: onOuterTransactionPop, onPush: onNestedTransactionPush };\n\t\t\t},\n\t\t);\n\t}\n\n\t/** Updates the transaction branch (and therefore the active branch) and rebinds the branch events. */\n\tprivate setTransactionBranch(\n\t\ttransactionBranch: SharedTreeBranch<TEditor, TChange> | undefined,\n\t): void {\n\t\tconst oldActiveBranch = this.activeBranch;\n\t\tthis.#transactionBranch = transactionBranch;\n\t\tfor (const [eventName, listeners] of this.#activeBranchEvents) {\n\t\t\tfor (const listener of listeners) {\n\t\t\t\toldActiveBranch.events.off(eventName, listener);\n\t\t\t\tthis.activeBranch.events.on(eventName, listener);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -22,7 +22,7 @@ export { type JsonSchemaId, type JsonSchemaType, type JsonObjectNodeSchema, type
22
22
  export type { TreeSchemaEncodingOptions } from "./getJsonSchema.js";
23
23
  export { getJsonSchema } from "./getJsonSchema.js";
24
24
  export { getSimpleSchema } from "./getSimpleSchema.js";
25
- export { SchemaCompatibilityTester } from "./schemaCompatibilityTester.js";
25
+ export { checkSchemaCompatibility } from "./schemaCompatibilityTester.js";
26
26
  export type { Unenforced, FieldSchemaAlphaUnsafe, ArrayNodeCustomizableSchemaUnsafe, MapNodeCustomizableSchemaUnsafe, System_Unsafe, TreeRecordNodeUnsafe, UnannotateAllowedTypeUnsafe, AnnotatedAllowedTypeUnsafe, AnnotatedAllowedTypesUnsafe, AllowedTypesFullUnsafe, AllowedTypesFullFromMixedUnsafe, UnannotateAllowedTypesListUnsafe, AnnotateAllowedTypesListUnsafe, FieldHasDefaultAlphaUnsafe, InsertableObjectFromSchemaRecordAlphaUnsafe, } from "./typesUnsafe.js";
27
27
  export { type VerboseTreeNode, type VerboseTree, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, replaceVerboseTreeHandles, } from "./verboseTree.js";
28
28
  export { type TreeEncodingOptions, customFromCursorStored, type CustomTreeNode, type CustomTreeValue, tryStoredSchemaAsArray, replaceHandles, type HandleConverter, KeyEncodingOptions, type TreeParsingOptions, } from "./customTree.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACX,sBAAsB,EACtB,yBAAyB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,qBAAqB,EACrB,0BAA0B,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACX,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,yBAAyB,EACzB,aAAa,EACb,YAAY,EACZ,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,KAAK,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EACN,aAAa,EACb,MAAM,EACN,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EACN,kBAAkB,EAClB,KAAK,kBAAkB,EAC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object.defineProperty(exports, "__esModule", { value: true });
7
- exports.decodeSchemaCompatibilitySnapshot = exports.encodeSchemaCompatibilitySnapshot = exports.incrementalSummaryHint = exports.incrementalEncodingPolicyForAllowedTypes = exports.generateSchemaFromSimpleSchema = exports.rollback = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.createIdentifierIndex = exports.createTreeIndex = exports.TreeBeta = exports.importConcise = exports.exportConcise = exports.borrowCursorFromTreeNodeOrValue = exports.replaceConciseTreeHandles = exports.conciseFromCursor = exports.KeyEncodingOptions = exports.replaceHandles = exports.tryStoredSchemaAsArray = exports.customFromCursorStored = exports.replaceVerboseTreeHandles = exports.verboseFromCursor = exports.cursorFromVerbose = exports.applySchemaToParserOptions = exports.SchemaCompatibilityTester = exports.getSimpleSchema = exports.getJsonSchema = exports.trackDirtyNodes = exports.createFromCursor = exports.tryGetSchema = exports.treeNodeApi = exports.getStoredKey = exports.getPropertyKeyFromStoredKey = exports.getIdentifierFromNode = exports.deltaMarksToArrayOps = exports.createCustomizedFluidFrameworkScopedFactory = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.allowUnused = exports.eraseSchemaDetailsSubclassable = exports.eraseSchemaDetails = exports.SchemaFactoryAlpha = exports.SchemaFactoryBeta = exports.scoped = exports.SchemaFactory = exports.schemaStatics = exports.asTreeViewAlpha = exports.TreeViewConfigurationAlpha = exports.TreeViewConfiguration = void 0;
7
+ exports.decodeSchemaCompatibilitySnapshot = exports.encodeSchemaCompatibilitySnapshot = exports.incrementalSummaryHint = exports.incrementalEncodingPolicyForAllowedTypes = exports.generateSchemaFromSimpleSchema = exports.rollback = exports.comparePersistedSchema = exports.extractPersistedSchema = exports.createIdentifierIndex = exports.createTreeIndex = exports.TreeBeta = exports.importConcise = exports.exportConcise = exports.borrowCursorFromTreeNodeOrValue = exports.replaceConciseTreeHandles = exports.conciseFromCursor = exports.KeyEncodingOptions = exports.replaceHandles = exports.tryStoredSchemaAsArray = exports.customFromCursorStored = exports.replaceVerboseTreeHandles = exports.verboseFromCursor = exports.cursorFromVerbose = exports.applySchemaToParserOptions = exports.checkSchemaCompatibility = exports.getSimpleSchema = exports.getJsonSchema = exports.trackDirtyNodes = exports.createFromCursor = exports.tryGetSchema = exports.treeNodeApi = exports.getStoredKey = exports.getPropertyKeyFromStoredKey = exports.getIdentifierFromNode = exports.deltaMarksToArrayOps = exports.createCustomizedFluidFrameworkScopedFactory = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.allowUnused = exports.eraseSchemaDetailsSubclassable = exports.eraseSchemaDetails = exports.SchemaFactoryAlpha = exports.SchemaFactoryBeta = exports.scoped = exports.SchemaFactory = exports.schemaStatics = exports.asTreeViewAlpha = exports.TreeViewConfigurationAlpha = exports.TreeViewConfiguration = void 0;
8
8
  exports.snapshotSchemaCompatibility = exports.checkCompatibility = exports.importCompatibilitySchemaSnapshot = exports.exportCompatibilitySchemaSnapshot = void 0;
9
9
  var configuration_js_1 = require("./configuration.js");
10
10
  Object.defineProperty(exports, "TreeViewConfiguration", { enumerable: true, get: function () { return configuration_js_1.TreeViewConfiguration; } });
@@ -46,7 +46,7 @@ Object.defineProperty(exports, "getJsonSchema", { enumerable: true, get: functio
46
46
  var getSimpleSchema_js_1 = require("./getSimpleSchema.js");
47
47
  Object.defineProperty(exports, "getSimpleSchema", { enumerable: true, get: function () { return getSimpleSchema_js_1.getSimpleSchema; } });
48
48
  var schemaCompatibilityTester_js_1 = require("./schemaCompatibilityTester.js");
49
- Object.defineProperty(exports, "SchemaCompatibilityTester", { enumerable: true, get: function () { return schemaCompatibilityTester_js_1.SchemaCompatibilityTester; } });
49
+ Object.defineProperty(exports, "checkSchemaCompatibility", { enumerable: true, get: function () { return schemaCompatibilityTester_js_1.checkSchemaCompatibility; } });
50
50
  var verboseTree_js_1 = require("./verboseTree.js");
51
51
  Object.defineProperty(exports, "applySchemaToParserOptions", { enumerable: true, get: function () { return verboseTree_js_1.applySchemaToParserOptions; } });
52
52
  Object.defineProperty(exports, "cursorFromVerbose", { enumerable: true, get: function () { return verboseTree_js_1.cursorFromVerbose; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAMH,uDAG4B;AAF3B,yHAAA,qBAAqB,OAAA;AACrB,8HAAA,0BAA0B,OAAA;AAgB3B,qCAA4C;AAAnC,0GAAA,eAAe,OAAA;AACxB,uDAAuE;AAA1C,iHAAA,aAAa,OAAA;AAC1C,uDAS4B;AAR3B,iHAAA,aAAa,OAAA;AACb,0GAAA,MAAM,OAAA;AAQP,+DAAmF;AAA1E,yHAAA,iBAAiB,OAAA;AAC1B,iEAIiC;AAHhC,2HAAA,kBAAkB,OAAA;AAInB,iEAGiC;AAFhC,2HAAA,kBAAkB,OAAA;AAClB,uIAAA,8BAA8B,OAAA;AAa/B,yEAA0D;AAAjD,wHAAA,WAAW,OAAA;AACpB,2EAKsC;AAJrC,uHAAA,SAAS,OAAA;AACT,6HAAA,eAAe,OAAA;AACf,6HAAA,eAAe,OAAA;AACf,yJAAA,2CAA2C,OAAA;AAE5C,mDAQ0B;AAPzB,sHAAA,oBAAoB,OAAA;AACpB,uHAAA,qBAAqB,OAAA;AACrB,6HAAA,2BAA2B,OAAA;AAC3B,8GAAA,YAAY,OAAA;AACZ,6GAAA,WAAW,OAAA;AAEX,8GAAA,YAAY,OAAA;AAEb,yCAA+C;AAAtC,6GAAA,gBAAgB,OAAA;AACzB,iDAIyB;AAFxB,gHAAA,eAAe,OAAA;AAqBhB,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AACtB,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AACxB,+EAA2E;AAAlE,yIAAA,yBAAyB,OAAA;AAmBlC,mDAO0B;AAJzB,4HAAA,0BAA0B,OAAA;AAC1B,mHAAA,iBAAiB,OAAA;AACjB,mHAAA,iBAAiB,OAAA;AACjB,2HAAA,yBAAyB,OAAA;AAG1B,iDAUyB;AARxB,uHAAA,sBAAsB,OAAA;AAGtB,uHAAA,sBAAsB,OAAA;AACtB,+GAAA,cAAc,OAAA;AAEd,mHAAA,kBAAkB,OAAA;AAInB,mDAI0B;AAFzB,mHAAA,iBAAiB,OAAA;AACjB,2HAAA,yBAAyB,OAAA;AAG1B,6CAOuB;AANtB,8HAAA,+BAA+B,OAAA;AAC/B,4GAAA,aAAa,OAAA;AACb,4GAAA,aAAa,OAAA;AAEb,uGAAA,QAAQ,OAAA;AAgBT,2DAA0E;AAAjE,qHAAA,eAAe,OAAA;AACxB,2DAG8B;AAF7B,2HAAA,qBAAqB,OAAA;AAItB,qDAG2B;AAF1B,yHAAA,sBAAsB,OAAA;AACtB,yHAAA,sBAAsB,OAAA;AAGvB,6DAkB+B;AAf9B,+GAAA,QAAQ,OAAA;AAiBT,6DAAuE;AAA9D,qIAAA,8BAA8B,OAAA;AAEvC,2EAGsC;AAFrC,sJAAA,wCAAwC,OAAA;AACxC,oIAAA,sBAAsB,OAAA;AAEvB,+DAGgC;AAF/B,yIAAA,iCAAiC,OAAA;AACjC,yIAAA,iCAAiC,OAAA;AAElC,qFAO2C;AAN1C,oJAAA,iCAAiC,OAAA;AACjC,oJAAA,iCAAiC,OAAA;AACjC,qIAAA,kBAAkB,OAAA;AAClB,8IAAA,2BAA2B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tITreeViewConfiguration,\n\tITreeConfigurationOptions,\n} from \"./configuration.js\";\nexport {\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n} from \"./configuration.js\";\nexport type {\n\tITree,\n\tTreeView,\n\tViewableTree,\n\tTreeViewEvents,\n\tSchemaCompatibilityStatus,\n\tTreeViewAlpha,\n\tTreeViewBeta,\n\tTreeBranch,\n\tTreeBranchAlpha,\n\tTreeBranchEvents,\n\tTreeContextAlpha,\n\tITreeAlpha,\n} from \"./tree.js\";\nexport { asTreeViewAlpha } from \"./tree.js\";\nexport { type SchemaStatics, schemaStatics } from \"./schemaStatics.js\";\nexport {\n\tSchemaFactory,\n\tscoped,\n\ttype ScopedSchemaName,\n\ttype ObjectSchemaOptionsAlpha,\n\ttype ObjectSchemaOptions,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaOptionsAlpha,\n\ttype SchemaFactory_base,\n} from \"./schemaFactory.js\";\nexport { SchemaFactoryBeta, type SchemaStaticsBeta } from \"./schemaFactoryBeta.js\";\nexport {\n\tSchemaFactoryAlpha,\n\ttype SchemaStaticsAlpha,\n\ttype NodeProvider,\n} from \"./schemaFactoryAlpha.js\";\nexport {\n\teraseSchemaDetails,\n\teraseSchemaDetailsSubclassable,\n} from \"./eraseSchemaDetails.js\";\nexport type {\n\tErasedSchema,\n\tErasedNode,\n\tErasedSchemaSubclassable,\n} from \"./eraseSchemaDetails.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n\tValidateRecursiveSchemaTemplate,\n\tFixRecursiveRecursionLimit,\n} from \"./schemaFactoryRecursive.js\";\nexport { allowUnused } from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\tcreateCustomizedFluidFrameworkScopedFactory,\n} from \"./schemaCreationUtilities.js\";\nexport {\n\tdeltaMarksToArrayOps,\n\tgetIdentifierFromNode,\n\tgetPropertyKeyFromStoredKey,\n\tgetStoredKey,\n\ttreeNodeApi,\n\ttype TreeNodeApi,\n\ttryGetSchema,\n} from \"./treeNodeApi.js\";\nexport { createFromCursor } from \"./create.js\";\nexport {\n\ttype DirtyTreeStatus,\n\ttrackDirtyNodes,\n\ttype DirtyTreeMap,\n} from \"./dirtyIndex.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n\ttype JsonRecordNodeSchema,\n\ttype JsonStringKeyPatternProperties,\n} from \"./jsonSchema.js\";\nexport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nexport type {\n\tUnenforced,\n\tFieldSchemaAlphaUnsafe,\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n\tUnannotateAllowedTypeUnsafe,\n\tAnnotatedAllowedTypeUnsafe,\n\tAnnotatedAllowedTypesUnsafe,\n\tAllowedTypesFullUnsafe,\n\tAllowedTypesFullFromMixedUnsafe,\n\tUnannotateAllowedTypesListUnsafe,\n\tAnnotateAllowedTypesListUnsafe,\n\tFieldHasDefaultAlphaUnsafe,\n\tInsertableObjectFromSchemaRecordAlphaUnsafe,\n} from \"./typesUnsafe.js\";\n\nexport {\n\ttype VerboseTreeNode,\n\ttype VerboseTree,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\treplaceVerboseTreeHandles,\n} from \"./verboseTree.js\";\n\nexport {\n\ttype TreeEncodingOptions,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\n\treplaceHandles,\n\ttype HandleConverter,\n\tKeyEncodingOptions,\n\ttype TreeParsingOptions,\n} from \"./customTree.js\";\n\nexport {\n\ttype ConciseTree,\n\tconciseFromCursor,\n\treplaceConciseTreeHandles,\n} from \"./conciseTree.js\";\n\nexport {\n\tborrowCursorFromTreeNodeOrValue,\n\texportConcise,\n\timportConcise,\n\ttype NodeChangedData,\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n} from \"./treeBeta.js\";\nexport {\n\ttype ArrayNodeDeltaOp,\n\ttype ArrayNodeInsertOp,\n\ttype ArrayNodeRemoveOp,\n\ttype ArrayNodeRetainOp,\n\ttype ArrayNodeTreeChangedDeltaOp,\n\ttype ArrayNodeTreeChangedRetainOp,\n\ttype NodeChangedDataAlpha,\n\ttype NodeChangedDataDelta,\n\ttype NodeChangedDataProperties,\n\ttype NodeChangedDataTreeDelta,\n\ttype TreeChangeEventsAlpha,\n} from \"./treeAlpha.js\";\nexport { createTreeIndex, type TreeIndexKey } from \"./simpleTreeIndex.js\";\nexport {\n\tcreateIdentifierIndex,\n\ttype IdentifierIndex,\n} from \"./identifierIndex.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\nexport {\n\ttype NoChangeConstraint,\n\ttype NodeInDocumentConstraint,\n\trollback,\n\ttype RunTransactionParamsAlpha,\n\ttype RunTransactionParamsBeta,\n\ttype TransactionCallbackStatusAlpha,\n\ttype TransactionCallbackStatusBeta,\n\ttype TransactionConstraint,\n\ttype TransactionConstraintAlpha,\n\ttype TransactionPostProcessor,\n\ttype TransactionResultFailed,\n\ttype TransactionResultSuccess,\n\ttype TransactionValueResult,\n\ttype TransactionVoidResult,\n\ttype VoidTransactionCallbackStatusAlpha,\n\ttype VoidTransactionCallbackStatusBeta,\n\ttype WithValue,\n} from \"./transactionTypes.js\";\n\nexport { generateSchemaFromSimpleSchema } from \"./schemaFromSimple.js\";\nexport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\nexport {\n\tincrementalEncodingPolicyForAllowedTypes,\n\tincrementalSummaryHint,\n} from \"./incrementalAllowedTypes.js\";\nexport {\n\tencodeSchemaCompatibilitySnapshot,\n\tdecodeSchemaCompatibilitySnapshot,\n} from \"./simpleSchemaCodec.js\";\nexport {\n\texportCompatibilitySchemaSnapshot,\n\timportCompatibilitySchemaSnapshot,\n\tcheckCompatibility,\n\tsnapshotSchemaCompatibility,\n\ttype SnapshotFileSystem,\n\ttype SnapshotSchemaCompatibilityOptions,\n} from \"./snapshotCompatibilityChecker.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAMH,uDAG4B;AAF3B,yHAAA,qBAAqB,OAAA;AACrB,8HAAA,0BAA0B,OAAA;AAgB3B,qCAA4C;AAAnC,0GAAA,eAAe,OAAA;AACxB,uDAAuE;AAA1C,iHAAA,aAAa,OAAA;AAC1C,uDAS4B;AAR3B,iHAAA,aAAa,OAAA;AACb,0GAAA,MAAM,OAAA;AAQP,+DAAmF;AAA1E,yHAAA,iBAAiB,OAAA;AAC1B,iEAIiC;AAHhC,2HAAA,kBAAkB,OAAA;AAInB,iEAGiC;AAFhC,2HAAA,kBAAkB,OAAA;AAClB,uIAAA,8BAA8B,OAAA;AAa/B,yEAA0D;AAAjD,wHAAA,WAAW,OAAA;AACpB,2EAKsC;AAJrC,uHAAA,SAAS,OAAA;AACT,6HAAA,eAAe,OAAA;AACf,6HAAA,eAAe,OAAA;AACf,yJAAA,2CAA2C,OAAA;AAE5C,mDAQ0B;AAPzB,sHAAA,oBAAoB,OAAA;AACpB,uHAAA,qBAAqB,OAAA;AACrB,6HAAA,2BAA2B,OAAA;AAC3B,8GAAA,YAAY,OAAA;AACZ,6GAAA,WAAW,OAAA;AAEX,8GAAA,YAAY,OAAA;AAEb,yCAA+C;AAAtC,6GAAA,gBAAgB,OAAA;AACzB,iDAIyB;AAFxB,gHAAA,eAAe,OAAA;AAqBhB,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AACtB,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AACxB,+EAA0E;AAAjE,wIAAA,wBAAwB,OAAA;AAmBjC,mDAO0B;AAJzB,4HAAA,0BAA0B,OAAA;AAC1B,mHAAA,iBAAiB,OAAA;AACjB,mHAAA,iBAAiB,OAAA;AACjB,2HAAA,yBAAyB,OAAA;AAG1B,iDAUyB;AARxB,uHAAA,sBAAsB,OAAA;AAGtB,uHAAA,sBAAsB,OAAA;AACtB,+GAAA,cAAc,OAAA;AAEd,mHAAA,kBAAkB,OAAA;AAInB,mDAI0B;AAFzB,mHAAA,iBAAiB,OAAA;AACjB,2HAAA,yBAAyB,OAAA;AAG1B,6CAOuB;AANtB,8HAAA,+BAA+B,OAAA;AAC/B,4GAAA,aAAa,OAAA;AACb,4GAAA,aAAa,OAAA;AAEb,uGAAA,QAAQ,OAAA;AAgBT,2DAA0E;AAAjE,qHAAA,eAAe,OAAA;AACxB,2DAG8B;AAF7B,2HAAA,qBAAqB,OAAA;AAItB,qDAG2B;AAF1B,yHAAA,sBAAsB,OAAA;AACtB,yHAAA,sBAAsB,OAAA;AAGvB,6DAkB+B;AAf9B,+GAAA,QAAQ,OAAA;AAiBT,6DAAuE;AAA9D,qIAAA,8BAA8B,OAAA;AAEvC,2EAGsC;AAFrC,sJAAA,wCAAwC,OAAA;AACxC,oIAAA,sBAAsB,OAAA;AAEvB,+DAGgC;AAF/B,yIAAA,iCAAiC,OAAA;AACjC,yIAAA,iCAAiC,OAAA;AAElC,qFAO2C;AAN1C,oJAAA,iCAAiC,OAAA;AACjC,oJAAA,iCAAiC,OAAA;AACjC,qIAAA,kBAAkB,OAAA;AAClB,8IAAA,2BAA2B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type {\n\tITreeViewConfiguration,\n\tITreeConfigurationOptions,\n} from \"./configuration.js\";\nexport {\n\tTreeViewConfiguration,\n\tTreeViewConfigurationAlpha,\n} from \"./configuration.js\";\nexport type {\n\tITree,\n\tTreeView,\n\tViewableTree,\n\tTreeViewEvents,\n\tSchemaCompatibilityStatus,\n\tTreeViewAlpha,\n\tTreeViewBeta,\n\tTreeBranch,\n\tTreeBranchAlpha,\n\tTreeBranchEvents,\n\tTreeContextAlpha,\n\tITreeAlpha,\n} from \"./tree.js\";\nexport { asTreeViewAlpha } from \"./tree.js\";\nexport { type SchemaStatics, schemaStatics } from \"./schemaStatics.js\";\nexport {\n\tSchemaFactory,\n\tscoped,\n\ttype ScopedSchemaName,\n\ttype ObjectSchemaOptionsAlpha,\n\ttype ObjectSchemaOptions,\n\ttype NodeSchemaOptions,\n\ttype NodeSchemaOptionsAlpha,\n\ttype SchemaFactory_base,\n} from \"./schemaFactory.js\";\nexport { SchemaFactoryBeta, type SchemaStaticsBeta } from \"./schemaFactoryBeta.js\";\nexport {\n\tSchemaFactoryAlpha,\n\ttype SchemaStaticsAlpha,\n\ttype NodeProvider,\n} from \"./schemaFactoryAlpha.js\";\nexport {\n\teraseSchemaDetails,\n\teraseSchemaDetailsSubclassable,\n} from \"./eraseSchemaDetails.js\";\nexport type {\n\tErasedSchema,\n\tErasedNode,\n\tErasedSchemaSubclassable,\n} from \"./eraseSchemaDetails.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n\tValidateRecursiveSchemaTemplate,\n\tFixRecursiveRecursionLimit,\n} from \"./schemaFactoryRecursive.js\";\nexport { allowUnused } from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n\tcreateCustomizedFluidFrameworkScopedFactory,\n} from \"./schemaCreationUtilities.js\";\nexport {\n\tdeltaMarksToArrayOps,\n\tgetIdentifierFromNode,\n\tgetPropertyKeyFromStoredKey,\n\tgetStoredKey,\n\ttreeNodeApi,\n\ttype TreeNodeApi,\n\ttryGetSchema,\n} from \"./treeNodeApi.js\";\nexport { createFromCursor } from \"./create.js\";\nexport {\n\ttype DirtyTreeStatus,\n\ttrackDirtyNodes,\n\ttype DirtyTreeMap,\n} from \"./dirtyIndex.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n\ttype JsonRecordNodeSchema,\n\ttype JsonStringKeyPatternProperties,\n} from \"./jsonSchema.js\";\nexport type { TreeSchemaEncodingOptions } from \"./getJsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { checkSchemaCompatibility } from \"./schemaCompatibilityTester.js\";\nexport type {\n\tUnenforced,\n\tFieldSchemaAlphaUnsafe,\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n\tTreeRecordNodeUnsafe,\n\tUnannotateAllowedTypeUnsafe,\n\tAnnotatedAllowedTypeUnsafe,\n\tAnnotatedAllowedTypesUnsafe,\n\tAllowedTypesFullUnsafe,\n\tAllowedTypesFullFromMixedUnsafe,\n\tUnannotateAllowedTypesListUnsafe,\n\tAnnotateAllowedTypesListUnsafe,\n\tFieldHasDefaultAlphaUnsafe,\n\tInsertableObjectFromSchemaRecordAlphaUnsafe,\n} from \"./typesUnsafe.js\";\n\nexport {\n\ttype VerboseTreeNode,\n\ttype VerboseTree,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n\treplaceVerboseTreeHandles,\n} from \"./verboseTree.js\";\n\nexport {\n\ttype TreeEncodingOptions,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\n\treplaceHandles,\n\ttype HandleConverter,\n\tKeyEncodingOptions,\n\ttype TreeParsingOptions,\n} from \"./customTree.js\";\n\nexport {\n\ttype ConciseTree,\n\tconciseFromCursor,\n\treplaceConciseTreeHandles,\n} from \"./conciseTree.js\";\n\nexport {\n\tborrowCursorFromTreeNodeOrValue,\n\texportConcise,\n\timportConcise,\n\ttype NodeChangedData,\n\tTreeBeta,\n\ttype TreeChangeEventsBeta,\n} from \"./treeBeta.js\";\nexport {\n\ttype ArrayNodeDeltaOp,\n\ttype ArrayNodeInsertOp,\n\ttype ArrayNodeRemoveOp,\n\ttype ArrayNodeRetainOp,\n\ttype ArrayNodeTreeChangedDeltaOp,\n\ttype ArrayNodeTreeChangedRetainOp,\n\ttype NodeChangedDataAlpha,\n\ttype NodeChangedDataDelta,\n\ttype NodeChangedDataProperties,\n\ttype NodeChangedDataTreeDelta,\n\ttype TreeChangeEventsAlpha,\n} from \"./treeAlpha.js\";\nexport { createTreeIndex, type TreeIndexKey } from \"./simpleTreeIndex.js\";\nexport {\n\tcreateIdentifierIndex,\n\ttype IdentifierIndex,\n} from \"./identifierIndex.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\nexport {\n\ttype NoChangeConstraint,\n\ttype NodeInDocumentConstraint,\n\trollback,\n\ttype RunTransactionParamsAlpha,\n\ttype RunTransactionParamsBeta,\n\ttype TransactionCallbackStatusAlpha,\n\ttype TransactionCallbackStatusBeta,\n\ttype TransactionConstraint,\n\ttype TransactionConstraintAlpha,\n\ttype TransactionPostProcessor,\n\ttype TransactionResultFailed,\n\ttype TransactionResultSuccess,\n\ttype TransactionValueResult,\n\ttype TransactionVoidResult,\n\ttype VoidTransactionCallbackStatusAlpha,\n\ttype VoidTransactionCallbackStatusBeta,\n\ttype WithValue,\n} from \"./transactionTypes.js\";\n\nexport { generateSchemaFromSimpleSchema } from \"./schemaFromSimple.js\";\nexport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\nexport {\n\tincrementalEncodingPolicyForAllowedTypes,\n\tincrementalSummaryHint,\n} from \"./incrementalAllowedTypes.js\";\nexport {\n\tencodeSchemaCompatibilitySnapshot,\n\tdecodeSchemaCompatibilitySnapshot,\n} from \"./simpleSchemaCodec.js\";\nexport {\n\texportCompatibilitySchemaSnapshot,\n\timportCompatibilitySchemaSnapshot,\n\tcheckCompatibility,\n\tsnapshotSchemaCompatibility,\n\ttype SnapshotFileSystem,\n\ttype SnapshotSchemaCompatibilityOptions,\n} from \"./snapshotCompatibilityChecker.js\";\n"]}
@@ -6,30 +6,15 @@ import type { TreeStoredSchema } from "../../core/index.js";
6
6
  import type { TreeSchema } from "../treeSchema.js";
7
7
  import type { SchemaCompatibilityStatus } from "./tree.js";
8
8
  /**
9
- * A collection of View information for schema
9
+ * Determines the compatibility of a stored document
10
+ * (based on its stored schema) with a viewer (based on its view schema).
11
+ *
10
12
  * @remarks
11
- * This contains everything needed to determine compatibility with a given stored schema.
13
+ * Adapters can be provided to handle differences between the two schema.
14
+ * Adapters should only use to types in the `view` SchemaRepository.
15
+ *
16
+ * TODO: this API violates the parse don't validate design philosophy.
17
+ * It should be wrapped with (or replaced by) a parse style API.
12
18
  */
13
- export declare class SchemaCompatibilityTester {
14
- /**
15
- * Schema for the view
16
- */
17
- readonly viewSchema: TreeSchema;
18
- constructor(
19
- /**
20
- * Schema for the view
21
- */
22
- viewSchema: TreeSchema);
23
- /**
24
- * Determines the compatibility of a stored document
25
- * (based on its stored schema) with a viewer (based on its view schema).
26
- *
27
- * Adapters can be provided to handle differences between the two schema.
28
- * Adapters should only use to types in the `view` SchemaRepository.
29
- *
30
- * TODO: this API violates the parse don't validate design philosophy.
31
- * It should be wrapped with (or replaced by) a parse style API.
32
- */
33
- checkCompatibility(stored: TreeStoredSchema): Omit<SchemaCompatibilityStatus, "canInitialize">;
34
- }
19
+ export declare function checkSchemaCompatibility(viewSchema: TreeSchema, stored: TreeStoredSchema): Omit<SchemaCompatibilityStatus, "canInitialize">;
35
20
  //# sourceMappingURL=schemaCompatibilityTester.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaCompatibilityTester.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaCompatibilityTester.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAE3D;;;;GAIG;AACH,qBAAa,yBAAyB;IAEpC;;OAEG;aACa,UAAU,EAAE,UAAU;;IAHtC;;OAEG;IACa,UAAU,EAAE,UAAU;IAGvC;;;;;;;;;OASG;IACI,kBAAkB,CACxB,MAAM,EAAE,gBAAgB,GACtB,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC;CA8BnD"}
1
+ {"version":3,"file":"schemaCompatibilityTester.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaCompatibilityTester.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACvC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,gBAAgB,GACtB,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC,CA6BlD"}
@@ -4,56 +4,43 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.SchemaCompatibilityTester = void 0;
7
+ exports.checkSchemaCompatibility = void 0;
8
8
  const index_js_1 = require("../../feature-libraries/index.js");
9
9
  const toStoredSchema_js_1 = require("../toStoredSchema.js");
10
10
  const discrepancies_js_1 = require("./discrepancies.js");
11
11
  /**
12
- * A collection of View information for schema
12
+ * Determines the compatibility of a stored document
13
+ * (based on its stored schema) with a viewer (based on its view schema).
14
+ *
13
15
  * @remarks
14
- * This contains everything needed to determine compatibility with a given stored schema.
16
+ * Adapters can be provided to handle differences between the two schema.
17
+ * Adapters should only use to types in the `view` SchemaRepository.
18
+ *
19
+ * TODO: this API violates the parse don't validate design philosophy.
20
+ * It should be wrapped with (or replaced by) a parse style API.
15
21
  */
16
- class SchemaCompatibilityTester {
17
- constructor(
18
- /**
19
- * Schema for the view
20
- */
21
- viewSchema) {
22
- this.viewSchema = viewSchema;
23
- }
24
- /**
25
- * Determines the compatibility of a stored document
26
- * (based on its stored schema) with a viewer (based on its view schema).
27
- *
28
- * Adapters can be provided to handle differences between the two schema.
29
- * Adapters should only use to types in the `view` SchemaRepository.
30
- *
31
- * TODO: this API violates the parse don't validate design philosophy.
32
- * It should be wrapped with (or replaced by) a parse style API.
33
- */
34
- checkCompatibility(stored) {
35
- // The public API surface assumes defaultSchemaPolicy
36
- const policy = index_js_1.defaultSchemaPolicy;
37
- // View schema allows a subset of documents that stored schema does, and the discrepancies are allowed by policy
38
- // determined by the view schema (i.e. objects with extra optional fields in the stored schema have opted into allowing this.
39
- // In the future, this would also include things like:
40
- // - fields with more allowed types in the stored schema than in the view schema have out-of-schema "unknown content" adapters
41
- let canView = true;
42
- for (const _discrepancy of (0, discrepancies_js_1.getDiscrepanciesInAllowedContent)(this.viewSchema, stored)) {
43
- canView = false;
44
- break;
45
- }
46
- const wouldUpgradeTo = (0, toStoredSchema_js_1.toUpgradeSchema)(this.viewSchema.root);
47
- const canUpgrade = (0, index_js_1.allowsRepoSuperset)(policy, stored, wouldUpgradeTo);
48
- // If true, then upgrading has no effect on what can be stored in the document.
49
- // TODO: This should likely be changed to indicate up a schema upgrade would be a no-op, including stored schema metadata.
50
- const isEquivalent = canView && canUpgrade && (0, index_js_1.allowsRepoSuperset)(policy, wouldUpgradeTo, stored);
51
- return {
52
- canView,
53
- canUpgrade,
54
- isEquivalent,
55
- };
22
+ function checkSchemaCompatibility(viewSchema, stored) {
23
+ // The public API surface assumes defaultSchemaPolicy
24
+ const policy = index_js_1.defaultSchemaPolicy;
25
+ // View schema allows a subset of documents that stored schema does, and the discrepancies are allowed by policy
26
+ // determined by the view schema (i.e. objects with extra optional fields in the stored schema have opted into allowing this.
27
+ // In the future, this would also include things like:
28
+ // - fields with more allowed types in the stored schema than in the view schema have out-of-schema "unknown content" adapters
29
+ let canView = true;
30
+ for (const _discrepancy of (0, discrepancies_js_1.getDiscrepanciesInAllowedContent)(viewSchema, stored)) {
31
+ canView = false;
32
+ break;
56
33
  }
34
+ const wouldUpgradeTo = (0, toStoredSchema_js_1.toUpgradeSchema)(viewSchema.root);
35
+ const canUpgrade = (0, index_js_1.allowsRepoSuperset)(policy, stored, wouldUpgradeTo);
36
+ // If true, then upgrading has no effect on what can be stored in the document.
37
+ // TODO: This should likely be changed to indicate up a schema upgrade would be a no-op, including stored schema metadata.
38
+ const isEquivalent = canView && canUpgrade && (0, index_js_1.allowsRepoSuperset)(policy, wouldUpgradeTo, stored);
39
+ return {
40
+ canView,
41
+ canUpgrade,
42
+ isEquivalent,
43
+ };
57
44
  }
58
- exports.SchemaCompatibilityTester = SchemaCompatibilityTester;
45
+ exports.checkSchemaCompatibility = checkSchemaCompatibility;
59
46
  //# sourceMappingURL=schemaCompatibilityTester.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaCompatibilityTester.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaCompatibilityTester.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAA2F;AAC3F,4DAAuD;AAGvD,yDAAsE;AAGtE;;;;GAIG;AACH,MAAa,yBAAyB;IACrC;IACC;;OAEG;IACa,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IACpC,CAAC;IAEJ;;;;;;;;;OASG;IACI,kBAAkB,CACxB,MAAwB;QAExB,qDAAqD;QACrD,MAAM,MAAM,GAAG,8BAAmB,CAAC;QAEnC,gHAAgH;QAChH,6HAA6H;QAC7H,sDAAsD;QACtD,8HAA8H;QAC9H,IAAI,OAAO,GAAG,IAAI,CAAC;QAEnB,KAAK,MAAM,YAAY,IAAI,IAAA,mDAAgC,EAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC;YACtF,OAAO,GAAG,KAAK,CAAC;YAChB,MAAM;QACP,CAAC;QAED,MAAM,cAAc,GAAG,IAAA,mCAAe,EAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAE7D,MAAM,UAAU,GAAG,IAAA,6BAAkB,EAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;QAEtE,+EAA+E;QAC/E,0HAA0H;QAC1H,MAAM,YAAY,GACjB,OAAO,IAAI,UAAU,IAAI,IAAA,6BAAkB,EAAC,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;QAE7E,OAAO;YACN,OAAO;YACP,UAAU;YACV,YAAY;SACZ,CAAC;IACH,CAAC;CACD;AAlDD,8DAkDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TreeStoredSchema } from \"../../core/index.js\";\nimport { allowsRepoSuperset, defaultSchemaPolicy } from \"../../feature-libraries/index.js\";\nimport { toUpgradeSchema } from \"../toStoredSchema.js\";\nimport type { TreeSchema } from \"../treeSchema.js\";\n\nimport { getDiscrepanciesInAllowedContent } from \"./discrepancies.js\";\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\n\n/**\n * A collection of View information for schema\n * @remarks\n * This contains everything needed to determine compatibility with a given stored schema.\n */\nexport class SchemaCompatibilityTester {\n\tpublic constructor(\n\t\t/**\n\t\t * Schema for the view\n\t\t */\n\t\tpublic readonly viewSchema: TreeSchema,\n\t) {}\n\n\t/**\n\t * Determines the compatibility of a stored document\n\t * (based on its stored schema) with a viewer (based on its view schema).\n\t *\n\t * Adapters can be provided to handle differences between the two schema.\n\t * Adapters should only use to types in the `view` SchemaRepository.\n\t *\n\t * TODO: this API violates the parse don't validate design philosophy.\n\t * It should be wrapped with (or replaced by) a parse style API.\n\t */\n\tpublic checkCompatibility(\n\t\tstored: TreeStoredSchema,\n\t): Omit<SchemaCompatibilityStatus, \"canInitialize\"> {\n\t\t// The public API surface assumes defaultSchemaPolicy\n\t\tconst policy = defaultSchemaPolicy;\n\n\t\t// View schema allows a subset of documents that stored schema does, and the discrepancies are allowed by policy\n\t\t// determined by the view schema (i.e. objects with extra optional fields in the stored schema have opted into allowing this.\n\t\t// In the future, this would also include things like:\n\t\t// - fields with more allowed types in the stored schema than in the view schema have out-of-schema \"unknown content\" adapters\n\t\tlet canView = true;\n\n\t\tfor (const _discrepancy of getDiscrepanciesInAllowedContent(this.viewSchema, stored)) {\n\t\t\tcanView = false;\n\t\t\tbreak;\n\t\t}\n\n\t\tconst wouldUpgradeTo = toUpgradeSchema(this.viewSchema.root);\n\n\t\tconst canUpgrade = allowsRepoSuperset(policy, stored, wouldUpgradeTo);\n\n\t\t// If true, then upgrading has no effect on what can be stored in the document.\n\t\t// TODO: This should likely be changed to indicate up a schema upgrade would be a no-op, including stored schema metadata.\n\t\tconst isEquivalent =\n\t\t\tcanView && canUpgrade && allowsRepoSuperset(policy, wouldUpgradeTo, stored);\n\n\t\treturn {\n\t\t\tcanView,\n\t\t\tcanUpgrade,\n\t\t\tisEquivalent,\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"schemaCompatibilityTester.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaCompatibilityTester.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAA2F;AAC3F,4DAAuD;AAGvD,yDAAsE;AAGtE;;;;;;;;;;GAUG;AACH,SAAgB,wBAAwB,CACvC,UAAsB,EACtB,MAAwB;IAExB,qDAAqD;IACrD,MAAM,MAAM,GAAG,8BAAmB,CAAC;IAEnC,gHAAgH;IAChH,6HAA6H;IAC7H,sDAAsD;IACtD,8HAA8H;IAC9H,IAAI,OAAO,GAAG,IAAI,CAAC;IAEnB,KAAK,MAAM,YAAY,IAAI,IAAA,mDAAgC,EAAC,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC;QACjF,OAAO,GAAG,KAAK,CAAC;QAChB,MAAM;IACP,CAAC;IAED,MAAM,cAAc,GAAG,IAAA,mCAAe,EAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAExD,MAAM,UAAU,GAAG,IAAA,6BAAkB,EAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;IAEtE,+EAA+E;IAC/E,0HAA0H;IAC1H,MAAM,YAAY,GACjB,OAAO,IAAI,UAAU,IAAI,IAAA,6BAAkB,EAAC,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IAE7E,OAAO;QACN,OAAO;QACP,UAAU;QACV,YAAY;KACZ,CAAC;AACH,CAAC;AAhCD,4DAgCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TreeStoredSchema } from \"../../core/index.js\";\nimport { allowsRepoSuperset, defaultSchemaPolicy } from \"../../feature-libraries/index.js\";\nimport { toUpgradeSchema } from \"../toStoredSchema.js\";\nimport type { TreeSchema } from \"../treeSchema.js\";\n\nimport { getDiscrepanciesInAllowedContent } from \"./discrepancies.js\";\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\n\n/**\n * Determines the compatibility of a stored document\n * (based on its stored schema) with a viewer (based on its view schema).\n *\n * @remarks\n * Adapters can be provided to handle differences between the two schema.\n * Adapters should only use to types in the `view` SchemaRepository.\n *\n * TODO: this API violates the parse don't validate design philosophy.\n * It should be wrapped with (or replaced by) a parse style API.\n */\nexport function checkSchemaCompatibility(\n\tviewSchema: TreeSchema,\n\tstored: TreeStoredSchema,\n): Omit<SchemaCompatibilityStatus, \"canInitialize\"> {\n\t// The public API surface assumes defaultSchemaPolicy\n\tconst policy = defaultSchemaPolicy;\n\n\t// View schema allows a subset of documents that stored schema does, and the discrepancies are allowed by policy\n\t// determined by the view schema (i.e. objects with extra optional fields in the stored schema have opted into allowing this.\n\t// In the future, this would also include things like:\n\t// - fields with more allowed types in the stored schema than in the view schema have out-of-schema \"unknown content\" adapters\n\tlet canView = true;\n\n\tfor (const _discrepancy of getDiscrepanciesInAllowedContent(viewSchema, stored)) {\n\t\tcanView = false;\n\t\tbreak;\n\t}\n\n\tconst wouldUpgradeTo = toUpgradeSchema(viewSchema.root);\n\n\tconst canUpgrade = allowsRepoSuperset(policy, stored, wouldUpgradeTo);\n\n\t// If true, then upgrading has no effect on what can be stored in the document.\n\t// TODO: This should likely be changed to indicate up a schema upgrade would be a no-op, including stored schema metadata.\n\tconst isEquivalent =\n\t\tcanView && canUpgrade && allowsRepoSuperset(policy, wouldUpgradeTo, stored);\n\n\treturn {\n\t\tcanView,\n\t\tcanUpgrade,\n\t\tisEquivalent,\n\t};\n}\n"]}
@@ -27,6 +27,8 @@ import type { ArrayNodeCustomizableSchemaUnsafe, FieldSchemaAlphaUnsafe, Inserta
27
27
  * Values should be preferred over generator functions when possible, as they are simpler and more efficient.
28
28
  * Generator functions should be used when the default value needs to be dynamic or when it is not possible to provide a value directly.
29
29
  *
30
+ * See {@link SchemaStaticsAlpha.withDefault} for the primary API that uses this type.
31
+ *
30
32
  * @example
31
33
  * ```typescript
32
34
  * // Provide a value directly
@@ -48,27 +50,63 @@ export type NodeProvider<T> = T | (() => T);
48
50
  */
49
51
  export interface SchemaStaticsAlpha {
50
52
  /**
51
- * Creates a field schema with a default value. Fields with defaults (whether required or optional) are recognized by the type system as optional in constructors,
52
- * allowing them to be omitted when creating new nodes.
53
+ * Creates a field schema with a default value.
54
+ *
55
+ * @remarks
56
+ * Fields with defaults are optional in constructors, allowing them to be omitted when creating new nodes.
57
+ * This works with both {@link SchemaStatics.required | required} and {@link SchemaStatics.optional | optional} fields:
58
+ *
59
+ * - **Required fields with defaults**: The field is always present in the tree, but can be omitted from the constructor.
60
+ * The default value is used when the field is not provided.
61
+ *
62
+ * - **Optional fields with defaults**: Optional fields already default to `undefined`, but `withDefault` lets you
63
+ * specify a different default value.
64
+ *
65
+ * The default value can be provided in two ways (see {@link NodeProvider}):
66
+ *
67
+ * 1. **A value**: The value is deep-copied for each use, ensuring independence between instances.
68
+ * Prefer this when the default is a fixed value.
69
+ *
70
+ * 2. **A generator function**: A function called each time a default is needed. Use this for dynamic defaults
71
+ * (e.g., timestamps, UUIDs) or when explicit control over value creation is required.
72
+ *
73
+ * Defaults are evaluated eagerly during node construction.
74
+ *
75
+ * For recursive schemas, use {@link SchemaStaticsAlpha.withDefaultRecursive} instead.
76
+ *
77
+ * See the {@link https://fluidframework.com/docs/data-structures/tree/schema-definition/default-field-values | Default Field Values documentation}
78
+ * for a comprehensive guide with additional examples.
53
79
  *
54
80
  * @param fieldSchema - The field schema to add a default to (e.g., `factory.required(factory.string)` or `factory.optional(factory.number)`)
55
81
  * @param defaultValue - A {@link NodeProvider} specifying the default value.
56
82
  *
57
83
  * @example
84
+ * A schema with a mix of required, defaulted, and dynamic fields:
58
85
  * ```typescript
59
- * const MySchema = factory.objectAlpha("MyObject", {
60
- * // Provide values directly
61
- * name: factory.withDefault(factory.required(factory.string), "untitled"),
62
- * count: factory.withDefault(factory.required(factory.number), 0),
63
- * metadata: factory.withDefault(factory.optional(Metadata), new Metadata({ version: 1 })),
64
- *
65
- * // Use generator functions for dynamic values
66
- * timestamp: factory.withDefault(factory.required(factory.number), () => Date.now()),
67
- * id: factory.withDefault(factory.required(factory.string), () => crypto.randomUUID()),
68
- * });
69
- *
70
- * const obj1 = new MySchema({}); // All defaults applied
71
- * const obj2 = new MySchema({ name: "custom" }); // name="custom", other defaults applied
86
+ * const factory = new SchemaFactoryAlpha("example");
87
+ *
88
+ * class Task extends factory.objectAlpha("Task", {
89
+ * // No default — must always be provided in the constructor
90
+ * title: factory.required(factory.string),
91
+ *
92
+ * // Required field with a static default
93
+ * status: factory.withDefault(factory.required(factory.string), "todo"),
94
+ *
95
+ * // Optional field with a custom default (instead of `undefined`)
96
+ * priority: factory.withDefault(factory.optional(factory.number), 0),
97
+ *
98
+ * // Dynamic default using a generator function
99
+ * createdAt: factory.withDefault(factory.required(factory.number), () => Date.now()),
100
+ * }) {}
101
+ *
102
+ * // Only `title` is required in the constructor; the rest use their defaults
103
+ * const task = new Task({ title: "Write docs" });
104
+ * // task.status === "todo"
105
+ * // task.priority === 0
106
+ * // task.createdAt is set to the current timestamp
107
+ *
108
+ * // Defaults can be overridden by providing explicit values
109
+ * const urgentTask = new Task({ title: "Fix bug", status: "in-progress", priority: 1 });
72
110
  * ```
73
111
  *
74
112
  * @privateRemarks
@@ -115,6 +153,9 @@ export interface SchemaStaticsAlpha {
115
153
  * @remarks
116
154
  * This version of {@link SchemaStaticsAlpha.withDefault} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
117
155
  * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
156
+ *
157
+ * See the {@link https://fluidframework.com/docs/data-structures/tree/schema-definition/default-field-values#recursive-types | Default Field Values — Recursive Types documentation}
158
+ * for usage examples and guidance on avoiding infinite recursion with recursive defaults.
118
159
  */
119
160
  withDefaultRecursive: <Kind extends FieldKind, Types extends System_Unsafe.ImplicitAllowedTypesUnsafe, TCustomMetadata = unknown>(fieldSchema: System_Unsafe.FieldSchemaUnsafe<Kind, Types, TCustomMetadata>, defaultValue: Unenforced<NodeProvider<System_Unsafe.InsertableTreeFieldFromImplicitFieldUnsafe<System_Unsafe.FieldSchemaUnsafe<Kind, Types>>>>) => FieldSchemaAlphaUnsafe<Kind, Types, TCustomMetadata, FieldPropsAlpha<TCustomMetadata> & {
120
161
  defaultProvider: DefaultProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactoryAlpha.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EACN,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,QA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