@fluidframework/tree 2.22.1 → 2.23.0-325054

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 (515) hide show
  1. package/.vscode/extensions.json +1 -0
  2. package/.vscode/settings.json +1 -0
  3. package/CHANGELOG.md +47 -0
  4. package/api-report/tree.alpha.api.md +169 -10
  5. package/api-report/tree.beta.api.md +101 -9
  6. package/api-report/tree.legacy.alpha.api.md +101 -9
  7. package/api-report/tree.legacy.public.api.md +101 -9
  8. package/api-report/tree.public.api.md +101 -9
  9. package/dist/alpha.d.ts +20 -0
  10. package/dist/beta.d.ts +15 -0
  11. package/dist/codec/codec.js +3 -3
  12. package/dist/codec/codec.js.map +1 -1
  13. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  14. package/dist/codec/discriminatedUnions.js +1 -1
  15. package/dist/codec/discriminatedUnions.js.map +1 -1
  16. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  17. package/dist/core/schema-stored/schema.js +3 -3
  18. package/dist/core/schema-stored/schema.js.map +1 -1
  19. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  20. package/dist/core/tree/anchorSet.js +18 -13
  21. package/dist/core/tree/anchorSet.js.map +1 -1
  22. package/dist/core/tree/treeTextFormat.js +1 -1
  23. package/dist/core/tree/treeTextFormat.js.map +1 -1
  24. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  25. package/dist/feature-libraries/chunked-forest/basicChunk.js +11 -8
  26. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  27. package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -2
  28. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  29. package/dist/feature-libraries/chunked-forest/chunkedForest.js +3 -3
  30. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  31. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +2 -2
  32. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  34. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
  35. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  37. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js +3 -3
  40. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/emptyChunk.js +14 -14
  42. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  44. package/dist/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  45. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  46. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  47. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  48. package/dist/feature-libraries/default-schema/schemaChecker.js +1 -1
  49. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  50. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  51. package/dist/feature-libraries/flex-tree/lazyField.js +4 -3
  52. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  53. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  54. package/dist/feature-libraries/flex-tree/lazyNode.js +5 -4
  55. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  56. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  57. package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  58. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  59. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  60. package/dist/feature-libraries/modular-schema/comparison.js +6 -4
  61. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  62. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  63. package/dist/feature-libraries/modular-schema/isNeverTree.js +4 -4
  64. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  65. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
  66. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  67. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  68. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +10 -11
  69. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  70. package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  71. package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  72. package/dist/feature-libraries/object-forest/objectForest.js +1 -1
  73. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  74. package/dist/feature-libraries/schema-index/codec.js +1 -1
  75. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  76. package/dist/feature-libraries/sequence-field/compose.js +1 -1
  77. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  78. package/dist/feature-libraries/sequence-field/invert.js +1 -1
  79. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  80. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  81. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  82. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  83. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  84. package/dist/feature-libraries/sequence-field/utils.js +1 -1
  85. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  86. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  87. package/dist/feature-libraries/treeCursorUtils.js +6 -4
  88. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  89. package/dist/index.d.ts +4 -2
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +10 -1
  92. package/dist/index.js.map +1 -1
  93. package/dist/jsonDomainSchema.d.ts +113 -0
  94. package/dist/jsonDomainSchema.d.ts.map +1 -0
  95. package/dist/jsonDomainSchema.js +101 -0
  96. package/dist/jsonDomainSchema.js.map +1 -0
  97. package/dist/legacy.d.ts +15 -0
  98. package/dist/packageVersion.d.ts +1 -1
  99. package/dist/packageVersion.d.ts.map +1 -1
  100. package/dist/packageVersion.js +1 -1
  101. package/dist/packageVersion.js.map +1 -1
  102. package/dist/public.d.ts +15 -0
  103. package/dist/serializableDomainSchema.d.ts +108 -0
  104. package/dist/serializableDomainSchema.d.ts.map +1 -0
  105. package/dist/serializableDomainSchema.js +90 -0
  106. package/dist/serializableDomainSchema.js.map +1 -0
  107. package/dist/shared-tree/index.d.ts +1 -1
  108. package/dist/shared-tree/index.d.ts.map +1 -1
  109. package/dist/shared-tree/index.js.map +1 -1
  110. package/dist/shared-tree/schematizeTree.js +1 -1
  111. package/dist/shared-tree/schematizeTree.js.map +1 -1
  112. package/dist/shared-tree/sharedTree.d.ts +37 -20
  113. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  114. package/dist/shared-tree/sharedTree.js +17 -17
  115. package/dist/shared-tree/sharedTree.js.map +1 -1
  116. package/dist/shared-tree/sharedTreeChangeFamily.js +1 -1
  117. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  118. package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
  119. package/dist/shared-tree/treeApiAlpha.js +4 -4
  120. package/dist/shared-tree/treeApiAlpha.js.map +1 -1
  121. package/dist/shared-tree/treeCheckout.js +1 -1
  122. package/dist/shared-tree/treeCheckout.js.map +1 -1
  123. package/dist/shared-tree-core/editManager.d.ts +11 -2
  124. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  125. package/dist/shared-tree-core/editManager.js +70 -34
  126. package/dist/shared-tree-core/editManager.js.map +1 -1
  127. package/dist/shared-tree-core/resubmitMachine.d.ts +2 -0
  128. package/dist/shared-tree-core/resubmitMachine.d.ts.map +1 -1
  129. package/dist/shared-tree-core/resubmitMachine.js.map +1 -1
  130. package/dist/shared-tree-core/sharedTreeCore.d.ts +10 -3
  131. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  132. package/dist/shared-tree-core/sharedTreeCore.js +42 -7
  133. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  134. package/dist/simple-tree/api/component.d.ts +30 -0
  135. package/dist/simple-tree/api/component.d.ts.map +1 -0
  136. package/dist/simple-tree/api/component.js +26 -0
  137. package/dist/simple-tree/api/component.js.map +1 -0
  138. package/dist/simple-tree/api/customTree.js +3 -3
  139. package/dist/simple-tree/api/customTree.js.map +1 -1
  140. package/dist/simple-tree/api/index.d.ts +2 -1
  141. package/dist/simple-tree/api/index.d.ts.map +1 -1
  142. package/dist/simple-tree/api/index.js +3 -1
  143. package/dist/simple-tree/api/index.js.map +1 -1
  144. package/dist/simple-tree/api/schemaCreationUtilities.js +1 -1
  145. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  146. package/dist/simple-tree/api/schemaFactory.d.ts +0 -8
  147. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  148. package/dist/simple-tree/api/schemaFactory.js +4 -25
  149. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  150. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
  151. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  152. package/dist/simple-tree/api/simpleTreeIndex.js +3 -3
  153. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  154. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  155. package/dist/simple-tree/api/tree.js +2 -3
  156. package/dist/simple-tree/api/tree.js.map +1 -1
  157. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  158. package/dist/simple-tree/api/treeNodeApi.js +7 -18
  159. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  160. package/dist/simple-tree/api/typesUnsafe.d.ts +127 -19
  161. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  162. package/dist/simple-tree/api/typesUnsafe.js +17 -0
  163. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  164. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  165. package/dist/simple-tree/api/verboseTree.js +5 -4
  166. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  167. package/dist/simple-tree/api/view.js +1 -1
  168. package/dist/simple-tree/api/view.js.map +1 -1
  169. package/dist/simple-tree/arrayNode.d.ts +1 -1
  170. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  171. package/dist/simple-tree/arrayNode.js +2 -2
  172. package/dist/simple-tree/arrayNode.js.map +1 -1
  173. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  174. package/dist/simple-tree/core/getOrCreateNode.js +1 -1
  175. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  176. package/dist/simple-tree/core/schemaCaching.js +1 -1
  177. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  178. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  179. package/dist/simple-tree/core/treeNodeKernel.js +6 -6
  180. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  181. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  182. package/dist/simple-tree/core/unhydratedFlexTree.js +5 -5
  183. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  184. package/dist/simple-tree/flexList.d.ts +4 -5
  185. package/dist/simple-tree/flexList.d.ts.map +1 -1
  186. package/dist/simple-tree/flexList.js +1 -14
  187. package/dist/simple-tree/flexList.js.map +1 -1
  188. package/dist/simple-tree/index.d.ts +4 -4
  189. package/dist/simple-tree/index.d.ts.map +1 -1
  190. package/dist/simple-tree/index.js +6 -2
  191. package/dist/simple-tree/index.js.map +1 -1
  192. package/dist/simple-tree/objectNode.d.ts +25 -2
  193. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  194. package/dist/simple-tree/objectNode.js +4 -2
  195. package/dist/simple-tree/objectNode.js.map +1 -1
  196. package/dist/simple-tree/proxies.js +1 -1
  197. package/dist/simple-tree/proxies.js.map +1 -1
  198. package/dist/simple-tree/schemaTypes.d.ts +211 -9
  199. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  200. package/dist/simple-tree/schemaTypes.js +83 -2
  201. package/dist/simple-tree/schemaTypes.js.map +1 -1
  202. package/dist/simple-tree/toMapTree.js +3 -3
  203. package/dist/simple-tree/toMapTree.js.map +1 -1
  204. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  205. package/dist/simple-tree/toStoredSchema.js +3 -6
  206. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  207. package/dist/simple-tree/treeNodeValid.d.ts +7 -1
  208. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  209. package/dist/simple-tree/treeNodeValid.js +18 -7
  210. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  211. package/dist/util/idAllocator.js +1 -1
  212. package/dist/util/idAllocator.js.map +1 -1
  213. package/dist/util/index.d.ts +2 -2
  214. package/dist/util/index.d.ts.map +1 -1
  215. package/dist/util/index.js +5 -4
  216. package/dist/util/index.js.map +1 -1
  217. package/dist/util/nestedMap.d.ts +2 -10
  218. package/dist/util/nestedMap.d.ts.map +1 -1
  219. package/dist/util/nestedMap.js +9 -28
  220. package/dist/util/nestedMap.js.map +1 -1
  221. package/dist/util/utils.d.ts +23 -6
  222. package/dist/util/utils.d.ts.map +1 -1
  223. package/dist/util/utils.js +46 -13
  224. package/dist/util/utils.js.map +1 -1
  225. package/lib/alpha.d.ts +20 -0
  226. package/lib/beta.d.ts +15 -0
  227. package/lib/codec/codec.js +3 -3
  228. package/lib/codec/codec.js.map +1 -1
  229. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  230. package/lib/codec/discriminatedUnions.js +1 -1
  231. package/lib/codec/discriminatedUnions.js.map +1 -1
  232. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  233. package/lib/core/schema-stored/schema.js +3 -3
  234. package/lib/core/schema-stored/schema.js.map +1 -1
  235. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  236. package/lib/core/tree/anchorSet.js +19 -14
  237. package/lib/core/tree/anchorSet.js.map +1 -1
  238. package/lib/core/tree/treeTextFormat.js +1 -1
  239. package/lib/core/tree/treeTextFormat.js.map +1 -1
  240. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  241. package/lib/feature-libraries/chunked-forest/basicChunk.js +11 -8
  242. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  243. package/lib/feature-libraries/chunked-forest/chunkTree.js +2 -2
  244. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  245. package/lib/feature-libraries/chunked-forest/chunkedForest.js +3 -3
  246. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  247. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +2 -2
  248. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  249. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  250. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
  251. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  252. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  253. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  254. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +1 -1
  255. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js +3 -3
  256. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +1 -1
  257. package/lib/feature-libraries/chunked-forest/emptyChunk.js +14 -14
  258. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  259. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  260. package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  261. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  262. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  263. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  264. package/lib/feature-libraries/default-schema/schemaChecker.js +1 -1
  265. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  266. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  267. package/lib/feature-libraries/flex-tree/lazyField.js +4 -3
  268. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  269. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  270. package/lib/feature-libraries/flex-tree/lazyNode.js +5 -4
  271. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  272. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  273. package/lib/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  274. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  275. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  276. package/lib/feature-libraries/modular-schema/comparison.js +6 -4
  277. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  278. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  279. package/lib/feature-libraries/modular-schema/isNeverTree.js +4 -4
  280. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  281. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
  282. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  283. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  284. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +11 -12
  285. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  286. package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  287. package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  288. package/lib/feature-libraries/object-forest/objectForest.js +1 -1
  289. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  290. package/lib/feature-libraries/schema-index/codec.js +1 -1
  291. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  292. package/lib/feature-libraries/sequence-field/compose.js +1 -1
  293. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  294. package/lib/feature-libraries/sequence-field/invert.js +1 -1
  295. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  296. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  297. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  298. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  299. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  300. package/lib/feature-libraries/sequence-field/utils.js +1 -1
  301. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  302. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  303. package/lib/feature-libraries/treeCursorUtils.js +6 -4
  304. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  305. package/lib/index.d.ts +4 -2
  306. package/lib/index.d.ts.map +1 -1
  307. package/lib/index.js +3 -1
  308. package/lib/index.js.map +1 -1
  309. package/lib/jsonDomainSchema.d.ts +113 -0
  310. package/lib/jsonDomainSchema.d.ts.map +1 -0
  311. package/lib/jsonDomainSchema.js +98 -0
  312. package/lib/jsonDomainSchema.js.map +1 -0
  313. package/lib/legacy.d.ts +15 -0
  314. package/lib/packageVersion.d.ts +1 -1
  315. package/lib/packageVersion.d.ts.map +1 -1
  316. package/lib/packageVersion.js +1 -1
  317. package/lib/packageVersion.js.map +1 -1
  318. package/lib/public.d.ts +15 -0
  319. package/lib/serializableDomainSchema.d.ts +108 -0
  320. package/lib/serializableDomainSchema.d.ts.map +1 -0
  321. package/lib/serializableDomainSchema.js +87 -0
  322. package/lib/serializableDomainSchema.js.map +1 -0
  323. package/lib/shared-tree/index.d.ts +1 -1
  324. package/lib/shared-tree/index.d.ts.map +1 -1
  325. package/lib/shared-tree/index.js.map +1 -1
  326. package/lib/shared-tree/schematizeTree.js +1 -1
  327. package/lib/shared-tree/schematizeTree.js.map +1 -1
  328. package/lib/shared-tree/sharedTree.d.ts +37 -20
  329. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  330. package/lib/shared-tree/sharedTree.js +18 -18
  331. package/lib/shared-tree/sharedTree.js.map +1 -1
  332. package/lib/shared-tree/sharedTreeChangeFamily.js +1 -1
  333. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  334. package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
  335. package/lib/shared-tree/treeApiAlpha.js +4 -4
  336. package/lib/shared-tree/treeApiAlpha.js.map +1 -1
  337. package/lib/shared-tree/treeCheckout.js +1 -1
  338. package/lib/shared-tree/treeCheckout.js.map +1 -1
  339. package/lib/shared-tree-core/editManager.d.ts +11 -2
  340. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  341. package/lib/shared-tree-core/editManager.js +70 -34
  342. package/lib/shared-tree-core/editManager.js.map +1 -1
  343. package/lib/shared-tree-core/resubmitMachine.d.ts +2 -0
  344. package/lib/shared-tree-core/resubmitMachine.d.ts.map +1 -1
  345. package/lib/shared-tree-core/resubmitMachine.js.map +1 -1
  346. package/lib/shared-tree-core/sharedTreeCore.d.ts +10 -3
  347. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  348. package/lib/shared-tree-core/sharedTreeCore.js +42 -7
  349. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  350. package/lib/simple-tree/api/component.d.ts +30 -0
  351. package/lib/simple-tree/api/component.d.ts.map +1 -0
  352. package/lib/simple-tree/api/component.js +23 -0
  353. package/lib/simple-tree/api/component.js.map +1 -0
  354. package/lib/simple-tree/api/customTree.js +3 -3
  355. package/lib/simple-tree/api/customTree.js.map +1 -1
  356. package/lib/simple-tree/api/index.d.ts +2 -1
  357. package/lib/simple-tree/api/index.d.ts.map +1 -1
  358. package/lib/simple-tree/api/index.js +1 -0
  359. package/lib/simple-tree/api/index.js.map +1 -1
  360. package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
  361. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  362. package/lib/simple-tree/api/schemaFactory.d.ts +0 -8
  363. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  364. package/lib/simple-tree/api/schemaFactory.js +2 -22
  365. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  366. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
  367. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  368. package/lib/simple-tree/api/simpleTreeIndex.js +3 -3
  369. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  370. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  371. package/lib/simple-tree/api/tree.js +3 -4
  372. package/lib/simple-tree/api/tree.js.map +1 -1
  373. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  374. package/lib/simple-tree/api/treeNodeApi.js +9 -20
  375. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  376. package/lib/simple-tree/api/typesUnsafe.d.ts +127 -19
  377. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  378. package/lib/simple-tree/api/typesUnsafe.js +15 -1
  379. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  380. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  381. package/lib/simple-tree/api/verboseTree.js +5 -4
  382. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  383. package/lib/simple-tree/api/view.js +1 -1
  384. package/lib/simple-tree/api/view.js.map +1 -1
  385. package/lib/simple-tree/arrayNode.d.ts +1 -1
  386. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  387. package/lib/simple-tree/arrayNode.js +2 -2
  388. package/lib/simple-tree/arrayNode.js.map +1 -1
  389. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  390. package/lib/simple-tree/core/getOrCreateNode.js +1 -1
  391. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  392. package/lib/simple-tree/core/schemaCaching.js +1 -1
  393. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  394. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  395. package/lib/simple-tree/core/treeNodeKernel.js +6 -6
  396. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  397. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  398. package/lib/simple-tree/core/unhydratedFlexTree.js +5 -5
  399. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  400. package/lib/simple-tree/flexList.d.ts +4 -5
  401. package/lib/simple-tree/flexList.d.ts.map +1 -1
  402. package/lib/simple-tree/flexList.js +0 -12
  403. package/lib/simple-tree/flexList.js.map +1 -1
  404. package/lib/simple-tree/index.d.ts +4 -4
  405. package/lib/simple-tree/index.d.ts.map +1 -1
  406. package/lib/simple-tree/index.js +2 -2
  407. package/lib/simple-tree/index.js.map +1 -1
  408. package/lib/simple-tree/objectNode.d.ts +25 -2
  409. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  410. package/lib/simple-tree/objectNode.js +4 -2
  411. package/lib/simple-tree/objectNode.js.map +1 -1
  412. package/lib/simple-tree/proxies.js +1 -1
  413. package/lib/simple-tree/proxies.js.map +1 -1
  414. package/lib/simple-tree/schemaTypes.d.ts +211 -9
  415. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  416. package/lib/simple-tree/schemaTypes.js +81 -3
  417. package/lib/simple-tree/schemaTypes.js.map +1 -1
  418. package/lib/simple-tree/toMapTree.js +3 -3
  419. package/lib/simple-tree/toMapTree.js.map +1 -1
  420. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  421. package/lib/simple-tree/toStoredSchema.js +5 -8
  422. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  423. package/lib/simple-tree/treeNodeValid.d.ts +7 -1
  424. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  425. package/lib/simple-tree/treeNodeValid.js +18 -7
  426. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  427. package/lib/util/idAllocator.js +1 -1
  428. package/lib/util/idAllocator.js.map +1 -1
  429. package/lib/util/index.d.ts +2 -2
  430. package/lib/util/index.d.ts.map +1 -1
  431. package/lib/util/index.js +2 -2
  432. package/lib/util/index.js.map +1 -1
  433. package/lib/util/nestedMap.d.ts +2 -10
  434. package/lib/util/nestedMap.d.ts.map +1 -1
  435. package/lib/util/nestedMap.js +5 -23
  436. package/lib/util/nestedMap.js.map +1 -1
  437. package/lib/util/utils.d.ts +23 -6
  438. package/lib/util/utils.d.ts.map +1 -1
  439. package/lib/util/utils.js +42 -11
  440. package/lib/util/utils.js.map +1 -1
  441. package/package.json +27 -23
  442. package/src/codec/codec.ts +3 -3
  443. package/src/codec/discriminatedUnions.ts +2 -1
  444. package/src/core/schema-stored/schema.ts +5 -3
  445. package/src/core/tree/anchorSet.ts +37 -26
  446. package/src/core/tree/treeTextFormat.ts +1 -1
  447. package/src/feature-libraries/chunked-forest/basicChunk.ts +11 -8
  448. package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -2
  449. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -3
  450. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -2
  451. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +4 -3
  452. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +2 -2
  453. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncoding.ts +4 -3
  454. package/src/feature-libraries/chunked-forest/emptyChunk.ts +14 -14
  455. package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
  456. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  457. package/src/feature-libraries/default-schema/schemaChecker.ts +1 -1
  458. package/src/feature-libraries/flex-tree/lazyField.ts +6 -8
  459. package/src/feature-libraries/flex-tree/lazyNode.ts +6 -4
  460. package/src/feature-libraries/indexing/anchorTreeIndex.ts +2 -1
  461. package/src/feature-libraries/modular-schema/comparison.ts +7 -5
  462. package/src/feature-libraries/modular-schema/isNeverTree.ts +6 -4
  463. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -4
  464. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +16 -12
  465. package/src/feature-libraries/node-key/mockNodeKeyManager.ts +1 -1
  466. package/src/feature-libraries/object-forest/objectForest.ts +1 -1
  467. package/src/feature-libraries/schema-index/codec.ts +1 -1
  468. package/src/feature-libraries/sequence-field/compose.ts +1 -1
  469. package/src/feature-libraries/sequence-field/invert.ts +1 -1
  470. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +1 -1
  471. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +1 -1
  472. package/src/feature-libraries/sequence-field/utils.ts +1 -1
  473. package/src/feature-libraries/treeCursorUtils.ts +6 -4
  474. package/src/index.ts +22 -1
  475. package/src/jsonDomainSchema.ts +129 -0
  476. package/src/packageVersion.ts +1 -1
  477. package/src/serializableDomainSchema.ts +121 -0
  478. package/src/shared-tree/index.ts +0 -1
  479. package/src/shared-tree/schematizeTree.ts +1 -1
  480. package/src/shared-tree/sharedTree.ts +31 -41
  481. package/src/shared-tree/sharedTreeChangeFamily.ts +1 -1
  482. package/src/shared-tree/treeApiAlpha.ts +12 -4
  483. package/src/shared-tree/treeCheckout.ts +1 -1
  484. package/src/shared-tree-core/editManager.ts +85 -47
  485. package/src/shared-tree-core/resubmitMachine.ts +2 -0
  486. package/src/shared-tree-core/sharedTreeCore.ts +62 -14
  487. package/src/simple-tree/api/component.ts +42 -0
  488. package/src/simple-tree/api/customTree.ts +3 -3
  489. package/src/simple-tree/api/index.ts +7 -0
  490. package/src/simple-tree/api/schemaCreationUtilities.ts +1 -1
  491. package/src/simple-tree/api/schemaFactory.ts +1 -28
  492. package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -1
  493. package/src/simple-tree/api/simpleTreeIndex.ts +3 -3
  494. package/src/simple-tree/api/tree.ts +3 -3
  495. package/src/simple-tree/api/treeNodeApi.ts +10 -18
  496. package/src/simple-tree/api/typesUnsafe.ts +193 -18
  497. package/src/simple-tree/api/verboseTree.ts +8 -4
  498. package/src/simple-tree/api/view.ts +1 -1
  499. package/src/simple-tree/arrayNode.ts +2 -2
  500. package/src/simple-tree/core/getOrCreateNode.ts +2 -1
  501. package/src/simple-tree/core/schemaCaching.ts +1 -1
  502. package/src/simple-tree/core/treeNodeKernel.ts +9 -6
  503. package/src/simple-tree/core/unhydratedFlexTree.ts +7 -5
  504. package/src/simple-tree/flexList.ts +4 -14
  505. package/src/simple-tree/index.ts +25 -1
  506. package/src/simple-tree/objectNode.ts +50 -5
  507. package/src/simple-tree/proxies.ts +1 -1
  508. package/src/simple-tree/schemaTypes.ts +322 -23
  509. package/src/simple-tree/toMapTree.ts +3 -3
  510. package/src/simple-tree/toStoredSchema.ts +5 -7
  511. package/src/simple-tree/treeNodeValid.ts +21 -7
  512. package/src/util/idAllocator.ts +1 -1
  513. package/src/util/index.ts +3 -2
  514. package/src/util/nestedMap.ts +9 -33
  515. package/src/util/utils.ts +52 -12
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/util/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,eAAe,MAAM,yBAAyB,CAAC;AA8BtD;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAI,QAAW;IACvC,OAAO,QAAsB,CAAC;AAC/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AU,cAAc,CAAmB,CAAI,EAAE,CAAI;IAC1D,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CAItC,GAAM,EAAE,GAAM,EAAE,GAAY;IAC7B,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE;QAChC,GAAG;YACF,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC;YACpB,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YAC5C,OAAO,KAAK,CAAC;QACd,CAAC;QACD,YAAY,EAAE,IAAI;KAClB,CAAC,CAAC;IACH,OAAO,GAAmC,CAAC;AAC5C,CAAC;AA+BD,MAAM,UAAU,qBAAqB,CAKpC,MAAqB,EACrB,QAAW,EACX,WAAc;IAEd,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAI,MAAiC,CAAC,QAAQ,CAAC,CAAC;QAC3D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,WAAqC,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;QAC1D,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { Type } from \"@sinclair/typebox\";\nimport structuredClone from \"@ungap/structured-clone\";\n\n/**\n * Subset of Map interface.\n */\nexport interface MapGetSet<K, V> {\n\tget(key: K): V | undefined;\n\tset(key: K, value: V): void;\n}\n\n/**\n * Make all transitive properties in `T` readonly\n */\nexport type RecursiveReadonly<T> = {\n\treadonly [P in keyof T]: RecursiveReadonly<T[P]>;\n};\n\n/**\n * Remove `readonly` from all fields.\n */\nexport type Mutable<T> = { -readonly [P in keyof T]: T[P] };\n\n/**\n * Make all field required and omits fields whose ony valid value would be `undefined`.\n * This is analogous to `Required<T>` except it tolerates 'optional undefined'.\n */\nexport type Populated<T> = {\n\t[P in keyof T as Exclude<P, T[P] extends undefined ? P : never>]-?: T[P];\n};\n\n/**\n * Casts a readonly object to a mutable one.\n * Better than casting to `Mutable<Foo>` because it doesn't risk casting a non-`Foo` to a `Mutable<Foo>`.\n * @param readonly - The object with readonly fields.\n * @returns The same object but with a type that makes all fields mutable.\n */\nexport function asMutable<T>(readonly: T): Mutable<T> {\n\treturn readonly as Mutable<T>;\n}\n\nexport const clone = structuredClone;\n\n/**\n * Throw an error with a constant message.\n * @remarks\n * Works like {@link @fluidframework/core-utils/internal#assert}.\n */\nexport function fail(message: string | number): never {\n\t// Declaring this here aliased to a different name avoids the assert tagging objecting to the usages of `assert` below.\n\t// Since users of `fail` do the assert message tagging instead, suppressing tagging errors here makes sense.\n\tconst assertNoTag: (condition: boolean, message: string | number) => asserts condition =\n\t\tassert;\n\tassertNoTag(false, message);\n}\n\n/**\n * Checks whether or not the given object is a `readonly` array.\n *\n * Note that this does NOT indicate if a given array should be treated as readonly.\n * This instead indicates if an object is an Array, and is typed to tolerate the readonly case.\n */\nexport function isReadonlyArray<T>(x: readonly T[] | unknown): x is readonly T[] {\n\t// `Array.isArray()` does not properly narrow `readonly` array types by itself,\n\t// so we wrap it in this type guard. This may become unnecessary if/when\n\t// https://github.com/microsoft/TypeScript/issues/17002 is resolved.\n\treturn Array.isArray(x);\n}\n\n/**\n * Creates and populates a new array.\n * @param size - The size of the array to be created.\n * @param filler - Callback for populating the array with a value for a given index\n */\nexport function makeArray<T>(size: number, filler: (index: number) => T): T[] {\n\tconst array = [];\n\tfor (let i = 0; i < size; ++i) {\n\t\tarray.push(filler(i));\n\t}\n\treturn array;\n}\n\n/**\n * Returns the last element of an array, or `undefined` if the array has no elements.\n * @param array - The array to get the last element from.\n * @remarks\n * If the type of the array has been narrowed by e.g. {@link hasSome | hasSome(array)} or {@link hasSingle | hasOne(array)} then the return type will be `T` rather than `T | undefined`.\n */\nexport function getLast<T>(array: readonly [T, ...T[]]): T;\nexport function getLast<T>(array: { [index: number]: T; length: number }): T | undefined;\nexport function getLast<T>(array: { [index: number]: T; length: number }): T | undefined {\n\treturn array[array.length - 1];\n}\n\n/**\n * Returns true if and only if the given array has at least one element.\n * @param array - The array to check.\n * @remarks\n * If `array` contains at least one element, its type will be narrowed and can benefit from improved typing from e.g. `array[0]` and {@link getLast | getLast(array)}.\n * This is especially useful when \"noUncheckedIndexedAccess\" is enabled in the TypeScript compiler options, since the return type of `array[0]` will be `T` rather than `T | undefined`.\n */\nexport function hasSome<T>(array: T[]): array is [T, ...T[]];\nexport function hasSome<T>(array: readonly T[]): array is readonly [T, ...T[]];\nexport function hasSome<T>(array: readonly T[]): array is [T, ...T[]] {\n\treturn array.length > 0;\n}\n\n/**\n * Returns true if and only if the given array has exactly one element.\n * @param array - The array to check.\n * @remarks\n * If `array` contains exactly one element, its type will be narrowed and can benefit from improved typing from e.g. `array[0]` and {@link getLast | getLast(array)}.\n * This is especially useful when \"noUncheckedIndexedAccess\" is enabled in the TypeScript compiler options, since the return type of `array[0]` will be `T` rather than `T | undefined`.\n */\nexport function hasSingle<T>(array: T[]): array is [T];\nexport function hasSingle<T>(array: readonly T[]): array is readonly [T];\nexport function hasSingle<T>(array: readonly T[]): array is [T] {\n\treturn array.length === 1;\n}\n\n/**\n * Compares two sets using callbacks.\n * Early returns on first false comparison.\n *\n * @param a - One Set.\n * @param b - The other Set.\n * @param aExtra - Called for items in `a` but not `b`.\n * @param bExtra - Called for items in `b` but not `a`.\n * @param same - Called for items in `a` and `b`.\n * @returns false iff any of the call backs returned false.\n */\nexport function compareSets<T>({\n\ta,\n\tb,\n\taExtra,\n\tbExtra,\n\tsame,\n}: {\n\ta: ReadonlySet<T> | ReadonlyMap<T, unknown>;\n\tb: ReadonlySet<T> | ReadonlyMap<T, unknown>;\n\taExtra?: (t: T) => boolean;\n\tbExtra?: (t: T) => boolean;\n\tsame?: (t: T) => boolean;\n}): boolean {\n\tfor (const item of a.keys()) {\n\t\tif (!b.has(item)) {\n\t\t\tif (aExtra !== undefined) {\n\t\t\t\tif (!aExtra(item)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\tif (same !== undefined && !same(item)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\tfor (const item of b.keys()) {\n\t\tif (!a.has(item)) {\n\t\t\tif (bExtra !== undefined) {\n\t\t\t\tif (!bExtra(item)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n\n/**\n * Retrieve a value from a map with the given key, or create a new entry if the key is not in the map.\n * @param map - The map to query/update\n * @param key - The key to lookup in the map\n * @param defaultValue - a function which returns a default value. This is called and used to set an initial value for the given key in the map if none exists\n * @returns either the existing value for the given key, or the newly-created value (the result of `defaultValue`)\n */\nexport function getOrCreate<K, V>(\n\tmap: MapGetSet<K, V>,\n\tkey: K,\n\tdefaultValue: (key: K) => V,\n): V {\n\tlet value = map.get(key);\n\tif (value === undefined) {\n\t\tvalue = defaultValue(key);\n\t\tmap.set(key, value);\n\t}\n\treturn value;\n}\n\n/**\n * Utility for dictionaries whose values are lists.\n * Gets the list associated with the provided key, if it exists.\n * Otherwise, creates an entry with an empty list, and returns that list.\n */\nexport function getOrAddEmptyToMap<K, V>(map: MapGetSet<K, V[]>, key: K): V[] {\n\tlet collection = map.get(key);\n\tif (collection === undefined) {\n\t\tcollection = [];\n\t\tmap.set(key, collection);\n\t}\n\treturn collection;\n}\n\n/**\n * Map one iterable to another by transforming each element one at a time\n * @param iterable - the iterable to transform\n * @param map - the transformation function to run on each element of the iterable\n * @returns a new iterable of elements which have been transformed by the `map` function\n */\nexport function* mapIterable<T, U>(\n\titerable: Iterable<T>,\n\tmap: (t: T) => U,\n): IterableIterator<U> {\n\tfor (const t of iterable) {\n\t\tyield map(t);\n\t}\n}\n\n/**\n * Filter one iterable into another\n * @param iterable - the iterable to filter\n * @param filter - the predicate function to run on each element of the iterable\n * @returns a new iterable including only the elements that passed the filter predicate\n */\nexport function* filterIterable<T>(\n\titerable: Iterable<T>,\n\tfilter: (t: T) => boolean,\n): IterableIterator<T> {\n\tfor (const t of iterable) {\n\t\tif (filter(t)) {\n\t\t\tyield t;\n\t\t}\n\t}\n}\n\n/**\n * Finds the first element in the given iterable that satisfies a predicate.\n * @param iterable - The iterable to search for an eligible element\n * @param predicate - The predicate to run against each element\n * @returns The first element in the iterable that satisfies the predicate, or undefined if the iterable contains no such element\n */\nexport function find<T>(iterable: Iterable<T>, predicate: (t: T) => boolean): T | undefined {\n\tfor (const t of iterable) {\n\t\tif (predicate(t)) {\n\t\t\treturn t;\n\t\t}\n\t}\n}\n\n/**\n * Counts the number of elements in the given iterable.\n * @param iterable - the iterable to enumerate\n * @returns the number of elements that were iterated after exhausting the iterable\n */\nexport function count(iterable: Iterable<unknown>): number {\n\tlet n = 0;\n\tfor (const _ of iterable) {\n\t\tn += 1;\n\t}\n\treturn n;\n}\n\n/**\n * Use for Json compatible data.\n *\n * @typeparam TExtra - Type permitted in addition to the normal JSON types.\n * Commonly used for to allow {@link @fluidframework/core-interfaces#IFluidHandle} within the otherwise JSON compatible content.\n *\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n * @alpha\n */\nexport type JsonCompatible<TExtra = never> =\n\t| string\n\t| number\n\t| boolean\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| JsonCompatible<TExtra>[]\n\t| JsonCompatibleObject<TExtra>\n\t| TExtra;\n\n/**\n * Use for Json object compatible data.\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n * @alpha\n */\nexport type JsonCompatibleObject<TExtra = never> = { [P in string]?: JsonCompatible<TExtra> };\n\n/**\n * Use for readonly view of Json compatible data.\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n */\nexport type JsonCompatibleReadOnly =\n\t| string\n\t| number\n\t| boolean\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| readonly JsonCompatibleReadOnly[]\n\t| JsonCompatibleReadOnlyObject;\n\n/**\n * Use for readonly view of Json compatible data.\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n */\nexport type JsonCompatibleReadOnlyObject = { readonly [P in string]?: JsonCompatibleReadOnly };\n\n/**\n * @remarks TODO: Audit usage of this type in schemas, evaluating whether it is necessary and performance\n * of alternatives.\n *\n * True \"arbitrary serializable data\" is probably fine, but some persisted types declarations might be better\n * expressed using composition of schemas for runtime validation, even if we don't think making the types\n * generic is worth the maintenance cost.\n */\nexport const JsonCompatibleReadOnlySchema = Type.Any();\n\n/**\n * Returns if a particular json compatible value is an object.\n * Does not include `null` or arrays.\n */\nexport function isJsonObject(\n\tvalue: JsonCompatibleReadOnly,\n): value is { readonly [P in string]?: JsonCompatibleReadOnly } {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * Verifies that the supplied indices are valid within the supplied array.\n * @param startIndex - The starting index in the range. Must be in [0, length).\n * @param endIndex - The ending index in the range. Must be within (start, length].\n * @param array - The array the indices refer to\n */\nexport function assertValidRangeIndices(\n\tstartIndex: number,\n\tendIndex: number,\n\tarray: { readonly length: number },\n): void {\n\tassert(endIndex >= startIndex, 0x79c /* Range indices are malformed. */);\n\tassertValidIndex(startIndex, array, false);\n\tassertValidIndex(endIndex, array, true);\n}\n\nexport function assertValidIndex(\n\tindex: number,\n\tarray: { readonly length: number },\n\tallowOnePastEnd: boolean = false,\n): void {\n\tassertNonNegativeSafeInteger(index);\n\tif (allowOnePastEnd) {\n\t\tassert(index <= array.length, 0x378 /* index must be less than or equal to length */);\n\t} else {\n\t\tassert(index < array.length, 0x379 /* index must be less than length */);\n\t}\n}\n\nexport function assertValidRange(\n\t{ start, end }: { start: number; end: number },\n\tarray: { readonly length: number },\n): void {\n\tassertNonNegativeSafeInteger(start);\n\tassertNonNegativeSafeInteger(end);\n\tassert(end <= array.length, 0x79d /* Range end must be less than or equal to length */);\n\tassert(start <= end, 0x79e /* Range start must be less than or equal to range start */);\n}\n\nexport function assertNonNegativeSafeInteger(index: number): void {\n\tassert(Number.isSafeInteger(index), 0x376 /* index must be an integer */);\n\tassert(index >= 0, 0x377 /* index must be non-negative */);\n}\n\n/**\n * Convert an object into a Map.\n *\n * This function must only be used with objects specifically intended to encode map like information.\n * The only time such objects should be used is for encoding maps as object literals to allow for developer ergonomics or JSON compatibility.\n * Even those two use-cases need to be carefully considered as using objects as maps can have a lot of issues\n * (including but not limited to unintended access to __proto__ and other non-owned keys).\n * This function helps these few cases get into using an actual map in as safe of was as is practical.\n */\nexport function objectToMap<MapKey extends string | number | symbol, MapValue>(\n\tobjectMap: Record<MapKey, MapValue>,\n): Map<MapKey, MapValue> {\n\tconst map = new Map<MapKey, MapValue>();\n\t// This function must only be used with objects specifically intended to encode map like information.\n\tfor (const key of Object.keys(objectMap)) {\n\t\tconst element = objectMap[key as MapKey];\n\t\tmap.set(key as MapKey, element);\n\t}\n\treturn map;\n}\n\n/**\n * Convert an object used as a map into a new object used like a map.\n *\n * @remarks\n * This function must only be used with objects specifically intended to encode map like information.\n * The only time such objects should be used is for encoding maps as object literals to allow for developer ergonomics or JSON compatibility.\n * Even those two use-cases need to be carefully considered as using objects as maps can have a lot of issues\n * (including but not limited to unintended access to __proto__ and other non-owned keys).\n * {@link objectToMap} helps these few cases get into using an actual map in as safe of a way as is practical.\n */\nexport function transformObjectMap<\n\tMapKey extends string | number | symbol,\n\tMapValue,\n\tNewMapValue,\n>(\n\tobjectMap: Record<MapKey, MapValue>,\n\ttransformer: (value: MapValue, key: MapKey) => NewMapValue,\n): Record<MapKey, MapValue> {\n\tconst output: Record<MapKey, MapValue> = Object.create(null);\n\t// This function must only be used with objects specifically intended to encode map like information.\n\tfor (const key of Object.keys(objectMap)) {\n\t\tconst element = objectMap[key as MapKey];\n\t\tObject.defineProperty(output, key, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: transformer(element, key as MapKey),\n\t\t});\n\t}\n\treturn output;\n}\n\n/**\n * Make an inverted copy of a map.\n *\n * @returns a map which can look up the keys from the values of the original map.\n */\nexport function invertMap<Key, Value>(input: Map<Key, Value>): Map<Value, Key> {\n\tconst result = new Map<Value, Key>(mapIterable(input, ([key, value]) => [value, key]));\n\tassert(\n\t\tresult.size === input.size,\n\t\t0x88a /* all values in a map must be unique to invert it */,\n\t);\n\treturn result;\n}\n\n/**\n * Returns the value from `set` if it contains exactly one item, otherwise `undefined`.\n */\nexport function oneFromSet<T>(set: ReadonlySet<T> | undefined): T | undefined {\n\tif (set === undefined) {\n\t\treturn undefined;\n\t}\n\tif (set.size !== 1) {\n\t\treturn undefined;\n\t}\n\tfor (const item of set) {\n\t\treturn item;\n\t}\n}\n\n/**\n * Type with a name describing what it is.\n * Typically used with values (like schema) that can be stored in a map, but in some representations have their name/key as a field.\n */\nexport interface Named<TName> {\n\treadonly name: TName;\n}\n\n/**\n * Order {@link Named} objects by their name.\n */\nexport function compareNamed(a: Named<string>, b: Named<string>): -1 | 0 | 1 {\n\tif (a.name < b.name) {\n\t\treturn -1;\n\t}\n\tif (a.name > b.name) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\n/**\n * Placeholder for `Symbol.dispose`.\n * @privateRemarks\n * TODO: replace this with `Symbol.dispose` when it is available or make it a valid polyfill.\n */\nexport const disposeSymbol: unique symbol = Symbol(\"Symbol.dispose placeholder\");\n\n/**\n * An object with an explicit lifetime that can be ended.\n * @privateRemarks\n * Simpler alternative to core-utils/IDisposable for internal use in this package.\n * This avoids adding a named \"dispose\" method, and will eventually be replaced with\n * {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management| TypeScript's Disposable}.\n *\n * Once this is replaced with TypeScript's Disposable, core-utils/IDisposable can extend it, bringing the APIs into a reasonable alignment.\n */\nexport interface IDisposable {\n\t/**\n\t * Call to end the lifetime of this object.\n\t *\n\t * It is invalid to use this object after this,\n\t * except for operations which explicitly document they are valid after disposal.\n\t *\n\t * @remarks\n\t * May cleanup resources retained by this object.\n\t * Often includes un-registering from events and thus preventing other objects from retaining a reference to this indefinably.\n\t *\n\t * Usually the only operations allowed after disposal are querying if an object is already disposed,\n\t * but this can vary between implementations.\n\t */\n\t[disposeSymbol](): void;\n}\n\n/**\n * Capitalize a string.\n */\nexport function capitalize<S extends string>(s: S): Capitalize<S> {\n\t// To avoid splitting characters which are made of multiple UTF-16 code units,\n\t// use iteration instead of indexing to separate the first character.\n\tconst iterated = s[Symbol.iterator]().next();\n\tif (iterated.done === true) {\n\t\t// Empty string case.\n\t\treturn \"\" as Capitalize<S>;\n\t}\n\n\treturn (iterated.value.toUpperCase() + s.slice(iterated.value.length)) as Capitalize<S>;\n}\n\n/**\n * Compares strings lexically to form a strict partial ordering.\n */\nexport function compareStrings<T extends string>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\n/**\n * Defines a property on an object that is lazily initialized and cached.\n * @remarks This is useful for properties that are expensive to compute and it is not guaranteed that they will be accessed.\n * This function initially defines a getter on the object, but after first read it replaces the getter with a value property.\n * @param obj - The object on which to define the property.\n * @param key - The key of the property to define.\n * @param get - The function (called either once or not at all) to compute the value of the property.\n * @returns `obj`, typed such that it has the new property.\n * This allows for the new property to be read off of `obj` in a type-safe manner after calling this function.\n */\nexport function defineLazyCachedProperty<\n\tT extends object,\n\tK extends string | number | symbol,\n\tV,\n>(obj: T, key: K, get: () => V): typeof obj & { [P in K]: V } {\n\tReflect.defineProperty(obj, key, {\n\t\tget() {\n\t\t\tconst value = get();\n\t\t\tReflect.defineProperty(obj, key, { value });\n\t\t\treturn value;\n\t\t},\n\t\tconfigurable: true,\n\t});\n\treturn obj as typeof obj & { [P in K]: V };\n}\n\n/**\n * Copies a given property from one object to another if and only if the property is defined.\n * @param source - The object to copy the property from.\n * If `source` is undefined or does not have the property defined, then this function will do nothing.\n * @param property - The property to copy.\n * @param destination - The object to copy the property to.\n * @remarks This function is useful for copying properties from one object to another while minimizing the presence of `undefined` values.\n * If `property` is not present on `source` - or if `property` is present, but has a value of `undefined` - then this function will not modify `destination`.\n * This is different from doing `destination.foo = source.foo`, which would define a `\"foo\"` property on `destination` with the value `undefined`.\n *\n * If the type of `source` is known to have `property`, then this function asserts that the type of `destination` has `property` as well after the call.\n *\n * This function first reads the property value (if present) from `source` and then sets it on `destination`, as opposed to e.g. directly copying the property descriptor.\n * @privateRemarks The first overload of this function allows auto-complete to suggest property names from `source`, but by having the second overload we still allow for arbitrary property names.\n */\nexport function copyPropertyIfDefined<S extends object, K extends keyof S, D extends object>(\n\tsource: S | undefined,\n\tproperty: K,\n\tdestination: D,\n): asserts destination is K extends keyof S ? D & { [P in K]: S[K] } : D;\nexport function copyPropertyIfDefined<\n\tS extends object,\n\tK extends string | number | symbol,\n\tD extends object,\n>(\n\tsource: S | undefined,\n\tproperty: K,\n\tdestination: D,\n): asserts destination is K extends keyof S ? D & { [P in K]: S[K] } : D;\nexport function copyPropertyIfDefined<\n\tS extends object,\n\tK extends string | number | symbol,\n\tD extends object,\n>(\n\tsource: S | undefined,\n\tproperty: K,\n\tdestination: D,\n): asserts destination is K extends keyof S ? D & { [P in K]: S[K] } : D {\n\tif (source !== undefined) {\n\t\tconst value = (source as { [P in K]?: unknown })[property];\n\t\tif (value !== undefined) {\n\t\t\t(destination as { [P in K]: unknown })[property] = value;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/util/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG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AAqC,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;QAC1D,CAAC;IACF,CAAC;AACF,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAC7B,KAAmB,EACnB,UAAoC,EACpC,SAAkB;IAElB,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,SAAS,EAAE,CAAC;IACpB,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACxE,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACtE,OAAO,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAChC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { Type } from \"@sinclair/typebox\";\nimport structuredClone from \"@ungap/structured-clone\";\n\n/**\n * Subset of Map interface.\n */\nexport interface MapGetSet<K, V> {\n\tget(key: K): V | undefined;\n\tset(key: K, value: V): void;\n}\n\n/**\n * Make all transitive properties in `T` readonly\n */\nexport type RecursiveReadonly<T> = {\n\treadonly [P in keyof T]: RecursiveReadonly<T[P]>;\n};\n\n/**\n * Remove `readonly` from all fields.\n */\nexport type Mutable<T> = { -readonly [P in keyof T]: T[P] };\n\n/**\n * Make all field required and omits fields whose ony valid value would be `undefined`.\n * This is analogous to `Required<T>` except it tolerates 'optional undefined'.\n */\nexport type Populated<T> = {\n\t[P in keyof T as Exclude<P, T[P] extends undefined ? P : never>]-?: T[P];\n};\n\n/**\n * Casts a readonly object to a mutable one.\n * Better than casting to `Mutable<Foo>` because it doesn't risk casting a non-`Foo` to a `Mutable<Foo>`.\n * @param readonly - The object with readonly fields.\n * @returns The same object but with a type that makes all fields mutable.\n */\nexport function asMutable<T>(readonly: T): Mutable<T> {\n\treturn readonly as Mutable<T>;\n}\n\nexport const clone = structuredClone;\n\n// TODO: update usages of this to use @fluidframework/core-utils/internal directly.\nexport { fail } from \"@fluidframework/core-utils/internal\";\n\n/**\n * Checks whether or not the given object is a `readonly` array.\n *\n * Note that this does NOT indicate if a given array should be treated as readonly.\n * This instead indicates if an object is an Array, and is typed to tolerate the readonly case.\n */\nexport function isReadonlyArray<T>(x: readonly T[] | unknown): x is readonly T[] {\n\t// `Array.isArray()` does not properly narrow `readonly` array types by itself,\n\t// so we wrap it in this type guard. This may become unnecessary if/when\n\t// https://github.com/microsoft/TypeScript/issues/17002 is resolved.\n\treturn Array.isArray(x);\n}\n\n/**\n * Creates and populates a new array.\n * @param size - The size of the array to be created.\n * @param filler - Callback for populating the array with a value for a given index\n */\nexport function makeArray<T>(size: number, filler: (index: number) => T): T[] {\n\tconst array = [];\n\tfor (let i = 0; i < size; ++i) {\n\t\tarray.push(filler(i));\n\t}\n\treturn array;\n}\n\n/**\n * Returns the last element of an array, or `undefined` if the array has no elements.\n * @param array - The array to get the last element from.\n * @remarks\n * If the type of the array has been narrowed by e.g. {@link hasSome | hasSome(array)} or {@link hasSingle | hasOne(array)} then the return type will be `T` rather than `T | undefined`.\n */\nexport function getLast<T>(array: readonly [T, ...T[]]): T;\nexport function getLast<T>(array: { [index: number]: T; length: number }): T | undefined;\nexport function getLast<T>(array: { [index: number]: T; length: number }): T | undefined {\n\treturn array[array.length - 1];\n}\n\n/**\n * Returns true if and only if the given array has at least one element.\n * @param array - The array to check.\n * @remarks\n * If `array` contains at least one element, its type will be narrowed and can benefit from improved typing from e.g. `array[0]` and {@link getLast | getLast(array)}.\n * This is especially useful when \"noUncheckedIndexedAccess\" is enabled in the TypeScript compiler options, since the return type of `array[0]` will be `T` rather than `T | undefined`.\n */\nexport function hasSome<T>(array: T[]): array is [T, ...T[]];\nexport function hasSome<T>(array: readonly T[]): array is readonly [T, ...T[]];\nexport function hasSome<T>(array: readonly T[]): array is [T, ...T[]] {\n\treturn array.length > 0;\n}\n\n/**\n * Returns true if and only if the given array has exactly one element.\n * @param array - The array to check.\n * @remarks\n * If `array` contains exactly one element, its type will be narrowed and can benefit from improved typing from e.g. `array[0]` and {@link getLast | getLast(array)}.\n * This is especially useful when \"noUncheckedIndexedAccess\" is enabled in the TypeScript compiler options, since the return type of `array[0]` will be `T` rather than `T | undefined`.\n */\nexport function hasSingle<T>(array: T[]): array is [T];\nexport function hasSingle<T>(array: readonly T[]): array is readonly [T];\nexport function hasSingle<T>(array: readonly T[]): array is [T] {\n\treturn array.length === 1;\n}\n\n/**\n * Compares two sets using callbacks.\n * Early returns on first false comparison.\n *\n * @param a - One Set.\n * @param b - The other Set.\n * @param aExtra - Called for items in `a` but not `b`.\n * @param bExtra - Called for items in `b` but not `a`.\n * @param same - Called for items in `a` and `b`.\n * @returns false iff any of the call backs returned false.\n */\nexport function compareSets<T>({\n\ta,\n\tb,\n\taExtra,\n\tbExtra,\n\tsame,\n}: {\n\ta: ReadonlySet<T> | ReadonlyMap<T, unknown>;\n\tb: ReadonlySet<T> | ReadonlyMap<T, unknown>;\n\taExtra?: (t: T) => boolean;\n\tbExtra?: (t: T) => boolean;\n\tsame?: (t: T) => boolean;\n}): boolean {\n\tfor (const item of a.keys()) {\n\t\tif (!b.has(item)) {\n\t\t\tif (aExtra !== undefined) {\n\t\t\t\tif (!aExtra(item)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else {\n\t\t\tif (same !== undefined && !same(item)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\tfor (const item of b.keys()) {\n\t\tif (!a.has(item)) {\n\t\t\tif (bExtra !== undefined) {\n\t\t\t\tif (!bExtra(item)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n\n/**\n * Sets the value at `key` in map to value if not already present.\n * Returns the value at `key` after setting it.\n * This is equivalent to a get or default that adds the default to the map.\n */\nexport function getOrAddInMap<Key, Value>(\n\tmap: MapGetSet<Key, Value>,\n\tkey: Key,\n\tvalue: Value,\n): Value {\n\tconst currentValue = map.get(key);\n\tif (currentValue !== undefined) {\n\t\treturn currentValue;\n\t}\n\tmap.set(key, value);\n\treturn value;\n}\n\n/**\n * Retrieve a value from a map with the given key, or create a new entry if the key is not in the map.\n * @param map - The map to query/update\n * @param key - The key to lookup in the map\n * @param defaultValue - a function which returns a default value. This is called and used to set an initial value for the given key in the map if none exists\n * @returns either the existing value for the given key, or the newly-created value (the result of `defaultValue`)\n */\nexport function getOrCreate<K, V>(\n\tmap: MapGetSet<K, V>,\n\tkey: K,\n\tdefaultValue: (key: K) => V,\n): V {\n\tlet value = map.get(key);\n\tif (value === undefined) {\n\t\tvalue = defaultValue(key);\n\t\tmap.set(key, value);\n\t}\n\treturn value;\n}\n\n/**\n * Utility for dictionaries whose values are lists.\n * Gets the list associated with the provided key, if it exists.\n * Otherwise, creates an entry with an empty list, and returns that list.\n */\nexport function getOrAddEmptyToMap<K, V>(map: MapGetSet<K, V[]>, key: K): V[] {\n\tlet collection = map.get(key);\n\tif (collection === undefined) {\n\t\tcollection = [];\n\t\tmap.set(key, collection);\n\t}\n\treturn collection;\n}\n\n/**\n * Map one iterable to another by transforming each element one at a time\n * @param iterable - the iterable to transform\n * @param map - the transformation function to run on each element of the iterable\n * @returns a new iterable of elements which have been transformed by the `map` function\n */\nexport function* mapIterable<T, U>(\n\titerable: Iterable<T>,\n\tmap: (t: T) => U,\n): IterableIterator<U> {\n\tfor (const t of iterable) {\n\t\tyield map(t);\n\t}\n}\n\n/**\n * Filter one iterable into another\n * @param iterable - the iterable to filter\n * @param filter - the predicate function to run on each element of the iterable\n * @returns a new iterable including only the elements that passed the filter predicate\n */\nexport function* filterIterable<T>(\n\titerable: Iterable<T>,\n\tfilter: (t: T) => boolean,\n): IterableIterator<T> {\n\tfor (const t of iterable) {\n\t\tif (filter(t)) {\n\t\t\tyield t;\n\t\t}\n\t}\n}\n\n/**\n * Finds the first element in the given iterable that satisfies a predicate.\n * @param iterable - The iterable to search for an eligible element\n * @param predicate - The predicate to run against each element\n * @returns The first element in the iterable that satisfies the predicate, or undefined if the iterable contains no such element\n */\nexport function find<T>(iterable: Iterable<T>, predicate: (t: T) => boolean): T | undefined {\n\tfor (const t of iterable) {\n\t\tif (predicate(t)) {\n\t\t\treturn t;\n\t\t}\n\t}\n}\n\n/**\n * Counts the number of elements in the given iterable.\n * @param iterable - the iterable to enumerate\n * @returns the number of elements that were iterated after exhausting the iterable\n */\nexport function count(iterable: Iterable<unknown>): number {\n\tlet n = 0;\n\tfor (const _ of iterable) {\n\t\tn += 1;\n\t}\n\treturn n;\n}\n\n/**\n * Use for Json compatible data.\n *\n * @typeparam TExtra - Type permitted in addition to the normal JSON types.\n * Commonly used for to allow {@link @fluidframework/core-interfaces#IFluidHandle} within the otherwise JSON compatible content.\n *\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n * @alpha\n */\nexport type JsonCompatible<TExtra = never> =\n\t| string\n\t| number\n\t| boolean\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| JsonCompatible<TExtra>[]\n\t| JsonCompatibleObject<TExtra>\n\t| TExtra;\n\n/**\n * Use for Json object compatible data.\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n * @alpha\n */\nexport type JsonCompatibleObject<TExtra = never> = { [P in string]?: JsonCompatible<TExtra> };\n\n/**\n * Use for readonly view of Json compatible data.\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n */\nexport type JsonCompatibleReadOnly =\n\t| string\n\t| number\n\t| boolean\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| readonly JsonCompatibleReadOnly[]\n\t| JsonCompatibleReadOnlyObject;\n\n/**\n * Use for readonly view of Json compatible data.\n * @remarks\n * This does not robustly forbid non json comparable data via type checking,\n * but instead mostly restricts access to it.\n */\nexport type JsonCompatibleReadOnlyObject = { readonly [P in string]?: JsonCompatibleReadOnly };\n\n/**\n * @remarks TODO: Audit usage of this type in schemas, evaluating whether it is necessary and performance\n * of alternatives.\n *\n * True \"arbitrary serializable data\" is probably fine, but some persisted types declarations might be better\n * expressed using composition of schemas for runtime validation, even if we don't think making the types\n * generic is worth the maintenance cost.\n */\nexport const JsonCompatibleReadOnlySchema = Type.Any();\n\n/**\n * Returns if a particular json compatible value is an object.\n * Does not include `null` or arrays.\n */\nexport function isJsonObject(\n\tvalue: JsonCompatibleReadOnly,\n): value is { readonly [P in string]?: JsonCompatibleReadOnly } {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * Verifies that the supplied indices are valid within the supplied array.\n * @param startIndex - The starting index in the range. Must be in [0, length).\n * @param endIndex - The ending index in the range. Must be within (start, length].\n * @param array - The array the indices refer to\n */\nexport function assertValidRangeIndices(\n\tstartIndex: number,\n\tendIndex: number,\n\tarray: { readonly length: number },\n): void {\n\tassert(endIndex >= startIndex, 0x79c /* Range indices are malformed. */);\n\tassertValidIndex(startIndex, array, false);\n\tassertValidIndex(endIndex, array, true);\n}\n\nexport function assertValidIndex(\n\tindex: number,\n\tarray: { readonly length: number },\n\tallowOnePastEnd: boolean = false,\n): void {\n\tassertNonNegativeSafeInteger(index);\n\tif (allowOnePastEnd) {\n\t\tassert(index <= array.length, 0x378 /* index must be less than or equal to length */);\n\t} else {\n\t\tassert(index < array.length, 0x379 /* index must be less than length */);\n\t}\n}\n\nexport function assertValidRange(\n\t{ start, end }: { start: number; end: number },\n\tarray: { readonly length: number },\n): void {\n\tassertNonNegativeSafeInteger(start);\n\tassertNonNegativeSafeInteger(end);\n\tassert(end <= array.length, 0x79d /* Range end must be less than or equal to length */);\n\tassert(start <= end, 0x79e /* Range start must be less than or equal to range start */);\n}\n\nexport function assertNonNegativeSafeInteger(index: number): void {\n\tassert(Number.isSafeInteger(index), 0x376 /* index must be an integer */);\n\tassert(index >= 0, 0x377 /* index must be non-negative */);\n}\n\n/**\n * Convert an object into a Map.\n *\n * This function must only be used with objects specifically intended to encode map like information.\n * The only time such objects should be used is for encoding maps as object literals to allow for developer ergonomics or JSON compatibility.\n * Even those two use-cases need to be carefully considered as using objects as maps can have a lot of issues\n * (including but not limited to unintended access to __proto__ and other non-owned keys).\n * This function helps these few cases get into using an actual map in as safe of was as is practical.\n */\nexport function objectToMap<MapKey extends string | number | symbol, MapValue>(\n\tobjectMap: Record<MapKey, MapValue>,\n): Map<MapKey, MapValue> {\n\tconst map = new Map<MapKey, MapValue>();\n\t// This function must only be used with objects specifically intended to encode map like information.\n\tfor (const key of Object.keys(objectMap)) {\n\t\tconst element = objectMap[key as MapKey];\n\t\tmap.set(key as MapKey, element);\n\t}\n\treturn map;\n}\n\n/**\n * Convert an object used as a map into a new object used like a map.\n *\n * @remarks\n * This function must only be used with objects specifically intended to encode map like information.\n * The only time such objects should be used is for encoding maps as object literals to allow for developer ergonomics or JSON compatibility.\n * Even those two use-cases need to be carefully considered as using objects as maps can have a lot of issues\n * (including but not limited to unintended access to __proto__ and other non-owned keys).\n * {@link objectToMap} helps these few cases get into using an actual map in as safe of a way as is practical.\n */\nexport function transformObjectMap<\n\tMapKey extends string | number | symbol,\n\tMapValue,\n\tNewMapValue,\n>(\n\tobjectMap: Record<MapKey, MapValue>,\n\ttransformer: (value: MapValue, key: MapKey) => NewMapValue,\n): Record<MapKey, MapValue> {\n\tconst output: Record<MapKey, MapValue> = Object.create(null);\n\t// This function must only be used with objects specifically intended to encode map like information.\n\tfor (const key of Object.keys(objectMap)) {\n\t\tconst element = objectMap[key as MapKey];\n\t\tObject.defineProperty(output, key, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tvalue: transformer(element, key as MapKey),\n\t\t});\n\t}\n\treturn output;\n}\n\n/**\n * Make an inverted copy of a map.\n *\n * @returns a map which can look up the keys from the values of the original map.\n */\nexport function invertMap<Key, Value>(input: Map<Key, Value>): Map<Value, Key> {\n\tconst result = new Map<Value, Key>(mapIterable(input, ([key, value]) => [value, key]));\n\tassert(\n\t\tresult.size === input.size,\n\t\t0x88a /* all values in a map must be unique to invert it */,\n\t);\n\treturn result;\n}\n\n/**\n * Returns the value from `set` if it contains exactly one item, otherwise `undefined`.\n */\nexport function oneFromSet<T>(set: ReadonlySet<T> | undefined): T | undefined {\n\tif (set === undefined) {\n\t\treturn undefined;\n\t}\n\tif (set.size !== 1) {\n\t\treturn undefined;\n\t}\n\tfor (const item of set) {\n\t\treturn item;\n\t}\n}\n\n/**\n * Type with a name describing what it is.\n * Typically used with values (like schema) that can be stored in a map, but in some representations have their name/key as a field.\n */\nexport interface Named<TName> {\n\treadonly name: TName;\n}\n\n/**\n * Order {@link Named} objects by their name.\n */\nexport function compareNamed(a: Named<string>, b: Named<string>): -1 | 0 | 1 {\n\tif (a.name < b.name) {\n\t\treturn -1;\n\t}\n\tif (a.name > b.name) {\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\n/**\n * Placeholder for `Symbol.dispose`.\n * @privateRemarks\n * TODO: replace this with `Symbol.dispose` when it is available or make it a valid polyfill.\n */\nexport const disposeSymbol: unique symbol = Symbol(\"Symbol.dispose placeholder\");\n\n/**\n * An object with an explicit lifetime that can be ended.\n * @privateRemarks\n * Simpler alternative to core-utils/IDisposable for internal use in this package.\n * This avoids adding a named \"dispose\" method, and will eventually be replaced with\n * {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management| TypeScript's Disposable}.\n *\n * Once this is replaced with TypeScript's Disposable, core-utils/IDisposable can extend it, bringing the APIs into a reasonable alignment.\n */\nexport interface IDisposable {\n\t/**\n\t * Call to end the lifetime of this object.\n\t *\n\t * It is invalid to use this object after this,\n\t * except for operations which explicitly document they are valid after disposal.\n\t *\n\t * @remarks\n\t * May cleanup resources retained by this object.\n\t * Often includes un-registering from events and thus preventing other objects from retaining a reference to this indefinably.\n\t *\n\t * Usually the only operations allowed after disposal are querying if an object is already disposed,\n\t * but this can vary between implementations.\n\t */\n\t[disposeSymbol](): void;\n}\n\n/**\n * Capitalize a string.\n */\nexport function capitalize<S extends string>(s: S): Capitalize<S> {\n\t// To avoid splitting characters which are made of multiple UTF-16 code units,\n\t// use iteration instead of indexing to separate the first character.\n\tconst iterated = s[Symbol.iterator]().next();\n\tif (iterated.done === true) {\n\t\t// Empty string case.\n\t\treturn \"\" as Capitalize<S>;\n\t}\n\n\treturn (iterated.value.toUpperCase() + s.slice(iterated.value.length)) as Capitalize<S>;\n}\n\n/**\n * Compares strings lexically to form a strict partial ordering.\n */\nexport function compareStrings<T extends string>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\n/**\n * Defines a property on an object that is lazily initialized and cached.\n * @remarks This is useful for properties that are expensive to compute and it is not guaranteed that they will be accessed.\n * This function initially defines a getter on the object, but after first read it replaces the getter with a value property.\n * @param obj - The object on which to define the property.\n * @param key - The key of the property to define.\n * @param get - The function (called either once or not at all) to compute the value of the property.\n * @returns `obj`, typed such that it has the new property.\n * This allows for the new property to be read off of `obj` in a type-safe manner after calling this function.\n */\nexport function defineLazyCachedProperty<\n\tT extends object,\n\tK extends string | number | symbol,\n\tV,\n>(obj: T, key: K, get: () => V): typeof obj & { [P in K]: V } {\n\tReflect.defineProperty(obj, key, {\n\t\tget() {\n\t\t\tconst value = get();\n\t\t\tReflect.defineProperty(obj, key, { value });\n\t\t\treturn value;\n\t\t},\n\t\tconfigurable: true,\n\t});\n\treturn obj as typeof obj & { [P in K]: V };\n}\n\n/**\n * Copies a given property from one object to another if and only if the property is defined.\n * @param source - The object to copy the property from.\n * If `source` is undefined or does not have the property defined, then this function will do nothing.\n * @param property - The property to copy.\n * @param destination - The object to copy the property to.\n * @remarks This function is useful for copying properties from one object to another while minimizing the presence of `undefined` values.\n * If `property` is not present on `source` - or if `property` is present, but has a value of `undefined` - then this function will not modify `destination`.\n * This is different from doing `destination.foo = source.foo`, which would define a `\"foo\"` property on `destination` with the value `undefined`.\n *\n * If the type of `source` is known to have `property`, then this function asserts that the type of `destination` has `property` as well after the call.\n *\n * This function first reads the property value (if present) from `source` and then sets it on `destination`, as opposed to e.g. directly copying the property descriptor.\n * @privateRemarks The first overload of this function allows auto-complete to suggest property names from `source`, but by having the second overload we still allow for arbitrary property names.\n */\nexport function copyPropertyIfDefined<S extends object, K extends keyof S, D extends object>(\n\tsource: S | undefined,\n\tproperty: K,\n\tdestination: D,\n): asserts destination is K extends keyof S ? D & { [P in K]: S[K] } : D;\nexport function copyPropertyIfDefined<\n\tS extends object,\n\tK extends string | number | symbol,\n\tD extends object,\n>(\n\tsource: S | undefined,\n\tproperty: K,\n\tdestination: D,\n): asserts destination is K extends keyof S ? D & { [P in K]: S[K] } : D;\nexport function copyPropertyIfDefined<\n\tS extends object,\n\tK extends string | number | symbol,\n\tD extends object,\n>(\n\tsource: S | undefined,\n\tproperty: K,\n\tdestination: D,\n): asserts destination is K extends keyof S ? D & { [P in K]: S[K] } : D {\n\tif (source !== undefined) {\n\t\tconst value = (source as { [P in K]?: unknown })[property];\n\t\tif (value !== undefined) {\n\t\t\t(destination as { [P in K]: unknown })[property] = value;\n\t\t}\n\t}\n}\n\n/**\n * Reduces an array of values into a single value.\n * This is similar to `Array.prototype.reduce`,\n * except that it recursively reduces the left and right halves of the input before reducing their respective reductions.\n *\n * When compared with an approach like reducing all the values left-to-right,\n * this balanced approach is beneficial when the cost of invoking `callbackFn` is proportional to the number reduced values that its parameters collectively represent.\n * For example, if `T` is an array, and `callbackFn` concatenates its inputs,\n * then `balancedReduce` will have O(N*log(N)) time complexity instead of `Array.prototype.reduce`'s O(N²).\n * However, if `callbackFn` is O(1) then both `balancedReduce` and `Array.prototype.reduce` will have O(N) complexity.\n *\n * @param array - The array to reduce.\n * @param callbackFn - The function to execute for each pairwise reduction.\n * @param emptyCase - A factory function that provides the value to return if the input array is empty.\n */\nexport function balancedReduce<T>(\n\tarray: readonly T[],\n\tcallbackFn: (left: T, right: T) => T,\n\temptyCase: () => T,\n): T {\n\tif (hasSingle(array)) {\n\t\treturn array[0];\n\t}\n\tif (!hasSome(array)) {\n\t\treturn emptyCase();\n\t}\n\tconst mid = Math.floor(array.length / 2);\n\tconst left = balancedReduce(array.slice(0, mid), callbackFn, emptyCase);\n\tconst right = balancedReduce(array.slice(mid), callbackFn, emptyCase);\n\treturn callbackFn(left, right);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/tree",
3
- "version": "2.22.1",
3
+ "version": "2.23.0-325054",
4
4
  "description": "Distributed tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -89,17 +89,17 @@
89
89
  "temp-directory": "nyc/.nyc_output"
90
90
  },
91
91
  "dependencies": {
92
- "@fluid-internal/client-utils": "~2.22.1",
93
- "@fluidframework/container-runtime": "~2.22.1",
94
- "@fluidframework/core-interfaces": "~2.22.1",
95
- "@fluidframework/core-utils": "~2.22.1",
96
- "@fluidframework/datastore-definitions": "~2.22.1",
97
- "@fluidframework/driver-definitions": "~2.22.1",
98
- "@fluidframework/id-compressor": "~2.22.1",
99
- "@fluidframework/runtime-definitions": "~2.22.1",
100
- "@fluidframework/runtime-utils": "~2.22.1",
101
- "@fluidframework/shared-object-base": "~2.22.1",
102
- "@fluidframework/telemetry-utils": "~2.22.1",
92
+ "@fluid-internal/client-utils": "2.23.0-325054",
93
+ "@fluidframework/container-runtime": "2.23.0-325054",
94
+ "@fluidframework/core-interfaces": "2.23.0-325054",
95
+ "@fluidframework/core-utils": "2.23.0-325054",
96
+ "@fluidframework/datastore-definitions": "2.23.0-325054",
97
+ "@fluidframework/driver-definitions": "2.23.0-325054",
98
+ "@fluidframework/id-compressor": "2.23.0-325054",
99
+ "@fluidframework/runtime-definitions": "2.23.0-325054",
100
+ "@fluidframework/runtime-utils": "2.23.0-325054",
101
+ "@fluidframework/shared-object-base": "2.23.0-325054",
102
+ "@fluidframework/telemetry-utils": "2.23.0-325054",
103
103
  "@sinclair/typebox": "^0.34.13",
104
104
  "@tylerbu/sorted-btree-es6": "^1.8.0",
105
105
  "@types/ungap__structured-clone": "^1.2.0",
@@ -109,19 +109,19 @@
109
109
  "devDependencies": {
110
110
  "@arethetypeswrong/cli": "^0.17.1",
111
111
  "@biomejs/biome": "~1.9.3",
112
- "@fluid-internal/mocha-test-setup": "~2.22.1",
113
- "@fluid-private/stochastic-test-utils": "~2.22.1",
114
- "@fluid-private/test-dds-utils": "~2.22.1",
115
- "@fluid-private/test-drivers": "~2.22.1",
112
+ "@fluid-internal/mocha-test-setup": "2.23.0-325054",
113
+ "@fluid-private/stochastic-test-utils": "2.23.0-325054",
114
+ "@fluid-private/test-dds-utils": "2.23.0-325054",
115
+ "@fluid-private/test-drivers": "2.23.0-325054",
116
116
  "@fluid-tools/benchmark": "^0.50.0",
117
- "@fluid-tools/build-cli": "^0.51.0",
117
+ "@fluid-tools/build-cli": "^0.54.0",
118
118
  "@fluidframework/build-common": "^2.0.3",
119
- "@fluidframework/build-tools": "^0.51.0",
120
- "@fluidframework/container-definitions": "~2.22.1",
121
- "@fluidframework/container-loader": "~2.22.1",
119
+ "@fluidframework/build-tools": "^0.54.0",
120
+ "@fluidframework/container-definitions": "2.23.0-325054",
121
+ "@fluidframework/container-loader": "2.23.0-325054",
122
122
  "@fluidframework/eslint-config-fluid": "^5.7.3",
123
- "@fluidframework/test-runtime-utils": "~2.22.1",
124
- "@fluidframework/test-utils": "~2.22.1",
123
+ "@fluidframework/test-runtime-utils": "2.23.0-325054",
124
+ "@fluidframework/test-utils": "2.23.0-325054",
125
125
  "@fluidframework/tree-previous": "npm:@fluidframework/tree@2.22.0",
126
126
  "@microsoft/api-extractor": "7.47.8",
127
127
  "@types/diff": "^3.5.1",
@@ -163,7 +163,11 @@
163
163
  }
164
164
  },
165
165
  "typeValidation": {
166
- "broken": {},
166
+ "broken": {
167
+ "TypeAlias_InsertableTreeNodeFromImplicitAllowedTypes": {
168
+ "backCompat": false
169
+ }
170
+ },
167
171
  "entrypoint": "public"
168
172
  },
169
173
  "scripts": {
@@ -203,7 +203,7 @@ export function makeCodecFamily<TDecoded, TContext>(
203
203
  > = new Map();
204
204
  for (const [formatVersion, codec] of registry) {
205
205
  if (codecs.has(formatVersion)) {
206
- fail("Duplicate codecs specified.");
206
+ fail(0xabf /* Duplicate codecs specified. */);
207
207
  }
208
208
  codecs.set(formatVersion, ensureBinaryEncoding(codec));
209
209
  }
@@ -315,13 +315,13 @@ export function withSchemaValidation<
315
315
  encode: (obj: TInMemoryFormat, context: TContext): TEncodedFormat => {
316
316
  const encoded = codec.encode(obj, context);
317
317
  if (!compiledFormat.check(encoded)) {
318
- fail("Encoded schema should validate");
318
+ fail(0xac0 /* Encoded schema should validate */);
319
319
  }
320
320
  return encoded;
321
321
  },
322
322
  decode: (encoded: TValidate, context: TContext): TInMemoryFormat => {
323
323
  if (!compiledFormat.check(encoded)) {
324
- fail("Encoded schema should validate");
324
+ fail(0xac1 /* Encoded schema should validate */);
325
325
  }
326
326
  // TODO: would be nice to provide a more specific validate type to the inner codec than the outer one gets.
327
327
  return codec.decode(encoded, context) as unknown as TInMemoryFormat;
@@ -124,7 +124,8 @@ export class DiscriminatedUnionDispatcher<
124
124
  );
125
125
  const key: keyof TUnion = keys[0] as keyof TUnion;
126
126
  const value = union[key];
127
- const factory = this.library.get(key) ?? fail("missing function for union member");
127
+ const factory =
128
+ this.library.get(key) ?? fail(0xac2 /* missing function for union member */);
128
129
  const result = factory(value, ...args);
129
130
  return result;
130
131
  }
@@ -207,7 +207,9 @@ export class ObjectNodeStoredSchema extends TreeNodeStoredSchema {
207
207
  enumerable: true,
208
208
  configurable: true,
209
209
  writable: true,
210
- value: encodeFieldSchema(this.objectNodeFields.get(key) ?? fail("missing field")),
210
+ value: encodeFieldSchema(
211
+ this.objectNodeFields.get(key) ?? fail(0xae7 /* missing field */),
212
+ ),
211
213
  });
212
214
  }
213
215
  return toErasedTreeNodeSchemaDataFormat({
@@ -305,11 +307,11 @@ const valueSchemaEncode = new Map([
305
307
  const valueSchemaDecode = invertMap(valueSchemaEncode);
306
308
 
307
309
  function encodeValueSchema(inMemory: ValueSchema): PersistedValueSchema {
308
- return valueSchemaEncode.get(inMemory) ?? fail("missing PersistedValueSchema");
310
+ return valueSchemaEncode.get(inMemory) ?? fail(0xae8 /* missing PersistedValueSchema */);
309
311
  }
310
312
 
311
313
  function decodeValueSchema(inMemory: PersistedValueSchema): ValueSchema {
312
- return valueSchemaDecode.get(inMemory) ?? fail("missing ValueSchema");
314
+ return valueSchemaDecode.get(inMemory) ?? fail(0xae9 /* missing ValueSchema */);
313
315
  }
314
316
 
315
317
  export function encodeFieldSchema(schema: TreeFieldStoredSchema): FieldSchemaFormat {
@@ -18,6 +18,8 @@ import {
18
18
  brand,
19
19
  brandedSlot,
20
20
  fail,
21
+ getOrAddEmptyToMap,
22
+ getOrCreate,
21
23
  } from "../../util/index.js";
22
24
  import type { FieldKey } from "../schema-stored/index.js";
23
25
 
@@ -474,7 +476,7 @@ export class AnchorSet implements AnchorLocator {
474
476
  }
475
477
  }
476
478
 
477
- return path ?? fail("internalize path must be a path");
479
+ return path ?? fail(0xaea /* internalize path must be a path */);
478
480
  }
479
481
 
480
482
  /**
@@ -711,15 +713,7 @@ export class AnchorSet implements AnchorLocator {
711
713
  /**
712
714
  * Events collected during the visit which get sent as a batch during "free".
713
715
  */
714
- bufferedEvents: [] as {
715
- node: PathNode;
716
- event: keyof AnchorEvents;
717
- /**
718
- * The key for the impacted field, if the event is associated with a key.
719
- * Some events, such as afterDestroy, do not involve a key, and thus leave this undefined.
720
- */
721
- changedField?: FieldKey;
722
- }[],
716
+ bufferedEvents: [] as BufferedEvent[],
723
717
 
724
718
  // 'currentDepth' and 'depthThresholdForSubtreeChanged' serve to keep track of when do we need to emit
725
719
  // subtreeChangedAfterBatch events.
@@ -751,25 +745,31 @@ export class AnchorSet implements AnchorLocator {
751
745
  node.removeRef();
752
746
  }
753
747
  this.anchorSet.activeVisitor = undefined;
754
- const alreadyEmitted = new Map<PathNode, string[]>();
755
- for (const { node, event } of this.bufferedEvents) {
756
- if (!alreadyEmitted.has(node)) {
757
- alreadyEmitted.set(node, []);
748
+
749
+ // Aggregate changedFields by node.
750
+ const eventsByNode: Map<PathNode, Set<FieldKey>> = new Map();
751
+ for (const { node, event, changedField } of this.bufferedEvents) {
752
+ if (event === "childrenChangedAfterBatch") {
753
+ const keys = getOrCreate(eventsByNode, node, () => new Set());
754
+ keys.add(
755
+ changedField ??
756
+ fail(0xb57 /* childrenChangedAfterBatch events should have a changedField */),
757
+ );
758
758
  }
759
- const emittedEvents = alreadyEmitted.get(node);
760
- if (emittedEvents?.includes(event) ?? false) {
759
+ }
760
+
761
+ const alreadyEmitted = new Map<PathNode, (keyof AnchorEvents)[]>();
762
+ for (const { node, event } of this.bufferedEvents) {
763
+ const emittedEvents = getOrAddEmptyToMap(alreadyEmitted, node);
764
+ if (emittedEvents.includes(event)) {
761
765
  continue;
762
766
  }
763
- emittedEvents?.push(event);
767
+ emittedEvents.push(event);
764
768
  if (event === "childrenChangedAfterBatch") {
765
- const fieldKeys: FieldKey[] = this.bufferedEvents
766
- .filter((e) => e.node === node && e.event === event)
767
- .map(
768
- (e) =>
769
- e.changedField ??
770
- fail("childrenChangedAfterBatch events should have a changedField"),
771
- );
772
- node.events.emit(event, { changedFields: new Set(fieldKeys) });
769
+ const changedFields =
770
+ eventsByNode.get(node) ??
771
+ fail(0xaeb /* childrenChangedAfterBatch events should have changedFields */);
772
+ node.events.emit(event, { changedFields });
773
773
  } else {
774
774
  node.events.emit(event);
775
775
  }
@@ -1031,7 +1031,8 @@ class PathNode extends ReferenceCountedBase implements UpPath<PathNode>, AnchorN
1031
1031
  public getOrCreateChildRef(key: FieldKey, index: number): [Anchor, AnchorNode] {
1032
1032
  const anchor = this.anchorSet.track(this.child(key, index));
1033
1033
  const node =
1034
- this.anchorSet.locate(anchor) ?? fail("cannot reference child that does not exist");
1034
+ this.anchorSet.locate(anchor) ??
1035
+ fail(0xaec /* cannot reference child that does not exist */);
1035
1036
  return [anchor, node];
1036
1037
  }
1037
1038
 
@@ -1194,3 +1195,13 @@ function binaryFind(sorted: readonly PathNode[], index: number): PathNode | unde
1194
1195
  }
1195
1196
  return undefined; // If we reach here, target is not in array (or array was not sorted)
1196
1197
  }
1198
+
1199
+ interface BufferedEvent {
1200
+ node: PathNode;
1201
+ event: keyof AnchorEvents;
1202
+ /**
1203
+ * The key for the impacted field, if the event is associated with a key.
1204
+ * Some events, such as afterDestroy, do not involve a key, and thus leave this undefined.
1205
+ */
1206
+ changedField?: FieldKey;
1207
+ }
@@ -90,7 +90,7 @@ export function getGenericTreeField<T>(
90
90
 
91
91
  // Do not just read field and check for undefined: see warning on FieldMapObject.
92
92
  if (Object.prototype.hasOwnProperty.call(children, key)) {
93
- return children[key] ?? fail("This wont be undefined due to the check above");
93
+ return children[key] ?? fail(0xaed /* This wont be undefined due to the check above */);
94
94
  }
95
95
  // Handle missing field:
96
96
  if (createIfMissing === false) {
@@ -234,7 +234,7 @@ export class BasicChunkCursor extends SynchronousCursor implements ChunkedCursor
234
234
  if (this.nestedCursor !== undefined) {
235
235
  return (
236
236
  this.nestedCursor.getPath(this.nestedPathPrefix(prefix)) ??
237
- fail("nested cursors should not be root")
237
+ fail(0xaee /* nested cursors should not be root */)
238
238
  );
239
239
  }
240
240
  assert(this.mode === CursorLocationType.Nodes, 0x524 /* must be in nodes mode */);
@@ -247,7 +247,7 @@ export class BasicChunkCursor extends SynchronousCursor implements ChunkedCursor
247
247
  // This uses index offset for actual node, when it should use offset for start of chunk.
248
248
  // To compensate, subtract this.indexWithinChunk below.
249
249
  const rootPath: UpPath =
250
- this.getOffsetPath(0, prefix) ?? fail("nested cursors should not be root");
250
+ this.getOffsetPath(0, prefix) ?? fail(0xaef /* nested cursors should not be root */);
251
251
  return {
252
252
  indexOffset: rootPath.parentIndex - this.indexWithinChunk,
253
253
  rootFieldOverride: rootPath.parentField,
@@ -483,8 +483,9 @@ export class BasicChunkCursor extends SynchronousCursor implements ChunkedCursor
483
483
  this.mode === CursorLocationType.Fields,
484
484
  0x52d /* can only navigate up from field when in field */,
485
485
  );
486
- this.siblings = this.siblingStack.pop() ?? fail("Unexpected siblingStack.length");
487
- this.index = this.indexStack.pop() ?? fail("Unexpected indexStack.length");
486
+ this.siblings =
487
+ this.siblingStack.pop() ?? fail(0xaf0 /* Unexpected siblingStack.length */);
488
+ this.index = this.indexStack.pop() ?? fail(0xaf1 /* Unexpected indexStack.length */);
488
489
  }
489
490
 
490
491
  public exitNode(): void {
@@ -498,12 +499,14 @@ export class BasicChunkCursor extends SynchronousCursor implements ChunkedCursor
498
499
  this.mode === CursorLocationType.Nodes,
499
500
  0x52e /* can only navigate up from node when in node */,
500
501
  );
501
- this.siblings = this.siblingStack.pop() ?? fail("Unexpected siblingStack.length");
502
- this.index = this.indexStack.pop() ?? fail("Unexpected indexStack.length");
502
+ this.siblings =
503
+ this.siblingStack.pop() ?? fail(0xaf2 /* Unexpected siblingStack.length */);
504
+ this.index = this.indexStack.pop() ?? fail(0xaf3 /* Unexpected indexStack.length */);
503
505
  this.indexOfChunk =
504
- this.indexOfChunkStack.pop() ?? fail("Unexpected indexOfChunkStack.length");
506
+ this.indexOfChunkStack.pop() ?? fail(0xaf4 /* Unexpected indexOfChunkStack.length */);
505
507
  this.indexWithinChunk =
506
- this.indexWithinChunkStack.pop() ?? fail("Unexpected indexWithinChunkStack.length");
508
+ this.indexWithinChunkStack.pop() ??
509
+ fail(0xaf5 /* Unexpected indexWithinChunkStack.length */);
507
510
  }
508
511
 
509
512
  private getNode(): BasicChunk {
@@ -247,7 +247,7 @@ export function tryShapeFromSchema(
247
247
  shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>,
248
248
  ): ShapeInfo {
249
249
  return getOrCreate(shapes, type, () => {
250
- const treeSchema = schema.nodeSchema.get(type) ?? fail("missing schema");
250
+ const treeSchema = schema.nodeSchema.get(type) ?? fail(0xaf9 /* missing schema */);
251
251
  if (treeSchema instanceof LeafNodeStoredSchema) {
252
252
  // Allow all string values (but only string values) to be compressed by the id compressor.
253
253
  // This allows compressing all compressible identifiers without requiring additional context to know which values could be identifiers.
@@ -284,7 +284,7 @@ export function tryShapeFromFieldSchema(
284
284
  key: FieldKey,
285
285
  shapes: Map<TreeNodeSchemaIdentifier, ShapeInfo>,
286
286
  ): FieldShape | undefined {
287
- const kind = policy.fieldKinds.get(type.kind) ?? fail("missing FieldKind");
287
+ const kind = policy.fieldKinds.get(type.kind) ?? fail(0xafa /* missing FieldKind */);
288
288
  if (kind.multiplicity !== Multiplicity.Single) {
289
289
  return undefined;
290
290
  }
@@ -227,7 +227,7 @@ export class ChunkedForest implements IEditableForest {
227
227
  assert(this.mutableChunk === undefined, 0x535 /* should be in field */);
228
228
  const parent = this.getParent();
229
229
  const chunks =
230
- parent.mutableChunk.fields.get(parent.key) ?? fail("missing edited field");
230
+ parent.mutableChunk.fields.get(parent.key) ?? fail(0xaf6 /* missing edited field */);
231
231
  let indexWithinChunk = index;
232
232
  let indexOfChunk = 0;
233
233
  let chunk = chunks[indexOfChunk] ?? oob();
@@ -236,7 +236,7 @@ export class ChunkedForest implements IEditableForest {
236
236
  indexWithinChunk -= chunk.topLevelLength;
237
237
  indexOfChunk++;
238
238
  if (indexOfChunk === chunks.length) {
239
- fail("missing edited node");
239
+ fail(0xaf7 /* missing edited node */);
240
240
  }
241
241
  }
242
242
  let found = chunks[indexOfChunk] ?? oob();
@@ -277,7 +277,7 @@ export class ChunkedForest implements IEditableForest {
277
277
  this.mutableChunk = undefined;
278
278
  },
279
279
  exitField(key: FieldKey): void {
280
- const top = this.mutableChunkStack.pop() ?? fail("should not be at root");
280
+ const top = this.mutableChunkStack.pop() ?? fail(0xaf8 /* should not be at root */);
281
281
  assert(this.mutableChunk === undefined, 0x539 /* should be in field */);
282
282
  this.mutableChunk = top.mutableChunk;
283
283
  },
@@ -85,7 +85,7 @@ export function handleShapesAndIdentifiers<TEncodedShape>(
85
85
  ) {
86
86
  // because "serializable" is allowed in buffer and it has type `any`, its very easy to mess up including of shapes in the buffer.
87
87
  // This catches the easiest way to get it wrong.
88
- fail("encoder interface instead of shape written to stream");
88
+ fail(0xb4b /* encoder interface instead of shape written to stream */);
89
89
  }
90
90
  }
91
91
  }
@@ -108,7 +108,7 @@ export function handleShapesAndIdentifiers<TEncodedShape>(
108
108
  if (item instanceof IdentifierToken) {
109
109
  array[index] = identifierTable.valueToIndex.get(item.identifier) ?? item.identifier;
110
110
  } else if (item instanceof Shape) {
111
- array[index] = shapeTable.valueToIndex.get(item) ?? fail("missing shape");
111
+ array[index] = shapeTable.valueToIndex.get(item) ?? fail(0xb4c /* missing shape */);
112
112
  }
113
113
  }
114
114
  }
@@ -273,7 +273,7 @@ export class InlineArrayShape
273
273
  shapes: EncoderCache,
274
274
  outputBuffer: BufferFormat,
275
275
  ): void {
276
- fail("Empty array should not encode any nodes");
276
+ fail(0xb4d /* Empty array should not encode any nodes */);
277
277
  },
278
278
  });
279
279
 
@@ -324,7 +324,7 @@ export class InlineArrayShape
324
324
  return {
325
325
  b: {
326
326
  length: this.length,
327
- shape: shapes.valueToIndex.get(this.inner.shape) ?? fail("missing shape"),
327
+ shape: shapes.valueToIndex.get(this.inner.shape) ?? fail(0xb4e /* missing shape */),
328
328
  },
329
329
  };
330
330
  }
@@ -380,7 +380,8 @@ export class NestedArrayShape extends ShapeGeneric<EncodedChunkShape> implements
380
380
  shapes: DeduplicationTable<Shape>,
381
381
  ): EncodedChunkShape {
382
382
  const shape: EncodedNestedArray =
383
- shapes.valueToIndex.get(this.inner.shape) ?? fail("index for shape not found in table");
383
+ shapes.valueToIndex.get(this.inner.shape) ??
384
+ fail(0xb4f /* index for shape not found in table */);
384
385
  return {
385
386
  a: shape,
386
387
  };
@@ -138,7 +138,7 @@ export function encodeFieldShapes(
138
138
  // key
139
139
  encodeIdentifier(field.key, identifiers),
140
140
  // shape
141
- shapes.valueToIndex.get(field.shape.shape) ?? fail("missing shape"),
141
+ shapes.valueToIndex.get(field.shape.shape) ?? fail(0xb50 /* missing shape */),
142
142
  ]);
143
143
  }
144
144
 
@@ -167,5 +167,5 @@ function dedupShape(
167
167
  shape: Shape<EncodedChunkShape>,
168
168
  shapes: DeduplicationTable<Shape<EncodedChunkShape>>,
169
169
  ): number {
170
- return shapes.valueToIndex.get(shape) ?? fail("missing shape");
170
+ return shapes.valueToIndex.get(shape) ?? fail(0xb51 /* missing shape */);
171
171
  }
@@ -74,7 +74,7 @@ export function fieldShaper(
74
74
  cache: EncoderCache,
75
75
  storedSchema: StoredSchemaCollection,
76
76
  ): FieldEncoder {
77
- const kind = cache.fieldShapes.get(field.kind) ?? fail("missing FieldKind");
77
+ const kind = cache.fieldShapes.get(field.kind) ?? fail(0xb52 /* missing FieldKind */);
78
78
  const type = oneFromSet(field.types);
79
79
  const nodeEncoder = type !== undefined ? treeHandler.shapeFromTree(type) : anyNodeEncoder;
80
80
  if (kind.multiplicity === Multiplicity.Single) {
@@ -113,7 +113,8 @@ export function treeShaper(
113
113
  fieldHandler: FieldShaper,
114
114
  schemaName: TreeNodeSchemaIdentifier,
115
115
  ): NodeShape {
116
- const schema = fullSchema.nodeSchema.get(schemaName) ?? fail("missing node schema");
116
+ const schema =
117
+ fullSchema.nodeSchema.get(schemaName) ?? fail(0xb53 /* missing node schema */);
117
118
 
118
119
  if (schema instanceof ObjectNodeStoredSchema) {
119
120
  // TODO:Performance:
@@ -146,7 +147,7 @@ export function treeShaper(
146
147
  );
147
148
  return shape;
148
149
  }
149
- fail("unsupported node kind");
150
+ fail(0xb54 /* unsupported node kind */);
150
151
  }
151
152
 
152
153
  export function oneFromSet<T>(set: ReadonlySet<T> | undefined): T | undefined {