@fluidframework/tree 2.116.0-416006 → 2.116.1

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 (327) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +5 -3
  3. package/api-report/tree.alpha.api.md +4 -2
  4. package/api-report/tree.beta.api.md +1 -1
  5. package/api-report/tree.legacy.beta.api.md +1 -1
  6. package/dist/codec/codec.d.ts +6 -6
  7. package/dist/codec/codec.d.ts.map +1 -1
  8. package/dist/codec/codec.js +3 -3
  9. package/dist/codec/codec.js.map +1 -1
  10. package/dist/codec/versioned/codec.d.ts +3 -3
  11. package/dist/codec/versioned/codec.d.ts.map +1 -1
  12. package/dist/codec/versioned/codec.js.map +1 -1
  13. package/dist/core/forest/editableForest.d.ts +2 -0
  14. package/dist/core/forest/editableForest.d.ts.map +1 -1
  15. package/dist/core/forest/editableForest.js.map +1 -1
  16. package/dist/core/index.d.ts +1 -1
  17. package/dist/core/index.d.ts.map +1 -1
  18. package/dist/core/index.js +2 -2
  19. package/dist/core/index.js.map +1 -1
  20. package/dist/core/tree/index.d.ts +1 -1
  21. package/dist/core/tree/index.d.ts.map +1 -1
  22. package/dist/core/tree/index.js +2 -2
  23. package/dist/core/tree/index.js.map +1 -1
  24. package/dist/core/tree/visitorUtils.d.ts +24 -3
  25. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  26. package/dist/core/tree/visitorUtils.js +24 -6
  27. package/dist/core/tree/visitorUtils.js.map +1 -1
  28. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +30 -6
  29. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  30. package/dist/feature-libraries/chunked-forest/chunkedForest.js +146 -54
  31. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  32. package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts +2 -1
  33. package/dist/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -1
  34. package/dist/feature-libraries/comparison-forest/comparisonForest.js +87 -70
  35. package/dist/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
  36. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  37. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +5 -0
  38. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  39. package/dist/feature-libraries/forest-summary/forestSummarizer.js +127 -107
  40. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  41. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts +2 -2
  42. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
  43. package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
  44. package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  45. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  46. package/dist/feature-libraries/modular-schema/invert.js +1 -1
  47. package/dist/feature-libraries/modular-schema/invert.js.map +1 -1
  48. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  49. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +2 -11
  50. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  51. package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts +11 -16
  52. package/dist/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
  53. package/dist/feature-libraries/modular-schema/modularChangeUtils.js +10 -3
  54. package/dist/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
  55. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  56. package/dist/feature-libraries/object-forest/objectForest.js +34 -13
  57. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  58. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  59. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  60. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  61. package/dist/feature-libraries/sequence-field/rebase.js +1 -1
  62. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  63. package/dist/feature-libraries/sequence-field/utils.js +1 -1
  64. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  65. package/dist/packageVersion.d.ts +1 -1
  66. package/dist/packageVersion.d.ts.map +1 -1
  67. package/dist/packageVersion.js +1 -1
  68. package/dist/packageVersion.js.map +1 -1
  69. package/dist/shared-tree/independentView.d.ts.map +1 -1
  70. package/dist/shared-tree/independentView.js +2 -4
  71. package/dist/shared-tree/independentView.js.map +1 -1
  72. package/dist/shared-tree/sharedTree.d.ts +30 -5
  73. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  74. package/dist/shared-tree/sharedTree.js +8 -8
  75. package/dist/shared-tree/sharedTree.js.map +1 -1
  76. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
  77. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  78. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  79. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +25 -1
  80. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  81. package/dist/shared-tree/sharedTreeChangeEnricher.js +24 -0
  82. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  83. package/dist/shared-tree/treeCheckout.d.ts +21 -10
  84. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  85. package/dist/shared-tree/treeCheckout.js +56 -24
  86. package/dist/shared-tree/treeCheckout.js.map +1 -1
  87. package/dist/shared-tree-core/branchCommitEnricher.d.ts +2 -1
  88. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  89. package/dist/shared-tree-core/branchCommitEnricher.js +3 -2
  90. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  91. package/dist/shared-tree-core/changeEnricher.d.ts +3 -2
  92. package/dist/shared-tree-core/changeEnricher.d.ts.map +1 -1
  93. package/dist/shared-tree-core/changeEnricher.js.map +1 -1
  94. package/dist/shared-tree-core/defaultResubmitMachine.d.ts +9 -1
  95. package/dist/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  96. package/dist/shared-tree-core/defaultResubmitMachine.js +7 -2
  97. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  98. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  99. package/dist/shared-tree-core/editManager.js +2 -2
  100. package/dist/shared-tree-core/editManager.js.map +1 -1
  101. package/dist/shared-tree-core/editManagerCodecs.d.ts +2 -2
  102. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  103. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  104. package/dist/shared-tree-core/editManagerSummarizer.d.ts +2 -2
  105. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  106. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  107. package/dist/shared-tree-core/messageCodecs.d.ts +2 -2
  108. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  109. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  110. package/dist/shared-tree-core/sharedTreeCore.d.ts +11 -2
  111. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  112. package/dist/shared-tree-core/sharedTreeCore.js +11 -8
  113. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  114. package/dist/shared-tree-core/summaryTypes.d.ts +2 -2
  115. package/dist/shared-tree-core/summaryTypes.d.ts.map +1 -1
  116. package/dist/shared-tree-core/summaryTypes.js.map +1 -1
  117. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +1 -1
  118. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  119. package/dist/simple-tree/api/storedSchema.d.ts +2 -2
  120. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  121. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  122. package/dist/simple-tree/api/treeChangeEvents.d.ts +5 -1
  123. package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  124. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
  125. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  126. package/dist/simple-tree/node-kinds/array/arrayNode.js +10 -0
  127. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  128. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  129. package/dist/simple-tree/node-kinds/map/mapNode.js +19 -2
  130. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  131. package/dist/tableSchema.d.ts +1 -1
  132. package/dist/tableSchema.js +1 -1
  133. package/dist/tableSchema.js.map +1 -1
  134. package/dist/treeFactory.d.ts.map +1 -1
  135. package/dist/treeFactory.js +1 -1
  136. package/dist/treeFactory.js.map +1 -1
  137. package/dist/util/breakable.d.ts +14 -2
  138. package/dist/util/breakable.d.ts.map +1 -1
  139. package/dist/util/breakable.js +9 -1
  140. package/dist/util/breakable.js.map +1 -1
  141. package/dist/util/compressedIds.d.ts +2 -2
  142. package/dist/util/compressedIds.d.ts.map +1 -1
  143. package/dist/util/compressedIds.js +1 -6
  144. package/dist/util/compressedIds.js.map +1 -1
  145. package/lib/codec/codec.d.ts +6 -6
  146. package/lib/codec/codec.d.ts.map +1 -1
  147. package/lib/codec/codec.js +3 -3
  148. package/lib/codec/codec.js.map +1 -1
  149. package/lib/codec/versioned/codec.d.ts +3 -3
  150. package/lib/codec/versioned/codec.d.ts.map +1 -1
  151. package/lib/codec/versioned/codec.js.map +1 -1
  152. package/lib/core/forest/editableForest.d.ts +2 -0
  153. package/lib/core/forest/editableForest.d.ts.map +1 -1
  154. package/lib/core/forest/editableForest.js.map +1 -1
  155. package/lib/core/index.d.ts +1 -1
  156. package/lib/core/index.d.ts.map +1 -1
  157. package/lib/core/index.js +1 -1
  158. package/lib/core/index.js.map +1 -1
  159. package/lib/core/tree/index.d.ts +1 -1
  160. package/lib/core/tree/index.d.ts.map +1 -1
  161. package/lib/core/tree/index.js +1 -1
  162. package/lib/core/tree/index.js.map +1 -1
  163. package/lib/core/tree/visitorUtils.d.ts +24 -3
  164. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  165. package/lib/core/tree/visitorUtils.js +22 -4
  166. package/lib/core/tree/visitorUtils.js.map +1 -1
  167. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +30 -6
  168. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  169. package/lib/feature-libraries/chunked-forest/chunkedForest.js +146 -56
  170. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  171. package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts +2 -1
  172. package/lib/feature-libraries/comparison-forest/comparisonForest.d.ts.map +1 -1
  173. package/lib/feature-libraries/comparison-forest/comparisonForest.js +88 -70
  174. package/lib/feature-libraries/comparison-forest/comparisonForest.js.map +1 -1
  175. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  176. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +5 -0
  177. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  178. package/lib/feature-libraries/forest-summary/forestSummarizer.js +129 -108
  179. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  180. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts +2 -2
  181. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -1
  182. package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -1
  183. package/lib/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  184. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  185. package/lib/feature-libraries/modular-schema/invert.js +2 -2
  186. package/lib/feature-libraries/modular-schema/invert.js.map +1 -1
  187. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  188. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +2 -11
  189. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  190. package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts +11 -16
  191. package/lib/feature-libraries/modular-schema/modularChangeUtils.d.ts.map +1 -1
  192. package/lib/feature-libraries/modular-schema/modularChangeUtils.js +10 -3
  193. package/lib/feature-libraries/modular-schema/modularChangeUtils.js.map +1 -1
  194. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  195. package/lib/feature-libraries/object-forest/objectForest.js +35 -14
  196. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  197. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  198. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  199. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  200. package/lib/feature-libraries/sequence-field/rebase.js +2 -2
  201. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  202. package/lib/feature-libraries/sequence-field/utils.js +1 -1
  203. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  204. package/lib/packageVersion.d.ts +1 -1
  205. package/lib/packageVersion.d.ts.map +1 -1
  206. package/lib/packageVersion.js +1 -1
  207. package/lib/packageVersion.js.map +1 -1
  208. package/lib/shared-tree/independentView.d.ts.map +1 -1
  209. package/lib/shared-tree/independentView.js +3 -5
  210. package/lib/shared-tree/independentView.js.map +1 -1
  211. package/lib/shared-tree/sharedTree.d.ts +30 -5
  212. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  213. package/lib/shared-tree/sharedTree.js +8 -8
  214. package/lib/shared-tree/sharedTree.js.map +1 -1
  215. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +2 -2
  216. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  217. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  218. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +25 -1
  219. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  220. package/lib/shared-tree/sharedTreeChangeEnricher.js +24 -0
  221. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  222. package/lib/shared-tree/treeCheckout.d.ts +21 -10
  223. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  224. package/lib/shared-tree/treeCheckout.js +56 -24
  225. package/lib/shared-tree/treeCheckout.js.map +1 -1
  226. package/lib/shared-tree-core/branchCommitEnricher.d.ts +2 -1
  227. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  228. package/lib/shared-tree-core/branchCommitEnricher.js +3 -2
  229. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  230. package/lib/shared-tree-core/changeEnricher.d.ts +3 -2
  231. package/lib/shared-tree-core/changeEnricher.d.ts.map +1 -1
  232. package/lib/shared-tree-core/changeEnricher.js.map +1 -1
  233. package/lib/shared-tree-core/defaultResubmitMachine.d.ts +9 -1
  234. package/lib/shared-tree-core/defaultResubmitMachine.d.ts.map +1 -1
  235. package/lib/shared-tree-core/defaultResubmitMachine.js +7 -2
  236. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  237. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  238. package/lib/shared-tree-core/editManager.js +2 -2
  239. package/lib/shared-tree-core/editManager.js.map +1 -1
  240. package/lib/shared-tree-core/editManagerCodecs.d.ts +2 -2
  241. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  242. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  243. package/lib/shared-tree-core/editManagerSummarizer.d.ts +2 -2
  244. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  245. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  246. package/lib/shared-tree-core/messageCodecs.d.ts +2 -2
  247. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  248. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  249. package/lib/shared-tree-core/sharedTreeCore.d.ts +11 -2
  250. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  251. package/lib/shared-tree-core/sharedTreeCore.js +11 -8
  252. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  253. package/lib/shared-tree-core/summaryTypes.d.ts +2 -2
  254. package/lib/shared-tree-core/summaryTypes.d.ts.map +1 -1
  255. package/lib/shared-tree-core/summaryTypes.js.map +1 -1
  256. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +1 -1
  257. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  258. package/lib/simple-tree/api/storedSchema.d.ts +2 -2
  259. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  260. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  261. package/lib/simple-tree/api/treeChangeEvents.d.ts +5 -1
  262. package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  263. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
  264. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  265. package/lib/simple-tree/node-kinds/array/arrayNode.js +10 -0
  266. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  267. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  268. package/lib/simple-tree/node-kinds/map/mapNode.js +19 -2
  269. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  270. package/lib/tableSchema.d.ts +1 -1
  271. package/lib/tableSchema.js +1 -1
  272. package/lib/tableSchema.js.map +1 -1
  273. package/lib/treeFactory.d.ts.map +1 -1
  274. package/lib/treeFactory.js +1 -1
  275. package/lib/treeFactory.js.map +1 -1
  276. package/lib/util/breakable.d.ts +14 -2
  277. package/lib/util/breakable.d.ts.map +1 -1
  278. package/lib/util/breakable.js +9 -1
  279. package/lib/util/breakable.js.map +1 -1
  280. package/lib/util/compressedIds.d.ts +2 -2
  281. package/lib/util/compressedIds.d.ts.map +1 -1
  282. package/lib/util/compressedIds.js +1 -6
  283. package/lib/util/compressedIds.js.map +1 -1
  284. package/package.json +27 -27
  285. package/src/codec/codec.ts +7 -7
  286. package/src/codec/versioned/codec.ts +5 -5
  287. package/src/core/forest/editableForest.ts +2 -0
  288. package/src/core/index.ts +1 -1
  289. package/src/core/tree/index.ts +1 -1
  290. package/src/core/tree/visitorUtils.ts +37 -12
  291. package/src/feature-libraries/chunked-forest/chunkedForest.ts +214 -59
  292. package/src/feature-libraries/comparison-forest/comparisonForest.ts +6 -1
  293. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +2 -2
  294. package/src/feature-libraries/forest-summary/forestSummarizer.ts +10 -0
  295. package/src/feature-libraries/forest-summary/summaryTypes.ts +2 -2
  296. package/src/feature-libraries/indexing/anchorTreeIndex.ts +1 -1
  297. package/src/feature-libraries/modular-schema/invert.ts +2 -2
  298. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +2 -23
  299. package/src/feature-libraries/modular-schema/modularChangeUtils.ts +12 -21
  300. package/src/feature-libraries/object-forest/objectForest.ts +48 -14
  301. package/src/feature-libraries/schema-index/schemaSummarizer.ts +3 -3
  302. package/src/feature-libraries/sequence-field/rebase.ts +2 -2
  303. package/src/feature-libraries/sequence-field/utils.ts +1 -1
  304. package/src/packageVersion.ts +1 -1
  305. package/src/shared-tree/independentView.ts +5 -12
  306. package/src/shared-tree/sharedTree.ts +41 -10
  307. package/src/shared-tree/sharedTreeChangeCodecs.ts +2 -2
  308. package/src/shared-tree/sharedTreeChangeEnricher.ts +25 -1
  309. package/src/shared-tree/treeCheckout.ts +53 -24
  310. package/src/shared-tree-core/branchCommitEnricher.ts +6 -2
  311. package/src/shared-tree-core/changeEnricher.ts +7 -2
  312. package/src/shared-tree-core/defaultResubmitMachine.ts +5 -0
  313. package/src/shared-tree-core/editManager.ts +2 -4
  314. package/src/shared-tree-core/editManagerCodecs.ts +2 -2
  315. package/src/shared-tree-core/editManagerSummarizer.ts +3 -3
  316. package/src/shared-tree-core/messageCodecs.ts +2 -2
  317. package/src/shared-tree-core/sharedTreeCore.ts +29 -11
  318. package/src/shared-tree-core/summaryTypes.ts +2 -2
  319. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +1 -1
  320. package/src/simple-tree/api/storedSchema.ts +2 -2
  321. package/src/simple-tree/api/treeChangeEvents.ts +5 -1
  322. package/src/simple-tree/node-kinds/array/arrayNode.ts +15 -0
  323. package/src/simple-tree/node-kinds/map/mapNode.ts +23 -2
  324. package/src/tableSchema.ts +1 -1
  325. package/src/treeFactory.ts +0 -1
  326. package/src/util/breakable.ts +9 -1
  327. package/src/util/compressedIds.ts +7 -13
@@ -1 +1 @@
1
- {"version":3,"file":"mapNode.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/map/mapNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAAmE;AACnE,uEAAsE;AAEtE,qDAA6D;AAC7D,kEAM6C;AAC7C,qDAMgC;AAMhC,kDA2B6B;AAC7B,6DAA0E;AAC1E,yDAAoE;AACpE,yEAAsE;AACtE,yEAAmE;AAEnE,mGAImD;AACnD,4CAA2D;AA6M3D,0IAA0I;AAC1I,uDAAuD;AACvD,8DAA8D;AAC9D,MAAM,OAAO,GAAwC;IACpD,cAAc,EAAE,GAAG,EAAE;QACpB,OAAO,GAAG,CAAC,SAAS,CAAC;IACtB,CAAC;CACD,CAAC;AAEF,MAAe,iBAAwD,SAAQ,wBAE9E;IAGA,YAAmB,KAA+D;QACjF,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACpB,CAAC;IAEM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;IAED,IAAY,SAAS;QACpB,OAAO,IAAA,uBAAY,EAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAEO,MAAM,CAAC,GAAW;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAA,gBAAK,EAAC,GAAG,CAAC,CAA0B,CAAC;QAC3E,OAAO,KAAK,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,CAAC,GAAG,CAAC;AAC/B,CAAC;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,IAAoB,EAAE,MAAqB;IACpE,IAAI,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,qBAAU,CAAC,+CAA+C,IAAI,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,cAAc,GAAG,CACtB,MAAM,CAAC,QAAQ,IAAI,IAAI;QACtB,CAAC,CAAC,+DAA+D;YAChE,IAAI;QACL,CAAC,CAAC,iDAAiD;YAClD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAC4B,CAAC;IAEpD,OAAO,IAAA,uCAA2B,EAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FluidReadonlyMap } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, Lazy } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { MapNodeStoredSchema } from \"../../../core/index.js\";\nimport {\n\tisTreeValue,\n\ttype FlexibleNodeContent,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype OptionalFieldEditBuilder,\n} from \"../../../feature-libraries/index.js\";\nimport {\n\tbrand,\n\tcount,\n\tisReadonlyArray,\n\ttype JsonCompatibleReadOnlyObject,\n\ttype RestrictiveStringRecord,\n} from \"../../../util/index.js\";\nimport type {\n\tNodeSchemaOptionsAlpha,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Referenced by TSDoc {@link} in this file.\n\tRunTransactionParamsAlpha,\n} from \"../../api/index.js\";\nimport {\n\tCompatibilityLevel,\n\tgetKernel,\n\ttype InnerNode,\n\tNodeKind,\n\ttype TreeNodeSchema,\n\t// eslint-disable-next-line import-x/no-deprecated -- Required to implement the deprecated typeNameSymbol API.\n\ttypeNameSymbol,\n\ttype TreeNode,\n\ttypeSchemaSymbol,\n\tgetInnerNode,\n\ttype InternalTreeNode,\n\ttype UnhydratedFlexTreeNode,\n\tnormalizeAllowedTypes,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeSchemaMetadata,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tTreeNodeValid,\n\ttype MostDerivedData,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaCorePrivate,\n\tprivateDataSymbol,\n\tcreateTreeNodeSchemaPrivateData,\n\ttype FlexContent,\n\ttype TreeNodeSchemaPrivateData,\n\tAnnotatedAllowedTypesInternal,\n} from \"../../core/index.js\";\nimport { getTreeNodeSchemaInitializedData } from \"../../createContext.js\";\nimport { createFieldSchema, FieldKind } from \"../../fieldSchema.js\";\nimport { tryGetTreeNodeForField } from \"../../getTreeNodeForField.js\";\nimport { prepareForInsertion } from \"../../prepareForInsertion.js\";\nimport type { SchemaType, SimpleAllowedTypeAttributes } from \"../../simpleSchema.js\";\nimport {\n\tunhydratedFlexTreeFromInsertable,\n\ttype FactoryContent,\n\ttype InsertableContent,\n} from \"../../unhydratedFlexTreeFromInsertable.js\";\nimport { recordLikeDataToFlexContent } from \"../common.js\";\n\nimport type {\n\tMapNodeCustomizableSchema,\n\tMapNodePojoEmulationSchema,\n\tMapNodeSchema,\n} from \"./mapNodeTypes.js\";\n\n/**\n * A map of string keys to tree objects.\n *\n * @privateRemarks\n * Add support for `clear` once we have established merge semantics for it.\n *\n * @sealed @public\n */\nexport interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTypes>\n\textends ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\tTreeNode {\n\t/**\n\t * Adds or updates an entry in the map with a specified `key` and a `value`.\n\t *\n\t * @param key - The key of the element to add to the map.\n\t * @param value - The value of the element to add to the map.\n\t *\n\t * @remarks\n\t * Setting the value at a key to `undefined` is equivalent to calling {@link TreeMapNode.delete} with that key.\n\t */\n\tset(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T> | undefined): void;\n\n\t/**\n\t * Removes the specified element from this map by its `key`.\n\t *\n\t * @remarks\n\t * Note: unlike JavaScript's Map API, this method does not return a flag indicating whether or not the value was\n\t * deleted.\n\t *\n\t * @privateRemarks\n\t * Regarding the choice to not return a boolean: Since this data structure is distributed in nature, it isn't\n\t * possible to tell whether or not the item was deleted as a result of this method call. Returning a \"best guess\"\n\t * is more likely to create issues / promote bad usage patterns than offer useful information.\n\t *\n\t * @param key - The key of the element to remove from the map.\n\t */\n\tdelete(key: string): void;\n\n\t/**\n\t * Returns an iterable of keys in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the keys returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tkeys(): IterableIterator<string>;\n\n\t/**\n\t * Returns an iterable of values in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the values returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tvalues(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>>;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the entries returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tentries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]>;\n\n\t/**\n\t * Executes the provided function once per each key/value pair in this map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order in which the function is called with respect to the map's entries.\n\t * If your usage scenario depends on consistent ordering, you will need to account for this.\n\t */\n\tforEach(\n\t\tcallbackfn: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tkey: string,\n\t\t\tmap: ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\t) => void,\n\t\t// Typing inherited from `ReadonlyMap`.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tthisArg?: any,\n\t): void;\n}\n\n/**\n * {@link TreeMapNode} with FluidReadonlyMap-based iteration.\n *\n * @remarks\n * This is the same as {@link TreeMapNode} except that it extends FluidReadonlyMap\n * instead of the built-in `ReadonlyMap`, insulating against breaking changes\n * in TypeScript's standard library iterator types.\n *\n * @sealed @alpha\n */\nexport interface TreeMapNodeAlpha<T extends ImplicitAllowedTypes = ImplicitAllowedTypes>\n\textends FluidReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\tTreeNode,\n\t\tPick<TreeMapNode<T>, \"set\" | \"delete\"> {\n\t/**\n\t * Removes all elements from the map.\n\t * @remarks\n\t * The merge semantics of this operation are loosely specified. Either of the following may occur:\n\t *\n\t * - `clear` may remove all elements that were in the map when the edit was authored,\n\t * even if some of those elements have since been moved elsewhere in the tree\n\t * (in which case they are removed from their new location).\n\t *\n\t * - `clear` may remove all elements that are in the map when the edit is sequenced,\n\t * even if some of those elements were not yet in the map when the edit was authored.\n\t */\n\tclear(): void;\n\t/**\n\t * Returns the value at `key`, first inserting `fallbackValue` if this map has no entry for `key`.\n\t *\n\t * @param key - The key of the element to return or insert at.\n\t * @param fallbackValue - The value to insert if `key` has no entry.\n\t * @returns The value at `key`, which may be the provided `fallbackValue`\n\t * if the map had no previous entry for `key`.\n\t *\n\t * @remarks\n\t * The check for the presence of an existing entry with the given `key` is performed at the time the edit is authored.\n\t * This has implications for the merge semantics of this operation:\n\t *\n\t * - If no entry is present for `key` at authoring time (thus leading to an insert)\n\t * while a peer concurrently inserts a value for the same `key`,\n\t * then the two inserts will race and the one that is sequenced second will overwrite the value inserted by the one\n\t * that is sequenced first.\n\t *\n\t * - If an entry is present for `key` at authoring time (thus leading to no insert)\n\t * while a peer concurrently deletes the entry for `key`,\n\t * then the map will end up with no entry for `key` no matter how the two edits are sequenced.\n\t *\n\t * - If an entry is present for `key` at authoring time (thus leading to no insert)\n\t * while a peer concurrently inserts a new entry for `key`,\n\t * then the map will end up with the entry set by the peer no matter how the two edits are sequenced.\n\t *\n\t * These last two points mean that, upon sequencing of an edit made with this API,\n\t * there is no guarantee that the entry for the given key will be the current one (if any) or the fallback one.\n\t * If such a guarantee is important, then consider using {@link RunTransactionParamsAlpha.preconditions}\n\t * to ensure the edit only applies when appropriate.\n\t *\n\t * This API is **not** equivalent to the following alternative:\n\t *\n\t * ```typescript\n\t * map.set(key, map.get(key) ?? fallbackValue);\n\t * ```\n\t *\n\t * They differ in the following ways:\n\t *\n\t * - This API treats entries containing `null` values as populated.\n\t * By contrast, the above alternative's usage of `??` means that a `null` entry is treated as equivalent to a missing entry.\n\t *\n\t * - This API only inserts/sets the entry for the given `key` when there is no current one.\n\t * By contrast, the above alternative always performs an insert.\n\t * That insert will throw an error for non-leaf types (objects, maps, arrays, and records) in cases where the entry\n\t * is already populated, because inserting a node that was already inserted is not supported.\n\t * It will always succeed for leaf types (number, string, boolean, null, and handle) since a new node is created\n\t * from the value.\n\t * Note that even in the cases where it does not throw,\n\t * the `set` operation has the potential to overwrite entries that are concurrently inserted even when the map had\n\t * an entry for `key`, which is not the case with this API.\n\t *\n\t * Avoid using this API to write a default value into the document when the application could instead return that\n\t * default when reading a missing entry, which is much less costly.\n\t * A more appropriate use of this API is when the value to be optionally inserted varies with the key.\n\t */\n\tgetOrInsert(\n\t\tkey: string,\n\t\tfallbackValue: InsertableTreeNodeFromImplicitAllowedTypes<T>,\n\t): TreeNodeFromImplicitAllowedTypes<T>;\n\n\t/**\n\t * Returns the value at `key`, first inserting the value produced by `callback` if this map has no entry for `key`.\n\t *\n\t * @param key - The key of the element to return or insert at.\n\t * @param callback - Invoked with `key` to produce the value to insert if `key` has no entry.\n\t * Not invoked if an entry is present.\n\t * @returns The value at `key`, which may be the value produced by `callback`\n\t * if the map had no previous entry for `key`.\n\t *\n\t * @remarks\n\t * This API is equivalent to {@link TreeMapNodeAlpha.getOrInsert} except that the fallback value is computed lazily:\n\t * `callback` is only invoked when the map has no entry for `key`.\n\t * Prefer this API over {@link TreeMapNodeAlpha.getOrInsert} when producing the fallback value is expensive.\n\t *\n\t * The check for the presence of an existing entry with the given `key` is performed at the time the edit is authored.\n\t * See {@link TreeMapNodeAlpha.getOrInsert} for the implications this has on the merge semantics of this operation.\n\t *\n\t * If `callback` throws, no edit is made and the error is propagated to the caller.\n\t * If `callback` sets an entry for `key` in this map, that entry is overwritten with the value `callback` returned.\n\t */\n\tgetOrInsertComputed(\n\t\tkey: string,\n\t\tcallback: (key: string) => InsertableTreeNodeFromImplicitAllowedTypes<T>,\n\t): TreeNodeFromImplicitAllowedTypes<T>;\n}\n\n// TreeMapNode is invariant over schema type, so for this handler to work with all schema, the only possible type for the schema is `any`.\n// This is not ideal, but no alternatives are possible.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst handler: ProxyHandler<TreeMapNodeAlpha<any>> = {\n\tgetPrototypeOf: () => {\n\t\treturn Map.prototype;\n\t},\n};\n\nabstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends TreeNodeValid<\n\tMapNodeInsertableData<T>\n> {\n\tpublic static readonly kind = NodeKind.Map;\n\n\tpublic constructor(input?: InternalTreeNode | MapNodeInsertableData<T> | undefined) {\n\t\tsuper(input ?? []);\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> {\n\t\treturn this.entries();\n\t}\n\n\tprivate get innerNode(): InnerNode {\n\t\treturn getInnerNode(this);\n\t}\n\n\tprivate editor(key: string): OptionalFieldEditBuilder<FlexibleNodeContent> {\n\t\tconst field = this.innerNode.getBoxed(brand(key)) as FlexTreeOptionalField;\n\t\treturn field.editor;\n\t}\n\n\tpublic delete(key: string): void {\n\t\tconst field = this.innerNode.getBoxed(brand(key));\n\t\tthis.editor(key).set(undefined, field.length === 0);\n\t}\n\tpublic *entries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> {\n\t\tconst node = this.innerNode;\n\t\tfor (const key of node.keys()) {\n\t\t\tyield [\n\t\t\t\tkey,\n\t\t\t\ttryGetTreeNodeForField(node.getBoxed(key)) as TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\t];\n\t\t}\n\t}\n\tpublic get(key: string): TreeNodeFromImplicitAllowedTypes<T> {\n\t\tconst node = this.innerNode;\n\t\tconst field = node.getBoxed(brand(key));\n\t\treturn tryGetTreeNodeForField(field) as TreeNodeFromImplicitAllowedTypes<T>;\n\t}\n\tpublic has(key: string): boolean {\n\t\treturn this.innerNode.tryGetField(brand(key)) !== undefined;\n\t}\n\tpublic keys(): IterableIterator<string> {\n\t\tconst node = this.innerNode;\n\t\treturn node.keys();\n\t}\n\tpublic set(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T>): this {\n\t\tconst kernel = getKernel(this);\n\t\tconst node = this.innerNode;\n\t\tconst innerSchema = this.innerNode.context.schema.nodeSchema.get(\n\t\t\tbrand(kernel.schema.identifier),\n\t\t);\n\t\tassert(\n\t\t\tinnerSchema instanceof MapNodeStoredSchema,\n\t\t\t0xc17 /* Expected MapNodeStoredSchema */,\n\t\t);\n\n\t\tconst mapTree = prepareForInsertion(\n\t\t\tvalue as InsertableContent | undefined,\n\t\t\tcreateFieldSchema(FieldKind.Optional, kernel.schema.info as ImplicitAllowedTypes),\n\t\t\tnode.context,\n\t\t\tinnerSchema.mapFields,\n\t\t);\n\n\t\tconst field = node.getBoxed(brand(key));\n\n\t\tthis.editor(key).set(mapTree, field.length === 0);\n\t\treturn this;\n\t}\n\tpublic getOrInsert(\n\t\tkey: string,\n\t\tfallbackValue: InsertableTreeNodeFromImplicitAllowedTypes<T>,\n\t): TreeNodeFromImplicitAllowedTypes<T> {\n\t\tconst existing = this.get(key);\n\t\tif (existing !== undefined) {\n\t\t\treturn existing;\n\t\t}\n\t\tthis.set(key, fallbackValue);\n\t\treturn this.get(key);\n\t}\n\tpublic getOrInsertComputed(\n\t\tkey: string,\n\t\tcallback: (key: string) => InsertableTreeNodeFromImplicitAllowedTypes<T>,\n\t): TreeNodeFromImplicitAllowedTypes<T> {\n\t\tconst existing = this.get(key);\n\t\tif (existing !== undefined) {\n\t\t\treturn existing;\n\t\t}\n\t\tthis.set(key, callback(key));\n\t\treturn this.get(key);\n\t}\n\tpublic get size(): number {\n\t\treturn count(this.innerNode.keys());\n\t}\n\tpublic *values(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\tfor (const [, value] of this.entries()) {\n\t\t\tyield value;\n\t\t}\n\t}\n\tpublic forEach<TThis extends TreeMapNodeAlpha<T>>(\n\t\tthis: TThis,\n\t\tcallbackFn: (value: TreeNodeFromImplicitAllowedTypes<T>, key: string, map: TThis) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tfor (const field of getInnerNode(this)) {\n\t\t\tconst node = tryGetTreeNodeForField(field) as TreeNodeFromImplicitAllowedTypes<T>;\n\t\t\tcallbackFn.call(thisArg, node, field.key, this);\n\t\t}\n\t}\n\tpublic clear(): void {\n\t\tconst node = this.innerNode;\n\t\tconst transaction = node.isHydrated() ? node.context.checkout.transaction : undefined;\n\t\ttransaction?.start();\n\t\tfor (const key of [...node.keys()]) {\n\t\t\tthis.delete(key);\n\t\t}\n\t\ttransaction?.commit();\n\t}\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n *\n * @param base - base schema type to extend.\n * @param useMapPrototype - should this type emulate a ES6 Map object (by faking its prototype with a proxy).\n * @param persistedMetadata - Optional persisted metadata for the object node schema.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function mapSchema<\n\tTName extends string,\n\tconst T extends ImplicitAllowedTypes,\n\tconst ImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n\tuseMapPrototype: boolean,\n\tnodeOptions: NodeSchemaOptionsAlpha<TCustomMetadata> = {},\n) {\n\tconst normalizedTypes = normalizeAllowedTypes(info);\n\tconst lazyAllowedTypesIdentifiers = new Lazy(\n\t\t() => new Set(normalizedTypes.evaluate().map((type) => type.identifier)),\n\t);\n\tconst lazySimpleAllowedTypes = new Lazy(() => {\n\t\treturn AnnotatedAllowedTypesInternal.evaluateSimpleAllowedTypes(normalizedTypes);\n\t});\n\n\tlet privateData: TreeNodeSchemaPrivateData | undefined;\n\tconst persistedMetadata = nodeOptions.persistedMetadata;\n\n\tclass Schema extends CustomMapNodeBase<T> implements TreeMapNodeAlpha<T> {\n\t\tpublic readonly [Symbol.toStringTag] = \"TreeMapNodeSchema\";\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\tif (useMapPrototype) {\n\t\t\t\treturn new Proxy<Schema>(instance as Schema, handler as ProxyHandler<Schema>);\n\t\t\t}\n\t\t\treturn instance;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn unhydratedFlexTreeFromInsertable(input as FactoryContent, this as typeof Schema);\n\t\t}\n\n\t\tpublic static get allowedTypesIdentifiers(): ReadonlySet<string> {\n\t\t\treturn lazyAllowedTypesIdentifiers.value;\n\t\t}\n\n\t\tpublic static get simpleAllowedTypes(): ReadonlyMap<\n\t\t\tstring,\n\t\t\tSimpleAllowedTypeAttributes<SchemaType.View>\n\t\t> {\n\t\t\treturn lazySimpleAllowedTypes.value;\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup(): TreeNodeSchemaInitializedData {\n\t\t\tconst schema = this as MapNodeSchema;\n\t\t\treturn getTreeNodeSchemaInitializedData(this, {\n\t\t\t\tshallowCompatibilityTest,\n\t\t\t\ttoFlexContent: (data: FactoryContent): FlexContent => mapToFlexContent(data, schema),\n\t\t\t});\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn normalizedTypes.evaluateSet();\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> =\n\t\t\tnodeOptions.metadata ?? {};\n\t\tpublic static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =\n\t\t\tpersistedMetadata;\n\n\t\t// eslint-disable-next-line import-x/no-deprecated -- Required to implement the deprecated typeNameSymbol API.\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): typeof schemaErased {\n\t\t\treturn Schema.constructorCached?.constructor as unknown as typeof schemaErased;\n\t\t}\n\n\t\tpublic static get [privateDataSymbol](): TreeNodeSchemaPrivateData {\n\t\t\treturn (privateData ??= createTreeNodeSchemaPrivateData(this, [normalizedTypes]));\n\t\t}\n\t}\n\tconst schemaErased: MapNodeCustomizableSchema<\n\t\tTName,\n\t\tT,\n\t\tImplicitlyConstructable,\n\t\tTCustomMetadata\n\t> &\n\t\tMapNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> &\n\t\tTreeNodeSchemaCorePrivate = Schema;\n\treturn schemaErased;\n}\n\n/**\n * Content which can be used to construct a Map node, explicitly or implicitly.\n * @system @public\n */\nexport type MapNodeInsertableData<T extends ImplicitAllowedTypes> =\n\t| Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]>\n\t| RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;\n\n/**\n * {@link TreeNodeSchemaInitializedData.shallowCompatibilityTest} for Map nodes.\n */\nfunction shallowCompatibilityTest(data: FactoryContent): CompatibilityLevel {\n\tif (isTreeValue(data)) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\tif (isReadonlyArray(data)) {\n\t\t// Arrays are iterable, so type checking does allow constructing a MapNode from an array if the array's type is key values pairs for the map.\n\t\treturn CompatibilityLevel.Low;\n\t}\n\n\tif (Symbol.iterator in data) {\n\t\treturn CompatibilityLevel.Normal;\n\t}\n\n\t// When not unioned with an ObjectNode, allow objects to be used to create maps.\n\treturn CompatibilityLevel.Low;\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.toFlexContent} for Map nodes.\n *\n * Transforms data under a Map schema.\n * @param data - The tree data to be transformed. Must be an iterable or Record like object.\n * @param schema - The schema to comply with.\n */\nfunction mapToFlexContent(data: FactoryContent, schema: MapNodeSchema): FlexContent {\n\tif (!(typeof data === \"object\" && data !== null)) {\n\t\tthrow new UsageError(`Input data is incompatible with Map schema: ${data}`);\n\t}\n\n\tconst fieldsIterator = (\n\t\tSymbol.iterator in data\n\t\t\t? // Support iterables of key value pairs (including Map objects)\n\t\t\t\tdata\n\t\t\t: // Support record objects for JSON style Map data\n\t\t\t\tObject.entries(data)\n\t) as Iterable<readonly [string, InsertableContent]>;\n\n\treturn recordLikeDataToFlexContent(fieldsIterator, schema);\n}\n"]}
1
+ {"version":3,"file":"mapNode.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/map/mapNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAAmE;AACnE,uEAAsE;AAEtE,qDAA6D;AAC7D,kEAM6C;AAC7C,qDAMgC;AAMhC,kDA2B6B;AAC7B,6DAA0E;AAC1E,yDAAoE;AACpE,yEAAsE;AACtE,yEAAmE;AAEnE,mGAImD;AACnD,4CAA2D;AA6M3D,0IAA0I;AAC1I,uDAAuD;AACvD,8DAA8D;AAC9D,MAAM,OAAO,GAAwC;IACpD,cAAc,EAAE,GAAG,EAAE;QACp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,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,qBAAU,CAAC,+CAA+C,IAAI,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,cAAc,GAAG,CACtB,MAAM,CAAC,QAAQ,IAAI,IAAI;QACtB,CAAC,CAAC,+DAA+D;YAChE,IAAI;QACL,CAAC,CAAC,iDAAiD;YAClD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAC4B,CAAC;IAEpD,OAAO,IAAA,uCAA2B,EAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FluidReadonlyMap } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, Lazy } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { MapNodeStoredSchema } from \"../../../core/index.js\";\nimport {\n\tisTreeValue,\n\ttype FlexibleNodeContent,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype OptionalFieldEditBuilder,\n} from \"../../../feature-libraries/index.js\";\nimport {\n\tbrand,\n\tcount,\n\tisReadonlyArray,\n\ttype JsonCompatibleReadOnlyObject,\n\ttype RestrictiveStringRecord,\n} from \"../../../util/index.js\";\nimport type {\n\tNodeSchemaOptionsAlpha,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Referenced by TSDoc {@link} in this file.\n\tRunTransactionParamsAlpha,\n} from \"../../api/index.js\";\nimport {\n\tCompatibilityLevel,\n\tgetKernel,\n\ttype InnerNode,\n\tNodeKind,\n\ttype TreeNodeSchema,\n\t// eslint-disable-next-line import-x/no-deprecated -- Required to implement the deprecated typeNameSymbol API.\n\ttypeNameSymbol,\n\ttype TreeNode,\n\ttypeSchemaSymbol,\n\tgetInnerNode,\n\ttype InternalTreeNode,\n\ttype UnhydratedFlexTreeNode,\n\tnormalizeAllowedTypes,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeSchemaMetadata,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tTreeNodeValid,\n\ttype MostDerivedData,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaCorePrivate,\n\tprivateDataSymbol,\n\tcreateTreeNodeSchemaPrivateData,\n\ttype FlexContent,\n\ttype TreeNodeSchemaPrivateData,\n\tAnnotatedAllowedTypesInternal,\n} from \"../../core/index.js\";\nimport { getTreeNodeSchemaInitializedData } from \"../../createContext.js\";\nimport { createFieldSchema, FieldKind } from \"../../fieldSchema.js\";\nimport { tryGetTreeNodeForField } from \"../../getTreeNodeForField.js\";\nimport { prepareForInsertion } from \"../../prepareForInsertion.js\";\nimport type { SchemaType, SimpleAllowedTypeAttributes } from \"../../simpleSchema.js\";\nimport {\n\tunhydratedFlexTreeFromInsertable,\n\ttype FactoryContent,\n\ttype InsertableContent,\n} from \"../../unhydratedFlexTreeFromInsertable.js\";\nimport { recordLikeDataToFlexContent } from \"../common.js\";\n\nimport type {\n\tMapNodeCustomizableSchema,\n\tMapNodePojoEmulationSchema,\n\tMapNodeSchema,\n} from \"./mapNodeTypes.js\";\n\n/**\n * A map of string keys to tree objects.\n *\n * @privateRemarks\n * Add support for `clear` once we have established merge semantics for it.\n *\n * @sealed @public\n */\nexport interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTypes>\n\textends ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\tTreeNode {\n\t/**\n\t * Adds or updates an entry in the map with a specified `key` and a `value`.\n\t *\n\t * @param key - The key of the element to add to the map.\n\t * @param value - The value of the element to add to the map.\n\t *\n\t * @remarks\n\t * Setting the value at a key to `undefined` is equivalent to calling {@link TreeMapNode.delete} with that key.\n\t */\n\tset(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T> | undefined): void;\n\n\t/**\n\t * Removes the specified element from this map by its `key`.\n\t *\n\t * @remarks\n\t * Note: unlike JavaScript's Map API, this method does not return a flag indicating whether or not the value was\n\t * deleted.\n\t *\n\t * @privateRemarks\n\t * Regarding the choice to not return a boolean: Since this data structure is distributed in nature, it isn't\n\t * possible to tell whether or not the item was deleted as a result of this method call. Returning a \"best guess\"\n\t * is more likely to create issues / promote bad usage patterns than offer useful information.\n\t *\n\t * @param key - The key of the element to remove from the map.\n\t */\n\tdelete(key: string): void;\n\n\t/**\n\t * Returns an iterable of keys in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the keys returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tkeys(): IterableIterator<string>;\n\n\t/**\n\t * Returns an iterable of values in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the values returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tvalues(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>>;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the entries returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tentries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]>;\n\n\t/**\n\t * Executes the provided function once per each key/value pair in this map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order in which the function is called with respect to the map's entries.\n\t * If your usage scenario depends on consistent ordering, you will need to account for this.\n\t */\n\tforEach(\n\t\tcallbackfn: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tkey: string,\n\t\t\tmap: ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\t) => void,\n\t\t// Typing inherited from `ReadonlyMap`.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tthisArg?: any,\n\t): void;\n}\n\n/**\n * {@link TreeMapNode} with FluidReadonlyMap-based iteration.\n *\n * @remarks\n * This is the same as {@link TreeMapNode} except that it extends FluidReadonlyMap\n * instead of the built-in `ReadonlyMap`, insulating against breaking changes\n * in TypeScript's standard library iterator types.\n *\n * @sealed @alpha\n */\nexport interface TreeMapNodeAlpha<T extends ImplicitAllowedTypes = ImplicitAllowedTypes>\n\textends FluidReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\tTreeNode,\n\t\tPick<TreeMapNode<T>, \"set\" | \"delete\"> {\n\t/**\n\t * Removes all elements from the map.\n\t * @remarks\n\t * The merge semantics of this operation are loosely specified. Either of the following may occur:\n\t *\n\t * - `clear` may remove all elements that were in the map when the edit was authored,\n\t * even if some of those elements have since been moved elsewhere in the tree\n\t * (in which case they are removed from their new location).\n\t *\n\t * - `clear` may remove all elements that are in the map when the edit is sequenced,\n\t * even if some of those elements were not yet in the map when the edit was authored.\n\t */\n\tclear(): void;\n\t/**\n\t * Returns the value at `key`, first inserting `fallbackValue` if this map has no entry for `key`.\n\t *\n\t * @param key - The key of the element to return or insert at.\n\t * @param fallbackValue - The value to insert if `key` has no entry.\n\t * @returns The value at `key`, which may be the provided `fallbackValue`\n\t * if the map had no previous entry for `key`.\n\t *\n\t * @remarks\n\t * The check for the presence of an existing entry with the given `key` is performed at the time the edit is authored.\n\t * This has implications for the merge semantics of this operation:\n\t *\n\t * - If no entry is present for `key` at authoring time (thus leading to an insert)\n\t * while a peer concurrently inserts a value for the same `key`,\n\t * then the two inserts will race and the one that is sequenced second will overwrite the value inserted by the one\n\t * that is sequenced first.\n\t *\n\t * - If an entry is present for `key` at authoring time (thus leading to no insert)\n\t * while a peer concurrently deletes the entry for `key`,\n\t * then the map will end up with no entry for `key` no matter how the two edits are sequenced.\n\t *\n\t * - If an entry is present for `key` at authoring time (thus leading to no insert)\n\t * while a peer concurrently inserts a new entry for `key`,\n\t * then the map will end up with the entry set by the peer no matter how the two edits are sequenced.\n\t *\n\t * These last two points mean that, upon sequencing of an edit made with this API,\n\t * there is no guarantee that the entry for the given key will be the current one (if any) or the fallback one.\n\t * If such a guarantee is important, then consider using {@link RunTransactionParamsAlpha.preconditions}\n\t * to ensure the edit only applies when appropriate.\n\t *\n\t * This API is **not** equivalent to the following alternative:\n\t *\n\t * ```typescript\n\t * map.set(key, map.get(key) ?? fallbackValue);\n\t * ```\n\t *\n\t * They differ in the following ways:\n\t *\n\t * - This API treats entries containing `null` values as populated.\n\t * By contrast, the above alternative's usage of `??` means that a `null` entry is treated as equivalent to a missing entry.\n\t *\n\t * - This API only inserts/sets the entry for the given `key` when there is no current one.\n\t * By contrast, the above alternative always performs an insert.\n\t * That insert will throw an error for non-leaf types (objects, maps, arrays, and records) in cases where the entry\n\t * is already populated, because inserting a node that was already inserted is not supported.\n\t * It will always succeed for leaf types (number, string, boolean, null, and handle) since a new node is created\n\t * from the value.\n\t * Note that even in the cases where it does not throw,\n\t * the `set` operation has the potential to overwrite entries that are concurrently inserted even when the map had\n\t * an entry for `key`, which is not the case with this API.\n\t *\n\t * Avoid using this API to write a default value into the document when the application could instead return that\n\t * default when reading a missing entry, which is much less costly.\n\t * A more appropriate use of this API is when the value to be optionally inserted varies with the key.\n\t */\n\tgetOrInsert(\n\t\tkey: string,\n\t\tfallbackValue: InsertableTreeNodeFromImplicitAllowedTypes<T>,\n\t): TreeNodeFromImplicitAllowedTypes<T>;\n\n\t/**\n\t * Returns the value at `key`, first inserting the value produced by `callback` if this map has no entry for `key`.\n\t *\n\t * @param key - The key of the element to return or insert at.\n\t * @param callback - Invoked with `key` to produce the value to insert if `key` has no entry.\n\t * Not invoked if an entry is present.\n\t * @returns The value at `key`, which may be the value produced by `callback`\n\t * if the map had no previous entry for `key`.\n\t *\n\t * @remarks\n\t * This API is equivalent to {@link TreeMapNodeAlpha.getOrInsert} except that the fallback value is computed lazily:\n\t * `callback` is only invoked when the map has no entry for `key`.\n\t * Prefer this API over {@link TreeMapNodeAlpha.getOrInsert} when producing the fallback value is expensive.\n\t *\n\t * The check for the presence of an existing entry with the given `key` is performed at the time the edit is authored.\n\t * See {@link TreeMapNodeAlpha.getOrInsert} for the implications this has on the merge semantics of this operation.\n\t *\n\t * If `callback` throws, no edit is made and the error is propagated to the caller.\n\t * If `callback` sets an entry for `key` in this map, that entry is overwritten with the value `callback` returned.\n\t */\n\tgetOrInsertComputed(\n\t\tkey: string,\n\t\tcallback: (key: string) => InsertableTreeNodeFromImplicitAllowedTypes<T>,\n\t): TreeNodeFromImplicitAllowedTypes<T>;\n}\n\n// TreeMapNode is invariant over schema type, so for this handler to work with all schema, the only possible type for the schema is `any`.\n// This is not ideal, but no alternatives are possible.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst handler: ProxyHandler<TreeMapNodeAlpha<any>> = {\n\tgetPrototypeOf: () => {\n\t\treturn Map.prototype;\n\t},\n\tget: (target, key, receiver) => {\n\t\tconst value = Reflect.get(target, key, receiver) as unknown;\n\t\tif (value !== undefined) {\n\t\t\treturn value;\n\t\t}\n\t\t// If the property is a function on Map.prototype but not on the target,\n\t\t// return a function that throws a descriptive TypeError when called.\n\t\tif (\n\t\t\ttypeof key === \"string\" &&\n\t\t\t!(key in target) &&\n\t\t\tkey in Map.prototype &&\n\t\t\ttypeof (Map.prototype as unknown as Record<string, unknown>)[key] === \"function\"\n\t\t) {\n\t\t\treturn () => {\n\t\t\t\tthrow new TypeError(\n\t\t\t\t\t`MapNode does not support '${key}'. Use the MapNode API (e.g., set, get, delete, keys, values, entries).`,\n\t\t\t\t);\n\t\t\t};\n\t\t}\n\t\treturn value;\n\t},\n};\n\nabstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends TreeNodeValid<\n\tMapNodeInsertableData<T>\n> {\n\tpublic static readonly kind = NodeKind.Map;\n\n\tpublic constructor(input?: InternalTreeNode | MapNodeInsertableData<T> | undefined) {\n\t\tsuper(input ?? []);\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> {\n\t\treturn this.entries();\n\t}\n\n\tprivate get innerNode(): InnerNode {\n\t\treturn getInnerNode(this);\n\t}\n\n\tprivate editor(key: string): OptionalFieldEditBuilder<FlexibleNodeContent> {\n\t\tconst field = this.innerNode.getBoxed(brand(key)) as FlexTreeOptionalField;\n\t\treturn field.editor;\n\t}\n\n\tpublic delete(key: string): void {\n\t\tconst field = this.innerNode.getBoxed(brand(key));\n\t\tthis.editor(key).set(undefined, field.length === 0);\n\t}\n\tpublic *entries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> {\n\t\tconst node = this.innerNode;\n\t\tfor (const key of node.keys()) {\n\t\t\tyield [\n\t\t\t\tkey,\n\t\t\t\ttryGetTreeNodeForField(node.getBoxed(key)) as TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\t];\n\t\t}\n\t}\n\tpublic get(key: string): TreeNodeFromImplicitAllowedTypes<T> {\n\t\tconst node = this.innerNode;\n\t\tconst field = node.getBoxed(brand(key));\n\t\treturn tryGetTreeNodeForField(field) as TreeNodeFromImplicitAllowedTypes<T>;\n\t}\n\tpublic has(key: string): boolean {\n\t\treturn this.innerNode.tryGetField(brand(key)) !== undefined;\n\t}\n\tpublic *keys(): IterableIterator<string> {\n\t\tconst node = this.innerNode;\n\t\tyield* node.keys();\n\t}\n\tpublic set(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T>): this {\n\t\tconst kernel = getKernel(this);\n\t\tconst node = this.innerNode;\n\t\tconst innerSchema = this.innerNode.context.schema.nodeSchema.get(\n\t\t\tbrand(kernel.schema.identifier),\n\t\t);\n\t\tassert(\n\t\t\tinnerSchema instanceof MapNodeStoredSchema,\n\t\t\t0xc17 /* Expected MapNodeStoredSchema */,\n\t\t);\n\n\t\tconst mapTree = prepareForInsertion(\n\t\t\tvalue as InsertableContent | undefined,\n\t\t\tcreateFieldSchema(FieldKind.Optional, kernel.schema.info as ImplicitAllowedTypes),\n\t\t\tnode.context,\n\t\t\tinnerSchema.mapFields,\n\t\t);\n\n\t\tconst field = node.getBoxed(brand(key));\n\n\t\tthis.editor(key).set(mapTree, field.length === 0);\n\t\treturn this;\n\t}\n\tpublic getOrInsert(\n\t\tkey: string,\n\t\tfallbackValue: InsertableTreeNodeFromImplicitAllowedTypes<T>,\n\t): TreeNodeFromImplicitAllowedTypes<T> {\n\t\tconst existing = this.get(key);\n\t\tif (existing !== undefined) {\n\t\t\treturn existing;\n\t\t}\n\t\tthis.set(key, fallbackValue);\n\t\treturn this.get(key);\n\t}\n\tpublic getOrInsertComputed(\n\t\tkey: string,\n\t\tcallback: (key: string) => InsertableTreeNodeFromImplicitAllowedTypes<T>,\n\t): TreeNodeFromImplicitAllowedTypes<T> {\n\t\tconst existing = this.get(key);\n\t\tif (existing !== undefined) {\n\t\t\treturn existing;\n\t\t}\n\t\tthis.set(key, callback(key));\n\t\treturn this.get(key);\n\t}\n\tpublic get size(): number {\n\t\treturn count(this.innerNode.keys());\n\t}\n\tpublic *values(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\tfor (const [, value] of this.entries()) {\n\t\t\tyield value;\n\t\t}\n\t}\n\tpublic forEach<TThis extends TreeMapNodeAlpha<T>>(\n\t\tthis: TThis,\n\t\tcallbackFn: (value: TreeNodeFromImplicitAllowedTypes<T>, key: string, map: TThis) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tfor (const field of getInnerNode(this)) {\n\t\t\tconst node = tryGetTreeNodeForField(field) as TreeNodeFromImplicitAllowedTypes<T>;\n\t\t\tcallbackFn.call(thisArg, node, field.key, this);\n\t\t}\n\t}\n\tpublic clear(): void {\n\t\tconst node = this.innerNode;\n\t\tconst transaction = node.isHydrated() ? node.context.checkout.transaction : undefined;\n\t\ttransaction?.start();\n\t\tfor (const key of [...node.keys()]) {\n\t\t\tthis.delete(key);\n\t\t}\n\t\ttransaction?.commit();\n\t}\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n *\n * @param base - base schema type to extend.\n * @param useMapPrototype - should this type emulate a ES6 Map object (by faking its prototype with a proxy).\n * @param persistedMetadata - Optional persisted metadata for the object node schema.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function mapSchema<\n\tTName extends string,\n\tconst T extends ImplicitAllowedTypes,\n\tconst ImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n\tuseMapPrototype: boolean,\n\tnodeOptions: NodeSchemaOptionsAlpha<TCustomMetadata> = {},\n) {\n\tconst normalizedTypes = normalizeAllowedTypes(info);\n\tconst lazyAllowedTypesIdentifiers = new Lazy(\n\t\t() => new Set(normalizedTypes.evaluate().map((type) => type.identifier)),\n\t);\n\tconst lazySimpleAllowedTypes = new Lazy(() => {\n\t\treturn AnnotatedAllowedTypesInternal.evaluateSimpleAllowedTypes(normalizedTypes);\n\t});\n\n\tlet privateData: TreeNodeSchemaPrivateData | undefined;\n\tconst persistedMetadata = nodeOptions.persistedMetadata;\n\n\tclass Schema extends CustomMapNodeBase<T> implements TreeMapNodeAlpha<T> {\n\t\tpublic readonly [Symbol.toStringTag] = \"TreeMapNodeSchema\";\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\tif (useMapPrototype) {\n\t\t\t\treturn new Proxy<Schema>(instance as Schema, handler as ProxyHandler<Schema>);\n\t\t\t}\n\t\t\treturn instance;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn unhydratedFlexTreeFromInsertable(input as FactoryContent, this as typeof Schema);\n\t\t}\n\n\t\tpublic static get allowedTypesIdentifiers(): ReadonlySet<string> {\n\t\t\treturn lazyAllowedTypesIdentifiers.value;\n\t\t}\n\n\t\tpublic static get simpleAllowedTypes(): ReadonlyMap<\n\t\t\tstring,\n\t\t\tSimpleAllowedTypeAttributes<SchemaType.View>\n\t\t> {\n\t\t\treturn lazySimpleAllowedTypes.value;\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup(): TreeNodeSchemaInitializedData {\n\t\t\tconst schema = this as MapNodeSchema;\n\t\t\treturn getTreeNodeSchemaInitializedData(this, {\n\t\t\t\tshallowCompatibilityTest,\n\t\t\t\ttoFlexContent: (data: FactoryContent): FlexContent => mapToFlexContent(data, schema),\n\t\t\t});\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn normalizedTypes.evaluateSet();\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> =\n\t\t\tnodeOptions.metadata ?? {};\n\t\tpublic static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =\n\t\t\tpersistedMetadata;\n\n\t\t// eslint-disable-next-line import-x/no-deprecated -- Required to implement the deprecated typeNameSymbol API.\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): typeof schemaErased {\n\t\t\treturn Schema.constructorCached?.constructor as unknown as typeof schemaErased;\n\t\t}\n\n\t\tpublic static get [privateDataSymbol](): TreeNodeSchemaPrivateData {\n\t\t\treturn (privateData ??= createTreeNodeSchemaPrivateData(this, [normalizedTypes]));\n\t\t}\n\t}\n\tconst schemaErased: MapNodeCustomizableSchema<\n\t\tTName,\n\t\tT,\n\t\tImplicitlyConstructable,\n\t\tTCustomMetadata\n\t> &\n\t\tMapNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> &\n\t\tTreeNodeSchemaCorePrivate = Schema;\n\treturn schemaErased;\n}\n\n/**\n * Content which can be used to construct a Map node, explicitly or implicitly.\n * @system @public\n */\nexport type MapNodeInsertableData<T extends ImplicitAllowedTypes> =\n\t| Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]>\n\t| RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;\n\n/**\n * {@link TreeNodeSchemaInitializedData.shallowCompatibilityTest} for Map nodes.\n */\nfunction shallowCompatibilityTest(data: FactoryContent): CompatibilityLevel {\n\tif (isTreeValue(data)) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\tif (isReadonlyArray(data)) {\n\t\t// Arrays are iterable, so type checking does allow constructing a MapNode from an array if the array's type is key values pairs for the map.\n\t\treturn CompatibilityLevel.Low;\n\t}\n\n\tif (Symbol.iterator in data) {\n\t\treturn CompatibilityLevel.Normal;\n\t}\n\n\t// When not unioned with an ObjectNode, allow objects to be used to create maps.\n\treturn CompatibilityLevel.Low;\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.toFlexContent} for Map nodes.\n *\n * Transforms data under a Map schema.\n * @param data - The tree data to be transformed. Must be an iterable or Record like object.\n * @param schema - The schema to comply with.\n */\nfunction mapToFlexContent(data: FactoryContent, schema: MapNodeSchema): FlexContent {\n\tif (!(typeof data === \"object\" && data !== null)) {\n\t\tthrow new UsageError(`Input data is incompatible with Map schema: ${data}`);\n\t}\n\n\tconst fieldsIterator = (\n\t\tSymbol.iterator in data\n\t\t\t? // Support iterables of key value pairs (including Map objects)\n\t\t\t\tdata\n\t\t\t: // Support record objects for JSON style Map data\n\t\t\t\tObject.entries(data)\n\t) as Iterable<readonly [string, InsertableContent]>;\n\n\treturn recordLikeDataToFlexContent(fieldsIterator, schema);\n}\n"]}
@@ -212,7 +212,7 @@ export declare namespace System_TableSchema {
212
212
  *
213
213
  * Also note: these APIs leverage `SharedTree` functionality that was added in version `2.80.0`,
214
214
  * which is not compatible with previous versions of this library.
215
- * To ensure safe collaboration, you will need to configure the {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}
215
+ * To ensure safe collaboration, you will need to configure the {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}
216
216
  * for the Fluid Runtime and/or `SharedTree` to at least `2.80.0`.
217
217
  * To set this minimum version for `SharedTree`, use {@link configuredSharedTreeBeta}.
218
218
  *
@@ -869,7 +869,7 @@ function removeRangeFromArray(startIndex, endIndex, array, methodName) {
869
869
  *
870
870
  * Also note: these APIs leverage `SharedTree` functionality that was added in version `2.80.0`,
871
871
  * which is not compatible with previous versions of this library.
872
- * To ensure safe collaboration, you will need to configure the {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}
872
+ * To ensure safe collaboration, you will need to configure the {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}
873
873
  * for the Fluid Runtime and/or `SharedTree` to at least `2.80.0`.
874
874
  * To set this minimum version for `SharedTree`, use {@link configuredSharedTreeBeta}.
875
875
  *