@fluidframework/tree 2.42.0 → 2.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (542) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/api-report/tree.alpha.api.md +72 -25
  3. package/api-report/tree.beta.api.md +34 -0
  4. package/api-report/tree.legacy.alpha.api.md +1 -0
  5. package/api-report/tree.legacy.public.api.md +1 -0
  6. package/api-report/tree.public.api.md +1 -0
  7. package/dist/alpha.d.ts +12 -6
  8. package/dist/beta.d.ts +6 -1
  9. package/dist/core/index.d.ts +1 -1
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/core/index.js +5 -2
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/core/schema-stored/formatV2.d.ts +80 -0
  14. package/dist/core/schema-stored/formatV2.d.ts.map +1 -0
  15. package/dist/core/schema-stored/formatV2.js +55 -0
  16. package/dist/core/schema-stored/formatV2.js.map +1 -0
  17. package/dist/core/schema-stored/index.d.ts +3 -1
  18. package/dist/core/schema-stored/index.d.ts.map +1 -1
  19. package/dist/core/schema-stored/index.js +5 -2
  20. package/dist/core/schema-stored/index.js.map +1 -1
  21. package/dist/core/schema-stored/schema.d.ts +49 -17
  22. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  23. package/dist/core/schema-stored/schema.js +65 -22
  24. package/dist/core/schema-stored/schema.js.map +1 -1
  25. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +9 -7
  26. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  27. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +13 -9
  28. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  29. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +3 -3
  30. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  31. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +6 -6
  32. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts +1 -1
  34. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  35. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +3 -3
  36. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  37. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +8 -3
  38. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  39. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +2 -5
  40. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  41. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +24 -25
  42. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  43. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  44. package/dist/feature-libraries/flex-tree/index.d.ts +0 -1
  45. package/dist/feature-libraries/flex-tree/index.d.ts.map +1 -1
  46. package/dist/feature-libraries/flex-tree/index.js +1 -7
  47. package/dist/feature-libraries/flex-tree/index.js.map +1 -1
  48. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts +2 -2
  49. package/dist/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  50. package/dist/feature-libraries/flex-tree/lazyEntity.js +3 -0
  51. package/dist/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  52. package/dist/feature-libraries/flex-tree/lazyField.d.ts +1 -2
  53. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  54. package/dist/feature-libraries/flex-tree/lazyField.js +2 -5
  55. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  56. package/dist/feature-libraries/flex-tree/lazyNode.d.ts +5 -5
  57. package/dist/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  58. package/dist/feature-libraries/flex-tree/lazyNode.js +15 -7
  59. package/dist/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  60. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +8 -3
  61. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  62. package/dist/feature-libraries/forest-summary/forestSummarizer.js +2 -5
  63. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  64. package/dist/feature-libraries/index.d.ts +2 -2
  65. package/dist/feature-libraries/index.d.ts.map +1 -1
  66. package/dist/feature-libraries/index.js +1 -2
  67. package/dist/feature-libraries/index.js.map +1 -1
  68. package/dist/feature-libraries/mapTreeCursor.d.ts +16 -2
  69. package/dist/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  70. package/dist/feature-libraries/mapTreeCursor.js.map +1 -1
  71. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +1 -1
  72. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +2 -0
  73. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  74. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  75. package/dist/feature-libraries/object-forest/objectForest.js +2 -0
  76. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  77. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  78. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -4
  79. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  80. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -36
  81. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  82. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js +3 -3
  83. package/dist/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  84. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  85. package/dist/feature-libraries/schema-index/codec.js +59 -9
  86. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  87. package/dist/feature-libraries/schema-index/formatV1.d.ts +1 -1
  88. package/dist/feature-libraries/schema-index/formatV2.d.ts +42 -0
  89. package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -0
  90. package/dist/feature-libraries/schema-index/formatV2.js +26 -0
  91. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -0
  92. package/dist/feature-libraries/schema-index/index.d.ts +2 -1
  93. package/dist/feature-libraries/schema-index/index.d.ts.map +1 -1
  94. package/dist/feature-libraries/schema-index/index.js +4 -2
  95. package/dist/feature-libraries/schema-index/index.js.map +1 -1
  96. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +7 -2
  97. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  98. package/dist/feature-libraries/schema-index/schemaSummarizer.js +6 -6
  99. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  100. package/dist/index.d.ts +2 -2
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js.map +1 -1
  103. package/dist/packageVersion.d.ts +1 -1
  104. package/dist/packageVersion.js +1 -1
  105. package/dist/packageVersion.js.map +1 -1
  106. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  107. package/dist/shared-tree/schematizeTree.js +1 -0
  108. package/dist/shared-tree/schematizeTree.js.map +1 -1
  109. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  110. package/dist/shared-tree/schematizingTreeView.js +3 -3
  111. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  112. package/dist/shared-tree/sharedTree.d.ts +5 -1
  113. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  114. package/dist/shared-tree/sharedTree.js +34 -5
  115. package/dist/shared-tree/sharedTree.js.map +1 -1
  116. package/dist/shared-tree/treeAlpha.d.ts +39 -1
  117. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  118. package/dist/shared-tree/treeAlpha.js +117 -11
  119. package/dist/shared-tree/treeAlpha.js.map +1 -1
  120. package/dist/shared-tree-core/editManagerSummarizer.d.ts +8 -3
  121. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  122. package/dist/shared-tree-core/editManagerSummarizer.js +2 -5
  123. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  124. package/dist/shared-tree-core/sharedTreeCore.d.ts +18 -7
  125. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  126. package/dist/shared-tree-core/sharedTreeCore.js +15 -2
  127. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  128. package/dist/simple-tree/api/configuration.d.ts +15 -3
  129. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  130. package/dist/simple-tree/api/configuration.js +40 -22
  131. package/dist/simple-tree/api/configuration.js.map +1 -1
  132. package/dist/simple-tree/api/index.d.ts +1 -1
  133. package/dist/simple-tree/api/index.d.ts.map +1 -1
  134. package/dist/simple-tree/api/index.js +4 -4
  135. package/dist/simple-tree/api/index.js.map +1 -1
  136. package/dist/simple-tree/api/schemaCompatibilityTester.js +1 -1
  137. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  138. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  139. package/dist/simple-tree/api/schemaCreationUtilities.js +3 -3
  140. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  141. package/dist/simple-tree/api/schemaFactory.d.ts +15 -11
  142. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  143. package/dist/simple-tree/api/schemaFactory.js +4 -0
  144. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  145. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +41 -11
  146. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  147. package/dist/simple-tree/api/schemaFactoryAlpha.js +31 -4
  148. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  149. package/dist/simple-tree/api/storedSchema.js +2 -2
  150. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  151. package/dist/simple-tree/api/treeChangeEvents.d.ts +8 -3
  152. package/dist/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  153. package/dist/simple-tree/api/treeChangeEvents.js.map +1 -1
  154. package/dist/simple-tree/api/treeNodeApi.d.ts +3 -0
  155. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  156. package/dist/simple-tree/api/treeNodeApi.js +1 -1
  157. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  158. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  159. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +5 -0
  160. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  161. package/dist/simple-tree/core/context.d.ts +3 -3
  162. package/dist/simple-tree/core/context.d.ts.map +1 -1
  163. package/dist/simple-tree/core/context.js.map +1 -1
  164. package/dist/simple-tree/core/getOrCreateNode.d.ts +9 -0
  165. package/dist/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  166. package/dist/simple-tree/core/getOrCreateNode.js +12 -1
  167. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  168. package/dist/simple-tree/core/index.d.ts +2 -2
  169. package/dist/simple-tree/core/index.d.ts.map +1 -1
  170. package/dist/simple-tree/core/index.js +3 -1
  171. package/dist/simple-tree/core/index.js.map +1 -1
  172. package/dist/simple-tree/core/treeNodeKernel.js +2 -2
  173. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  174. package/dist/simple-tree/core/treeNodeSchema.d.ts +68 -1
  175. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  176. package/dist/simple-tree/core/treeNodeSchema.js +24 -1
  177. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  178. package/dist/simple-tree/core/unhydratedFlexTree.d.ts +5 -9
  179. package/dist/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  180. package/dist/simple-tree/core/unhydratedFlexTree.js +12 -31
  181. package/dist/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  182. package/dist/simple-tree/core/walkSchema.d.ts +3 -3
  183. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  184. package/dist/simple-tree/core/walkSchema.js +9 -5
  185. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  186. package/dist/simple-tree/createContext.js +1 -1
  187. package/dist/simple-tree/createContext.js.map +1 -1
  188. package/dist/simple-tree/getTreeNodeForField.d.ts +1 -1
  189. package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -1
  190. package/dist/simple-tree/getTreeNodeForField.js +3 -3
  191. package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
  192. package/dist/simple-tree/index.d.ts +6 -6
  193. package/dist/simple-tree/index.d.ts.map +1 -1
  194. package/dist/simple-tree/index.js +8 -5
  195. package/dist/simple-tree/index.js.map +1 -1
  196. package/dist/simple-tree/leafNodeSchema.d.ts +4 -1
  197. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  198. package/dist/simple-tree/leafNodeSchema.js +1 -0
  199. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  200. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +3 -1
  201. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  202. package/dist/simple-tree/node-kinds/array/arrayNode.js +21 -16
  203. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  204. package/dist/simple-tree/node-kinds/map/mapNode.d.ts +3 -2
  205. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  206. package/dist/simple-tree/node-kinds/map/mapNode.js +11 -5
  207. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  208. package/dist/simple-tree/node-kinds/object/objectNode.d.ts +3 -2
  209. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  210. package/dist/simple-tree/node-kinds/object/objectNode.js +12 -7
  211. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  212. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  213. package/dist/simple-tree/prepareForInsertion.js +5 -1
  214. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  215. package/dist/simple-tree/schemaTypes.d.ts +63 -30
  216. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  217. package/dist/simple-tree/schemaTypes.js +73 -40
  218. package/dist/simple-tree/schemaTypes.js.map +1 -1
  219. package/dist/simple-tree/simpleSchema.d.ts +22 -4
  220. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  221. package/dist/simple-tree/simpleSchema.js.map +1 -1
  222. package/dist/simple-tree/toStoredSchema.d.ts +4 -0
  223. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  224. package/dist/simple-tree/toStoredSchema.js +15 -4
  225. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  226. package/dist/simple-tree/treeNodeValid.d.ts.map +1 -1
  227. package/dist/simple-tree/treeNodeValid.js +1 -2
  228. package/dist/simple-tree/treeNodeValid.js.map +1 -1
  229. package/dist/simple-tree/walkFieldSchema.d.ts.map +1 -1
  230. package/dist/simple-tree/walkFieldSchema.js +1 -1
  231. package/dist/simple-tree/walkFieldSchema.js.map +1 -1
  232. package/dist/tableSchema.d.ts +1 -1
  233. package/dist/util/typeUtils.d.ts +2 -2
  234. package/dist/util/typeUtils.js.map +1 -1
  235. package/dist/util/utils.d.ts +2 -0
  236. package/dist/util/utils.d.ts.map +1 -1
  237. package/dist/util/utils.js.map +1 -1
  238. package/lib/alpha.d.ts +12 -6
  239. package/lib/beta.d.ts +6 -1
  240. package/lib/core/index.d.ts +1 -1
  241. package/lib/core/index.d.ts.map +1 -1
  242. package/lib/core/index.js +1 -1
  243. package/lib/core/index.js.map +1 -1
  244. package/lib/core/schema-stored/formatV2.d.ts +80 -0
  245. package/lib/core/schema-stored/formatV2.d.ts.map +1 -0
  246. package/lib/core/schema-stored/formatV2.js +52 -0
  247. package/lib/core/schema-stored/formatV2.js.map +1 -0
  248. package/lib/core/schema-stored/index.d.ts +3 -1
  249. package/lib/core/schema-stored/index.d.ts.map +1 -1
  250. package/lib/core/schema-stored/index.js +3 -1
  251. package/lib/core/schema-stored/index.js.map +1 -1
  252. package/lib/core/schema-stored/schema.d.ts +49 -17
  253. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  254. package/lib/core/schema-stored/schema.js +63 -21
  255. package/lib/core/schema-stored/schema.js.map +1 -1
  256. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +9 -7
  257. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  258. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js +11 -7
  259. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  260. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +3 -3
  261. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  262. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +7 -7
  263. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  264. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts +1 -1
  265. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  266. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +3 -3
  267. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  268. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +8 -3
  269. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  270. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +2 -5
  271. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  272. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts +24 -25
  273. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  274. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  275. package/lib/feature-libraries/flex-tree/index.d.ts +0 -1
  276. package/lib/feature-libraries/flex-tree/index.d.ts.map +1 -1
  277. package/lib/feature-libraries/flex-tree/index.js +0 -1
  278. package/lib/feature-libraries/flex-tree/index.js.map +1 -1
  279. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts +2 -2
  280. package/lib/feature-libraries/flex-tree/lazyEntity.d.ts.map +1 -1
  281. package/lib/feature-libraries/flex-tree/lazyEntity.js +3 -0
  282. package/lib/feature-libraries/flex-tree/lazyEntity.js.map +1 -1
  283. package/lib/feature-libraries/flex-tree/lazyField.d.ts +1 -2
  284. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  285. package/lib/feature-libraries/flex-tree/lazyField.js +3 -6
  286. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  287. package/lib/feature-libraries/flex-tree/lazyNode.d.ts +5 -5
  288. package/lib/feature-libraries/flex-tree/lazyNode.d.ts.map +1 -1
  289. package/lib/feature-libraries/flex-tree/lazyNode.js +15 -7
  290. package/lib/feature-libraries/flex-tree/lazyNode.js.map +1 -1
  291. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +8 -3
  292. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  293. package/lib/feature-libraries/forest-summary/forestSummarizer.js +2 -5
  294. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  295. package/lib/feature-libraries/index.d.ts +2 -2
  296. package/lib/feature-libraries/index.d.ts.map +1 -1
  297. package/lib/feature-libraries/index.js +1 -1
  298. package/lib/feature-libraries/index.js.map +1 -1
  299. package/lib/feature-libraries/mapTreeCursor.d.ts +16 -2
  300. package/lib/feature-libraries/mapTreeCursor.d.ts.map +1 -1
  301. package/lib/feature-libraries/mapTreeCursor.js.map +1 -1
  302. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +1 -1
  303. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +2 -0
  304. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +1 -1
  305. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  306. package/lib/feature-libraries/object-forest/objectForest.js +2 -0
  307. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  308. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  309. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +8 -4
  310. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  311. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -36
  312. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts.map +1 -1
  313. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js +3 -3
  314. package/lib/feature-libraries/schema-edits/schemaChangeFormat.js.map +1 -1
  315. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  316. package/lib/feature-libraries/schema-index/codec.js +60 -10
  317. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  318. package/lib/feature-libraries/schema-index/formatV1.d.ts +1 -1
  319. package/lib/feature-libraries/schema-index/formatV2.d.ts +42 -0
  320. package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -0
  321. package/lib/feature-libraries/schema-index/formatV2.js +23 -0
  322. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -0
  323. package/lib/feature-libraries/schema-index/index.d.ts +2 -1
  324. package/lib/feature-libraries/schema-index/index.d.ts.map +1 -1
  325. package/lib/feature-libraries/schema-index/index.js +2 -1
  326. package/lib/feature-libraries/schema-index/index.js.map +1 -1
  327. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +7 -2
  328. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  329. package/lib/feature-libraries/schema-index/schemaSummarizer.js +6 -6
  330. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  331. package/lib/index.d.ts +2 -2
  332. package/lib/index.d.ts.map +1 -1
  333. package/lib/index.js.map +1 -1
  334. package/lib/packageVersion.d.ts +1 -1
  335. package/lib/packageVersion.js +1 -1
  336. package/lib/packageVersion.js.map +1 -1
  337. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  338. package/lib/shared-tree/schematizeTree.js +1 -0
  339. package/lib/shared-tree/schematizeTree.js.map +1 -1
  340. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  341. package/lib/shared-tree/schematizingTreeView.js +4 -4
  342. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  343. package/lib/shared-tree/sharedTree.d.ts +5 -1
  344. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  345. package/lib/shared-tree/sharedTree.js +34 -5
  346. package/lib/shared-tree/sharedTree.js.map +1 -1
  347. package/lib/shared-tree/treeAlpha.d.ts +39 -1
  348. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  349. package/lib/shared-tree/treeAlpha.js +111 -5
  350. package/lib/shared-tree/treeAlpha.js.map +1 -1
  351. package/lib/shared-tree-core/editManagerSummarizer.d.ts +8 -3
  352. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  353. package/lib/shared-tree-core/editManagerSummarizer.js +2 -5
  354. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  355. package/lib/shared-tree-core/sharedTreeCore.d.ts +18 -7
  356. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  357. package/lib/shared-tree-core/sharedTreeCore.js +15 -2
  358. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  359. package/lib/simple-tree/api/configuration.d.ts +15 -3
  360. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  361. package/lib/simple-tree/api/configuration.js +42 -24
  362. package/lib/simple-tree/api/configuration.js.map +1 -1
  363. package/lib/simple-tree/api/index.d.ts +1 -1
  364. package/lib/simple-tree/api/index.d.ts.map +1 -1
  365. package/lib/simple-tree/api/index.js +1 -1
  366. package/lib/simple-tree/api/index.js.map +1 -1
  367. package/lib/simple-tree/api/schemaCompatibilityTester.js +1 -1
  368. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  369. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +3 -3
  370. package/lib/simple-tree/api/schemaCreationUtilities.js +3 -3
  371. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  372. package/lib/simple-tree/api/schemaFactory.d.ts +15 -11
  373. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  374. package/lib/simple-tree/api/schemaFactory.js +4 -0
  375. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  376. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +41 -11
  377. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  378. package/lib/simple-tree/api/schemaFactoryAlpha.js +31 -4
  379. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  380. package/lib/simple-tree/api/storedSchema.js +2 -2
  381. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  382. package/lib/simple-tree/api/treeChangeEvents.d.ts +8 -3
  383. package/lib/simple-tree/api/treeChangeEvents.d.ts.map +1 -1
  384. package/lib/simple-tree/api/treeChangeEvents.js.map +1 -1
  385. package/lib/simple-tree/api/treeNodeApi.d.ts +3 -0
  386. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  387. package/lib/simple-tree/api/treeNodeApi.js +2 -2
  388. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  389. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  390. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +5 -0
  391. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  392. package/lib/simple-tree/core/context.d.ts +3 -3
  393. package/lib/simple-tree/core/context.d.ts.map +1 -1
  394. package/lib/simple-tree/core/context.js.map +1 -1
  395. package/lib/simple-tree/core/getOrCreateNode.d.ts +9 -0
  396. package/lib/simple-tree/core/getOrCreateNode.d.ts.map +1 -1
  397. package/lib/simple-tree/core/getOrCreateNode.js +10 -0
  398. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  399. package/lib/simple-tree/core/index.d.ts +2 -2
  400. package/lib/simple-tree/core/index.d.ts.map +1 -1
  401. package/lib/simple-tree/core/index.js +2 -2
  402. package/lib/simple-tree/core/index.js.map +1 -1
  403. package/lib/simple-tree/core/treeNodeKernel.js +2 -2
  404. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  405. package/lib/simple-tree/core/treeNodeSchema.d.ts +68 -1
  406. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  407. package/lib/simple-tree/core/treeNodeSchema.js +21 -0
  408. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  409. package/lib/simple-tree/core/unhydratedFlexTree.d.ts +5 -9
  410. package/lib/simple-tree/core/unhydratedFlexTree.d.ts.map +1 -1
  411. package/lib/simple-tree/core/unhydratedFlexTree.js +15 -34
  412. package/lib/simple-tree/core/unhydratedFlexTree.js.map +1 -1
  413. package/lib/simple-tree/core/walkSchema.d.ts +3 -3
  414. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  415. package/lib/simple-tree/core/walkSchema.js +9 -5
  416. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  417. package/lib/simple-tree/createContext.js +1 -1
  418. package/lib/simple-tree/createContext.js.map +1 -1
  419. package/lib/simple-tree/getTreeNodeForField.d.ts +1 -1
  420. package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -1
  421. package/lib/simple-tree/getTreeNodeForField.js +1 -1
  422. package/lib/simple-tree/getTreeNodeForField.js.map +1 -1
  423. package/lib/simple-tree/index.d.ts +6 -6
  424. package/lib/simple-tree/index.d.ts.map +1 -1
  425. package/lib/simple-tree/index.js +4 -4
  426. package/lib/simple-tree/index.js.map +1 -1
  427. package/lib/simple-tree/leafNodeSchema.d.ts +4 -1
  428. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  429. package/lib/simple-tree/leafNodeSchema.js +2 -1
  430. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  431. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +3 -1
  432. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  433. package/lib/simple-tree/node-kinds/array/arrayNode.js +13 -8
  434. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  435. package/lib/simple-tree/node-kinds/map/mapNode.d.ts +3 -2
  436. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  437. package/lib/simple-tree/node-kinds/map/mapNode.js +14 -8
  438. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  439. package/lib/simple-tree/node-kinds/object/objectNode.d.ts +3 -2
  440. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  441. package/lib/simple-tree/node-kinds/object/objectNode.js +14 -9
  442. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  443. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  444. package/lib/simple-tree/prepareForInsertion.js +5 -1
  445. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  446. package/lib/simple-tree/schemaTypes.d.ts +63 -30
  447. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  448. package/lib/simple-tree/schemaTypes.js +70 -36
  449. package/lib/simple-tree/schemaTypes.js.map +1 -1
  450. package/lib/simple-tree/simpleSchema.d.ts +22 -4
  451. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  452. package/lib/simple-tree/simpleSchema.js.map +1 -1
  453. package/lib/simple-tree/toStoredSchema.d.ts +4 -0
  454. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  455. package/lib/simple-tree/toStoredSchema.js +15 -4
  456. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  457. package/lib/simple-tree/treeNodeValid.d.ts.map +1 -1
  458. package/lib/simple-tree/treeNodeValid.js +1 -2
  459. package/lib/simple-tree/treeNodeValid.js.map +1 -1
  460. package/lib/simple-tree/walkFieldSchema.d.ts.map +1 -1
  461. package/lib/simple-tree/walkFieldSchema.js +1 -1
  462. package/lib/simple-tree/walkFieldSchema.js.map +1 -1
  463. package/lib/tableSchema.d.ts +1 -1
  464. package/lib/util/typeUtils.d.ts +2 -2
  465. package/lib/util/typeUtils.js.map +1 -1
  466. package/lib/util/utils.d.ts +2 -0
  467. package/lib/util/utils.d.ts.map +1 -1
  468. package/lib/util/utils.js.map +1 -1
  469. package/package.json +23 -23
  470. package/src/core/index.ts +3 -1
  471. package/src/core/schema-stored/formatV2.ts +78 -0
  472. package/src/core/schema-stored/index.ts +4 -1
  473. package/src/core/schema-stored/schema.ts +123 -33
  474. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +16 -11
  475. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +16 -7
  476. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +4 -4
  477. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +9 -16
  478. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +33 -30
  479. package/src/feature-libraries/flex-tree/index.ts +0 -8
  480. package/src/feature-libraries/flex-tree/lazyEntity.ts +5 -1
  481. package/src/feature-libraries/flex-tree/lazyField.ts +5 -8
  482. package/src/feature-libraries/flex-tree/lazyNode.ts +17 -8
  483. package/src/feature-libraries/forest-summary/forestSummarizer.ts +9 -16
  484. package/src/feature-libraries/index.ts +1 -1
  485. package/src/feature-libraries/mapTreeCursor.ts +17 -8
  486. package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +2 -0
  487. package/src/feature-libraries/object-forest/objectForest.ts +3 -0
  488. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +11 -6
  489. package/src/feature-libraries/schema-edits/schemaChangeFormat.ts +3 -3
  490. package/src/feature-libraries/schema-index/codec.ts +73 -14
  491. package/src/feature-libraries/schema-index/formatV2.ts +30 -0
  492. package/src/feature-libraries/schema-index/index.ts +2 -1
  493. package/src/feature-libraries/schema-index/schemaSummarizer.ts +11 -18
  494. package/src/index.ts +6 -0
  495. package/src/packageVersion.ts +1 -1
  496. package/src/shared-tree/schematizeTree.ts +1 -0
  497. package/src/shared-tree/schematizingTreeView.ts +8 -5
  498. package/src/shared-tree/sharedTree.ts +42 -12
  499. package/src/shared-tree/treeAlpha.ts +196 -6
  500. package/src/shared-tree-core/editManagerSummarizer.ts +9 -16
  501. package/src/shared-tree-core/sharedTreeCore.ts +33 -24
  502. package/src/simple-tree/api/configuration.ts +59 -27
  503. package/src/simple-tree/api/index.ts +3 -3
  504. package/src/simple-tree/api/schemaCompatibilityTester.ts +1 -1
  505. package/src/simple-tree/api/schemaCreationUtilities.ts +3 -3
  506. package/src/simple-tree/api/schemaFactory.ts +16 -11
  507. package/src/simple-tree/api/schemaFactoryAlpha.ts +53 -8
  508. package/src/simple-tree/api/storedSchema.ts +4 -4
  509. package/src/simple-tree/api/treeChangeEvents.ts +8 -3
  510. package/src/simple-tree/api/treeNodeApi.ts +5 -2
  511. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +5 -0
  512. package/src/simple-tree/core/context.ts +3 -3
  513. package/src/simple-tree/core/getOrCreateNode.ts +14 -0
  514. package/src/simple-tree/core/index.ts +7 -1
  515. package/src/simple-tree/core/treeNodeKernel.ts +2 -2
  516. package/src/simple-tree/core/treeNodeSchema.ts +113 -1
  517. package/src/simple-tree/core/unhydratedFlexTree.ts +22 -44
  518. package/src/simple-tree/core/walkSchema.ts +16 -7
  519. package/src/simple-tree/createContext.ts +1 -1
  520. package/src/simple-tree/getTreeNodeForField.ts +3 -1
  521. package/src/simple-tree/index.ts +12 -5
  522. package/src/simple-tree/leafNodeSchema.ts +9 -1
  523. package/src/simple-tree/node-kinds/array/arrayNode.ts +20 -9
  524. package/src/simple-tree/node-kinds/map/mapNode.ts +21 -6
  525. package/src/simple-tree/node-kinds/object/objectNode.ts +29 -12
  526. package/src/simple-tree/prepareForInsertion.ts +5 -1
  527. package/src/simple-tree/schemaTypes.ts +151 -71
  528. package/src/simple-tree/simpleSchema.ts +27 -5
  529. package/src/simple-tree/toStoredSchema.ts +17 -4
  530. package/src/simple-tree/treeNodeValid.ts +1 -1
  531. package/src/simple-tree/walkFieldSchema.ts +5 -1
  532. package/src/util/typeUtils.ts +2 -2
  533. package/src/util/utils.ts +2 -0
  534. package/dist/feature-libraries/flex-tree/navigation.d.ts +0 -46
  535. package/dist/feature-libraries/flex-tree/navigation.d.ts.map +0 -1
  536. package/dist/feature-libraries/flex-tree/navigation.js +0 -104
  537. package/dist/feature-libraries/flex-tree/navigation.js.map +0 -1
  538. package/lib/feature-libraries/flex-tree/navigation.d.ts +0 -46
  539. package/lib/feature-libraries/flex-tree/navigation.d.ts.map +0 -1
  540. package/lib/feature-libraries/flex-tree/navigation.js +0 -97
  541. package/lib/feature-libraries/flex-tree/navigation.js.map +0 -1
  542. package/src/feature-libraries/flex-tree/navigation.ts +0 -121
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { type ArrayNodeCustomizableSchema, type MapNodeCustomizableSchema, type ObjectNodeSchema } from "../node-kinds/index.js";
6
6
  import { SchemaFactory, type SchemaFactoryObjectOptions, type ScopedSchemaName } from "./schemaFactory.js";
7
- import type { ImplicitAllowedTypes, ImplicitAnnotatedAllowedTypes, ImplicitAnnotatedFieldSchema, NodeSchemaOptions } from "../schemaTypes.js";
7
+ import type { ImplicitAllowedTypes, ImplicitAnnotatedAllowedTypes, ImplicitAnnotatedFieldSchema, NodeSchemaOptionsAlpha } from "../schemaTypes.js";
8
8
  import type { RestrictiveStringRecord } from "../../util/index.js";
9
9
  import type { NodeKind, TreeNodeSchemaClass } from "../core/index.js";
10
10
  import type { ArrayNodeCustomizableSchemaUnsafe, MapNodeCustomizableSchemaUnsafe, System_Unsafe } from "./typesUnsafe.js";
@@ -45,31 +45,61 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
45
45
  */
46
46
  objectRecursive<const Name extends TName, const T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>, const TCustomMetadata = unknown>(name: Name, t: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, System_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>, false, T, never, TCustomMetadata> & SimpleObjectNodeSchema<TCustomMetadata> & Pick<ObjectNodeSchema, "fields">;
47
47
  /**
48
- * {@inheritDoc SchemaStatics.optional}
48
+ * {@inheritDoc SchemaStatics.leaves}
49
49
  */
50
50
  static readonly leaves: readonly [import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"number", number> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"boolean", boolean> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"null", null> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"handle", import("@fluidframework/core-interfaces").IFluidHandle<unknown>> & import("../simpleSchema.js").SimpleLeafNodeSchema];
51
51
  /**
52
52
  * {@inheritDoc SchemaStatics.optional}
53
53
  */
54
54
  static readonly optional: {
55
- <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;
56
- <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, import("../schemaTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
55
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;
56
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, import("../schemaTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
57
57
  };
58
58
  /**
59
59
  * {@inheritDoc SchemaStatics.required}
60
60
  */
61
61
  static readonly required: {
62
- <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, T, TCustomMetadata>;
63
- <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, import("../schemaTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
62
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, T, TCustomMetadata>;
63
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, import("../schemaTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
64
64
  };
65
65
  /**
66
66
  * {@inheritDoc SchemaStatics.optionalRecursive}
67
67
  */
68
- static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;
68
+ static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;
69
+ /**
70
+ * {@inheritDoc SchemaStatics.requiredRecursive}
71
+ */
72
+ static readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Required, T, TCustomMetadata>;
69
73
  /**
70
74
  * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.
71
75
  */
72
76
  static readonly identifier: <const TCustomMetadata = unknown>(props?: Omit<import("../schemaTypes.js").FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Identifier, import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, TCustomMetadata>;
77
+ /**
78
+ * {@inheritDoc SchemaStatics.leaves}
79
+ */
80
+ readonly leaves: readonly [import("../leafNodeSchema.js").LeafSchema<"string", string> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"number", number> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"boolean", boolean> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"null", null> & import("../simpleSchema.js").SimpleLeafNodeSchema, import("../leafNodeSchema.js").LeafSchema<"handle", import("@fluidframework/core-interfaces").IFluidHandle<unknown>> & import("../simpleSchema.js").SimpleLeafNodeSchema];
81
+ /**
82
+ * {@inheritDoc SchemaStatics.optional}
83
+ */
84
+ readonly optional: {
85
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;
86
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Optional, import("../schemaTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
87
+ };
88
+ /**
89
+ * {@inheritDoc SchemaStatics.required}
90
+ */
91
+ readonly required: {
92
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, T, TCustomMetadata>;
93
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata_1>, "defaultProvider"> | undefined): import("../schemaTypes.js").FieldSchemaAlpha<import("../schemaTypes.js").FieldKind.Required, import("../schemaTypes.js").UnannotateImplicitAllowedTypes<T_1>, TCustomMetadata_1>;
94
+ };
95
+ /**
96
+ * {@inheritDoc SchemaStatics.optionalRecursive}
97
+ */
98
+ readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Optional, T, TCustomMetadata>;
99
+ /**
100
+ * {@inheritDoc SchemaStatics.requiredRecursive}
101
+ */
102
+ readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<import("../schemaTypes.js").FieldPropsAlpha<TCustomMetadata>, "defaultProvider"> | undefined) => import("./typesUnsafe.js").FieldSchemaAlphaUnsafe<import("../schemaTypes.js").FieldKind.Required, T, TCustomMetadata>;
73
103
  /**
74
104
  * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.
75
105
  *
@@ -84,11 +114,11 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
84
114
  * }) {}
85
115
  * ```
86
116
  */
87
- mapAlpha<Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
117
+ mapAlpha<Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
88
118
  /**
89
119
  * {@inheritDoc SchemaFactory.objectRecursive}
90
120
  */
91
- mapRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): MapNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
121
+ mapRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): MapNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
92
122
  /**
93
123
  * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
94
124
  *
@@ -101,11 +131,11 @@ export declare class SchemaFactoryAlpha<out TScope extends string | undefined =
101
131
  * class NamedArray extends factory.arrayAlpha("name", factory.number) {}
102
132
  * ```
103
133
  */
104
- arrayAlpha<const Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
134
+ arrayAlpha<const Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
105
135
  /**
106
136
  * {@inheritDoc SchemaFactory.objectRecursive}
107
137
  */
108
- arrayRecursive<const Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): ArrayNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
138
+ arrayRecursive<const Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): ArrayNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
109
139
  /**
110
140
  * Create a {@link SchemaFactory} with a {@link SchemaFactory.scope|scope} which is a combination of this factory's scope and the provided name.
111
141
  * @remarks
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactoryAlpha.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryAlpha.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,2BAA2B,EAEhC,KAAK,yBAAyB,EAE9B,KAAK,gBAAgB,EAErB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEN,aAAa,EAEb,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACX,oBAAoB,EACpB,6BAA6B,EAC7B,4BAA4B,EAE5B,iBAAiB,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EACX,iCAAiC,EACjC,+BAA+B,EAC/B,aAAa,EACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;;;;;;GAQG;AACH,qBAAa,kBAAkB,CAC9B,GAAG,CAAC,MAAM,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,EAC1D,KAAK,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CACrC,SAAQ,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC;IACrC,OAAO,CAAC,OAAO;IAMf;;;;;;OAMG;IACI,WAAW,CACjB,KAAK,CAAC,IAAI,SAAS,KAAK,EACxB,KAAK,CAAC,CAAC,SAAS,uBAAuB,CAAC,4BA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AAO,CAAC,EAAE,sBAAsB,CAAC,eAAe,CAAC;IAYhF;;;;;OAKG;IACI,aAAa,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,EAAE,UAAU,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EACtF,IAAI,EAAE,CAAC,GACL,kBAAkB,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC;CAG9D"}
@@ -17,6 +17,29 @@ const schemaFactory_js_1 = require("./schemaFactory.js");
17
17
  * If we were to do so, they would be exposed on the public API surface of `SchemaFactory`.
18
18
  */
19
19
  class SchemaFactoryAlpha extends schemaFactory_js_1.SchemaFactory {
20
+ constructor() {
21
+ super(...arguments);
22
+ /**
23
+ * {@inheritDoc SchemaStatics.leaves}
24
+ */
25
+ this.leaves = schemaFactory_js_1.schemaStatics.leaves;
26
+ /**
27
+ * {@inheritDoc SchemaStatics.optional}
28
+ */
29
+ this.optional = schemaFactory_js_1.schemaStatics.optional;
30
+ /**
31
+ * {@inheritDoc SchemaStatics.required}
32
+ */
33
+ this.required = schemaFactory_js_1.schemaStatics.required;
34
+ /**
35
+ * {@inheritDoc SchemaStatics.optionalRecursive}
36
+ */
37
+ this.optionalRecursive = schemaFactory_js_1.schemaStatics.optionalRecursive;
38
+ /**
39
+ * {@inheritDoc SchemaStatics.requiredRecursive}
40
+ */
41
+ this.requiredRecursive = schemaFactory_js_1.schemaStatics.requiredRecursive;
42
+ }
20
43
  scoped2(name) {
21
44
  return (this.scope === undefined ? `${name}` : `${this.scope}.${name}`);
22
45
  }
@@ -29,7 +52,7 @@ class SchemaFactoryAlpha extends schemaFactory_js_1.SchemaFactory {
29
52
  */
30
53
  objectAlpha(name, fields, options) {
31
54
  return (0, index_js_1.objectSchema)(this.scoped2(name), fields, true, options?.allowUnknownOptionalFields ??
32
- schemaFactory_js_1.defaultSchemaFactoryObjectOptions.allowUnknownOptionalFields, options?.metadata);
55
+ schemaFactory_js_1.defaultSchemaFactoryObjectOptions.allowUnknownOptionalFields, options?.metadata, options?.persistedMetadata);
33
56
  }
34
57
  /**
35
58
  * {@inheritdoc SchemaFactory.objectRecursive}
@@ -52,7 +75,7 @@ class SchemaFactoryAlpha extends schemaFactory_js_1.SchemaFactory {
52
75
  * ```
53
76
  */
54
77
  mapAlpha(name, allowedTypes, options) {
55
- return (0, index_js_1.mapSchema)(this.scoped2(name), allowedTypes, true, true, options?.metadata);
78
+ return (0, index_js_1.mapSchema)(this.scoped2(name), allowedTypes, true, true, options?.metadata, options?.persistedMetadata);
56
79
  }
57
80
  /**
58
81
  * {@inheritDoc SchemaFactory.objectRecursive}
@@ -74,7 +97,7 @@ class SchemaFactoryAlpha extends schemaFactory_js_1.SchemaFactory {
74
97
  * ```
75
98
  */
76
99
  arrayAlpha(name, allowedTypes, options) {
77
- return (0, index_js_1.arraySchema)(this.scoped2(name), allowedTypes, true, true, options?.metadata);
100
+ return (0, index_js_1.arraySchema)(this.scoped2(name), allowedTypes, true, true, options?.metadata, options?.persistedMetadata);
78
101
  }
79
102
  /**
80
103
  * {@inheritDoc SchemaFactory.objectRecursive}
@@ -95,7 +118,7 @@ class SchemaFactoryAlpha extends schemaFactory_js_1.SchemaFactory {
95
118
  }
96
119
  exports.SchemaFactoryAlpha = SchemaFactoryAlpha;
97
120
  /**
98
- * {@inheritDoc SchemaStatics.optional}
121
+ * {@inheritDoc SchemaStatics.leaves}
99
122
  */
100
123
  SchemaFactoryAlpha.leaves = schemaFactory_js_1.schemaStatics.leaves;
101
124
  /**
@@ -110,6 +133,10 @@ SchemaFactoryAlpha.required = schemaFactory_js_1.schemaStatics.required;
110
133
  * {@inheritDoc SchemaStatics.optionalRecursive}
111
134
  */
112
135
  SchemaFactoryAlpha.optionalRecursive = schemaFactory_js_1.schemaStatics.optionalRecursive;
136
+ /**
137
+ * {@inheritDoc SchemaStatics.requiredRecursive}
138
+ */
139
+ SchemaFactoryAlpha.requiredRecursive = schemaFactory_js_1.schemaStatics.requiredRecursive;
113
140
  /**
114
141
  * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.
115
142
  */
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactoryAlpha.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryAlpha.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qDAOgC;AAChC,yDAM4B;AAiB5B;;;;;;;;GAQG;AACH,MAAa,kBAGX,SAAQ,gCAA4B;IAC7B,OAAO,CAA8B,IAAU;QACtD,OAAO,CACN,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE,CAC5B,CAAC;IACrC,CAAC;IAED;;;;;;OAMG;IACI,WAAW,CAKjB,IAAU,EACV,MAAS,EACT,OAAqD;QAcrD,OAAO,IAAA,uBAAY,EAClB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAClB,MAAM,EACN,IAAI,EACJ,OAAO,EAAE,0BAA0B;YAClC,oDAAiC,CAAC,0BAA0B,EAC7D,OAAO,EAAE,QAAQ,CACjB,CAAC;IACH,CAAC;IAED;;OAEG;IACa,eAAe,CAK9B,IAAU,EACV,CAAI,EACJ,OAAqD;QAwBrD,OAAO,IAAI,CAAC,WAAW,CACtB,IAAI,EACJ,CAAqD,EACrD,OAAO,CAgBN,CAAC;IACJ,CAAC;IA2BD;;;;;;;;;;;;;OAaG;IACI,QAAQ,CAKd,IAAU,EACV,YAAe,EACf,OAA4C;QAE5C,OAAO,IAAA,oBAAS,EAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACnF,CAAC;IAED;;OAEG;IACH,4EAA4E;IAC5D,YAAY,CAI1B,IAAU,EAAE,YAAe,EAAE,OAA4C;QAC1E,OAAO,IAAI,CAAC,QAAQ,CACnB,IAAI,EACJ,YAAwC,EACxC,OAAO,CAKP,CAAC;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACI,UAAU,CAKhB,IAAU,EACV,YAAe,EACf,OAA4C;QAE5C,OAAO,IAAA,sBAAW,EAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACrF,CAAC;IAED;;OAEG;IACH,4EAA4E;IAC5D,cAAc,CAI5B,IAAU,EAAE,YAAe,EAAE,OAA4C;QAC1E,OAAO,IAAI,CAAC,UAAU,CACrB,IAAI,EACJ,YAAwC,EACxC,OAAO,CAKP,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,aAAa,CACnB,IAAO;QAEP,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,CAAC;;AArOF,gDAsOC;AA9HA;;GAEG;AAC6B,yBAAM,GAAG,gCAAa,CAAC,MAAM,CAAC;AAE9D;;GAEG;AAC6B,2BAAQ,GAAG,gCAAa,CAAC,QAAQ,CAAC;AAElE;;GAEG;AAC6B,2BAAQ,GAAG,gCAAa,CAAC,QAAQ,CAAC;AAElE;;GAEG;AAC6B,oCAAiB,GAAG,gCAAa,CAAC,iBAAiB,CAAC;AAEpF;;GAEG;AACoB,6BAAU,GAAG,gCAAa,CAAC,UAAU,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ArrayNodeCustomizableSchema,\n\tarraySchema,\n\ttype MapNodeCustomizableSchema,\n\tmapSchema,\n\ttype ObjectNodeSchema,\n\tobjectSchema,\n} from \"../node-kinds/index.js\";\nimport {\n\tdefaultSchemaFactoryObjectOptions,\n\tSchemaFactory,\n\tschemaStatics,\n\ttype SchemaFactoryObjectOptions,\n\ttype ScopedSchemaName,\n} from \"./schemaFactory.js\";\nimport type {\n\tImplicitAllowedTypes,\n\tImplicitAnnotatedAllowedTypes,\n\tImplicitAnnotatedFieldSchema,\n\tImplicitFieldSchema,\n\tNodeSchemaOptions,\n} from \"../schemaTypes.js\";\nimport type { RestrictiveStringRecord } from \"../../util/index.js\";\nimport type { NodeKind, TreeNodeSchemaClass } from \"../core/index.js\";\nimport type {\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n} from \"./typesUnsafe.js\";\nimport type { SimpleObjectNodeSchema } from \"../simpleSchema.js\";\n\n/**\n * {@link SchemaFactory} with additional alpha APIs.\n *\n * @alpha\n * @privateRemarks\n *\n * Some private methods on `SchemaFactory` are intentionally duplicated here to avoid increasing their exposure to `protected`.\n * If we were to do so, they would be exposed on the public API surface of `SchemaFactory`.\n */\nexport class SchemaFactoryAlpha<\n\tout TScope extends string | undefined = string | undefined,\n\tTName extends number | string = string,\n> extends SchemaFactory<TScope, TName> {\n\tprivate scoped2<Name extends TName | string>(name: Name): ScopedSchemaName<TScope, Name> {\n\t\treturn (\n\t\t\tthis.scope === undefined ? `${name}` : `${this.scope}.${name}`\n\t\t) as ScopedSchemaName<TScope, Name>;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n\t * @param options - Additional options for the schema.\n\t */\n\tpublic objectAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tfields: T,\n\t\toptions?: SchemaFactoryObjectOptions<TCustomMetadata>,\n\t): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> & {\n\t\t/**\n\t\t * Typing checking workaround: not for for actual use.\n\t\t * @remarks\n\t\t * This API collides with {@link TreeNodeSchemaCore.createFromInsertable} to disable a type checking optimization which produces different and undesired results.\n\t\t * See {@link https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2773459693} for more details.\n\t\t * @privateRemarks\n\t\t * The specific issue here is non-empty POJO mode object schema not being assignable to `ObjectNodeSchema`,\n\t\t * See the above link and the tests in objectNode.spec.ts which reference it.\n\t\t * @system\n\t\t */\n\t\treadonly createFromInsertable: unknown;\n\t} {\n\t\treturn objectSchema(\n\t\t\tthis.scoped2(name),\n\t\t\tfields,\n\t\t\ttrue,\n\t\t\toptions?.allowUnknownOptionalFields ??\n\t\t\t\tdefaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,\n\t\t\toptions?.metadata,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritdoc SchemaFactory.objectRecursive}\n\t */\n\tpublic override objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tt: T,\n\t\toptions?: SchemaFactoryObjectOptions<TCustomMetadata>,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\tfalse,\n\t\tT,\n\t\tnever,\n\t\tTCustomMetadata\n\t> &\n\t\tSimpleObjectNodeSchema<TCustomMetadata> &\n\t\t// We can't just use non generic `ObjectNodeSchema` here since \"Base constructors must all have the same return type\".\n\t\t// We also can't just use generic `ObjectNodeSchema` here and not `TreeNodeSchemaClass` since that doesn't work with unsafe recursive types.\n\t\t// ObjectNodeSchema<\n\t\t// \tScopedSchemaName<TScope, Name>,\n\t\t// \t// T & RestrictiveStringRecord<ImplicitFieldSchema> would be nice to use here, but it breaks the recursive type self references.\n\t\t// \tRestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t// \tfalse,\n\t\t// \tTCustomMetadata\n\t\t// >\n\t\tPick<ObjectNodeSchema, \"fields\"> {\n\t\t// TODO: syntax highting is vs code is broken here. Don't trust it. Use the compiler instead.\n\t\ttype TScopedName = ScopedSchemaName<TScope, Name>;\n\t\treturn this.objectAlpha(\n\t\t\tname,\n\t\t\tt as T & RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\toptions,\n\t\t) as unknown as TreeNodeSchemaClass<\n\t\t\tTScopedName,\n\t\t\tNodeKind.Object,\n\t\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, TScopedName>,\n\t\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t\t> &\n\t\t\tObjectNodeSchema<\n\t\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\t\tRestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\t\tfalse,\n\t\t\t\tTCustomMetadata\n\t\t\t>;\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic static override readonly leaves = schemaStatics.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic static override readonly optional = schemaStatics.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic static override readonly required = schemaStatics.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic static override readonly optionalRecursive = schemaStatics.optionalRecursive;\n\n\t/**\n\t * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.\n\t */\n\tpublic static readonly identifier = schemaStatics.identifier;\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear as values in the map.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedMap extends factory.map(\"name\", factory.number, {\n\t * \tmetadata: { description: \"A map of numbers\" }\n\t * }) {}\n\t * ```\n\t */\n\tpublic mapAlpha<\n\t\tName extends TName,\n\t\tconst T extends ImplicitAnnotatedAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptions<TCustomMetadata>,\n\t): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn mapSchema(this.scoped2(name), allowedTypes, true, true, options?.metadata);\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaFactory.objectRecursive}\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override mapRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>) {\n\t\treturn this.mapAlpha(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\toptions,\n\t\t) as unknown as MapNodeCustomizableSchemaUnsafe<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tT,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the array.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedArray extends factory.arrayAlpha(\"name\", factory.number) {}\n\t * ```\n\t */\n\tpublic arrayAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends ImplicitAnnotatedAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptions<TCustomMetadata>,\n\t): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn arraySchema(this.scoped2(name), allowedTypes, true, true, options?.metadata);\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaFactory.objectRecursive}\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override arrayRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>) {\n\t\treturn this.arrayAlpha(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\toptions,\n\t\t) as unknown as ArrayNodeCustomizableSchemaUnsafe<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tT,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Create a {@link SchemaFactory} with a {@link SchemaFactory.scope|scope} which is a combination of this factory's scope and the provided name.\n\t * @remarks\n\t * The main use-case for this is when creating a collection of related schema (for example using a function that creates multiple schema).\n\t * Creating such related schema using a sub-scope helps ensure they won't collide with other schema in the parent scope.\n\t */\n\tpublic scopedFactory<const T extends TName, TNameInner extends number | string = string>(\n\t\tname: T,\n\t): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner> {\n\t\treturn new SchemaFactoryAlpha(this.scoped2(name));\n\t}\n}\n"]}
1
+ {"version":3,"file":"schemaFactoryAlpha.js","sourceRoot":"","sources":["../../../src/simple-tree/api/schemaFactoryAlpha.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qDAOgC;AAChC,yDAM4B;AAiB5B;;;;;;;;GAQG;AACH,MAAa,kBAGX,SAAQ,gCAA4B;IAHtC;;QAuIC;;WAEG;QACsB,WAAM,GAAG,gCAAa,CAAC,MAAM,CAAC;QA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E,OAAO,IAAI,CAAC,QAAQ,CACnB,IAAI,EACJ,YAAwC,EACxC,OAAO,CAKP,CAAC;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACI,UAAU,CAKhB,IAAU,EACV,YAAe,EACf,OAAiD;QAEjD,OAAO,IAAA,sBAAW,EACjB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAClB,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,iBAAiB,CAC1B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,4EAA4E;IAC5D,cAAc,CAI5B,IAAU,EAAE,YAAe,EAAE,OAAiD;QAC/E,OAAO,IAAI,CAAC,UAAU,CACrB,IAAI,EACJ,YAAwC,EACxC,OAAO,CAKP,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,aAAa,CACnB,IAAO;QAEP,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,CAAC;;AAlRF,gDAmRC;AA1KA;;GAEG;AAC6B,yBAAM,GAAG,gCAAa,CAAC,MAAM,AAAvB,CAAwB;AAE9D;;GAEG;AAC6B,2BAAQ,GAAG,gCAAa,CAAC,QAAQ,AAAzB,CAA0B;AAElE;;GAEG;AAC6B,2BAAQ,GAAG,gCAAa,CAAC,QAAQ,AAAzB,CAA0B;AAElE;;GAEG;AAC6B,oCAAiB,GAAG,gCAAa,CAAC,iBAAiB,AAAlC,CAAmC;AAEpF;;GAEG;AAC6B,oCAAiB,GAAG,gCAAa,CAAC,iBAAiB,AAAlC,CAAmC;AAEpF;;GAEG;AACoB,6BAAU,GAAG,gCAAa,CAAC,UAAU,AAA3B,CAA4B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ArrayNodeCustomizableSchema,\n\tarraySchema,\n\ttype MapNodeCustomizableSchema,\n\tmapSchema,\n\ttype ObjectNodeSchema,\n\tobjectSchema,\n} from \"../node-kinds/index.js\";\nimport {\n\tdefaultSchemaFactoryObjectOptions,\n\tSchemaFactory,\n\tschemaStatics,\n\ttype SchemaFactoryObjectOptions,\n\ttype ScopedSchemaName,\n} from \"./schemaFactory.js\";\nimport type {\n\tImplicitAllowedTypes,\n\tImplicitAnnotatedAllowedTypes,\n\tImplicitAnnotatedFieldSchema,\n\tImplicitFieldSchema,\n\tNodeSchemaOptionsAlpha,\n} from \"../schemaTypes.js\";\nimport type { RestrictiveStringRecord } from \"../../util/index.js\";\nimport type { NodeKind, TreeNodeSchemaClass } from \"../core/index.js\";\nimport type {\n\tArrayNodeCustomizableSchemaUnsafe,\n\tMapNodeCustomizableSchemaUnsafe,\n\tSystem_Unsafe,\n} from \"./typesUnsafe.js\";\nimport type { SimpleObjectNodeSchema } from \"../simpleSchema.js\";\n\n/**\n * {@link SchemaFactory} with additional alpha APIs.\n *\n * @alpha\n * @privateRemarks\n *\n * Some private methods on `SchemaFactory` are intentionally duplicated here to avoid increasing their exposure to `protected`.\n * If we were to do so, they would be exposed on the public API surface of `SchemaFactory`.\n */\nexport class SchemaFactoryAlpha<\n\tout TScope extends string | undefined = string | undefined,\n\tTName extends number | string = string,\n> extends SchemaFactory<TScope, TName> {\n\tprivate scoped2<Name extends TName | string>(name: Name): ScopedSchemaName<TScope, Name> {\n\t\treturn (\n\t\t\tthis.scope === undefined ? `${name}` : `${this.scope}.${name}`\n\t\t) as ScopedSchemaName<TScope, Name>;\n\t}\n\n\t/**\n\t * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n\t * @param options - Additional options for the schema.\n\t */\n\tpublic objectAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tfields: T,\n\t\toptions?: SchemaFactoryObjectOptions<TCustomMetadata>,\n\t): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> & {\n\t\t/**\n\t\t * Typing checking workaround: not for for actual use.\n\t\t * @remarks\n\t\t * This API collides with {@link TreeNodeSchemaCore.createFromInsertable} to disable a type checking optimization which produces different and undesired results.\n\t\t * See {@link https://github.com/microsoft/TypeScript/issues/59049#issuecomment-2773459693} for more details.\n\t\t * @privateRemarks\n\t\t * The specific issue here is non-empty POJO mode object schema not being assignable to `ObjectNodeSchema`,\n\t\t * See the above link and the tests in objectNode.spec.ts which reference it.\n\t\t * @system\n\t\t */\n\t\treadonly createFromInsertable: unknown;\n\t} {\n\t\treturn objectSchema(\n\t\t\tthis.scoped2(name),\n\t\t\tfields,\n\t\t\ttrue,\n\t\t\toptions?.allowUnknownOptionalFields ??\n\t\t\t\tdefaultSchemaFactoryObjectOptions.allowUnknownOptionalFields,\n\t\t\toptions?.metadata,\n\t\t\toptions?.persistedMetadata,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritdoc SchemaFactory.objectRecursive}\n\t */\n\tpublic override objectRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tt: T,\n\t\toptions?: SchemaFactoryObjectOptions<TCustomMetadata>,\n\t): TreeNodeSchemaClass<\n\t\tScopedSchemaName<TScope, Name>,\n\t\tNodeKind.Object,\n\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>,\n\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\tfalse,\n\t\tT,\n\t\tnever,\n\t\tTCustomMetadata\n\t> &\n\t\tSimpleObjectNodeSchema<TCustomMetadata> &\n\t\t// We can't just use non generic `ObjectNodeSchema` here since \"Base constructors must all have the same return type\".\n\t\t// We also can't just use generic `ObjectNodeSchema` here and not `TreeNodeSchemaClass` since that doesn't work with unsafe recursive types.\n\t\t// ObjectNodeSchema<\n\t\t// \tScopedSchemaName<TScope, Name>,\n\t\t// \t// T & RestrictiveStringRecord<ImplicitFieldSchema> would be nice to use here, but it breaks the recursive type self references.\n\t\t// \tRestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t// \tfalse,\n\t\t// \tTCustomMetadata\n\t\t// >\n\t\tPick<ObjectNodeSchema, \"fields\"> {\n\t\t// TODO: syntax highting is vs code is broken here. Don't trust it. Use the compiler instead.\n\t\ttype TScopedName = ScopedSchemaName<TScope, Name>;\n\t\treturn this.objectAlpha(\n\t\t\tname,\n\t\t\tt as T & RestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\toptions,\n\t\t) as unknown as TreeNodeSchemaClass<\n\t\t\tTScopedName,\n\t\t\tNodeKind.Object,\n\t\t\tSystem_Unsafe.TreeObjectNodeUnsafe<T, TScopedName>,\n\t\t\tobject & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>,\n\t\t\tfalse,\n\t\t\tT,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t\t> &\n\t\t\tObjectNodeSchema<\n\t\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\t\tRestrictiveStringRecord<ImplicitFieldSchema>,\n\t\t\t\tfalse,\n\t\t\t\tTCustomMetadata\n\t\t\t>;\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic static override readonly leaves = schemaStatics.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic static override readonly optional = schemaStatics.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic static override readonly required = schemaStatics.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic static override readonly optionalRecursive = schemaStatics.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic static override readonly requiredRecursive = schemaStatics.requiredRecursive;\n\n\t/**\n\t * Like {@link SchemaFactory.identifier} but static and a factory function that can be provided {@link FieldProps}.\n\t */\n\tpublic static readonly identifier = schemaStatics.identifier;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.leaves}\n\t */\n\tpublic override readonly leaves = schemaStatics.leaves;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optional}\n\t */\n\tpublic override readonly optional = schemaStatics.optional;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.required}\n\t */\n\tpublic override readonly required = schemaStatics.required;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.optionalRecursive}\n\t */\n\tpublic override readonly optionalRecursive = schemaStatics.optionalRecursive;\n\n\t/**\n\t * {@inheritDoc SchemaStatics.requiredRecursive}\n\t */\n\tpublic override readonly requiredRecursive = schemaStatics.requiredRecursive;\n\n\t/**\n\t * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear as values in the map.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedMap extends factory.map(\"name\", factory.number, {\n\t * \tmetadata: { description: \"A map of numbers\" }\n\t * }) {}\n\t * ```\n\t */\n\tpublic mapAlpha<\n\t\tName extends TName,\n\t\tconst T extends ImplicitAnnotatedAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn mapSchema(\n\t\t\tthis.scoped2(name),\n\t\t\tallowedTypes,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\toptions?.metadata,\n\t\t\toptions?.persistedMetadata,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaFactory.objectRecursive}\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override mapRecursive<\n\t\tName extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {\n\t\treturn this.mapAlpha(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\toptions,\n\t\t) as unknown as MapNodeCustomizableSchemaUnsafe<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tT,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.\n\t *\n\t * @param name - Unique identifier for this schema within this factory's scope.\n\t * @param allowedTypes - The types that may appear in the array.\n\t * @param options - Additional options for the schema.\n\t *\n\t * @example\n\t * ```typescript\n\t * class NamedArray extends factory.arrayAlpha(\"name\", factory.number) {}\n\t * ```\n\t */\n\tpublic arrayAlpha<\n\t\tconst Name extends TName,\n\t\tconst T extends ImplicitAnnotatedAllowedTypes,\n\t\tconst TCustomMetadata = unknown,\n\t>(\n\t\tname: Name,\n\t\tallowedTypes: T,\n\t\toptions?: NodeSchemaOptionsAlpha<TCustomMetadata>,\n\t): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> {\n\t\treturn arraySchema(\n\t\t\tthis.scoped2(name),\n\t\t\tallowedTypes,\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\toptions?.metadata,\n\t\t\toptions?.persistedMetadata,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc SchemaFactory.objectRecursive}\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic override arrayRecursive<\n\t\tconst Name extends TName,\n\t\tconst T extends System_Unsafe.ImplicitAllowedTypesUnsafe,\n\t\tconst TCustomMetadata = unknown,\n\t>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>) {\n\t\treturn this.arrayAlpha(\n\t\t\tname,\n\t\t\tallowedTypes as T & ImplicitAllowedTypes,\n\t\t\toptions,\n\t\t) as unknown as ArrayNodeCustomizableSchemaUnsafe<\n\t\t\tScopedSchemaName<TScope, Name>,\n\t\t\tT,\n\t\t\tTCustomMetadata\n\t\t>;\n\t}\n\n\t/**\n\t * Create a {@link SchemaFactory} with a {@link SchemaFactory.scope|scope} which is a combination of this factory's scope and the provided name.\n\t * @remarks\n\t * The main use-case for this is when creating a collection of related schema (for example using a function that creates multiple schema).\n\t * Creating such related schema using a sub-scope helps ensure they won't collide with other schema in the parent scope.\n\t */\n\tpublic scopedFactory<const T extends TName, TNameInner extends number | string = string>(\n\t\tname: T,\n\t): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner> {\n\t\treturn new SchemaFactoryAlpha(this.scoped2(name));\n\t}\n}\n"]}
@@ -43,8 +43,8 @@ const schemaCompatibilityTester_js_1 = require("./schemaCompatibilityTester.js")
43
43
  */
44
44
  function extractPersistedSchema(schema, oldestCompatibleClient) {
45
45
  const stored = (0, toStoredSchema_js_1.simpleToStoredSchema)(schema);
46
- const writeVersion = (0, index_js_3.clientVersionToSchemaVersion)(oldestCompatibleClient);
47
- return (0, index_js_2.encodeTreeSchema)(stored, writeVersion);
46
+ const schemaWriteVersion = (0, index_js_3.clientVersionToSchemaVersion)(oldestCompatibleClient);
47
+ return (0, index_js_2.encodeTreeSchema)(stored, schemaWriteVersion);
48
48
  }
49
49
  exports.extractPersistedSchema = extractPersistedSchema;
50
50
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"storedSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/storedSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kDAAoD;AACpD,+DAI0C;AAC1C,4EAIuD;AAEvD,sDAAmF;AAEnF,4DAA4D;AAE5D,iFAA2E;AAG3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAgB,sBAAsB,CACrC,MAAwB,EACxB,sBAA0C;IAE1C,MAAM,MAAM,GAAG,IAAA,wCAAoB,EAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,YAAY,GAAG,IAAA,uCAA4B,EAAC,sBAAsB,CAAC,CAAC;IAC1E,OAAO,IAAA,2BAAgB,EAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAC/C,CAAC;AAPD,wDAOC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAgB,sBAAsB,CACrC,SAAyB,EACzB,IAAyB,EACzB,OAAsB;IAEtB,0DAA0D;IAC1D,2JAA2J;IAC3J,MAAM,WAAW,GAAG,IAAA,0BAAe,EAAC,OAAO,EAAE,wBAAa,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,SAAmB,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,IAAI,wDAAyB,CAC/C,8BAAmB,EACnB,EAAE,EACF,IAAA,qCAAoB,EAAC,IAAI,CAAC,CAC1B,CAAC;IACF,OAAO,UAAU,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC;AAfD,wDAeC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FluidClientVersion, ICodecOptions } from \"../../codec/index.js\";\nimport { SchemaVersion } from \"../../core/index.js\";\nimport {\n\tdefaultSchemaPolicy,\n\tencodeTreeSchema,\n\tmakeSchemaCodec,\n} from \"../../feature-libraries/index.js\";\nimport {\n\tclientVersionToSchemaVersion,\n\ttype Format,\n\t// eslint-disable-next-line import/no-internal-modules\n} from \"../../feature-libraries/schema-index/index.js\";\nimport type { JsonCompatible } from \"../../util/index.js\";\nimport { normalizeFieldSchema, type ImplicitFieldSchema } from \"../schemaTypes.js\";\nimport type { SimpleTreeSchema } from \"../simpleSchema.js\";\nimport { simpleToStoredSchema } from \"../toStoredSchema.js\";\n\nimport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\n\n/**\n * Dumps the \"persisted\" schema subset of the provided `schema` into a deterministic JSON-compatible, semi-human-readable format.\n *\n * @param schema - The schema to dump.\n *\n * @remarks\n * This can be used to help inspect schema for debugging, and to save a snapshot of schema to help detect and review changes to an applications schema.\n * This format is also compatible with {@link ViewContent.schema}, {@link comparePersistedSchema} and {@link persistedToSimpleSchema}.\n *\n * This only includes the \"persisted\" subset of schema information, which means the portion which gets included in documents.\n * It thus uses \"persisted\" keys, see {@link FieldProps.key}.\n *\n * If two schema have identical \"persisted\" schema, then they are considered {@link SchemaCompatibilityStatus.isEquivalent|equivalent}.\n *\n * See also {@link comparePersistedSchema}.\n *\n * @example\n * An application could use this API to generate a `schema.json` file when it first releases,\n * then test that the schema is sill compatible with documents from that version with a test like :\n * ```typescript\n * assert.deepEqual(extractPersistedSchema(MySchema, FluidClientVersion.v2_0), require(\"./schema.json\"));\n * ```\n *\n * @privateRemarks\n * This currently uses the schema summary format, but that could be changed to something more human readable (particularly if the encoded format becomes less human readable).\n * This intentionally does not leak the format types in the API.\n *\n * Public API surface uses \"persisted\" terminology while internally we use \"stored\".\n * @alpha\n */\nexport function extractPersistedSchema(\n\tschema: SimpleTreeSchema,\n\toldestCompatibleClient: FluidClientVersion,\n): JsonCompatible {\n\tconst stored = simpleToStoredSchema(schema);\n\tconst writeVersion = clientVersionToSchemaVersion(oldestCompatibleClient);\n\treturn encodeTreeSchema(stored, writeVersion);\n}\n\n/**\n * Compares two schema extracted using {@link extractPersistedSchema}.\n * Reports the same compatibility that {@link TreeView.compatibility} would report if\n * opening a document that used the `persisted` schema and provided `view` to {@link ViewableTree.viewWith}.\n *\n * @param persisted - Schema persisted for a document. Typically persisted alongside the data and assumed to describe that data.\n * @param view - Schema which would be used to view persisted content.\n * @param options - {@link ICodecOptions} used when parsing the provided schema.\n * @param canInitialize - Passed through to the return value unchanged and otherwise unused.\n * @returns The {@link SchemaCompatibilityStatus} a {@link TreeView} would report for this combination of schema.\n *\n * @remarks\n * This uses the persisted formats for schema, meaning it only includes data which impacts compatibility.\n * It also uses the persisted format so that this API can be used in tests to compare against saved schema from previous versions of the application.\n *\n * @example\n * An application could use {@link extractPersistedSchema} to generate a `schema.json` file for various versions of the app,\n * then test that documents using those schema can be upgraded to work with the current schema using a test like:\n * ```typescript\n * assert(\n * \tcomparePersistedSchema(\n * \t\trequire(\"./schema.json\"),\n * \t\tMySchema,\n * \t\t{ jsonValidator: typeboxValidator },\n * \t\tfalse,\n * \t).canUpgrade,\n * );\n * ```\n * @alpha\n */\nexport function comparePersistedSchema(\n\tpersisted: JsonCompatible,\n\tview: ImplicitFieldSchema,\n\toptions: ICodecOptions,\n): Omit<SchemaCompatibilityStatus, \"canInitialize\"> {\n\t// Any version can be passed down to makeSchemaCodec here.\n\t// We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.\n\tconst schemaCodec = makeSchemaCodec(options, SchemaVersion.v1);\n\tconst stored = schemaCodec.decode(persisted as Format);\n\tconst viewSchema = new SchemaCompatibilityTester(\n\t\tdefaultSchemaPolicy,\n\t\t{},\n\t\tnormalizeFieldSchema(view),\n\t);\n\treturn viewSchema.checkCompatibility(stored);\n}\n"]}
1
+ {"version":3,"file":"storedSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/storedSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kDAAoD;AACpD,+DAI0C;AAC1C,4EAIuD;AAEvD,sDAAmF;AAEnF,4DAA4D;AAE5D,iFAA2E;AAG3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAgB,sBAAsB,CACrC,MAAwB,EACxB,sBAA0C;IAE1C,MAAM,MAAM,GAAG,IAAA,wCAAoB,EAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,kBAAkB,GAAG,IAAA,uCAA4B,EAAC,sBAAsB,CAAC,CAAC;IAChF,OAAO,IAAA,2BAAgB,EAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AACrD,CAAC;AAPD,wDAOC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,SAAgB,sBAAsB,CACrC,SAAyB,EACzB,IAAyB,EACzB,OAAsB;IAEtB,0DAA0D;IAC1D,2JAA2J;IAC3J,MAAM,WAAW,GAAG,IAAA,0BAAe,EAAC,OAAO,EAAE,wBAAa,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,SAAqB,CAAC,CAAC;IACzD,MAAM,UAAU,GAAG,IAAI,wDAAyB,CAC/C,8BAAmB,EACnB,EAAE,EACF,IAAA,qCAAoB,EAAC,IAAI,CAAC,CAC1B,CAAC;IACF,OAAO,UAAU,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC;AAfD,wDAeC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FluidClientVersion, ICodecOptions } from \"../../codec/index.js\";\nimport { SchemaVersion } from \"../../core/index.js\";\nimport {\n\tdefaultSchemaPolicy,\n\tencodeTreeSchema,\n\tmakeSchemaCodec,\n} from \"../../feature-libraries/index.js\";\nimport {\n\tclientVersionToSchemaVersion,\n\ttype FormatV1,\n\t// eslint-disable-next-line import/no-internal-modules\n} from \"../../feature-libraries/schema-index/index.js\";\nimport type { JsonCompatible } from \"../../util/index.js\";\nimport { normalizeFieldSchema, type ImplicitFieldSchema } from \"../schemaTypes.js\";\nimport type { SimpleTreeSchema } from \"../simpleSchema.js\";\nimport { simpleToStoredSchema } from \"../toStoredSchema.js\";\n\nimport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\n\n/**\n * Dumps the \"persisted\" schema subset of the provided `schema` into a deterministic JSON-compatible, semi-human-readable format.\n *\n * @param schema - The schema to dump.\n *\n * @remarks\n * This can be used to help inspect schema for debugging, and to save a snapshot of schema to help detect and review changes to an applications schema.\n * This format is also compatible with {@link ViewContent.schema}, {@link comparePersistedSchema} and {@link persistedToSimpleSchema}.\n *\n * This only includes the \"persisted\" subset of schema information, which means the portion which gets included in documents.\n * It thus uses \"persisted\" keys, see {@link FieldProps.key}.\n *\n * If two schema have identical \"persisted\" schema, then they are considered {@link SchemaCompatibilityStatus.isEquivalent|equivalent}.\n *\n * See also {@link comparePersistedSchema}.\n *\n * @example\n * An application could use this API to generate a `schema.json` file when it first releases,\n * then test that the schema is sill compatible with documents from that version with a test like :\n * ```typescript\n * assert.deepEqual(extractPersistedSchema(MySchema, FluidClientVersion.v2_0), require(\"./schema.json\"));\n * ```\n *\n * @privateRemarks\n * This currently uses the schema summary format, but that could be changed to something more human readable (particularly if the encoded format becomes less human readable).\n * This intentionally does not leak the format types in the API.\n *\n * Public API surface uses \"persisted\" terminology while internally we use \"stored\".\n * @alpha\n */\nexport function extractPersistedSchema(\n\tschema: SimpleTreeSchema,\n\toldestCompatibleClient: FluidClientVersion,\n): JsonCompatible {\n\tconst stored = simpleToStoredSchema(schema);\n\tconst schemaWriteVersion = clientVersionToSchemaVersion(oldestCompatibleClient);\n\treturn encodeTreeSchema(stored, schemaWriteVersion);\n}\n\n/**\n * Compares two schema extracted using {@link extractPersistedSchema}.\n * Reports the same compatibility that {@link TreeView.compatibility} would report if\n * opening a document that used the `persisted` schema and provided `view` to {@link ViewableTree.viewWith}.\n *\n * @param persisted - Schema persisted for a document. Typically persisted alongside the data and assumed to describe that data.\n * @param view - Schema which would be used to view persisted content.\n * @param options - {@link ICodecOptions} used when parsing the provided schema.\n * @param canInitialize - Passed through to the return value unchanged and otherwise unused.\n * @returns The {@link SchemaCompatibilityStatus} a {@link TreeView} would report for this combination of schema.\n *\n * @remarks\n * This uses the persisted formats for schema, meaning it only includes data which impacts compatibility.\n * It also uses the persisted format so that this API can be used in tests to compare against saved schema from previous versions of the application.\n *\n * @example\n * An application could use {@link extractPersistedSchema} to generate a `schema.json` file for various versions of the app,\n * then test that documents using those schema can be upgraded to work with the current schema using a test like:\n * ```typescript\n * assert(\n * \tcomparePersistedSchema(\n * \t\trequire(\"./schema.json\"),\n * \t\tMySchema,\n * \t\t{ jsonValidator: typeboxValidator },\n * \t\tfalse,\n * \t).canUpgrade,\n * );\n * ```\n * @alpha\n */\nexport function comparePersistedSchema(\n\tpersisted: JsonCompatible,\n\tview: ImplicitFieldSchema,\n\toptions: ICodecOptions,\n): Omit<SchemaCompatibilityStatus, \"canInitialize\"> {\n\t// Any version can be passed down to makeSchemaCodec here.\n\t// We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.\n\tconst schemaCodec = makeSchemaCodec(options, SchemaVersion.v1);\n\tconst stored = schemaCodec.decode(persisted as FormatV1);\n\tconst viewSchema = new SchemaCompatibilityTester(\n\t\tdefaultSchemaPolicy,\n\t\t{},\n\t\tnormalizeFieldSchema(view),\n\t);\n\treturn viewSchema.checkCompatibility(stored);\n}\n"]}
@@ -25,7 +25,10 @@
25
25
  */
26
26
  export interface TreeChangeEvents {
27
27
  /**
28
- * Emitted by a node after a batch of changes has been applied to the tree, if any of the changes affected the node.
28
+ * Emitted by a node if any changes affected the node.
29
+ *
30
+ * This event is emitted after all the changes in a batch have been applied to the whole tree.
31
+ * This means that a handler for this event will be able to read the updated state of the tree.
29
32
  *
30
33
  * - Object nodes define a change as being when the value of one of its properties changes (i.e., the property's value is set, including when set to `undefined`).
31
34
  *
@@ -63,8 +66,10 @@ export interface TreeChangeEvents {
63
66
  */
64
67
  nodeChanged(unstable?: unknown): void;
65
68
  /**
66
- * Emitted by a node after a batch of changes has been applied to the tree, when something changed anywhere in the
67
- * subtree rooted at it.
69
+ * Emitted by a node if something changed anywhere in the subtree rooted at it.
70
+ *
71
+ * This event is emitted after all the changes in a batch have been applied to the whole tree.
72
+ * This means that a handler for this event will be able to read the updated state of the tree.
68
73
  *
69
74
  * @remarks
70
75
  * This event is not emitted when the node itself is moved to a different location in the tree or removed from the tree.
@@ -1 +1 @@
1
- {"version":3,"file":"treeChangeEvents.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/treeChangeEvents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,WAAW,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEtC;;;;;;;;;;;;;;;OAeG;IACH,WAAW,IAAI,IAAI,CAAC;CACpB"}
1
+ {"version":3,"file":"treeChangeEvents.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/treeChangeEvents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACH,WAAW,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEtC;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,IAAI,IAAI,CAAC;CACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"treeChangeEvents.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeChangeEvents.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A collection of events that can be emitted by a {@link TreeNode}.\n *\n * @privateRemarks\n * TODO: add a way to subscribe to a specific field (for nodeChanged and treeChanged).\n * Probably have object node and map node specific APIs for this.\n *\n * TODO: ensure that subscription API for fields aligns with API for subscribing to the root.\n *\n * TODO: add more wider area (avoid needing tons of nodeChanged registration) events for use-cases other than treeChanged.\n * Some ideas:\n *\n * - treeChanged, but with some subtrees/fields/paths excluded\n * - helper to batch several nodeChanged calls to a treeChanged scope\n * - parent change (ex: registration on the parent field for a specific index: maybe allow it for a range. Ex: node event takes optional field and optional index range?)\n * - new content inserted into subtree. Either provide event for this and/or enough info to treeChanged to find and search the new sub-trees.\n * Add separate (non event related) API to efficiently scan tree for given set of types (using low level cursor and schema based filtering)\n * to allow efficiently searching for new content (and initial content) of a given type.\n *\n * @sealed @public\n */\nexport interface TreeChangeEvents {\n\t/**\n\t * Emitted by a node after a batch of changes has been applied to the tree, if any of the changes affected the node.\n\t *\n\t * - Object nodes define a change as being when the value of one of its properties changes (i.e., the property's value is set, including when set to `undefined`).\n\t *\n\t * - Array nodes define a change as when an element is added, removed, moved or replaced.\n\t *\n\t * - Map nodes define a change as when an entry is added, updated, or removed.\n\t *\n\t * @param unstable - Future versions of this API (such as the one in beta on TreeBeta) may use this argument to provide additional data to the event.\n\t * users of this event should ensure that they do not provide a listener callback which has an optional parameter in this position, since unexpected data might get provided to it.\n\t * This parameter exists to capture this fact in the type system.\n\t * Using an inline lambda expression as the listener callback is a good pattern to avoid cases like this were arguments are added from breaking due to optional arguments.\n\t *\n\t * @remarks\n\t * This event is not emitted when:\n\t *\n\t * - Properties of a child node change. Notably, updates to an array node or a map node (like adding or removing\n\t * elements/entries) will emit this event on the array/map node itself, but not on the node that contains the\n\t * array/map node as one of its properties.\n\t *\n\t * - The node is moved to a different location in the tree or removed from the tree.\n\t * In this case the event is emitted on the _parent_ node, not the node itself.\n\t *\n\t * For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in\n\t * the client that made the original edit.\n\t *\n\t * When the event is emitted, the tree is guaranteed to be in-schema.\n\t *\n\t * @privateRemarks\n\t * This event occurs whenever the apparent contents of the node instance change, regardless of what caused the change.\n\t * For example, it will fire when the local client reassigns a child, when part of a remote edit is applied to the\n\t * node, or when the node has to be updated due to resolution of a merge conflict\n\t * (for example a previously applied local change might be undone, then reapplied differently or not at all).\n\t *\n\t * TODO: define and document event ordering (ex: bottom up, with nodeChanged before treeChange on each level).\n\t */\n\tnodeChanged(unstable?: unknown): void;\n\n\t/**\n\t * Emitted by a node after a batch of changes has been applied to the tree, when something changed anywhere in the\n\t * subtree rooted at it.\n\t *\n\t * @remarks\n\t * This event is not emitted when the node itself is moved to a different location in the tree or removed from the tree.\n\t * In that case it is emitted on the _parent_ node, not the node itself.\n\t *\n\t * The node itself is part of the subtree, so this event will be emitted even if the only changes are to the properties\n\t * of the node itself.\n\t *\n\t * For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in\n\t * the client that made the original edit.\n\t *\n\t * When it is emitted, the tree is guaranteed to be in-schema.\n\t */\n\ttreeChanged(): void;\n}\n"]}
1
+ {"version":3,"file":"treeChangeEvents.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeChangeEvents.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * A collection of events that can be emitted by a {@link TreeNode}.\n *\n * @privateRemarks\n * TODO: add a way to subscribe to a specific field (for nodeChanged and treeChanged).\n * Probably have object node and map node specific APIs for this.\n *\n * TODO: ensure that subscription API for fields aligns with API for subscribing to the root.\n *\n * TODO: add more wider area (avoid needing tons of nodeChanged registration) events for use-cases other than treeChanged.\n * Some ideas:\n *\n * - treeChanged, but with some subtrees/fields/paths excluded\n * - helper to batch several nodeChanged calls to a treeChanged scope\n * - parent change (ex: registration on the parent field for a specific index: maybe allow it for a range. Ex: node event takes optional field and optional index range?)\n * - new content inserted into subtree. Either provide event for this and/or enough info to treeChanged to find and search the new sub-trees.\n * Add separate (non event related) API to efficiently scan tree for given set of types (using low level cursor and schema based filtering)\n * to allow efficiently searching for new content (and initial content) of a given type.\n *\n * @sealed @public\n */\nexport interface TreeChangeEvents {\n\t/**\n\t * Emitted by a node if any changes affected the node.\n\t *\n\t * This event is emitted after all the changes in a batch have been applied to the whole tree.\n\t * This means that a handler for this event will be able to read the updated state of the tree.\n\t *\n\t * - Object nodes define a change as being when the value of one of its properties changes (i.e., the property's value is set, including when set to `undefined`).\n\t *\n\t * - Array nodes define a change as when an element is added, removed, moved or replaced.\n\t *\n\t * - Map nodes define a change as when an entry is added, updated, or removed.\n\t *\n\t * @param unstable - Future versions of this API (such as the one in beta on TreeBeta) may use this argument to provide additional data to the event.\n\t * users of this event should ensure that they do not provide a listener callback which has an optional parameter in this position, since unexpected data might get provided to it.\n\t * This parameter exists to capture this fact in the type system.\n\t * Using an inline lambda expression as the listener callback is a good pattern to avoid cases like this were arguments are added from breaking due to optional arguments.\n\t *\n\t * @remarks\n\t * This event is not emitted when:\n\t *\n\t * - Properties of a child node change. Notably, updates to an array node or a map node (like adding or removing\n\t * elements/entries) will emit this event on the array/map node itself, but not on the node that contains the\n\t * array/map node as one of its properties.\n\t *\n\t * - The node is moved to a different location in the tree or removed from the tree.\n\t * In this case the event is emitted on the _parent_ node, not the node itself.\n\t *\n\t * For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in\n\t * the client that made the original edit.\n\t *\n\t * When the event is emitted, the tree is guaranteed to be in-schema.\n\t *\n\t * @privateRemarks\n\t * This event occurs whenever the apparent contents of the node instance change, regardless of what caused the change.\n\t * For example, it will fire when the local client reassigns a child, when part of a remote edit is applied to the\n\t * node, or when the node has to be updated due to resolution of a merge conflict\n\t * (for example a previously applied local change might be undone, then reapplied differently or not at all).\n\t *\n\t * TODO: define and document event ordering (ex: bottom up, with nodeChanged before treeChange on each level).\n\t */\n\tnodeChanged(unstable?: unknown): void;\n\n\t/**\n\t * Emitted by a node if something changed anywhere in the subtree rooted at it.\n\t *\n\t * This event is emitted after all the changes in a batch have been applied to the whole tree.\n\t * This means that a handler for this event will be able to read the updated state of the tree.\n\t *\n\t * @remarks\n\t * This event is not emitted when the node itself is moved to a different location in the tree or removed from the tree.\n\t * In that case it is emitted on the _parent_ node, not the node itself.\n\t *\n\t * The node itself is part of the subtree, so this event will be emitted even if the only changes are to the properties\n\t * of the node itself.\n\t *\n\t * For remote edits, this event is not guaranteed to occur in the same order or quantity that it did in\n\t * the client that made the original edit.\n\t *\n\t * When it is emitted, the tree is guaranteed to be in-schema.\n\t */\n\ttreeChanged(): void;\n}\n"]}
@@ -43,6 +43,9 @@ export interface TreeNodeApi {
43
43
  * Return the node under which this node resides in the tree (or undefined if this is a root node of the tree).
44
44
  *
45
45
  * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.
46
+ *
47
+ * @see {@link (TreeAlpha:interface).child}
48
+ * @see {@link (TreeAlpha:interface).children}
46
49
  */
47
50
  parent(node: TreeNode): TreeNode | undefined;
48
51
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"treeNodeApi.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/treeNodeApi.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,KAAK,UAAU,EAA2B,MAAM,kCAAkC,CAAC;AAE5F,OAAO,EACN,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EACzB,KAAK,gCAAgC,EAErC,MAAM,mBAAmB,CAAC;AAW3B,OAAO,EAGN,KAAK,cAAc,EAEnB,KAAK,QAAQ,EAKb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI9D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,aAAa,GAAG,cAAc,CAAC;IAEvD;;;;;;;;OAQG;IACH,EAAE,CAAC,OAAO,SAAS,oBAAoB,EACtC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,OAAO,GACb,KAAK,IAAI,gCAAgC,CAAC,OAAO,CAAC,CAAC;IAEtD;;;;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AAG,SAAS,CAAC;CACrD;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,WA2FzB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,cAAc,CAuBvE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,kBAAkB,GAC7B,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAC/B,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,YAAY,GACvB,MAAM,GAAG,SAAS,CAAC;AACtB,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,cAAc,GACzB,MAAM,GAAG,SAAS,CAAC;AA2DtB;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAgB5D;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,MAAM,GAAG,MAAM,GACxB,MAAM,GAAG,MAAM,CAyBjB"}
@@ -137,7 +137,7 @@ function getIdentifierFromNode(node, compression) {
137
137
  const key = identifierFieldKeys[0] ?? (0, internal_1.oob)();
138
138
  const identifierField = flexNode.tryGetField(key);
139
139
  (0, internal_1.assert)(identifierField !== undefined, 0xbb5 /* missing identifier field */);
140
- const identifierValue = (0, getTreeNodeForField_js_1.getTreeNodeForField)(identifierField);
140
+ const identifierValue = (0, getTreeNodeForField_js_1.tryGetTreeNodeForField)(identifierField);
141
141
  (0, internal_1.assert)(typeof identifierValue === "string", 0xbb6 /* identifier not a string */);
142
142
  const context = flexNode.context;
143
143
  switch (compression) {
@@ -1 +1 @@
1
- {"version":3,"file":"treeNodeApi.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeNodeApi.ts"],"names":[],"mappings":";AAAA;;;GA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KAAK,KAAK,CAAC,EAAE,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAC5F,OAAO,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC;AAC/B,CAAC;AAhBD,oCAgBC;AAED;;GAEG;AACH,SAAgB,2BAA2B,CAC1C,MAAsB,EACtB,SAA0B;IAE1B,iHAAiH;IACjH,gFAAgF;IAChF,IAAI,MAAM,CAAC,IAAI,KAAK,mBAAQ,CAAC,MAAM,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,IAA2C,CAAC;IAElE,cAAc;IACd,iEAAiE;IACjE,uGAAuG;IACvG,6IAA6I;IAC7I,iEAAiE;IACjE,KAAK,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACjE,IAAI,WAAW,YAAY,4BAAW,IAAI,WAAW,CAAC,KAAK,EAAE,GAAG,KAAK,SAAS,EAAE,CAAC;YAChF,OAAO,WAAW,CAAC;QACpB,CAAC;IACF,CAAC;IAED,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE,CAAC;QACrC,IAAA,eAAI,EAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AA5BD,kEA4BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, oob, fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport { EmptyKey, rootFieldKey } from \"../../core/index.js\";\nimport { type TreeStatus, isTreeValue, FieldKinds } from \"../../feature-libraries/index.js\";\nimport { extractFromOpaque } from \"../../util/index.js\";\nimport {\n\ttype TreeLeafValue,\n\ttype ImplicitFieldSchema,\n\tFieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n} from \"../schemaTypes.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { Off } from \"@fluidframework/core-interfaces\";\nimport {\n\tgetKernel,\n\tisTreeNode,\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype TreeNode,\n\ttryGetTreeNodeSchema,\n\tgetOrCreateNodeFromInnerNode,\n\ttypeSchemaSymbol,\n\tgetOrCreateInnerNode,\n} from \"../core/index.js\";\nimport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\nimport { isObjectNodeSchema } from \"../node-kinds/index.js\";\nimport { getTreeNodeForField } from \"../getTreeNodeForField.js\";\n\n/**\n * Provides various functions for analyzing {@link TreeNode}s.\n *\n * @remarks\n * With the exception of {@link TreeNodeApi.status}, these functions should not be called with nodes that have\n * been {@link TreeStatus.Deleted | deleted}.\n * To verify whether or not a node already has been deleted, use the {@link TreeNodeApi.status} function.\n *\n * This type should only be used via the public {@link (Tree:variable)} export.\n *\n * @privateRemarks\n * Due to limitations of API-Extractor link resolution, this type can't be moved into internalTypes but should be considered just an implementation detail of the `Tree` export.\n *\n * Inlining the typing of this interface onto the `Tree` object provides slightly different .d.ts generation,\n * which avoids typescript expanding the type of TreeNodeSchema and thus encountering\n * https://github.com/microsoft/rushstack/issues/1958.\n * @sealed @public\n */\nexport interface TreeNodeApi {\n\t/**\n\t * The schema information for this node.\n\t */\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema;\n\n\t/**\n\t * Narrow the type of the given value if it satisfies the given schema.\n\t * @example\n\t * ```ts\n\t * if (node.is(myNode, Point)) {\n\t * const y = myNode.y; // `myNode` is now known to satisfy the `Point` schema and therefore has a `y` coordinate.\n\t * }\n\t * ```\n\t */\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema>;\n\n\t/**\n\t * Return the node under which this node resides in the tree (or undefined if this is a root node of the tree).\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.\n\t */\n\tparent(node: TreeNode): TreeNode | undefined;\n\n\t/**\n\t * The key of the given node under its parent.\n\t *\n\t * @remarks\n\t * If `node` is an element in a {@link (TreeArrayNode:interface)}, this returns the index of `node` in the array node (a `number`).\n\t * Otherwise, this returns the key of the field that it is under (a `string`).\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.\n\t */\n\tkey(node: TreeNode): string | number;\n\n\t/**\n\t * Register an event listener on the given node.\n\t * @param node - The node whose events should be subscribed to.\n\t * @param eventName - Which event to subscribe to.\n\t * @param listener - The callback to trigger for the event. The tree can be read during the callback, but it is invalid to modify the tree during this callback.\n\t * @returns A callback function which will deregister the event.\n\t * This callback should be called only once.\n\t */\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): () => void;\n\n\t/**\n\t * Returns the {@link TreeStatus} of the given node.\n\t */\n\tstatus(node: TreeNode): TreeStatus;\n\n\t/**\n\t * Returns the {@link SchemaFactory.identifier | identifier} of the given node in the most compressed form possible.\n\t * @remarks\n\t * If the node is {@link Unhydrated | hydrated} and its identifier is a valid UUID that was automatically generated by the SharedTree it is part of (or something else using the same {@link @fluidframework/id-compressor#IIdCompressor}), then this will return a process-unique integer corresponding to that identifier.\n\t * This is useful for performance-sensitive scenarios involving many nodes with identifiers that need to be compactly retained in memory or used for efficient lookup.\n\t * Note that automatically generated identifiers that were accessed before the node was hydrated will return the generated UUID, not the process-unique integer.\n\t *\n\t * If the node's identifier is any other user-provided string, then this will return that string.\n\t *\n\t * If the node has no identifier (that is, it has no {@link SchemaFactory.identifier | identifier} field), then this returns `undefined`.\n\t *\n\t * If the node has more than one identifier, then this will throw an error.\n\t *\n\t * The returned integer should not be serialized or preserved outside of the current process.\n\t * Its lifetime is that of the current in-memory instance of the FF container for this client, and it is not guaranteed to be unique or stable outside of that context.\n\t * The same node's identifier may, for example, be different across multiple sessions for the same client and document, or different across two clients in the same session.\n\t */\n\tshortId(node: TreeNode): number | string | undefined;\n}\n\n/**\n * {@inheritDoc TreeNodeApi}\n */\nexport const treeNodeApi: TreeNodeApi = {\n\tparent(node: TreeNode): TreeNode | undefined {\n\t\tconst editNode = getOrCreateInnerNode(node).parentField.parent.parent;\n\t\tif (editNode === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst output = getOrCreateNodeFromInnerNode(editNode);\n\t\tassert(\n\t\t\t!isTreeValue(output),\n\t\t\t0x87f /* Parent can't be a leaf, so it should be a node not a value */,\n\t\t);\n\t\treturn output;\n\t},\n\tkey(node: TreeNode): string | number {\n\t\t// If the parent is undefined, then this node is under the root field,\n\t\t// so we know its key is the special root one.\n\t\tconst parent = treeNodeApi.parent(node);\n\t\tif (parent === undefined) {\n\t\t\treturn rootFieldKey;\n\t\t}\n\n\t\t// The flex-domain strictly operates in terms of \"stored keys\".\n\t\t// To find the associated developer-facing \"property key\", we need to look up the field associated with\n\t\t// the stored key from the flex-domain, and get property key its simple-domain counterpart was created with.\n\t\tconst storedKey = getStoredKey(node);\n\t\tconst parentSchema = treeNodeApi.schema(parent);\n\t\tconst propertyKey = getPropertyKeyFromStoredKey(parentSchema, storedKey);\n\t\treturn propertyKey;\n\t},\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): Off {\n\t\tconst kernel = getKernel(node);\n\t\tswitch (eventName) {\n\t\t\tcase \"nodeChanged\": {\n\t\t\t\tconst nodeSchema = kernel.schema;\n\t\t\t\tif (isObjectNodeSchema(nodeSchema)) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tconst changedProperties = new Set(\n\t\t\t\t\t\t\tArray.from(\n\t\t\t\t\t\t\t\tchangedFields,\n\t\t\t\t\t\t\t\t(field) =>\n\t\t\t\t\t\t\t\t\tnodeSchema.storedKeyToPropertyKey.get(field) ??\n\t\t\t\t\t\t\t\t\tfail(0xb36 /* Could not find stored key in schema. */),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlistener({ changedProperties });\n\t\t\t\t\t});\n\t\t\t\t} else if (nodeSchema.kind === NodeKind.Array) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", () => {\n\t\t\t\t\t\tlistener({ changedProperties: undefined });\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tlistener({ changedProperties: changedFields });\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase \"treeChanged\": {\n\t\t\t\treturn kernel.events.on(\"subtreeChangedAfterBatch\", () => listener({}));\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new UsageError(`No event named ${JSON.stringify(eventName)}.`);\n\t\t}\n\t},\n\tstatus(node: TreeNode): TreeStatus {\n\t\treturn getKernel(node).getStatus();\n\t},\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema> {\n\t\t// This \"is\" utility would return false if the provided schema is a base type of the actual schema.\n\t\t// This could be confusing, and that case can only be hit when violating the rule that there is a single most derived schema that gets used (See documentation on TreeNodeSchemaClass).\n\t\t// Therefore this uses markSchemaMostDerived to ensure an informative usage error is thrown in the case where a base type is used.\n\n\t\tconst actualSchema = tryGetSchema(value);\n\t\tif (actualSchema === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn normalizeAllowedTypes(schema).has(actualSchema);\n\t},\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema {\n\t\treturn tryGetSchema(node) ?? fail(0xb37 /* Not a tree node */);\n\t},\n\tshortId(node: TreeNode): number | string | undefined {\n\t\treturn getIdentifierFromNode(node, \"preferCompressed\");\n\t},\n};\n\n/**\n * Returns a schema for a value if the value is a {@link TreeNode} or a {@link TreeLeafValue}.\n * Returns undefined for other values.\n */\nexport function tryGetSchema(value: unknown): undefined | TreeNodeSchema {\n\tswitch (typeof value) {\n\t\tcase \"string\":\n\t\t\treturn stringSchema;\n\t\tcase \"number\":\n\t\t\treturn numberSchema;\n\t\tcase \"boolean\":\n\t\t\treturn booleanSchema;\n\t\tcase \"object\": {\n\t\t\tif (isTreeNode(value)) {\n\t\t\t\t// TODO: This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.\n\t\t\t\treturn tryGetTreeNodeSchema(value);\n\t\t\t}\n\t\t\tif (value === null) {\n\t\t\t\treturn nullSchema;\n\t\t\t}\n\t\t\tif (isFluidHandle(value)) {\n\t\t\t\treturn handleSchema;\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\n/**\n * Gets the identifier from a node.\n *\n * @param node - {@link TreeNode} where you want to extract the identifier from.\n * @param compression - string value to determine what type of identifier you want to retrieve.\n *\n * @remarks\n * If the node does not contain an identifier field, it returns undefined.\n *\n * If `compression` is set to `compressed`:\n *\n * - If the node contains a compressible identifier known by the id compressor, the compressed identifier is returned.\n *\n * - If the node contains an identifier, but is not compressible or unknown by the id compressor, `undefined` is returned.\n *\n * If `compression` is set to `preferCompressed`:\n *\n * - If the node contains a compressible identifier known by the id compressor, the compressed identifier is returned.\n *\n * - If the node contains an identifier, but is not compressible or unknown by the id compressor, the uncompressed identifier is returned.\n *\n * If `compression` is set to `uncompressed`:\n * - If the node contains an identifier field, the uncompressed identifier is returned.\n */\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"preferCompressed\",\n): number | string | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"compressed\",\n): number | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"uncompressed\",\n): string | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"preferCompressed\" | \"compressed\" | \"uncompressed\",\n): number | string | undefined {\n\tconst schema = node[typeSchemaSymbol];\n\tif (!isObjectNodeSchema(schema)) {\n\t\treturn undefined;\n\t}\n\n\tconst flexNode = getOrCreateInnerNode(node);\n\tconst identifierFieldKeys = schema.identifierFieldKeys;\n\n\tswitch (identifierFieldKeys.length) {\n\t\tcase 0:\n\t\t\treturn undefined;\n\t\tcase 1: {\n\t\t\tconst key = identifierFieldKeys[0] ?? oob();\n\t\t\tconst identifierField = flexNode.tryGetField(key);\n\t\t\tassert(identifierField !== undefined, 0xbb5 /* missing identifier field */);\n\t\t\tconst identifierValue = getTreeNodeForField(identifierField);\n\t\t\tassert(typeof identifierValue === \"string\", 0xbb6 /* identifier not a string */);\n\n\t\t\tconst context = flexNode.context;\n\t\t\tswitch (compression) {\n\t\t\t\tcase \"preferCompressed\": {\n\t\t\t\t\tif (context.isHydrated()) {\n\t\t\t\t\t\tconst localNodeKey =\n\t\t\t\t\t\t\tcontext.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);\n\t\t\t\t\t\treturn localNodeKey !== undefined\n\t\t\t\t\t\t\t? extractFromOpaque(localNodeKey)\n\t\t\t\t\t\t\t: identifierValue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn identifierValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"compressed\": {\n\t\t\t\t\tif (context.isHydrated()) {\n\t\t\t\t\t\tconst localNodeKey =\n\t\t\t\t\t\t\tcontext.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);\n\t\t\t\t\t\treturn localNodeKey !== undefined ? extractFromOpaque(localNodeKey) : undefined;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"uncompressed\": {\n\t\t\t\t\treturn identifierValue;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(compression);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tthrow new UsageError(\n\t\t\t\t\"shortId() may not be called on a node with more than one identifier. Consider converting extraneous identifier fields to string fields.\",\n\t\t\t);\n\t}\n}\n\n/**\n * Gets the stored key with which the provided node is associated in the parent.\n */\nexport function getStoredKey(node: TreeNode): string | number {\n\t// Note: the flex domain strictly works with \"stored keys\", and knows nothing about the developer-facing\n\t// \"property keys\".\n\tconst parentField = getOrCreateInnerNode(node).parentField;\n\tif (parentField.parent.schema === FieldKinds.sequence.identifier) {\n\t\t// The parent of `node` is an array node\n\t\tassert(\n\t\t\tparentField.parent.key === EmptyKey,\n\t\t\t0xa28 /* When using index as key, field should use EmptyKey */,\n\t\t);\n\t\treturn parentField.index;\n\t}\n\n\t// The parent of `node` is an object, a map, or undefined. If undefined, then `node` is a root/detached node.\n\tassert(parentField.index === 0, 0xa29 /* When using field key as key, index should be 0 */);\n\treturn parentField.parent.key;\n}\n\n/**\n * Given a node schema, gets the property key corresponding with the provided {@link FieldProps.key | stored key}.\n */\nexport function getPropertyKeyFromStoredKey(\n\tschema: TreeNodeSchema,\n\tstoredKey: string | number,\n): string | number {\n\t// Only object nodes have the concept of a \"stored key\", differentiated from the developer-facing \"property key\".\n\t// For any other kind of node, the stored key and the property key are the same.\n\tif (schema.kind !== NodeKind.Object) {\n\t\treturn storedKey;\n\t}\n\n\tconst fields = schema.info as Record<string, ImplicitFieldSchema>;\n\n\t// Invariants:\n\t// - The set of all property keys under an object must be unique.\n\t// - The set of all stored keys (including those implicitly created from property keys) must be unique.\n\t// To find the property key associated with the provided stored key, first check for any stored key matches (which are optionally populated).\n\t// If we don't find any, then search for a matching property key.\n\tfor (const [propertyKey, fieldSchema] of Object.entries(fields)) {\n\t\tif (fieldSchema instanceof FieldSchema && fieldSchema.props?.key === storedKey) {\n\t\t\treturn propertyKey;\n\t\t}\n\t}\n\n\tif (fields[storedKey] === undefined) {\n\t\tfail(0xb38 /* Existing stored key should always map to a property key */);\n\t}\n\n\treturn storedKey;\n}\n"]}
1
+ {"version":3,"file":"treeNodeApi.js","sourceRoot":"","sources":["../../../src/simple-tree/api/treeNodeApi.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAyF;AAEzF,kDAA6D;AAC7D,+DAA4F;AAC5F,kDAAwD;AACxD,sDAO2B;AAC3B,4DAM8B;AAC9B,qEAAuE;AACvE,uEAAsE;AAEtE,+CAU0B;AAE1B,qDAA4D;AAC5D,sEAAmE;AAoGnE;;GAEG;AACU,QAAA,WAAW,GAAgB;IACvC,MAAM,CAAC,IAAc;QACpB,MAAM,QAAQ,GAAG,IAAA,+BAAoB,EAAC,IAAI,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;QACtE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,MAAM,MAAM,GAAG,IAAA,uCAA4B,EAAC,QAAQ,CAAC,CAAC;QACtD,IAAA,iBAAM,EACL,CAAC,IAAA,sBAAW,EAAC,MAAM,CAAC,EACpB,KAAK,CAAC,gEAAgE,CACtE,CAAC;QACF,OAAO,MAAM,CAAC;IACf,CAAC;IACD,GAAG,CAAC,IAAc;QACjB,sEAAsE;QACtE,8CAA8C;QAC9C,MAAM,MAAM,GAAG,mBAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,uBAAY,CAAC;QACrB,CAAC;QAED,+DAA+D;QAC/D,uGAAuG;QACvG,4GAA4G;QAC5G,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACrC,MAA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ed under the MIT License.\n */\n\nimport { assert, oob, fail, unreachableCase } from \"@fluidframework/core-utils/internal\";\n\nimport { EmptyKey, rootFieldKey } from \"../../core/index.js\";\nimport { type TreeStatus, isTreeValue, FieldKinds } from \"../../feature-libraries/index.js\";\nimport { extractFromOpaque } from \"../../util/index.js\";\nimport {\n\ttype TreeLeafValue,\n\ttype ImplicitFieldSchema,\n\tFieldSchema,\n\ttype ImplicitAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n} from \"../schemaTypes.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport type { Off } from \"@fluidframework/core-interfaces\";\nimport {\n\tgetKernel,\n\tisTreeNode,\n\ttype TreeNodeSchema,\n\tNodeKind,\n\ttype TreeNode,\n\ttryGetTreeNodeSchema,\n\tgetOrCreateNodeFromInnerNode,\n\ttypeSchemaSymbol,\n\tgetOrCreateInnerNode,\n} from \"../core/index.js\";\nimport type { TreeChangeEvents } from \"./treeChangeEvents.js\";\nimport { isObjectNodeSchema } from \"../node-kinds/index.js\";\nimport { tryGetTreeNodeForField } from \"../getTreeNodeForField.js\";\n\n/**\n * Provides various functions for analyzing {@link TreeNode}s.\n *\n * @remarks\n * With the exception of {@link TreeNodeApi.status}, these functions should not be called with nodes that have\n * been {@link TreeStatus.Deleted | deleted}.\n * To verify whether or not a node already has been deleted, use the {@link TreeNodeApi.status} function.\n *\n * This type should only be used via the public {@link (Tree:variable)} export.\n *\n * @privateRemarks\n * Due to limitations of API-Extractor link resolution, this type can't be moved into internalTypes but should be considered just an implementation detail of the `Tree` export.\n *\n * Inlining the typing of this interface onto the `Tree` object provides slightly different .d.ts generation,\n * which avoids typescript expanding the type of TreeNodeSchema and thus encountering\n * https://github.com/microsoft/rushstack/issues/1958.\n * @sealed @public\n */\nexport interface TreeNodeApi {\n\t/**\n\t * The schema information for this node.\n\t */\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema;\n\n\t/**\n\t * Narrow the type of the given value if it satisfies the given schema.\n\t * @example\n\t * ```ts\n\t * if (node.is(myNode, Point)) {\n\t * const y = myNode.y; // `myNode` is now known to satisfy the `Point` schema and therefore has a `y` coordinate.\n\t * }\n\t * ```\n\t */\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema>;\n\n\t/**\n\t * Return the node under which this node resides in the tree (or undefined if this is a root node of the tree).\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.\n\t *\n\t * @see {@link (TreeAlpha:interface).child}\n\t * @see {@link (TreeAlpha:interface).children}\n\t */\n\tparent(node: TreeNode): TreeNode | undefined;\n\n\t/**\n\t * The key of the given node under its parent.\n\t *\n\t * @remarks\n\t * If `node` is an element in a {@link (TreeArrayNode:interface)}, this returns the index of `node` in the array node (a `number`).\n\t * Otherwise, this returns the key of the field that it is under (a `string`).\n\t *\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the node has been {@link TreeStatus.Deleted | deleted}.\n\t */\n\tkey(node: TreeNode): string | number;\n\n\t/**\n\t * Register an event listener on the given node.\n\t * @param node - The node whose events should be subscribed to.\n\t * @param eventName - Which event to subscribe to.\n\t * @param listener - The callback to trigger for the event. The tree can be read during the callback, but it is invalid to modify the tree during this callback.\n\t * @returns A callback function which will deregister the event.\n\t * This callback should be called only once.\n\t */\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): () => void;\n\n\t/**\n\t * Returns the {@link TreeStatus} of the given node.\n\t */\n\tstatus(node: TreeNode): TreeStatus;\n\n\t/**\n\t * Returns the {@link SchemaFactory.identifier | identifier} of the given node in the most compressed form possible.\n\t * @remarks\n\t * If the node is {@link Unhydrated | hydrated} and its identifier is a valid UUID that was automatically generated by the SharedTree it is part of (or something else using the same {@link @fluidframework/id-compressor#IIdCompressor}), then this will return a process-unique integer corresponding to that identifier.\n\t * This is useful for performance-sensitive scenarios involving many nodes with identifiers that need to be compactly retained in memory or used for efficient lookup.\n\t * Note that automatically generated identifiers that were accessed before the node was hydrated will return the generated UUID, not the process-unique integer.\n\t *\n\t * If the node's identifier is any other user-provided string, then this will return that string.\n\t *\n\t * If the node has no identifier (that is, it has no {@link SchemaFactory.identifier | identifier} field), then this returns `undefined`.\n\t *\n\t * If the node has more than one identifier, then this will throw an error.\n\t *\n\t * The returned integer should not be serialized or preserved outside of the current process.\n\t * Its lifetime is that of the current in-memory instance of the FF container for this client, and it is not guaranteed to be unique or stable outside of that context.\n\t * The same node's identifier may, for example, be different across multiple sessions for the same client and document, or different across two clients in the same session.\n\t */\n\tshortId(node: TreeNode): number | string | undefined;\n}\n\n/**\n * {@inheritDoc TreeNodeApi}\n */\nexport const treeNodeApi: TreeNodeApi = {\n\tparent(node: TreeNode): TreeNode | undefined {\n\t\tconst editNode = getOrCreateInnerNode(node).parentField.parent.parent;\n\t\tif (editNode === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst output = getOrCreateNodeFromInnerNode(editNode);\n\t\tassert(\n\t\t\t!isTreeValue(output),\n\t\t\t0x87f /* Parent can't be a leaf, so it should be a node not a value */,\n\t\t);\n\t\treturn output;\n\t},\n\tkey(node: TreeNode): string | number {\n\t\t// If the parent is undefined, then this node is under the root field,\n\t\t// so we know its key is the special root one.\n\t\tconst parent = treeNodeApi.parent(node);\n\t\tif (parent === undefined) {\n\t\t\treturn rootFieldKey;\n\t\t}\n\n\t\t// The flex-domain strictly operates in terms of \"stored keys\".\n\t\t// To find the associated developer-facing \"property key\", we need to look up the field associated with\n\t\t// the stored key from the flex-domain, and get property key its simple-domain counterpart was created with.\n\t\tconst storedKey = getStoredKey(node);\n\t\tconst parentSchema = treeNodeApi.schema(parent);\n\t\tconst propertyKey = getPropertyKeyFromStoredKey(parentSchema, storedKey);\n\t\treturn propertyKey;\n\t},\n\ton<K extends keyof TreeChangeEvents>(\n\t\tnode: TreeNode,\n\t\teventName: K,\n\t\tlistener: TreeChangeEvents[K],\n\t): Off {\n\t\tconst kernel = getKernel(node);\n\t\tswitch (eventName) {\n\t\t\tcase \"nodeChanged\": {\n\t\t\t\tconst nodeSchema = kernel.schema;\n\t\t\t\tif (isObjectNodeSchema(nodeSchema)) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tconst changedProperties = new Set(\n\t\t\t\t\t\t\tArray.from(\n\t\t\t\t\t\t\t\tchangedFields,\n\t\t\t\t\t\t\t\t(field) =>\n\t\t\t\t\t\t\t\t\tnodeSchema.storedKeyToPropertyKey.get(field) ??\n\t\t\t\t\t\t\t\t\tfail(0xb36 /* Could not find stored key in schema. */),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlistener({ changedProperties });\n\t\t\t\t\t});\n\t\t\t\t} else if (nodeSchema.kind === NodeKind.Array) {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", () => {\n\t\t\t\t\t\tlistener({ changedProperties: undefined });\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn kernel.events.on(\"childrenChangedAfterBatch\", ({ changedFields }) => {\n\t\t\t\t\t\tlistener({ changedProperties: changedFields });\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase \"treeChanged\": {\n\t\t\t\treturn kernel.events.on(\"subtreeChangedAfterBatch\", () => listener({}));\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new UsageError(`No event named ${JSON.stringify(eventName)}.`);\n\t\t}\n\t},\n\tstatus(node: TreeNode): TreeStatus {\n\t\treturn getKernel(node).getStatus();\n\t},\n\tis<TSchema extends ImplicitAllowedTypes>(\n\t\tvalue: unknown,\n\t\tschema: TSchema,\n\t): value is TreeNodeFromImplicitAllowedTypes<TSchema> {\n\t\t// This \"is\" utility would return false if the provided schema is a base type of the actual schema.\n\t\t// This could be confusing, and that case can only be hit when violating the rule that there is a single most derived schema that gets used (See documentation on TreeNodeSchemaClass).\n\t\t// Therefore this uses markSchemaMostDerived to ensure an informative usage error is thrown in the case where a base type is used.\n\n\t\tconst actualSchema = tryGetSchema(value);\n\t\tif (actualSchema === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\treturn normalizeAllowedTypes(schema).has(actualSchema);\n\t},\n\tschema(node: TreeNode | TreeLeafValue): TreeNodeSchema {\n\t\treturn tryGetSchema(node) ?? fail(0xb37 /* Not a tree node */);\n\t},\n\tshortId(node: TreeNode): number | string | undefined {\n\t\treturn getIdentifierFromNode(node, \"preferCompressed\");\n\t},\n};\n\n/**\n * Returns a schema for a value if the value is a {@link TreeNode} or a {@link TreeLeafValue}.\n * Returns undefined for other values.\n */\nexport function tryGetSchema(value: unknown): undefined | TreeNodeSchema {\n\tswitch (typeof value) {\n\t\tcase \"string\":\n\t\t\treturn stringSchema;\n\t\tcase \"number\":\n\t\t\treturn numberSchema;\n\t\tcase \"boolean\":\n\t\t\treturn booleanSchema;\n\t\tcase \"object\": {\n\t\t\tif (isTreeNode(value)) {\n\t\t\t\t// TODO: This case could be optimized, for example by placing the simple schema in a symbol on tree nodes.\n\t\t\t\treturn tryGetTreeNodeSchema(value);\n\t\t\t}\n\t\t\tif (value === null) {\n\t\t\t\treturn nullSchema;\n\t\t\t}\n\t\t\tif (isFluidHandle(value)) {\n\t\t\t\treturn handleSchema;\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n\n/**\n * Gets the identifier from a node.\n *\n * @param node - {@link TreeNode} where you want to extract the identifier from.\n * @param compression - string value to determine what type of identifier you want to retrieve.\n *\n * @remarks\n * If the node does not contain an identifier field, it returns undefined.\n *\n * If `compression` is set to `compressed`:\n *\n * - If the node contains a compressible identifier known by the id compressor, the compressed identifier is returned.\n *\n * - If the node contains an identifier, but is not compressible or unknown by the id compressor, `undefined` is returned.\n *\n * If `compression` is set to `preferCompressed`:\n *\n * - If the node contains a compressible identifier known by the id compressor, the compressed identifier is returned.\n *\n * - If the node contains an identifier, but is not compressible or unknown by the id compressor, the uncompressed identifier is returned.\n *\n * If `compression` is set to `uncompressed`:\n * - If the node contains an identifier field, the uncompressed identifier is returned.\n */\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"preferCompressed\",\n): number | string | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"compressed\",\n): number | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"uncompressed\",\n): string | undefined;\nexport function getIdentifierFromNode(\n\tnode: TreeNode,\n\tcompression: \"preferCompressed\" | \"compressed\" | \"uncompressed\",\n): number | string | undefined {\n\tconst schema = node[typeSchemaSymbol];\n\tif (!isObjectNodeSchema(schema)) {\n\t\treturn undefined;\n\t}\n\n\tconst flexNode = getOrCreateInnerNode(node);\n\tconst identifierFieldKeys = schema.identifierFieldKeys;\n\n\tswitch (identifierFieldKeys.length) {\n\t\tcase 0:\n\t\t\treturn undefined;\n\t\tcase 1: {\n\t\t\tconst key = identifierFieldKeys[0] ?? oob();\n\t\t\tconst identifierField = flexNode.tryGetField(key);\n\t\t\tassert(identifierField !== undefined, 0xbb5 /* missing identifier field */);\n\t\t\tconst identifierValue = tryGetTreeNodeForField(identifierField);\n\t\t\tassert(typeof identifierValue === \"string\", 0xbb6 /* identifier not a string */);\n\n\t\t\tconst context = flexNode.context;\n\t\t\tswitch (compression) {\n\t\t\t\tcase \"preferCompressed\": {\n\t\t\t\t\tif (context.isHydrated()) {\n\t\t\t\t\t\tconst localNodeKey =\n\t\t\t\t\t\t\tcontext.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);\n\t\t\t\t\t\treturn localNodeKey !== undefined\n\t\t\t\t\t\t\t? extractFromOpaque(localNodeKey)\n\t\t\t\t\t\t\t: identifierValue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn identifierValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"compressed\": {\n\t\t\t\t\tif (context.isHydrated()) {\n\t\t\t\t\t\tconst localNodeKey =\n\t\t\t\t\t\t\tcontext.nodeKeyManager.tryLocalizeNodeIdentifier(identifierValue);\n\t\t\t\t\t\treturn localNodeKey !== undefined ? extractFromOpaque(localNodeKey) : undefined;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase \"uncompressed\": {\n\t\t\t\t\treturn identifierValue;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(compression);\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tthrow new UsageError(\n\t\t\t\t\"shortId() may not be called on a node with more than one identifier. Consider converting extraneous identifier fields to string fields.\",\n\t\t\t);\n\t}\n}\n\n/**\n * Gets the stored key with which the provided node is associated in the parent.\n */\nexport function getStoredKey(node: TreeNode): string | number {\n\t// Note: the flex domain strictly works with \"stored keys\", and knows nothing about the developer-facing\n\t// \"property keys\".\n\tconst parentField = getOrCreateInnerNode(node).parentField;\n\tif (parentField.parent.schema === FieldKinds.sequence.identifier) {\n\t\t// The parent of `node` is an array node\n\t\tassert(\n\t\t\tparentField.parent.key === EmptyKey,\n\t\t\t0xa28 /* When using index as key, field should use EmptyKey */,\n\t\t);\n\t\treturn parentField.index;\n\t}\n\n\t// The parent of `node` is an object, a map, or undefined. If undefined, then `node` is a root/detached node.\n\tassert(parentField.index === 0, 0xa29 /* When using field key as key, index should be 0 */);\n\treturn parentField.parent.key;\n}\n\n/**\n * Given a node schema, gets the property key corresponding with the provided {@link FieldProps.key | stored key}.\n */\nexport function getPropertyKeyFromStoredKey(\n\tschema: TreeNodeSchema,\n\tstoredKey: string | number,\n): string | number {\n\t// Only object nodes have the concept of a \"stored key\", differentiated from the developer-facing \"property key\".\n\t// For any other kind of node, the stored key and the property key are the same.\n\tif (schema.kind !== NodeKind.Object) {\n\t\treturn storedKey;\n\t}\n\n\tconst fields = schema.info as Record<string, ImplicitFieldSchema>;\n\n\t// Invariants:\n\t// - The set of all property keys under an object must be unique.\n\t// - The set of all stored keys (including those implicitly created from property keys) must be unique.\n\t// To find the property key associated with the provided stored key, first check for any stored key matches (which are optionally populated).\n\t// If we don't find any, then search for a matching property key.\n\tfor (const [propertyKey, fieldSchema] of Object.entries(fields)) {\n\t\tif (fieldSchema instanceof FieldSchema && fieldSchema.props?.key === storedKey) {\n\t\t\treturn propertyKey;\n\t\t}\n\t}\n\n\tif (fields[storedKey] === undefined) {\n\t\tfail(0xb38 /* Existing stored key should always map to a property key */);\n\t}\n\n\treturn storedKey;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"viewSchemaToSimpleSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/viewSchemaToSimpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,KAAK,EAQX,gBAAgB,EAChB,MAAM,oBAAoB,CAAC;AAM5B;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CACjC,MAAM,EAAE,mBAAmB,EAC3B,iBAAiB,EAAE,OAAO,GACxB,gBAAgB,CA4BlB"}
1
+ {"version":3,"file":"viewSchemaToSimpleSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/viewSchemaToSimpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,KAAK,EAQX,gBAAgB,EAChB,MAAM,oBAAoB,CAAC;AAM5B;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CACjC,MAAM,EAAE,mBAAmB,EAC3B,iBAAiB,EAAE,OAAO,GACxB,gBAAgB,CA6BlB"}
@@ -47,6 +47,7 @@ function toSimpleTreeSchema(schema, copySchemaObjects) {
47
47
  allowedTypesIdentifiers: normalizedSchema.allowedTypesIdentifiers,
48
48
  kind: normalizedSchema.kind,
49
49
  metadata: normalizedSchema.metadata,
50
+ persistedMetadata: normalizedSchema.persistedMetadata,
50
51
  })
51
52
  : normalizedSchema,
52
53
  definitions,
@@ -77,6 +78,7 @@ function copySimpleLeafSchema(schema) {
77
78
  kind: index_js_1.NodeKind.Leaf,
78
79
  leafKind: schema.leafKind,
79
80
  metadata: schema.metadata,
81
+ persistedMetadata: schema.persistedMetadata,
80
82
  };
81
83
  }
82
84
  function copySimpleMapOrArraySchema(schema) {
@@ -84,6 +86,7 @@ function copySimpleMapOrArraySchema(schema) {
84
86
  kind: schema.kind,
85
87
  allowedTypesIdentifiers: schema.allowedTypesIdentifiers,
86
88
  metadata: schema.metadata,
89
+ persistedMetadata: schema.persistedMetadata,
87
90
  };
88
91
  }
89
92
  function copySimpleObjectSchema(schema) {
@@ -94,6 +97,7 @@ function copySimpleObjectSchema(schema) {
94
97
  kind: field.kind,
95
98
  allowedTypesIdentifiers: field.allowedTypesIdentifiers,
96
99
  metadata: field.metadata,
100
+ persistedMetadata: field.persistedMetadata,
97
101
  storedKey: field.storedKey,
98
102
  });
99
103
  }
@@ -101,6 +105,7 @@ function copySimpleObjectSchema(schema) {
101
105
  kind: index_js_1.NodeKind.Object,
102
106
  fields,
103
107
  metadata: schema.metadata,
108
+ persistedMetadata: schema.persistedMetadata,
104
109
  };
105
110
  }
106
111
  //# sourceMappingURL=viewSchemaToSimpleSchema.js.map