@fluidframework/tree 2.1.0 → 2.3.0-288113

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 (1464) hide show
  1. package/.mocharc.customBenchmarks.cjs +33 -0
  2. package/CHANGELOG.md +297 -0
  3. package/README.md +34 -4
  4. package/api-extractor.json +17 -0
  5. package/api-report/tree.alpha.api.md +158 -28
  6. package/api-report/tree.beta.api.md +59 -28
  7. package/api-report/tree.public.api.md +59 -28
  8. package/dist/beta.d.ts +4 -1
  9. package/dist/codec/discriminatedUnions.d.ts +11 -5
  10. package/dist/codec/discriminatedUnions.d.ts.map +1 -1
  11. package/dist/codec/discriminatedUnions.js.map +1 -1
  12. package/dist/codec/index.d.ts +1 -1
  13. package/dist/codec/index.d.ts.map +1 -1
  14. package/dist/codec/index.js.map +1 -1
  15. package/dist/core/forest/editableForest.d.ts +1 -5
  16. package/dist/core/forest/editableForest.d.ts.map +1 -1
  17. package/dist/core/forest/editableForest.js.map +1 -1
  18. package/dist/core/forest/forest.d.ts +0 -6
  19. package/dist/core/forest/forest.d.ts.map +1 -1
  20. package/dist/core/forest/forest.js +0 -2
  21. package/dist/core/forest/forest.js.map +1 -1
  22. package/dist/core/index.d.ts +2 -2
  23. package/dist/core/index.d.ts.map +1 -1
  24. package/dist/core/index.js +3 -4
  25. package/dist/core/index.js.map +1 -1
  26. package/dist/core/rebase/changeRebaser.d.ts +0 -4
  27. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  28. package/dist/core/rebase/changeRebaser.js.map +1 -1
  29. package/dist/core/rebase/index.d.ts +1 -1
  30. package/dist/core/rebase/index.d.ts.map +1 -1
  31. package/dist/core/rebase/index.js +1 -3
  32. package/dist/core/rebase/index.js.map +1 -1
  33. package/dist/core/rebase/types.d.ts +1 -8
  34. package/dist/core/rebase/types.d.ts.map +1 -1
  35. package/dist/core/rebase/types.js +1 -9
  36. package/dist/core/rebase/types.js.map +1 -1
  37. package/dist/core/rebase/utils.d.ts +0 -1
  38. package/dist/core/rebase/utils.d.ts.map +1 -1
  39. package/dist/core/rebase/utils.js +12 -7
  40. package/dist/core/rebase/utils.js.map +1 -1
  41. package/dist/core/schema-stored/multiplicity.d.ts +0 -1
  42. package/dist/core/schema-stored/multiplicity.d.ts.map +1 -1
  43. package/dist/core/schema-stored/multiplicity.js +0 -1
  44. package/dist/core/schema-stored/multiplicity.js.map +1 -1
  45. package/dist/core/schema-stored/schema.d.ts +0 -7
  46. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  47. package/dist/core/schema-stored/schema.js +0 -4
  48. package/dist/core/schema-stored/schema.js.map +1 -1
  49. package/dist/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  50. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  51. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  52. package/dist/core/schema-view/view.d.ts +0 -3
  53. package/dist/core/schema-view/view.d.ts.map +1 -1
  54. package/dist/core/schema-view/view.js +0 -1
  55. package/dist/core/schema-view/view.js.map +1 -1
  56. package/dist/core/tree/anchorSet.d.ts +4 -16
  57. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  58. package/dist/core/tree/anchorSet.js +12 -5
  59. package/dist/core/tree/anchorSet.js.map +1 -1
  60. package/dist/core/tree/cursor.d.ts +1 -6
  61. package/dist/core/tree/cursor.d.ts.map +1 -1
  62. package/dist/core/tree/cursor.js +0 -2
  63. package/dist/core/tree/cursor.js.map +1 -1
  64. package/dist/core/tree/delta.d.ts +0 -11
  65. package/dist/core/tree/delta.d.ts.map +1 -1
  66. package/dist/core/tree/delta.js.map +1 -1
  67. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  68. package/dist/core/tree/detachedFieldIndexCodec.js +3 -2
  69. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  70. package/dist/core/tree/detachedFieldIndexTypes.d.ts +0 -1
  71. package/dist/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  72. package/dist/core/tree/detachedFieldIndexTypes.js.map +1 -1
  73. package/dist/core/tree/index.d.ts +1 -1
  74. package/dist/core/tree/index.d.ts.map +1 -1
  75. package/dist/core/tree/index.js +3 -1
  76. package/dist/core/tree/index.js.map +1 -1
  77. package/dist/core/tree/mapTree.d.ts +20 -4
  78. package/dist/core/tree/mapTree.d.ts.map +1 -1
  79. package/dist/core/tree/mapTree.js +29 -0
  80. package/dist/core/tree/mapTree.js.map +1 -1
  81. package/dist/core/tree/pathTree.d.ts +0 -11
  82. package/dist/core/tree/pathTree.d.ts.map +1 -1
  83. package/dist/core/tree/pathTree.js.map +1 -1
  84. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  85. package/dist/core/tree/treeTextFormat.js +3 -2
  86. package/dist/core/tree/treeTextFormat.js.map +1 -1
  87. package/dist/core/tree/types.d.ts +0 -11
  88. package/dist/core/tree/types.d.ts.map +1 -1
  89. package/dist/core/tree/types.js +0 -4
  90. package/dist/core/tree/types.js.map +1 -1
  91. package/dist/core/tree/visitDelta.d.ts +0 -1
  92. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  93. package/dist/core/tree/visitDelta.js +2 -2
  94. package/dist/core/tree/visitDelta.js.map +1 -1
  95. package/dist/core/tree/visitPath.d.ts +0 -2
  96. package/dist/core/tree/visitPath.d.ts.map +1 -1
  97. package/dist/core/tree/visitPath.js.map +1 -1
  98. package/dist/core/tree/visitorUtils.d.ts +0 -1
  99. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  100. package/dist/core/tree/visitorUtils.js.map +1 -1
  101. package/dist/domains/index.d.ts +1 -1
  102. package/dist/domains/index.d.ts.map +1 -1
  103. package/dist/domains/index.js +2 -1
  104. package/dist/domains/index.js.map +1 -1
  105. package/dist/domains/json/index.d.ts +1 -1
  106. package/dist/domains/json/index.d.ts.map +1 -1
  107. package/dist/domains/json/index.js +2 -1
  108. package/dist/domains/json/index.js.map +1 -1
  109. package/dist/domains/json/jsonCursor.d.ts +36 -2
  110. package/dist/domains/json/jsonCursor.d.ts.map +1 -1
  111. package/dist/domains/json/jsonCursor.js +76 -5
  112. package/dist/domains/json/jsonCursor.js.map +1 -1
  113. package/dist/domains/json/jsonDomainSchema.d.ts +13 -3
  114. package/dist/domains/json/jsonDomainSchema.d.ts.map +1 -1
  115. package/dist/domains/json/jsonDomainSchema.js +12 -4
  116. package/dist/domains/json/jsonDomainSchema.js.map +1 -1
  117. package/dist/domains/leafDomain.d.ts +0 -1
  118. package/dist/domains/leafDomain.d.ts.map +1 -1
  119. package/dist/domains/leafDomain.js +0 -1
  120. package/dist/domains/leafDomain.js.map +1 -1
  121. package/dist/domains/schemaBuilder.d.ts +1 -7
  122. package/dist/domains/schemaBuilder.d.ts.map +1 -1
  123. package/dist/domains/schemaBuilder.js +0 -10
  124. package/dist/domains/schemaBuilder.js.map +1 -1
  125. package/dist/events/events.d.ts +7 -5
  126. package/dist/events/events.d.ts.map +1 -1
  127. package/dist/events/events.js +5 -3
  128. package/dist/events/events.js.map +1 -1
  129. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  130. package/dist/feature-libraries/chunked-forest/basicChunk.js +8 -3
  131. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  132. package/dist/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  133. package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  134. package/dist/feature-libraries/chunked-forest/chunk.js.map +1 -1
  135. package/dist/feature-libraries/chunked-forest/chunkTree.js +3 -3
  136. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  137. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  138. package/dist/feature-libraries/chunked-forest/chunkedForest.js +7 -5
  139. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  140. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +1 -1
  141. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  142. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  143. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +8 -5
  144. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  145. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  146. package/dist/feature-libraries/chunked-forest/uniformChunk.js +5 -3
  147. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  148. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  149. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  150. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +9 -19
  151. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  152. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  153. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  154. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  155. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  156. package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  157. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  158. package/dist/feature-libraries/default-schema/defaultSchema.js +0 -1
  159. package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  160. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  161. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  162. package/dist/feature-libraries/default-schema/index.js +2 -1
  163. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  164. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  165. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  166. package/dist/feature-libraries/default-schema/schemaChecker.js +6 -0
  167. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  168. package/dist/feature-libraries/editableTreeBinder.d.ts +0 -67
  169. package/dist/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  170. package/dist/feature-libraries/editableTreeBinder.js +5 -24
  171. package/dist/feature-libraries/editableTreeBinder.js.map +1 -1
  172. package/dist/feature-libraries/fieldGenerator.d.ts +0 -3
  173. package/dist/feature-libraries/fieldGenerator.d.ts.map +1 -1
  174. package/dist/feature-libraries/fieldGenerator.js +0 -1
  175. package/dist/feature-libraries/fieldGenerator.js.map +1 -1
  176. package/dist/feature-libraries/flex-map-tree/index.d.ts +1 -1
  177. package/dist/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  178. package/dist/feature-libraries/flex-map-tree/index.js +2 -2
  179. package/dist/feature-libraries/flex-map-tree/index.js.map +1 -1
  180. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -51
  181. package/dist/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  182. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js +171 -180
  183. package/dist/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  184. package/dist/feature-libraries/flex-tree/context.d.ts +0 -1
  185. package/dist/feature-libraries/flex-tree/context.d.ts.map +1 -1
  186. package/dist/feature-libraries/flex-tree/context.js.map +1 -1
  187. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -373
  188. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  189. package/dist/feature-libraries/flex-tree/flexTreeTypes.js +1 -34
  190. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  191. package/dist/feature-libraries/flex-tree/index.d.ts +2 -2
  192. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  193. package/dist/feature-libraries/flex-tree/index.js +1 -3
  194. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  195. package/dist/feature-libraries/flex-tree/lazyField.d.ts +9 -27
  196. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  197. package/dist/feature-libraries/flex-tree/lazyField.js +26 -102
  198. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  199. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +3 -18
  200. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  201. package/dist/feature-libraries/flex-tree/lazyNode.js +2 -126
  202. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  203. package/dist/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  204. package/dist/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  205. package/dist/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  206. package/dist/feature-libraries/flex-tree/utilities.d.ts +2 -1
  207. package/dist/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  208. package/dist/feature-libraries/flex-tree/utilities.js +4 -0
  209. package/dist/feature-libraries/flex-tree/utilities.js.map +1 -1
  210. package/dist/feature-libraries/forest-summary/codec.js +2 -2
  211. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  212. package/dist/feature-libraries/index.d.ts +6 -8
  213. package/dist/feature-libraries/index.d.ts.map +1 -1
  214. package/dist/feature-libraries/index.js +7 -20
  215. package/dist/feature-libraries/index.js.map +1 -1
  216. package/dist/feature-libraries/mapTreeCursor.d.ts +6 -2
  217. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  218. package/dist/feature-libraries/mapTreeCursor.js +9 -1
  219. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  220. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  221. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  222. package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  223. package/dist/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  224. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  225. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  226. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  227. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  228. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  229. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  230. package/dist/feature-libraries/modular-schema/discrepancies.js +105 -2
  231. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  232. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  233. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  234. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  235. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  236. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  237. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  238. package/dist/feature-libraries/modular-schema/fieldKind.js +1 -2
  239. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  240. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  241. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  242. package/dist/feature-libraries/modular-schema/genericFieldKind.js +57 -85
  243. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  244. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  245. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  246. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js +5 -8
  247. package/dist/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  248. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  249. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  250. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js +6 -0
  251. package/dist/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  252. package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
  253. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  254. package/dist/feature-libraries/modular-schema/index.js +2 -1
  255. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  256. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  257. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +39 -22
  258. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  259. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  260. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  261. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +192 -228
  262. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  263. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  264. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  265. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  266. package/dist/feature-libraries/node-key/nodeKey.d.ts +0 -4
  267. package/dist/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  268. package/dist/feature-libraries/node-key/nodeKey.js +0 -2
  269. package/dist/feature-libraries/node-key/nodeKey.js.map +1 -1
  270. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  271. package/dist/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  272. package/dist/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  273. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  274. package/dist/feature-libraries/object-forest/objectForest.js +1 -10
  275. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  276. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  277. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  278. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  279. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  280. package/dist/feature-libraries/schemaBuilderBase.d.ts +2 -28
  281. package/dist/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  282. package/dist/feature-libraries/schemaBuilderBase.js +1 -27
  283. package/dist/feature-libraries/schemaBuilderBase.js.map +1 -1
  284. package/dist/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  285. package/dist/feature-libraries/sequence-field/compose.js +24 -21
  286. package/dist/feature-libraries/sequence-field/compose.js.map +1 -1
  287. package/dist/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  288. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  289. package/dist/feature-libraries/sequence-field/formatV2.js +7 -6
  290. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  291. package/dist/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  292. package/dist/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  293. package/dist/feature-libraries/sequence-field/formatV3.js +23 -0
  294. package/dist/feature-libraries/sequence-field/formatV3.js.map +1 -0
  295. package/dist/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  296. package/dist/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  297. package/dist/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  298. package/dist/feature-libraries/sequence-field/index.d.ts +1 -1
  299. package/dist/feature-libraries/sequence-field/index.d.ts.map +1 -1
  300. package/dist/feature-libraries/sequence-field/index.js.map +1 -1
  301. package/dist/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  302. package/dist/feature-libraries/sequence-field/invert.js +21 -13
  303. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  304. package/dist/feature-libraries/sequence-field/markQueue.js +1 -1
  305. package/dist/feature-libraries/sequence-field/markQueue.js.map +1 -1
  306. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  307. package/dist/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  308. package/dist/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  309. package/dist/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  310. package/dist/feature-libraries/sequence-field/rebase.js +24 -6
  311. package/dist/feature-libraries/sequence-field/rebase.js.map +1 -1
  312. package/dist/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  313. package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  314. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  315. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  316. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +38 -4
  317. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  318. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  319. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  320. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js +54 -9
  321. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  322. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  323. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  324. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js +85 -0
  325. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  326. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  327. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  328. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  329. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  330. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +4 -1
  331. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  332. package/dist/feature-libraries/sequence-field/types.d.ts +23 -4
  333. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  334. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  335. package/dist/feature-libraries/sequence-field/utils.d.ts +5 -4
  336. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  337. package/dist/feature-libraries/sequence-field/utils.js +70 -42
  338. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  339. package/dist/feature-libraries/storedToViewSchema.d.ts +0 -1
  340. package/dist/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  341. package/dist/feature-libraries/storedToViewSchema.js +0 -1
  342. package/dist/feature-libraries/storedToViewSchema.js.map +1 -1
  343. package/dist/feature-libraries/treeCursorUtils.d.ts +0 -6
  344. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  345. package/dist/feature-libraries/treeCursorUtils.js +8 -6
  346. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  347. package/dist/feature-libraries/treeTextCursor.d.ts +0 -2
  348. package/dist/feature-libraries/treeTextCursor.d.ts.map +1 -1
  349. package/dist/feature-libraries/treeTextCursor.js +0 -2
  350. package/dist/feature-libraries/treeTextCursor.js.map +1 -1
  351. package/dist/feature-libraries/typed-schema/flexList.d.ts +0 -3
  352. package/dist/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  353. package/dist/feature-libraries/typed-schema/flexList.js.map +1 -1
  354. package/dist/feature-libraries/typed-schema/index.d.ts +1 -1
  355. package/dist/feature-libraries/typed-schema/index.d.ts.map +1 -1
  356. package/dist/feature-libraries/typed-schema/index.js +1 -3
  357. package/dist/feature-libraries/typed-schema/index.js.map +1 -1
  358. package/dist/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  359. package/dist/feature-libraries/typed-schema/schemaCollection.js +0 -4
  360. package/dist/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  361. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  362. package/dist/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  363. package/dist/feature-libraries/typed-schema/typedTreeSchema.js +1 -40
  364. package/dist/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  365. package/dist/feature-libraries/typed-schema/view.d.ts +0 -1
  366. package/dist/feature-libraries/typed-schema/view.d.ts.map +1 -1
  367. package/dist/feature-libraries/typed-schema/view.js.map +1 -1
  368. package/dist/index.d.ts +8 -9
  369. package/dist/index.d.ts.map +1 -1
  370. package/dist/index.js +36 -90
  371. package/dist/index.js.map +1 -1
  372. package/dist/internalTypes.d.ts +1 -1
  373. package/dist/internalTypes.d.ts.map +1 -1
  374. package/dist/internalTypes.js.map +1 -1
  375. package/dist/packageVersion.d.ts +1 -1
  376. package/dist/packageVersion.d.ts.map +1 -1
  377. package/dist/packageVersion.js +1 -1
  378. package/dist/packageVersion.js.map +1 -1
  379. package/dist/public.d.ts +4 -1
  380. package/dist/shared-tree/schematizeTree.d.ts +2 -11
  381. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  382. package/dist/shared-tree/schematizeTree.js +13 -2
  383. package/dist/shared-tree/schematizeTree.js.map +1 -1
  384. package/dist/shared-tree/schematizingTreeView.d.ts +4 -4
  385. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  386. package/dist/shared-tree/schematizingTreeView.js +2 -2
  387. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  388. package/dist/shared-tree/sharedTree.d.ts +4 -17
  389. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  390. package/dist/shared-tree/sharedTree.js +4 -8
  391. package/dist/shared-tree/sharedTree.js.map +1 -1
  392. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  393. package/dist/shared-tree/sharedTreeChangeCodecs.js +4 -0
  394. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  395. package/dist/shared-tree/sharedTreeChangeFamily.js +2 -2
  396. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  397. package/dist/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  398. package/dist/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  399. package/dist/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  400. package/dist/shared-tree/treeApi.js +2 -2
  401. package/dist/shared-tree/treeApi.js.map +1 -1
  402. package/dist/shared-tree/treeCheckout.d.ts +0 -5
  403. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  404. package/dist/shared-tree/treeCheckout.js +5 -3
  405. package/dist/shared-tree/treeCheckout.js.map +1 -1
  406. package/dist/shared-tree/treeView.d.ts +3 -6
  407. package/dist/shared-tree/treeView.d.ts.map +1 -1
  408. package/dist/shared-tree/treeView.js.map +1 -1
  409. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  410. package/dist/shared-tree-core/branch.js +11 -6
  411. package/dist/shared-tree-core/branch.js.map +1 -1
  412. package/dist/shared-tree-core/defaultResubmitMachine.js +3 -3
  413. package/dist/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  414. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  415. package/dist/shared-tree-core/editManagerCodecs.js +1 -0
  416. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  417. package/dist/shared-tree-core/editManagerFormat.d.ts +2 -2
  418. package/dist/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  419. package/dist/shared-tree-core/editManagerFormat.js +6 -1
  420. package/dist/shared-tree-core/editManagerFormat.js.map +1 -1
  421. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  422. package/dist/shared-tree-core/messageCodecs.js +1 -0
  423. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  424. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  425. package/dist/shared-tree-core/sharedTreeCore.js +3 -1
  426. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  427. package/dist/simple-tree/api/create.d.ts +54 -0
  428. package/dist/simple-tree/api/create.d.ts.map +1 -0
  429. package/dist/simple-tree/api/create.js +99 -0
  430. package/dist/simple-tree/api/create.js.map +1 -0
  431. package/dist/simple-tree/api/index.d.ts +12 -0
  432. package/dist/simple-tree/api/index.d.ts.map +1 -0
  433. package/dist/simple-tree/api/index.js +28 -0
  434. package/dist/simple-tree/api/index.js.map +1 -0
  435. package/{lib/simple-tree → dist/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  436. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  437. package/dist/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  438. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  439. package/dist/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  440. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -0
  441. package/dist/simple-tree/{schemaFactory.js → api/schemaFactory.js} +10 -9
  442. package/dist/simple-tree/api/schemaFactory.js.map +1 -0
  443. package/{lib/simple-tree → dist/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  444. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  445. package/dist/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  446. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  447. package/dist/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  448. package/dist/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  449. package/dist/simple-tree/api/testRecursiveDomain.js.map +1 -0
  450. package/{lib/simple-tree → dist/simple-tree/api}/tree.d.ts +111 -20
  451. package/dist/simple-tree/api/tree.d.ts.map +1 -0
  452. package/dist/simple-tree/api/tree.js +173 -0
  453. package/dist/simple-tree/api/tree.js.map +1 -0
  454. package/dist/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +7 -6
  455. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  456. package/dist/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +57 -21
  457. package/dist/simple-tree/api/treeNodeApi.js.map +1 -0
  458. package/dist/simple-tree/api/verboseTree.d.ts +136 -0
  459. package/dist/simple-tree/api/verboseTree.d.ts.map +1 -0
  460. package/dist/simple-tree/api/verboseTree.js +220 -0
  461. package/dist/simple-tree/api/verboseTree.js.map +1 -0
  462. package/dist/simple-tree/arrayNode.d.ts +3 -3
  463. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  464. package/dist/simple-tree/arrayNode.js +72 -85
  465. package/dist/simple-tree/arrayNode.js.map +1 -1
  466. package/dist/simple-tree/core/index.d.ts +10 -0
  467. package/dist/simple-tree/core/index.d.ts.map +1 -0
  468. package/dist/simple-tree/core/index.js +27 -0
  469. package/dist/simple-tree/core/index.js.map +1 -0
  470. package/{lib/simple-tree → dist/simple-tree/core}/schemaCaching.d.ts +2 -9
  471. package/dist/simple-tree/core/schemaCaching.d.ts.map +1 -0
  472. package/dist/simple-tree/{schemaCaching.js → core/schemaCaching.js} +2 -23
  473. package/dist/simple-tree/core/schemaCaching.js.map +1 -0
  474. package/dist/simple-tree/core/treeNodeKernel.d.ts +70 -0
  475. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  476. package/dist/simple-tree/core/treeNodeKernel.js +164 -0
  477. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -0
  478. package/dist/simple-tree/core/treeNodeSchema.d.ts +149 -0
  479. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  480. package/dist/simple-tree/core/treeNodeSchema.js +35 -0
  481. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -0
  482. package/{lib/simple-tree → dist/simple-tree/core}/types.d.ts +50 -79
  483. package/dist/simple-tree/core/types.d.ts.map +1 -0
  484. package/dist/simple-tree/core/types.js +117 -0
  485. package/dist/simple-tree/core/types.js.map +1 -0
  486. package/dist/simple-tree/core/withType.d.ts +82 -0
  487. package/dist/simple-tree/core/withType.d.ts.map +1 -0
  488. package/dist/simple-tree/core/withType.js +39 -0
  489. package/dist/simple-tree/core/withType.js.map +1 -0
  490. package/dist/simple-tree/getJsonSchema.d.ts +55 -0
  491. package/dist/simple-tree/getJsonSchema.d.ts.map +1 -0
  492. package/dist/simple-tree/getJsonSchema.js +69 -0
  493. package/dist/simple-tree/getJsonSchema.js.map +1 -0
  494. package/dist/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  495. package/dist/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  496. package/dist/simple-tree/getSimpleFieldSchema.js +29 -0
  497. package/dist/simple-tree/getSimpleFieldSchema.js.map +1 -0
  498. package/dist/simple-tree/getSimpleSchema.d.ts +58 -0
  499. package/dist/simple-tree/getSimpleSchema.d.ts.map +1 -0
  500. package/dist/simple-tree/getSimpleSchema.js +68 -0
  501. package/dist/simple-tree/getSimpleSchema.js.map +1 -0
  502. package/dist/simple-tree/index.d.ts +12 -13
  503. package/dist/simple-tree/index.d.ts.map +1 -1
  504. package/dist/simple-tree/index.js +26 -23
  505. package/dist/simple-tree/index.js.map +1 -1
  506. package/dist/simple-tree/jsonSchema.d.ts +206 -0
  507. package/dist/simple-tree/jsonSchema.d.ts.map +1 -0
  508. package/dist/{feature-libraries/schema-aware/index.js → simple-tree/jsonSchema.js} +1 -1
  509. package/dist/simple-tree/jsonSchema.js.map +1 -0
  510. package/dist/simple-tree/leafNodeSchema.d.ts +1 -1
  511. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  512. package/dist/simple-tree/leafNodeSchema.js +3 -4
  513. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  514. package/dist/simple-tree/mapNode.d.ts +9 -3
  515. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  516. package/dist/simple-tree/mapNode.js +33 -35
  517. package/dist/simple-tree/mapNode.js.map +1 -1
  518. package/dist/simple-tree/objectNode.d.ts +18 -16
  519. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  520. package/dist/simple-tree/objectNode.js +43 -44
  521. package/dist/simple-tree/objectNode.js.map +1 -1
  522. package/dist/simple-tree/objectNodeTypes.d.ts +38 -0
  523. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -0
  524. package/dist/simple-tree/objectNodeTypes.js +19 -0
  525. package/dist/simple-tree/objectNodeTypes.js.map +1 -0
  526. package/dist/simple-tree/proxies.d.ts +6 -25
  527. package/dist/simple-tree/proxies.d.ts.map +1 -1
  528. package/dist/simple-tree/proxies.js +50 -63
  529. package/dist/simple-tree/proxies.js.map +1 -1
  530. package/dist/simple-tree/proxyBinding.d.ts +45 -22
  531. package/dist/simple-tree/proxyBinding.d.ts.map +1 -1
  532. package/dist/simple-tree/proxyBinding.js +94 -59
  533. package/dist/simple-tree/proxyBinding.js.map +1 -1
  534. package/dist/simple-tree/schemaTypes.d.ts +10 -159
  535. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  536. package/dist/simple-tree/schemaTypes.js +11 -42
  537. package/dist/simple-tree/schemaTypes.js.map +1 -1
  538. package/dist/simple-tree/simpleSchema.d.ts +124 -0
  539. package/dist/simple-tree/simpleSchema.d.ts.map +1 -0
  540. package/dist/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  541. package/dist/simple-tree/simpleSchema.js.map +1 -0
  542. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  543. package/dist/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  544. package/dist/simple-tree/simpleSchemaToJsonSchema.js +146 -0
  545. package/dist/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  546. package/dist/simple-tree/toFlexSchema.d.ts +4 -12
  547. package/dist/simple-tree/toFlexSchema.d.ts.map +1 -1
  548. package/dist/simple-tree/toFlexSchema.js +42 -52
  549. package/dist/simple-tree/toFlexSchema.js.map +1 -1
  550. package/dist/simple-tree/toMapTree.d.ts +39 -39
  551. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  552. package/dist/simple-tree/toMapTree.js +227 -171
  553. package/dist/simple-tree/toMapTree.js.map +1 -1
  554. package/dist/simple-tree/treeNodeValid.d.ts +74 -0
  555. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -0
  556. package/dist/simple-tree/{types.js → treeNodeValid.js} +18 -111
  557. package/dist/simple-tree/treeNodeValid.js.map +1 -0
  558. package/dist/simple-tree/typesUnsafe.d.ts +35 -4
  559. package/dist/simple-tree/typesUnsafe.d.ts.map +1 -1
  560. package/dist/simple-tree/typesUnsafe.js.map +1 -1
  561. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  562. package/dist/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  563. package/dist/simple-tree/viewSchemaToSimpleSchema.js +171 -0
  564. package/dist/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  565. package/dist/util/brand.d.ts +0 -3
  566. package/dist/util/brand.d.ts.map +1 -1
  567. package/dist/util/brand.js +1 -2
  568. package/dist/util/brand.js.map +1 -1
  569. package/dist/util/brandedMap.d.ts +0 -5
  570. package/dist/util/brandedMap.d.ts.map +1 -1
  571. package/dist/util/brandedMap.js +0 -1
  572. package/dist/util/brandedMap.js.map +1 -1
  573. package/dist/util/idAllocator.d.ts +0 -2
  574. package/dist/util/idAllocator.d.ts.map +1 -1
  575. package/dist/util/idAllocator.js +0 -1
  576. package/dist/util/idAllocator.js.map +1 -1
  577. package/dist/util/index.d.ts +2 -2
  578. package/dist/util/index.d.ts.map +1 -1
  579. package/dist/util/index.js +4 -2
  580. package/dist/util/index.js.map +1 -1
  581. package/dist/util/nestedMap.d.ts +5 -19
  582. package/dist/util/nestedMap.d.ts.map +1 -1
  583. package/dist/util/nestedMap.js +17 -17
  584. package/dist/util/nestedMap.js.map +1 -1
  585. package/dist/util/opaque.d.ts +0 -4
  586. package/dist/util/opaque.d.ts.map +1 -1
  587. package/dist/util/opaque.js +0 -2
  588. package/dist/util/opaque.js.map +1 -1
  589. package/dist/util/rangeMap.d.ts +0 -2
  590. package/dist/util/rangeMap.d.ts.map +1 -1
  591. package/dist/util/rangeMap.js +4 -3
  592. package/dist/util/rangeMap.js.map +1 -1
  593. package/dist/util/transactionResult.d.ts +0 -1
  594. package/dist/util/transactionResult.d.ts.map +1 -1
  595. package/dist/util/transactionResult.js +0 -1
  596. package/dist/util/transactionResult.js.map +1 -1
  597. package/dist/util/typeCheck.d.ts +2 -20
  598. package/dist/util/typeCheck.d.ts.map +1 -1
  599. package/dist/util/typeCheck.js.map +1 -1
  600. package/dist/util/typeCheckTests.d.ts +4 -4
  601. package/dist/util/typeCheckTests.d.ts.map +1 -1
  602. package/dist/util/typeCheckTests.js.map +1 -1
  603. package/dist/util/typeUtils.d.ts +0 -7
  604. package/dist/util/typeUtils.d.ts.map +1 -1
  605. package/dist/util/typeUtils.js.map +1 -1
  606. package/dist/util/utils.d.ts +6 -8
  607. package/dist/util/utils.d.ts.map +1 -1
  608. package/dist/util/utils.js +14 -5
  609. package/dist/util/utils.js.map +1 -1
  610. package/lib/beta.d.ts +4 -1
  611. package/lib/codec/discriminatedUnions.d.ts +11 -5
  612. package/lib/codec/discriminatedUnions.d.ts.map +1 -1
  613. package/lib/codec/discriminatedUnions.js.map +1 -1
  614. package/lib/codec/index.d.ts +1 -1
  615. package/lib/codec/index.d.ts.map +1 -1
  616. package/lib/codec/index.js +1 -1
  617. package/lib/codec/index.js.map +1 -1
  618. package/lib/core/forest/editableForest.d.ts +1 -5
  619. package/lib/core/forest/editableForest.d.ts.map +1 -1
  620. package/lib/core/forest/editableForest.js.map +1 -1
  621. package/lib/core/forest/forest.d.ts +0 -6
  622. package/lib/core/forest/forest.d.ts.map +1 -1
  623. package/lib/core/forest/forest.js +0 -2
  624. package/lib/core/forest/forest.js.map +1 -1
  625. package/lib/core/index.d.ts +2 -2
  626. package/lib/core/index.d.ts.map +1 -1
  627. package/lib/core/index.js +2 -2
  628. package/lib/core/index.js.map +1 -1
  629. package/lib/core/rebase/changeRebaser.d.ts +0 -4
  630. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  631. package/lib/core/rebase/changeRebaser.js.map +1 -1
  632. package/lib/core/rebase/index.d.ts +1 -1
  633. package/lib/core/rebase/index.d.ts.map +1 -1
  634. package/lib/core/rebase/index.js +1 -1
  635. package/lib/core/rebase/index.js.map +1 -1
  636. package/lib/core/rebase/types.d.ts +1 -8
  637. package/lib/core/rebase/types.d.ts.map +1 -1
  638. package/lib/core/rebase/types.js +1 -7
  639. package/lib/core/rebase/types.js.map +1 -1
  640. package/lib/core/rebase/utils.d.ts +0 -1
  641. package/lib/core/rebase/utils.d.ts.map +1 -1
  642. package/lib/core/rebase/utils.js +13 -8
  643. package/lib/core/rebase/utils.js.map +1 -1
  644. package/lib/core/schema-stored/multiplicity.d.ts +0 -1
  645. package/lib/core/schema-stored/multiplicity.d.ts.map +1 -1
  646. package/lib/core/schema-stored/multiplicity.js +0 -1
  647. package/lib/core/schema-stored/multiplicity.js.map +1 -1
  648. package/lib/core/schema-stored/schema.d.ts +0 -7
  649. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  650. package/lib/core/schema-stored/schema.js +0 -4
  651. package/lib/core/schema-stored/schema.js.map +1 -1
  652. package/lib/core/schema-stored/storedSchemaRepository.d.ts +0 -3
  653. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  654. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  655. package/lib/core/schema-view/view.d.ts +0 -3
  656. package/lib/core/schema-view/view.d.ts.map +1 -1
  657. package/lib/core/schema-view/view.js +0 -1
  658. package/lib/core/schema-view/view.js.map +1 -1
  659. package/lib/core/tree/anchorSet.d.ts +4 -16
  660. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  661. package/lib/core/tree/anchorSet.js +12 -5
  662. package/lib/core/tree/anchorSet.js.map +1 -1
  663. package/lib/core/tree/cursor.d.ts +1 -6
  664. package/lib/core/tree/cursor.d.ts.map +1 -1
  665. package/lib/core/tree/cursor.js +0 -2
  666. package/lib/core/tree/cursor.js.map +1 -1
  667. package/lib/core/tree/delta.d.ts +0 -11
  668. package/lib/core/tree/delta.d.ts.map +1 -1
  669. package/lib/core/tree/delta.js.map +1 -1
  670. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  671. package/lib/core/tree/detachedFieldIndexCodec.js +4 -3
  672. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  673. package/lib/core/tree/detachedFieldIndexTypes.d.ts +0 -1
  674. package/lib/core/tree/detachedFieldIndexTypes.d.ts.map +1 -1
  675. package/lib/core/tree/detachedFieldIndexTypes.js.map +1 -1
  676. package/lib/core/tree/index.d.ts +1 -1
  677. package/lib/core/tree/index.d.ts.map +1 -1
  678. package/lib/core/tree/index.js +1 -0
  679. package/lib/core/tree/index.js.map +1 -1
  680. package/lib/core/tree/mapTree.d.ts +20 -4
  681. package/lib/core/tree/mapTree.d.ts.map +1 -1
  682. package/lib/core/tree/mapTree.js +27 -1
  683. package/lib/core/tree/mapTree.js.map +1 -1
  684. package/lib/core/tree/pathTree.d.ts +0 -11
  685. package/lib/core/tree/pathTree.d.ts.map +1 -1
  686. package/lib/core/tree/pathTree.js.map +1 -1
  687. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  688. package/lib/core/tree/treeTextFormat.js +3 -2
  689. package/lib/core/tree/treeTextFormat.js.map +1 -1
  690. package/lib/core/tree/types.d.ts +0 -11
  691. package/lib/core/tree/types.d.ts.map +1 -1
  692. package/lib/core/tree/types.js +0 -4
  693. package/lib/core/tree/types.js.map +1 -1
  694. package/lib/core/tree/visitDelta.d.ts +0 -1
  695. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  696. package/lib/core/tree/visitDelta.js +2 -2
  697. package/lib/core/tree/visitDelta.js.map +1 -1
  698. package/lib/core/tree/visitPath.d.ts +0 -2
  699. package/lib/core/tree/visitPath.d.ts.map +1 -1
  700. package/lib/core/tree/visitPath.js.map +1 -1
  701. package/lib/core/tree/visitorUtils.d.ts +0 -1
  702. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  703. package/lib/core/tree/visitorUtils.js.map +1 -1
  704. package/lib/domains/index.d.ts +1 -1
  705. package/lib/domains/index.d.ts.map +1 -1
  706. package/lib/domains/index.js +1 -1
  707. package/lib/domains/index.js.map +1 -1
  708. package/lib/domains/json/index.d.ts +1 -1
  709. package/lib/domains/json/index.d.ts.map +1 -1
  710. package/lib/domains/json/index.js +1 -1
  711. package/lib/domains/json/index.js.map +1 -1
  712. package/lib/domains/json/jsonCursor.d.ts +36 -2
  713. package/lib/domains/json/jsonCursor.d.ts.map +1 -1
  714. package/lib/domains/json/jsonCursor.js +76 -5
  715. package/lib/domains/json/jsonCursor.js.map +1 -1
  716. package/lib/domains/json/jsonDomainSchema.d.ts +13 -3
  717. package/lib/domains/json/jsonDomainSchema.d.ts.map +1 -1
  718. package/lib/domains/json/jsonDomainSchema.js +9 -1
  719. package/lib/domains/json/jsonDomainSchema.js.map +1 -1
  720. package/lib/domains/leafDomain.d.ts +0 -1
  721. package/lib/domains/leafDomain.d.ts.map +1 -1
  722. package/lib/domains/leafDomain.js +0 -1
  723. package/lib/domains/leafDomain.js.map +1 -1
  724. package/lib/domains/schemaBuilder.d.ts +1 -7
  725. package/lib/domains/schemaBuilder.d.ts.map +1 -1
  726. package/lib/domains/schemaBuilder.js +1 -11
  727. package/lib/domains/schemaBuilder.js.map +1 -1
  728. package/lib/events/events.d.ts +7 -5
  729. package/lib/events/events.d.ts.map +1 -1
  730. package/lib/events/events.js +5 -3
  731. package/lib/events/events.js.map +1 -1
  732. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  733. package/lib/feature-libraries/chunked-forest/basicChunk.js +9 -4
  734. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  735. package/lib/feature-libraries/chunked-forest/chunk.d.ts +1 -1
  736. package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +1 -1
  737. package/lib/feature-libraries/chunked-forest/chunk.js.map +1 -1
  738. package/lib/feature-libraries/chunked-forest/chunkTree.js +4 -4
  739. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  740. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  741. package/lib/feature-libraries/chunked-forest/chunkedForest.js +8 -6
  742. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  743. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js +2 -2
  744. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  745. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  746. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +9 -6
  747. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  748. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  749. package/lib/feature-libraries/chunked-forest/uniformChunk.js +6 -4
  750. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  751. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +12 -24
  752. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  753. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +6 -16
  754. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  755. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +0 -6
  756. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  757. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +11 -1
  758. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  759. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -1
  760. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  761. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -1
  762. package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  763. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  764. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  765. package/lib/feature-libraries/default-schema/index.js +1 -1
  766. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  767. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +6 -0
  768. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  769. package/lib/feature-libraries/default-schema/schemaChecker.js +6 -0
  770. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  771. package/lib/feature-libraries/editableTreeBinder.d.ts +0 -67
  772. package/lib/feature-libraries/editableTreeBinder.d.ts.map +1 -1
  773. package/lib/feature-libraries/editableTreeBinder.js +6 -25
  774. package/lib/feature-libraries/editableTreeBinder.js.map +1 -1
  775. package/lib/feature-libraries/fieldGenerator.d.ts +0 -3
  776. package/lib/feature-libraries/fieldGenerator.d.ts.map +1 -1
  777. package/lib/feature-libraries/fieldGenerator.js +0 -1
  778. package/lib/feature-libraries/fieldGenerator.js.map +1 -1
  779. package/lib/feature-libraries/flex-map-tree/index.d.ts +1 -1
  780. package/lib/feature-libraries/flex-map-tree/index.d.ts.map +1 -1
  781. package/lib/feature-libraries/flex-map-tree/index.js +1 -1
  782. package/lib/feature-libraries/flex-map-tree/index.js.map +1 -1
  783. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts +57 -51
  784. package/lib/feature-libraries/flex-map-tree/mapTreeNode.d.ts.map +1 -1
  785. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js +172 -180
  786. package/lib/feature-libraries/flex-map-tree/mapTreeNode.js.map +1 -1
  787. package/lib/feature-libraries/flex-tree/context.d.ts +0 -1
  788. package/lib/feature-libraries/flex-tree/context.d.ts.map +1 -1
  789. package/lib/feature-libraries/flex-tree/context.js.map +1 -1
  790. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +17 -373
  791. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  792. package/lib/feature-libraries/flex-tree/flexTreeTypes.js +0 -33
  793. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  794. package/lib/feature-libraries/flex-tree/index.d.ts +2 -2
  795. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  796. package/lib/feature-libraries/flex-tree/index.js +1 -1
  797. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  798. package/lib/feature-libraries/flex-tree/lazyField.d.ts +9 -27
  799. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  800. package/lib/feature-libraries/flex-tree/lazyField.js +28 -104
  801. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  802. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +3 -18
  803. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  804. package/lib/feature-libraries/flex-tree/lazyNode.js +5 -126
  805. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  806. package/lib/feature-libraries/flex-tree/treeEvents.d.ts +0 -2
  807. package/lib/feature-libraries/flex-tree/treeEvents.d.ts.map +1 -1
  808. package/lib/feature-libraries/flex-tree/treeEvents.js.map +1 -1
  809. package/lib/feature-libraries/flex-tree/utilities.d.ts +2 -1
  810. package/lib/feature-libraries/flex-tree/utilities.d.ts.map +1 -1
  811. package/lib/feature-libraries/flex-tree/utilities.js +4 -0
  812. package/lib/feature-libraries/flex-tree/utilities.js.map +1 -1
  813. package/lib/feature-libraries/forest-summary/codec.js +3 -3
  814. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  815. package/lib/feature-libraries/index.d.ts +6 -8
  816. package/lib/feature-libraries/index.d.ts.map +1 -1
  817. package/lib/feature-libraries/index.js +6 -7
  818. package/lib/feature-libraries/index.js.map +1 -1
  819. package/lib/feature-libraries/mapTreeCursor.d.ts +6 -2
  820. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  821. package/lib/feature-libraries/mapTreeCursor.js +7 -0
  822. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  823. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -4
  824. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +1 -1
  825. package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -1
  826. package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +1 -1
  827. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +0 -2
  828. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  829. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +0 -1
  830. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  831. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +18 -0
  832. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  833. package/lib/feature-libraries/modular-schema/discrepancies.js +103 -1
  834. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  835. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +0 -8
  836. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  837. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js +0 -1
  838. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  839. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +1 -3
  840. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  841. package/lib/feature-libraries/modular-schema/fieldKind.js +1 -2
  842. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  843. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +1 -2
  844. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  845. package/lib/feature-libraries/modular-schema/genericFieldKind.js +56 -83
  846. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  847. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts +1 -1
  848. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.d.ts.map +1 -1
  849. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js +6 -9
  850. package/lib/feature-libraries/modular-schema/genericFieldKindCodecs.js.map +1 -1
  851. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts +3 -14
  852. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.d.ts.map +1 -1
  853. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js +4 -1
  854. package/lib/feature-libraries/modular-schema/genericFieldKindTypes.js.map +1 -1
  855. package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
  856. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  857. package/lib/feature-libraries/modular-schema/index.js +1 -1
  858. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  859. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  860. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +42 -25
  861. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  862. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +9 -8
  863. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  864. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +169 -206
  865. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  866. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +8 -14
  867. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  868. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  869. package/lib/feature-libraries/node-key/nodeKey.d.ts +0 -4
  870. package/lib/feature-libraries/node-key/nodeKey.d.ts.map +1 -1
  871. package/lib/feature-libraries/node-key/nodeKey.js +0 -2
  872. package/lib/feature-libraries/node-key/nodeKey.js.map +1 -1
  873. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts +0 -1
  874. package/lib/feature-libraries/node-key/nodeKeyManager.d.ts.map +1 -1
  875. package/lib/feature-libraries/node-key/nodeKeyManager.js.map +1 -1
  876. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  877. package/lib/feature-libraries/object-forest/objectForest.js +2 -11
  878. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  879. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  880. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  881. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  882. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  883. package/lib/feature-libraries/schemaBuilderBase.d.ts +2 -28
  884. package/lib/feature-libraries/schemaBuilderBase.d.ts.map +1 -1
  885. package/lib/feature-libraries/schemaBuilderBase.js +2 -28
  886. package/lib/feature-libraries/schemaBuilderBase.js.map +1 -1
  887. package/lib/feature-libraries/sequence-field/compose.d.ts.map +1 -1
  888. package/lib/feature-libraries/sequence-field/compose.js +25 -22
  889. package/lib/feature-libraries/sequence-field/compose.js.map +1 -1
  890. package/lib/feature-libraries/sequence-field/formatV2.d.ts +3 -3
  891. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  892. package/lib/feature-libraries/sequence-field/formatV2.js +3 -3
  893. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  894. package/lib/feature-libraries/sequence-field/formatV3.d.ts +195 -0
  895. package/lib/feature-libraries/sequence-field/formatV3.d.ts.map +1 -0
  896. package/lib/feature-libraries/sequence-field/formatV3.js +19 -0
  897. package/lib/feature-libraries/sequence-field/formatV3.js.map +1 -0
  898. package/lib/feature-libraries/sequence-field/helperTypes.d.ts +11 -0
  899. package/lib/feature-libraries/sequence-field/helperTypes.d.ts.map +1 -1
  900. package/lib/feature-libraries/sequence-field/helperTypes.js.map +1 -1
  901. package/lib/feature-libraries/sequence-field/index.d.ts +1 -1
  902. package/lib/feature-libraries/sequence-field/index.d.ts.map +1 -1
  903. package/lib/feature-libraries/sequence-field/index.js.map +1 -1
  904. package/lib/feature-libraries/sequence-field/invert.d.ts.map +1 -1
  905. package/lib/feature-libraries/sequence-field/invert.js +22 -14
  906. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  907. package/lib/feature-libraries/sequence-field/markQueue.js +2 -2
  908. package/lib/feature-libraries/sequence-field/markQueue.js.map +1 -1
  909. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts +2 -2
  910. package/lib/feature-libraries/sequence-field/moveEffectTable.d.ts.map +1 -1
  911. package/lib/feature-libraries/sequence-field/moveEffectTable.js.map +1 -1
  912. package/lib/feature-libraries/sequence-field/rebase.d.ts.map +1 -1
  913. package/lib/feature-libraries/sequence-field/rebase.js +25 -7
  914. package/lib/feature-libraries/sequence-field/rebase.js.map +1 -1
  915. package/lib/feature-libraries/sequence-field/replaceRevisions.d.ts.map +1 -1
  916. package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -3
  917. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  918. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +1 -1
  919. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +40 -6
  920. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +1 -1
  921. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts +4 -1
  922. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.d.ts.map +1 -1
  923. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js +55 -11
  924. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV2.js.map +1 -1
  925. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts +11 -0
  926. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.d.ts.map +1 -0
  927. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js +81 -0
  928. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV3.js.map +1 -0
  929. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  930. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +2 -0
  931. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  932. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.d.ts.map +1 -1
  933. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +5 -2
  934. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  935. package/lib/feature-libraries/sequence-field/types.d.ts +23 -4
  936. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  937. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  938. package/lib/feature-libraries/sequence-field/utils.d.ts +5 -4
  939. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  940. package/lib/feature-libraries/sequence-field/utils.js +67 -41
  941. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  942. package/lib/feature-libraries/storedToViewSchema.d.ts +0 -1
  943. package/lib/feature-libraries/storedToViewSchema.d.ts.map +1 -1
  944. package/lib/feature-libraries/storedToViewSchema.js +0 -1
  945. package/lib/feature-libraries/storedToViewSchema.js.map +1 -1
  946. package/lib/feature-libraries/treeCursorUtils.d.ts +0 -6
  947. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  948. package/lib/feature-libraries/treeCursorUtils.js +9 -7
  949. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  950. package/lib/feature-libraries/treeTextCursor.d.ts +0 -2
  951. package/lib/feature-libraries/treeTextCursor.d.ts.map +1 -1
  952. package/lib/feature-libraries/treeTextCursor.js +0 -2
  953. package/lib/feature-libraries/treeTextCursor.js.map +1 -1
  954. package/lib/feature-libraries/typed-schema/flexList.d.ts +0 -3
  955. package/lib/feature-libraries/typed-schema/flexList.d.ts.map +1 -1
  956. package/lib/feature-libraries/typed-schema/flexList.js.map +1 -1
  957. package/lib/feature-libraries/typed-schema/index.d.ts +1 -1
  958. package/lib/feature-libraries/typed-schema/index.d.ts.map +1 -1
  959. package/lib/feature-libraries/typed-schema/index.js +1 -1
  960. package/lib/feature-libraries/typed-schema/index.js.map +1 -1
  961. package/lib/feature-libraries/typed-schema/schemaCollection.d.ts.map +1 -1
  962. package/lib/feature-libraries/typed-schema/schemaCollection.js +1 -5
  963. package/lib/feature-libraries/typed-schema/schemaCollection.js.map +1 -1
  964. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts +2 -41
  965. package/lib/feature-libraries/typed-schema/typedTreeSchema.d.ts.map +1 -1
  966. package/lib/feature-libraries/typed-schema/typedTreeSchema.js +1 -38
  967. package/lib/feature-libraries/typed-schema/typedTreeSchema.js.map +1 -1
  968. package/lib/feature-libraries/typed-schema/view.d.ts +0 -1
  969. package/lib/feature-libraries/typed-schema/view.d.ts.map +1 -1
  970. package/lib/feature-libraries/typed-schema/view.js.map +1 -1
  971. package/lib/index.d.ts +8 -9
  972. package/lib/index.d.ts.map +1 -1
  973. package/lib/index.js +8 -9
  974. package/lib/index.js.map +1 -1
  975. package/lib/internalTypes.d.ts +1 -1
  976. package/lib/internalTypes.d.ts.map +1 -1
  977. package/lib/internalTypes.js.map +1 -1
  978. package/lib/packageVersion.d.ts +1 -1
  979. package/lib/packageVersion.d.ts.map +1 -1
  980. package/lib/packageVersion.js +1 -1
  981. package/lib/packageVersion.js.map +1 -1
  982. package/lib/public.d.ts +4 -1
  983. package/lib/shared-tree/schematizeTree.d.ts +2 -11
  984. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  985. package/lib/shared-tree/schematizeTree.js +15 -4
  986. package/lib/shared-tree/schematizeTree.js.map +1 -1
  987. package/lib/shared-tree/schematizingTreeView.d.ts +4 -4
  988. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  989. package/lib/shared-tree/schematizingTreeView.js +3 -3
  990. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  991. package/lib/shared-tree/sharedTree.d.ts +4 -17
  992. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  993. package/lib/shared-tree/sharedTree.js +6 -10
  994. package/lib/shared-tree/sharedTree.js.map +1 -1
  995. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  996. package/lib/shared-tree/sharedTreeChangeCodecs.js +4 -0
  997. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  998. package/lib/shared-tree/sharedTreeChangeFamily.js +3 -3
  999. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  1000. package/lib/shared-tree/sharedTreeEditBuilder.d.ts +0 -2
  1001. package/lib/shared-tree/sharedTreeEditBuilder.d.ts.map +1 -1
  1002. package/lib/shared-tree/sharedTreeEditBuilder.js.map +1 -1
  1003. package/lib/shared-tree/treeApi.js +3 -3
  1004. package/lib/shared-tree/treeApi.js.map +1 -1
  1005. package/lib/shared-tree/treeCheckout.d.ts +0 -5
  1006. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  1007. package/lib/shared-tree/treeCheckout.js +6 -4
  1008. package/lib/shared-tree/treeCheckout.js.map +1 -1
  1009. package/lib/shared-tree/treeView.d.ts +3 -6
  1010. package/lib/shared-tree/treeView.d.ts.map +1 -1
  1011. package/lib/shared-tree/treeView.js.map +1 -1
  1012. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  1013. package/lib/shared-tree-core/branch.js +12 -7
  1014. package/lib/shared-tree-core/branch.js.map +1 -1
  1015. package/lib/shared-tree-core/defaultResubmitMachine.js +4 -4
  1016. package/lib/shared-tree-core/defaultResubmitMachine.js.map +1 -1
  1017. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  1018. package/lib/shared-tree-core/editManagerCodecs.js +1 -0
  1019. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  1020. package/lib/shared-tree-core/editManagerFormat.d.ts +2 -2
  1021. package/lib/shared-tree-core/editManagerFormat.d.ts.map +1 -1
  1022. package/lib/shared-tree-core/editManagerFormat.js +6 -1
  1023. package/lib/shared-tree-core/editManagerFormat.js.map +1 -1
  1024. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  1025. package/lib/shared-tree-core/messageCodecs.js +1 -0
  1026. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  1027. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  1028. package/lib/shared-tree-core/sharedTreeCore.js +4 -2
  1029. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  1030. package/lib/simple-tree/api/create.d.ts +54 -0
  1031. package/lib/simple-tree/api/create.d.ts.map +1 -0
  1032. package/lib/simple-tree/api/create.js +92 -0
  1033. package/lib/simple-tree/api/create.js.map +1 -0
  1034. package/lib/simple-tree/api/index.d.ts +12 -0
  1035. package/lib/simple-tree/api/index.d.ts.map +1 -0
  1036. package/lib/simple-tree/api/index.js +13 -0
  1037. package/lib/simple-tree/api/index.js.map +1 -0
  1038. package/{dist/simple-tree → lib/simple-tree/api}/schemaCreationUtilities.d.ts +7 -4
  1039. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -0
  1040. package/lib/simple-tree/{schemaCreationUtilities.js → api/schemaCreationUtilities.js} +1 -1
  1041. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -0
  1042. package/lib/simple-tree/{schemaFactory.d.ts → api/schemaFactory.d.ts} +15 -14
  1043. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -0
  1044. package/lib/simple-tree/{schemaFactory.js → api/schemaFactory.js} +9 -8
  1045. package/lib/simple-tree/api/schemaFactory.js.map +1 -0
  1046. package/{dist/simple-tree → lib/simple-tree/api}/schemaFactoryRecursive.d.ts +40 -7
  1047. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -0
  1048. package/lib/simple-tree/{schemaFactoryRecursive.js → api/schemaFactoryRecursive.js} +1 -1
  1049. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -0
  1050. package/lib/simple-tree/api/testRecursiveDomain.d.ts +62 -0
  1051. package/lib/simple-tree/api/testRecursiveDomain.d.ts.map +1 -0
  1052. package/lib/simple-tree/api/testRecursiveDomain.js.map +1 -0
  1053. package/{dist/simple-tree → lib/simple-tree/api}/tree.d.ts +111 -20
  1054. package/lib/simple-tree/api/tree.d.ts.map +1 -0
  1055. package/lib/simple-tree/api/tree.js +165 -0
  1056. package/lib/simple-tree/api/tree.js.map +1 -0
  1057. package/lib/simple-tree/{treeNodeApi.d.ts → api/treeNodeApi.d.ts} +7 -6
  1058. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -0
  1059. package/lib/simple-tree/{treeNodeApi.js → api/treeNodeApi.js} +55 -19
  1060. package/lib/simple-tree/api/treeNodeApi.js.map +1 -0
  1061. package/lib/simple-tree/api/verboseTree.d.ts +136 -0
  1062. package/lib/simple-tree/api/verboseTree.d.ts.map +1 -0
  1063. package/lib/simple-tree/api/verboseTree.js +213 -0
  1064. package/lib/simple-tree/api/verboseTree.js.map +1 -0
  1065. package/lib/simple-tree/arrayNode.d.ts +3 -3
  1066. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  1067. package/lib/simple-tree/arrayNode.js +59 -70
  1068. package/lib/simple-tree/arrayNode.js.map +1 -1
  1069. package/lib/simple-tree/core/index.d.ts +10 -0
  1070. package/lib/simple-tree/core/index.d.ts.map +1 -0
  1071. package/lib/simple-tree/core/index.js +10 -0
  1072. package/lib/simple-tree/core/index.js.map +1 -0
  1073. package/{dist/simple-tree → lib/simple-tree/core}/schemaCaching.d.ts +2 -9
  1074. package/lib/simple-tree/core/schemaCaching.d.ts.map +1 -0
  1075. package/lib/simple-tree/{schemaCaching.js → core/schemaCaching.js} +1 -21
  1076. package/lib/simple-tree/core/schemaCaching.js.map +1 -0
  1077. package/lib/simple-tree/core/treeNodeKernel.d.ts +70 -0
  1078. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -0
  1079. package/lib/simple-tree/core/treeNodeKernel.js +157 -0
  1080. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -0
  1081. package/lib/simple-tree/core/treeNodeSchema.d.ts +149 -0
  1082. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -0
  1083. package/lib/simple-tree/core/treeNodeSchema.js +32 -0
  1084. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -0
  1085. package/{dist/simple-tree → lib/simple-tree/core}/types.d.ts +50 -79
  1086. package/lib/simple-tree/core/types.d.ts.map +1 -0
  1087. package/lib/simple-tree/core/types.js +111 -0
  1088. package/lib/simple-tree/core/types.js.map +1 -0
  1089. package/lib/simple-tree/core/withType.d.ts +82 -0
  1090. package/lib/simple-tree/core/withType.d.ts.map +1 -0
  1091. package/lib/simple-tree/core/withType.js +36 -0
  1092. package/lib/simple-tree/core/withType.js.map +1 -0
  1093. package/lib/simple-tree/getJsonSchema.d.ts +55 -0
  1094. package/lib/simple-tree/getJsonSchema.d.ts.map +1 -0
  1095. package/lib/simple-tree/getJsonSchema.js +65 -0
  1096. package/lib/simple-tree/getJsonSchema.js.map +1 -0
  1097. package/lib/simple-tree/getSimpleFieldSchema.d.ts +14 -0
  1098. package/lib/simple-tree/getSimpleFieldSchema.d.ts.map +1 -0
  1099. package/lib/simple-tree/getSimpleFieldSchema.js +25 -0
  1100. package/lib/simple-tree/getSimpleFieldSchema.js.map +1 -0
  1101. package/lib/simple-tree/getSimpleSchema.d.ts +58 -0
  1102. package/lib/simple-tree/getSimpleSchema.d.ts.map +1 -0
  1103. package/lib/simple-tree/getSimpleSchema.js +64 -0
  1104. package/lib/simple-tree/getSimpleSchema.js.map +1 -0
  1105. package/lib/simple-tree/index.d.ts +12 -13
  1106. package/lib/simple-tree/index.d.ts.map +1 -1
  1107. package/lib/simple-tree/index.js +8 -11
  1108. package/lib/simple-tree/index.js.map +1 -1
  1109. package/lib/simple-tree/jsonSchema.d.ts +206 -0
  1110. package/lib/simple-tree/jsonSchema.d.ts.map +1 -0
  1111. package/lib/simple-tree/{nodeKeys.js → jsonSchema.js} +1 -1
  1112. package/lib/simple-tree/jsonSchema.js.map +1 -0
  1113. package/lib/simple-tree/leafNodeSchema.d.ts +1 -1
  1114. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  1115. package/lib/simple-tree/leafNodeSchema.js +1 -2
  1116. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  1117. package/lib/simple-tree/mapNode.d.ts +9 -3
  1118. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  1119. package/lib/simple-tree/mapNode.js +36 -36
  1120. package/lib/simple-tree/mapNode.js.map +1 -1
  1121. package/lib/simple-tree/objectNode.d.ts +18 -16
  1122. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  1123. package/lib/simple-tree/objectNode.js +36 -34
  1124. package/lib/simple-tree/objectNode.js.map +1 -1
  1125. package/lib/simple-tree/objectNodeTypes.d.ts +38 -0
  1126. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -0
  1127. package/lib/simple-tree/objectNodeTypes.js +15 -0
  1128. package/lib/simple-tree/objectNodeTypes.js.map +1 -0
  1129. package/lib/simple-tree/proxies.d.ts +6 -25
  1130. package/lib/simple-tree/proxies.d.ts.map +1 -1
  1131. package/lib/simple-tree/proxies.js +46 -57
  1132. package/lib/simple-tree/proxies.js.map +1 -1
  1133. package/lib/simple-tree/proxyBinding.d.ts +45 -22
  1134. package/lib/simple-tree/proxyBinding.d.ts.map +1 -1
  1135. package/lib/simple-tree/proxyBinding.js +89 -52
  1136. package/lib/simple-tree/proxyBinding.js.map +1 -1
  1137. package/lib/simple-tree/schemaTypes.d.ts +10 -159
  1138. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  1139. package/lib/simple-tree/schemaTypes.js +9 -41
  1140. package/lib/simple-tree/schemaTypes.js.map +1 -1
  1141. package/lib/simple-tree/simpleSchema.d.ts +124 -0
  1142. package/lib/simple-tree/simpleSchema.d.ts.map +1 -0
  1143. package/lib/{feature-libraries/schema-aware/schemaAware.js → simple-tree/simpleSchema.js} +1 -1
  1144. package/lib/simple-tree/simpleSchema.js.map +1 -0
  1145. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts +12 -0
  1146. package/lib/simple-tree/simpleSchemaToJsonSchema.d.ts.map +1 -0
  1147. package/lib/simple-tree/simpleSchemaToJsonSchema.js +142 -0
  1148. package/lib/simple-tree/simpleSchemaToJsonSchema.js.map +1 -0
  1149. package/lib/simple-tree/toFlexSchema.d.ts +4 -12
  1150. package/lib/simple-tree/toFlexSchema.d.ts.map +1 -1
  1151. package/lib/simple-tree/toFlexSchema.js +9 -18
  1152. package/lib/simple-tree/toFlexSchema.js.map +1 -1
  1153. package/lib/simple-tree/toMapTree.d.ts +39 -39
  1154. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  1155. package/lib/simple-tree/toMapTree.js +214 -158
  1156. package/lib/simple-tree/toMapTree.js.map +1 -1
  1157. package/lib/simple-tree/treeNodeValid.d.ts +74 -0
  1158. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -0
  1159. package/lib/simple-tree/{types.js → treeNodeValid.js} +8 -98
  1160. package/lib/simple-tree/treeNodeValid.js.map +1 -0
  1161. package/lib/simple-tree/typesUnsafe.d.ts +35 -4
  1162. package/lib/simple-tree/typesUnsafe.d.ts.map +1 -1
  1163. package/lib/simple-tree/typesUnsafe.js.map +1 -1
  1164. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts +11 -0
  1165. package/lib/simple-tree/viewSchemaToSimpleSchema.d.ts.map +1 -0
  1166. package/lib/simple-tree/viewSchemaToSimpleSchema.js +167 -0
  1167. package/lib/simple-tree/viewSchemaToSimpleSchema.js.map +1 -0
  1168. package/lib/util/brand.d.ts +0 -3
  1169. package/lib/util/brand.d.ts.map +1 -1
  1170. package/lib/util/brand.js +1 -2
  1171. package/lib/util/brand.js.map +1 -1
  1172. package/lib/util/brandedMap.d.ts +0 -5
  1173. package/lib/util/brandedMap.d.ts.map +1 -1
  1174. package/lib/util/brandedMap.js +0 -1
  1175. package/lib/util/brandedMap.js.map +1 -1
  1176. package/lib/util/idAllocator.d.ts +0 -2
  1177. package/lib/util/idAllocator.d.ts.map +1 -1
  1178. package/lib/util/idAllocator.js +0 -1
  1179. package/lib/util/idAllocator.js.map +1 -1
  1180. package/lib/util/index.d.ts +2 -2
  1181. package/lib/util/index.d.ts.map +1 -1
  1182. package/lib/util/index.js +2 -2
  1183. package/lib/util/index.js.map +1 -1
  1184. package/lib/util/nestedMap.d.ts +5 -19
  1185. package/lib/util/nestedMap.d.ts.map +1 -1
  1186. package/lib/util/nestedMap.js +15 -16
  1187. package/lib/util/nestedMap.js.map +1 -1
  1188. package/lib/util/opaque.d.ts +0 -4
  1189. package/lib/util/opaque.d.ts.map +1 -1
  1190. package/lib/util/opaque.js +0 -2
  1191. package/lib/util/opaque.js.map +1 -1
  1192. package/lib/util/rangeMap.d.ts +0 -2
  1193. package/lib/util/rangeMap.d.ts.map +1 -1
  1194. package/lib/util/rangeMap.js +4 -3
  1195. package/lib/util/rangeMap.js.map +1 -1
  1196. package/lib/util/transactionResult.d.ts +0 -1
  1197. package/lib/util/transactionResult.d.ts.map +1 -1
  1198. package/lib/util/transactionResult.js +0 -1
  1199. package/lib/util/transactionResult.js.map +1 -1
  1200. package/lib/util/typeCheck.d.ts +2 -20
  1201. package/lib/util/typeCheck.d.ts.map +1 -1
  1202. package/lib/util/typeCheck.js.map +1 -1
  1203. package/lib/util/typeCheckTests.d.ts +4 -4
  1204. package/lib/util/typeCheckTests.d.ts.map +1 -1
  1205. package/lib/util/typeCheckTests.js.map +1 -1
  1206. package/lib/util/typeUtils.d.ts +0 -7
  1207. package/lib/util/typeUtils.d.ts.map +1 -1
  1208. package/lib/util/typeUtils.js.map +1 -1
  1209. package/lib/util/utils.d.ts +6 -8
  1210. package/lib/util/utils.d.ts.map +1 -1
  1211. package/lib/util/utils.js +12 -4
  1212. package/lib/util/utils.js.map +1 -1
  1213. package/package.json +25 -24
  1214. package/src/codec/discriminatedUnions.ts +20 -10
  1215. package/src/codec/index.ts +5 -1
  1216. package/src/core/forest/README.md +4 -2
  1217. package/src/core/forest/editableForest.ts +1 -6
  1218. package/src/core/forest/forest.ts +0 -6
  1219. package/src/core/index.ts +2 -2
  1220. package/src/core/rebase/changeRebaser.ts +0 -4
  1221. package/src/core/rebase/index.ts +0 -2
  1222. package/src/core/rebase/types.ts +1 -23
  1223. package/src/core/rebase/utils.ts +13 -11
  1224. package/src/core/schema-stored/multiplicity.ts +0 -1
  1225. package/src/core/schema-stored/schema.ts +0 -7
  1226. package/src/core/schema-stored/storedSchemaRepository.ts +0 -3
  1227. package/src/core/schema-view/view.ts +0 -3
  1228. package/src/core/tree/anchorSet.ts +27 -26
  1229. package/src/core/tree/cursor.ts +1 -6
  1230. package/src/core/tree/delta.ts +0 -11
  1231. package/src/core/tree/detachedFieldIndexCodec.ts +4 -3
  1232. package/src/core/tree/detachedFieldIndexTypes.ts +0 -1
  1233. package/src/core/tree/index.ts +1 -1
  1234. package/src/core/tree/mapTree.ts +45 -4
  1235. package/src/core/tree/pathTree.ts +0 -11
  1236. package/src/core/tree/treeTextFormat.ts +3 -2
  1237. package/src/core/tree/types.ts +0 -11
  1238. package/src/core/tree/visitDelta.ts +2 -3
  1239. package/src/core/tree/visitPath.ts +0 -2
  1240. package/src/core/tree/visitorUtils.ts +0 -1
  1241. package/src/domains/index.ts +3 -0
  1242. package/src/domains/json/index.ts +7 -1
  1243. package/src/domains/json/jsonCursor.ts +113 -6
  1244. package/src/domains/json/jsonDomainSchema.ts +4 -5
  1245. package/src/domains/leafDomain.ts +0 -1
  1246. package/src/domains/schemaBuilder.ts +0 -22
  1247. package/src/events/events.ts +10 -6
  1248. package/src/feature-libraries/chunked-forest/README.md +9 -1
  1249. package/src/feature-libraries/chunked-forest/basicChunk.ts +14 -9
  1250. package/src/feature-libraries/chunked-forest/chunk.ts +1 -1
  1251. package/src/feature-libraries/chunked-forest/chunkTree.ts +4 -4
  1252. package/src/feature-libraries/chunked-forest/chunkedForest.ts +8 -6
  1253. package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +2 -2
  1254. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +9 -6
  1255. package/src/feature-libraries/chunked-forest/uniformChunk.ts +6 -4
  1256. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +18 -46
  1257. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +11 -6
  1258. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -1
  1259. package/src/feature-libraries/default-schema/index.ts +1 -1
  1260. package/src/feature-libraries/default-schema/schemaChecker.ts +6 -0
  1261. package/src/feature-libraries/editableTreeBinder.ts +6 -78
  1262. package/src/feature-libraries/fieldGenerator.ts +0 -3
  1263. package/src/feature-libraries/flex-map-tree/index.ts +2 -1
  1264. package/src/feature-libraries/flex-map-tree/mapTreeNode.ts +238 -288
  1265. package/src/feature-libraries/flex-tree/context.ts +0 -1
  1266. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +27 -524
  1267. package/src/feature-libraries/flex-tree/index.ts +1 -18
  1268. package/src/feature-libraries/flex-tree/lazyField.ts +38 -214
  1269. package/src/feature-libraries/flex-tree/lazyNode.ts +3 -215
  1270. package/src/feature-libraries/flex-tree/treeEvents.ts +0 -2
  1271. package/src/feature-libraries/flex-tree/utilities.ts +6 -1
  1272. package/src/feature-libraries/forest-summary/codec.ts +3 -3
  1273. package/src/feature-libraries/index.ts +5 -49
  1274. package/src/feature-libraries/mapTreeCursor.ts +13 -4
  1275. package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -4
  1276. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +0 -2
  1277. package/src/feature-libraries/modular-schema/discrepancies.ts +117 -1
  1278. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +0 -8
  1279. package/src/feature-libraries/modular-schema/fieldKind.ts +1 -3
  1280. package/src/feature-libraries/modular-schema/genericFieldKind.ts +69 -92
  1281. package/src/feature-libraries/modular-schema/genericFieldKindCodecs.ts +7 -14
  1282. package/src/feature-libraries/modular-schema/genericFieldKindTypes.ts +6 -15
  1283. package/src/feature-libraries/modular-schema/index.ts +2 -2
  1284. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +68 -34
  1285. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +330 -336
  1286. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +7 -14
  1287. package/src/feature-libraries/node-key/nodeKey.ts +0 -4
  1288. package/src/feature-libraries/node-key/nodeKeyManager.ts +0 -1
  1289. package/src/feature-libraries/object-forest/objectForest.ts +1 -13
  1290. package/src/feature-libraries/schemaBuilderBase.ts +1 -49
  1291. package/src/feature-libraries/sequence-field/compose.ts +41 -20
  1292. package/src/feature-libraries/sequence-field/formatV2.ts +3 -3
  1293. package/src/feature-libraries/sequence-field/formatV3.ts +65 -0
  1294. package/src/feature-libraries/sequence-field/helperTypes.ts +33 -0
  1295. package/src/feature-libraries/sequence-field/index.ts +1 -0
  1296. package/src/feature-libraries/sequence-field/invert.ts +28 -18
  1297. package/src/feature-libraries/sequence-field/markQueue.ts +2 -2
  1298. package/src/feature-libraries/sequence-field/moveEffectTable.ts +2 -2
  1299. package/src/feature-libraries/sequence-field/rebase.ts +30 -13
  1300. package/src/feature-libraries/sequence-field/replaceRevisions.ts +27 -3
  1301. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +52 -7
  1302. package/src/feature-libraries/sequence-field/sequenceFieldCodecV2.ts +92 -19
  1303. package/src/feature-libraries/sequence-field/sequenceFieldCodecV3.ts +134 -0
  1304. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +2 -0
  1305. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +8 -2
  1306. package/src/feature-libraries/sequence-field/types.ts +24 -4
  1307. package/src/feature-libraries/sequence-field/utils.ts +78 -50
  1308. package/src/feature-libraries/storedToViewSchema.ts +0 -1
  1309. package/src/feature-libraries/treeCursorUtils.ts +11 -11
  1310. package/src/feature-libraries/treeTextCursor.ts +0 -2
  1311. package/src/feature-libraries/typed-schema/flexList.ts +0 -3
  1312. package/src/feature-libraries/typed-schema/index.ts +0 -2
  1313. package/src/feature-libraries/typed-schema/schemaCollection.ts +0 -5
  1314. package/src/feature-libraries/typed-schema/typedTreeSchema.ts +2 -68
  1315. package/src/feature-libraries/typed-schema/view.ts +0 -1
  1316. package/src/index.ts +32 -242
  1317. package/src/internalTypes.ts +1 -0
  1318. package/src/packageVersion.ts +1 -1
  1319. package/src/shared-tree/schematizeTree.ts +25 -21
  1320. package/src/shared-tree/schematizingTreeView.ts +6 -6
  1321. package/src/shared-tree/sharedTree.ts +8 -39
  1322. package/src/shared-tree/sharedTreeChangeCodecs.ts +8 -0
  1323. package/src/shared-tree/sharedTreeChangeFamily.ts +3 -3
  1324. package/src/shared-tree/sharedTreeEditBuilder.ts +0 -2
  1325. package/src/shared-tree/treeApi.ts +3 -3
  1326. package/src/shared-tree/treeCheckout.ts +6 -8
  1327. package/src/shared-tree/treeView.ts +3 -6
  1328. package/src/shared-tree-core/branch.ts +20 -8
  1329. package/src/shared-tree-core/defaultResubmitMachine.ts +4 -4
  1330. package/src/shared-tree-core/editManagerCodecs.ts +1 -0
  1331. package/src/shared-tree-core/editManagerFormat.ts +7 -2
  1332. package/src/shared-tree-core/messageCodecs.ts +2 -1
  1333. package/src/shared-tree-core/sharedTreeCore.ts +5 -3
  1334. package/src/simple-tree/ProxyBinding.md +2 -0
  1335. package/src/simple-tree/api/README.md +7 -0
  1336. package/src/simple-tree/api/create.ts +179 -0
  1337. package/src/simple-tree/api/index.ts +36 -0
  1338. package/src/simple-tree/{schemaCreationUtilities.ts → api/schemaCreationUtilities.ts} +13 -5
  1339. package/src/simple-tree/{schemaFactory.ts → api/schemaFactory.ts} +36 -34
  1340. package/src/simple-tree/{schemaFactoryRecursive.ts → api/schemaFactoryRecursive.ts} +47 -10
  1341. package/src/simple-tree/{testRecursiveDomain.ts → api/testRecursiveDomain.ts} +3 -1
  1342. package/src/simple-tree/{tree.ts → api/tree.ts} +246 -34
  1343. package/src/simple-tree/{treeNodeApi.ts → api/treeNodeApi.ts} +84 -41
  1344. package/src/simple-tree/api/verboseTree.ts +415 -0
  1345. package/src/simple-tree/arrayNode.ts +103 -110
  1346. package/src/simple-tree/core/README.md +11 -0
  1347. package/src/simple-tree/core/index.ts +34 -0
  1348. package/src/simple-tree/{schemaCaching.ts → core/schemaCaching.ts} +3 -37
  1349. package/src/simple-tree/core/treeNodeKernel.ts +200 -0
  1350. package/src/simple-tree/core/treeNodeSchema.ts +184 -0
  1351. package/src/simple-tree/core/types.ts +281 -0
  1352. package/src/simple-tree/core/withType.ts +89 -0
  1353. package/src/simple-tree/getJsonSchema.ts +70 -0
  1354. package/src/simple-tree/getSimpleFieldSchema.ts +36 -0
  1355. package/src/simple-tree/getSimpleSchema.ts +69 -0
  1356. package/src/simple-tree/index.ts +59 -33
  1357. package/src/simple-tree/jsonSchema.ts +230 -0
  1358. package/src/simple-tree/leafNodeSchema.ts +6 -3
  1359. package/src/simple-tree/mapNode.ts +56 -55
  1360. package/src/simple-tree/objectNode.ts +66 -90
  1361. package/src/simple-tree/objectNodeTypes.ts +68 -0
  1362. package/src/simple-tree/proxies.ts +52 -68
  1363. package/src/simple-tree/proxyBinding.ts +127 -72
  1364. package/src/simple-tree/schemaTypes.ts +29 -194
  1365. package/src/simple-tree/simpleSchema.ts +138 -0
  1366. package/src/simple-tree/simpleSchemaToJsonSchema.ts +178 -0
  1367. package/src/simple-tree/toFlexSchema.ts +9 -42
  1368. package/src/simple-tree/toMapTree.ts +270 -296
  1369. package/src/simple-tree/{types.ts → treeNodeValid.ts} +16 -232
  1370. package/src/simple-tree/typesUnsafe.ts +51 -5
  1371. package/src/simple-tree/viewSchemaToSimpleSchema.ts +209 -0
  1372. package/src/util/brand.ts +1 -4
  1373. package/src/util/brandedMap.ts +0 -5
  1374. package/src/util/idAllocator.ts +0 -2
  1375. package/src/util/index.ts +2 -0
  1376. package/src/util/nestedMap.ts +23 -20
  1377. package/src/util/opaque.ts +0 -4
  1378. package/src/util/rangeMap.ts +5 -5
  1379. package/src/util/transactionResult.ts +0 -1
  1380. package/src/util/typeCheck.ts +2 -20
  1381. package/src/util/typeCheckTests.ts +4 -4
  1382. package/src/util/typeUtils.ts +0 -7
  1383. package/src/util/utils.ts +13 -8
  1384. package/tsconfig.json +0 -1
  1385. package/dist/feature-libraries/contextuallyTyped.d.ts +0 -209
  1386. package/dist/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1387. package/dist/feature-libraries/contextuallyTyped.js +0 -328
  1388. package/dist/feature-libraries/contextuallyTyped.js.map +0 -1
  1389. package/dist/feature-libraries/schema-aware/index.d.ts +0 -6
  1390. package/dist/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1391. package/dist/feature-libraries/schema-aware/index.js.map +0 -1
  1392. package/dist/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1393. package/dist/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1394. package/dist/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1395. package/dist/simple-tree/nodeKeys.d.ts +0 -41
  1396. package/dist/simple-tree/nodeKeys.d.ts.map +0 -1
  1397. package/dist/simple-tree/nodeKeys.js +0 -7
  1398. package/dist/simple-tree/nodeKeys.js.map +0 -1
  1399. package/dist/simple-tree/schemaCaching.d.ts.map +0 -1
  1400. package/dist/simple-tree/schemaCaching.js.map +0 -1
  1401. package/dist/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1402. package/dist/simple-tree/schemaCreationUtilities.js.map +0 -1
  1403. package/dist/simple-tree/schemaFactory.d.ts.map +0 -1
  1404. package/dist/simple-tree/schemaFactory.js.map +0 -1
  1405. package/dist/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1406. package/dist/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1407. package/dist/simple-tree/testRecursiveDomain.d.ts +0 -61
  1408. package/dist/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1409. package/dist/simple-tree/testRecursiveDomain.js.map +0 -1
  1410. package/dist/simple-tree/tree.d.ts.map +0 -1
  1411. package/dist/simple-tree/tree.js +0 -73
  1412. package/dist/simple-tree/tree.js.map +0 -1
  1413. package/dist/simple-tree/treeNodeApi.d.ts.map +0 -1
  1414. package/dist/simple-tree/treeNodeApi.js.map +0 -1
  1415. package/dist/simple-tree/treeNodeKernel.d.ts +0 -26
  1416. package/dist/simple-tree/treeNodeKernel.d.ts.map +0 -1
  1417. package/dist/simple-tree/treeNodeKernel.js +0 -83
  1418. package/dist/simple-tree/treeNodeKernel.js.map +0 -1
  1419. package/dist/simple-tree/types.d.ts.map +0 -1
  1420. package/dist/simple-tree/types.js.map +0 -1
  1421. package/lib/feature-libraries/contextuallyTyped.d.ts +0 -209
  1422. package/lib/feature-libraries/contextuallyTyped.d.ts.map +0 -1
  1423. package/lib/feature-libraries/contextuallyTyped.js +0 -311
  1424. package/lib/feature-libraries/contextuallyTyped.js.map +0 -1
  1425. package/lib/feature-libraries/schema-aware/index.d.ts +0 -6
  1426. package/lib/feature-libraries/schema-aware/index.d.ts.map +0 -1
  1427. package/lib/feature-libraries/schema-aware/index.js +0 -6
  1428. package/lib/feature-libraries/schema-aware/index.js.map +0 -1
  1429. package/lib/feature-libraries/schema-aware/schemaAware.d.ts +0 -76
  1430. package/lib/feature-libraries/schema-aware/schemaAware.d.ts.map +0 -1
  1431. package/lib/feature-libraries/schema-aware/schemaAware.js.map +0 -1
  1432. package/lib/simple-tree/nodeKeys.d.ts +0 -41
  1433. package/lib/simple-tree/nodeKeys.d.ts.map +0 -1
  1434. package/lib/simple-tree/nodeKeys.js.map +0 -1
  1435. package/lib/simple-tree/schemaCaching.d.ts.map +0 -1
  1436. package/lib/simple-tree/schemaCaching.js.map +0 -1
  1437. package/lib/simple-tree/schemaCreationUtilities.d.ts.map +0 -1
  1438. package/lib/simple-tree/schemaCreationUtilities.js.map +0 -1
  1439. package/lib/simple-tree/schemaFactory.d.ts.map +0 -1
  1440. package/lib/simple-tree/schemaFactory.js.map +0 -1
  1441. package/lib/simple-tree/schemaFactoryRecursive.d.ts.map +0 -1
  1442. package/lib/simple-tree/schemaFactoryRecursive.js.map +0 -1
  1443. package/lib/simple-tree/testRecursiveDomain.d.ts +0 -61
  1444. package/lib/simple-tree/testRecursiveDomain.d.ts.map +0 -1
  1445. package/lib/simple-tree/testRecursiveDomain.js.map +0 -1
  1446. package/lib/simple-tree/tree.d.ts.map +0 -1
  1447. package/lib/simple-tree/tree.js +0 -66
  1448. package/lib/simple-tree/tree.js.map +0 -1
  1449. package/lib/simple-tree/treeNodeApi.d.ts.map +0 -1
  1450. package/lib/simple-tree/treeNodeApi.js.map +0 -1
  1451. package/lib/simple-tree/treeNodeKernel.d.ts +0 -26
  1452. package/lib/simple-tree/treeNodeKernel.d.ts.map +0 -1
  1453. package/lib/simple-tree/treeNodeKernel.js +0 -79
  1454. package/lib/simple-tree/treeNodeKernel.js.map +0 -1
  1455. package/lib/simple-tree/types.d.ts.map +0 -1
  1456. package/lib/simple-tree/types.js.map +0 -1
  1457. package/src/feature-libraries/contextuallyTyped.ts +0 -582
  1458. package/src/feature-libraries/schema-aware/README.md +0 -19
  1459. package/src/feature-libraries/schema-aware/index.ts +0 -16
  1460. package/src/feature-libraries/schema-aware/schemaAware.ts +0 -135
  1461. package/src/simple-tree/nodeKeys.ts +0 -42
  1462. package/src/simple-tree/treeNodeKernel.ts +0 -91
  1463. /package/dist/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
  1464. /package/lib/simple-tree/{testRecursiveDomain.js → api/testRecursiveDomain.js} +0 -0
@@ -2,15 +2,18 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { cursorForMapTreeNode, getOrCreateMapTreeNode, getSchemaAndPolicy, isMapTreeNode, } from "../feature-libraries/index.js";
6
- import { getProxyForField, markContentType, prepareContentForHydration, } from "./proxies.js";
7
- import { getFlexNode } from "./proxyBinding.js";
8
- import { getSimpleNodeSchema } from "./schemaCaching.js";
9
- import { NodeKind, typeNameSymbol, } from "./schemaTypes.js";
5
+ import { getOrCreateMapTreeNode, getSchemaAndPolicy, } from "../feature-libraries/index.js";
6
+ import { getTreeNodeForField, prepareContentForHydration, } from "./proxies.js";
7
+ import { getOrCreateInnerNode } from "./proxyBinding.js";
8
+ import { getSimpleNodeSchema } from "./core/index.js";
9
+ import { createFieldSchema, FieldKind, } from "./schemaTypes.js";
10
+ import { NodeKind,
11
+ // eslint-disable-next-line import/no-deprecated
12
+ typeNameSymbol, typeSchemaSymbol, } from "./core/index.js";
10
13
  import { mapTreeFromNodeData } from "./toMapTree.js";
11
- import { TreeNodeValid } from "./types.js";
12
14
  import { getFlexSchema } from "./toFlexSchema.js";
13
- import { UsageError } from "@fluidframework/telemetry-utils/internal";
15
+ import { brand, count } from "../util/index.js";
16
+ import { TreeNodeValid } from "./treeNodeValid.js";
14
17
  const handler = {
15
18
  getPrototypeOf: () => {
16
19
  return Map.prototype;
@@ -21,45 +24,43 @@ class CustomMapNodeBase extends TreeNodeValid {
21
24
  return this.entries();
22
25
  }
23
26
  delete(key) {
24
- const node = getFlexNode(this);
25
- if (isMapTreeNode(node)) {
26
- throw new UsageError(`A map cannot be mutated before being inserted into the tree`);
27
- }
28
- node.delete(key);
27
+ const field = getOrCreateInnerNode(this).getBoxed(key);
28
+ field.editor.set(undefined, field.length === 0);
29
29
  }
30
30
  *entries() {
31
- const node = getFlexNode(this);
31
+ const node = getOrCreateInnerNode(this);
32
32
  for (const key of node.keys()) {
33
- yield [key, getProxyForField(node.getBoxed(key))];
33
+ yield [
34
+ key,
35
+ getTreeNodeForField(node.getBoxed(key)),
36
+ ];
34
37
  }
35
38
  }
36
39
  get(key) {
37
- const node = getFlexNode(this);
40
+ const node = getOrCreateInnerNode(this);
38
41
  const field = node.getBoxed(key);
39
- return getProxyForField(field);
42
+ return getTreeNodeForField(field);
40
43
  }
41
44
  has(key) {
42
- const node = getFlexNode(this);
43
- return node.has(key);
45
+ return getOrCreateInnerNode(this).tryGetField(brand(key)) !== undefined;
44
46
  }
45
47
  keys() {
46
- const node = getFlexNode(this);
48
+ const node = getOrCreateInnerNode(this);
47
49
  return node.keys();
48
50
  }
49
51
  set(key, value) {
50
- const node = getFlexNode(this);
51
- if (isMapTreeNode(node)) {
52
- throw new UsageError(`A map cannot be mutated before being inserted into the tree`);
53
- }
52
+ const node = getOrCreateInnerNode(this);
54
53
  const classSchema = getSimpleNodeSchema(node.schema);
55
- const mapTree = mapTreeFromNodeData(value, classSchema.info, node.context.nodeKeyManager, getSchemaAndPolicy(node));
56
- prepareContentForHydration(mapTree, node.context.checkout.forest);
57
- const cursor = mapTree !== undefined ? cursorForMapTreeNode(mapTree) : undefined;
58
- node.set(key, cursor);
54
+ const mapTree = mapTreeFromNodeData(value, createFieldSchema(FieldKind.Optional, classSchema.info), node.context?.nodeKeyManager, getSchemaAndPolicy(node));
55
+ const field = node.getBoxed(key);
56
+ if (node.context !== undefined) {
57
+ prepareContentForHydration(mapTree, node.context.checkout.forest);
58
+ }
59
+ field.editor.set(mapTree, field.length === 0);
59
60
  return this;
60
61
  }
61
62
  get size() {
62
- return getFlexNode(this).size;
63
+ return count(getOrCreateInnerNode(this).keys());
63
64
  }
64
65
  *values() {
65
66
  for (const [, value] of this.entries()) {
@@ -67,8 +68,8 @@ class CustomMapNodeBase extends TreeNodeValid {
67
68
  }
68
69
  }
69
70
  forEach(callbackFn, thisArg) {
70
- for (const field of getFlexNode(this).boxedIterator()) {
71
- const node = getProxyForField(field);
71
+ for (const field of getOrCreateInnerNode(this).boxedIterator()) {
72
+ const node = getTreeNodeForField(field);
72
73
  callbackFn.call(thisArg, node, field.key, this);
73
74
  }
74
75
  }
@@ -91,14 +92,18 @@ export function mapSchema(identifier, info, implicitlyConstructable, useMapProto
91
92
  return instance;
92
93
  }
93
94
  static buildRawNode(instance, input) {
94
- return getOrCreateMapTreeNode(flexSchema, mapTreeFromNodeData(copyContent(flexSchema.name, input), this));
95
+ return getOrCreateMapTreeNode(flexSchema, mapTreeFromNodeData(input, this));
95
96
  }
96
97
  static oneTimeSetup() {
97
98
  flexSchema = getFlexSchema(this);
98
99
  }
100
+ // eslint-disable-next-line import/no-deprecated
99
101
  get [typeNameSymbol]() {
100
102
  return identifier;
101
103
  }
104
+ get [typeSchemaSymbol]() {
105
+ return schema.constructorCached?.constructor;
106
+ }
102
107
  }
103
108
  schema.constructorCached = undefined;
104
109
  schema.identifier = identifier;
@@ -107,9 +112,4 @@ export function mapSchema(identifier, info, implicitlyConstructable, useMapProto
107
112
  const schemaErased = schema;
108
113
  return schemaErased;
109
114
  }
110
- function copyContent(typeName, content) {
111
- const copy = new Map(content);
112
- markContentType(typeName, copy);
113
- return copy;
114
- }
115
115
  //# sourceMappingURL=mapNode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapNode.js","sourceRoot":"","sources":["../../src/simple-tree/mapNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAIN,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,GACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEN,gBAAgB,EAChB,eAAe,EACf,0BAA0B,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACN,QAAQ,EAOR,cAAc,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAuC,aAAa,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAsFtE,MAAM,OAAO,GAA8B;IAC1C,cAAc,EAAE,GAAG,EAAE;QACpB,OAAO,GAAG,CAAC,SAAS,CAAC;IACtB,CAAC;CACD,CAAC;AAEF,MAAe,iBAAwD,SAAQ,aAE9E;IAGO,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;IACM,MAAM,CAAC,GAAW;QACxB,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,aAAa,CAAC,IAAI,CAAC,E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O,CAAC,CAAC;YACvD,CAAC;YACD,OAAO,QAAQ,CAAC;QACjB,CAAC;QAEM,MAAM,CAAU,YAAY,CAElC,QAA2B,EAC3B,KAAS;YAET,OAAO,sBAAsB,CAC5B,UAAU,EACV,mBAAmB,CAClB,WAAW,CAAC,UAAU,CAAC,IAAI,EAAE,KAA8C,CAAC,EAC5E,IAAuC,CACvC,CACD,CAAC;QACH,CAAC;QAIS,MAAM,CAAU,YAAY;YACrC,UAAU,GAAG,aAAa,CAAC,IAAiC,CAAsB,CAAC;QACpF,CAAC;QAOD,IAAW,CAAC,cAAc,CAAC;YAC1B,OAAO,UAAU,CAAC;QACnB,CAAC;;IAbyB,wBAAiB,GAAgC,SAAS,CAAC;IAM9D,iBAAU,GAAG,UAAU,CAAC;IACxB,WAAI,GAAG,IAAI,CAAC;IACZ,8BAAuB,GAC7C,uBAAuB,CAAC;IAM1B,MAAM,YAAY,GAOd,MAAM,CAAC;IACX,OAAO,YAAY,CAAC;AACrB,CAAC;AAED,SAAS,WAAW,CACnB,QAAkC,EAClC,OAA8B;IAE9B,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAC9B,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TreeNodeSchemaIdentifier } from \"../core/index.js\";\nimport {\n\ttype FlexMapNodeSchema,\n\ttype FlexTreeNode,\n\ttype MapTreeNode,\n\tcursorForMapTreeNode,\n\tgetOrCreateMapTreeNode,\n\tgetSchemaAndPolicy,\n\tisMapTreeNode,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype InsertableContent,\n\tgetProxyForField,\n\tmarkContentType,\n\tprepareContentForHydration,\n} from \"./proxies.js\";\nimport { getFlexNode } from \"./proxyBinding.js\";\nimport { getSimpleNodeSchema } from \"./schemaCaching.js\";\nimport {\n\tNodeKind,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchemaClass,\n\ttype WithType,\n\ttype TreeNodeSchema,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttypeNameSymbol,\n} from \"./schemaTypes.js\";\nimport { mapTreeFromNodeData } from \"./toMapTree.js\";\nimport { type MostDerivedData, type TreeNode, TreeNodeValid } from \"./types.js\";\nimport { getFlexSchema } from \"./toFlexSchema.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * A map of string keys to tree objects.\n *\n * @privateRemarks\n * Add support for `clear` once we have established merge semantics for it.\n *\n * @sealed @public\n */\nexport interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTypes>\n\textends ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\tTreeNode {\n\t/**\n\t * Adds or updates an entry in the map with a specified `key` and a `value`.\n\t *\n\t * @param key - The key of the element to add to the map.\n\t * @param value - The value of the element to add to the map.\n\t *\n\t * @remarks\n\t * Setting the value at a key to `undefined` is equivalent to calling {@link TreeMapNode.delete} with that key.\n\t */\n\tset(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T> | undefined): void;\n\n\t/**\n\t * Removes the specified element from this map by its `key`.\n\t *\n\t * @remarks\n\t * Note: unlike JavaScript's Map API, this method does not return a flag indicating whether or not the value was\n\t * deleted.\n\t *\n\t * @privateRemarks\n\t * Regarding the choice to not return a boolean: Since this data structure is distributed in nature, it isn't\n\t * possible to tell whether or not the item was deleted as a result of this method call. Returning a \"best guess\"\n\t * is more likely to create issues / promote bad usage patterns than offer useful information.\n\t *\n\t * @param key - The key of the element to remove from the map.\n\t */\n\tdelete(key: string): void;\n\n\t/**\n\t * Returns an iterable of keys in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the keys returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tkeys(): IterableIterator<string>;\n\n\t/**\n\t * Returns an iterable of values in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the values returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tvalues(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>>;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the entries returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tentries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]>;\n\n\t/**\n\t * Executes the provided function once per each key/value pair in this map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order in which the function is called with respect to the map's entries.\n\t * If your usage scenario depends on consistent ordering, you will need to account for this.\n\t */\n\tforEach(\n\t\tcallbackfn: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tkey: string,\n\t\t\tmap: ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\t) => void,\n\t\t// Typing inherited from `ReadonlyMap`.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tthisArg?: any,\n\t): void;\n}\n\nconst handler: ProxyHandler<TreeMapNode> = {\n\tgetPrototypeOf: () => {\n\t\treturn Map.prototype;\n\t},\n};\n\nabstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends TreeNodeValid<\n\tIterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T>]>\n> {\n\tpublic static readonly kind = NodeKind.Map;\n\n\tpublic [Symbol.iterator](): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> {\n\t\treturn this.entries();\n\t}\n\tpublic delete(key: string): void {\n\t\tconst node = getFlexNode(this);\n\t\tif (isMapTreeNode(node)) {\n\t\t\tthrow new UsageError(`A map cannot be mutated before being inserted into the tree`);\n\t\t}\n\n\t\tnode.delete(key);\n\t}\n\tpublic *entries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> {\n\t\tconst node = getFlexNode(this);\n\t\tfor (const key of node.keys()) {\n\t\t\tyield [key, getProxyForField(node.getBoxed(key)) as TreeNodeFromImplicitAllowedTypes<T>];\n\t\t}\n\t}\n\tpublic get(key: string): TreeNodeFromImplicitAllowedTypes<T> {\n\t\tconst node = getFlexNode(this);\n\t\tconst field = node.getBoxed(key);\n\t\treturn getProxyForField(field) as TreeNodeFromImplicitAllowedTypes<T>;\n\t}\n\tpublic has(key: string): boolean {\n\t\tconst node = getFlexNode(this);\n\t\treturn node.has(key);\n\t}\n\tpublic keys(): IterableIterator<string> {\n\t\tconst node = getFlexNode(this);\n\t\treturn node.keys();\n\t}\n\tpublic set(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T>): TreeMapNode {\n\t\tconst node = getFlexNode(this);\n\t\tif (isMapTreeNode(node)) {\n\t\t\tthrow new UsageError(`A map cannot be mutated before being inserted into the tree`);\n\t\t}\n\n\t\tconst classSchema = getSimpleNodeSchema(node.schema);\n\t\tconst mapTree = mapTreeFromNodeData(\n\t\t\tvalue as InsertableContent,\n\t\t\tclassSchema.info as ImplicitAllowedTypes,\n\t\t\tnode.context.nodeKeyManager,\n\t\t\tgetSchemaAndPolicy(node),\n\t\t);\n\n\t\tprepareContentForHydration(mapTree, node.context.checkout.forest);\n\t\tconst cursor = mapTree !== undefined ? cursorForMapTreeNode(mapTree) : undefined;\n\t\tnode.set(key, cursor);\n\t\treturn this;\n\t}\n\tpublic get size(): number {\n\t\treturn getFlexNode(this).size;\n\t}\n\tpublic *values(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\tfor (const [, value] of this.entries()) {\n\t\t\tyield value;\n\t\t}\n\t}\n\tpublic forEach<TThis extends TreeMapNode<T>>(\n\t\tthis: TThis,\n\t\tcallbackFn: (value: TreeNodeFromImplicitAllowedTypes<T>, key: string, map: TThis) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tfor (const field of getFlexNode(this).boxedIterator()) {\n\t\t\tconst node = getProxyForField(field) as TreeNodeFromImplicitAllowedTypes<T>;\n\t\t\tcallbackFn.call(thisArg, node, field.key, this);\n\t\t}\n\t}\n\t// TODO: add `clear` once we have established merge semantics for it.\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n *\n * @param base - base schema type to extend.\n * @param useMapPrototype - should this type emulate a ES6 Map object (by faking its prototype with a proxy).\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function mapSchema<\n\tTName extends string,\n\tconst T extends ImplicitAllowedTypes,\n\tconst ImplicitlyConstructable extends boolean,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n\tuseMapPrototype: boolean,\n) {\n\tlet flexSchema: FlexMapNodeSchema;\n\n\tclass schema extends CustomMapNodeBase<T> implements TreeMapNode<T> {\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\tif (useMapPrototype) {\n\t\t\t\treturn new Proxy<schema>(instance as schema, handler);\n\t\t\t}\n\t\t\treturn instance;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): MapTreeNode {\n\t\t\treturn getOrCreateMapTreeNode(\n\t\t\t\tflexSchema,\n\t\t\t\tmapTreeFromNodeData(\n\t\t\t\t\tcopyContent(flexSchema.name, input as Iterable<[string, InsertableContent]>),\n\t\t\t\t\tthis as unknown as ImplicitAllowedTypes,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>): void {\n\t\t\tflexSchema = getFlexSchema(this as unknown as TreeNodeSchema) as FlexMapNodeSchema;\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t}\n\tconst schemaErased: TreeNodeSchemaClass<\n\t\tTName,\n\t\tNodeKind.Map,\n\t\tTreeMapNode<T> & WithType<TName>,\n\t\tIterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T>]>,\n\t\tImplicitlyConstructable,\n\t\tT\n\t> = schema;\n\treturn schemaErased;\n}\n\nfunction copyContent<T>(\n\ttypeName: TreeNodeSchemaIdentifier,\n\tcontent: Iterable<[string, T]>,\n): Map<string, T> {\n\tconst copy = new Map(content);\n\tmarkContentType(typeName, copy);\n\treturn copy;\n}\n"]}
1
+ {"version":3,"file":"mapNode.js","sourceRoot":"","sources":["../../src/simple-tree/mapNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIN,sBAAsB,EACtB,kBAAkB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAGN,mBAAmB,EACnB,0BAA0B,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACN,iBAAiB,EACjB,SAAS,GAIT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,QAAQ;AAIR,gDAAgD;AAChD,cAAc,EAEd,gBAAgB,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAkC,M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EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjD,CAAC;IACF,CAAC;;AAjEsB,sBAAI,GAAG,QAAQ,CAAC,GAAG,CAAC;AAqE5C;;;;;GAKG;AACH,4EAA4E;AAC5E,MAAM,UAAU,SAAS,CAKxB,UAAiB,EACjB,IAAO,EACP,uBAAgD,EAChD,eAAwB;IAExB,IAAI,UAA6B,CAAC;IAElC,MAAM,MAAO,SAAQ,iBAAoB;QACjC,MAAM,CAAU,eAAe,CAErC,QAA2B,EAC3B,QAAsB;YAEtB,IAAI,eAAe,EAAE,CAAC;gBACrB,OAAO,IAAI,KAAK,CAAS,QAAkB,EAAE,OAAO,CAAC,CAAC;YACvD,CAAC;YACD,OAAO,QAAQ,CAAC;QACjB,CAAC;QAEM,MAAM,CAAU,YAAY,CAElC,QAA2B,EAC3B,KAAS;YAET,OAAO,sBAAsB,CAC5B,UAAU,EACV,mBAAmB,CAAC,KAAuB,EAAE,IAAuC,CAAC,CACrF,CAAC;QACH,CAAC;QAIS,MAAM,CAAU,YAAY;YACrC,UAAU,GAAG,aAAa,CAAC,IAAiC,CAAsB,CAAC;QACpF,CAAC;QAOD,gDAAgD;QAChD,IAAW,CAAC,cAAc,CAAC;YAC1B,OAAO,UAAU,CAAC;QACnB,CAAC;QACD,IAAW,CAAC,gBAAgB,CAAC;YAC5B,OAAO,MAAM,CAAC,iBAAiB,EAAE,WAA6C,CAAC;QAChF,CAAC;;IAjByB,wBAAiB,GAAgC,SAAS,CAAC;IAM9D,iBAAU,GAAG,UAAU,CAAC;IACxB,WAAI,GAAG,IAAI,CAAC;IACZ,8BAAuB,GAC7C,uBAAuB,CAAC;IAU1B,MAAM,YAAY,GAOd,MAAM,CAAC;IACX,OAAO,YAAY,CAAC;AACrB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype FlexMapNodeSchema,\n\ttype FlexTreeNode,\n\ttype MapTreeNode,\n\tgetOrCreateMapTreeNode,\n\tgetSchemaAndPolicy,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype FactoryContent,\n\ttype InsertableContent,\n\tgetTreeNodeForField,\n\tprepareContentForHydration,\n} from \"./proxies.js\";\nimport { getOrCreateInnerNode } from \"./proxyBinding.js\";\nimport { getSimpleNodeSchema } from \"./core/index.js\";\nimport {\n\tcreateFieldSchema,\n\tFieldKind,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n} from \"./schemaTypes.js\";\nimport {\n\tNodeKind,\n\ttype TreeNodeSchemaClass,\n\ttype TreeNodeSchema,\n\ttype WithType,\n\t// eslint-disable-next-line import/no-deprecated\n\ttypeNameSymbol,\n\ttype TreeNode,\n\ttypeSchemaSymbol,\n} from \"./core/index.js\";\nimport { mapTreeFromNodeData } from \"./toMapTree.js\";\nimport { getFlexSchema } from \"./toFlexSchema.js\";\nimport { brand, count, type RestrictiveReadonlyRecord } from \"../util/index.js\";\nimport { TreeNodeValid, type MostDerivedData } from \"./treeNodeValid.js\";\n\n/**\n * A map of string keys to tree objects.\n *\n * @privateRemarks\n * Add support for `clear` once we have established merge semantics for it.\n *\n * @sealed @public\n */\nexport interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTypes>\n\textends ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\tTreeNode {\n\t/**\n\t * Adds or updates an entry in the map with a specified `key` and a `value`.\n\t *\n\t * @param key - The key of the element to add to the map.\n\t * @param value - The value of the element to add to the map.\n\t *\n\t * @remarks\n\t * Setting the value at a key to `undefined` is equivalent to calling {@link TreeMapNode.delete} with that key.\n\t */\n\tset(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T> | undefined): void;\n\n\t/**\n\t * Removes the specified element from this map by its `key`.\n\t *\n\t * @remarks\n\t * Note: unlike JavaScript's Map API, this method does not return a flag indicating whether or not the value was\n\t * deleted.\n\t *\n\t * @privateRemarks\n\t * Regarding the choice to not return a boolean: Since this data structure is distributed in nature, it isn't\n\t * possible to tell whether or not the item was deleted as a result of this method call. Returning a \"best guess\"\n\t * is more likely to create issues / promote bad usage patterns than offer useful information.\n\t *\n\t * @param key - The key of the element to remove from the map.\n\t */\n\tdelete(key: string): void;\n\n\t/**\n\t * Returns an iterable of keys in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the keys returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tkeys(): IterableIterator<string>;\n\n\t/**\n\t * Returns an iterable of values in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the values returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tvalues(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>>;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order of the entries returned.\n\t * If your usage scenario depends on consistent ordering, you will need to sort these yourself.\n\t */\n\tentries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]>;\n\n\t/**\n\t * Executes the provided function once per each key/value pair in this map.\n\t *\n\t * @remarks\n\t * Note: no guarantees are made regarding the order in which the function is called with respect to the map's entries.\n\t * If your usage scenario depends on consistent ordering, you will need to account for this.\n\t */\n\tforEach(\n\t\tcallbackfn: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tkey: string,\n\t\t\tmap: ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>,\n\t\t) => void,\n\t\t// Typing inherited from `ReadonlyMap`.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tthisArg?: any,\n\t): void;\n}\n\nconst handler: ProxyHandler<TreeMapNode> = {\n\tgetPrototypeOf: () => {\n\t\treturn Map.prototype;\n\t},\n};\n\nabstract class CustomMapNodeBase<const T extends ImplicitAllowedTypes> extends TreeNodeValid<\n\tMapNodeInsertableData<T>\n> {\n\tpublic static readonly kind = NodeKind.Map;\n\n\tpublic [Symbol.iterator](): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> {\n\t\treturn this.entries();\n\t}\n\tpublic delete(key: string): void {\n\t\tconst field = getOrCreateInnerNode(this).getBoxed(key);\n\t\tfield.editor.set(undefined, field.length === 0);\n\t}\n\tpublic *entries(): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<T>]> {\n\t\tconst node = getOrCreateInnerNode(this);\n\t\tfor (const key of node.keys()) {\n\t\t\tyield [\n\t\t\t\tkey,\n\t\t\t\tgetTreeNodeForField(node.getBoxed(key)) as TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\t];\n\t\t}\n\t}\n\tpublic get(key: string): TreeNodeFromImplicitAllowedTypes<T> {\n\t\tconst node = getOrCreateInnerNode(this);\n\t\tconst field = node.getBoxed(key);\n\t\treturn getTreeNodeForField(field) as TreeNodeFromImplicitAllowedTypes<T>;\n\t}\n\tpublic has(key: string): boolean {\n\t\treturn getOrCreateInnerNode(this).tryGetField(brand(key)) !== undefined;\n\t}\n\tpublic keys(): IterableIterator<string> {\n\t\tconst node = getOrCreateInnerNode(this);\n\t\treturn node.keys();\n\t}\n\tpublic set(key: string, value: InsertableTreeNodeFromImplicitAllowedTypes<T>): TreeMapNode {\n\t\tconst node = getOrCreateInnerNode(this);\n\t\tconst classSchema = getSimpleNodeSchema(node.schema);\n\t\tconst mapTree = mapTreeFromNodeData(\n\t\t\tvalue as InsertableContent | undefined,\n\t\t\tcreateFieldSchema(FieldKind.Optional, classSchema.info as ImplicitAllowedTypes),\n\t\t\tnode.context?.nodeKeyManager,\n\t\t\tgetSchemaAndPolicy(node),\n\t\t);\n\n\t\tconst field = node.getBoxed(key);\n\t\tif (node.context !== undefined) {\n\t\t\tprepareContentForHydration(mapTree, node.context.checkout.forest);\n\t\t}\n\n\t\tfield.editor.set(mapTree, field.length === 0);\n\t\treturn this;\n\t}\n\tpublic get size(): number {\n\t\treturn count(getOrCreateInnerNode(this).keys());\n\t}\n\tpublic *values(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\tfor (const [, value] of this.entries()) {\n\t\t\tyield value;\n\t\t}\n\t}\n\tpublic forEach<TThis extends TreeMapNode<T>>(\n\t\tthis: TThis,\n\t\tcallbackFn: (value: TreeNodeFromImplicitAllowedTypes<T>, key: string, map: TThis) => void,\n\t\tthisArg?: unknown,\n\t): void {\n\t\tfor (const field of getOrCreateInnerNode(this).boxedIterator()) {\n\t\t\tconst node = getTreeNodeForField(field) as TreeNodeFromImplicitAllowedTypes<T>;\n\t\t\tcallbackFn.call(thisArg, node, field.key, this);\n\t\t}\n\t}\n\t// TODO: add `clear` once we have established merge semantics for it.\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n *\n * @param base - base schema type to extend.\n * @param useMapPrototype - should this type emulate a ES6 Map object (by faking its prototype with a proxy).\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function mapSchema<\n\tTName extends string,\n\tconst T extends ImplicitAllowedTypes,\n\tconst ImplicitlyConstructable extends boolean,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n\tuseMapPrototype: boolean,\n) {\n\tlet flexSchema: FlexMapNodeSchema;\n\n\tclass schema extends CustomMapNodeBase<T> implements TreeMapNode<T> {\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\tif (useMapPrototype) {\n\t\t\t\treturn new Proxy<schema>(instance as schema, handler);\n\t\t\t}\n\t\t\treturn instance;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): MapTreeNode {\n\t\t\treturn getOrCreateMapTreeNode(\n\t\t\t\tflexSchema,\n\t\t\t\tmapTreeFromNodeData(input as FactoryContent, this as unknown as ImplicitAllowedTypes),\n\t\t\t);\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>): void {\n\t\t\tflexSchema = getFlexSchema(this as unknown as TreeNodeSchema) as FlexMapNodeSchema;\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): typeof schemaErased {\n\t\t\treturn schema.constructorCached?.constructor as unknown as typeof schemaErased;\n\t\t}\n\t}\n\tconst schemaErased: TreeNodeSchemaClass<\n\t\tTName,\n\t\tNodeKind.Map,\n\t\tTreeMapNode<T> & WithType<TName, NodeKind.Map>,\n\t\tMapNodeInsertableData<T>,\n\t\tImplicitlyConstructable,\n\t\tT\n\t> = schema;\n\treturn schemaErased;\n}\n\n/**\n * Content which can be used to construct a Map node, explicitly or implicitly.\n * @system @public\n */\nexport type MapNodeInsertableData<T extends ImplicitAllowedTypes> =\n\t| Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]>\n\t| RestrictiveReadonlyRecord<string, InsertableTreeNodeFromImplicitAllowedTypes<T>>;\n"]}
@@ -2,11 +2,13 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import type { FieldKey } from "../core/index.js";
5
6
  import { type FlexTreeField } from "../feature-libraries/index.js";
6
7
  import { type InsertableContent } from "./proxies.js";
7
- import { NodeKind, type ImplicitFieldSchema, type TreeNodeSchemaClass, type WithType, type TreeNodeSchema, type TreeFieldFromImplicitField, type InsertableTreeFieldFromImplicitField, type FieldSchema, FieldKind } from "./schemaTypes.js";
8
- import { type TreeNode } from "./types.js";
8
+ import { type ImplicitFieldSchema, type TreeFieldFromImplicitField, type InsertableTreeFieldFromImplicitField, type FieldSchema, FieldKind } from "./schemaTypes.js";
9
+ import { NodeKind, type WithType, type TreeNode } from "./core/index.js";
9
10
  import { type RestrictiveReadonlyRecord, type FlattenKeys } from "../util/index.js";
11
+ import type { ObjectNodeSchema, ObjectNodeSchemaInternalData } from "./objectNodeTypes.js";
10
12
  /**
11
13
  * Helper used to produce types for object nodes.
12
14
  * @public
@@ -25,7 +27,7 @@ export type ObjectFromSchemaRecord<T extends RestrictiveReadonlyRecord<string, I
25
27
  * This allows a majority of general purpose JavaScript object processing operations (like `for...in`, `Reflect.ownKeys()` and `Object.entries()`) to enumerate all the children.
26
28
  * @public
27
29
  */
28
- export type TreeObjectNode<T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName>;
30
+ export type TreeObjectNode<T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object>;
29
31
  /**
30
32
  * Type utility for determining whether or not an implicit field schema has a default value.
31
33
  *
@@ -54,6 +56,18 @@ export type InsertableObjectFromSchemaRecord<T extends RestrictiveReadonlyRecord
54
56
  } & {
55
57
  readonly [Property in keyof T as FieldHasDefault<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitField<T[Property]>;
56
58
  }>;
59
+ /**
60
+ * Maps from simple field keys ("view" keys) to information about the field.
61
+ *
62
+ * @remarks
63
+ * A missing entry for a given view key indicates that no such field exists.
64
+ * Keys with symbols are currently never used, but allowed to make lookups on non-field things
65
+ * (returning undefined) easier.
66
+ */
67
+ export type SimpleKeyMap = ReadonlyMap<string | symbol, {
68
+ storedKey: FieldKey;
69
+ schema: FieldSchema;
70
+ }>;
57
71
  export declare function setField(field: FlexTreeField, simpleFieldSchema: FieldSchema, value: InsertableContent | undefined): void;
58
72
  /**
59
73
  * Define a {@link TreeNodeSchema} for a {@link TreeObjectNode}.
@@ -61,17 +75,5 @@ export declare function setField(field: FlexTreeField, simpleFieldSchema: FieldS
61
75
  * @param name - Unique identifier for this schema within this factory's scope.
62
76
  * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.
63
77
  */
64
- export declare function objectSchema<TName extends string, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>, const ImplicitlyConstructable extends boolean>(identifier: TName, info: T, implicitlyConstructable: ImplicitlyConstructable): ObjectNodeSchema<TName, T, ImplicitlyConstructable>;
65
- /**
66
- * A schema for {@link TreeObjectNode}s.
67
- * @privateRemarks
68
- * This is a candidate for being promoted to the public package API.
69
- */
70
- export interface ObjectNodeSchema<TName extends string = string, T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema> = RestrictiveReadonlyRecord<string, ImplicitFieldSchema>, ImplicitlyConstructable extends boolean = boolean> extends TreeNodeSchemaClass<TName, NodeKind.Object, TreeObjectNode<T, TName>, object & InsertableObjectFromSchemaRecord<T>, ImplicitlyConstructable, T> {
71
- readonly fields: ReadonlyMap<string, FieldSchema>;
72
- }
73
- export declare const ObjectNodeSchema: {
74
- readonly [Symbol.hasInstance]: (value: TreeNodeSchema) => value is ObjectNodeSchema<string, RestrictiveReadonlyRecord<string, ImplicitFieldSchema>, boolean>;
75
- };
76
- export declare function isObjectNodeSchema(schema: TreeNodeSchema): schema is ObjectNodeSchema;
78
+ export declare function objectSchema<TName extends string, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>, const ImplicitlyConstructable extends boolean>(identifier: TName, info: T, implicitlyConstructable: ImplicitlyConstructable): ObjectNodeSchema<TName, T, ImplicitlyConstructable> & ObjectNodeSchemaInternalData;
77
79
  //# sour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AK,EACjB,IAAI,EAAE,CAAC,EACP,uBAAuB,EAAE,uBAAuB,GAC9C,gBAAgB,CAAC,KAAK,EAAE,CAAC,EAAE,uBAAuB,CAAC,GAAG,4BAA4B,CAwHpF"}
@@ -2,15 +2,19 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { assert } from "@fluidframework/core-utils/internal";
5
6
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
6
- import { cursorForMapTreeNode, FieldKinds, getOrCreateMapTreeNode, getSchemaAndPolicy, isMapTreeNode, } from "../feature-libraries/index.js";
7
- import { getProxyForField, markContentType, prepareContentForHydration, } from "./proxies.js";
8
- import { getFlexNode } from "./proxyBinding.js";
9
- import { NodeKind, getStoredKey, getExplicitStoredKey, normalizeFieldSchema, typeNameSymbol, FieldKind, } from "./schemaTypes.js";
7
+ import { FieldKinds, getOrCreateMapTreeNode, getSchemaAndPolicy, isMapTreeNode, } from "../feature-libraries/index.js";
8
+ import { getTreeNodeForField, prepareContentForHydration, } from "./proxies.js";
9
+ import { getOrCreateInnerNode } from "./proxyBinding.js";
10
+ import { getStoredKey, getExplicitStoredKey, normalizeFieldSchema, FieldKind, } from "./schemaTypes.js";
11
+ import { NodeKind,
12
+ // eslint-disable-next-line import/no-deprecated
13
+ typeNameSymbol, typeSchemaSymbol, } from "./core/index.js";
10
14
  import { mapTreeFromNodeData } from "./toMapTree.js";
11
- import { TreeNodeValid, } from "./types.js";
12
15
  import { fail } from "../util/index.js";
13
16
  import { getFlexSchema } from "./toFlexSchema.js";
17
+ import { TreeNodeValid } from "./treeNodeValid.js";
14
18
  /**
15
19
  * Caches the mappings from view keys to stored keys for the provided object field schemas in {@link simpleKeyToFlexKeyCache}.
16
20
  */
@@ -42,10 +46,10 @@ function createProxyHandler(flexKeyMap, allowAdditionalProperties) {
42
46
  get(target, viewKey, proxy) {
43
47
  const fieldInfo = flexKeyMap.get(viewKey);
44
48
  if (fieldInfo !== undefined) {
45
- const flexNode = getFlexNode(proxy);
49
+ const flexNode = getOrCreateInnerNode(proxy);
46
50
  const field = flexNode.tryGetField(fieldInfo.storedKey);
47
51
  if (field !== undefined) {
48
- return getProxyForField(field);
52
+ return getTreeNodeForField(field);
49
53
  }
50
54
  // Check if the user is trying to read an identifier field of an unhydrated node, but the identifier is not present.
51
55
  // This means the identifier is an "auto-generated identifier", because otherwise it would have been supplied by the user at construction time and would have been successfully read just above.
@@ -64,11 +68,7 @@ function createProxyHandler(flexKeyMap, allowAdditionalProperties) {
64
68
  // Pass the proxy as the receiver here, so that setters on the prototype receive `proxy` as `this`.
65
69
  return allowAdditionalProperties ? Reflect.set(target, viewKey, value, proxy) : false;
66
70
  }
67
- const flexNode = getFlexNode(proxy);
68
- if (isMapTreeNode(flexNode)) {
69
- throw new UsageError(`An object cannot be mutated before being inserted into the tree`);
70
- }
71
- setField(flexNode.getBoxed(fieldInfo.storedKey), fieldInfo.schema, value);
71
+ setField(getOrCreateInnerNode(proxy).getBoxed(fieldInfo.storedKey), fieldInfo.schema, value);
72
72
  return true;
73
73
  },
74
74
  deleteProperty(target, viewKey) {
@@ -96,9 +96,9 @@ function createProxyHandler(flexKeyMap, allowAdditionalProperties) {
96
96
  // If a refactoring is done to associated flex tree data with the target not the proxy, this extra map could be removed,
97
97
  // and the design would be more compatible with proxyless nodes.
98
98
  const proxy = targetToProxy.get(target) ?? fail("missing proxy");
99
- const field = getFlexNode(proxy).tryGetField(fieldInfo.storedKey);
99
+ const field = getOrCreateInnerNode(proxy).tryGetField(fieldInfo.storedKey);
100
100
  const p = {
101
- value: field === undefined ? undefined : getProxyForField(field),
101
+ value: field === undefined ? undefined : getTreeNodeForField(field),
102
102
  writable: true,
103
103
  // Report empty fields as own properties so they shadow inherited properties (even when empty) to match TypeScript typing.
104
104
  // Make empty fields not enumerable so they get skipped when iterating over an object to better align with
@@ -112,13 +112,20 @@ function createProxyHandler(flexKeyMap, allowAdditionalProperties) {
112
112
  return handler;
113
113
  }
114
114
  export function setField(field, simpleFieldSchema, value) {
115
+ const mapTree = mapTreeFromNodeData(value, simpleFieldSchema, field.context?.nodeKeyManager, getSchemaAndPolicy(field));
116
+ if (field.context !== undefined) {
117
+ prepareContentForHydration(mapTree, field.context.checkout.forest);
118
+ }
115
119
  switch (field.schema.kind) {
116
- case FieldKinds.required:
120
+ case FieldKinds.required: {
121
+ assert(mapTree !== undefined, 0xa04 /* Cannot set a required field to undefined */);
122
+ const typedField = field;
123
+ typedField.editor.set(mapTree);
124
+ break;
125
+ }
117
126
  case FieldKinds.optional: {
118
127
  const typedField = field;
119
- const mapTree = mapTreeFromNodeData(value, simpleFieldSchema.allowedTypes, field.context.nodeKeyManager, getSchemaAndPolicy(field));
120
- prepareContentForHydration(mapTree, field.context.checkout.forest);
121
- typedField.content = mapTree !== undefined ? cursorForMapTreeNode(mapTree) : undefined;
128
+ typedField.editor.set(mapTree, typedField.length === 0);
122
129
  break;
123
130
  }
124
131
  default:
@@ -169,7 +176,7 @@ export function objectSchema(identifier, info, implicitlyConstructable) {
169
176
  return proxy;
170
177
  }
171
178
  static buildRawNode(instance, input) {
172
- return getOrCreateMapTreeNode(flexSchema, mapTreeFromNodeData(copyContent(flexSchema.name, input), this));
179
+ return getOrCreateMapTreeNode(flexSchema, mapTreeFromNodeData(input, this));
173
180
  }
174
181
  static oneTimeSetup() {
175
182
  // One time initialization that required knowing the most derived type (from this.constructor) and thus has to be lazy.
@@ -198,11 +205,20 @@ export function objectSchema(identifier, info, implicitlyConstructable) {
198
205
  }
199
206
  }
200
207
  }
208
+ // eslint-disable-next-line import/no-deprecated
201
209
  get [typeNameSymbol]() {
202
210
  return identifier;
203
211
  }
212
+ get [typeSchemaSymbol]() {
213
+ return CustomObjectNode.constructorCached?.constructor;
214
+ }
204
215
  }
205
- CustomObjectNode.fields = new Map([...flexKeyMap].map(([key, value]) => [key, value.schema]));
216
+ CustomObjectNode.fields = new Map(Array.from(flexKeyMap, ([key, value]) => [key, value.schema]));
217
+ CustomObjectNode.flexKeyMap = flexKeyMap;
218
+ CustomObjectNode.storedKeyToPropertyKey = new Map(Array.from(flexKeyMap, ([key, value]) => [
219
+ value.storedKey,
220
+ key,
221
+ ]));
206
222
  CustomObjectNode.constructorCached = undefined;
207
223
  CustomObjectNode.identifier = identifier;
208
224
  CustomObjectNode.info = info;
@@ -239,18 +255,4 @@ function assertUniqueKeys(schemaName, fields) {
239
255
  derivedStoredKeys.add(storedKey);
240
256
  }
241
257
  }
242
- function copyContent(typeName, content) {
243
- const copy = { ...content };
244
- markContentType(typeName, copy);
245
- return copy;
246
- }
247
- export const ObjectNodeSchema = {
248
- // instanceof-based narrowing support for Javascript and TypeScript 5.3 or newer.
249
- [Symbol.hasInstance](value) {
250
- return isObjectNodeSchema(value);
251
- },
252
- };
253
- export function isObjectNodeSchema(schema) {
254
- return schema.kind === NodeKind.Object;
255
- }
256
258
  //# sourceMappingURL=objectNode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"objectNode.js","sourceRoot":"","sources":["../../src/simple-tree/objectNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAGtE,OAAO,EACN,oBAAoB,EACpB,UAAU,EAOV,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,GAEb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEN,gBAAgB,EAChB,eAAe,EACf,0BAA0B,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACN,QAAQ,EAKR,YAAY,EACZ,oBAAoB,EAIpB,oBAAoB,EACpB,cAAc,EAEd,SAAS,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAIN,aAAa,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAkC,IAAI,EAAoB,MAAM,kB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nE,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC5C,KAAK,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACxD,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAChD,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,UAAU,CACnB,eAAe,SAAS,gBAAgB,UAAU,6JAA6J,CAC/M,CAAC;QACH,CAAC;QACD,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;AACF,CAAC;AAED,SAAS,WAAW,CAAmB,QAAkC,EAAE,OAAU;IACpF,MAAM,IAAI,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;IAC5B,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAChC,OAAO,IAAI,CAAC;AACb,CAAC;AAyBD,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,iFAAiF;IACjF,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAqB;QACzC,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACQ,CAAC;AAEX,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACxD,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,CAAC;AACxC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { FieldKey, TreeNodeSchemaIdentifier } from \"../core/index.js\";\nimport {\n\tcursorForMapTreeNode,\n\tFieldKinds,\n\ttype FlexAllowedTypes,\n\ttype FlexObjectNodeSchema,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\tgetOrCreateMapTreeNode,\n\tgetSchemaAndPolicy,\n\tisMapTreeNode,\n\ttype MapTreeNode,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype InsertableContent,\n\tgetProxyForField,\n\tmarkContentType,\n\tprepareContentForHydration,\n} from \"./proxies.js\";\nimport { getFlexNode } from \"./proxyBinding.js\";\nimport {\n\tNodeKind,\n\ttype ImplicitFieldSchema,\n\ttype TreeNodeSchemaClass,\n\ttype WithType,\n\ttype TreeNodeSchema,\n\tgetStoredKey,\n\tgetExplicitStoredKey,\n\ttype TreeFieldFromImplicitField,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype FieldSchema,\n\tnormalizeFieldSchema,\n\ttypeNameSymbol,\n\ttype ImplicitAllowedTypes,\n\tFieldKind,\n} from \"./schemaTypes.js\";\nimport { mapTreeFromNodeData } from \"./toMapTree.js\";\nimport {\n\ttype InternalTreeNode,\n\ttype MostDerivedData,\n\ttype TreeNode,\n\tTreeNodeValid,\n} from \"./types.js\";\nimport { type RestrictiveReadonlyRecord, fail, type FlattenKeys } from \"../util/index.js\";\nimport { getFlexSchema } from \"./toFlexSchema.js\";\n\n/**\n * Helper used to produce types for object nodes.\n * @public\n */\nexport type ObjectFromSchemaRecord<\n\tT extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>,\n> = {\n\t-readonly [Property in keyof T]: TreeFieldFromImplicitField<T[Property]>;\n};\n\n/**\n * A {@link TreeNode} which modules a JavaScript object.\n * @remarks\n * Object nodes consist of a type which specifies which {@link TreeNodeSchema} they use (see {@link TreeNodeApi.schema}), and a collections of fields, each with a distinct `key` and its own {@link FieldSchema} defining what can be placed under that key.\n *\n * All fields on an object node are exposed as own properties with string keys.\n * Non-empty fields are enumerable and empty optional fields are non-enumerable own properties with the value `undefined`.\n * No other own `own` or `enumerable` properties are included on object nodes unless the user of the node manually adds custom session only state.\n * This allows a majority of general purpose JavaScript object processing operations (like `for...in`, `Reflect.ownKeys()` and `Object.entries()`) to enumerate all the children.\n * @public\n */\nexport type TreeObjectNode<\n\tT extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>,\n\tTypeName extends string = string,\n> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName>;\n\n/**\n * Type utility for determining whether or not an implicit field schema has a default value.\n *\n * @privateRemarks\n * TODO: Account for field schemas with default value providers.\n * For now, this only captures field kinds that we know always have defaults - optional fields and identifier fields.\n *\n * @public\n */\nexport type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<\n\tFieldKind.Optional | FieldKind.Identifier\n>\n\t? true\n\t: false;\n\n/**\n * Helper used to produce types for:\n *\n * 1. Insertable content which can be used to construct an object node.\n *\n * 2. Insertable content which is an unhydrated object node.\n *\n * 3. Union of 1 and 2.\n *\n * @privateRemarks TODO: consider separating these cases into different types.\n *\n * @public\n */\nexport type InsertableObjectFromSchemaRecord<\n\tT extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>,\n> = FlattenKeys<\n\t{\n\t\treadonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property]>;\n\t} & {\n\t\t// Field does not have a known default, make it required:\n\t\treadonly [Property in keyof T as FieldHasDefault<T[Property]> extends false\n\t\t\t? Property\n\t\t\t: never]: InsertableTreeFieldFromImplicitField<T[Property]>;\n\t}\n>;\n\n/**\n * Maps from simple field keys (\"view\" keys) to information about the field.\n *\n * @remarks\n * A missing entry for a given view key indicates that no such field exists.\n * Keys with symbols are currently never used, but allowed to make lookups on non-field things\n * (returning undefined) easier.\n */\ntype SimpleKeyMap = ReadonlyMap<string | symbol, { storedKey: FieldKey; schema: FieldSchema }>;\n\n/**\n * Caches the mappings from view keys to stored keys for the provided object field schemas in {@link simpleKeyToFlexKeyCache}.\n */\nfunction createFlexKeyMapping(fields: Record<string, ImplicitFieldSchema>): SimpleKeyMap {\n\tconst keyMap: Map<string | symbol, { storedKey: FieldKey; schema: FieldSchema }> = new Map();\n\tfor (const [viewKey, fieldSchema] of Object.entries(fields)) {\n\t\tconst storedKey = getStoredKey(viewKey, fieldSchema);\n\t\tkeyMap.set(viewKey, { storedKey, schema: normalizeFieldSchema(fieldSchema) });\n\t}\n\n\treturn keyMap;\n}\n\n/**\n * @param allowAdditionalProperties - If true, setting of unexpected properties will be forwarded to the target object.\n * Otherwise setting of unexpected properties will error.\n * TODO: consider implementing this using `Object.preventExtension` instead.\n * @param customTargetObject - Target object of the proxy.\n * If not provided `{}` is used for the target.\n */\nfunction createProxyHandler(\n\tflexKeyMap: SimpleKeyMap,\n\tallowAdditionalProperties: boolean,\n): ProxyHandler<TreeNode> {\n\t// To satisfy 'deepEquals' level scrutiny, the target of the proxy must be an object with the same\n\t// prototype as an object literal '{}'. This is because 'deepEquals' uses 'Object.getPrototypeOf'\n\t// as a way to quickly reject objects with different prototype chains.\n\t//\n\t// (Note that the prototype of an object literal appears as '[Object: null prototype] {}', not because\n\t// the prototype is null, but because the prototype object itself has a null prototype.)\n\n\t// TODO: Although the target is an object literal, it's still worthwhile to try experimenting with\n\t// a dispatch object to see if it improves performance.\n\tconst handler: ProxyHandler<TreeNode> = {\n\t\tget(target, viewKey, proxy): unknown {\n\t\t\tconst fieldInfo = flexKeyMap.get(viewKey);\n\n\t\t\tif (fieldInfo !== undefined) {\n\t\t\t\tconst flexNode = getFlexNode(proxy);\n\t\t\t\tconst field = flexNode.tryGetField(fieldInfo.storedKey);\n\t\t\t\tif (field !== undefined) {\n\t\t\t\t\treturn getProxyForField(field);\n\t\t\t\t}\n\n\t\t\t\t// Check if the user is trying to read an identifier field of an unhydrated node, but the identifier is not present.\n\t\t\t\t// This means the identifier is an \"auto-generated identifier\", because otherwise it would have been supplied by the user at construction time and would have been successfully read just above.\n\t\t\t\t// In this case, it is categorically impossible to provide an identifier (auto-generated identifiers can't be created until hydration/insertion time), so we emit an error.\n\t\t\t\tif (fieldInfo.schema.kind === FieldKind.Identifier && isMapTreeNode(flexNode)) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"An automatically generated node identifier may not be queried until the node is inserted into the tree\",\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// Pass the proxy as the receiver here, so that any methods on the prototype receive `proxy` as `this`.\n\t\t\treturn Reflect.get(target, viewKey, proxy);\n\t\t},\n\t\tset(target, viewKey, value: InsertableContent | undefined, proxy) {\n\t\t\tconst fieldInfo = flexKeyMap.get(viewKey);\n\t\t\tif (fieldInfo === undefined) {\n\t\t\t\t// Pass the proxy as the receiver here, so that setters on the prototype receive `proxy` as `this`.\n\t\t\t\treturn allowAdditionalProperties ? Reflect.set(target, viewKey, value, proxy) : false;\n\t\t\t}\n\n\t\t\tconst flexNode = getFlexNode(proxy);\n\t\t\tif (isMapTreeNode(flexNode)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`An object cannot be mutated before being inserted into the tree`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tsetField(flexNode.getBoxed(fieldInfo.storedKey), fieldInfo.schema, value);\n\t\t\treturn true;\n\t\t},\n\t\tdeleteProperty(target, viewKey): boolean {\n\t\t\t// TODO: supporting delete when it makes sense (custom local fields, and optional field) could be added as a feature in the future.\n\t\t\tthrow new UsageError(\n\t\t\t\t`Object nodes do not support the delete operator. Optional fields can be assigned to undefined instead.`,\n\t\t\t);\n\t\t},\n\t\thas: (target, viewKey) => {\n\t\t\treturn (\n\t\t\t\tflexKeyMap.has(viewKey) ||\n\t\t\t\t(allowAdditionalProperties ? Reflect.has(target, viewKey) : false)\n\t\t\t);\n\t\t},\n\t\townKeys: (target) => {\n\t\t\treturn [\n\t\t\t\t...flexKeyMap.keys(),\n\t\t\t\t...(allowAdditionalProperties ? Reflect.ownKeys(target) : []),\n\t\t\t];\n\t\t},\n\t\tgetOwnPropertyDescriptor: (target, viewKey) => {\n\t\t\tconst fieldInfo = flexKeyMap.get(viewKey);\n\n\t\t\tif (fieldInfo === undefined) {\n\t\t\t\treturn allowAdditionalProperties\n\t\t\t\t\t? Reflect.getOwnPropertyDescriptor(target, viewKey)\n\t\t\t\t\t: undefined;\n\t\t\t}\n\n\t\t\t// For some reason, the getOwnPropertyDescriptor is not passed in the receiver, so use a weak map.\n\t\t\t// If a refactoring is done to associated flex tree data with the target not the proxy, this extra map could be removed,\n\t\t\t// and the design would be more compatible with proxyless nodes.\n\t\t\tconst proxy = targetToProxy.get(target) ?? fail(\"missing proxy\");\n\t\t\tconst field = getFlexNode(proxy).tryGetField(fieldInfo.storedKey);\n\n\t\t\tconst p: PropertyDescriptor = {\n\t\t\t\tvalue: field === undefined ? undefined : getProxyForField(field),\n\t\t\t\twritable: true,\n\t\t\t\t// Report empty fields as own properties so they shadow inherited properties (even when empty) to match TypeScript typing.\n\t\t\t\t// Make empty fields not enumerable so they get skipped when iterating over an object to better align with\n\t\t\t\t// JSON and deep equals with JSON compatible object (which can't have undefined fields).\n\t\t\t\tenumerable: field !== undefined,\n\t\t\t\tconfigurable: true, // Must be 'configurable' if property is absent from proxy target.\n\t\t\t};\n\n\t\t\treturn p;\n\t\t},\n\t};\n\treturn handler;\n}\n\nexport function setField(\n\tfield: FlexTreeField,\n\tsimpleFieldSchema: FieldSchema,\n\tvalue: InsertableContent | undefined,\n): void {\n\tswitch (field.schema.kind) {\n\t\tcase FieldKinds.required:\n\t\tcase FieldKinds.optional: {\n\t\t\tconst typedField = field as\n\t\t\t\t| FlexTreeRequiredField<FlexAllowedTypes>\n\t\t\t\t| FlexTreeOptionalField<FlexAllowedTypes>;\n\n\t\t\tconst mapTree = mapTreeFromNodeData(\n\t\t\t\tvalue,\n\t\t\t\tsimpleFieldSchema.allowedTypes,\n\t\t\t\tfield.context.nodeKeyManager,\n\t\t\t\tgetSchemaAndPolicy(field),\n\t\t\t);\n\n\t\t\tprepareContentForHydration(mapTree, field.context.checkout.forest);\n\t\t\ttypedField.content = mapTree !== undefined ? cursorForMapTreeNode(mapTree) : undefined;\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault:\n\t\t\tfail(\"invalid FieldKind\");\n\t}\n}\n\nabstract class CustomObjectNodeBase<\n\tconst T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>,\n> extends TreeNodeValid<InsertableObjectFromSchemaRecord<T>> {\n\tpublic static readonly kind = NodeKind.Object;\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link TreeObjectNode}.\n *\n * @param name - Unique identifier for this schema within this factory's scope.\n * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n */\nexport function objectSchema<\n\tTName extends string,\n\tconst T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>,\n\tconst ImplicitlyConstructable extends boolean,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n): ObjectNodeSchema<TName, T, ImplicitlyConstructable> {\n\t// Ensure no collisions between final set of view keys, and final set of stored keys (including those\n\t// implicitly derived from view keys)\n\tassertUniqueKeys(identifier, info);\n\n\t// Performance optimization: cache view key => stored key and schema.\n\tconst flexKeyMap: SimpleKeyMap = createFlexKeyMapping(info);\n\n\tlet handler: ProxyHandler<object>;\n\tlet customizable: boolean;\n\tlet flexSchema: FlexObjectNodeSchema;\n\n\tclass CustomObjectNode extends CustomObjectNodeBase<T> {\n\t\tpublic static readonly fields: ReadonlyMap<string, FieldSchema> = new Map(\n\t\t\t[...flexKeyMap].map(([key, value]) => [key as string, value.schema]),\n\t\t);\n\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\t// Differentiate between the following cases:\n\t\t\t//\n\t\t\t// Case 1: Direct construction (POJO emulation)\n\t\t\t//\n\t\t\t// const Foo = schemaFactory.object(\"Foo\", {bar: schemaFactory.number});\n\t\t\t//\n\t\t\t// assert.deepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t//\t\t \"Prototype chain equivalent to POJO.\");\n\t\t\t//\n\t\t\t// Case 2: Subclass construction (Customizable Object)\n\t\t\t//\n\t\t\t// \t class Foo extends schemaFactory.object(\"Foo\", {bar: schemaFactory.number}) {}\n\t\t\t//\n\t\t\t// \t assert.notDeepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t// \t \"Subclass prototype chain differs from POJO.\");\n\t\t\t//\n\t\t\t// In Case 1 (POJO emulation), the prototype chain match '{}' (proxyTarget = undefined)\n\t\t\t// In Case 2 (Customizable Object), the prototype chain include the user's subclass (proxyTarget = this)\n\n\t\t\tconst proxyTarget = customizable ? instance : {};\n\t\t\tconst proxy = new Proxy(proxyTarget, handler) as CustomObjectNode;\n\t\t\ttargetToProxy.set(proxyTarget, proxy);\n\t\t\treturn proxy;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): MapTreeNode {\n\t\t\treturn getOrCreateMapTreeNode(\n\t\t\t\tflexSchema,\n\t\t\t\tmapTreeFromNodeData(\n\t\t\t\t\tcopyContent(flexSchema.name, input as object),\n\t\t\t\t\tthis as unknown as ImplicitAllowedTypes,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>): void {\n\t\t\t// One time initialization that required knowing the most derived type (from this.constructor) and thus has to be lazy.\n\t\t\tcustomizable = (this as unknown) !== CustomObjectNode;\n\t\t\thandler = createProxyHandler(flexKeyMap, customizable);\n\t\t\tflexSchema = getFlexSchema(this as unknown as TreeNodeSchema) as FlexObjectNodeSchema;\n\n\t\t\t// First run, do extra validation.\n\t\t\t// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.\n\t\t\t// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).\n\t\t\t{\n\t\t\t\tlet prototype: object = this.prototype;\n\t\t\t\t// There isn't a clear cleaner way to author this loop.\n\t\t\t\twhile (prototype !== CustomObjectNode.prototype) {\n\t\t\t\t\tfor (const [key] of flexKeyMap) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t// constructor is a special case, since one is built in on the derived type, and shadowing it works fine since we only use it before fields are applied.\n\t\t\t\t\t\t\tkey !== \"constructor\" &&\n\t\t\t\t\t\t\tReflect.getOwnPropertyDescriptor(prototype, key) !== undefined\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Schema ${identifier} defines an inherited property \"${key.toString()}\" which shadows a field. Since fields are exposed as own properties, this shadowing will not work, and is an error.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Since this stops at CustomObjectNode, it should never see a null prototype, so this case is safe.\n\t\t\t\t\t// Additionally, if the prototype chain is ever messed up such that CustomObjectNode is not in it,\n\t\t\t\t\t// the null that would show up here does at least ensure this code throws instead of hanging.\n\t\t\t\t\tprototype = Reflect.getPrototypeOf(prototype) as object;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t}\n\n\treturn CustomObjectNode as typeof CustomObjectNode &\n\t\t(new (\n\t\t\tinput: InsertableObjectFromSchemaRecord<T> | InternalTreeNode,\n\t\t) => TreeObjectNode<T, TName>);\n}\n\nconst targetToProxy: WeakMap<object, TreeNode> = new WeakMap();\n\n/**\n * Ensures that the set of view keys in the schema is unique.\n * Also ensure that the final set of stored keys (including those implicitly derived from view keys) is unique.\n * @throws Throws a `UsageError` if either of the key uniqueness invariants is violated.\n */\nfunction assertUniqueKeys<\n\tconst Name extends number | string,\n\tconst Fields extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>,\n>(schemaName: Name, fields: Fields): void {\n\t// Verify that there are no duplicates among the explicitly specified stored keys.\n\tconst explicitStoredKeys = new Set<string>();\n\tfor (const schema of Object.values(fields)) {\n\t\tconst storedKey = getExplicitStoredKey(schema);\n\t\tif (storedKey === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (explicitStoredKeys.has(storedKey)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Duplicate stored key \"${storedKey}\" in schema \"${schemaName}\". Stored keys must be unique within an object schema.`,\n\t\t\t);\n\t\t}\n\t\texplicitStoredKeys.add(storedKey);\n\t}\n\n\t// Verify that there are no duplicates among the derived\n\t// (including those implicitly derived from view keys) stored keys.\n\tconst derivedStoredKeys = new Set<string>();\n\tfor (const [viewKey, schema] of Object.entries(fields)) {\n\t\tconst storedKey = getStoredKey(viewKey, schema);\n\t\tif (derivedStoredKeys.has(storedKey)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Stored key \"${storedKey}\" in schema \"${schemaName}\" conflicts with a property key of the same name, which is not overridden by a stored key. The final set of stored keys in an object schema must be unique.`,\n\t\t\t);\n\t\t}\n\t\tderivedStoredKeys.add(storedKey);\n\t}\n}\n\nfunction copyContent<T extends object>(typeName: TreeNodeSchemaIdentifier, content: T): T {\n\tconst copy = { ...content };\n\tmarkContentType(typeName, copy);\n\treturn copy;\n}\n\n/**\n * A schema for {@link TreeObjectNode}s.\n * @privateRemarks\n * This is a candidate for being promoted to the public package API.\n */\nexport interface ObjectNodeSchema<\n\tTName extends string = string,\n\tT extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema> = RestrictiveReadonlyRecord<\n\t\tstring,\n\t\tImplicitFieldSchema\n\t>,\n\tImplicitlyConstructable extends boolean = boolean,\n> extends TreeNodeSchemaClass<\n\t\tTName,\n\t\tNodeKind.Object,\n\t\tTreeObjectNode<T, TName>,\n\t\tobject & InsertableObjectFromSchemaRecord<T>,\n\t\tImplicitlyConstructable,\n\t\tT\n\t> {\n\treadonly fields: ReadonlyMap<string, FieldSchema>;\n}\n\nexport const ObjectNodeSchema = {\n\t// instanceof-based narrowing support for Javascript and TypeScript 5.3 or newer.\n\t[Symbol.hasInstance](value: TreeNodeSchema): value is ObjectNodeSchema {\n\t\treturn isObjectNodeSchema(value);\n\t},\n} as const;\n\nexport function isObjectNodeSchema(schema: TreeNodeSchema): schema is ObjectNodeSchema {\n\treturn schema.kind === NodeKind.Object;\n}\n"]}
1
+ {"version":3,"file":"objectNode.js","sourceRoot":"","sources":["../../src/simple-tree/objectNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAGtE,OAAO,EACN,UAAU,EAOV,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,GAEb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEN,mBAAmB,EACnB,0BAA0B,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAEN,YAAY,EACZ,oBAAoB,EAIpB,oBAAoB,EAEpB,SAAS,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEN,QAAQ;AAER,gDAAgD;AAChD,cAAc,EACd,gBAAgB,GAGhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAkC,IAAI,EAAoB,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAwB,MAAM,oBAAoB,CAAC;AAkFzE;;GAEG;AACH,SAAS,oBAAoB,CAAC,MAA2C;IACxE,MAAM,MAAM,GAAuE,IAAI,GAAG,EAAE,CAAC;IAC7F,KAAK,MA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AAC,EAAE,CAAC;YACvC,MAAM,IAAI,UAAU,CACnB,yBAAyB,SAAS,gBAAgB,UAAU,wDAAwD,CACpH,CAAC;QACH,CAAC;QACD,kBAAkB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAED,wDAAwD;IACxD,mEAAmE;IACnE,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC5C,KAAK,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACxD,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAChD,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,UAAU,CACnB,eAAe,SAAS,gBAAgB,UAAU,6JAA6J,CAC/M,CAAC;QACH,CAAC;QACD,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { FieldKey } from \"../core/index.js\";\nimport {\n\tFieldKinds,\n\ttype FlexAllowedTypes,\n\ttype FlexObjectNodeSchema,\n\ttype FlexTreeField,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n\ttype FlexTreeRequiredField,\n\tgetOrCreateMapTreeNode,\n\tgetSchemaAndPolicy,\n\tisMapTreeNode,\n\ttype MapTreeNode,\n} from \"../feature-libraries/index.js\";\nimport {\n\ttype InsertableContent,\n\tgetTreeNodeForField,\n\tprepareContentForHydration,\n} from \"./proxies.js\";\nimport { getOrCreateInnerNode } from \"./proxyBinding.js\";\nimport {\n\ttype ImplicitFieldSchema,\n\tgetStoredKey,\n\tgetExplicitStoredKey,\n\ttype TreeFieldFromImplicitField,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype FieldSchema,\n\tnormalizeFieldSchema,\n\ttype ImplicitAllowedTypes,\n\tFieldKind,\n} from \"./schemaTypes.js\";\nimport {\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype WithType,\n\t// eslint-disable-next-line import/no-deprecated\n\ttypeNameSymbol,\n\ttypeSchemaSymbol,\n\ttype InternalTreeNode,\n\ttype TreeNode,\n} from \"./core/index.js\";\nimport { mapTreeFromNodeData } from \"./toMapTree.js\";\nimport { type RestrictiveReadonlyRecord, fail, type FlattenKeys } from \"../util/index.js\";\nimport { getFlexSchema } from \"./toFlexSchema.js\";\nimport type { ObjectNodeSchema, ObjectNodeSchemaInternalData } from \"./objectNodeTypes.js\";\nimport { TreeNodeValid, type MostDerivedData } from \"./treeNodeValid.js\";\n\n/**\n * Helper used to produce types for object nodes.\n * @public\n */\nexport type ObjectFromSchemaRecord<\n\tT extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>,\n> = {\n\t-readonly [Property in keyof T]: TreeFieldFromImplicitField<T[Property]>;\n};\n\n/**\n * A {@link TreeNode} which modules a JavaScript object.\n * @remarks\n * Object nodes consist of a type which specifies which {@link TreeNodeSchema} they use (see {@link TreeNodeApi.schema}), and a collections of fields, each with a distinct `key` and its own {@link FieldSchema} defining what can be placed under that key.\n *\n * All fields on an object node are exposed as own properties with string keys.\n * Non-empty fields are enumerable and empty optional fields are non-enumerable own properties with the value `undefined`.\n * No other own `own` or `enumerable` properties are included on object nodes unless the user of the node manually adds custom session only state.\n * This allows a majority of general purpose JavaScript object processing operations (like `for...in`, `Reflect.ownKeys()` and `Object.entries()`) to enumerate all the children.\n * @public\n */\nexport type TreeObjectNode<\n\tT extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>,\n\tTypeName extends string = string,\n> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object>;\n\n/**\n * Type utility for determining whether or not an implicit field schema has a default value.\n *\n * @privateRemarks\n * TODO: Account for field schemas with default value providers.\n * For now, this only captures field kinds that we know always have defaults - optional fields and identifier fields.\n *\n * @public\n */\nexport type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<\n\tFieldKind.Optional | FieldKind.Identifier\n>\n\t? true\n\t: false;\n\n/**\n * Helper used to produce types for:\n *\n * 1. Insertable content which can be used to construct an object node.\n *\n * 2. Insertable content which is an unhydrated object node.\n *\n * 3. Union of 1 and 2.\n *\n * @privateRemarks TODO: consider separating these cases into different types.\n *\n * @public\n */\nexport type InsertableObjectFromSchemaRecord<\n\tT extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>,\n> = FlattenKeys<\n\t{\n\t\treadonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property]>;\n\t} & {\n\t\t// Field does not have a known default, make it required:\n\t\treadonly [Property in keyof T as FieldHasDefault<T[Property]> extends false\n\t\t\t? Property\n\t\t\t: never]: InsertableTreeFieldFromImplicitField<T[Property]>;\n\t}\n>;\n\n/**\n * Maps from simple field keys (\"view\" keys) to information about the field.\n *\n * @remarks\n * A missing entry for a given view key indicates that no such field exists.\n * Keys with symbols are currently never used, but allowed to make lookups on non-field things\n * (returning undefined) easier.\n */\nexport type SimpleKeyMap = ReadonlyMap<\n\tstring | symbol,\n\t{ storedKey: FieldKey; schema: FieldSchema }\n>;\n\n/**\n * Caches the mappings from view keys to stored keys for the provided object field schemas in {@link simpleKeyToFlexKeyCache}.\n */\nfunction createFlexKeyMapping(fields: Record<string, ImplicitFieldSchema>): SimpleKeyMap {\n\tconst keyMap: Map<string | symbol, { storedKey: FieldKey; schema: FieldSchema }> = new Map();\n\tfor (const [viewKey, fieldSchema] of Object.entries(fields)) {\n\t\tconst storedKey = getStoredKey(viewKey, fieldSchema);\n\t\tkeyMap.set(viewKey, { storedKey, schema: normalizeFieldSchema(fieldSchema) });\n\t}\n\n\treturn keyMap;\n}\n\n/**\n * @param allowAdditionalProperties - If true, setting of unexpected properties will be forwarded to the target object.\n * Otherwise setting of unexpected properties will error.\n * TODO: consider implementing this using `Object.preventExtension` instead.\n * @param customTargetObject - Target object of the proxy.\n * If not provided `{}` is used for the target.\n */\nfunction createProxyHandler(\n\tflexKeyMap: SimpleKeyMap,\n\tallowAdditionalProperties: boolean,\n): ProxyHandler<TreeNode> {\n\t// To satisfy 'deepEquals' level scrutiny, the target of the proxy must be an object with the same\n\t// prototype as an object literal '{}'. This is because 'deepEquals' uses 'Object.getPrototypeOf'\n\t// as a way to quickly reject objects with different prototype chains.\n\t//\n\t// (Note that the prototype of an object literal appears as '[Object: null prototype] {}', not because\n\t// the prototype is null, but because the prototype object itself has a null prototype.)\n\n\t// TODO: Although the target is an object literal, it's still worthwhile to try experimenting with\n\t// a dispatch object to see if it improves performance.\n\tconst handler: ProxyHandler<TreeNode> = {\n\t\tget(target, viewKey, proxy): unknown {\n\t\t\tconst fieldInfo = flexKeyMap.get(viewKey);\n\n\t\t\tif (fieldInfo !== undefined) {\n\t\t\t\tconst flexNode = getOrCreateInnerNode(proxy);\n\t\t\t\tconst field = flexNode.tryGetField(fieldInfo.storedKey);\n\t\t\t\tif (field !== undefined) {\n\t\t\t\t\treturn getTreeNodeForField(field);\n\t\t\t\t}\n\n\t\t\t\t// Check if the user is trying to read an identifier field of an unhydrated node, but the identifier is not present.\n\t\t\t\t// This means the identifier is an \"auto-generated identifier\", because otherwise it would have been supplied by the user at construction time and would have been successfully read just above.\n\t\t\t\t// In this case, it is categorically impossible to provide an identifier (auto-generated identifiers can't be created until hydration/insertion time), so we emit an error.\n\t\t\t\tif (fieldInfo.schema.kind === FieldKind.Identifier && isMapTreeNode(flexNode)) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"An automatically generated node identifier may not be queried until the node is inserted into the tree\",\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// Pass the proxy as the receiver here, so that any methods on the prototype receive `proxy` as `this`.\n\t\t\treturn Reflect.get(target, viewKey, proxy);\n\t\t},\n\t\tset(target, viewKey, value: InsertableContent | undefined, proxy) {\n\t\t\tconst fieldInfo = flexKeyMap.get(viewKey);\n\t\t\tif (fieldInfo === undefined) {\n\t\t\t\t// Pass the proxy as the receiver here, so that setters on the prototype receive `proxy` as `this`.\n\t\t\t\treturn allowAdditionalProperties ? Reflect.set(target, viewKey, value, proxy) : false;\n\t\t\t}\n\n\t\t\tsetField(\n\t\t\t\tgetOrCreateInnerNode(proxy).getBoxed(fieldInfo.storedKey),\n\t\t\t\tfieldInfo.schema,\n\t\t\t\tvalue,\n\t\t\t);\n\t\t\treturn true;\n\t\t},\n\t\tdeleteProperty(target, viewKey): boolean {\n\t\t\t// TODO: supporting delete when it makes sense (custom local fields, and optional field) could be added as a feature in the future.\n\t\t\tthrow new UsageError(\n\t\t\t\t`Object nodes do not support the delete operator. Optional fields can be assigned to undefined instead.`,\n\t\t\t);\n\t\t},\n\t\thas: (target, viewKey) => {\n\t\t\treturn (\n\t\t\t\tflexKeyMap.has(viewKey) ||\n\t\t\t\t(allowAdditionalProperties ? Reflect.has(target, viewKey) : false)\n\t\t\t);\n\t\t},\n\t\townKeys: (target) => {\n\t\t\treturn [\n\t\t\t\t...flexKeyMap.keys(),\n\t\t\t\t...(allowAdditionalProperties ? Reflect.ownKeys(target) : []),\n\t\t\t];\n\t\t},\n\t\tgetOwnPropertyDescriptor: (target, viewKey) => {\n\t\t\tconst fieldInfo = flexKeyMap.get(viewKey);\n\n\t\t\tif (fieldInfo === undefined) {\n\t\t\t\treturn allowAdditionalProperties\n\t\t\t\t\t? Reflect.getOwnPropertyDescriptor(target, viewKey)\n\t\t\t\t\t: undefined;\n\t\t\t}\n\n\t\t\t// For some reason, the getOwnPropertyDescriptor is not passed in the receiver, so use a weak map.\n\t\t\t// If a refactoring is done to associated flex tree data with the target not the proxy, this extra map could be removed,\n\t\t\t// and the design would be more compatible with proxyless nodes.\n\t\t\tconst proxy = targetToProxy.get(target) ?? fail(\"missing proxy\");\n\t\t\tconst field = getOrCreateInnerNode(proxy).tryGetField(fieldInfo.storedKey);\n\n\t\t\tconst p: PropertyDescriptor = {\n\t\t\t\tvalue: field === undefined ? undefined : getTreeNodeForField(field),\n\t\t\t\twritable: true,\n\t\t\t\t// Report empty fields as own properties so they shadow inherited properties (even when empty) to match TypeScript typing.\n\t\t\t\t// Make empty fields not enumerable so they get skipped when iterating over an object to better align with\n\t\t\t\t// JSON and deep equals with JSON compatible object (which can't have undefined fields).\n\t\t\t\tenumerable: field !== undefined,\n\t\t\t\tconfigurable: true, // Must be 'configurable' if property is absent from proxy target.\n\t\t\t};\n\n\t\t\treturn p;\n\t\t},\n\t};\n\treturn handler;\n}\n\nexport function setField(\n\tfield: FlexTreeField,\n\tsimpleFieldSchema: FieldSchema,\n\tvalue: InsertableContent | undefined,\n): void {\n\tconst mapTree = mapTreeFromNodeData(\n\t\tvalue,\n\t\tsimpleFieldSchema,\n\t\tfield.context?.nodeKeyManager,\n\t\tgetSchemaAndPolicy(field),\n\t);\n\n\tif (field.context !== undefined) {\n\t\tprepareContentForHydration(mapTree, field.context.checkout.forest);\n\t}\n\n\tswitch (field.schema.kind) {\n\t\tcase FieldKinds.required: {\n\t\t\tassert(mapTree !== undefined, 0xa04 /* Cannot set a required field to undefined */);\n\t\t\tconst typedField = field as FlexTreeRequiredField<FlexAllowedTypes>;\n\t\t\ttypedField.editor.set(mapTree);\n\t\t\tbreak;\n\t\t}\n\t\tcase FieldKinds.optional: {\n\t\t\tconst typedField = field as FlexTreeOptionalField<FlexAllowedTypes>;\n\t\t\ttypedField.editor.set(mapTree, typedField.length === 0);\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault:\n\t\t\tfail(\"invalid FieldKind\");\n\t}\n}\n\nabstract class CustomObjectNodeBase<\n\tconst T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>,\n> extends TreeNodeValid<InsertableObjectFromSchemaRecord<T>> {\n\tpublic static readonly kind = NodeKind.Object;\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link TreeObjectNode}.\n *\n * @param name - Unique identifier for this schema within this factory's scope.\n * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n */\nexport function objectSchema<\n\tTName extends string,\n\tconst T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>,\n\tconst ImplicitlyConstructable extends boolean,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n): ObjectNodeSchema<TName, T, ImplicitlyConstructable> & ObjectNodeSchemaInternalData {\n\t// Ensure no collisions between final set of view keys, and final set of stored keys (including those\n\t// implicitly derived from view keys)\n\tassertUniqueKeys(identifier, info);\n\n\t// Performance optimization: cache view key => stored key and schema.\n\tconst flexKeyMap: SimpleKeyMap = createFlexKeyMapping(info);\n\n\tlet handler: ProxyHandler<object>;\n\tlet customizable: boolean;\n\tlet flexSchema: FlexObjectNodeSchema;\n\n\tclass CustomObjectNode extends CustomObjectNodeBase<T> {\n\t\tpublic static readonly fields: ReadonlyMap<string, FieldSchema> = new Map(\n\t\t\tArray.from(flexKeyMap, ([key, value]) => [key as string, value.schema]),\n\t\t);\n\t\tpublic static readonly flexKeyMap: SimpleKeyMap = flexKeyMap;\n\t\tpublic static readonly storedKeyToPropertyKey: ReadonlyMap<FieldKey, string> = new Map<\n\t\t\tFieldKey,\n\t\t\tstring\n\t\t>(\n\t\t\tArray.from(flexKeyMap, ([key, value]): [FieldKey, string] => [\n\t\t\t\tvalue.storedKey,\n\t\t\t\tkey as string,\n\t\t\t]),\n\t\t);\n\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\t// Differentiate between the following cases:\n\t\t\t//\n\t\t\t// Case 1: Direct construction (POJO emulation)\n\t\t\t//\n\t\t\t// const Foo = schemaFactory.object(\"Foo\", {bar: schemaFactory.number});\n\t\t\t//\n\t\t\t// assert.deepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t//\t\t \"Prototype chain equivalent to POJO.\");\n\t\t\t//\n\t\t\t// Case 2: Subclass construction (Customizable Object)\n\t\t\t//\n\t\t\t// \t class Foo extends schemaFactory.object(\"Foo\", {bar: schemaFactory.number}) {}\n\t\t\t//\n\t\t\t// \t assert.notDeepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t// \t \"Subclass prototype chain differs from POJO.\");\n\t\t\t//\n\t\t\t// In Case 1 (POJO emulation), the prototype chain match '{}' (proxyTarget = undefined)\n\t\t\t// In Case 2 (Customizable Object), the prototype chain include the user's subclass (proxyTarget = this)\n\n\t\t\tconst proxyTarget = customizable ? instance : {};\n\t\t\tconst proxy = new Proxy(proxyTarget, handler) as CustomObjectNode;\n\t\t\ttargetToProxy.set(proxyTarget, proxy);\n\t\t\treturn proxy;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): MapTreeNode {\n\t\t\treturn getOrCreateMapTreeNode(\n\t\t\t\tflexSchema,\n\t\t\t\tmapTreeFromNodeData(input as object, this as unknown as ImplicitAllowedTypes),\n\t\t\t);\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup<T2>(this: typeof TreeNodeValid<T2>): void {\n\t\t\t// One time initialization that required knowing the most derived type (from this.constructor) and thus has to be lazy.\n\t\t\tcustomizable = (this as unknown) !== CustomObjectNode;\n\t\t\thandler = createProxyHandler(flexKeyMap, customizable);\n\t\t\tflexSchema = getFlexSchema(this as unknown as TreeNodeSchema) as FlexObjectNodeSchema;\n\n\t\t\t// First run, do extra validation.\n\t\t\t// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.\n\t\t\t// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).\n\t\t\t{\n\t\t\t\tlet prototype: object = this.prototype;\n\t\t\t\t// There isn't a clear cleaner way to author this loop.\n\t\t\t\twhile (prototype !== CustomObjectNode.prototype) {\n\t\t\t\t\tfor (const [key] of flexKeyMap) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t// constructor is a special case, since one is built in on the derived type, and shadowing it works fine since we only use it before fields are applied.\n\t\t\t\t\t\t\tkey !== \"constructor\" &&\n\t\t\t\t\t\t\tReflect.getOwnPropertyDescriptor(prototype, key) !== undefined\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Schema ${identifier} defines an inherited property \"${key.toString()}\" which shadows a field. Since fields are exposed as own properties, this shadowing will not work, and is an error.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Since this stops at CustomObjectNode, it should never see a null prototype, so this case is safe.\n\t\t\t\t\t// Additionally, if the prototype chain is ever messed up such that CustomObjectNode is not in it,\n\t\t\t\t\t// the null that would show up here does at least ensure this code throws instead of hanging.\n\t\t\t\t\tprototype = Reflect.getPrototypeOf(prototype) as object;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): Output {\n\t\t\treturn CustomObjectNode.constructorCached?.constructor as unknown as Output;\n\t\t}\n\t}\n\ttype Output = typeof CustomObjectNode &\n\t\t(new (\n\t\t\tinput: InsertableObjectFromSchemaRecord<T> | InternalTreeNode,\n\t\t) => TreeObjectNode<T, TName>);\n\treturn CustomObjectNode as Output;\n}\n\nconst targetToProxy: WeakMap<object, TreeNode> = new WeakMap();\n\n/**\n * Ensures that the set of view keys in the schema is unique.\n * Also ensure that the final set of stored keys (including those implicitly derived from view keys) is unique.\n * @throws Throws a `UsageError` if either of the key uniqueness invariants is violated.\n */\nfunction assertUniqueKeys<\n\tconst Name extends number | string,\n\tconst Fields extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>,\n>(schemaName: Name, fields: Fields): void {\n\t// Verify that there are no duplicates among the explicitly specified stored keys.\n\tconst explicitStoredKeys = new Set<string>();\n\tfor (const schema of Object.values(fields)) {\n\t\tconst storedKey = getExplicitStoredKey(schema);\n\t\tif (storedKey === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (explicitStoredKeys.has(storedKey)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Duplicate stored key \"${storedKey}\" in schema \"${schemaName}\". Stored keys must be unique within an object schema.`,\n\t\t\t);\n\t\t}\n\t\texplicitStoredKeys.add(storedKey);\n\t}\n\n\t// Verify that there are no duplicates among the derived\n\t// (including those implicitly derived from view keys) stored keys.\n\tconst derivedStoredKeys = new Set<string>();\n\tfor (const [viewKey, schema] of Object.entries(fields)) {\n\t\tconst storedKey = getStoredKey(viewKey, schema);\n\t\tif (derivedStoredKeys.has(storedKey)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Stored key \"${storedKey}\" in schema \"${schemaName}\" conflicts with a property key of the same name, which is not overridden by a stored key. The final set of stored keys in an object schema must be unique.`,\n\t\t\t);\n\t\t}\n\t\tderivedStoredKeys.add(storedKey);\n\t}\n}\n"]}
@@ -0,0 +1,38 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { RestrictiveReadonlyRecord } from "../util/index.js";
6
+ import type { TreeObjectNode, InsertableObjectFromSchemaRecord, SimpleKeyMap } from "./objectNode.js";
7
+ import type { ImplicitFieldSchema, FieldSchema } from "./schemaTypes.js";
8
+ import { NodeKind, type TreeNodeSchemaClass, type TreeNodeSchema } from "./core/index.js";
9
+ import type { FieldKey } from "../core/index.js";
10
+ /**
11
+ * A schema for {@link TreeObjectNode}s.
12
+ * @privateRemarks
13
+ * This is a candidate for being promoted to the public package API.
14
+ */
15
+ export interface ObjectNodeSchema<TName extends string = string, T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema> = RestrictiveReadonlyRecord<string, ImplicitFieldSchema>, ImplicitlyConstructable extends boolean = boolean> extends TreeNodeSchemaClass<TName, NodeKind.Object, TreeObjectNode<T, TName>, object & InsertableObjectFromSchemaRecord<T>, ImplicitlyConstructable, T> {
16
+ /**
17
+ * From property keys to the associated schema.
18
+ */
19
+ readonly fields: ReadonlyMap<string, FieldSchema>;
20
+ }
21
+ /**
22
+ * Extra data provided on all {@link ObjectNodeSchema} that is not included in the (soon possibly public) ObjectNodeSchema type.
23
+ */
24
+ export interface ObjectNodeSchemaInternalData {
25
+ /**
26
+ * {@inheritdoc SimpleKeyMap}
27
+ */
28
+ readonly flexKeyMap: SimpleKeyMap;
29
+ /**
30
+ * Lookup the property keys from the stored keys.
31
+ */
32
+ readonly storedKeyToPropertyKey: ReadonlyMap<FieldKey, string>;
33
+ }
34
+ export declare const ObjectNodeSchema: {
35
+ readonly [Symbol.hasInstance]: (value: TreeNodeSchema) => value is ObjectNodeSchema<string, RestrictiveReadonlyRecord<string, ImplicitFieldSchema>, boolean>;
36
+ };
37
+ export declare function isObjectNodeSchema(schema: TreeNodeSchema): schema is ObjectNodeSchema & ObjectNodeSchemaInternalData;
38
+ //# sourceMappingURL=objectNodeTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectNodeTypes.d.ts","sourceRoot":"","sources":["../../src/simple-tree/objectNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EACX,cAAc,EACd,gCAAgC,EAChC,YAAY,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,KAAK,mBAAmB,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAChC,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,CAAC,SAAS,yBAAyB,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,yBAAyB,CAC3F,MAAM,EACN,mBAAmB,CACnB,EACD,uBAAuB,SAAS,OAAO,GAAG,OAAO,CAChD,SAAQ,mBAAmB,CAC3B,KAAK,EACL,QAAQ,CAAC,MAAM,EACf,cAAc,CAAC,CAAC,EAAE,KAAK,CAAC,EACxB,MAAM,GAAG,gCAAgC,CAAC,CAAC,CAAC,EAC5C,uBAAuB,EACvB,CAAC,CACD;IACD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CAClD;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;CAC/D;AAED,eAAO,MAAM,gBAAgB;2CAEA,cAAc;CAGjC,CAAC;AAEX,wBAAgB,kBAAkB,CACjC,MAAM,EAAE,cAAc,GACpB,MAAM,IAAI,gBAAgB,GAAG,4BAA4B,CAE3D"}
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { NodeKind } from "./core/index.js";
6
+ export const ObjectNodeSchema = {
7
+ // instanceof-based narrowing support for Javascript and TypeScript 5.3 or newer.
8
+ [Symbol.hasInstance](value) {
9
+ return isObjectNodeSchema(value);
10
+ },
11
+ };
12
+ export function isObjectNodeSchema(schema) {
13
+ return schema.kind === NodeKind.Object;
14
+ }
15
+ //# sourceMappingURL=objectNodeTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectNodeTypes.js","sourceRoot":"","sources":["../../src/simple-tree/objectNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,QAAQ,EAAiD,MAAM,iBAAiB,CAAC;AA4C1F,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,iFAAiF;IACjF,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAqB;QACzC,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACQ,CAAC;AAEX,MAAM,UAAU,kBAAkB,CACjC,MAAsB;IAEtB,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,CAAC;AACxC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { RestrictiveReadonlyRecord } from \"../util/index.js\";\nimport type {\n\tTreeObjectNode,\n\tInsertableObjectFromSchemaRecord,\n\tSimpleKeyMap,\n} from \"./objectNode.js\";\nimport type { ImplicitFieldSchema, FieldSchema } from \"./schemaTypes.js\";\nimport { NodeKind, type TreeNodeSchemaClass, type TreeNodeSchema } from \"./core/index.js\";\nimport type { FieldKey } from \"../core/index.js\";\n\n/**\n * A schema for {@link TreeObjectNode}s.\n * @privateRemarks\n * This is a candidate for being promoted to the public package API.\n */\nexport interface ObjectNodeSchema<\n\tTName extends string = string,\n\tT extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema> = RestrictiveReadonlyRecord<\n\t\tstring,\n\t\tImplicitFieldSchema\n\t>,\n\tImplicitlyConstructable extends boolean = boolean,\n> extends TreeNodeSchemaClass<\n\t\tTName,\n\t\tNodeKind.Object,\n\t\tTreeObjectNode<T, TName>,\n\t\tobject & InsertableObjectFromSchemaRecord<T>,\n\t\tImplicitlyConstructable,\n\t\tT\n\t> {\n\t/**\n\t * From property keys to the associated schema.\n\t */\n\treadonly fields: ReadonlyMap<string, FieldSchema>;\n}\n\n/**\n * Extra data provided on all {@link ObjectNodeSchema} that is not included in the (soon possibly public) ObjectNodeSchema type.\n */\nexport interface ObjectNodeSchemaInternalData {\n\t/**\n\t * {@inheritdoc SimpleKeyMap}\n\t */\n\treadonly flexKeyMap: SimpleKeyMap;\n\n\t/**\n\t * Lookup the property keys from the stored keys.\n\t */\n\treadonly storedKeyToPropertyKey: ReadonlyMap<FieldKey, string>;\n}\n\nexport const ObjectNodeSchema = {\n\t// instanceof-based narrowing support for Javascript and TypeScript 5.3 or newer.\n\t[Symbol.hasInstance](value: TreeNodeSchema): value is ObjectNodeSchema {\n\t\treturn isObjectNodeSchema(value);\n\t},\n} as const;\n\nexport function isObjectNodeSchema(\n\tschema: TreeNodeSchema,\n): schema is ObjectNodeSchema & ObjectNodeSchemaInternalData {\n\treturn schema.kind === NodeKind.Object;\n}\n"]}