@fluidframework/tree 2.23.0-323641 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (420) hide show
  1. package/.vscode/extensions.json +1 -0
  2. package/CHANGELOG.md +47 -0
  3. package/api-report/tree.alpha.api.md +31 -0
  4. package/dist/alpha.d.ts +1 -0
  5. package/dist/codec/codec.js +3 -3
  6. package/dist/codec/codec.js.map +1 -1
  7. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  8. package/dist/codec/discriminatedUnions.js +1 -1
  9. package/dist/codec/discriminatedUnions.js.map +1 -1
  10. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  11. package/dist/core/schema-stored/schema.js +3 -3
  12. package/dist/core/schema-stored/schema.js.map +1 -1
  13. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  14. package/dist/core/tree/anchorSet.js +5 -4
  15. package/dist/core/tree/anchorSet.js.map +1 -1
  16. package/dist/core/tree/treeTextFormat.js +1 -1
  17. package/dist/core/tree/treeTextFormat.js.map +1 -1
  18. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  19. package/dist/feature-libraries/chunked-forest/basicChunk.js +11 -8
  20. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  21. package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -2
  22. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  23. package/dist/feature-libraries/chunked-forest/chunkedForest.js +3 -3
  24. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  25. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +2 -2
  26. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  27. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  28. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
  29. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  30. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  31. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  32. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js +3 -3
  34. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +1 -1
  35. package/dist/feature-libraries/chunked-forest/emptyChunk.js +14 -14
  36. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  37. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  39. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  40. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  41. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  42. package/dist/feature-libraries/default-schema/schemaChecker.js +1 -1
  43. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  44. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  45. package/dist/feature-libraries/flex-tree/lazyField.js +4 -3
  46. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  47. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  48. package/dist/feature-libraries/flex-tree/lazyNode.js +5 -4
  49. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  50. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  51. package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  52. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  53. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  54. package/dist/feature-libraries/modular-schema/comparison.js +6 -4
  55. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  56. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  57. package/dist/feature-libraries/modular-schema/isNeverTree.js +4 -4
  58. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  59. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
  60. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  61. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  62. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +5 -5
  63. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  64. package/dist/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  65. package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  66. package/dist/feature-libraries/object-forest/objectForest.js +1 -1
  67. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  68. package/dist/feature-libraries/schema-index/codec.js +1 -1
  69. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  70. package/dist/feature-libraries/sequence-field/compose.js +1 -1
  71. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  72. package/dist/feature-libraries/sequence-field/invert.js +1 -1
  73. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  74. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  75. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  76. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  77. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  78. package/dist/feature-libraries/sequence-field/utils.js +1 -1
  79. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  80. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  81. package/dist/feature-libraries/treeCursorUtils.js +6 -4
  82. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  83. package/dist/index.d.ts +3 -1
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +5 -1
  86. package/dist/index.js.map +1 -1
  87. package/dist/jsonDomainSchema.d.ts +113 -0
  88. package/dist/jsonDomainSchema.d.ts.map +1 -0
  89. package/dist/jsonDomainSchema.js +101 -0
  90. package/dist/jsonDomainSchema.js.map +1 -0
  91. package/dist/packageVersion.d.ts +1 -1
  92. package/dist/packageVersion.d.ts.map +1 -1
  93. package/dist/packageVersion.js +1 -1
  94. package/dist/packageVersion.js.map +1 -1
  95. package/dist/serializableDomainSchema.d.ts +108 -0
  96. package/dist/serializableDomainSchema.d.ts.map +1 -0
  97. package/dist/serializableDomainSchema.js +90 -0
  98. package/dist/serializableDomainSchema.js.map +1 -0
  99. package/dist/shared-tree/index.d.ts +1 -1
  100. package/dist/shared-tree/index.d.ts.map +1 -1
  101. package/dist/shared-tree/index.js.map +1 -1
  102. package/dist/shared-tree/schematizeTree.js +1 -1
  103. package/dist/shared-tree/schematizeTree.js.map +1 -1
  104. package/dist/shared-tree/sharedTree.d.ts +35 -19
  105. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  106. package/dist/shared-tree/sharedTree.js +14 -17
  107. package/dist/shared-tree/sharedTree.js.map +1 -1
  108. package/dist/shared-tree/sharedTreeChangeFamily.js +1 -1
  109. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  110. package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
  111. package/dist/shared-tree/treeApiAlpha.js +4 -4
  112. package/dist/shared-tree/treeApiAlpha.js.map +1 -1
  113. package/dist/shared-tree/treeCheckout.js +1 -1
  114. package/dist/shared-tree/treeCheckout.js.map +1 -1
  115. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  116. package/dist/shared-tree-core/editManager.js +8 -7
  117. package/dist/shared-tree-core/editManager.js.map +1 -1
  118. package/dist/shared-tree-core/sharedTreeCore.d.ts +1 -2
  119. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  120. package/dist/shared-tree-core/sharedTreeCore.js +2 -2
  121. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  122. package/dist/simple-tree/api/customTree.js +3 -3
  123. package/dist/simple-tree/api/customTree.js.map +1 -1
  124. package/dist/simple-tree/api/schemaCreationUtilities.js +1 -1
  125. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  126. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
  127. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  128. package/dist/simple-tree/api/simpleTreeIndex.js +3 -3
  129. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  130. package/dist/simple-tree/api/tree.js +1 -1
  131. package/dist/simple-tree/api/tree.js.map +1 -1
  132. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  133. package/dist/simple-tree/api/treeNodeApi.js +9 -5
  134. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  135. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  136. package/dist/simple-tree/api/verboseTree.js +5 -4
  137. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  138. package/dist/simple-tree/api/view.js +1 -1
  139. package/dist/simple-tree/api/view.js.map +1 -1
  140. package/dist/simple-tree/arrayNode.js +2 -2
  141. package/dist/simple-tree/arrayNode.js.map +1 -1
  142. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  143. package/dist/simple-tree/core/getOrCreateNode.js +1 -1
  144. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  145. package/dist/simple-tree/core/schemaCaching.js +1 -1
  146. package/dist/simple-tree/core/schemaCaching.js.map +1 -1
  147. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  148. package/dist/simple-tree/core/treeNodeKernel.js +6 -6
  149. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  150. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  151. package/dist/simple-tree/core/unhydratedFlexTree.js +5 -5
  152. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  153. package/dist/simple-tree/objectNode.js +2 -2
  154. package/dist/simple-tree/objectNode.js.map +1 -1
  155. package/dist/simple-tree/proxies.js +1 -1
  156. package/dist/simple-tree/proxies.js.map +1 -1
  157. package/dist/simple-tree/toMapTree.js +3 -3
  158. package/dist/simple-tree/toMapTree.js.map +1 -1
  159. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  160. package/dist/simple-tree/toStoredSchema.js +2 -1
  161. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  162. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  163. package/dist/simple-tree/treeNodeValid.js +5 -2
  164. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  165. package/dist/util/idAllocator.js +1 -1
  166. package/dist/util/idAllocator.js.map +1 -1
  167. package/dist/util/index.d.ts +2 -2
  168. package/dist/util/index.d.ts.map +1 -1
  169. package/dist/util/index.js +4 -4
  170. package/dist/util/index.js.map +1 -1
  171. package/dist/util/nestedMap.d.ts +2 -10
  172. package/dist/util/nestedMap.d.ts.map +1 -1
  173. package/dist/util/nestedMap.js +9 -28
  174. package/dist/util/nestedMap.js.map +1 -1
  175. package/dist/util/utils.d.ts +7 -6
  176. package/dist/util/utils.d.ts.map +1 -1
  177. package/dist/util/utils.js +18 -13
  178. package/dist/util/utils.js.map +1 -1
  179. package/lib/alpha.d.ts +1 -0
  180. package/lib/codec/codec.js +3 -3
  181. package/lib/codec/codec.js.map +1 -1
  182. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  183. package/lib/codec/discriminatedUnions.js +1 -1
  184. package/lib/codec/discriminatedUnions.js.map +1 -1
  185. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  186. package/lib/core/schema-stored/schema.js +3 -3
  187. package/lib/core/schema-stored/schema.js.map +1 -1
  188. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  189. package/lib/core/tree/anchorSet.js +5 -4
  190. package/lib/core/tree/anchorSet.js.map +1 -1
  191. package/lib/core/tree/treeTextFormat.js +1 -1
  192. package/lib/core/tree/treeTextFormat.js.map +1 -1
  193. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  194. package/lib/feature-libraries/chunked-forest/basicChunk.js +11 -8
  195. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  196. package/lib/feature-libraries/chunked-forest/chunkTree.js +2 -2
  197. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  198. package/lib/feature-libraries/chunked-forest/chunkedForest.js +3 -3
  199. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  200. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +2 -2
  201. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  202. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  203. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -3
  204. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  205. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  206. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  207. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +1 -1
  208. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js +3 -3
  209. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +1 -1
  210. package/lib/feature-libraries/chunked-forest/emptyChunk.js +14 -14
  211. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  212. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  213. package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  214. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  215. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  216. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  217. package/lib/feature-libraries/default-schema/schemaChecker.js +1 -1
  218. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  219. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  220. package/lib/feature-libraries/flex-tree/lazyField.js +4 -3
  221. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  222. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  223. package/lib/feature-libraries/flex-tree/lazyNode.js +5 -4
  224. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  225. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  226. package/lib/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  227. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  228. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  229. package/lib/feature-libraries/modular-schema/comparison.js +6 -4
  230. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  231. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  232. package/lib/feature-libraries/modular-schema/isNeverTree.js +4 -4
  233. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  234. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
  235. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  236. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  237. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +6 -6
  238. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  239. package/lib/feature-libraries/node-key/mockNodeKeyManager.js +1 -1
  240. package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +1 -1
  241. package/lib/feature-libraries/object-forest/objectForest.js +1 -1
  242. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  243. package/lib/feature-libraries/schema-index/codec.js +1 -1
  244. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  245. package/lib/feature-libraries/sequence-field/compose.js +1 -1
  246. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  247. package/lib/feature-libraries/sequence-field/invert.js +1 -1
  248. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  249. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  250. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  251. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  252. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  253. package/lib/feature-libraries/sequence-field/utils.js +1 -1
  254. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  255. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  256. package/lib/feature-libraries/treeCursorUtils.js +6 -4
  257. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  258. package/lib/index.d.ts +3 -1
  259. package/lib/index.d.ts.map +1 -1
  260. package/lib/index.js +2 -0
  261. package/lib/index.js.map +1 -1
  262. package/lib/jsonDomainSchema.d.ts +113 -0
  263. package/lib/jsonDomainSchema.d.ts.map +1 -0
  264. package/lib/jsonDomainSchema.js +98 -0
  265. package/lib/jsonDomainSchema.js.map +1 -0
  266. package/lib/packageVersion.d.ts +1 -1
  267. package/lib/packageVersion.d.ts.map +1 -1
  268. package/lib/packageVersion.js +1 -1
  269. package/lib/packageVersion.js.map +1 -1
  270. package/lib/serializableDomainSchema.d.ts +108 -0
  271. package/lib/serializableDomainSchema.d.ts.map +1 -0
  272. package/lib/serializableDomainSchema.js +87 -0
  273. package/lib/serializableDomainSchema.js.map +1 -0
  274. package/lib/shared-tree/index.d.ts +1 -1
  275. package/lib/shared-tree/index.d.ts.map +1 -1
  276. package/lib/shared-tree/index.js.map +1 -1
  277. package/lib/shared-tree/schematizeTree.js +1 -1
  278. package/lib/shared-tree/schematizeTree.js.map +1 -1
  279. package/lib/shared-tree/sharedTree.d.ts +35 -19
  280. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  281. package/lib/shared-tree/sharedTree.js +15 -18
  282. package/lib/shared-tree/sharedTree.js.map +1 -1
  283. package/lib/shared-tree/sharedTreeChangeFamily.js +1 -1
  284. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  285. package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
  286. package/lib/shared-tree/treeApiAlpha.js +4 -4
  287. package/lib/shared-tree/treeApiAlpha.js.map +1 -1
  288. package/lib/shared-tree/treeCheckout.js +1 -1
  289. package/lib/shared-tree/treeCheckout.js.map +1 -1
  290. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  291. package/lib/shared-tree-core/editManager.js +8 -7
  292. package/lib/shared-tree-core/editManager.js.map +1 -1
  293. package/lib/shared-tree-core/sharedTreeCore.d.ts +1 -2
  294. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  295. package/lib/shared-tree-core/sharedTreeCore.js +2 -2
  296. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  297. package/lib/simple-tree/api/customTree.js +3 -3
  298. package/lib/simple-tree/api/customTree.js.map +1 -1
  299. package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
  300. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  301. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +1 -1
  302. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  303. package/lib/simple-tree/api/simpleTreeIndex.js +3 -3
  304. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  305. package/lib/simple-tree/api/tree.js +1 -1
  306. package/lib/simple-tree/api/tree.js.map +1 -1
  307. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  308. package/lib/simple-tree/api/treeNodeApi.js +9 -5
  309. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  310. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  311. package/lib/simple-tree/api/verboseTree.js +5 -4
  312. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  313. package/lib/simple-tree/api/view.js +1 -1
  314. package/lib/simple-tree/api/view.js.map +1 -1
  315. package/lib/simple-tree/arrayNode.js +2 -2
  316. package/lib/simple-tree/arrayNode.js.map +1 -1
  317. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  318. package/lib/simple-tree/core/getOrCreateNode.js +1 -1
  319. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  320. package/lib/simple-tree/core/schemaCaching.js +1 -1
  321. package/lib/simple-tree/core/schemaCaching.js.map +1 -1
  322. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  323. package/lib/simple-tree/core/treeNodeKernel.js +6 -6
  324. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  325. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  326. package/lib/simple-tree/core/unhydratedFlexTree.js +5 -5
  327. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  328. package/lib/simple-tree/objectNode.js +2 -2
  329. package/lib/simple-tree/objectNode.js.map +1 -1
  330. package/lib/simple-tree/proxies.js +1 -1
  331. package/lib/simple-tree/proxies.js.map +1 -1
  332. package/lib/simple-tree/toMapTree.js +3 -3
  333. package/lib/simple-tree/toMapTree.js.map +1 -1
  334. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  335. package/lib/simple-tree/toStoredSchema.js +2 -1
  336. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  337. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  338. package/lib/simple-tree/treeNodeValid.js +5 -2
  339. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  340. package/lib/util/idAllocator.js +1 -1
  341. package/lib/util/idAllocator.js.map +1 -1
  342. package/lib/util/index.d.ts +2 -2
  343. package/lib/util/index.d.ts.map +1 -1
  344. package/lib/util/index.js +2 -2
  345. package/lib/util/index.js.map +1 -1
  346. package/lib/util/nestedMap.d.ts +2 -10
  347. package/lib/util/nestedMap.d.ts.map +1 -1
  348. package/lib/util/nestedMap.js +5 -23
  349. package/lib/util/nestedMap.js.map +1 -1
  350. package/lib/util/utils.d.ts +7 -6
  351. package/lib/util/utils.d.ts.map +1 -1
  352. package/lib/util/utils.js +15 -11
  353. package/lib/util/utils.js.map +1 -1
  354. package/package.json +22 -22
  355. package/src/codec/codec.ts +3 -3
  356. package/src/codec/discriminatedUnions.ts +2 -1
  357. package/src/core/schema-stored/schema.ts +5 -3
  358. package/src/core/tree/anchorSet.ts +5 -4
  359. package/src/core/tree/treeTextFormat.ts +1 -1
  360. package/src/feature-libraries/chunked-forest/basicChunk.ts +11 -8
  361. package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -2
  362. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -3
  363. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -2
  364. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +4 -3
  365. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +2 -2
  366. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncoding.ts +4 -3
  367. package/src/feature-libraries/chunked-forest/emptyChunk.ts +14 -14
  368. package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
  369. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  370. package/src/feature-libraries/default-schema/schemaChecker.ts +1 -1
  371. package/src/feature-libraries/flex-tree/lazyField.ts +6 -8
  372. package/src/feature-libraries/flex-tree/lazyNode.ts +6 -4
  373. package/src/feature-libraries/indexing/anchorTreeIndex.ts +2 -1
  374. package/src/feature-libraries/modular-schema/comparison.ts +7 -5
  375. package/src/feature-libraries/modular-schema/isNeverTree.ts +6 -4
  376. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +4 -4
  377. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +7 -6
  378. package/src/feature-libraries/node-key/mockNodeKeyManager.ts +1 -1
  379. package/src/feature-libraries/object-forest/objectForest.ts +1 -1
  380. package/src/feature-libraries/schema-index/codec.ts +1 -1
  381. package/src/feature-libraries/sequence-field/compose.ts +1 -1
  382. package/src/feature-libraries/sequence-field/invert.ts +1 -1
  383. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +1 -1
  384. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +1 -1
  385. package/src/feature-libraries/sequence-field/utils.ts +1 -1
  386. package/src/feature-libraries/treeCursorUtils.ts +6 -4
  387. package/src/index.ts +3 -1
  388. package/src/jsonDomainSchema.ts +129 -0
  389. package/src/packageVersion.ts +1 -1
  390. package/src/serializableDomainSchema.ts +121 -0
  391. package/src/shared-tree/index.ts +0 -1
  392. package/src/shared-tree/schematizeTree.ts +1 -1
  393. package/src/shared-tree/sharedTree.ts +26 -41
  394. package/src/shared-tree/sharedTreeChangeFamily.ts +1 -1
  395. package/src/shared-tree/treeApiAlpha.ts +12 -4
  396. package/src/shared-tree/treeCheckout.ts +1 -1
  397. package/src/shared-tree-core/editManager.ts +8 -7
  398. package/src/shared-tree-core/sharedTreeCore.ts +6 -4
  399. package/src/simple-tree/api/customTree.ts +3 -3
  400. package/src/simple-tree/api/schemaCreationUtilities.ts +1 -1
  401. package/src/simple-tree/api/schemaFactoryRecursive.ts +1 -1
  402. package/src/simple-tree/api/simpleTreeIndex.ts +3 -3
  403. package/src/simple-tree/api/tree.ts +1 -1
  404. package/src/simple-tree/api/treeNodeApi.ts +11 -6
  405. package/src/simple-tree/api/verboseTree.ts +8 -4
  406. package/src/simple-tree/api/view.ts +1 -1
  407. package/src/simple-tree/arrayNode.ts +2 -2
  408. package/src/simple-tree/core/getOrCreateNode.ts +2 -1
  409. package/src/simple-tree/core/schemaCaching.ts +1 -1
  410. package/src/simple-tree/core/treeNodeKernel.ts +9 -6
  411. package/src/simple-tree/core/unhydratedFlexTree.ts +7 -5
  412. package/src/simple-tree/objectNode.ts +2 -2
  413. package/src/simple-tree/proxies.ts +1 -1
  414. package/src/simple-tree/toMapTree.ts +3 -3
  415. package/src/simple-tree/toStoredSchema.ts +2 -1
  416. package/src/simple-tree/treeNodeValid.ts +5 -2
  417. package/src/util/idAllocator.ts +1 -1
  418. package/src/util/index.ts +2 -2
  419. package/src/util/nestedMap.ts +9 -33
  420. package/src/util/utils.ts +20 -12
@@ -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 {
@@ -52,10 +52,10 @@ export const emptyCursor: ChunkedCursor = {
52
52
  mode: CursorLocationType.Fields,
53
53
  [cursorChunk]: emptyChunk,
54
54
  nextField(): boolean {
55
- fail("cannot navigate above root");
55
+ fail(0xafb /* cannot navigate above root */);
56
56
  },
57
57
  exitField(): void {
58
- fail("cannot navigate above root");
58
+ fail(0xafc /* cannot navigate above root */);
59
59
  },
60
60
  skipPendingFields(): boolean {
61
61
  return true;
@@ -70,43 +70,43 @@ export const emptyCursor: ChunkedCursor = {
70
70
  return false;
71
71
  },
72
72
  enterNode(childIndex: number): void {
73
- fail("empty cursor has no nodes");
73
+ fail(0xafd /* empty cursor has no nodes */);
74
74
  },
75
75
  getFieldPath(prefix?: PathRootPrefix): FieldUpPath {
76
76
  return prefixFieldPath(prefix, emptyPath);
77
77
  },
78
78
  getPath(): UpPath | undefined {
79
- fail("empty cursor has no nodes");
79
+ fail(0xafe /* empty cursor has no nodes */);
80
80
  },
81
81
  get fieldIndex(): never {
82
- return fail("empty cursor has no nodes");
82
+ return fail(0xaff /* empty cursor has no nodes */);
83
83
  },
84
84
  get chunkStart(): never {
85
- return fail("empty cursor has no nodes");
85
+ return fail(0xb00 /* empty cursor has no nodes */);
86
86
  },
87
87
  get chunkLength(): never {
88
- return fail("empty cursor has no nodes");
88
+ return fail(0xb01 /* empty cursor has no nodes */);
89
89
  },
90
90
  seekNodes(offset: number): boolean {
91
- fail("empty cursor has no nodes");
91
+ fail(0xb02 /* empty cursor has no nodes */);
92
92
  },
93
93
  nextNode(): boolean {
94
- fail("empty cursor has no nodes");
94
+ fail(0xb03 /* empty cursor has no nodes */);
95
95
  },
96
96
  exitNode(): void {
97
- fail("empty cursor has no nodes");
97
+ fail(0xb04 /* empty cursor has no nodes */);
98
98
  },
99
99
  firstField(): boolean {
100
- fail("empty cursor has no nodes");
100
+ fail(0xb05 /* empty cursor has no nodes */);
101
101
  },
102
102
  enterField(key: FieldKey): void {
103
- fail("empty cursor has no nodes");
103
+ fail(0xb06 /* empty cursor has no nodes */);
104
104
  },
105
105
  get type(): never {
106
- return fail("empty cursor has no nodes");
106
+ return fail(0xb07 /* empty cursor has no nodes */);
107
107
  },
108
108
  get value(): never {
109
- return fail("empty cursor has no nodes");
109
+ return fail(0xb08 /* empty cursor has no nodes */);
110
110
  },
111
111
  atChunkRoot(): boolean {
112
112
  return true;
@@ -382,7 +382,7 @@ class Cursor extends SynchronousCursor implements ChunkedCursor {
382
382
  }
383
383
 
384
384
  public getFieldKey(): FieldKey {
385
- return this.fieldKey ?? fail("not in a field");
385
+ return this.fieldKey ?? fail(0xb09 /* not in a field */);
386
386
  }
387
387
 
388
388
  public getFieldLength(): number {
@@ -510,11 +510,13 @@ class Cursor extends SynchronousCursor implements ChunkedCursor {
510
510
  public exitNode(): void {
511
511
  const info = this.nodeInfo(CursorLocationType.Nodes);
512
512
  this.indexOfField =
513
- info.indexOfParentField ?? fail("navigation up to root field not yet supported"); // TODO;
513
+ info.indexOfParentField ??
514
+ fail(0xb0a /* navigation up to root field not yet supported */); // TODO;
514
515
  this.fieldKey = info.parentField;
515
516
  this.mode = CursorLocationType.Fields;
516
517
  this.moveToPosition(
517
- info.indexOfParentPosition ?? fail("navigation up to root field not yet supported"),
518
+ info.indexOfParentPosition ??
519
+ fail(0xb0b /* navigation up to root field not yet supported */),
518
520
  ); // TODO
519
521
  }
520
522
 
@@ -536,7 +538,7 @@ class Cursor extends SynchronousCursor implements ChunkedCursor {
536
538
  this.indexOfField =
537
539
  fieldInfo === undefined
538
540
  ? fieldMap.size
539
- : (fieldInfo.indexOfParentField ?? fail("children should have parents"));
541
+ : (fieldInfo.indexOfParentField ?? fail(0xb0c /* children should have parents */));
540
542
  this.fieldKey = key;
541
543
  this.mode = CursorLocationType.Fields;
542
544
  }
@@ -42,7 +42,7 @@ export const noChangeHandler: FieldChangeHandler<0> = {
42
42
  rebase: (change: 0, over: 0) => 0,
43
43
  }),
44
44
  codecsFactory: () => noChangeCodecFamily,
45
- editor: { buildChildChanges: () => fail("Child changes not supported") },
45
+ editor: { buildChildChanges: () => fail(0xb0d /* Child changes not supported */) },
46
46
  intoDelta: (change, deltaFromChild: ToDelta): FieldChangeDelta => ({}),
47
47
  relevantRemovedRoots: (change): Iterable<DeltaDetachedNodeId> => [],
48
48
  isEmpty: (change: 0) => true,
@@ -90,7 +90,7 @@ export function isNodeInSchema(
90
90
  }
91
91
  }
92
92
  } else {
93
- fail("Unknown TreeNodeStoredSchema type");
93
+ fail(0xb0e /* Unknown TreeNodeStoredSchema type */);
94
94
  }
95
95
 
96
96
  return SchemaValidationErrors.NoError;
@@ -82,12 +82,9 @@ export function makeField(
82
82
 
83
83
  const makeFlexTreeField = (): FlexTreeField => {
84
84
  usedAnchor = true;
85
- const field = new (kindToClass.get(schema) ?? fail("missing field implementation"))(
86
- context,
87
- schema,
88
- cursor,
89
- fieldAnchor,
90
- );
85
+ const field = new (
86
+ kindToClass.get(schema) ?? fail(0xb0f /* missing field implementation */)
87
+ )(context, schema, cursor, fieldAnchor);
91
88
  return field;
92
89
  };
93
90
 
@@ -97,7 +94,8 @@ export function makeField(
97
94
 
98
95
  // For the common case (all but roots), cache field associated with its node's anchor and field key.
99
96
  const anchorNode =
100
- context.checkout.forest.anchors.locate(fieldAnchor.parent) ?? fail("missing anchor");
97
+ context.checkout.forest.anchors.locate(fieldAnchor.parent) ??
98
+ fail(0xb10 /* missing anchor */);
101
99
 
102
100
  // Since anchor-set could be reused across a flex tree context getting disposed, key off the flex tree node not the anchor.
103
101
  const cacheKey = anchorNode.slots.get(flexTreeSlot);
@@ -150,7 +148,7 @@ export abstract class LazyField extends LazyEntity<FieldAnchor> implements FlexT
150
148
  if (fieldAnchor.parent !== undefined) {
151
149
  const anchorNode =
152
150
  context.checkout.forest.anchors.locate(fieldAnchor.parent) ??
153
- fail("parent anchor node should always exist since field is under a node");
151
+ fail(0xb11 /* parent anchor node should always exist since field is under a node */);
154
152
  this.offAfterDestroy = anchorNode.events.on("afterDestroy", () => {
155
153
  this[disposeSymbol]();
156
154
  });
@@ -48,7 +48,7 @@ export function makeTree(context: Context, cursor: ITreeSubscriptionCursor): Laz
48
48
  const anchor = cursor.buildAnchor();
49
49
  const anchorNode =
50
50
  context.checkout.forest.anchors.locate(anchor) ??
51
- fail("cursor should point to a node that is not the root of the AnchorSet");
51
+ fail(0xb12 /* cursor should point to a node that is not the root of the AnchorSet */);
52
52
  const cached = anchorNode.slots.get(flexTreeSlot);
53
53
  if (cached !== undefined) {
54
54
  context.checkout.forest.anchors.forget(anchor);
@@ -60,7 +60,8 @@ export function makeTree(context: Context, cursor: ITreeSubscriptionCursor): Laz
60
60
  }
61
61
 
62
62
  function cleanupTree(anchor: AnchorNode): void {
63
- const cached = anchor.slots.get(flexTreeSlot) ?? fail("tree should only be cleaned up once");
63
+ const cached =
64
+ anchor.slots.get(flexTreeSlot) ?? fail(0xb13 /* tree should only be cleaned up once */);
64
65
  assert(cached instanceof LazyTreeNode, 0x92d /* Expected LazyTreeNode */);
65
66
  cached[disposeSymbol]();
66
67
  }
@@ -86,7 +87,8 @@ export class LazyTreeNode extends LazyEntity<Anchor> implements FlexTreeNode {
86
87
  anchor: Anchor,
87
88
  ) {
88
89
  super(context, cursor, anchor);
89
- this.storedSchema = context.schema.nodeSchema.get(this.schema) ?? fail("missing schema");
90
+ this.storedSchema =
91
+ context.schema.nodeSchema.get(this.schema) ?? fail(0xb14 /* missing schema */);
90
92
  assert(cursor.mode === CursorLocationType.Nodes, 0x783 /* must be in nodes mode */);
91
93
  anchorNode.slots.set(flexTreeSlot, this);
92
94
  this.#removeDeleteCallback = anchorNode.events.on("afterDestroy", cleanupTree);
@@ -180,7 +182,7 @@ export class LazyTreeNode extends LazyEntity<Anchor> implements FlexTreeNode {
180
182
  cursor.enterField(key);
181
183
  const nodeSchema =
182
184
  this.context.schema.nodeSchema.get(parentType) ??
183
- fail("requested schema that does not exist");
185
+ fail(0xb15 /* requested schema that does not exist */);
184
186
  fieldSchema = nodeSchema.getFieldSchema(key).kind;
185
187
  }
186
188
 
@@ -359,7 +359,8 @@ export class AnchorTreeIndex<TKey extends TreeIndexKey, TValue>
359
359
  throw new Error("key finder should be pure and functional");
360
360
  }
361
361
  const anchor = nodeCursor.buildAnchor();
362
- const anchorNode = this.forest.anchors.locate(anchor) ?? fail("expected anchor node");
362
+ const anchorNode =
363
+ this.forest.anchors.locate(anchor) ?? fail(0xb16 /* expected anchor node */);
363
364
 
364
365
  // check if this anchor node already exists in the index
365
366
  const existingKey = this.nodeToKey.get(anchorNode);
@@ -104,7 +104,8 @@ export function allowsTreeSuperset(
104
104
  allowsFieldSuperset(
105
105
  policy,
106
106
  originalData,
107
- original.objectNodeFields.get(originalField) ?? fail("missing expected field"),
107
+ original.objectNodeFields.get(originalField) ??
108
+ fail(0xb17 /* missing expected field */),
108
109
  normalizeField(undefined),
109
110
  ),
110
111
  bExtra: (supersetField) =>
@@ -112,14 +113,15 @@ export function allowsTreeSuperset(
112
113
  policy,
113
114
  originalData,
114
115
  normalizeField(undefined),
115
- superset.objectNodeFields.get(supersetField) ?? fail("missing expected field"),
116
+ superset.objectNodeFields.get(supersetField) ??
117
+ fail(0xb18 /* missing expected field */),
116
118
  ),
117
119
  same: (sameField) =>
118
120
  allowsFieldSuperset(
119
121
  policy,
120
122
  originalData,
121
- original.objectNodeFields.get(sameField) ?? fail("missing expected field"),
122
- superset.objectNodeFields.get(sameField) ?? fail("missing expected field"),
123
+ original.objectNodeFields.get(sameField) ?? fail(0xb19 /* missing expected field */),
124
+ superset.objectNodeFields.get(sameField) ?? fail(0xb1a /* missing expected field */),
123
125
  ),
124
126
  });
125
127
  }
@@ -148,7 +150,7 @@ export function allowsFieldSuperset(
148
150
  superset: TreeFieldStoredSchema,
149
151
  ): boolean {
150
152
  return withEditor(
151
- policy.fieldKinds.get(original.kind) ?? fail("missing kind"),
153
+ policy.fieldKinds.get(original.kind) ?? fail(0xb1b /* missing kind */),
152
154
  ).allowsFieldSuperset(policy, originalData, original.types, superset);
153
155
  }
154
156
 
@@ -35,8 +35,8 @@ export function isNeverFieldRecursive(
35
35
  parentTypeStack: Set<TreeNodeStoredSchema>,
36
36
  ): boolean {
37
37
  if (
38
- (policy.fieldKinds.get(field.kind) ?? fail("missing field kind")).multiplicity ===
39
- Multiplicity.Single &&
38
+ (policy.fieldKinds.get(field.kind) ?? fail(0xb1c /* missing field kind */))
39
+ .multiplicity === Multiplicity.Single &&
40
40
  field.types !== undefined
41
41
  ) {
42
42
  for (const type of field.types) {
@@ -94,8 +94,10 @@ export function isNeverTreeRecursive(
94
94
  parentTypeStack.add(treeNode);
95
95
  if (treeNode instanceof MapNodeStoredSchema) {
96
96
  return (
97
- (policy.fieldKinds.get(treeNode.mapFields.kind) ?? fail("missing field kind"))
98
- .multiplicity === Multiplicity.Single
97
+ (
98
+ policy.fieldKinds.get(treeNode.mapFields.kind) ??
99
+ fail(0xb1d /* missing field kind */)
100
+ ).multiplicity === Multiplicity.Single
99
101
  );
100
102
  } else if (treeNode instanceof ObjectNodeStoredSchema) {
101
103
  for (const field of treeNode.objectNodeFields.values()) {
@@ -177,7 +177,7 @@ function makeModularChangeCodec(
177
177
  return encodeNodeChangesForJson(node, fieldContext);
178
178
  },
179
179
 
180
- decodeNode: () => fail("Should not decode nodes during field encoding"),
180
+ decodeNode: () => fail(0xb1e /* Should not decode nodes during field encoding */),
181
181
  };
182
182
 
183
183
  return encodeFieldChangesForJsonI(change, fieldContext);
@@ -193,7 +193,7 @@ function makeModularChangeCodec(
193
193
  const { codec, compiledSchema } = getFieldChangesetCodec(fieldChange.fieldKind);
194
194
  const encodedChange = codec.json.encode(fieldChange.change, context);
195
195
  if (compiledSchema !== undefined && !compiledSchema.check(encodedChange)) {
196
- fail("Encoded change didn't pass schema validation.");
196
+ fail(0xb1f /* Encoded change didn't pass schema validation. */);
197
197
  }
198
198
 
199
199
  const fieldKey: FieldKey = field;
@@ -238,7 +238,7 @@ function makeModularChangeCodec(
238
238
  for (const field of encodedChange) {
239
239
  const { codec, compiledSchema } = getFieldChangesetCodec(field.fieldKind);
240
240
  if (compiledSchema !== undefined && !compiledSchema.check(field.change)) {
241
- fail("Encoded change didn't pass schema validation.");
241
+ fail(0xb20 /* Encoded change didn't pass schema validation. */);
242
242
  }
243
243
 
244
244
  const fieldId: FieldId = {
@@ -249,7 +249,7 @@ function makeModularChangeCodec(
249
249
  const fieldContext: FieldChangeEncodingContext = {
250
250
  baseContext: context,
251
251
 
252
- encodeNode: () => fail("Should not encode nodes during field decoding"),
252
+ encodeNode: () => fail(0xb21 /* Should not encode nodes during field decoding */),
253
253
 
254
254
  decodeNode: (encodedNode: EncodedNodeChangeset): NodeId => {
255
255
  const nodeId: NodeId = {
@@ -52,7 +52,7 @@ import {
52
52
  idAllocatorFromMaxId,
53
53
  idAllocatorFromState,
54
54
  type RangeQueryResult,
55
- getOrAddInMapLazy,
55
+ getOrCreate,
56
56
  newTupleBTree,
57
57
  mergeTupleBTrees,
58
58
  type TupleBTree,
@@ -321,7 +321,7 @@ export class ModularChangeFamily
321
321
  crossFieldTable.pendingCompositions.nodeIdsToCompose.push([child1, child2]);
322
322
  }
323
323
 
324
- return child1 ?? child2 ?? fail("Should not compose two undefined nodes");
324
+ return child1 ?? child2 ?? fail(0xb22 /* Should not compose two undefined nodes */);
325
325
  };
326
326
 
327
327
  const amendedChange = rebaser.compose(
@@ -566,7 +566,7 @@ export class ModularChangeFamily
566
566
  setInChangeAtomIdMap(crossFieldTable.newToBaseNodeId, child2, child1);
567
567
  crossFieldTable.pendingCompositions.nodeIdsToCompose.push([child1, child2]);
568
568
  }
569
- return child1 ?? child2 ?? fail("Should not compose two undefined nodes");
569
+ return child1 ?? child2 ?? fail(0xb23 /* Should not compose two undefined nodes */);
570
570
  },
571
571
  idAllocator,
572
572
  manager,
@@ -1426,7 +1426,8 @@ export class ModularChangeFamily
1426
1426
  constraintState: ConstraintState,
1427
1427
  revertConstraintState: ConstraintState,
1428
1428
  ): void {
1429
- const node = nodes.get([nodeId.revision, nodeId.localId]) ?? fail("Unknown node ID");
1429
+ const node =
1430
+ nodes.get([nodeId.revision, nodeId.localId]) ?? fail(0xb24 /* Unknown node ID */);
1430
1431
  if (node.nodeExistsConstraint !== undefined) {
1431
1432
  const isNowViolated = inputAttachState === NodeAttachState.Detached;
1432
1433
  if (node.nodeExistsConstraint.violated !== isNowViolated) {
@@ -1924,7 +1925,7 @@ export function updateRefreshers(
1924
1925
 
1925
1926
  if (change.builds !== undefined) {
1926
1927
  for (const [[revision, id], chunk] of change.builds.entries()) {
1927
- const lengthTree = getOrAddInMapLazy(chunkLengths, revision, () => new BTree());
1928
+ const lengthTree = getOrCreate(chunkLengths, revision, () => new BTree());
1928
1929
  lengthTree.set(id, chunk.topLevelLength);
1929
1930
  }
1930
1931
  }
@@ -3002,7 +3003,7 @@ function fieldChangeFromId(
3002
3003
  id: FieldId,
3003
3004
  ): FieldChange {
3004
3005
  const fieldMap = fieldMapFromNodeId(fields, nodes, id.nodeId);
3005
- return fieldMap.get(id.field) ?? fail("No field exists for the given ID");
3006
+ return fieldMap.get(id.field) ?? fail(0xb25 /* No field exists for the given ID */);
3006
3007
  }
3007
3008
 
3008
3009
  function fieldMapFromNodeId(
@@ -27,7 +27,7 @@ export class MockNodeKeyManager implements NodeKeyManager {
27
27
  }
28
28
 
29
29
  public localizeNodeKey(key: StableNodeKey): LocalNodeKey {
30
- return this.tryLocalizeNodeKey(key) ?? fail("Key is not compressible");
30
+ return this.tryLocalizeNodeKey(key) ?? fail(0xb26 /* Key is not compressible */);
31
31
  }
32
32
 
33
33
  public stabilizeNodeKey(key: LocalNodeKey): StableNodeKey {
@@ -439,7 +439,7 @@ class Cursor extends SynchronousCursor implements ITreeSubscriptionCursor {
439
439
  }
440
440
  public getPath(prefix?: PathRootPrefix): UpPath {
441
441
  assert(this.innerCursor !== undefined, 0x436 /* Cursor must be current to be used */);
442
- return this.innerCursor.getPath(prefix) ?? fail("no path when at root");
442
+ return this.innerCursor.getPath(prefix) ?? fail(0xb27 /* no path when at root */);
443
443
  }
444
444
  public get fieldIndex(): number {
445
445
  assert(this.innerCursor !== undefined, 0x437 /* Cursor must be current to be used */);
@@ -27,7 +27,7 @@ export function encodeRepo(repo: TreeStoredSchema): Format {
27
27
  Object.create(null);
28
28
  const rootFieldSchema = encodeFieldSchema(repo.rootFieldSchema);
29
29
  for (const name of [...repo.nodeSchema.keys()].sort()) {
30
- const schema = repo.nodeSchema.get(name) ?? fail("missing schema");
30
+ const schema = repo.nodeSchema.get(name) ?? fail(0xb28 /* missing schema */);
31
31
  Object.defineProperty(nodeSchema, name, {
32
32
  enumerable: true,
33
33
  configurable: true,
@@ -540,7 +540,7 @@ export class ComposeQueue {
540
540
  return this.dequeueBase();
541
541
  } else if (areOutputCellsEmpty(baseMark) && areInputCellsEmpty(newMark)) {
542
542
  const baseCellId: ChangeAtomId =
543
- getOutputCellId(baseMark) ?? fail("Expected defined output ID");
543
+ getOutputCellId(baseMark) ?? fail(0xb29 /* Expected defined output ID */);
544
544
 
545
545
  if (markEmptiesCells(baseMark) && baseCellId.revision === undefined) {
546
546
  // The base revision should always be defined except when squashing changes into a transaction.
@@ -176,7 +176,7 @@ function invertMark(
176
176
  }
177
177
 
178
178
  const cellId = getDetachOutputCellId(mark) ?? {
179
- revision: mark.revision ?? fail("Revision must be defined"),
179
+ revision: mark.revision ?? fail(0xb2a /* Revision must be defined */),
180
180
  localId: mark.id,
181
181
  };
182
182
 
@@ -145,7 +145,7 @@ export function makeV1Codec(
145
145
  context,
146
146
  );
147
147
  case NoopMarkType:
148
- fail("Mark type: NoopMarkType should not be encoded.");
148
+ fail(0xb2b /* Mark type: NoopMarkType should not be encoded. */);
149
149
  default:
150
150
  unreachableCase(type);
151
151
  }
@@ -132,7 +132,7 @@ export function makeV2CodecHelpers(
132
132
  context,
133
133
  );
134
134
  case NoopMarkType:
135
- fail("Mark type: NoopMarkType should not be encoded.");
135
+ fail(0xb2c /* Mark type: NoopMarkType should not be encoded. */);
136
136
  default:
137
137
  unreachableCase(type);
138
138
  }
@@ -747,7 +747,7 @@ export function splitMark<TMark extends Mark>(mark: TMark, length: number): [TMa
747
747
  const markLength = mark.count;
748
748
  const remainder = markLength - length;
749
749
  if (length < 1 || remainder < 1) {
750
- fail("Unable to split mark due to lengths");
750
+ fail(0xb2d /* Unable to split mark due to lengths */);
751
751
  }
752
752
 
753
753
  const [effect1, effect2] = splitMarkEffect(mark, length);
@@ -345,14 +345,16 @@ class StackCursor<TNode> extends SynchronousCursor implements CursorWithNode<TNo
345
345
 
346
346
  public exitField(): void {
347
347
  // assert(this.mode === CursorLocationType.Fields, "can only navigate up from field when in field");
348
- this.siblings = this.siblingStack.pop() ?? fail("Unexpected siblingStack.length");
349
- this.index = this.indexStack.pop() ?? fail("Unexpected indexStack.length");
348
+ this.siblings =
349
+ this.siblingStack.pop() ?? fail(0xac3 /* Unexpected siblingStack.length */);
350
+ this.index = this.indexStack.pop() ?? fail(0xac4 /* Unexpected indexStack.length */);
350
351
  }
351
352
 
352
353
  public exitNode(): void {
353
354
  // assert(this.mode === CursorLocationType.Nodes, "can only navigate up from node when in node");
354
- this.siblings = this.siblingStack.pop() ?? fail("Unexpected siblingStack.length");
355
- this.index = this.indexStack.pop() ?? fail("Unexpected indexStack.length");
355
+ this.siblings =
356
+ this.siblingStack.pop() ?? fail(0xac5 /* Unexpected siblingStack.length */);
357
+ this.index = this.indexStack.pop() ?? fail(0xac6 /* Unexpected indexStack.length */);
356
358
  }
357
359
 
358
360
  public getNode(): TNode {
package/src/index.ts CHANGED
@@ -73,7 +73,6 @@ export {
73
73
  ForestTypeOptimized,
74
74
  ForestTypeExpensiveDebug,
75
75
  ForestTypeReference,
76
- type IChannelView,
77
76
  } from "./shared-tree/index.js";
78
77
 
79
78
  export {
@@ -259,3 +258,6 @@ export {
259
258
  export type { MapNodeInsertableData } from "./simple-tree/index.js";
260
259
 
261
260
  export type { JsonCompatible, JsonCompatibleObject } from "./util/index.js";
261
+
262
+ export { JsonAsTree } from "./jsonDomainSchema.js";
263
+ export { FluidSerializableAsTree } from "./serializableDomainSchema.js";