@fluidframework/tree 2.23.0 → 2.31.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 (1027) hide show
  1. package/CHANGELOG.md +1636 -1466
  2. package/api-extractor/api-extractor.current.json +0 -3
  3. package/api-report/tree.alpha.api.md +261 -100
  4. package/api-report/tree.beta.api.md +86 -61
  5. package/api-report/tree.legacy.alpha.api.md +86 -61
  6. package/api-report/tree.legacy.public.api.md +86 -61
  7. package/api-report/tree.public.api.md +86 -61
  8. package/dist/alpha.d.ts +32 -1
  9. package/dist/beta.d.ts +5 -1
  10. package/dist/codec/codec.d.ts +1 -1
  11. package/dist/codec/codec.d.ts.map +1 -1
  12. package/dist/codec/codec.js +3 -4
  13. package/dist/codec/codec.js.map +1 -1
  14. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  15. package/dist/codec/discriminatedUnions.js +1 -1
  16. package/dist/codec/discriminatedUnions.js.map +1 -1
  17. package/dist/core/forest/editableForest.d.ts +1 -14
  18. package/dist/core/forest/editableForest.d.ts.map +1 -1
  19. package/dist/core/forest/editableForest.js +1 -28
  20. package/dist/core/forest/editableForest.js.map +1 -1
  21. package/dist/core/forest/forest.d.ts +16 -3
  22. package/dist/core/forest/forest.d.ts.map +1 -1
  23. package/dist/core/forest/forest.js +4 -1
  24. package/dist/core/forest/forest.js.map +1 -1
  25. package/dist/core/forest/index.d.ts +1 -1
  26. package/dist/core/forest/index.d.ts.map +1 -1
  27. package/dist/core/forest/index.js +1 -2
  28. package/dist/core/forest/index.js.map +1 -1
  29. package/dist/core/index.d.ts +2 -2
  30. package/dist/core/index.d.ts.map +1 -1
  31. package/dist/core/index.js +3 -3
  32. package/dist/core/index.js.map +1 -1
  33. package/dist/core/rebase/utils.js +1 -1
  34. package/dist/core/rebase/utils.js.map +1 -1
  35. package/dist/core/schema-stored/schema.d.ts +4 -1
  36. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  37. package/dist/core/schema-stored/schema.js +8 -4
  38. package/dist/core/schema-stored/schema.js.map +1 -1
  39. package/dist/core/tree/anchorSet.d.ts +8 -3
  40. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  41. package/dist/core/tree/anchorSet.js +16 -9
  42. package/dist/core/tree/anchorSet.js.map +1 -1
  43. package/dist/core/tree/delta.d.ts +8 -23
  44. package/dist/core/tree/delta.d.ts.map +1 -1
  45. package/dist/core/tree/delta.js.map +1 -1
  46. package/dist/core/tree/deltaUtil.d.ts +3 -3
  47. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  48. package/dist/core/tree/deltaUtil.js +2 -2
  49. package/dist/core/tree/deltaUtil.js.map +1 -1
  50. package/dist/core/tree/index.d.ts +2 -2
  51. package/dist/core/tree/index.d.ts.map +1 -1
  52. package/dist/core/tree/index.js +2 -1
  53. package/dist/core/tree/index.js.map +1 -1
  54. package/dist/core/tree/pathTree.d.ts +54 -1
  55. package/dist/core/tree/pathTree.d.ts.map +1 -1
  56. package/dist/core/tree/pathTree.js +8 -1
  57. package/dist/core/tree/pathTree.js.map +1 -1
  58. package/dist/core/tree/treeTextFormat.js +2 -2
  59. package/dist/core/tree/treeTextFormat.js.map +1 -1
  60. package/dist/core/tree/visitDelta.d.ts +7 -5
  61. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  62. package/dist/core/tree/visitDelta.js +19 -9
  63. package/dist/core/tree/visitDelta.js.map +1 -1
  64. package/dist/core/tree/visitorUtils.d.ts +5 -23
  65. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  66. package/dist/core/tree/visitorUtils.js +8 -5
  67. package/dist/core/tree/visitorUtils.js.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +1 -1
  69. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/basicChunk.js +9 -9
  71. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +5 -3
  73. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/chunkTree.js +12 -9
  75. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -0
  77. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/chunkedForest.js +8 -5
  79. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +3 -3
  81. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  82. package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
  83. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  84. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  85. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -4
  86. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  87. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  88. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  89. package/dist/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.d.ts → schemaBasedEncode.d.ts} +1 -1
  90. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -0
  91. package/dist/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.js → schemaBasedEncode.js} +4 -5
  92. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -0
  93. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  94. package/dist/feature-libraries/chunked-forest/emptyChunk.js +15 -15
  95. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  96. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +3 -2
  97. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  98. package/dist/feature-libraries/chunked-forest/uniformChunk.js +7 -6
  99. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  100. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -14
  101. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  102. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +5 -6
  103. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  104. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  105. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +19 -19
  106. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  107. package/dist/feature-libraries/default-schema/index.d.ts +1 -0
  108. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  109. package/dist/feature-libraries/default-schema/index.js +3 -1
  110. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  111. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts +21 -0
  112. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -0
  113. package/dist/feature-libraries/default-schema/mappedEditBuilder.js +57 -0
  114. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -0
  115. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  116. package/dist/feature-libraries/default-schema/schemaChecker.js +1 -2
  117. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  118. package/dist/feature-libraries/deltaUtils.js +1 -1
  119. package/dist/feature-libraries/deltaUtils.js.map +1 -1
  120. package/dist/feature-libraries/flex-tree/context.d.ts +5 -5
  121. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  122. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  123. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -2
  124. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  125. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  126. package/dist/feature-libraries/flex-tree/lazyField.d.ts +5 -4
  127. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  128. package/dist/feature-libraries/flex-tree/lazyField.js +12 -9
  129. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  130. package/dist/feature-libraries/flex-tree/lazyNode.js +4 -4
  131. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  132. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  133. package/dist/feature-libraries/forest-summary/forestSummarizer.js +4 -5
  134. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  135. package/dist/feature-libraries/index.d.ts +2 -1
  136. package/dist/feature-libraries/index.d.ts.map +1 -1
  137. package/dist/feature-libraries/index.js +9 -7
  138. package/dist/feature-libraries/index.js.map +1 -1
  139. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  140. package/dist/feature-libraries/indexing/anchorTreeIndex.js +1 -1
  141. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  142. package/dist/feature-libraries/initializeForest.d.ts +18 -0
  143. package/dist/feature-libraries/initializeForest.d.ts.map +1 -0
  144. package/dist/feature-libraries/initializeForest.js +35 -0
  145. package/dist/feature-libraries/initializeForest.js.map +1 -0
  146. package/dist/feature-libraries/modular-schema/comparison.js +4 -4
  147. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  148. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  149. package/dist/feature-libraries/modular-schema/isNeverTree.js +2 -3
  150. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  151. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  152. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +4 -4
  153. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  154. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -5
  155. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  156. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +13 -19
  157. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  158. package/dist/feature-libraries/node-identifier/index.d.ts +8 -0
  159. package/dist/feature-libraries/node-identifier/index.d.ts.map +1 -0
  160. package/dist/feature-libraries/node-identifier/index.js +16 -0
  161. package/dist/feature-libraries/node-identifier/index.js.map +1 -0
  162. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts +22 -0
  163. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -0
  164. package/dist/feature-libraries/{node-key/mockNodeKeyManager.js → node-identifier/mockNodeIdentifierManager.js} +18 -18
  165. package/dist/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -0
  166. package/dist/feature-libraries/node-identifier/nodeIdentifier.d.ts +38 -0
  167. package/dist/feature-libraries/node-identifier/nodeIdentifier.d.ts.map +1 -0
  168. package/dist/feature-libraries/node-identifier/nodeIdentifier.js +26 -0
  169. package/dist/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -0
  170. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts +37 -0
  171. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -0
  172. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js +48 -0
  173. package/dist/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -0
  174. package/dist/feature-libraries/object-forest/objectForest.d.ts +2 -1
  175. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  176. package/dist/feature-libraries/object-forest/objectForest.js +7 -3
  177. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  178. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  179. package/dist/feature-libraries/schema-index/codec.js +2 -1
  180. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  181. package/dist/feature-libraries/sequence-field/compose.d.ts +1 -1
  182. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  183. package/dist/feature-libraries/sequence-field/compose.js +16 -17
  184. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  185. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  186. package/dist/feature-libraries/sequence-field/invert.js +1 -1
  187. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  188. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  189. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +1 -1
  190. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  191. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  192. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +1 -1
  193. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  194. package/dist/feature-libraries/sequence-field/utils.js +1 -1
  195. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  196. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  197. package/dist/feature-libraries/treeCursorUtils.js +5 -6
  198. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  199. package/dist/index.d.ts +5 -4
  200. package/dist/index.d.ts.map +1 -1
  201. package/dist/index.js +15 -3
  202. package/dist/index.js.map +1 -1
  203. package/dist/jsonDomainSchema.d.ts +15 -16
  204. package/dist/jsonDomainSchema.d.ts.map +1 -1
  205. package/dist/jsonDomainSchema.js +10 -5
  206. package/dist/jsonDomainSchema.js.map +1 -1
  207. package/dist/legacy.d.ts +5 -1
  208. package/dist/packageVersion.d.ts +1 -1
  209. package/dist/packageVersion.js +1 -1
  210. package/dist/packageVersion.js.map +1 -1
  211. package/dist/public.d.ts +5 -1
  212. package/dist/serializableDomainSchema.d.ts +8 -14
  213. package/dist/serializableDomainSchema.d.ts.map +1 -1
  214. package/dist/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  215. package/dist/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  216. package/dist/shared-tree/checkoutFlexTreeView.js.map +1 -1
  217. package/dist/shared-tree/independentView.d.ts.map +1 -1
  218. package/dist/shared-tree/independentView.js +3 -18
  219. package/dist/shared-tree/independentView.js.map +1 -1
  220. package/dist/shared-tree/index.d.ts +1 -1
  221. package/dist/shared-tree/index.d.ts.map +1 -1
  222. package/dist/shared-tree/index.js +2 -1
  223. package/dist/shared-tree/index.js.map +1 -1
  224. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  225. package/dist/shared-tree/schematizeTree.js +4 -3
  226. package/dist/shared-tree/schematizeTree.js.map +1 -1
  227. package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
  228. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  229. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  230. package/dist/shared-tree/sharedTree.d.ts +1 -0
  231. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  232. package/dist/shared-tree/sharedTree.js +27 -19
  233. package/dist/shared-tree/sharedTree.js.map +1 -1
  234. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  235. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  236. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  237. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +1 -2
  238. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  239. package/dist/shared-tree/sharedTreeEditBuilder.js +2 -2
  240. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  241. package/dist/shared-tree/treeApiAlpha.d.ts +9 -30
  242. package/dist/shared-tree/treeApiAlpha.d.ts.map +1 -1
  243. package/dist/shared-tree/treeApiAlpha.js +22 -34
  244. package/dist/shared-tree/treeApiAlpha.js.map +1 -1
  245. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  246. package/dist/shared-tree/treeCheckout.js +2 -2
  247. package/dist/shared-tree/treeCheckout.js.map +1 -1
  248. package/dist/shared-tree-core/branch.d.ts +4 -3
  249. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  250. package/dist/shared-tree-core/branch.js +2 -2
  251. package/dist/shared-tree-core/branch.js.map +1 -1
  252. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  253. package/dist/shared-tree-core/editManager.js +37 -31
  254. package/dist/shared-tree-core/editManager.js.map +1 -1
  255. package/dist/sharedTreeAttributes.d.ts +18 -0
  256. package/dist/sharedTreeAttributes.d.ts.map +1 -0
  257. package/dist/sharedTreeAttributes.js +25 -0
  258. package/dist/sharedTreeAttributes.js.map +1 -0
  259. package/dist/simple-tree/api/conciseTree.d.ts +8 -2
  260. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  261. package/dist/simple-tree/api/conciseTree.js +10 -1
  262. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  263. package/dist/simple-tree/api/create.d.ts +3 -3
  264. package/dist/simple-tree/api/create.d.ts.map +1 -1
  265. package/dist/simple-tree/api/create.js.map +1 -1
  266. package/dist/simple-tree/api/customTree.d.ts +42 -12
  267. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  268. package/dist/simple-tree/api/customTree.js +33 -5
  269. package/dist/simple-tree/api/customTree.js.map +1 -1
  270. package/dist/simple-tree/api/getJsonSchema.d.ts +10 -0
  271. package/dist/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  272. package/dist/simple-tree/api/getJsonSchema.js +10 -0
  273. package/dist/simple-tree/api/getJsonSchema.js.map +1 -1
  274. package/dist/simple-tree/api/getSimpleSchema.d.ts +13 -43
  275. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  276. package/dist/simple-tree/api/getSimpleSchema.js +13 -43
  277. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  278. package/dist/simple-tree/api/index.d.ts +7 -6
  279. package/dist/simple-tree/api/index.d.ts.map +1 -1
  280. package/dist/simple-tree/api/index.js +8 -1
  281. package/dist/simple-tree/api/index.js.map +1 -1
  282. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  283. package/dist/simple-tree/api/schemaCreationUtilities.js +2 -2
  284. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  285. package/dist/simple-tree/api/schemaFactory.d.ts +112 -67
  286. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  287. package/dist/simple-tree/api/schemaFactory.js +80 -158
  288. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  289. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +38 -23
  290. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  291. package/dist/simple-tree/api/schemaFactoryAlpha.js +26 -1
  292. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  293. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts +40 -5
  294. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  295. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  296. package/dist/simple-tree/api/schemaFromSimple.d.ts +19 -0
  297. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -0
  298. package/dist/simple-tree/api/schemaFromSimple.js +71 -0
  299. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -0
  300. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +3 -2
  301. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  302. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +7 -6
  303. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  304. package/dist/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  305. package/dist/simple-tree/api/simpleTreeIndex.js +4 -3
  306. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  307. package/dist/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  308. package/dist/simple-tree/api/tree.d.ts +12 -6
  309. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  310. package/dist/simple-tree/api/tree.js +17 -8
  311. package/dist/simple-tree/api/tree.js.map +1 -1
  312. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  313. package/dist/simple-tree/api/treeNodeApi.js +5 -20
  314. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  315. package/dist/simple-tree/api/typesUnsafe.d.ts +102 -36
  316. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  317. package/dist/simple-tree/api/typesUnsafe.js +0 -1
  318. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  319. package/dist/simple-tree/api/verboseTree.d.ts +16 -25
  320. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -1
  321. package/dist/simple-tree/api/verboseTree.js +19 -14
  322. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  323. package/dist/simple-tree/api/view.d.ts.map +1 -1
  324. package/dist/simple-tree/api/view.js +16 -17
  325. package/dist/simple-tree/api/view.js.map +1 -1
  326. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +16 -3
  327. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  328. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +70 -147
  329. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  330. package/dist/simple-tree/arrayNode.d.ts +5 -4
  331. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  332. package/dist/simple-tree/arrayNode.js +13 -9
  333. package/dist/simple-tree/arrayNode.js.map +1 -1
  334. package/dist/simple-tree/arrayNodeTypes.d.ts +46 -0
  335. package/dist/simple-tree/arrayNodeTypes.d.ts.map +1 -0
  336. package/dist/simple-tree/arrayNodeTypes.js +30 -0
  337. package/dist/simple-tree/arrayNodeTypes.js.map +1 -0
  338. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  339. package/dist/simple-tree/core/getOrCreateNode.js +1 -11
  340. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  341. package/dist/simple-tree/core/index.d.ts +1 -2
  342. package/dist/simple-tree/core/index.d.ts.map +1 -1
  343. package/dist/simple-tree/core/index.js +2 -3
  344. package/dist/simple-tree/core/index.js.map +1 -1
  345. package/dist/simple-tree/core/treeNodeKernel.d.ts +12 -5
  346. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  347. package/dist/simple-tree/core/treeNodeKernel.js +36 -20
  348. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  349. package/dist/simple-tree/core/treeNodeSchema.d.ts +14 -7
  350. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  351. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  352. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +2 -2
  353. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  354. package/dist/simple-tree/core/unhydratedFlexTree.js +5 -5
  355. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  356. package/dist/simple-tree/flexList.d.ts +4 -5
  357. package/dist/simple-tree/flexList.d.ts.map +1 -1
  358. package/dist/simple-tree/flexList.js +1 -14
  359. package/dist/simple-tree/flexList.js.map +1 -1
  360. package/dist/simple-tree/index.d.ts +9 -2
  361. package/dist/simple-tree/index.d.ts.map +1 -1
  362. package/dist/simple-tree/index.js +15 -2
  363. package/dist/simple-tree/index.js.map +1 -1
  364. package/dist/simple-tree/leafNodeSchema.d.ts +22 -5
  365. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  366. package/dist/simple-tree/leafNodeSchema.js +2 -0
  367. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  368. package/dist/simple-tree/mapNode.d.ts +3 -2
  369. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  370. package/dist/simple-tree/mapNode.js +5 -1
  371. package/dist/simple-tree/mapNode.js.map +1 -1
  372. package/dist/simple-tree/mapNodeTypes.d.ts +46 -0
  373. package/dist/simple-tree/mapNodeTypes.d.ts.map +1 -0
  374. package/dist/simple-tree/mapNodeTypes.js +30 -0
  375. package/dist/simple-tree/mapNodeTypes.js.map +1 -0
  376. package/dist/simple-tree/objectNode.d.ts +10 -3
  377. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  378. package/dist/simple-tree/objectNode.js +12 -5
  379. package/dist/simple-tree/objectNode.js.map +1 -1
  380. package/dist/simple-tree/objectNodeTypes.d.ts +9 -5
  381. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  382. package/dist/simple-tree/objectNodeTypes.js +3 -0
  383. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  384. package/dist/simple-tree/proxies.js +2 -1
  385. package/dist/simple-tree/proxies.js.map +1 -1
  386. package/dist/simple-tree/schemaTypes.d.ts +81 -8
  387. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  388. package/dist/simple-tree/schemaTypes.js +94 -5
  389. package/dist/simple-tree/schemaTypes.js.map +1 -1
  390. package/dist/simple-tree/{api/simpleSchema.d.ts → simpleSchema.d.ts} +55 -28
  391. package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
  392. package/dist/simple-tree/simpleSchema.js.map +1 -0
  393. package/dist/simple-tree/toMapTree.d.ts +4 -4
  394. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  395. package/dist/simple-tree/toMapTree.js +3 -3
  396. package/dist/simple-tree/toMapTree.js.map +1 -1
  397. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  398. package/dist/simple-tree/toStoredSchema.js +2 -6
  399. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  400. package/dist/simple-tree/treeNodeValid.d.ts +7 -1
  401. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  402. package/dist/simple-tree/treeNodeValid.js +17 -10
  403. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  404. package/dist/treeFactory.d.ts +0 -12
  405. package/dist/treeFactory.d.ts.map +1 -1
  406. package/dist/treeFactory.js +5 -21
  407. package/dist/treeFactory.js.map +1 -1
  408. package/dist/util/cloneWithReplacements.d.ts +21 -0
  409. package/dist/util/cloneWithReplacements.d.ts.map +1 -0
  410. package/dist/util/cloneWithReplacements.js +38 -0
  411. package/dist/util/cloneWithReplacements.js.map +1 -0
  412. package/dist/util/idAllocator.d.ts.map +1 -1
  413. package/dist/util/idAllocator.js +1 -2
  414. package/dist/util/idAllocator.js.map +1 -1
  415. package/dist/util/index.d.ts +2 -1
  416. package/dist/util/index.d.ts.map +1 -1
  417. package/dist/util/index.js +4 -3
  418. package/dist/util/index.js.map +1 -1
  419. package/dist/util/referenceCounting.d.ts +18 -0
  420. package/dist/util/referenceCounting.d.ts.map +1 -1
  421. package/dist/util/referenceCounting.js.map +1 -1
  422. package/dist/util/typeCheck.d.ts +7 -0
  423. package/dist/util/typeCheck.d.ts.map +1 -1
  424. package/dist/util/typeCheck.js.map +1 -1
  425. package/dist/util/utils.d.ts +0 -1
  426. package/dist/util/utils.d.ts.map +1 -1
  427. package/dist/util/utils.js +1 -4
  428. package/dist/util/utils.js.map +1 -1
  429. package/lib/alpha.d.ts +32 -1
  430. package/lib/beta.d.ts +5 -1
  431. package/lib/codec/codec.d.ts +1 -1
  432. package/lib/codec/codec.d.ts.map +1 -1
  433. package/lib/codec/codec.js +1 -2
  434. package/lib/codec/codec.js.map +1 -1
  435. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  436. package/lib/codec/discriminatedUnions.js +2 -2
  437. package/lib/codec/discriminatedUnions.js.map +1 -1
  438. package/lib/core/forest/editableForest.d.ts +1 -14
  439. package/lib/core/forest/editableForest.d.ts.map +1 -1
  440. package/lib/core/forest/editableForest.js +0 -26
  441. package/lib/core/forest/editableForest.js.map +1 -1
  442. package/lib/core/forest/forest.d.ts +16 -3
  443. package/lib/core/forest/forest.d.ts.map +1 -1
  444. package/lib/core/forest/forest.js +4 -1
  445. package/lib/core/forest/forest.js.map +1 -1
  446. package/lib/core/forest/index.d.ts +1 -1
  447. package/lib/core/forest/index.d.ts.map +1 -1
  448. package/lib/core/forest/index.js +1 -1
  449. package/lib/core/forest/index.js.map +1 -1
  450. package/lib/core/index.d.ts +2 -2
  451. package/lib/core/index.d.ts.map +1 -1
  452. package/lib/core/index.js +2 -2
  453. package/lib/core/index.js.map +1 -1
  454. package/lib/core/rebase/utils.js +1 -1
  455. package/lib/core/rebase/utils.js.map +1 -1
  456. package/lib/core/schema-stored/schema.d.ts +4 -1
  457. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  458. package/lib/core/schema-stored/schema.js +6 -2
  459. package/lib/core/schema-stored/schema.js.map +1 -1
  460. package/lib/core/tree/anchorSet.d.ts +8 -3
  461. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  462. package/lib/core/tree/anchorSet.js +14 -7
  463. package/lib/core/tree/anchorSet.js.map +1 -1
  464. package/lib/core/tree/delta.d.ts +8 -23
  465. package/lib/core/tree/delta.d.ts.map +1 -1
  466. package/lib/core/tree/delta.js.map +1 -1
  467. package/lib/core/tree/deltaUtil.d.ts +3 -3
  468. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  469. package/lib/core/tree/deltaUtil.js +2 -2
  470. package/lib/core/tree/deltaUtil.js.map +1 -1
  471. package/lib/core/tree/index.d.ts +2 -2
  472. package/lib/core/tree/index.d.ts.map +1 -1
  473. package/lib/core/tree/index.js +1 -1
  474. package/lib/core/tree/index.js.map +1 -1
  475. package/lib/core/tree/pathTree.d.ts +54 -1
  476. package/lib/core/tree/pathTree.d.ts.map +1 -1
  477. package/lib/core/tree/pathTree.js +6 -0
  478. package/lib/core/tree/pathTree.js.map +1 -1
  479. package/lib/core/tree/treeTextFormat.js +1 -1
  480. package/lib/core/tree/treeTextFormat.js.map +1 -1
  481. package/lib/core/tree/visitDelta.d.ts +7 -5
  482. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  483. package/lib/core/tree/visitDelta.js +19 -9
  484. package/lib/core/tree/visitDelta.js.map +1 -1
  485. package/lib/core/tree/visitorUtils.d.ts +5 -23
  486. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  487. package/lib/core/tree/visitorUtils.js +8 -5
  488. package/lib/core/tree/visitorUtils.js.map +1 -1
  489. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +1 -1
  490. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  491. package/lib/feature-libraries/chunked-forest/basicChunk.js +3 -3
  492. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  493. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +5 -3
  494. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  495. package/lib/feature-libraries/chunked-forest/chunkTree.js +12 -9
  496. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  497. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -0
  498. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  499. package/lib/feature-libraries/chunked-forest/chunkedForest.js +8 -5
  500. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  501. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +1 -1
  502. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  503. package/lib/feature-libraries/chunked-forest/codec/codecs.js +1 -1
  504. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  505. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  506. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +3 -3
  507. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  508. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +2 -2
  509. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  510. package/lib/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.d.ts → schemaBasedEncode.d.ts} +1 -1
  511. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -0
  512. package/lib/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.js → schemaBasedEncode.js} +2 -3
  513. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -0
  514. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  515. package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -1
  516. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  517. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +3 -2
  518. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  519. package/lib/feature-libraries/chunked-forest/uniformChunk.js +5 -4
  520. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  521. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -14
  522. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  523. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +5 -6
  524. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  525. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  526. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +1 -1
  527. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  528. package/lib/feature-libraries/default-schema/index.d.ts +1 -0
  529. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  530. package/lib/feature-libraries/default-schema/index.js +1 -0
  531. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  532. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts +21 -0
  533. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -0
  534. package/lib/feature-libraries/default-schema/mappedEditBuilder.js +53 -0
  535. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -0
  536. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  537. package/lib/feature-libraries/default-schema/schemaChecker.js +1 -2
  538. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  539. package/lib/feature-libraries/deltaUtils.js +1 -1
  540. package/lib/feature-libraries/deltaUtils.js.map +1 -1
  541. package/lib/feature-libraries/flex-tree/context.d.ts +5 -5
  542. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  543. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  544. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +2 -2
  545. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  546. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  547. package/lib/feature-libraries/flex-tree/lazyField.d.ts +5 -4
  548. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  549. package/lib/feature-libraries/flex-tree/lazyField.js +13 -10
  550. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  551. package/lib/feature-libraries/flex-tree/lazyNode.js +2 -2
  552. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  553. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  554. package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -7
  555. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  556. package/lib/feature-libraries/index.d.ts +2 -1
  557. package/lib/feature-libraries/index.d.ts.map +1 -1
  558. package/lib/feature-libraries/index.js +2 -1
  559. package/lib/feature-libraries/index.js.map +1 -1
  560. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  561. package/lib/feature-libraries/indexing/anchorTreeIndex.js +2 -2
  562. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  563. package/lib/feature-libraries/initializeForest.d.ts +18 -0
  564. package/lib/feature-libraries/initializeForest.d.ts.map +1 -0
  565. package/lib/feature-libraries/initializeForest.js +31 -0
  566. package/lib/feature-libraries/initializeForest.js.map +1 -0
  567. package/lib/feature-libraries/modular-schema/comparison.js +2 -2
  568. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  569. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  570. package/lib/feature-libraries/modular-schema/isNeverTree.js +1 -2
  571. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  572. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  573. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +2 -2
  574. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  575. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +5 -5
  576. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  577. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +12 -18
  578. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  579. package/lib/feature-libraries/node-identifier/index.d.ts +8 -0
  580. package/lib/feature-libraries/node-identifier/index.d.ts.map +1 -0
  581. package/lib/feature-libraries/node-identifier/index.js +8 -0
  582. package/lib/feature-libraries/node-identifier/index.js.map +1 -0
  583. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts +22 -0
  584. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.d.ts.map +1 -0
  585. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js +45 -0
  586. package/lib/feature-libraries/node-identifier/mockNodeIdentifierManager.js.map +1 -0
  587. package/lib/feature-libraries/node-identifier/nodeIdentifier.d.ts +38 -0
  588. package/lib/feature-libraries/node-identifier/nodeIdentifier.d.ts.map +1 -0
  589. package/lib/feature-libraries/node-identifier/nodeIdentifier.js +22 -0
  590. package/lib/feature-libraries/node-identifier/nodeIdentifier.js.map +1 -0
  591. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts +37 -0
  592. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.d.ts.map +1 -0
  593. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js +43 -0
  594. package/lib/feature-libraries/node-identifier/nodeIdentifierManager.js.map +1 -0
  595. package/lib/feature-libraries/object-forest/objectForest.d.ts +2 -1
  596. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  597. package/lib/feature-libraries/object-forest/objectForest.js +8 -4
  598. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  599. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  600. package/lib/feature-libraries/schema-index/codec.js +2 -1
  601. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  602. package/lib/feature-libraries/sequence-field/compose.d.ts +1 -1
  603. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  604. package/lib/feature-libraries/sequence-field/compose.js +1 -2
  605. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  606. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  607. package/lib/feature-libraries/sequence-field/invert.js +2 -2
  608. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  609. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  610. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +2 -2
  611. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  612. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  613. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +2 -2
  614. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  615. package/lib/feature-libraries/sequence-field/utils.js +2 -2
  616. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  617. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  618. package/lib/feature-libraries/treeCursorUtils.js +2 -3
  619. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  620. package/lib/index.d.ts +5 -4
  621. package/lib/index.d.ts.map +1 -1
  622. package/lib/index.js +5 -3
  623. package/lib/index.js.map +1 -1
  624. package/lib/jsonDomainSchema.d.ts +15 -16
  625. package/lib/jsonDomainSchema.d.ts.map +1 -1
  626. package/lib/jsonDomainSchema.js +11 -6
  627. package/lib/jsonDomainSchema.js.map +1 -1
  628. package/lib/legacy.d.ts +5 -1
  629. package/lib/packageVersion.d.ts +1 -1
  630. package/lib/packageVersion.js +1 -1
  631. package/lib/packageVersion.js.map +1 -1
  632. package/lib/public.d.ts +5 -1
  633. package/lib/serializableDomainSchema.d.ts +8 -14
  634. package/lib/serializableDomainSchema.d.ts.map +1 -1
  635. package/lib/shared-tree/checkoutFlexTreeView.d.ts +3 -3
  636. package/lib/shared-tree/checkoutFlexTreeView.d.ts.map +1 -1
  637. package/lib/shared-tree/checkoutFlexTreeView.js.map +1 -1
  638. package/lib/shared-tree/independentView.d.ts.map +1 -1
  639. package/lib/shared-tree/independentView.js +5 -20
  640. package/lib/shared-tree/independentView.js.map +1 -1
  641. package/lib/shared-tree/index.d.ts +1 -1
  642. package/lib/shared-tree/index.d.ts.map +1 -1
  643. package/lib/shared-tree/index.js +1 -1
  644. package/lib/shared-tree/index.js.map +1 -1
  645. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  646. package/lib/shared-tree/schematizeTree.js +5 -4
  647. package/lib/shared-tree/schematizeTree.js.map +1 -1
  648. package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
  649. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  650. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  651. package/lib/shared-tree/sharedTree.d.ts +1 -0
  652. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  653. package/lib/shared-tree/sharedTree.js +23 -16
  654. package/lib/shared-tree/sharedTree.js.map +1 -1
  655. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  656. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  657. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  658. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +1 -2
  659. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  660. package/lib/shared-tree/sharedTreeEditBuilder.js +2 -2
  661. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  662. package/lib/shared-tree/treeApiAlpha.d.ts +9 -30
  663. package/lib/shared-tree/treeApiAlpha.d.ts.map +1 -1
  664. package/lib/shared-tree/treeApiAlpha.js +12 -24
  665. package/lib/shared-tree/treeApiAlpha.js.map +1 -1
  666. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  667. package/lib/shared-tree/treeCheckout.js +4 -4
  668. package/lib/shared-tree/treeCheckout.js.map +1 -1
  669. package/lib/shared-tree-core/branch.d.ts +4 -3
  670. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  671. package/lib/shared-tree-core/branch.js +2 -2
  672. package/lib/shared-tree-core/branch.js.map +1 -1
  673. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  674. package/lib/shared-tree-core/editManager.js +35 -29
  675. package/lib/shared-tree-core/editManager.js.map +1 -1
  676. package/lib/sharedTreeAttributes.d.ts +18 -0
  677. package/lib/sharedTreeAttributes.d.ts.map +1 -0
  678. package/lib/sharedTreeAttributes.js +22 -0
  679. package/lib/sharedTreeAttributes.js.map +1 -0
  680. package/lib/simple-tree/api/conciseTree.d.ts +8 -2
  681. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  682. package/lib/simple-tree/api/conciseTree.js +9 -1
  683. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  684. package/lib/simple-tree/api/create.d.ts +3 -3
  685. package/lib/simple-tree/api/create.d.ts.map +1 -1
  686. package/lib/simple-tree/api/create.js.map +1 -1
  687. package/lib/simple-tree/api/customTree.d.ts +42 -12
  688. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  689. package/lib/simple-tree/api/customTree.js +30 -3
  690. package/lib/simple-tree/api/customTree.js.map +1 -1
  691. package/lib/simple-tree/api/getJsonSchema.d.ts +10 -0
  692. package/lib/simple-tree/api/getJsonSchema.d.ts.map +1 -1
  693. package/lib/simple-tree/api/getJsonSchema.js +10 -0
  694. package/lib/simple-tree/api/getJsonSchema.js.map +1 -1
  695. package/lib/simple-tree/api/getSimpleSchema.d.ts +13 -43
  696. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  697. package/lib/simple-tree/api/getSimpleSchema.js +13 -43
  698. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  699. package/lib/simple-tree/api/index.d.ts +7 -6
  700. package/lib/simple-tree/api/index.d.ts.map +1 -1
  701. package/lib/simple-tree/api/index.js +5 -3
  702. package/lib/simple-tree/api/index.js.map +1 -1
  703. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  704. package/lib/simple-tree/api/schemaCreationUtilities.js +1 -1
  705. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  706. package/lib/simple-tree/api/schemaFactory.d.ts +112 -67
  707. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  708. package/lib/simple-tree/api/schemaFactory.js +78 -155
  709. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  710. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +38 -23
  711. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  712. package/lib/simple-tree/api/schemaFactoryAlpha.js +27 -2
  713. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  714. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts +40 -5
  715. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  716. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  717. package/lib/simple-tree/api/schemaFromSimple.d.ts +19 -0
  718. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -0
  719. package/lib/simple-tree/api/schemaFromSimple.js +67 -0
  720. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -0
  721. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +3 -2
  722. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  723. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +6 -6
  724. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  725. package/lib/simple-tree/api/simpleTreeIndex.d.ts.map +1 -1
  726. package/lib/simple-tree/api/simpleTreeIndex.js +2 -1
  727. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  728. package/lib/simple-tree/api/testRecursiveDomain.d.ts +10 -10
  729. package/lib/simple-tree/api/tree.d.ts +12 -6
  730. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  731. package/lib/simple-tree/api/tree.js +14 -5
  732. package/lib/simple-tree/api/tree.js.map +1 -1
  733. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  734. package/lib/simple-tree/api/treeNodeApi.js +5 -20
  735. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  736. package/lib/simple-tree/api/typesUnsafe.d.ts +102 -36
  737. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  738. package/lib/simple-tree/api/typesUnsafe.js +0 -1
  739. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  740. package/lib/simple-tree/api/verboseTree.d.ts +16 -25
  741. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -1
  742. package/lib/simple-tree/api/verboseTree.js +16 -12
  743. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  744. package/lib/simple-tree/api/view.d.ts.map +1 -1
  745. package/lib/simple-tree/api/view.js +1 -2
  746. package/lib/simple-tree/api/view.js.map +1 -1
  747. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +16 -3
  748. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  749. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +69 -146
  750. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  751. package/lib/simple-tree/arrayNode.d.ts +5 -4
  752. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  753. package/lib/simple-tree/arrayNode.js +7 -3
  754. package/lib/simple-tree/arrayNode.js.map +1 -1
  755. package/lib/simple-tree/arrayNodeTypes.d.ts +46 -0
  756. package/lib/simple-tree/arrayNodeTypes.d.ts.map +1 -0
  757. package/lib/simple-tree/arrayNodeTypes.js +26 -0
  758. package/lib/simple-tree/arrayNodeTypes.js.map +1 -0
  759. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  760. package/lib/simple-tree/core/getOrCreateNode.js +2 -12
  761. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  762. package/lib/simple-tree/core/index.d.ts +1 -2
  763. package/lib/simple-tree/core/index.d.ts.map +1 -1
  764. package/lib/simple-tree/core/index.js +1 -2
  765. package/lib/simple-tree/core/index.js.map +1 -1
  766. package/lib/simple-tree/core/treeNodeKernel.d.ts +12 -5
  767. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  768. package/lib/simple-tree/core/treeNodeKernel.js +28 -14
  769. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  770. package/lib/simple-tree/core/treeNodeSchema.d.ts +14 -7
  771. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  772. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  773. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +2 -2
  774. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  775. package/lib/simple-tree/core/unhydratedFlexTree.js +2 -2
  776. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  777. package/lib/simple-tree/flexList.d.ts +4 -5
  778. package/lib/simple-tree/flexList.d.ts.map +1 -1
  779. package/lib/simple-tree/flexList.js +0 -12
  780. package/lib/simple-tree/flexList.js.map +1 -1
  781. package/lib/simple-tree/index.d.ts +9 -2
  782. package/lib/simple-tree/index.d.ts.map +1 -1
  783. package/lib/simple-tree/index.js +5 -2
  784. package/lib/simple-tree/index.js.map +1 -1
  785. package/lib/simple-tree/leafNodeSchema.d.ts +22 -5
  786. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  787. package/lib/simple-tree/leafNodeSchema.js +2 -0
  788. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  789. package/lib/simple-tree/mapNode.d.ts +3 -2
  790. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  791. package/lib/simple-tree/mapNode.js +5 -1
  792. package/lib/simple-tree/mapNode.js.map +1 -1
  793. package/lib/simple-tree/mapNodeTypes.d.ts +46 -0
  794. package/lib/simple-tree/mapNodeTypes.d.ts.map +1 -0
  795. package/lib/simple-tree/mapNodeTypes.js +26 -0
  796. package/lib/simple-tree/mapNodeTypes.js.map +1 -0
  797. package/lib/simple-tree/objectNode.d.ts +10 -3
  798. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  799. package/lib/simple-tree/objectNode.js +12 -5
  800. package/lib/simple-tree/objectNode.js.map +1 -1
  801. package/lib/simple-tree/objectNodeTypes.d.ts +9 -5
  802. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  803. package/lib/simple-tree/objectNodeTypes.js +3 -0
  804. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  805. package/lib/simple-tree/proxies.js +2 -1
  806. package/lib/simple-tree/proxies.js.map +1 -1
  807. package/lib/simple-tree/schemaTypes.d.ts +81 -8
  808. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  809. package/lib/simple-tree/schemaTypes.js +91 -6
  810. package/lib/simple-tree/schemaTypes.js.map +1 -1
  811. package/lib/simple-tree/{api/simpleSchema.d.ts → simpleSchema.d.ts} +55 -28
  812. package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
  813. package/lib/simple-tree/simpleSchema.js.map +1 -0
  814. package/lib/simple-tree/toMapTree.d.ts +4 -4
  815. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  816. package/lib/simple-tree/toMapTree.js +2 -2
  817. package/lib/simple-tree/toMapTree.js.map +1 -1
  818. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  819. package/lib/simple-tree/toStoredSchema.js +4 -8
  820. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  821. package/lib/simple-tree/treeNodeValid.d.ts +7 -1
  822. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  823. package/lib/simple-tree/treeNodeValid.js +14 -7
  824. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  825. package/lib/treeFactory.d.ts +0 -12
  826. package/lib/treeFactory.d.ts.map +1 -1
  827. package/lib/treeFactory.js +1 -17
  828. package/lib/treeFactory.js.map +1 -1
  829. package/lib/tsdoc-metadata.json +1 -1
  830. package/lib/util/cloneWithReplacements.d.ts +21 -0
  831. package/lib/util/cloneWithReplacements.d.ts.map +1 -0
  832. package/lib/util/cloneWithReplacements.js +34 -0
  833. package/lib/util/cloneWithReplacements.js.map +1 -0
  834. package/lib/util/idAllocator.d.ts.map +1 -1
  835. package/lib/util/idAllocator.js +1 -2
  836. package/lib/util/idAllocator.js.map +1 -1
  837. package/lib/util/index.d.ts +2 -1
  838. package/lib/util/index.d.ts.map +1 -1
  839. package/lib/util/index.js +2 -1
  840. package/lib/util/index.js.map +1 -1
  841. package/lib/util/referenceCounting.d.ts +18 -0
  842. package/lib/util/referenceCounting.d.ts.map +1 -1
  843. package/lib/util/referenceCounting.js.map +1 -1
  844. package/lib/util/typeCheck.d.ts +7 -0
  845. package/lib/util/typeCheck.d.ts.map +1 -1
  846. package/lib/util/typeCheck.js.map +1 -1
  847. package/lib/util/utils.d.ts +0 -1
  848. package/lib/util/utils.d.ts.map +1 -1
  849. package/lib/util/utils.js +0 -2
  850. package/lib/util/utils.js.map +1 -1
  851. package/package.json +37 -27
  852. package/src/codec/codec.ts +2 -2
  853. package/src/codec/discriminatedUnions.ts +2 -2
  854. package/src/core/forest/editableForest.ts +1 -52
  855. package/src/core/forest/forest.ts +17 -2
  856. package/src/core/forest/index.ts +0 -1
  857. package/src/core/index.ts +4 -2
  858. package/src/core/rebase/utils.ts +1 -1
  859. package/src/core/schema-stored/schema.ts +6 -2
  860. package/src/core/tree/anchorSet.ts +42 -12
  861. package/src/core/tree/delta.ts +8 -25
  862. package/src/core/tree/deltaUtil.ts +5 -5
  863. package/src/core/tree/index.ts +4 -1
  864. package/src/core/tree/pathTree.ts +72 -1
  865. package/src/core/tree/treeTextFormat.ts +1 -1
  866. package/src/core/tree/visitDelta.ts +38 -17
  867. package/src/core/tree/visitorUtils.ts +22 -36
  868. package/src/feature-libraries/chunked-forest/basicChunk.ts +3 -3
  869. package/src/feature-libraries/chunked-forest/chunkTree.ts +20 -9
  870. package/src/feature-libraries/chunked-forest/chunkedForest.ts +10 -6
  871. package/src/feature-libraries/chunked-forest/codec/README.md +3 -3
  872. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -1
  873. package/src/feature-libraries/chunked-forest/codec/codecs.ts +1 -1
  874. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +3 -3
  875. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +2 -2
  876. package/src/feature-libraries/chunked-forest/codec/{schemaBasedEncoding.ts → schemaBasedEncode.ts} +1 -2
  877. package/src/feature-libraries/chunked-forest/emptyChunk.ts +1 -1
  878. package/src/feature-libraries/chunked-forest/uniformChunk.ts +5 -4
  879. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +21 -38
  880. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -1
  881. package/src/feature-libraries/default-schema/index.ts +2 -0
  882. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +68 -0
  883. package/src/feature-libraries/default-schema/schemaChecker.ts +1 -2
  884. package/src/feature-libraries/deltaUtils.ts +1 -1
  885. package/src/feature-libraries/flex-tree/context.ts +4 -4
  886. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +2 -2
  887. package/src/feature-libraries/flex-tree/lazyField.ts +21 -12
  888. package/src/feature-libraries/flex-tree/lazyNode.ts +2 -2
  889. package/src/feature-libraries/forest-summary/forestSummarizer.ts +5 -9
  890. package/src/feature-libraries/index.ts +10 -8
  891. package/src/feature-libraries/indexing/anchorTreeIndex.ts +4 -4
  892. package/src/feature-libraries/initializeForest.ts +55 -0
  893. package/src/feature-libraries/modular-schema/comparison.ts +2 -2
  894. package/src/feature-libraries/modular-schema/isNeverTree.ts +1 -2
  895. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +1 -2
  896. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +13 -30
  897. package/src/feature-libraries/node-identifier/README.md +11 -0
  898. package/src/feature-libraries/node-identifier/index.ts +17 -0
  899. package/src/feature-libraries/node-identifier/mockNodeIdentifierManager.ts +59 -0
  900. package/src/feature-libraries/node-identifier/nodeIdentifier.ts +50 -0
  901. package/src/feature-libraries/node-identifier/nodeIdentifierManager.ts +95 -0
  902. package/src/feature-libraries/object-forest/objectForest.ts +11 -5
  903. package/src/feature-libraries/schema-index/codec.ts +2 -1
  904. package/src/feature-libraries/sequence-field/compose.ts +2 -2
  905. package/src/feature-libraries/sequence-field/invert.ts +2 -2
  906. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +2 -2
  907. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +2 -2
  908. package/src/feature-libraries/sequence-field/utils.ts +2 -2
  909. package/src/feature-libraries/treeCursorUtils.ts +2 -3
  910. package/src/index.ts +43 -13
  911. package/src/jsonDomainSchema.ts +30 -11
  912. package/src/packageVersion.ts +1 -1
  913. package/src/shared-tree/checkoutFlexTreeView.ts +2 -2
  914. package/src/shared-tree/independentView.ts +5 -29
  915. package/src/shared-tree/index.ts +1 -0
  916. package/src/shared-tree/schematizeTree.ts +5 -4
  917. package/src/shared-tree/schematizingTreeView.ts +3 -3
  918. package/src/shared-tree/sharedTree.ts +29 -19
  919. package/src/shared-tree/sharedTreeChangeFamily.ts +1 -3
  920. package/src/shared-tree/sharedTreeEditBuilder.ts +5 -11
  921. package/src/shared-tree/treeApiAlpha.ts +45 -85
  922. package/src/shared-tree/treeCheckout.ts +4 -10
  923. package/src/shared-tree-core/branch.ts +5 -3
  924. package/src/shared-tree-core/editManager.ts +37 -45
  925. package/src/sharedTreeAttributes.ts +25 -0
  926. package/src/simple-tree/api/conciseTree.ts +25 -8
  927. package/src/simple-tree/api/create.ts +3 -3
  928. package/src/simple-tree/api/customTree.ts +60 -17
  929. package/src/simple-tree/api/getJsonSchema.ts +10 -0
  930. package/src/simple-tree/api/getSimpleSchema.ts +14 -44
  931. package/src/simple-tree/api/index.ts +17 -12
  932. package/src/simple-tree/api/schemaCreationUtilities.ts +1 -2
  933. package/src/simple-tree/api/schemaFactory.ts +179 -118
  934. package/src/simple-tree/api/schemaFactoryAlpha.ts +74 -67
  935. package/src/simple-tree/api/schemaFactoryRecursive.ts +44 -12
  936. package/src/simple-tree/api/schemaFromSimple.ts +96 -0
  937. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +7 -7
  938. package/src/simple-tree/api/simpleTreeIndex.ts +2 -1
  939. package/src/simple-tree/api/tree.ts +16 -11
  940. package/src/simple-tree/api/treeNodeApi.ts +5 -18
  941. package/src/simple-tree/api/typesUnsafe.ts +166 -48
  942. package/src/simple-tree/api/verboseTree.ts +45 -57
  943. package/src/simple-tree/api/view.ts +1 -2
  944. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +80 -185
  945. package/src/simple-tree/arrayNode.ts +20 -14
  946. package/src/simple-tree/arrayNodeTypes.ts +93 -0
  947. package/src/simple-tree/core/getOrCreateNode.ts +3 -13
  948. package/src/simple-tree/core/index.ts +1 -1
  949. package/src/simple-tree/core/treeNodeKernel.ts +32 -18
  950. package/src/simple-tree/core/treeNodeSchema.ts +14 -8
  951. package/src/simple-tree/core/unhydratedFlexTree.ts +4 -4
  952. package/src/simple-tree/flexList.ts +4 -14
  953. package/src/simple-tree/index.ts +36 -9
  954. package/src/simple-tree/leafNodeSchema.ts +28 -7
  955. package/src/simple-tree/mapNode.ts +13 -11
  956. package/src/simple-tree/mapNodeTypes.ts +90 -0
  957. package/src/simple-tree/objectNode.ts +40 -13
  958. package/src/simple-tree/objectNodeTypes.ts +21 -16
  959. package/src/simple-tree/proxies.ts +2 -2
  960. package/src/simple-tree/schemaTypes.ts +153 -23
  961. package/src/simple-tree/{api/simpleSchema.ts → simpleSchema.ts} +67 -28
  962. package/src/simple-tree/toMapTree.ts +8 -8
  963. package/src/simple-tree/toStoredSchema.ts +4 -7
  964. package/src/simple-tree/treeNodeValid.ts +17 -7
  965. package/src/treeFactory.ts +1 -19
  966. package/src/util/cloneWithReplacements.ts +41 -0
  967. package/src/util/idAllocator.ts +1 -3
  968. package/src/util/index.ts +2 -1
  969. package/src/util/referenceCounting.ts +18 -1
  970. package/src/util/typeCheck.ts +7 -0
  971. package/src/util/utils.ts +0 -3
  972. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +0 -1
  973. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +0 -1
  974. package/dist/feature-libraries/node-key/index.d.ts +0 -8
  975. package/dist/feature-libraries/node-key/index.d.ts.map +0 -1
  976. package/dist/feature-libraries/node-key/index.js +0 -16
  977. package/dist/feature-libraries/node-key/index.js.map +0 -1
  978. package/dist/feature-libraries/node-key/mockNodeKeyManager.d.ts +0 -22
  979. package/dist/feature-libraries/node-key/mockNodeKeyManager.d.ts.map +0 -1
  980. package/dist/feature-libraries/node-key/mockNodeKeyManager.js.map +0 -1
  981. package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -38
  982. package/dist/feature-libraries/node-key/nodeKey.d.ts.map +0 -1
  983. package/dist/feature-libraries/node-key/nodeKey.js +0 -26
  984. package/dist/feature-libraries/node-key/nodeKey.js.map +0 -1
  985. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -37
  986. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +0 -1
  987. package/dist/feature-libraries/node-key/nodeKeyManager.js +0 -48
  988. package/dist/feature-libraries/node-key/nodeKeyManager.js.map +0 -1
  989. package/dist/simple-tree/api/simpleSchema.d.ts.map +0 -1
  990. package/dist/simple-tree/api/simpleSchema.js.map +0 -1
  991. package/dist/simple-tree/core/schemaCaching.d.ts +0 -16
  992. package/dist/simple-tree/core/schemaCaching.d.ts.map +0 -1
  993. package/dist/simple-tree/core/schemaCaching.js +0 -32
  994. package/dist/simple-tree/core/schemaCaching.js.map +0 -1
  995. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.d.ts.map +0 -1
  996. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncoding.js.map +0 -1
  997. package/lib/feature-libraries/node-key/index.d.ts +0 -8
  998. package/lib/feature-libraries/node-key/index.d.ts.map +0 -1
  999. package/lib/feature-libraries/node-key/index.js +0 -8
  1000. package/lib/feature-libraries/node-key/index.js.map +0 -1
  1001. package/lib/feature-libraries/node-key/mockNodeKeyManager.d.ts +0 -22
  1002. package/lib/feature-libraries/node-key/mockNodeKeyManager.d.ts.map +0 -1
  1003. package/lib/feature-libraries/node-key/mockNodeKeyManager.js +0 -45
  1004. package/lib/feature-libraries/node-key/mockNodeKeyManager.js.map +0 -1
  1005. package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -38
  1006. package/lib/feature-libraries/node-key/nodeKey.d.ts.map +0 -1
  1007. package/lib/feature-libraries/node-key/nodeKey.js +0 -22
  1008. package/lib/feature-libraries/node-key/nodeKey.js.map +0 -1
  1009. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -37
  1010. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +0 -1
  1011. package/lib/feature-libraries/node-key/nodeKeyManager.js +0 -43
  1012. package/lib/feature-libraries/node-key/nodeKeyManager.js.map +0 -1
  1013. package/lib/simple-tree/api/simpleSchema.d.ts.map +0 -1
  1014. package/lib/simple-tree/api/simpleSchema.js.map +0 -1
  1015. package/lib/simple-tree/core/schemaCaching.d.ts +0 -16
  1016. package/lib/simple-tree/core/schemaCaching.d.ts.map +0 -1
  1017. package/lib/simple-tree/core/schemaCaching.js +0 -27
  1018. package/lib/simple-tree/core/schemaCaching.js.map +0 -1
  1019. package/prettier.config.cjs +0 -8
  1020. package/src/feature-libraries/node-key/README.md +0 -11
  1021. package/src/feature-libraries/node-key/index.ts +0 -17
  1022. package/src/feature-libraries/node-key/mockNodeKeyManager.ts +0 -54
  1023. package/src/feature-libraries/node-key/nodeKey.ts +0 -47
  1024. package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -93
  1025. package/src/simple-tree/core/schemaCaching.ts +0 -35
  1026. /package/dist/simple-tree/{api/simpleSchema.js → simpleSchema.js} +0 -0
  1027. /package/lib/simple-tree/{api/simpleSchema.js → simpleSchema.js} +0 -0
@@ -9,8 +9,7 @@ const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const index_js_1 = require("./core/index.js");
10
10
  const index_js_2 = require("../feature-libraries/index.js");
11
11
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
12
- const index_js_3 = require("../util/index.js");
13
- const index_js_4 = require("./core/index.js");
12
+ const index_js_3 = require("./core/index.js");
14
13
  const flexList_js_1 = require("./flexList.js");
15
14
  /**
16
15
  * Class which all {@link TreeNode}s must extend.
@@ -36,14 +35,16 @@ class TreeNodeValid extends index_js_1.TreeNode {
36
35
  * Schema classes must override to provide an implementation of RawTreeNode construction.
37
36
  */
38
37
  static buildRawNode(instance, input) {
39
- return (0, index_js_3.fail)(0xae4 /* Schema must override buildRawNode */);
38
+ return (0, internal_1.fail)(0xae4 /* Schema must override buildRawNode */);
40
39
  }
41
40
  /**
42
41
  * Schema classes can override to provide a callback that is called once when the first node is constructed.
43
42
  * This is a good place to perform extra validation and cache schema derived data needed for the implementation of the node.
43
+ * @remarks
44
+ * It is valid to dereference LazyItem schema references in this function (or anything that runs after it).
44
45
  */
45
46
  static oneTimeSetup() {
46
- (0, index_js_3.fail)(0xae5 /* Missing oneTimeSetup */);
47
+ (0, internal_1.fail)(0xae5 /* Missing oneTimeSetup */);
47
48
  }
48
49
  /**
49
50
  * Indicate that `this` is the most derived version of a schema, and thus the only one allowed to be used (other than by being subclassed a single time).
@@ -86,24 +87,30 @@ class TreeNodeValid extends index_js_1.TreeNode {
86
87
  return new this(input);
87
88
  }
88
89
  /**
89
- * @see {@link TreeNodeSchemaCore.createFromInsertable}.
90
+ * See {@link TreeNodeSchemaCore.createFromInsertable}.
90
91
  */
91
92
  static createFromInsertable(input) {
92
93
  return new this(input);
93
94
  }
95
+ /**
96
+ * Idempotent initialization function that pre-caches data and can dereference lazy schema references.
97
+ */
98
+ static oneTimeInitialize() {
99
+ const cache = this.markMostDerived();
100
+ cache.oneTimeInitialized ??= this.oneTimeSetup();
101
+ // TypeScript fails to narrow the type of `oneTimeInitialized` to `Context` here, so use a cast:
102
+ return cache;
103
+ }
94
104
  constructor(input) {
95
105
  super(index_js_1.privateToken);
96
106
  const schema = this.constructor;
97
- const cache = schema.markMostDerived();
98
- if (cache.oneTimeInitialized === undefined) {
99
- cache.oneTimeInitialized = schema.oneTimeSetup();
100
- }
107
+ const cache = schema.oneTimeInitialize();
101
108
  if ((0, index_js_1.isTreeNode)(input)) {
102
109
  // TODO: update this once we have better support for deep-copying and move operations.
103
110
  throw new internal_2.UsageError("Existing nodes may not be used as the constructor parameter for a new node. The existing node may be used directly instead of creating a new one, used as a child of the new node (if it has not yet been inserted into the tree). If the desired result is copying the provided node, it must be deep copied (since any child node would be parented under both the new and old nodes). Currently no API is provided to make deep copies, but it can be done manually with object spreads - for example `new Foo({...oldFoo})` will work if all fields of `oldFoo` are leaf nodes.");
104
111
  }
105
112
  const node = (0, index_js_2.isFlexTreeNode)(input) ? input : schema.buildRawNode(this, input);
106
- (0, internal_1.assert)((0, index_js_4.getSimpleNodeSchemaFromInnerNode)(node) === schema, 0x83b /* building node with wrong schema */);
113
+ (0, internal_1.assert)((0, index_js_3.getSimpleNodeSchemaFromInnerNode)(node) === schema, 0x83b /* building node with wrong schema */);
107
114
  const result = schema.prepareInstance(this, node);
108
115
  // The TreeNodeKernel associates itself the TreeNode (result here, not node) so it can be looked up later via getKernel.
109
116
  // If desired this could be put in a non-enumerable symbol property for lookup instead, but that gets mess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C,IAAI,MAAM,CAAC,OAAO,CAAC,MAAkB,CAAC,EAAE,CAAC;YAC/D,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxE,CAAC;QAED,QAAQ;QACR,+HAA+H;QAC/H,qDAAqD;QACrD,qCAAqC;QACrC,2DAA2D;QAE3D,OAAO,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,CAAC,MAAM,EAAE,MAAM;QACrB,OAAO,YAAY,CAAC,MAAkC,CAAC,KAAK,SAAS,CAAC;IACvE,CAAC;CACD,CAAC;AAEF,SAAS,kBAAkB,CAC1B,MAAe,EACf,MAAuC;IAEvC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC9B,CAAC;SAAM,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,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\";\n\nimport {\n\ttype TreeNodeSchema,\n\tNodeKind,\n\tisTreeNode,\n\tTreeNodeKernel,\n\tprivateToken,\n\tTreeNode,\n\ttype InternalTreeNode,\n\ttypeSchemaSymbol,\n\ttype InnerNode,\n\ttype Context,\n\ttype UnhydratedFlexTreeNode,\n} from \"./core/index.js\";\nimport { type FlexTreeNode, isFlexTreeNode } from \"../feature-libraries/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { fail } from \"../util/index.js\";\n\nimport { getSimpleNodeSchemaFromInnerNode } from \"./core/index.js\";\nimport { markEager } from \"./flexList.js\";\n\n/**\n * Class which all {@link TreeNode}s must extend.\n * Since this is not exported, it allows robust detection of attempts to create TreeNodes which do not go through SchemaFactory which is the only place which exposes classes that extend this.\n *\n * This has static members which schema classes can override to provide schema specific functionality.\n * These static members are only intended to be used / overridden by code within this package, and are used by the various node kinds.\n * Access to these static members has to be done via `this.constructor.staticMember` to support the overrides, and thus can only be used in the constructor, after the base constructor has been invoked.\n */\nexport abstract class TreeNodeValid<TInput> extends TreeNode {\n\t/**\n\t * Schema classes can override this to control what happens at the end of the constructor.\n\t * The return value from this is returned from the constructor, allowing substituting a proxy if desired.\n\t *\n\t * This is not simply done in the derived constructor to enable:\n\t * - this class to access the value which is being returned before it's returned from the constructor.\n\t * - the derived class to be provided the input `FlexTreeNode` without relying on a field on the node to hold it.\n\t */\n\tprotected static prepareInstance<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: FlexTreeNode,\n\t): TreeNodeValid<T> {\n\t\treturn instance;\n\t}\n\n\t/**\n\t * Schema classes must override to provide an implementation of RawTreeNode construction.\n\t */\n\tprotected static buildRawNode<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: T,\n\t): UnhydratedFlexTreeNode {\n\t\treturn fail(0xae4 /* Schema must override buildRawNode */);\n\t}\n\n\t/**\n\t * Schema classes can override to provide a callback that is called once when the first node is constructed.\n\t * This is a good place to perform extra validation and cache schema derived data needed for the implementation of the node.\n\t */\n\tprotected static oneTimeSetup<T>(this: typeof TreeNodeValid<T>): Context {\n\t\tfail(0xae5 /* Missing oneTimeSetup */);\n\t}\n\n\t/**\n\t * The most derived constructor (the one invoked with the `new` operator, not a parent class constructor invoked with as `super`) used to construct an instance of this type.\n\t * @remarks\n\t * Captured when an instance is constructed.\n\t *\n\t * Used to ensure that some derived class (which must override this member, defaulting it to `undefined`) is only instantiated with a single \"most derived\" class (the constructor actually invoked the the user with `new`).\n\t *\n\t * Typically this is override in the class that statically implements {@link TreeNodeSchema} to enforce that all nodes using that schema use the same class and not different subclasses of it.\n\t *\n\t * Also used to detect if oneTimeSetup has run.\n\t *\n\t * @privateRemarks\n\t * This defaults to \"default\", which is used to trigger an error if not overridden in the derived class.\n\t *\n\t * The value of this on TreeNodeValid must only be overridden by base classes and never modified.\n\t * Ways to enforce this immutability prevent it from being overridden,\n\t * so code modifying constructorCached should be extra careful to avoid accidentally modifying the base/inherited value.\n\t */\n\tprotected static constructorCached: MostDerivedData | \"default\" | undefined = \"default\";\n\n\t/**\n\t * Indicate that `this` is the most derived version of a schema, and thus the only one allowed to be used (other than by being subclassed a single time).\n\t */\n\tpublic static markMostDerived(this: typeof TreeNodeValid & TreeNodeSchema): MostDerivedData {\n\t\tassert(this.constructorCached !== \"default\", 0x95f /* invalid schema class */);\n\n\t\tif (this.constructorCached === undefined) {\n\t\t\t// Set the constructorCached on the layer of the prototype chain that declared it.\n\t\t\t// This is necessary to ensure there is only one subclass of that type used:\n\t\t\t// if constructorCached was simply set on `schema`,\n\t\t\t// then a base classes between `schema` (exclusive) and where `constructorCached` is set (inclusive) and other subclasses of them\n\t\t\t// would not see the stored `constructorCached`, and the validation above against multiple derived classes would not work.\n\n\t\t\t// This is not just an alias of `this`, but a reference to the item in the prototype chain being walked, which happens to start at `this`.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias, unicorn/no-this-assignment\n\t\t\tlet schemaBase: typeof TreeNodeValid = this;\n\t\t\twhile (!Object.prototype.hasOwnProperty.call(schemaBase, \"constructorCached\")) {\n\t\t\t\tschemaBase = Reflect.getPrototypeOf(schemaBase) as typeof TreeNodeValid;\n\t\t\t}\n\t\t\tassert(schemaBase.constructorCached === undefined, 0x962 /* overwriting wrong cache */);\n\t\t\tschemaBase.constructorCached = { constructor: this, oneTimeInitialized: undefined };\n\t\t\tassert(\n\t\t\t\tthis.constructorCached === schemaBase.constructorCached,\n\t\t\t\t0x9b5 /* Inheritance should work */,\n\t\t\t);\n\t\t\treturn this.constructorCached;\n\t\t} else if (this.constructorCached.constructor === this) {\n\t\t\treturn this.constructorCached;\n\t\t}\n\n\t\t// If users trying to diagnose the cause of this error becomes a common issue, more information could be captured.\n\t\t// The call stack to when a schema is first marked most derived could be captured in debug builds and stored in the `MostDerivedData` object:\n\t\t// This could then be included in the error to aid in debugging this error.\n\t\tthrow new UsageError(\n\t\t\t`Two schema classes were used (${this.name} and ${\n\t\t\t\tthis.constructorCached.constructor.name\n\t\t\t}) which derived from the same SchemaFactory generated class (${JSON.stringify(\n\t\t\t\tthis.identifier,\n\t\t\t)}). This is invalid.`,\n\t\t);\n\t}\n\n\t/**\n\t * Node creation function for implementing the TreeNodeSchemaNonClass half of TreeNodeSchemaBoth.\n\t * @remarks\n\t * When used as TreeNodeSchemaNonClass and subclassed,\n\t * does not actually have the correct compile time type for the return value due to TypeScript limitations.\n\t * This is why this is not exposed as part of TreeNodeSchemaClass where subclassing is allowed.\n\t */\n\tpublic static create<TInput, TOut, TThis extends new (args: TInput) => TOut>(\n\t\tthis: TThis,\n\t\tinput: TInput,\n\t): TOut {\n\t\treturn new this(input);\n\t}\n\n\t/**\n\t * @see {@link TreeNodeSchemaCore.createFromInsertable}.\n\t */\n\tpublic static createFromInsertable<TInput, TOut, TThis extends new (args: TInput) => TOut>(\n\t\tthis: TThis,\n\t\tinput: TInput,\n\t): TOut {\n\t\treturn new this(input);\n\t}\n\n\tpublic constructor(input: TInput | InternalTreeNode) {\n\t\tsuper(privateToken);\n\t\tconst schema = this.constructor as typeof TreeNodeValid & TreeNodeSchema;\n\t\tconst cache = schema.markMostDerived();\n\t\tif (cache.oneTimeInitialized === undefined) {\n\t\t\tcache.oneTimeInitialized = schema.oneTimeSetup();\n\t\t}\n\n\t\tif (isTreeNode(input)) {\n\t\t\t// TODO: update this once we have better support for deep-copying and move operations.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing nodes may not be used as the constructor parameter for a new node. The existing node may be used directly instead of creating a new one, used as a child of the new node (if it has not yet been inserted into the tree). If the desired result is copying the provided node, it must be deep copied (since any child node would be parented under both the new and old nodes). Currently no API is provided to make deep copies, but it can be done manually with object spreads - for example `new Foo({...oldFoo})` will work if all fields of `oldFoo` are leaf nodes.\",\n\t\t\t);\n\t\t}\n\n\t\tconst node: InnerNode = isFlexTreeNode(input) ? input : schema.buildRawNode(this, input);\n\t\tassert(\n\t\t\tgetSimpleNodeSchemaFromInnerNode(node) === schema,\n\t\t\t0x83b /* building node with wrong schema */,\n\t\t);\n\n\t\tconst result = schema.prepareInstance(this, node);\n\t\t// The TreeNodeKernel associates itself the TreeNode (result here, not node) so it can be looked up later via getKernel.\n\t\t// If desired this could be put in a non-enumerable symbol property for lookup instead, but that gets messy going through proxies,\n\t\t// so just relying on the WeakMap seems like the cleanest approach.\n\t\tnew TreeNodeKernel(result, schema, node, cache.oneTimeInitialized);\n\n\t\treturn result;\n\t}\n}\n// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.\nmarkEager(TreeNodeValid);\n\n/**\n * Data cached about the most derived type in a schema's class hierarchy.\n * @remarks\n * The most derived type is the only one allowed to be referenced by other schema or constructed as a node.\n * It has to be discovered lazily (when a node is constructed or when a {@link TreeViewConfiguration} is made),\n * since JavaScript provides no way to find derived classes, or inject static class initialization time logic into base classes.\n * Additionally since schema can reference other schema through lazy references which might be forward or recursive references,\n * this can not be evaluated for one schema when referenced by another schema.\n *\n * See {@link TreeNodeValid.constructorCached} and {@link TreeNodeValid.markMostDerived}.\n */\nexport interface MostDerivedData {\n\treadonly constructor: typeof TreeNodeValid & TreeNodeSchema;\n\toneTimeInitialized?: Context;\n}\n\n// #region NodeJS custom inspect for TreeNodes.\n\n/**\n * Used to customize \"inspect\" behavior in NodeJS.\n * See https://nodejs.org/api/util.html#utilinspectcustom for details.\n *\n * VS-Code's debugger also uses this to inspect objects,\n * see https://github.com/microsoft/vscode-js-debug/blob/64df2686c92bac402909dee5c3c389bbb7a81f6d/src/adapter/templates/getStringyProps.ts#L11 for details.\n */\nconst customInspectSymbol = Symbol.for(\"nodejs.util.inspect.custom\");\n\n/**\n * Node inspecting function for use with {@link customInspectSymbol}.\n */\nfunction inspectNodeFunction(\n\tthis: TreeNodeValid<unknown>,\n\tdepth: number,\n\toptions?: unknown,\n\tinspect?: unknown,\n): unknown {\n\tconst schema = this[typeSchemaSymbol];\n\tconst title = `${schema.name}: ${NodeKind[schema.kind]} Node (${schema.identifier})`;\n\n\tif (depth < 2) {\n\t\tconst short = shortContent(this);\n\t\tif (short !== undefined) {\n\t\t\treturn `${title} ${short}`;\n\t\t}\n\t\treturn title;\n\t}\n\tconst content = `${title} ${JSON.stringify(this)}`;\n\treturn content;\n}\n\n/**\n * If the node has no items, a short JSON string for it.\n */\nfunction shortContent(node: TreeNodeValid<unknown>): string | undefined {\n\tif (Object.values(node).length === 0) {\n\t\treturn JSON.stringify(node);\n\t}\n\treturn undefined;\n}\n\n/**\n * Add inherited non-enumerable symbol for NodeJS inspection to all nodes.\n *\n * See {@link customInspectSymbol}.\n */\nObject.defineProperty(TreeNodeValid.prototype, customInspectSymbol, {\n\tvalue: inspectNodeFunction,\n\tenumerable: false,\n});\n\n// #endregion\n\n// #region Browser custom debug format for TreeNodes\n\n// This section has side-effects, so including it in this file ensures its loaded whenever TreeNodes could exist.\n// Supported in at least Chrome and FireFox, more details at https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n// For this to work the browser's dev tools generally have to \"Enable custom formatters\".\n\n// This formatter is inspired by https://github.com/andrewdavey/immutable-devtools/blob/master/src/createFormatters.js which provides a similar formatter for the immutable.js library.\n\nconst globals = typeof window === \"undefined\" ? globalThis : window;\nconst formatters = ((\n\tglobals as { devtoolsFormatters?: DevtoolsFormatter.DevtoolsFormatter[] }\n).devtoolsFormatters ??= []);\n\nconst nodeFormatter: DevtoolsFormatter.DevtoolsFormatter = {\n\theader(object, config) {\n\t\tif (isTreeNode(object)) {\n\t\t\treturn [\"span\", `${inspectNodeFunction.call(object, 1)}`];\n\t\t}\n\t\treturn null;\n\t},\n\tbody(object, config): DevtoolsFormatter.Item {\n\t\tconst children: DevtoolsFormatter.Item[] = [];\n\t\tfor (const [key, value] of Object.entries(object as TreeNode)) {\n\t\t\tchildren.push([\"li\", [\"span\", `${key}: `], formattedReference(value)]);\n\t\t}\n\n\t\t// TODO:\n\t\t// for array nodes, this isn't great since (at least in FireFox) the list items show up with a prefixed number starting from 1.\n\t\t// This looks messy when followed by the array index.\n\t\t// Find a way to hide the list index.\n\t\t// { style: 'list-style-type: none` } did not seem to work.\n\n\t\treturn [\"ol\", ...children];\n\t},\n\thasBody(object, config) {\n\t\treturn shortContent(object as TreeNodeValid<undefined>) === undefined;\n\t},\n};\n\nfunction formattedReference(\n\tobject: unknown,\n\tconfig?: DevtoolsFormatter.ObjectConfig,\n): DevtoolsFormatter.Item {\n\tif (object === undefined) {\n\t\treturn [\"span\", \"undefined\"];\n\t} else if (object === \"null\") {\n\t\treturn [\"span\", \"null\"];\n\t}\n\n\treturn [\"object\", { object, config }];\n}\n\nformatters.push(nodeFormatter);\n\n// #endregion\n\n// These types are based on https://github.com/BenjaminAster/Better-TypeScript/blob/main/types/devtools-formatters.d.ts\n// however the original package causes multiple compile errors due to some of its other types it used, so the relevant part has been extracted and adjusted to better match our conventions.\ndeclare namespace DevtoolsFormatter {\n\ttype ObjectConfig = Record<string | symbol, unknown>;\n\n\ttype ElementTagName = \"div\" | \"span\" | \"ol\" | \"li\" | \"table\" | \"tr\" | \"td\";\n\n\ttype ElementTemplate = StyledElementTemplate | UnstyledElementTemplate;\n\n\ttype StyledElementTemplate = readonly [\n\t\tElementTagName,\n\t\t{\n\t\t\tstyle?: string;\n\t\t},\n\t\t...Item[],\n\t];\n\n\ttype UnstyledElementTemplate = readonly [ElementTagName, ...Item[]];\n\n\ttype ObjectReference = readonly [\n\t\t\"object\",\n\t\t{\n\t\t\tobject: unknown;\n\t\t\tconfig?: ObjectConfig;\n\t\t},\n\t];\n\n\ttype Item = string | ElementTemplate | ObjectReference;\n\n\tinterface DevtoolsFormatter {\n\t\theader(\n\t\t\tobject?: unknown,\n\t\t\tconfig?: ObjectConfig,\n\t\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\t): Item | null;\n\t\thasBody(object?: unknown, config?: ObjectConfig): boolean;\n\t\tbody(object?: unknown, config?: ObjectConfig): Item;\n\t}\n}\n"]}
1
+ {"version":3,"file":"treeNodeValid.js","sourceRoot":"","sources":["../../src/simple-tree/treeNodeValid.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AAEnE,8CAYyB;AACzB,4DAAkF;AAClF,uEAAsE;AAEtE,8CAAmE;AACnE,+CAA0C;AAE1C;;;;;;;GAOG;AACH,MAAsB,aAAsB,SAAQ,mBAAQ;IAC3D;;;;;;;OAOG;IACO,MAAM,CAAC,eAAe,CAE/B,QAA0B,EAC1B,KAAmB;QAEnB,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED;;OAEG;IACO,MAAM,CAAC,YAAY,CAE5B,QAA0B,EAC1B,KAAQ;QAER,OAAO,IAAA,eAAI,EAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;OAKG;IACO,MAAM,CAAC,YAAY;QAC5B,IAAA,eAAI,EAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACxC,CAAC;IAsBD;;OAEG;IACI,MAAM,CAAC,eAAe;QAC5B,IAAA,iBAAM,EAAC,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAE/E,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;YAC1C,kFAAkF;YAClF,4EAA4E;YAC5E,mDAAmD;YACnD,iIAAiI;YACjI,0HAA0H;YAE1H,0I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aAAa,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\ttype TreeNodeSchema,\n\tNodeKind,\n\tisTreeNode,\n\tTreeNodeKernel,\n\tprivateToken,\n\tTreeNode,\n\ttype InternalTreeNode,\n\ttypeSchemaSymbol,\n\ttype InnerNode,\n\ttype Context,\n\ttype UnhydratedFlexTreeNode,\n} from \"./core/index.js\";\nimport { type FlexTreeNode, isFlexTreeNode } from \"../feature-libraries/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { getSimpleNodeSchemaFromInnerNode } from \"./core/index.js\";\nimport { markEager } from \"./flexList.js\";\n\n/**\n * Class which all {@link TreeNode}s must extend.\n * Since this is not exported, it allows robust detection of attempts to create TreeNodes which do not go through SchemaFactory which is the only place which exposes classes that extend this.\n *\n * This has static members which schema classes can override to provide schema specific functionality.\n * These static members are only intended to be used / overridden by code within this package, and are used by the various node kinds.\n * Access to these static members has to be done via `this.constructor.staticMember` to support the overrides, and thus can only be used in the constructor, after the base constructor has been invoked.\n */\nexport abstract class TreeNodeValid<TInput> extends TreeNode {\n\t/**\n\t * Schema classes can override this to control what happens at the end of the constructor.\n\t * The return value from this is returned from the constructor, allowing substituting a proxy if desired.\n\t *\n\t * This is not simply done in the derived constructor to enable:\n\t * - this class to access the value which is being returned before it's returned from the constructor.\n\t * - the derived class to be provided the input `FlexTreeNode` without relying on a field on the node to hold it.\n\t */\n\tprotected static prepareInstance<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: FlexTreeNode,\n\t): TreeNodeValid<T> {\n\t\treturn instance;\n\t}\n\n\t/**\n\t * Schema classes must override to provide an implementation of RawTreeNode construction.\n\t */\n\tprotected static buildRawNode<T>(\n\t\tthis: typeof TreeNodeValid<T>,\n\t\tinstance: TreeNodeValid<T>,\n\t\tinput: T,\n\t): UnhydratedFlexTreeNode {\n\t\treturn fail(0xae4 /* Schema must override buildRawNode */);\n\t}\n\n\t/**\n\t * Schema classes can override to provide a callback that is called once when the first node is constructed.\n\t * This is a good place to perform extra validation and cache schema derived data needed for the implementation of the node.\n\t * @remarks\n\t * It is valid to dereference LazyItem schema references in this function (or anything that runs after it).\n\t */\n\tprotected static oneTimeSetup<T>(this: typeof TreeNodeValid<T>): Context {\n\t\tfail(0xae5 /* Missing oneTimeSetup */);\n\t}\n\n\t/**\n\t * The most derived constructor (the one invoked with the `new` operator, not a parent class constructor invoked with as `super`) used to construct an instance of this type.\n\t * @remarks\n\t * Captured when an instance is constructed.\n\t *\n\t * Used to ensure that some derived class (which must override this member, defaulting it to `undefined`) is only instantiated with a single \"most derived\" class (the constructor actually invoked the the user with `new`).\n\t *\n\t * Typically this is override in the class that statically implements {@link TreeNodeSchema} to enforce that all nodes using that schema use the same class and not different subclasses of it.\n\t *\n\t * Also used to detect if oneTimeSetup has run.\n\t *\n\t * @privateRemarks\n\t * This defaults to \"default\", which is used to trigger an error if not overridden in the derived class.\n\t *\n\t * The value of this on TreeNodeValid must only be overridden by base classes and never modified.\n\t * Ways to enforce this immutability prevent it from being overridden,\n\t * so code modifying constructorCached should be extra careful to avoid accidentally modifying the base/inherited value.\n\t */\n\tprotected static constructorCached: MostDerivedData | \"default\" | undefined = \"default\";\n\n\t/**\n\t * Indicate that `this` is the most derived version of a schema, and thus the only one allowed to be used (other than by being subclassed a single time).\n\t */\n\tpublic static markMostDerived(this: typeof TreeNodeValid & TreeNodeSchema): MostDerivedData {\n\t\tassert(this.constructorCached !== \"default\", 0x95f /* invalid schema class */);\n\n\t\tif (this.constructorCached === undefined) {\n\t\t\t// Set the constructorCached on the layer of the prototype chain that declared it.\n\t\t\t// This is necessary to ensure there is only one subclass of that type used:\n\t\t\t// if constructorCached was simply set on `schema`,\n\t\t\t// then a base classes between `schema` (exclusive) and where `constructorCached` is set (inclusive) and other subclasses of them\n\t\t\t// would not see the stored `constructorCached`, and the validation above against multiple derived classes would not work.\n\n\t\t\t// This is not just an alias of `this`, but a reference to the item in the prototype chain being walked, which happens to start at `this`.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias, unicorn/no-this-assignment\n\t\t\tlet schemaBase: typeof TreeNodeValid = this;\n\t\t\twhile (!Object.prototype.hasOwnProperty.call(schemaBase, \"constructorCached\")) {\n\t\t\t\tschemaBase = Reflect.getPrototypeOf(schemaBase) as typeof TreeNodeValid;\n\t\t\t}\n\t\t\tassert(schemaBase.constructorCached === undefined, 0x962 /* overwriting wrong cache */);\n\t\t\tschemaBase.constructorCached = { constructor: this, oneTimeInitialized: undefined };\n\t\t\tassert(\n\t\t\t\tthis.constructorCached === schemaBase.constructorCached,\n\t\t\t\t0x9b5 /* Inheritance should work */,\n\t\t\t);\n\t\t\treturn this.constructorCached;\n\t\t} else if (this.constructorCached.constructor === this) {\n\t\t\treturn this.constructorCached;\n\t\t}\n\n\t\t// If users trying to diagnose the cause of this error becomes a common issue, more information could be captured.\n\t\t// The call stack to when a schema is first marked most derived could be captured in debug builds and stored in the `MostDerivedData` object:\n\t\t// This could then be included in the error to aid in debugging this error.\n\t\tthrow new UsageError(\n\t\t\t`Two schema classes were used (${this.name} and ${\n\t\t\t\tthis.constructorCached.constructor.name\n\t\t\t}) which derived from the same SchemaFactory generated class (${JSON.stringify(\n\t\t\t\tthis.identifier,\n\t\t\t)}). This is invalid.`,\n\t\t);\n\t}\n\n\t/**\n\t * Node creation function for implementing the TreeNodeSchemaNonClass half of TreeNodeSchemaBoth.\n\t * @remarks\n\t * When used as TreeNodeSchemaNonClass and subclassed,\n\t * does not actually have the correct compile time type for the return value due to TypeScript limitations.\n\t * This is why this is not exposed as part of TreeNodeSchemaClass where subclassing is allowed.\n\t */\n\tpublic static create<TInput, TOut, TThis extends new (args: TInput) => TOut>(\n\t\tthis: TThis,\n\t\tinput: TInput,\n\t): TOut {\n\t\treturn new this(input);\n\t}\n\n\t/**\n\t * See {@link TreeNodeSchemaCore.createFromInsertable}.\n\t */\n\tpublic static createFromInsertable<TInput, TOut, TThis extends new (args: TInput) => TOut>(\n\t\tthis: TThis,\n\t\tinput: TInput,\n\t): TOut {\n\t\treturn new this(input);\n\t}\n\n\t/**\n\t * Idempotent initialization function that pre-caches data and can dereference lazy schema references.\n\t */\n\tpublic static oneTimeInitialize(\n\t\tthis: typeof TreeNodeValid & TreeNodeSchema,\n\t): Required<MostDerivedData> {\n\t\tconst cache = this.markMostDerived();\n\t\tcache.oneTimeInitialized ??= this.oneTimeSetup();\n\t\t// TypeScript fails to narrow the type of `oneTimeInitialized` to `Context` here, so use a cast:\n\t\treturn cache as MostDerivedData & { oneTimeInitialized: Context };\n\t}\n\n\tpublic constructor(input: TInput | InternalTreeNode) {\n\t\tsuper(privateToken);\n\t\tconst schema = this.constructor as typeof TreeNodeValid & TreeNodeSchema;\n\t\tconst cache = schema.oneTimeInitialize();\n\n\t\tif (isTreeNode(input)) {\n\t\t\t// TODO: update this once we have better support for deep-copying and move operations.\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Existing nodes may not be used as the constructor parameter for a new node. The existing node may be used directly instead of creating a new one, used as a child of the new node (if it has not yet been inserted into the tree). If the desired result is copying the provided node, it must be deep copied (since any child node would be parented under both the new and old nodes). Currently no API is provided to make deep copies, but it can be done manually with object spreads - for example `new Foo({...oldFoo})` will work if all fields of `oldFoo` are leaf nodes.\",\n\t\t\t);\n\t\t}\n\n\t\tconst node: InnerNode = isFlexTreeNode(input) ? input : schema.buildRawNode(this, input);\n\t\tassert(\n\t\t\tgetSimpleNodeSchemaFromInnerNode(node) === schema,\n\t\t\t0x83b /* building node with wrong schema */,\n\t\t);\n\n\t\tconst result = schema.prepareInstance(this, node);\n\t\t// The TreeNodeKernel associates itself the TreeNode (result here, not node) so it can be looked up later via getKernel.\n\t\t// If desired this could be put in a non-enumerable symbol property for lookup instead, but that gets messy going through proxies,\n\t\t// so just relying on the WeakMap seems like the cleanest approach.\n\t\tnew TreeNodeKernel(result, schema, node, cache.oneTimeInitialized);\n\n\t\treturn result;\n\t}\n}\n// Class objects are functions (callable), so we need a strong way to distinguish between `schema` and `() => schema` when used as a `LazyItem`.\nmarkEager(TreeNodeValid);\n\n/**\n * Data cached about the most derived type in a schema's class hierarchy.\n * @remarks\n * The most derived type is the only one allowed to be referenced by other schema or constructed as a node.\n * It has to be discovered lazily (when a node is constructed or when a {@link TreeViewConfiguration} is made),\n * since JavaScript provides no way to find derived classes, or inject static class initialization time logic into base classes.\n * Additionally since schema can reference other schema through lazy references which might be forward or recursive references,\n * this can not be evaluated for one schema when referenced by another schema.\n *\n * See {@link TreeNodeValid.constructorCached} and {@link TreeNodeValid.markMostDerived}.\n */\nexport interface MostDerivedData {\n\treadonly constructor: typeof TreeNodeValid & TreeNodeSchema;\n\toneTimeInitialized?: Context;\n}\n\n// #region NodeJS custom inspect for TreeNodes.\n\n/**\n * Used to customize \"inspect\" behavior in NodeJS.\n * See https://nodejs.org/api/util.html#utilinspectcustom for details.\n *\n * VS-Code's debugger also uses this to inspect objects,\n * see https://github.com/microsoft/vscode-js-debug/blob/64df2686c92bac402909dee5c3c389bbb7a81f6d/src/adapter/templates/getStringyProps.ts#L11 for details.\n */\nconst customInspectSymbol = Symbol.for(\"nodejs.util.inspect.custom\");\n\n/**\n * Node inspecting function for use with {@link customInspectSymbol}.\n */\nfunction inspectNodeFunction(\n\tthis: TreeNodeValid<unknown>,\n\tdepth: number,\n\toptions?: unknown,\n\tinspect?: unknown,\n): unknown {\n\tconst schema = this[typeSchemaSymbol];\n\tconst title = `${schema.name}: ${NodeKind[schema.kind]} Node (${schema.identifier})`;\n\n\tif (depth < 2) {\n\t\tconst short = shortContent(this);\n\t\tif (short !== undefined) {\n\t\t\treturn `${title} ${short}`;\n\t\t}\n\t\treturn title;\n\t}\n\tconst content = `${title} ${JSON.stringify(this)}`;\n\treturn content;\n}\n\n/**\n * If the node has no items, a short JSON string for it.\n */\nfunction shortContent(node: TreeNodeValid<unknown>): string | undefined {\n\tif (Object.values(node).length === 0) {\n\t\treturn JSON.stringify(node);\n\t}\n\treturn undefined;\n}\n\n/**\n * Add inherited non-enumerable symbol for NodeJS inspection to all nodes.\n *\n * See {@link customInspectSymbol}.\n */\nObject.defineProperty(TreeNodeValid.prototype, customInspectSymbol, {\n\tvalue: inspectNodeFunction,\n\tenumerable: false,\n});\n\n// #endregion\n\n// #region Browser custom debug format for TreeNodes\n\n// This section has side-effects, so including it in this file ensures its loaded whenever TreeNodes could exist.\n// Supported in at least Chrome and FireFox, more details at https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html\n// For this to work the browser's dev tools generally have to \"Enable custom formatters\".\n\n// This formatter is inspired by https://github.com/andrewdavey/immutable-devtools/blob/master/src/createFormatters.js which provides a similar formatter for the immutable.js library.\n\nconst globals = typeof window === \"undefined\" ? globalThis : window;\nconst formatters = ((\n\tglobals as { devtoolsFormatters?: DevtoolsFormatter.DevtoolsFormatter[] }\n).devtoolsFormatters ??= []);\n\nconst nodeFormatter: DevtoolsFormatter.DevtoolsFormatter = {\n\theader(object, config) {\n\t\tif (isTreeNode(object)) {\n\t\t\treturn [\"span\", `${inspectNodeFunction.call(object, 1)}`];\n\t\t}\n\t\treturn null;\n\t},\n\tbody(object, config): DevtoolsFormatter.Item {\n\t\tconst children: DevtoolsFormatter.Item[] = [];\n\t\tfor (const [key, value] of Object.entries(object as TreeNode)) {\n\t\t\tchildren.push([\"li\", [\"span\", `${key}: `], formattedReference(value)]);\n\t\t}\n\n\t\t// TODO:\n\t\t// for array nodes, this isn't great since (at least in FireFox) the list items show up with a prefixed number starting from 1.\n\t\t// This looks messy when followed by the array index.\n\t\t// Find a way to hide the list index.\n\t\t// { style: 'list-style-type: none` } did not seem to work.\n\n\t\treturn [\"ol\", ...children];\n\t},\n\thasBody(object, config) {\n\t\treturn shortContent(object as TreeNodeValid<undefined>) === undefined;\n\t},\n};\n\nfunction formattedReference(\n\tobject: unknown,\n\tconfig?: DevtoolsFormatter.ObjectConfig,\n): DevtoolsFormatter.Item {\n\tif (object === undefined) {\n\t\treturn [\"span\", \"undefined\"];\n\t} else if (object === \"null\") {\n\t\treturn [\"span\", \"null\"];\n\t}\n\n\treturn [\"object\", { object, config }];\n}\n\nformatters.push(nodeFormatter);\n\n// #endregion\n\n// These types are based on https://github.com/BenjaminAster/Better-TypeScript/blob/main/types/devtools-formatters.d.ts\n// however the original package causes multiple compile errors due to some of its other types it used, so the relevant part has been extracted and adjusted to better match our conventions.\ndeclare namespace DevtoolsFormatter {\n\ttype ObjectConfig = Record<string | symbol, unknown>;\n\n\ttype ElementTagName = \"div\" | \"span\" | \"ol\" | \"li\" | \"table\" | \"tr\" | \"td\";\n\n\ttype ElementTemplate = StyledElementTemplate | UnstyledElementTemplate;\n\n\ttype StyledElementTemplate = readonly [\n\t\tElementTagName,\n\t\t{\n\t\t\tstyle?: string;\n\t\t},\n\t\t...Item[],\n\t];\n\n\ttype UnstyledElementTemplate = readonly [ElementTagName, ...Item[]];\n\n\ttype ObjectReference = readonly [\n\t\t\"object\",\n\t\t{\n\t\t\tobject: unknown;\n\t\t\tconfig?: ObjectConfig;\n\t\t},\n\t];\n\n\ttype Item = string | ElementTemplate | ObjectReference;\n\n\tinterface DevtoolsFormatter {\n\t\theader(\n\t\t\tobject?: unknown,\n\t\t\tconfig?: ObjectConfig,\n\t\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\t): Item | null;\n\t\thasBody(object?: unknown, config?: ObjectConfig): boolean;\n\t\tbody(object?: unknown, config?: ObjectConfig): Item;\n\t}\n}\n"]}
@@ -7,18 +7,6 @@ import type { SharedObjectKind } from "@fluidframework/shared-object-base";
7
7
  import { type ISharedObjectKind } from "@fluidframework/shared-object-base/internal";
8
8
  import { SharedTree as SharedTreeImpl, type SharedTreeOptions, type SharedTreeOptionsInternal } from "./shared-tree/index.js";
9
9
  import type { ITree } from "./simple-tree/index.js";
10
- /**
11
- * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
12
- * @alpha
13
- * @legacy
14
- */
15
- export declare const SharedTreeFactoryType = "https://graph.microsoft.com/types/tree";
16
- /**
17
- * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
18
- * @alpha
19
- * @legacy
20
- */
21
- export declare const SharedTreeAttributes: IChannelAttributes;
22
10
  /**
23
11
  * A channel factory that creates an {@link ITree}.
24
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"treeFactory.d.ts","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACN,KAAK,iBAAiB,EAEtB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EACN,UAAU,IAAI,cAAc,EAC5B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAIpD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,2CAA2C,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,kBAIlC,CAAC;AAEF;;GAEG;AACH,qBAAa,WAAY,YAAW,eAAe,CAAC,KAAK,CAAC;IAMtC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAL3C,OAAc,IAAI,EAAE,MAAM,CAAyB;IACnD,SAAgB,IAAI,EAAE,MAAM,CAAyB;IAErD,SAAgB,UAAU,EAAE,kBAAkB,CAAwB;gBAElC,OAAO,EAAE,yBAAyB;IAEzD,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,iBAAiB,EAAE,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C,cAAc,CAAC;IAMnB,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc;CAK1E;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,oDAA2B,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,iBAAiB,GACxB,iBAAiB,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAOpD"}
@@ -4,34 +4,18 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.configuredSharedTree = exports.SharedTree = exports.TreeFactory = exports.SharedTreeAttributes = exports.SharedTreeFactoryType = void 0;
7
+ exports.configuredSharedTree = exports.SharedTree = exports.TreeFactory = void 0;
8
8
  const internal_1 = require("@fluidframework/shared-object-base/internal");
9
9
  const index_js_1 = require("./shared-tree/index.js");
10
- const packageVersion_js_1 = require("./packageVersion.js");
11
- /**
12
- * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory."type"}
13
- * @alpha
14
- * @legacy
15
- */
16
- exports.SharedTreeFactoryType = "https://graph.microsoft.com/types/tree";
17
- /**
18
- * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}
19
- * @alpha
20
- * @legacy
21
- */
22
- exports.SharedTreeAttributes = {
23
- type: exports.SharedTreeFactoryType,
24
- snapshotFormatVersion: "0.0.0",
25
- packageVersion: packageVersion_js_1.pkgVersion,
26
- };
10
+ const sharedTreeAttributes_js_1 = require("./sharedTreeAttributes.js");
27
11
  /**
28
12
  * A channel factory that creates an {@link ITree}.
29
13
  */
30
14
  class TreeFactory {
31
15
  constructor(options) {
32
16
  this.options = options;
33
- this.type = exports.SharedTreeFactoryType;
34
- this.attributes = exports.SharedTreeAttributes;
17
+ this.type = sharedTreeAttributes_js_1.SharedTreeFactoryType;
18
+ this.attributes = sharedTreeAttributes_js_1.SharedTreeAttributes;
35
19
  }
36
20
  async load(runtime, id, services, channelAttributes) {
37
21
  const tree = new index_js_1.SharedTree(id, runtime, channelAttributes, this.options);
@@ -45,7 +29,7 @@ class TreeFactory {
45
29
  }
46
30
  }
47
31
  exports.TreeFactory = TreeFactory;
48
- TreeFactory.Type = exports.SharedTreeFactoryType;
32
+ TreeFactory.Type = sharedTreeAttributes_js_1.SharedTreeFactoryType;
49
33
  /**
50
34
  * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees
51
35
  * of objects, arrays, and other data types.
@@ -1 +1 @@
1
- {"version":3,"file":"treeFactory.js","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,0EAGqD;AAErD,qDAIgC;AAGhC,2DAAiD;AAEjD;;;;GAIG;AACU,QAAA,qBAAqB,GAAG,wCAAwC,CAAC;AAE9E;;;;GAIG;AACU,QAAA,oBAAoB,GAAuB;IACvD,IAAI,EAAE,6BAAqB;IAC3B,qBAAqB,EAAE,OAAO;IAC9B,cAAc,EAAE,8BAAU;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAa,WAAW;IAMvB,YAAoC,OAAkC;QAAlC,YAAO,GAAP,OAAO,CAA2B;QAJtD,SAAI,GAAW,6BAAqB,CAAC;QAErC,eAAU,GAAuB,4BAAoB,CAAC;IAEG,CAAC;IAEnE,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,iBAA+C;QAE/C,MAAM,IAAI,GAAG,IAAI,qBAAc,CAAC,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9E,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,IAAI,GAAG,IAAI,qBAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5E,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;;AAvBF,kCAwBC;AAvBc,gBAAI,GAAW,6BAAqB,AAAhC,CAAiC;AAyBpD;;;;;GAKG;AACU,QAAA,UAAU,GAAG,oBAAoB,CAAC,EAAE,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,oBAAoB,CACnC,OAA0B;IAE1B,MAAM,iBAAkB,SAAQ,WAAW;QAC1C;YACC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChB,CAAC;KACD;IACD,OAAO,IAAA,iCAAsB,EAAQ,iBAAiB,CAAC,CAAC;AACzD,CAAC;AATD,oDASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport {\n\ttype ISharedObjectKind,\n\tcreateSharedObjectKind,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport {\n\tSharedTree as SharedTreeImpl,\n\ttype SharedTreeOptions,\n\ttype SharedTreeOptionsInternal,\n} from \"./shared-tree/index.js\";\nimport type { ITree } from \"./simple-tree/index.js\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.\"type\"}\n * @alpha\n * @legacy\n */\nexport const SharedTreeFactoryType = \"https://graph.microsoft.com/types/tree\";\n\n/**\n * {@inheritDoc @fluidframework/shared-object-base#ISharedObjectFactory.attributes}\n * @alpha\n * @legacy\n */\nexport const SharedTreeAttributes: IChannelAttributes = {\n\ttype: SharedTreeFactoryType,\n\tsnapshotFormatVersion: \"0.0.0\",\n\tpackageVersion: pkgVersion,\n};\n\n/**\n * A channel factory that creates an {@link ITree}.\n */\nexport class TreeFactory implements IChannelFactory<ITree> {\n\tpublic static Type: string = SharedTreeFactoryType;\n\tpublic readonly type: string = SharedTreeFactoryType;\n\n\tpublic readonly attributes: IChannelAttributes = SharedTreeAttributes;\n\n\tpublic constructor(private readonly options: SharedTreeOptionsInternal) {}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<SharedTreeImpl> {\n\t\tconst tree = new SharedTreeImpl(id, runtime, channelAttributes, this.options);\n\t\tawait tree.load(services);\n\t\treturn tree;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTreeImpl {\n\t\tconst tree = new SharedTreeImpl(id, runtime, this.attributes, this.options);\n\t\ttree.initializeLocal();\n\t\treturn tree;\n\t}\n}\n\n/**\n * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees\n * of objects, arrays, and other data types.\n * @legacy\n * @alpha\n */\nexport const SharedTree = configuredSharedTree({});\n\n/**\n * {@link SharedTree} but allowing a non-default configuration.\n * @remarks\n * This is useful for debugging and testing to opt into extra validation or see if opting out of some optimizations fixes an issue.\n * @example\n * ```typescript\n * import {\n * \tForestType,\n * \tTreeCompressionStrategy,\n * \tconfiguredSharedTree,\n * \ttypeboxValidator,\n * \t// eslint-disable-next-line import/no-internal-modules\n * } from \"@fluidframework/tree/internal\";\n * const SharedTree = configuredSharedTree({\n * \tforest: ForestType.Reference,\n * \tjsonValidator: typeboxValidator,\n * \ttreeEncodeType: TreeCompressionStrategy.Uncompressed,\n * });\n * ```\n * @privateRemarks\n * This should be legacy, but has to be internal due to limitations of API tagging preventing it from being both alpha and alpha+legacy.\n * TODO:\n * Expose Ajv validator for better error message quality somehow.\n * Maybe as part of a test utils or dev-tool package?\n * @internal\n */\nexport function configuredSharedTree(\n\toptions: SharedTreeOptions,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\tclass ConfiguredFactory extends TreeFactory {\n\t\tpublic constructor() {\n\t\t\tsuper(options);\n\t\t}\n\t}\n\treturn createSharedObjectKind<ITree>(ConfiguredFactory);\n}\n"]}
1
+ {"version":3,"file":"treeFactory.js","sourceRoot":"","sources":["../src/treeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,0EAGqD;AAErD,qDAIgC;AAGhC,uEAAwF;AAExF;;GAEG;AACH,MAAa,WAAW;IAMvB,YAAoC,OAAkC;QAAlC,YAAO,GAAP,OAAO,CAA2B;QAJtD,SAAI,GAAW,+CAAqB,CAAC;QAErC,eAAU,GAAuB,8CAAoB,CAAC;IAEG,CAAC;IAEnE,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,iBAA+C;QAE/C,MAAM,IAAI,GAAG,IAAI,qBAAc,CAAC,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9E,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,IAAI,GAAG,IAAI,qBAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5E,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;;AAvBF,kCAwBC;AAvBc,gBAAI,GAAW,+CAAqB,AAAhC,CAAiC;AAyBpD;;;;;GAKG;AACU,QAAA,UAAU,GAAG,oBAAoB,CAAC,EAAE,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,oBAAoB,CACnC,OAA0B;IAE1B,MAAM,iBAAkB,SAAQ,WAAW;QAC1C;YACC,KAAK,CAAC,OAAO,CAAC,CAAC;QAChB,CAAC;KACD;IACD,OAAO,IAAA,iCAAsB,EAAQ,iBAAiB,CAAC,CAAC;AACzD,CAAC;AATD,oDASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\nimport {\n\ttype ISharedObjectKind,\n\tcreateSharedObjectKind,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport {\n\tSharedTree as SharedTreeImpl,\n\ttype SharedTreeOptions,\n\ttype SharedTreeOptionsInternal,\n} from \"./shared-tree/index.js\";\nimport type { ITree } from \"./simple-tree/index.js\";\n\nimport { SharedTreeFactoryType, SharedTreeAttributes } from \"./sharedTreeAttributes.js\";\n\n/**\n * A channel factory that creates an {@link ITree}.\n */\nexport class TreeFactory implements IChannelFactory<ITree> {\n\tpublic static Type: string = SharedTreeFactoryType;\n\tpublic readonly type: string = SharedTreeFactoryType;\n\n\tpublic readonly attributes: IChannelAttributes = SharedTreeAttributes;\n\n\tpublic constructor(private readonly options: SharedTreeOptionsInternal) {}\n\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tchannelAttributes: Readonly<IChannelAttributes>,\n\t): Promise<SharedTreeImpl> {\n\t\tconst tree = new SharedTreeImpl(id, runtime, channelAttributes, this.options);\n\t\tawait tree.load(services);\n\t\treturn tree;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTreeImpl {\n\t\tconst tree = new SharedTreeImpl(id, runtime, this.attributes, this.options);\n\t\ttree.initializeLocal();\n\t\treturn tree;\n\t}\n}\n\n/**\n * SharedTree is a hierarchical data structure for collaboratively editing strongly typed JSON-like trees\n * of objects, arrays, and other data types.\n * @legacy\n * @alpha\n */\nexport const SharedTree = configuredSharedTree({});\n\n/**\n * {@link SharedTree} but allowing a non-default configuration.\n * @remarks\n * This is useful for debugging and testing to opt into extra validation or see if opting out of some optimizations fixes an issue.\n * @example\n * ```typescript\n * import {\n * \tForestType,\n * \tTreeCompressionStrategy,\n * \tconfiguredSharedTree,\n * \ttypeboxValidator,\n * \t// eslint-disable-next-line import/no-internal-modules\n * } from \"@fluidframework/tree/internal\";\n * const SharedTree = configuredSharedTree({\n * \tforest: ForestType.Reference,\n * \tjsonValidator: typeboxValidator,\n * \ttreeEncodeType: TreeCompressionStrategy.Uncompressed,\n * });\n * ```\n * @privateRemarks\n * This should be legacy, but has to be internal due to limitations of API tagging preventing it from being both alpha and alpha+legacy.\n * TODO:\n * Expose Ajv validator for better error message quality somehow.\n * Maybe as part of a test utils or dev-tool package?\n * @internal\n */\nexport function configuredSharedTree(\n\toptions: SharedTreeOptions,\n): ISharedObjectKind<ITree> & SharedObjectKind<ITree> {\n\tclass ConfiguredFactory extends TreeFactory {\n\t\tpublic constructor() {\n\t\t\tsuper(options);\n\t\t}\n\t}\n\treturn createSharedObjectKind<ITree>(ConfiguredFactory);\n}\n"]}
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ /**
6
+ * Like `JSON.stringify`, but returns a clone instead of stringifying the result.
7
+ *
8
+ * @remarks Only considers enumerable own properties with string keys.
9
+ *
10
+ * @param root - Data to clone.
11
+ * @param rootKey - The key to pass to replacer for the root.
12
+ * @param replacer - Like `JSON.stringify`'s replacer: called for every value while walking data. Unlike `JSON.stringify`'s replacer, this
13
+ * returns a wrapper around the value with a "clone" flag to indicate if the clone should recurse into that object (true) or use it as is (false).
14
+ * @returns A clone of `root`.
15
+ * @alpha
16
+ */
17
+ export declare function cloneWithReplacements(root: unknown, rootKey: string, replacer: (key: string, value: unknown) => {
18
+ clone: boolean;
19
+ value: unknown;
20
+ }): unknown;
21
+ //# sourceMappingURL=cloneWithReplacements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloneWithReplacements.d.ts","sourceRoot":"","sources":["../../src/util/cloneWithReplacements.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC3E,OAAO,CAmBT"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.cloneWithReplacements = void 0;
8
+ /**
9
+ * Like `JSON.stringify`, but returns a clone instead of stringifying the result.
10
+ *
11
+ * @remarks Only considers enumerable own properties with string keys.
12
+ *
13
+ * @param root - Data to clone.
14
+ * @param rootKey - The key to pass to replacer for the root.
15
+ * @param replacer - Like `JSON.stringify`'s replacer: called for every value while walking data. Unlike `JSON.stringify`'s replacer, this
16
+ * returns a wrapper around the value with a "clone" flag to indicate if the clone should recurse into that object (true) or use it as is (false).
17
+ * @returns A clone of `root`.
18
+ * @alpha
19
+ */
20
+ function cloneWithReplacements(root, rootKey, replacer) {
21
+ const { clone, value } = replacer(rootKey, root);
22
+ if (clone === false) {
23
+ return value;
24
+ }
25
+ if (root === null || typeof root !== "object") {
26
+ return root;
27
+ }
28
+ if (Array.isArray(root)) {
29
+ return root.map((item, index) => cloneWithReplacements(item, index.toString(), replacer));
30
+ }
31
+ const result = {};
32
+ for (const [key, field] of Object.entries(root)) {
33
+ result[key] = cloneWithReplacements(field, key, replacer);
34
+ }
35
+ return result;
36
+ }
37
+ exports.cloneWithReplacements = cloneWithReplacements;
38
+ //# sourceMappingURL=cloneWithReplacements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloneWithReplacements.js","sourceRoot":"","sources":["../../src/util/cloneWithReplacements.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;;GAWG;AACH,SAAgB,qBAAqB,CACpC,IAAa,EACb,OAAe,EACf,QAA6E;IAE7E,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACjD,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACd,CAAC;IAED,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACjD,MAAM,CAAC,GAAG,CAAC,GAAG,qBAAqB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAvBD,sDAuBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Like `JSON.stringify`, but returns a clone instead of stringifying the result.\n *\n * @remarks Only considers enumerable own properties with string keys.\n *\n * @param root - Data to clone.\n * @param rootKey - The key to pass to replacer for the root.\n * @param replacer - Like `JSON.stringify`'s replacer: called for every value while walking data. Unlike `JSON.stringify`'s replacer, this\n * returns a wrapper around the value with a \"clone\" flag to indicate if the clone should recurse into that object (true) or use it as is (false).\n * @returns A clone of `root`.\n * @alpha\n */\nexport function cloneWithReplacements(\n\troot: unknown,\n\trootKey: string,\n\treplacer: (key: string, value: unknown) => { clone: boolean; value: unknown },\n): unknown {\n\tconst { clone, value } = replacer(rootKey, root);\n\tif (clone === false) {\n\t\treturn value;\n\t}\n\n\tif (root === null || typeof root !== \"object\") {\n\t\treturn root;\n\t}\n\n\tif (Array.isArray(root)) {\n\t\treturn root.map((item, index) => cloneWithReplacements(item, index.toString(), replacer));\n\t}\n\n\tconst result: Record<string, unknown> = {};\n\tfor (const [key, field] of Object.entries(root)) {\n\t\tresult[key] = cloneWithReplacements(field, key, replacer);\n\t}\n\treturn result;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"idAllocator.d.ts","sourceRoot":"","sources":["../../src/util/idAllocator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,GAAG,GAAG,MAAM;IACxC;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,GAAG,CAAC;IAClC;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,oBAAoB,CAAC,KAAK,GAAE,MAAM,GAAG,SAAqB,GAAG,WAAW,CAEvF;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,GAAG,WAAW,CAW1E;AAED,eAAO,MAAM,eAAe,EAAE,WAG7B,CAAC"}
1
+ {"version":3,"file":"idAllocator.d.ts","sourceRoot":"","sources":["../../src/util/idAllocator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,GAAG,GAAG,MAAM;IACxC;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,GAAG,CAAC;IAClC;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,oBAAoB,CAAC,KAAK,GAAE,MAAM,GAAG,SAAqB,GAAG,WAAW,CAEvF;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,GAAG,WAAW,CAW1E;AAED,eAAO,MAAM,eAAe,EAAE,WAG7B,CAAC"}
@@ -6,7 +6,6 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.fakeIdAllocator = exports.idAllocatorFromState = exports.idAllocatorFromMaxId = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
- const utils_js_1 = require("./utils.js");
10
9
  function idAllocatorFromMaxId(maxId = undefined) {
11
10
  return idAllocatorFromState({ maxId: maxId ?? -1 });
12
11
  }
@@ -25,7 +24,7 @@ function idAllocatorFromState(state) {
25
24
  }
26
25
  exports.idAllocatorFromState = idAllocatorFromState;
27
26
  exports.fakeIdAllocator = {
28
- allocate: () => (0, utils_js_1.fail)(0xae6 /* Should not allocate IDs */),
27
+ allocate: () => (0, internal_1.fail)(0xae6 /* Should not allocate IDs */),
29
28
  getMaxId: () => 0,
30
29
  };
31
30
  //# sourceMappingURL=idAllocator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"idAllocator.js","sourceRoot":"","sources":["../../src/util/idAllocator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,yCAAkC;AAqBlC,SAAgB,oBAAoB,CAAC,QAA4B,SAAS;IACzE,OAAO,oBAAoB,CAAC,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;AACrD,CAAC;AAFD,oDAEC;AAED,SAAgB,oBAAoB,CAAC,KAAwB;IAC5D,OAAO;QACN,QAAQ,EAAE,CAAC,CAAU,EAAU,EAAE;YAChC,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC;YACrB,IAAA,iBAAM,EAAC,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,mCAAmC,CAAC,CAAC;YAC7D,MAAM,EAAE,GAAW,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;YACnC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC;YACrB,OAAO,EAAE,CAAC;QACX,CAAC;QACD,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK;KAC3B,CAAC;AACH,CAAC;AAXD,oDAWC;AAEY,QAAA,eAAe,GAAgB;IAC3C,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAA,eAAI,EAAC,KAAK,CAAC,6BAA6B,CAAC;IACzD,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;CACjB,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\";\n\nimport { fail } from \"./utils.js\";\n\n/**\n * Used for allocating IDs unique to a particular instance of the allocator.\n */\nexport interface IdAllocator<TId = number> {\n\t/**\n\t * Allocates a block of `count` consecutive IDs and returns the first ID in the block.\n\t * For convenience can be called with no parameters to allocate a single ID.\n\t */\n\tallocate: (count?: number) => TId;\n\t/**\n\t * @returns The maximum ID that was generated by this allocator.\n\t */\n\tgetMaxId: () => TId;\n}\n\nexport interface IdAllocationState {\n\tmaxId: number;\n}\n\nexport function idAllocatorFromMaxId(maxId: number | undefined = undefined): IdAllocator {\n\treturn idAllocatorFromState({ maxId: maxId ?? -1 });\n}\n\nexport function idAllocatorFromState(state: IdAllocationState): IdAllocator {\n\treturn {\n\t\tallocate: (c?: number): number => {\n\t\t\tconst count = c ?? 1;\n\t\t\tassert(count > 0, 0x5cf /* Must allocate at least one ID */);\n\t\t\tconst id: number = state.maxId + 1;\n\t\t\tstate.maxId += count;\n\t\t\treturn id;\n\t\t},\n\t\tgetMaxId: () => state.maxId,\n\t};\n}\n\nexport const fakeIdAllocator: IdAllocator = {\n\tallocate: () => fail(0xae6 /* Should not allocate IDs */),\n\tgetMaxId: () => 0,\n};\n"]}
1
+ {"version":3,"file":"idAllocator.js","sourceRoot":"","sources":["../../src/util/idAllocator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAmE;AAqBnE,SAAgB,oBAAoB,CAAC,QAA4B,SAAS;IACzE,OAAO,oBAAoB,CAAC,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;AACrD,CAAC;AAFD,oDAEC;AAED,SAAgB,oBAAoB,CAAC,KAAwB;IAC5D,OAAO;QACN,QAAQ,EAAE,CAAC,CAAU,EAAU,EAAE;YAChC,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC;YACrB,IAAA,iBAAM,EAAC,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,mCAAmC,CAAC,CAAC;YAC7D,MAAM,EAAE,GAAW,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;YACnC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC;YACrB,OAAO,EAAE,CAAC;QACX,CAAC;QACD,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK;KAC3B,CAAC;AACH,CAAC;AAXD,oDAWC;AAEY,QAAA,eAAe,GAAgB;IAC3C,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAA,eAAI,EAAC,KAAK,CAAC,6BAA6B,CAAC;IACzD,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;CACjB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\n\n/**\n * Used for allocating IDs unique to a particular instance of the allocator.\n */\nexport interface IdAllocator<TId = number> {\n\t/**\n\t * Allocates a block of `count` consecutive IDs and returns the first ID in the block.\n\t * For convenience can be called with no parameters to allocate a single ID.\n\t */\n\tallocate: (count?: number) => TId;\n\t/**\n\t * @returns The maximum ID that was generated by this allocator.\n\t */\n\tgetMaxId: () => TId;\n}\n\nexport interface IdAllocationState {\n\tmaxId: number;\n}\n\nexport function idAllocatorFromMaxId(maxId: number | undefined = undefined): IdAllocator {\n\treturn idAllocatorFromState({ maxId: maxId ?? -1 });\n}\n\nexport function idAllocatorFromState(state: IdAllocationState): IdAllocator {\n\treturn {\n\t\tallocate: (c?: number): number => {\n\t\t\tconst count = c ?? 1;\n\t\t\tassert(count > 0, 0x5cf /* Must allocate at least one ID */);\n\t\t\tconst id: number = state.maxId + 1;\n\t\t\tstate.maxId += count;\n\t\t\treturn id;\n\t\t},\n\t\tgetMaxId: () => state.maxId,\n\t};\n}\n\nexport const fakeIdAllocator: IdAllocator = {\n\tallocate: () => fail(0xae6 /* Should not allocate IDs */),\n\tgetMaxId: () => 0,\n};\n"]}
@@ -10,7 +10,7 @@ export { addToNestedSet, type NestedSet, nestedSetContains } from "./nestedSet.j
10
10
  export { type OffsetList, OffsetListFactory } from "./offsetList.js";
11
11
  export type { areSafelyAssignable, Contravariant, Covariant, eitherIsAny, EnforceTypeCheckTests, Invariant, isAny, isAssignableTo, isStrictSubset, MakeNominal, requireFalse, requireTrue, requireAssignableTo, areOnlyKeys, } from "./typeCheck.js";
12
12
  export { StackyIterator } from "./stackyIterator.js";
13
- export { asMutable, balancedReduce, clone, compareSets, fail, getOrAddEmptyToMap, getOrCreate, isJsonObject, isReadonlyArray, type JsonCompatible, type JsonCompatibleObject, type JsonCompatibleReadOnly, type JsonCompatibleReadOnlyObject, JsonCompatibleReadOnlySchema, makeArray, mapIterable, filterIterable, type Mutable, type Populated, type RecursiveReadonly, assertValidIndex, assertValidRange, assertNonNegativeSafeInteger, objectToMap, invertMap, oneFromSet, type Named, compareNamed, disposeSymbol, type IDisposable, capitalize, assertValidRangeIndices, transformObjectMap, compareStrings, find, count, getLast, hasSome, hasSingle, defineLazyCachedProperty, copyPropertyIfDefined as copyProperty, getOrAddInMap, } from "./utils.js";
13
+ export { asMutable, balancedReduce, clone, compareSets, getOrAddEmptyToMap, getOrCreate, isJsonObject, isReadonlyArray, type JsonCompatible, type JsonCompatibleObject, type JsonCompatibleReadOnly, type JsonCompatibleReadOnlyObject, JsonCompatibleReadOnlySchema, makeArray, mapIterable, filterIterable, type Mutable, type Populated, type RecursiveReadonly, assertValidIndex, assertValidRange, assertNonNegativeSafeInteger, objectToMap, invertMap, oneFromSet, type Named, compareNamed, disposeSymbol, type IDisposable, capitalize, assertValidRangeIndices, transformObjectMap, compareStrings, find, count, getLast, hasSome, hasSingle, defineLazyCachedProperty, copyPropertyIfDefined as copyProperty, getOrAddInMap, } from "./utils.js";
14
14
  export { ReferenceCountedBase, type ReferenceCounted } from "./referenceCounting.js";
15
15
  export type { _RecursiveTrick, RestrictiveReadonlyRecord, RestrictiveStringRecord, _InlineTrick, FlattenKeys, IsUnion, UnionToIntersection, UnionToTuple, PopUnion, } from "./typeUtils.js";
16
16
  export { unsafeArrayToTuple } from "./typeUtils.js";
@@ -19,4 +19,5 @@ export { RangeMap, type RangeQueryResult, newIntegerRangeMap, } from "./rangeMap
19
19
  export { type IdAllocator, idAllocatorFromMaxId, idAllocatorFromState, type IdAllocationState, fakeIdAllocator, } from "./idAllocator.js";
20
20
  export { Breakable, type WithBreakable, breakingMethod, throwIfBroken, breakingClass, } from "./breakable.js";
21
21
  export { type TupleBTree, newTupleBTree, mergeTupleBTrees } from "./bTreeUtils.js";
22
+ export { cloneWithReplacements } from "./cloneWithReplacements.js";
22
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"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,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,4BAA4B,EAC5B,WAAW,EACX,SAAS,EACT,UAAU,EACV,KAAK,KAAK,EACV,YAAY,EACZ,aAAa,EACb,KAAK,WAAW,EAChB,UAAU,EACV,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAS,EACT,wBAAwB,EACxB,qBAAqB,IAAI,YAAY,EACrC,aAAa,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAErF,YAAY,EACX,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,QAAQ,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EACN,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,WAAW,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,QAAQ,EACR,KAAK,gBAAgB,EACrB,kBAAkB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,KAAK,WAAW,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,eAAe,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,SAAS,EACT,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,aAAa,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,EACL,KAAK,K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C5B,WAAW,EACX,SAAS,EACT,UAAU,EACV,KAAK,KAAK,EACV,YAAY,EACZ,aAAa,EACb,KAAK,WAAW,EAChB,UAAU,EACV,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAS,EACT,wBAAwB,EACxB,qBAAqB,IAAI,YAAY,EACrC,aAAa,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAErF,YAAY,EACX,eAAe,EACf,yBAAyB,EACzB,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,QAAQ,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EACN,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,WAAW,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,QAAQ,EACR,KAAK,gBAAgB,EACrB,kBAAkB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACN,KAAK,WAAW,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,eAAe,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,SAAS,EACT,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,aAAa,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -4,8 +4,8 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.count = exports.find = exports.compareStrings = exports.transformObjectMap = exports.assertValidRangeIndices = exports.capitalize = exports.disposeSymbol = exports.compareNamed = exports.oneFromSet = exports.invertMap = exports.objectToMap = exports.assertNonNegativeSafeInteger = exports.assertValidRange = exports.assertValidIndex = exports.filterIterable = exports.mapIterable = exports.makeArray = exports.JsonCompatibleReadOnlySchema = exports.isReadonlyArray = exports.isJsonObject = exports.getOrCreate = exports.getOrAddEmptyToMap = exports.fail = exports.compareSets = exports.clone = exports.balancedReduce = exports.asMutable = exports.StackyIterator = exports.OffsetListFactory = exports.nestedSetContains = exports.addToNestedSet = exports.getOrCreateInNestedMap = exports.nestedMapFromFlatList = exports.nestedMapToFlatList = exports.mapNestedMap = exports.tryGetFromNestedMap = exports.tryAddToNestedMap = exports.setInNestedMap = exports.populateNestedMap = exports.SizedNestedMap = exports.forEachInNestedMap = exports.getOrDefaultInNestedMap = exports.getOrAddInNestedMap = exports.deleteFromNestedMap = exports.extractFromOpaque = exports.brandOpaque = exports.brandedStringType = exports.brandedNumberType = exports.BrandedType = exports.brand = void 0;
8
- exports.mergeTupleBTrees = exports.newTupleBTree = exports.breakingClass = exports.throwIfBroken = exports.breakingMethod = exports.Breakable = exports.fakeIdAllocator = exports.idAllocatorFromState = exports.idAllocatorFromMaxId = exports.newIntegerRangeMap = exports.RangeMap = exports.brandedSlot = exports.getOrCreateSlotContent = exports.unsafeArrayToTuple = exports.ReferenceCountedBase = exports.getOrAddInMap = exports.copyProperty = exports.defineLazyCachedProperty = exports.hasSingle = exports.hasSome = exports.getLast = void 0;
7
+ exports.getLast = exports.count = exports.find = exports.compareStrings = exports.transformObjectMap = exports.assertValidRangeIndices = exports.capitalize = exports.disposeSymbol = exports.compareNamed = exports.oneFromSet = exports.invertMap = exports.objectToMap = exports.assertNonNegativeSafeInteger = exports.assertValidRange = exports.assertValidIndex = exports.filterIterable = exports.mapIterable = exports.makeArray = exports.JsonCompatibleReadOnlySchema = exports.isReadonlyArray = exports.isJsonObject = exports.getOrCreate = exports.getOrAddEmptyToMap = exports.compareSets = exports.clone = exports.balancedReduce = exports.asMutable = exports.StackyIterator = exports.OffsetListFactory = exports.nestedSetContains = exports.addToNestedSet = exports.getOrCreateInNestedMap = exports.nestedMapFromFlatList = exports.nestedMapToFlatList = exports.mapNestedMap = exports.tryGetFromNestedMap = exports.tryAddToNestedMap = exports.setInNestedMap = exports.populateNestedMap = exports.SizedNestedMap = exports.forEachInNestedMap = exports.getOrDefaultInNestedMap = exports.getOrAddInNestedMap = exports.deleteFromNestedMap = exports.extractFromOpaque = exports.brandOpaque = exports.brandedStringType = exports.brandedNumberType = exports.BrandedType = exports.brand = void 0;
8
+ exports.cloneWithReplacements = exports.mergeTupleBTrees = exports.newTupleBTree = exports.breakingClass = exports.throwIfBroken = exports.breakingMethod = exports.Breakable = exports.fakeIdAllocator = exports.idAllocatorFromState = exports.idAllocatorFromMaxId = exports.newIntegerRangeMap = exports.RangeMap = exports.brandedSlot = exports.getOrCreateSlotContent = exports.unsafeArrayToTuple = exports.ReferenceCountedBase = exports.getOrAddInMap = exports.copyProperty = exports.defineLazyCachedProperty = exports.hasSingle = exports.hasSome = void 0;
9
9
  var brand_js_1 = require("./brand.js");
10
10
  Object.defineProperty(exports, "brand", { enumerable: true, get: function () { return brand_js_1.brand; } });
11
11
  Object.defineProperty(exports, "BrandedType", { enumerable: true, get: function () { return brand_js_1.BrandedType; } });
@@ -41,7 +41,6 @@ Object.defineProperty(exports, "asMutable", { enumerable: true, get: function ()
41
41
  Object.defineProperty(exports, "balancedReduce", { enumerable: true, get: function () { return utils_js_1.balancedReduce; } });
42
42
  Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return utils_js_1.clone; } });
43
43
  Object.defineProperty(exports, "compareSets", { enumerable: true, get: function () { return utils_js_1.compareSets; } });
44
- Object.defineProperty(exports, "fail", { enumerable: true, get: function () { return utils_js_1.fail; } });
45
44
  Object.defineProperty(exports, "getOrAddEmptyToMap", { enumerable: true, get: function () { return utils_js_1.getOrAddEmptyToMap; } });
46
45
  Object.defineProperty(exports, "getOrCreate", { enumerable: true, get: function () { return utils_js_1.getOrCreate; } });
47
46
  Object.defineProperty(exports, "isJsonObject", { enumerable: true, get: function () { return utils_js_1.isJsonObject; } });
@@ -92,4 +91,6 @@ Object.defineProperty(exports, "breakingClass", { enumerable: true, get: functio
92
91
  var bTreeUtils_js_1 = require("./bTreeUtils.js");
93
92
  Object.defineProperty(exports, "newTupleBTree", { enumerable: true, get: function () { return bTreeUtils_js_1.newTupleBTree; } });
94
93
  Object.defineProperty(exports, "mergeTupleBTrees", { enumerable: true, get: function () { return bTreeUtils_js_1.mergeTupleBTrees; } });
94
+ var cloneWithReplacements_js_1 = require("./cloneWithReplacements.js");
95
+ Object.defineProperty(exports, "cloneWithReplacements", { enumerable: true, get: function () { return cloneWithReplacements_js_1.cloneWithReplacements; } });
95
96
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,uCAMoB;AALnB,iGAAA,KAAK,OAAA;AAEL,uGAAA,WAAW,OAAA;AAIZ,qDAAyE;AAAhE,oHAAA,iBAAiB,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAC7C,yCAKqB;AAJpB,wGAAA,WAAW,OAAA;AACX,8GAAA,iBAAiB,OAAA;AAIlB,+CAgBwB;AAfvB,mHAAA,mBAAmB,OAAA;AACnB,mHAAA,mBAAmB,OAAA;AACnB,uHAAA,uBAAuB,OAAA;AACvB,kHAAA,kBAAkB,OAAA;AAGlB,8GAAA,cAAc,OAAA;AACd,iHAAA,iBAAiB,OAAA;AACjB,8GAAA,cAAc,OAAA;AACd,iHAAA,iBAAiB,OAAA;AACjB,mHAAA,mBAAmB,OAAA;AACnB,4GAAA,YAAY,OAAA;AACZ,mHAAA,mBAAmB,OAAA;AACnB,qHAAA,qBAAqB,OAAA;AACrB,sHAAA,sBAAsB,OAAA;AAEvB,+CAAmF;AAA1E,8GAAA,cAAc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sHAAA,oBAAoB,OAAA;AACpB,sHAAA,oBAAoB,OAAA;AAEpB,iHAAA,eAAe,OAAA;AAGhB,+CAMwB;AALvB,yGAAA,SAAS,OAAA;AAET,8GAAA,cAAc,OAAA;AACd,6GAAA,aAAa,OAAA;AACb,6GAAA,aAAa,OAAA;AAGd,iDAAmF;AAAzD,8GAAA,aAAa,OAAA;AAAE,iHAAA,gBAAgB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tbrand,\n\ttype Brand,\n\tBrandedType,\n\ttype NameFromBranded,\n\ttype ValueFromBranded,\n} from \"./brand.js\";\nexport { brandedNumberType, brandedStringType } from \"./typeboxBrand.js\";\nexport {\n\tbrandOpaque,\n\textractFromOpaque,\n\ttype ExtractFromOpaque,\n\ttype Opaque,\n} from \"./opaque.js\";\nexport {\n\tdeleteFromNestedMap,\n\tgetOrAddInNestedMap,\n\tgetOrDefaultInNestedMap,\n\tforEachInNestedMap,\n\ttype NestedMap,\n\ttype ReadonlyNestedMap,\n\tSizedNestedMap,\n\tpopulateNestedMap,\n\tsetInNestedMap,\n\ttryAddToNestedMap,\n\ttryGetFromNestedMap,\n\tmapNestedMap,\n\tnestedMapToFlatList,\n\tnestedMapFromFlatList,\n\tgetOrCreateInNestedMap,\n} from \"./nestedMap.js\";\nexport { addToNestedSet, type NestedSet, nestedSetContains } from \"./nestedSet.js\";\nexport { type OffsetList, OffsetListFactory } from \"./offsetList.js\";\nexport type {\n\tareSafelyAssignable,\n\tContravariant,\n\tCovariant,\n\teitherIsAny,\n\tEnforceTypeCheckTests,\n\tInvariant,\n\tisAny,\n\tisAssignableTo,\n\tisStrictSubset,\n\tMakeNominal,\n\trequireFalse,\n\trequireTrue,\n\trequireAssignableTo,\n\tareOnlyKeys,\n} from \"./typeCheck.js\";\nexport { StackyIterator } from \"./stackyIterator.js\";\nexport {\n\tasMutable,\n\tbalancedReduce,\n\tclone,\n\tcompareSets,\n\tfail,\n\tgetOrAddEmptyToMap,\n\tgetOrCreate,\n\tisJsonObject,\n\tisReadonlyArray,\n\ttype JsonCompatible,\n\ttype JsonCompatibleObject,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n\tJsonCompatibleReadOnlySchema,\n\tmakeArray,\n\tmapIterable,\n\tfilterIterable,\n\ttype Mutable,\n\ttype Populated,\n\ttype RecursiveReadonly,\n\tassertValidIndex,\n\tassertValidRange,\n\tassertNonNegativeSafeInteger,\n\tobjectToMap,\n\tinvertMap,\n\toneFromSet,\n\ttype Named,\n\tcompareNamed,\n\tdisposeSymbol,\n\ttype IDisposable,\n\tcapitalize,\n\tassertValidRangeIndices,\n\ttransformObjectMap,\n\tcompareStrings,\n\tfind,\n\tcount,\n\tgetLast,\n\thasSome,\n\thasSingle,\n\tdefineLazyCachedProperty,\n\tcopyPropertyIfDefined as copyProperty,\n\tgetOrAddInMap,\n} from \"./utils.js\";\nexport { ReferenceCountedBase, type ReferenceCounted } from \"./referenceCounting.js\";\n\nexport type {\n\t_RecursiveTrick,\n\tRestrictiveReadonlyRecord,\n\tRestrictiveStringRecord,\n\t_InlineTrick,\n\tFlattenKeys,\n\tIsUnion,\n\tUnionToIntersection,\n\tUnionToTuple,\n\tPopUnion,\n} from \"./typeUtils.js\";\n\nexport { unsafeArrayToTuple } from \"./typeUtils.js\";\n\nexport {\n\ttype BrandedKey,\n\ttype BrandedKeyContent,\n\ttype BrandedMapSubset,\n\tgetOrCreateSlotContent,\n\tbrandedSlot,\n} from \"./brandedMap.js\";\n\nexport {\n\tRangeMap,\n\ttype RangeQueryResult,\n\tnewIntegerRangeMap,\n} from \"./rangeMap.js\";\n\nexport {\n\ttype IdAllocator,\n\tidAllocatorFromMaxId,\n\tidAllocatorFromState,\n\ttype IdAllocationState,\n\tfakeIdAllocator,\n} from \"./idAllocator.js\";\n\nexport {\n\tBreakable,\n\ttype WithBreakable,\n\tbreakingMethod,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"./breakable.js\";\n\nexport { type TupleBTree, newTupleBTree, mergeTupleBTrees } from \"./bTreeUtils.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,uCAMoB;AALnB,iGAAA,KAAK,OAAA;AAEL,uGAAA,WAAW,OAAA;AAIZ,qDAAyE;AAAhE,oHAAA,iBAAiB,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAC7C,yCAKqB;AAJpB,wGAAA,WAAW,OAAA;AACX,8GAAA,iBAAiB,OAAA;AAIlB,+CAgBwB;AAfvB,mHAAA,mBAAmB,OAAA;AACnB,mHAAA,mBAAmB,OAAA;AACnB,uHAAA,uBAAuB,OAAA;AACvB,kHAAA,kBAAkB,OAAA;AAGlB,8GAAA,cAAc,OAAA;AACd,iHAAA,iBAAiB,OAAA;AACjB,8GAAA,cAAc,OAAA;AACd,iHAAA,iBAAiB,OAAA;AACjB,mHAAA,mBAAmB,OAAA;AACnB,4GAAA,YAAY,OAAA;AACZ,mHAAA,mBAAmB,OAAA;AACnB,qHAAA,qBAAqB,OAAA;AACrB,sHAAA,sBAAsB,OAAA;AAEvB,+CAAmF;AAA1E,8GAAA,cAAc,OAAA;AAAkB,iHAAA,iBAAiB,OAAA;AAC1D,iDAAqE;AAA3C,kHAAA,iBAAiB,OAAA;AAiB3C,yDAAqD;AAA5C,mHAAA,cAAc,OAAA;AACvB,uCA0CoB;AAzCnB,qGAAA,SAAS,OAAA;AACT,0GAAA,cAAc,OAAA;AACd,iGAAA,KAAK,OAAA;AACL,uGAAA,WAAW,OAAA;AACX,8GAAA,kBAAkB,OAAA;AAClB,uGAAA,WAAW,OAAA;AACX,wGAAA,YAAY,OAAA;AACZ,2GAAA,eAAe,OAAA;AAKf,wHAAA,4BAA4B,OAAA;AAC5B,qGAAA,SAAS,OAAA;AACT,uGAAA,WAAW,OAAA;AACX,0GAAA,cAAc,OAAA;AAId,4GAAA,gBAAgB,OAAA;AAChB,4GAAA,gBAAgB,OAAA;AAChB,wHAAA,4BAA4B,OAAA;AAC5B,uGAAA,WAAW,OAAA;AACX,qGAAA,SAAS,OAAA;AACT,sGAAA,UAAU,OAAA;AAEV,wGAAA,YAAY,OAAA;AACZ,yGAAA,aAAa,OAAA;AAEb,sGAAA,UAAU,OAAA;AACV,mHAAA,uBAAuB,OAAA;AACvB,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,gGAAA,IAAI,OAAA;AACJ,iGAAA,KAAK,OAAA;AACL,mGAAA,OAAO,OAAA;AACP,mGAAA,OAAO,OAAA;AACP,qGAAA,SAAS,OAAA;AACT,oHAAA,wBAAwB,OAAA;AACxB,wGAAA,qBAAqB,OAAgB;AACrC,yGAAA,aAAa,OAAA;AAEd,+DAAqF;AAA5E,4HAAA,oBAAoB,OAAA;AAc7B,+CAAoD;AAA3C,kHAAA,kBAAkB,OAAA;AAE3B,iDAMyB;AAFxB,uHAAA,sBAAsB,OAAA;AACtB,4GAAA,WAAW,OAAA;AAGZ,6CAIuB;AAHtB,uGAAA,QAAQ,OAAA;AAER,iHAAA,kBAAkB,OAAA;AAGnB,mDAM0B;AAJzB,sHAAA,oBAAoB,OAAA;AACpB,sHAAA,oBAAoB,OAAA;AAEpB,iHAAA,eAAe,OAAA;AAGhB,+CAMwB;AALvB,yGAAA,SAAS,OAAA;AAET,8GAAA,cAAc,OAAA;AACd,6GAAA,aAAa,OAAA;AACb,6GAAA,aAAa,OAAA;AAGd,iDAAmF;AAAzD,8GAAA,aAAa,OAAA;AAAE,iHAAA,gBAAgB,OAAA;AAEzD,uEAAmE;AAA1D,iIAAA,qBAAqB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tbrand,\n\ttype Brand,\n\tBrandedType,\n\ttype NameFromBranded,\n\ttype ValueFromBranded,\n} from \"./brand.js\";\nexport { brandedNumberType, brandedStringType } from \"./typeboxBrand.js\";\nexport {\n\tbrandOpaque,\n\textractFromOpaque,\n\ttype ExtractFromOpaque,\n\ttype Opaque,\n} from \"./opaque.js\";\nexport {\n\tdeleteFromNestedMap,\n\tgetOrAddInNestedMap,\n\tgetOrDefaultInNestedMap,\n\tforEachInNestedMap,\n\ttype NestedMap,\n\ttype ReadonlyNestedMap,\n\tSizedNestedMap,\n\tpopulateNestedMap,\n\tsetInNestedMap,\n\ttryAddToNestedMap,\n\ttryGetFromNestedMap,\n\tmapNestedMap,\n\tnestedMapToFlatList,\n\tnestedMapFromFlatList,\n\tgetOrCreateInNestedMap,\n} from \"./nestedMap.js\";\nexport { addToNestedSet, type NestedSet, nestedSetContains } from \"./nestedSet.js\";\nexport { type OffsetList, OffsetListFactory } from \"./offsetList.js\";\nexport type {\n\tareSafelyAssignable,\n\tContravariant,\n\tCovariant,\n\teitherIsAny,\n\tEnforceTypeCheckTests,\n\tInvariant,\n\tisAny,\n\tisAssignableTo,\n\tisStrictSubset,\n\tMakeNominal,\n\trequireFalse,\n\trequireTrue,\n\trequireAssignableTo,\n\tareOnlyKeys,\n} from \"./typeCheck.js\";\nexport { StackyIterator } from \"./stackyIterator.js\";\nexport {\n\tasMutable,\n\tbalancedReduce,\n\tclone,\n\tcompareSets,\n\tgetOrAddEmptyToMap,\n\tgetOrCreate,\n\tisJsonObject,\n\tisReadonlyArray,\n\ttype JsonCompatible,\n\ttype JsonCompatibleObject,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n\tJsonCompatibleReadOnlySchema,\n\tmakeArray,\n\tmapIterable,\n\tfilterIterable,\n\ttype Mutable,\n\ttype Populated,\n\ttype RecursiveReadonly,\n\tassertValidIndex,\n\tassertValidRange,\n\tassertNonNegativeSafeInteger,\n\tobjectToMap,\n\tinvertMap,\n\toneFromSet,\n\ttype Named,\n\tcompareNamed,\n\tdisposeSymbol,\n\ttype IDisposable,\n\tcapitalize,\n\tassertValidRangeIndices,\n\ttransformObjectMap,\n\tcompareStrings,\n\tfind,\n\tcount,\n\tgetLast,\n\thasSome,\n\thasSingle,\n\tdefineLazyCachedProperty,\n\tcopyPropertyIfDefined as copyProperty,\n\tgetOrAddInMap,\n} from \"./utils.js\";\nexport { ReferenceCountedBase, type ReferenceCounted } from \"./referenceCounting.js\";\n\nexport type {\n\t_RecursiveTrick,\n\tRestrictiveReadonlyRecord,\n\tRestrictiveStringRecord,\n\t_InlineTrick,\n\tFlattenKeys,\n\tIsUnion,\n\tUnionToIntersection,\n\tUnionToTuple,\n\tPopUnion,\n} from \"./typeUtils.js\";\n\nexport { unsafeArrayToTuple } from \"./typeUtils.js\";\n\nexport {\n\ttype BrandedKey,\n\ttype BrandedKeyContent,\n\ttype BrandedMapSubset,\n\tgetOrCreateSlotContent,\n\tbrandedSlot,\n} from \"./brandedMap.js\";\n\nexport {\n\tRangeMap,\n\ttype RangeQueryResult,\n\tnewIntegerRangeMap,\n} from \"./rangeMap.js\";\n\nexport {\n\ttype IdAllocator,\n\tidAllocatorFromMaxId,\n\tidAllocatorFromState,\n\ttype IdAllocationState,\n\tfakeIdAllocator,\n} from \"./idAllocator.js\";\n\nexport {\n\tBreakable,\n\ttype WithBreakable,\n\tbreakingMethod,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"./breakable.js\";\n\nexport { type TupleBTree, newTupleBTree, mergeTupleBTrees } from \"./bTreeUtils.js\";\n\nexport { cloneWithReplacements } from \"./cloneWithReplacements.js\";\n"]}
@@ -2,8 +2,26 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ /**
6
+ * An object which counts the number of users / references to it.
7
+ * @remarks
8
+ * This implements the [Reference counting](https://en.wikipedia.org/wiki/Reference_counting) pattern.
9
+ * Getting the reference count correct is difficult in TypeScript and great care must be used.
10
+ * Because of this, this interface should not be used in the public API.
11
+ */
5
12
  export interface ReferenceCounted {
13
+ /**
14
+ * Called to increase the reference count tracked by this object.
15
+ * @remarks
16
+ * When a user of this object allows something else to use it,
17
+ * this should be called.
18
+ */
6
19
  referenceAdded(): void;
20
+ /**
21
+ * Called to decrease the reference count tracked by this object.
22
+ * @remarks
23
+ * When a user of this object will no longer use it, this should be called.
24
+ */
7
25
  referenceRemoved(): void;
8
26
  /**
9
27
  * @returns true if mutating this object may impact other users of it.
@@ -1 +1 @@
1
- {"version":3,"file":"referenceCounting.d.ts","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,gBAAgB;IAChC,cAAc,IAAI,IAAI,CAAC;IAEvB,gBAAgB,IAAI,IAAI,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,IAAI,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,8BAAsB,oBAAqB,YAAW,gBAAgB;IAC/C,OAAO,CAAC,QAAQ;IAAtC,SAAS,aAAqB,QAAQ,GAAE,MAAU;IAE3C,cAAc,CAAC,KAAK,SAAI,GAAG,IAAI;IAI/B,gBAAgB,CAAC,KAAK,SAAI,GAAG,IAAI;IAQjC,QAAQ,IAAI,OAAO;IAInB,cAAc,IAAI,OAAO;IAIhC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI;CACzC"}
1
+ {"version":3,"file":"referenceCounting.d.ts","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;OAKG;IACH,cAAc,IAAI,IAAI,CAAC;IACvB;;;;OAIG;IACH,gBAAgB,IAAI,IAAI,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,IAAI,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,8BAAsB,oBAAqB,YAAW,gBAAgB;IAC/C,OAAO,CAAC,QAAQ;IAAtC,SAAS,aAAqB,QAAQ,GAAE,MAAU;IAE3C,cAAc,CAAC,KAAK,SAAI,GAAG,IAAI;IAI/B,gBAAgB,CAAC,KAAK,SAAI,GAAG,IAAI;IAQjC,QAAQ,IAAI,OAAO;IAInB,cAAc,IAAI,OAAO;IAIhC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI;CACzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"referenceCounting.js","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAe7D;;GAEG;AACH,MAAsB,oBAAoB;IACzC,YAA8B,WAAmB,CAAC;QAApB,aAAQ,GAAR,QAAQ,CAAY;IAAG,CAAC;IAE/C,cAAc,CAAC,KAAK,GAAG,CAAC;QAC9B,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;IACxB,CAAC;IAEM,gBAAgB,CAAC,KAAK,GAAG,CAAC;QAChC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QACvB,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC3D,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,cAAc,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;IAEM,QAAQ;QACd,OAAO,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC1B,CAAC;IAEM,cAAc;QACpB,OAAO,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC5B,CAAC;CAMD;AA3BD,oDA2BC","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\";\n\nexport interface ReferenceCounted {\n\treferenceAdded(): void;\n\n\treferenceRemoved(): void;\n\n\t/**\n\t * @returns true if mutating this object may impact other users of it.\n\t *\n\t * Implementations can return true if the refcount is 1 OR the content is logically immutable.\n\t */\n\tisShared(): boolean;\n}\n\n/**\n * Base class to assist with implementing ReferenceCounted.\n */\nexport abstract class ReferenceCountedBase implements ReferenceCounted {\n\tprotected constructor(private refCount: number = 1) {}\n\n\tpublic referenceAdded(count = 1): void {\n\t\tthis.refCount += count;\n\t}\n\n\tpublic referenceRemoved(count = 1): void {\n\t\tthis.refCount -= count;\n\t\tassert(this.refCount >= 0, 0x4c4 /* Negative ref count */);\n\t\tif (this.refCount === 0) {\n\t\t\tthis.onUnreferenced();\n\t\t}\n\t}\n\n\tpublic isShared(): boolean {\n\t\treturn this.refCount > 1;\n\t}\n\n\tpublic isUnreferenced(): boolean {\n\t\treturn this.refCount === 0;\n\t}\n\n\t/**\n\t * Called when refcount reaches 0.\n\t */\n\tprotected abstract onUnreferenced(): void;\n}\n"]}
1
+ {"version":3,"file":"referenceCounting.js","sourceRoot":"","sources":["../../src/util/referenceCounting.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAgC7D;;GAEG;AACH,MAAsB,oBAAoB;IACzC,YAA8B,WAAmB,CAAC;QAApB,aAAQ,GAAR,QAAQ,CAAY;IAAG,CAAC;IAE/C,cAAc,CAAC,KAAK,GAAG,CAAC;QAC9B,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;IACxB,CAAC;IAEM,gBAAgB,CAAC,KAAK,GAAG,CAAC;QAChC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QACvB,IAAA,iBAAM,EAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC3D,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,cAAc,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;IAEM,QAAQ;QACd,OAAO,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC1B,CAAC;IAEM,cAAc;QACpB,OAAO,IAAI,CAAC,QAAQ,KAAK,CAAC,CAAC;IAC5B,CAAC;CAMD;AA3BD,oDA2BC","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\";\n\n/**\n * An object which counts the number of users / references to it.\n * @remarks\n * This implements the [Reference counting](https://en.wikipedia.org/wiki/Reference_counting) pattern.\n * Getting the reference count correct is difficult in TypeScript and great care must be used.\n * Because of this, this interface should not be used in the public API.\n */\nexport interface ReferenceCounted {\n\t/**\n\t * Called to increase the reference count tracked by this object.\n\t * @remarks\n\t * When a user of this object allows something else to use it,\n\t * this should be called.\n\t */\n\treferenceAdded(): void;\n\t/**\n\t * Called to decrease the reference count tracked by this object.\n\t * @remarks\n\t * When a user of this object will no longer use it, this should be called.\n\t */\n\treferenceRemoved(): void;\n\n\t/**\n\t * @returns true if mutating this object may impact other users of it.\n\t *\n\t * Implementations can return true if the refcount is 1 OR the content is logically immutable.\n\t */\n\tisShared(): boolean;\n}\n\n/**\n * Base class to assist with implementing ReferenceCounted.\n */\nexport abstract class ReferenceCountedBase implements ReferenceCounted {\n\tprotected constructor(private refCount: number = 1) {}\n\n\tpublic referenceAdded(count = 1): void {\n\t\tthis.refCount += count;\n\t}\n\n\tpublic referenceRemoved(count = 1): void {\n\t\tthis.refCount -= count;\n\t\tassert(this.refCount >= 0, 0x4c4 /* Negative ref count */);\n\t\tif (this.refCount === 0) {\n\t\t\tthis.onUnreferenced();\n\t\t}\n\t}\n\n\tpublic isShared(): boolean {\n\t\treturn this.refCount > 1;\n\t}\n\n\tpublic isUnreferenced(): boolean {\n\t\treturn this.refCount === 0;\n\t}\n\n\t/**\n\t * Called when refcount reaches 0.\n\t */\n\tprotected abstract onUnreferenced(): void;\n}\n"]}
@@ -116,12 +116,14 @@ export interface Invariant<in out T> extends Contravariant<T>, Covariant<T> {
116
116
  * Compile time assert that X is True.
117
117
  * To use, simply define a type:
118
118
  * `type _check = requireTrue<your type check>;`
119
+ * @internal
119
120
  */
120
121
  export type requireTrue<_X extends true> = true;
121
122
  /**
122
123
  * Compile time assert that X is False.
123
124
  * To use, simply define a type:
124
125
  * `type _check = requireFalse<your type check>;`
126
+ * @internal
125
127
  */
126
128
  export type requireFalse<_X extends false> = true;
127
129
  /**
@@ -130,6 +132,7 @@ export type requireFalse<_X extends false> = true;
130
132
  * @privateRemarks
131
133
  * Use of [] in the extends clause prevents unions from being distributed over this conditional and returning `boolean` in some cases.
132
134
  * @see {@link https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types | distributive-conditional-types} for details.
135
+ * @internal
133
136
  */
134
137
  export type isAssignableTo<Source, Destination> = [Source] extends [Destination] ? true : false;
135
138
  /**
@@ -139,10 +142,12 @@ export type isStrictSubset<Subset, Superset> = isAssignableTo<Subset, Superset>
139
142
  /**
140
143
  * Returns a type parameter that is true iff A and B are assignable to each other, and neither is any.
141
144
  * This is useful for checking if the output of a type meta-function is the expected type.
145
+ * @internal
142
146
  */
143
147
  export type areSafelyAssignable<A, B> = eitherIsAny<A, B> extends true ? false : isAssignableTo<A, B> extends true ? isAssignableTo<B, A> : false;
144
148
  /**
145
149
  * Returns a type parameter that is true iff A is any or B is any.
150
+ * @internal
146
151
  */
147
152
  export type eitherIsAny<A, B> = true extends isAny<A> | isAny<B> ? true : false;
148
153
  /**
@@ -152,12 +157,14 @@ export type eitherIsAny<A, B> = true extends isAny<A> | isAny<B> ? true : false;
152
157
  * Only `never` is assignable to `never` (`any` isn't),
153
158
  * but `any` distributes over the `extends` here while nothing else should.
154
159
  * This can be used to detect `any`.
160
+ * @internal
155
161
  */
156
162
  export type isAny<T> = boolean extends (T extends never ? true : false) ? true : false;
157
163
  /**
158
164
  * Compile time assert that A is assignable to (extends) B.
159
165
  * To use, simply define a type:
160
166
  * `type _check = requireAssignableTo<T, Expected>;`
167
+ * @internal
161
168
  */
162
169
  export type requireAssignableTo<_A extends B, B> = true;
163
170
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"typ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