@fluidframework/tree 2.11.0 → 2.13.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 (704) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/api-report/tree.alpha.api.md +88 -12
  3. package/api-report/tree.beta.api.md +23 -11
  4. package/api-report/tree.legacy.alpha.api.md +23 -11
  5. package/api-report/tree.legacy.public.api.md +23 -11
  6. package/api-report/tree.public.api.md +23 -11
  7. package/dist/alpha.d.ts +11 -0
  8. package/dist/beta.d.ts +2 -0
  9. package/dist/core/index.d.ts +2 -2
  10. package/dist/core/index.d.ts.map +1 -1
  11. package/dist/core/index.js +5 -3
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/core/rebase/utils.d.ts.map +1 -1
  14. package/dist/core/rebase/utils.js +2 -9
  15. package/dist/core/rebase/utils.js.map +1 -1
  16. package/dist/core/schema-stored/format.d.ts +0 -3
  17. package/dist/core/schema-stored/format.d.ts.map +1 -1
  18. package/dist/core/schema-stored/format.js.map +1 -1
  19. package/dist/core/schema-stored/schema.d.ts +12 -10
  20. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  21. package/dist/core/schema-stored/schema.js +3 -5
  22. package/dist/core/schema-stored/schema.js.map +1 -1
  23. package/dist/core/schema-view/index.d.ts +1 -1
  24. package/dist/core/schema-view/index.d.ts.map +1 -1
  25. package/dist/core/schema-view/index.js +1 -2
  26. package/dist/core/schema-view/index.js.map +1 -1
  27. package/dist/core/schema-view/view.d.ts +0 -7
  28. package/dist/core/schema-view/view.d.ts.map +1 -1
  29. package/dist/core/schema-view/view.js +1 -12
  30. package/dist/core/schema-view/view.js.map +1 -1
  31. package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.d.ts +2 -1
  32. package/dist/core/tree/chunk.d.ts.map +1 -0
  33. package/dist/{feature-libraries/chunked-forest → core/tree}/chunk.js +2 -2
  34. package/dist/core/tree/chunk.js.map +1 -0
  35. package/dist/core/tree/index.d.ts +1 -0
  36. package/dist/core/tree/index.d.ts.map +1 -1
  37. package/dist/core/tree/index.js +5 -1
  38. package/dist/core/tree/index.js.map +1 -1
  39. package/dist/core/tree/treeTextFormat.d.ts +0 -5
  40. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  41. package/dist/core/tree/treeTextFormat.js.map +1 -1
  42. package/dist/core/tree/types.d.ts +0 -5
  43. package/dist/core/tree/types.d.ts.map +1 -1
  44. package/dist/core/tree/types.js +0 -1
  45. package/dist/core/tree/types.js.map +1 -1
  46. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts +1 -2
  47. package/dist/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/basicChunk.js +14 -14
  49. package/dist/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
  51. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/chunkTree.js +2 -3
  53. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -2
  55. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts +1 -2
  58. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
  59. package/dist/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
  61. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  62. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts +1 -1
  67. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/emptyChunk.js +2 -3
  69. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  71. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/index.js +5 -5
  73. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  75. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/sequenceChunk.js +2 -2
  77. package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
  79. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/uniformChunk.js +13 -13
  81. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  82. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts +10 -0
  83. package/dist/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  84. package/dist/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
  85. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  86. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  87. package/dist/feature-libraries/default-schema/defaultSchema.js +1 -0
  88. package/dist/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  89. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  90. package/dist/feature-libraries/default-schema/schemaChecker.js +2 -1
  91. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  92. package/dist/feature-libraries/index.d.ts +1 -2
  93. package/dist/feature-libraries/index.d.ts.map +1 -1
  94. package/dist/feature-libraries/index.js +6 -4
  95. package/dist/feature-libraries/index.js.map +1 -1
  96. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
  97. package/dist/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  98. package/dist/feature-libraries/indexing/anchorTreeIndex.js +31 -5
  99. package/dist/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  100. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts +1 -1
  101. package/dist/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  102. package/dist/feature-libraries/modular-schema/crossFieldQueries.js +8 -2
  103. package/dist/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  104. package/dist/feature-libraries/modular-schema/discrepancies.d.ts +84 -24
  105. package/dist/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  106. package/dist/feature-libraries/modular-schema/discrepancies.js +32 -33
  107. package/dist/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  108. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts +12 -5
  109. package/dist/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  110. package/dist/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  111. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  112. package/dist/feature-libraries/modular-schema/genericFieldKind.js +2 -1
  113. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  114. package/dist/feature-libraries/modular-schema/index.d.ts +2 -2
  115. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  116. package/dist/feature-libraries/modular-schema/index.js +5 -1
  117. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  118. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
  119. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  120. package/dist/feature-libraries/modular-schema/isNeverTree.js +0 -1
  121. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  122. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -0
  123. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  124. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +89 -25
  125. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  126. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts +12 -0
  127. package/dist/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  128. package/dist/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  129. package/dist/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  130. package/dist/feature-libraries/optional-field/optionalField.js +24 -4
  131. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  132. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  133. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  134. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  135. package/dist/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  136. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
  137. package/dist/feature-libraries/sequence-field/formatV1.d.ts +99 -99
  138. package/dist/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  139. package/dist/feature-libraries/sequence-field/formatV2.d.ts +76 -76
  140. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  141. package/dist/feature-libraries/sequence-field/formatV3.d.ts +54 -54
  142. package/dist/feature-libraries/sequence-field/types.d.ts +0 -1
  143. package/dist/feature-libraries/sequence-field/types.d.ts.map +1 -1
  144. package/dist/feature-libraries/sequence-field/types.js.map +1 -1
  145. package/dist/feature-libraries/sequence-field/utils.d.ts +2 -2
  146. package/dist/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  147. package/dist/feature-libraries/sequence-field/utils.js +14 -5
  148. package/dist/feature-libraries/sequence-field/utils.js.map +1 -1
  149. package/dist/index.d.ts +4 -5
  150. package/dist/index.d.ts.map +1 -1
  151. package/dist/index.js +2 -14
  152. package/dist/index.js.map +1 -1
  153. package/dist/legacy.d.ts +2 -0
  154. package/dist/packageVersion.d.ts +1 -1
  155. package/dist/packageVersion.js +1 -1
  156. package/dist/packageVersion.js.map +1 -1
  157. package/dist/public.d.ts +2 -0
  158. package/dist/shared-tree/index.d.ts +3 -2
  159. package/dist/shared-tree/index.d.ts.map +1 -1
  160. package/dist/shared-tree/index.js +2 -1
  161. package/dist/shared-tree/index.js.map +1 -1
  162. package/dist/shared-tree/schematizeTree.d.ts +1 -1
  163. package/dist/shared-tree/schematizeTree.d.ts.map +1 -1
  164. package/dist/shared-tree/schematizeTree.js +6 -6
  165. package/dist/shared-tree/schematizeTree.js.map +1 -1
  166. package/dist/shared-tree/schematizingTreeView.d.ts +10 -1
  167. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  168. package/dist/shared-tree/schematizingTreeView.js +51 -12
  169. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  170. package/dist/shared-tree/sharedTree.d.ts +31 -10
  171. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  172. package/dist/shared-tree/sharedTree.js +106 -15
  173. package/dist/shared-tree/sharedTree.js.map +1 -1
  174. package/dist/shared-tree/transactionTypes.d.ts +105 -0
  175. package/dist/shared-tree/transactionTypes.d.ts.map +1 -0
  176. package/dist/shared-tree/transactionTypes.js +13 -0
  177. package/dist/shared-tree/transactionTypes.js.map +1 -0
  178. package/dist/shared-tree/treeApi.d.ts +1 -25
  179. package/dist/shared-tree/treeApi.d.ts.map +1 -1
  180. package/dist/shared-tree/treeApi.js +4 -8
  181. package/dist/shared-tree/treeApi.js.map +1 -1
  182. package/dist/shared-tree/treeCheckout.d.ts +39 -13
  183. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  184. package/dist/shared-tree/treeCheckout.js +275 -128
  185. package/dist/shared-tree/treeCheckout.js.map +1 -1
  186. package/dist/shared-tree-core/branch.d.ts +13 -35
  187. package/dist/shared-tree-core/branch.d.ts.map +1 -1
  188. package/dist/shared-tree-core/branch.js +12 -77
  189. package/dist/shared-tree-core/branch.js.map +1 -1
  190. package/dist/shared-tree-core/branchCommitEnricher.d.ts +7 -1
  191. package/dist/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  192. package/dist/shared-tree-core/branchCommitEnricher.js +16 -18
  193. package/dist/shared-tree-core/branchCommitEnricher.js.map +1 -1
  194. package/dist/shared-tree-core/editManager.d.ts.map +1 -1
  195. package/dist/shared-tree-core/editManager.js +2 -2
  196. package/dist/shared-tree-core/editManager.js.map +1 -1
  197. package/dist/shared-tree-core/index.d.ts +3 -3
  198. package/dist/shared-tree-core/index.d.ts.map +1 -1
  199. package/dist/shared-tree-core/index.js +2 -2
  200. package/dist/shared-tree-core/index.js.map +1 -1
  201. package/dist/shared-tree-core/sharedTreeCore.d.ts +2 -9
  202. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  203. package/dist/shared-tree-core/sharedTreeCore.js +4 -16
  204. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  205. package/dist/shared-tree-core/transaction.d.ts +38 -0
  206. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  207. package/dist/shared-tree-core/transaction.js +118 -6
  208. package/dist/shared-tree-core/transaction.js.map +1 -1
  209. package/dist/simple-tree/api/conciseTree.d.ts.map +1 -1
  210. package/dist/simple-tree/api/conciseTree.js +1 -1
  211. package/dist/simple-tree/api/conciseTree.js.map +1 -1
  212. package/dist/simple-tree/api/create.d.ts.map +1 -1
  213. package/dist/simple-tree/api/create.js +5 -1
  214. package/dist/simple-tree/api/create.js.map +1 -1
  215. package/dist/simple-tree/api/customTree.d.ts +14 -2
  216. package/dist/simple-tree/api/customTree.d.ts.map +1 -1
  217. package/dist/simple-tree/api/customTree.js +53 -3
  218. package/dist/simple-tree/api/customTree.js.map +1 -1
  219. package/dist/simple-tree/api/index.d.ts +3 -2
  220. package/dist/simple-tree/api/index.d.ts.map +1 -1
  221. package/dist/simple-tree/api/index.js +6 -1
  222. package/dist/simple-tree/api/index.js.map +1 -1
  223. package/dist/simple-tree/api/jsonSchema.d.ts +6 -0
  224. package/dist/simple-tree/api/jsonSchema.d.ts.map +1 -1
  225. package/dist/simple-tree/api/jsonSchema.js.map +1 -1
  226. package/dist/simple-tree/api/schemaFactory.d.ts +65 -8
  227. package/dist/simple-tree/api/schemaFactory.d.ts.map +1 -1
  228. package/dist/simple-tree/api/schemaFactory.js +10 -4
  229. package/dist/simple-tree/api/schemaFactory.js.map +1 -1
  230. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
  231. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
  232. package/dist/simple-tree/api/schemaFactoryAlpha.js +90 -0
  233. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
  234. package/dist/simple-tree/api/simpleSchema.d.ts +8 -2
  235. package/dist/simple-tree/api/simpleSchema.d.ts.map +1 -1
  236. package/dist/simple-tree/api/simpleSchema.js.map +1 -1
  237. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js +13 -10
  238. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  239. package/dist/simple-tree/api/simpleTreeIndex.js +3 -1
  240. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  241. package/dist/simple-tree/api/storedSchema.d.ts +4 -4
  242. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  243. package/dist/simple-tree/api/storedSchema.js +8 -21
  244. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  245. package/dist/simple-tree/api/testRecursiveDomain.d.ts +5 -5
  246. package/dist/simple-tree/api/tree.d.ts +61 -0
  247. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  248. package/dist/simple-tree/api/tree.js.map +1 -1
  249. package/dist/simple-tree/api/verboseTree.js +1 -1
  250. package/dist/simple-tree/api/verboseTree.js.map +1 -1
  251. package/dist/simple-tree/api/view.d.ts +14 -9
  252. package/dist/simple-tree/api/view.d.ts.map +1 -1
  253. package/dist/simple-tree/api/view.js +129 -40
  254. package/dist/simple-tree/api/view.js.map +1 -1
  255. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  256. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +11 -11
  257. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  258. package/dist/simple-tree/arrayNode.d.ts +2 -2
  259. package/dist/simple-tree/arrayNode.d.ts.map +1 -1
  260. package/dist/simple-tree/arrayNode.js +2 -1
  261. package/dist/simple-tree/arrayNode.js.map +1 -1
  262. package/dist/simple-tree/core/treeNodeSchema.d.ts +10 -6
  263. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  264. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  265. package/dist/simple-tree/index.d.ts +3 -3
  266. package/dist/simple-tree/index.d.ts.map +1 -1
  267. package/dist/simple-tree/index.js +6 -2
  268. package/dist/simple-tree/index.js.map +1 -1
  269. package/dist/simple-tree/leafNodeSchema.d.ts +5 -20
  270. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  271. package/dist/simple-tree/leafNodeSchema.js +0 -15
  272. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  273. package/dist/simple-tree/mapNode.d.ts +2 -2
  274. package/dist/simple-tree/mapNode.d.ts.map +1 -1
  275. package/dist/simple-tree/mapNode.js +2 -1
  276. package/dist/simple-tree/mapNode.js.map +1 -1
  277. package/dist/simple-tree/objectNode.d.ts +9 -4
  278. package/dist/simple-tree/objectNode.d.ts.map +1 -1
  279. package/dist/simple-tree/objectNode.js +19 -2
  280. package/dist/simple-tree/objectNode.js.map +1 -1
  281. package/dist/simple-tree/objectNodeTypes.d.ts +6 -2
  282. package/dist/simple-tree/objectNodeTypes.d.ts.map +1 -1
  283. package/dist/simple-tree/objectNodeTypes.js.map +1 -1
  284. package/dist/simple-tree/schemaTypes.d.ts +51 -3
  285. package/dist/simple-tree/schemaTypes.d.ts.map +1 -1
  286. package/dist/simple-tree/schemaTypes.js.map +1 -1
  287. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  288. package/dist/simple-tree/toStoredSchema.js +18 -13
  289. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  290. package/dist/util/brand.d.ts +0 -2
  291. package/dist/util/brand.d.ts.map +1 -1
  292. package/dist/util/brand.js +0 -1
  293. package/dist/util/brand.js.map +1 -1
  294. package/dist/util/index.d.ts +2 -2
  295. package/dist/util/index.d.ts.map +1 -1
  296. package/dist/util/index.js +4 -5
  297. package/dist/util/index.js.map +1 -1
  298. package/dist/util/rangeMap.d.ts +72 -42
  299. package/dist/util/rangeMap.d.ts.map +1 -1
  300. package/dist/util/rangeMap.js +161 -151
  301. package/dist/util/rangeMap.js.map +1 -1
  302. package/dist/util/typeCheck.d.ts +0 -2
  303. package/dist/util/typeCheck.d.ts.map +1 -1
  304. package/dist/util/typeCheck.js.map +1 -1
  305. package/dist/util/utils.d.ts +35 -1
  306. package/dist/util/utils.d.ts.map +1 -1
  307. package/dist/util/utils.js +32 -1
  308. package/dist/util/utils.js.map +1 -1
  309. package/lib/alpha.d.ts +11 -0
  310. package/lib/beta.d.ts +2 -0
  311. package/lib/core/index.d.ts +2 -2
  312. package/lib/core/index.d.ts.map +1 -1
  313. package/lib/core/index.js +2 -2
  314. package/lib/core/index.js.map +1 -1
  315. package/lib/core/rebase/utils.d.ts.map +1 -1
  316. package/lib/core/rebase/utils.js +3 -10
  317. package/lib/core/rebase/utils.js.map +1 -1
  318. package/lib/core/schema-stored/format.d.ts +0 -3
  319. package/lib/core/schema-stored/format.d.ts.map +1 -1
  320. package/lib/core/schema-stored/format.js.map +1 -1
  321. package/lib/core/schema-stored/schema.d.ts +12 -10
  322. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  323. package/lib/core/schema-stored/schema.js +3 -5
  324. package/lib/core/schema-stored/schema.js.map +1 -1
  325. package/lib/core/schema-view/index.d.ts +1 -1
  326. package/lib/core/schema-view/index.d.ts.map +1 -1
  327. package/lib/core/schema-view/index.js +1 -1
  328. package/lib/core/schema-view/index.js.map +1 -1
  329. package/lib/core/schema-view/view.d.ts +0 -7
  330. package/lib/core/schema-view/view.d.ts.map +1 -1
  331. package/lib/core/schema-view/view.js +0 -11
  332. package/lib/core/schema-view/view.js.map +1 -1
  333. package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.d.ts +2 -1
  334. package/lib/core/tree/chunk.d.ts.map +1 -0
  335. package/lib/{feature-libraries/chunked-forest → core/tree}/chunk.js +1 -1
  336. package/lib/core/tree/chunk.js.map +1 -0
  337. package/lib/core/tree/index.d.ts +1 -0
  338. package/lib/core/tree/index.d.ts.map +1 -1
  339. package/lib/core/tree/index.js +1 -0
  340. package/lib/core/tree/index.js.map +1 -1
  341. package/lib/core/tree/treeTextFormat.d.ts +0 -5
  342. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  343. package/lib/core/tree/treeTextFormat.js.map +1 -1
  344. package/lib/core/tree/types.d.ts +0 -5
  345. package/lib/core/tree/types.d.ts.map +1 -1
  346. package/lib/core/tree/types.js +0 -1
  347. package/lib/core/tree/types.js.map +1 -1
  348. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts +1 -2
  349. package/lib/feature-libraries/chunked-forest/basicChunk.d.ts.map +1 -1
  350. package/lib/feature-libraries/chunked-forest/basicChunk.js +1 -1
  351. package/lib/feature-libraries/chunked-forest/basicChunk.js.map +1 -1
  352. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -2
  353. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  354. package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -2
  355. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  356. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -2
  357. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  358. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  359. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts +1 -2
  360. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.d.ts.map +1 -1
  361. package/lib/feature-libraries/chunked-forest/codec/chunkCodecUtilities.js.map +1 -1
  362. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -2
  363. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  364. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  365. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +1 -1
  366. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  367. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  368. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts +1 -1
  369. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  370. package/lib/feature-libraries/chunked-forest/emptyChunk.js +1 -2
  371. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  372. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  373. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  374. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  375. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  376. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  377. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  378. package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -1
  379. package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  380. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -2
  381. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  382. package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  383. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  384. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts +10 -0
  385. package/lib/feature-libraries/default-schema/defaultEditBuilder.d.ts.map +1 -1
  386. package/lib/feature-libraries/default-schema/defaultEditBuilder.js +3 -0
  387. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  388. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +1 -1
  389. package/lib/feature-libraries/default-schema/defaultSchema.js +1 -0
  390. package/lib/feature-libraries/default-schema/defaultSchema.js.map +1 -1
  391. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  392. package/lib/feature-libraries/default-schema/schemaChecker.js +2 -1
  393. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  394. package/lib/feature-libraries/index.d.ts +1 -2
  395. package/lib/feature-libraries/index.d.ts.map +1 -1
  396. package/lib/feature-libraries/index.js +1 -2
  397. package/lib/feature-libraries/index.js.map +1 -1
  398. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts +8 -1
  399. package/lib/feature-libraries/indexing/anchorTreeIndex.d.ts.map +1 -1
  400. package/lib/feature-libraries/indexing/anchorTreeIndex.js +31 -5
  401. package/lib/feature-libraries/indexing/anchorTreeIndex.js.map +1 -1
  402. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts +1 -1
  403. package/lib/feature-libraries/modular-schema/crossFieldQueries.d.ts.map +1 -1
  404. package/lib/feature-libraries/modular-schema/crossFieldQueries.js +9 -3
  405. package/lib/feature-libraries/modular-schema/crossFieldQueries.js.map +1 -1
  406. package/lib/feature-libraries/modular-schema/discrepancies.d.ts +84 -24
  407. package/lib/feature-libraries/modular-schema/discrepancies.d.ts.map +1 -1
  408. package/lib/feature-libraries/modular-schema/discrepancies.js +25 -28
  409. package/lib/feature-libraries/modular-schema/discrepancies.js.map +1 -1
  410. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts +12 -5
  411. package/lib/feature-libraries/modular-schema/fieldChangeHandler.d.ts.map +1 -1
  412. package/lib/feature-libraries/modular-schema/fieldChangeHandler.js.map +1 -1
  413. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  414. package/lib/feature-libraries/modular-schema/genericFieldKind.js +2 -1
  415. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  416. package/lib/feature-libraries/modular-schema/index.d.ts +2 -2
  417. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  418. package/lib/feature-libraries/modular-schema/index.js +1 -1
  419. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  420. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +0 -1
  421. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  422. package/lib/feature-libraries/modular-schema/isNeverTree.js +0 -1
  423. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  424. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +1 -0
  425. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  426. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +89 -25
  427. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  428. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts +12 -0
  429. package/lib/feature-libraries/modular-schema/modularChangeTypes.d.ts.map +1 -1
  430. package/lib/feature-libraries/modular-schema/modularChangeTypes.js.map +1 -1
  431. package/lib/feature-libraries/optional-field/optionalField.d.ts.map +1 -1
  432. package/lib/feature-libraries/optional-field/optionalField.js +24 -4
  433. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  434. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts +6 -6
  435. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV1.d.ts.map +1 -1
  436. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts +7 -7
  437. package/lib/feature-libraries/optional-field/optionalFieldChangeFormatV2.d.ts.map +1 -1
  438. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +12 -12
  439. package/lib/feature-libraries/sequence-field/formatV1.d.ts +99 -99
  440. package/lib/feature-libraries/sequence-field/formatV1.d.ts.map +1 -1
  441. package/lib/feature-libraries/sequence-field/formatV2.d.ts +76 -76
  442. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  443. package/lib/feature-libraries/sequence-field/formatV3.d.ts +54 -54
  444. package/lib/feature-libraries/sequence-field/types.d.ts +0 -1
  445. package/lib/feature-libraries/sequence-field/types.d.ts.map +1 -1
  446. package/lib/feature-libraries/sequence-field/types.js.map +1 -1
  447. package/lib/feature-libraries/sequence-field/utils.d.ts +2 -2
  448. package/lib/feature-libraries/sequence-field/utils.d.ts.map +1 -1
  449. package/lib/feature-libraries/sequence-field/utils.js +14 -5
  450. package/lib/feature-libraries/sequence-field/utils.js.map +1 -1
  451. package/lib/index.d.ts +4 -5
  452. package/lib/index.d.ts.map +1 -1
  453. package/lib/index.js +3 -4
  454. package/lib/index.js.map +1 -1
  455. package/lib/legacy.d.ts +2 -0
  456. package/lib/packageVersion.d.ts +1 -1
  457. package/lib/packageVersion.js +1 -1
  458. package/lib/packageVersion.js.map +1 -1
  459. package/lib/public.d.ts +2 -0
  460. package/lib/shared-tree/index.d.ts +3 -2
  461. package/lib/shared-tree/index.d.ts.map +1 -1
  462. package/lib/shared-tree/index.js +2 -1
  463. package/lib/shared-tree/index.js.map +1 -1
  464. package/lib/shared-tree/schematizeTree.d.ts +1 -1
  465. package/lib/shared-tree/schematizeTree.d.ts.map +1 -1
  466. package/lib/shared-tree/schematizeTree.js +7 -7
  467. package/lib/shared-tree/schematizeTree.js.map +1 -1
  468. package/lib/shared-tree/schematizingTreeView.d.ts +10 -1
  469. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  470. package/lib/shared-tree/schematizingTreeView.js +56 -17
  471. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  472. package/lib/shared-tree/sharedTree.d.ts +31 -10
  473. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  474. package/lib/shared-tree/sharedTree.js +107 -16
  475. package/lib/shared-tree/sharedTree.js.map +1 -1
  476. package/lib/shared-tree/transactionTypes.d.ts +105 -0
  477. package/lib/shared-tree/transactionTypes.d.ts.map +1 -0
  478. package/lib/shared-tree/transactionTypes.js +10 -0
  479. package/lib/shared-tree/transactionTypes.js.map +1 -0
  480. package/lib/shared-tree/treeApi.d.ts +1 -25
  481. package/lib/shared-tree/treeApi.d.ts.map +1 -1
  482. package/lib/shared-tree/treeApi.js +1 -5
  483. package/lib/shared-tree/treeApi.js.map +1 -1
  484. package/lib/shared-tree/treeCheckout.d.ts +39 -13
  485. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  486. package/lib/shared-tree/treeCheckout.js +277 -130
  487. package/lib/shared-tree/treeCheckout.js.map +1 -1
  488. package/lib/shared-tree-core/branch.d.ts +13 -35
  489. package/lib/shared-tree-core/branch.d.ts.map +1 -1
  490. package/lib/shared-tree-core/branch.js +12 -76
  491. package/lib/shared-tree-core/branch.js.map +1 -1
  492. package/lib/shared-tree-core/branchCommitEnricher.d.ts +7 -1
  493. package/lib/shared-tree-core/branchCommitEnricher.d.ts.map +1 -1
  494. package/lib/shared-tree-core/branchCommitEnricher.js +16 -18
  495. package/lib/shared-tree-core/branchCommitEnricher.js.map +1 -1
  496. package/lib/shared-tree-core/editManager.d.ts.map +1 -1
  497. package/lib/shared-tree-core/editManager.js +3 -3
  498. package/lib/shared-tree-core/editManager.js.map +1 -1
  499. package/lib/shared-tree-core/index.d.ts +3 -3
  500. package/lib/shared-tree-core/index.d.ts.map +1 -1
  501. package/lib/shared-tree-core/index.js +2 -2
  502. package/lib/shared-tree-core/index.js.map +1 -1
  503. package/lib/shared-tree-core/sharedTreeCore.d.ts +2 -9
  504. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  505. package/lib/shared-tree-core/sharedTreeCore.js +4 -16
  506. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  507. package/lib/shared-tree-core/transaction.d.ts +38 -0
  508. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  509. package/lib/shared-tree-core/transaction.js +112 -1
  510. package/lib/shared-tree-core/transaction.js.map +1 -1
  511. package/lib/simple-tree/api/conciseTree.d.ts.map +1 -1
  512. package/lib/simple-tree/api/conciseTree.js +2 -2
  513. package/lib/simple-tree/api/conciseTree.js.map +1 -1
  514. package/lib/simple-tree/api/create.d.ts.map +1 -1
  515. package/lib/simple-tree/api/create.js +5 -1
  516. package/lib/simple-tree/api/create.js.map +1 -1
  517. package/lib/simple-tree/api/customTree.d.ts +14 -2
  518. package/lib/simple-tree/api/customTree.d.ts.map +1 -1
  519. package/lib/simple-tree/api/customTree.js +50 -2
  520. package/lib/simple-tree/api/customTree.js.map +1 -1
  521. package/lib/simple-tree/api/index.d.ts +3 -2
  522. package/lib/simple-tree/api/index.d.ts.map +1 -1
  523. package/lib/simple-tree/api/index.js +3 -1
  524. package/lib/simple-tree/api/index.js.map +1 -1
  525. package/lib/simple-tree/api/jsonSchema.d.ts +6 -0
  526. package/lib/simple-tree/api/jsonSchema.d.ts.map +1 -1
  527. package/lib/simple-tree/api/jsonSchema.js.map +1 -1
  528. package/lib/simple-tree/api/schemaFactory.d.ts +65 -8
  529. package/lib/simple-tree/api/schemaFactory.d.ts.map +1 -1
  530. package/lib/simple-tree/api/schemaFactory.js +9 -3
  531. package/lib/simple-tree/api/schemaFactory.js.map +1 -1
  532. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +83 -0
  533. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -0
  534. package/lib/simple-tree/api/schemaFactoryAlpha.js +86 -0
  535. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -0
  536. package/lib/simple-tree/api/simpleSchema.d.ts +8 -2
  537. package/lib/simple-tree/api/simpleSchema.d.ts.map +1 -1
  538. package/lib/simple-tree/api/simpleSchema.js.map +1 -1
  539. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js +14 -11
  540. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  541. package/lib/simple-tree/api/simpleTreeIndex.js +3 -1
  542. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  543. package/lib/simple-tree/api/storedSchema.d.ts +4 -4
  544. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  545. package/lib/simple-tree/api/storedSchema.js +5 -18
  546. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  547. package/lib/simple-tree/api/testRecursiveDomain.d.ts +5 -5
  548. package/lib/simple-tree/api/tree.d.ts +61 -0
  549. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  550. package/lib/simple-tree/api/tree.js.map +1 -1
  551. package/lib/simple-tree/api/verboseTree.js +2 -2
  552. package/lib/simple-tree/api/verboseTree.js.map +1 -1
  553. package/lib/simple-tree/api/view.d.ts +14 -9
  554. package/lib/simple-tree/api/view.d.ts.map +1 -1
  555. package/lib/simple-tree/api/view.js +131 -42
  556. package/lib/simple-tree/api/view.js.map +1 -1
  557. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  558. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +12 -12
  559. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  560. package/lib/simple-tree/arrayNode.d.ts +2 -2
  561. package/lib/simple-tree/arrayNode.d.ts.map +1 -1
  562. package/lib/simple-tree/arrayNode.js +2 -1
  563. package/lib/simple-tree/arrayNode.js.map +1 -1
  564. package/lib/simple-tree/core/treeNodeSchema.d.ts +10 -6
  565. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  566. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  567. package/lib/simple-tree/index.d.ts +3 -3
  568. package/lib/simple-tree/index.d.ts.map +1 -1
  569. package/lib/simple-tree/index.js +2 -2
  570. package/lib/simple-tree/index.js.map +1 -1
  571. package/lib/simple-tree/leafNodeSchema.d.ts +5 -20
  572. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  573. package/lib/simple-tree/leafNodeSchema.js +0 -15
  574. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  575. package/lib/simple-tree/mapNode.d.ts +2 -2
  576. package/lib/simple-tree/mapNode.d.ts.map +1 -1
  577. package/lib/simple-tree/mapNode.js +2 -1
  578. package/lib/simple-tree/mapNode.js.map +1 -1
  579. package/lib/simple-tree/objectNode.d.ts +9 -4
  580. package/lib/simple-tree/objectNode.d.ts.map +1 -1
  581. package/lib/simple-tree/objectNode.js +17 -1
  582. package/lib/simple-tree/objectNode.js.map +1 -1
  583. package/lib/simple-tree/objectNodeTypes.d.ts +6 -2
  584. package/lib/simple-tree/objectNodeTypes.d.ts.map +1 -1
  585. package/lib/simple-tree/objectNodeTypes.js.map +1 -1
  586. package/lib/simple-tree/schemaTypes.d.ts +51 -3
  587. package/lib/simple-tree/schemaTypes.d.ts.map +1 -1
  588. package/lib/simple-tree/schemaTypes.js.map +1 -1
  589. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  590. package/lib/simple-tree/toStoredSchema.js +19 -14
  591. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  592. package/lib/util/brand.d.ts +0 -2
  593. package/lib/util/brand.d.ts.map +1 -1
  594. package/lib/util/brand.js +0 -1
  595. package/lib/util/brand.js.map +1 -1
  596. package/lib/util/index.d.ts +2 -2
  597. package/lib/util/index.d.ts.map +1 -1
  598. package/lib/util/index.js +2 -2
  599. package/lib/util/index.js.map +1 -1
  600. package/lib/util/rangeMap.d.ts +72 -42
  601. package/lib/util/rangeMap.d.ts.map +1 -1
  602. package/lib/util/rangeMap.js +159 -146
  603. package/lib/util/rangeMap.js.map +1 -1
  604. package/lib/util/typeCheck.d.ts +0 -2
  605. package/lib/util/typeCheck.d.ts.map +1 -1
  606. package/lib/util/typeCheck.js.map +1 -1
  607. package/lib/util/utils.d.ts +35 -1
  608. package/lib/util/utils.d.ts.map +1 -1
  609. package/lib/util/utils.js +29 -0
  610. package/lib/util/utils.js.map +1 -1
  611. package/package.json +23 -23
  612. package/src/core/index.ts +5 -1
  613. package/src/core/rebase/utils.ts +17 -20
  614. package/src/core/schema-stored/format.ts +0 -3
  615. package/src/core/schema-stored/schema.ts +13 -10
  616. package/src/core/schema-view/index.ts +0 -1
  617. package/src/core/schema-view/view.ts +0 -11
  618. package/src/{feature-libraries/chunked-forest → core/tree}/chunk.ts +4 -4
  619. package/src/core/tree/index.ts +8 -0
  620. package/src/core/tree/treeTextFormat.ts +0 -5
  621. package/src/core/tree/types.ts +0 -5
  622. package/src/feature-libraries/chunked-forest/basicChunk.ts +4 -2
  623. package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -1
  624. package/src/feature-libraries/chunked-forest/chunkedForest.ts +2 -1
  625. package/src/feature-libraries/chunked-forest/codec/chunkCodecUtilities.ts +1 -2
  626. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +6 -2
  627. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +1 -1
  628. package/src/feature-libraries/chunked-forest/emptyChunk.ts +4 -2
  629. package/src/feature-libraries/chunked-forest/index.ts +1 -1
  630. package/src/feature-libraries/chunked-forest/sequenceChunk.ts +1 -1
  631. package/src/feature-libraries/chunked-forest/uniformChunk.ts +4 -1
  632. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +14 -1
  633. package/src/feature-libraries/default-schema/defaultSchema.ts +1 -0
  634. package/src/feature-libraries/default-schema/schemaChecker.ts +4 -1
  635. package/src/feature-libraries/index.ts +13 -1
  636. package/src/feature-libraries/indexing/anchorTreeIndex.ts +34 -5
  637. package/src/feature-libraries/modular-schema/crossFieldQueries.ts +9 -9
  638. package/src/feature-libraries/modular-schema/discrepancies.ts +76 -38
  639. package/src/feature-libraries/modular-schema/fieldChangeHandler.ts +13 -9
  640. package/src/feature-libraries/modular-schema/genericFieldKind.ts +4 -2
  641. package/src/feature-libraries/modular-schema/index.ts +14 -0
  642. package/src/feature-libraries/modular-schema/isNeverTree.ts +0 -2
  643. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +124 -31
  644. package/src/feature-libraries/modular-schema/modularChangeTypes.ts +12 -0
  645. package/src/feature-libraries/optional-field/optionalField.ts +34 -5
  646. package/src/feature-libraries/sequence-field/types.ts +0 -1
  647. package/src/feature-libraries/sequence-field/utils.ts +18 -7
  648. package/src/index.ts +12 -29
  649. package/src/packageVersion.ts +1 -1
  650. package/src/shared-tree/index.ts +13 -2
  651. package/src/shared-tree/schematizeTree.ts +6 -10
  652. package/src/shared-tree/schematizingTreeView.ts +102 -23
  653. package/src/shared-tree/sharedTree.ts +181 -44
  654. package/src/shared-tree/transactionTypes.ts +125 -0
  655. package/src/shared-tree/treeApi.ts +1 -28
  656. package/src/shared-tree/treeCheckout.ts +358 -175
  657. package/src/shared-tree-core/branch.ts +29 -122
  658. package/src/shared-tree-core/branchCommitEnricher.ts +19 -20
  659. package/src/shared-tree-core/editManager.ts +3 -8
  660. package/src/shared-tree-core/index.ts +2 -1
  661. package/src/shared-tree-core/sharedTreeCore.ts +8 -19
  662. package/src/shared-tree-core/transaction.ts +145 -0
  663. package/src/simple-tree/api/conciseTree.ts +2 -2
  664. package/src/simple-tree/api/create.ts +5 -1
  665. package/src/simple-tree/api/customTree.ts +69 -1
  666. package/src/simple-tree/api/index.ts +13 -2
  667. package/src/simple-tree/api/jsonSchema.ts +7 -0
  668. package/src/simple-tree/api/schemaFactory.ts +91 -3
  669. package/src/simple-tree/api/schemaFactoryAlpha.ts +253 -0
  670. package/src/simple-tree/api/simpleSchema.ts +9 -2
  671. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +22 -12
  672. package/src/simple-tree/api/simpleTreeIndex.ts +2 -0
  673. package/src/simple-tree/api/storedSchema.ts +7 -22
  674. package/src/simple-tree/api/tree.ts +78 -0
  675. package/src/simple-tree/api/verboseTree.ts +2 -2
  676. package/src/simple-tree/api/view.ts +197 -51
  677. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +19 -13
  678. package/src/simple-tree/arrayNode.ts +7 -1
  679. package/src/simple-tree/core/treeNodeSchema.ts +51 -7
  680. package/src/simple-tree/index.ts +9 -0
  681. package/src/simple-tree/leafNodeSchema.ts +0 -19
  682. package/src/simple-tree/mapNode.ts +7 -1
  683. package/src/simple-tree/objectNode.ts +33 -3
  684. package/src/simple-tree/objectNodeTypes.ts +9 -1
  685. package/src/simple-tree/schemaTypes.ts +57 -3
  686. package/src/simple-tree/toStoredSchema.ts +25 -19
  687. package/src/util/brand.ts +0 -2
  688. package/src/util/index.ts +3 -6
  689. package/src/util/rangeMap.ts +199 -189
  690. package/src/util/typeCheck.ts +0 -2
  691. package/src/util/utils.ts +73 -1
  692. package/dist/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
  693. package/dist/feature-libraries/chunked-forest/chunk.js.map +0 -1
  694. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
  695. package/dist/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
  696. package/dist/feature-libraries/memoizedIdRangeAllocator.js +0 -74
  697. package/dist/feature-libraries/memoizedIdRangeAllocator.js.map +0 -1
  698. package/lib/feature-libraries/chunked-forest/chunk.d.ts.map +0 -1
  699. package/lib/feature-libraries/chunked-forest/chunk.js.map +0 -1
  700. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts +0 -38
  701. package/lib/feature-libraries/memoizedIdRangeAllocator.d.ts.map +0 -1
  702. package/lib/feature-libraries/memoizedIdRangeAllocator.js +0 -71
  703. package/lib/feature-libraries/memoizedIdRangeAllocator.js.map +0 -1
  704. package/src/feature-libraries/memoizedIdRangeAllocator.ts +0 -112
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../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M,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAA,4BAAiB,EAAC,MAAM,CAAC,CAAC,CAAC;IACzE,MAAM,OAAO,GAAG,IAAA,uCAAoB,EAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC;IAE9C,MAAM,sBAAsB,GAAoB;QAC/C,MAAM,EAAE,8BAAmB;QAC3B,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,MAAM;KAClC,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,0BAAe,EACjC,QAAQ,EACR,UAAU,CAAC,eAAe,EAC1B,sBAAsB,CACtB,CAAC;IACF,IAAA,8BAAe,EAAC,UAAU,CAAC,CAAC;IAE5B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,SAA4D,CAAC;IACrE,CAAC;IACD,IAAA,iBAAM,EAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACnE,8JAA8J;IAC9J,oEAAoE;IACpE,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,iCAAsB,CAAC,WAAW,CACrD,IAAA,uCAAoB,EAAC,MAAM,CAAC,EAC5B,OAAO,CACP,CAAC;IAEF,MAAM,MAAM,GAAG,IAAA,uCAA4B,EAAC,WAAW,CAAC,CAAC;IACzD,OAAO,MAAyD,CAAC;AAClE,CAAC;AAlCD,4CAkCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { ITreeCursorSynchronous, SchemaAndPolicy } from \"../../core/index.js\";\nimport type {\n\tImplicitFieldSchema,\n\tTreeFieldFromImplicitField,\n\tFieldSchema,\n\tFieldKind,\n\tUnsafeUnknownSchema,\n\tInsertableField,\n\tTreeLeafValue,\n} from \"../schemaTypes.js\";\nimport {\n\tgetOrCreateNodeFromInnerNode,\n\tUnhydratedFlexTreeNode,\n\ttype TreeNode,\n\ttype Unhydrated,\n} from \"../core/index.js\";\nimport {\n\tcursorForMapTreeNode,\n\tdefaultSchemaPolicy,\n\tFieldKinds,\n\tmapTreeFromCursor,\n\ttype NodeKeyManager,\n} from \"../../feature-libraries/index.js\";\nimport { isFieldInSchema } from \"../../feature-libraries/index.js\";\nimport { toStoredSchema } from \"../toStoredSchema.js\";\nimport { inSchemaOrThrow, mapTreeFromNodeData } from \"../toMapTree.js\";\nimport { getUnhydratedContext } from \"../createContext.js\";\n\n/**\n * Construct tree content that is compatible with the field defined by the provided `schema`.\n * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.\n * @param data - The data used to construct the field content.\n * @remarks\n * When providing a {@link TreeNodeSchemaClass}, this is the same as invoking its constructor except that an unhydrated node can also be provided.\n * This function exists as a generalization that can be used in other cases as well,\n * such as when `undefined` might be allowed (for an optional field), or when the type should be inferred from the data when more than one type is possible.\n *\n * Like with {@link TreeNodeSchemaClass}'s constructor, its an error to provide an existing node to this API.\n * For that case, use {@link TreeBeta.clone}.\n */\nexport function createFromInsertable<\n\tconst TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n>(\n\tschema: UnsafeUnknownSchema extends TSchema\n\t\t? ImplicitFieldSchema\n\t\t: TSchema & ImplicitFieldSchema,\n\tdata: InsertableField<TSchema>,\n\tcontext?: NodeKeyManager | undefined,\n): Unhydrated<\n\tTSchema extends ImplicitFieldSchema\n\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t: TreeNode | TreeLeafValue | undefined\n> {\n\tconst cursor = cursorFromInsertable(schema, data, context);\n\tconst result = cursor === undefined ? undefined : createFromCursor(schema, cursor);\n\treturn result as Unhydrated<\n\t\tTSchema extends ImplicitFieldSchema\n\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t: TreeNode | TreeLeafValue | undefined\n\t>;\n}\n\n/**\n * Construct tree content that is compatible with the field defined by the provided `schema`.\n * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.\n * @param data - The data used to construct the field content.\n * @remarks\n * When providing a {@link TreeNodeSchemaClass},\n * this is the same as invoking its constructor except that an unhydrated node can also be provided and the returned value is a cursor.\n * When `undefined` is provided (for an optional field), `undefined` is returned.\n */\nexport function cursorFromInsertable<\n\tTSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n>(\n\tschema: UnsafeUnknownSchema extends TSchema\n\t\t? ImplicitFieldSchema\n\t\t: TSchema & ImplicitFieldSchema,\n\tdata: InsertableField<TSchema>,\n\tcontext?: NodeKeyManager | undefined,\n):\n\t| ITreeCursorSynchronous\n\t| (TSchema extends FieldSchema<FieldKind.Optional> ? undefined : never) {\n\tconst storedSchema = toStoredSchema(schema);\n\tconst schemaValidationPolicy: SchemaAndPolicy = {\n\t\tpolicy: defaultSchemaPolicy,\n\t\t// TODO: optimize: This isn't the most efficient operation since its not cached, and has to convert all the schema.\n\t\tschema: storedSchema,\n\t};\n\n\tconst mapTree = mapTreeFromNodeData(\n\t\tdata as InsertableField<UnsafeUnknownSchema>,\n\t\tschema,\n\t\tcontext,\n\t\tschemaValidationPolicy,\n\t);\n\tif (mapTree === undefined) {\n\t\tassert(\n\t\t\tstoredSchema.rootFieldSchema.kind === FieldKinds.optional.identifier,\n\t\t\t0xa10 /* missing non-optional field */,\n\t\t);\n\t\treturn undefined as TSchema extends FieldSchema<FieldKind.Optional> ? undefined : never;\n\t}\n\treturn cursorForMapTreeNode(mapTree);\n}\n\n/**\n * Creates an unhydrated simple-tree field from a cursor in nodes mode.\n */\nexport function createFromCursor<const TSchema extends ImplicitFieldSchema>(\n\tschema: TSchema,\n\tcursor: ITreeCursorSynchronous | undefined,\n): Unhydrated<TreeFieldFromImplicitField<TSchema>> {\n\tconst mapTrees = cursor === undefined ? [] : [mapTreeFromCursor(cursor)];\n\tconst context = getUnhydratedContext(schema);\n\tconst flexSchema = context.flexContext.schema;\n\n\tconst schemaValidationPolicy: SchemaAndPolicy = {\n\t\tpolicy: defaultSchemaPolicy,\n\t\tschema: context.flexContext.schema,\n\t};\n\n\tconst maybeError = isFieldInSchema(\n\t\tmapTrees,\n\t\tflexSchema.rootFieldSchema,\n\t\tschemaValidationPolicy,\n\t);\n\tinSchemaOrThrow(maybeError);\n\n\tif (mapTrees.length === 0) {\n\t\treturn undefined as Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n\t}\n\tassert(mapTrees.length === 1, 0xa11 /* unexpected field length */);\n\t// Length asserted above, so this is safe. This assert is done instead of checking for undefined after indexing to ensure a length greater than 1 also errors.\n\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\tconst mapTree = mapTrees[0]!;\n\tconst mapTreeNode = UnhydratedFlexTreeNode.getOrCreate(\n\t\tgetUnhydratedContext(schema),\n\t\tmapTree,\n\t);\n\n\tconst result = getOrCreateNodeFromInnerNode(mapTreeNode);\n\treturn result as Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n}\n"]}
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/simple-tree/api/create.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAY7D,+CAK0B;AAC1B,+DAM0C;AAC1C,+DAAmE;AACnE,4DAAsD;AACtD,kDAAuE;AACvE,0DAA2D;AAC3D,oDAAoE;AAEpE;;;;;;;;;;;GAWG;AACH,SAAgB,oBAAoB,CAGnC,MAEgC,EAChC,IAA8B,EAC9B,OAAoC;IAMpC,MAAM,MAAM,GAAG,oBAAoB,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC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,WAAW,CAAC,MAAM;KAClC,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,0BAAe,EACjC,QAAQ,EACR,UAAU,CAAC,eAAe,EAC1B,sBAAsB,CACtB,CAAC;IACF,IAAA,8BAAe,EAAC,UAAU,CAAC,CAAC;IAE5B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,SAA4D,CAAC;IACrE,CAAC;IACD,IAAA,iBAAM,EAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACnE,8JAA8J;IAC9J,oEAAoE;IACpE,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,iCAAsB,CAAC,WAAW,CACrD,IAAA,uCAAoB,EAAC,MAAM,CAAC,EAC5B,OAAO,CACP,CAAC;IAEF,MAAM,MAAM,GAAG,IAAA,uCAA4B,EAAC,WAAW,CAAC,CAAC;IACzD,OAAO,MAAyD,CAAC;AAClE,CAAC;AArCD,4CAqCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport type { ITreeCursorSynchronous, SchemaAndPolicy } from \"../../core/index.js\";\nimport type {\n\tImplicitFieldSchema,\n\tTreeFieldFromImplicitField,\n\tFieldSchema,\n\tFieldKind,\n\tUnsafeUnknownSchema,\n\tInsertableField,\n\tTreeLeafValue,\n} from \"../schemaTypes.js\";\nimport {\n\tgetOrCreateNodeFromInnerNode,\n\tUnhydratedFlexTreeNode,\n\ttype TreeNode,\n\ttype Unhydrated,\n} from \"../core/index.js\";\nimport {\n\tcursorForMapTreeNode,\n\tdefaultSchemaPolicy,\n\tFieldKinds,\n\tmapTreeFromCursor,\n\ttype NodeKeyManager,\n} from \"../../feature-libraries/index.js\";\nimport { isFieldInSchema } from \"../../feature-libraries/index.js\";\nimport { toStoredSchema } from \"../toStoredSchema.js\";\nimport { inSchemaOrThrow, mapTreeFromNodeData } from \"../toMapTree.js\";\nimport { getUnhydratedContext } from \"../createContext.js\";\nimport { createUnknownOptionalFieldPolicy } from \"../objectNode.js\";\n\n/**\n * Construct tree content that is compatible with the field defined by the provided `schema`.\n * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.\n * @param data - The data used to construct the field content.\n * @remarks\n * When providing a {@link TreeNodeSchemaClass}, this is the same as invoking its constructor except that an unhydrated node can also be provided.\n * This function exists as a generalization that can be used in other cases as well,\n * such as when `undefined` might be allowed (for an optional field), or when the type should be inferred from the data when more than one type is possible.\n *\n * Like with {@link TreeNodeSchemaClass}'s constructor, its an error to provide an existing node to this API.\n * For that case, use {@link TreeBeta.clone}.\n */\nexport function createFromInsertable<\n\tconst TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n>(\n\tschema: UnsafeUnknownSchema extends TSchema\n\t\t? ImplicitFieldSchema\n\t\t: TSchema & ImplicitFieldSchema,\n\tdata: InsertableField<TSchema>,\n\tcontext?: NodeKeyManager | undefined,\n): Unhydrated<\n\tTSchema extends ImplicitFieldSchema\n\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t: TreeNode | TreeLeafValue | undefined\n> {\n\tconst cursor = cursorFromInsertable(schema, data, context);\n\tconst result = cursor === undefined ? undefined : createFromCursor(schema, cursor);\n\treturn result as Unhydrated<\n\t\tTSchema extends ImplicitFieldSchema\n\t\t\t? TreeFieldFromImplicitField<TSchema>\n\t\t\t: TreeNode | TreeLeafValue | undefined\n\t>;\n}\n\n/**\n * Construct tree content that is compatible with the field defined by the provided `schema`.\n * @param schema - The schema for what to construct. As this is an {@link ImplicitFieldSchema}, a {@link FieldSchema}, {@link TreeNodeSchema} or {@link AllowedTypes} array can be provided.\n * @param data - The data used to construct the field content.\n * @remarks\n * When providing a {@link TreeNodeSchemaClass},\n * this is the same as invoking its constructor except that an unhydrated node can also be provided and the returned value is a cursor.\n * When `undefined` is provided (for an optional field), `undefined` is returned.\n */\nexport function cursorFromInsertable<\n\tTSchema extends ImplicitFieldSchema | UnsafeUnknownSchema,\n>(\n\tschema: UnsafeUnknownSchema extends TSchema\n\t\t? ImplicitFieldSchema\n\t\t: TSchema & ImplicitFieldSchema,\n\tdata: InsertableField<TSchema>,\n\tcontext?: NodeKeyManager | undefined,\n):\n\t| ITreeCursorSynchronous\n\t| (TSchema extends FieldSchema<FieldKind.Optional> ? undefined : never) {\n\tconst storedSchema = toStoredSchema(schema);\n\tconst schemaValidationPolicy: SchemaAndPolicy = {\n\t\tpolicy: defaultSchemaPolicy,\n\t\t// TODO: optimize: This isn't the most efficient operation since its not cached, and has to convert all the schema.\n\t\tschema: storedSchema,\n\t};\n\n\tconst mapTree = mapTreeFromNodeData(\n\t\tdata as InsertableField<UnsafeUnknownSchema>,\n\t\tschema,\n\t\tcontext,\n\t\tschemaValidationPolicy,\n\t);\n\tif (mapTree === undefined) {\n\t\tassert(\n\t\t\tstoredSchema.rootFieldSchema.kind === FieldKinds.optional.identifier,\n\t\t\t0xa10 /* missing non-optional field */,\n\t\t);\n\t\treturn undefined as TSchema extends FieldSchema<FieldKind.Optional> ? undefined : never;\n\t}\n\treturn cursorForMapTreeNode(mapTree);\n}\n\n/**\n * Creates an unhydrated simple-tree field from a cursor in nodes mode.\n */\nexport function createFromCursor<const TSchema extends ImplicitFieldSchema>(\n\tschema: TSchema,\n\tcursor: ITreeCursorSynchronous | undefined,\n): Unhydrated<TreeFieldFromImplicitField<TSchema>> {\n\tconst mapTrees = cursor === undefined ? [] : [mapTreeFromCursor(cursor)];\n\tconst context = getUnhydratedContext(schema);\n\tconst flexSchema = context.flexContext.schema;\n\n\tconst schemaValidationPolicy: SchemaAndPolicy = {\n\t\tpolicy: {\n\t\t\t...defaultSchemaPolicy,\n\t\t\tallowUnknownOptionalFields: createUnknownOptionalFieldPolicy(schema),\n\t\t},\n\t\tschema: context.flexContext.schema,\n\t};\n\n\tconst maybeError = isFieldInSchema(\n\t\tmapTrees,\n\t\tflexSchema.rootFieldSchema,\n\t\tschemaValidationPolicy,\n\t);\n\tinSchemaOrThrow(maybeError);\n\n\tif (mapTrees.length === 0) {\n\t\treturn undefined as Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n\t}\n\tassert(mapTrees.length === 1, 0xa11 /* unexpected field length */);\n\t// Length asserted above, so this is safe. This assert is done instead of checking for undefined after indexing to ensure a length greater than 1 also errors.\n\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\tconst mapTree = mapTrees[0]!;\n\tconst mapTreeNode = UnhydratedFlexTreeNode.getOrCreate(\n\t\tgetUnhydratedContext(schema),\n\t\tmapTree,\n\t);\n\n\tconst result = getOrCreateNodeFromInnerNode(mapTreeNode);\n\treturn result as Unhydrated<TreeFieldFromImplicitField<TSchema>>;\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IFluidHandle } from "@fluidframework/core-interfaces";
6
- import { type ITreeCursor } from "../../core/index.js";
6
+ import { type ITreeCursor, type TreeNodeSchemaIdentifier, type TreeNodeStoredSchema } from "../../core/index.js";
7
7
  import type { TreeLeafValue } from "../schemaTypes.js";
8
8
  import { type TreeNodeSchema } from "../core/index.js";
9
9
  /**
@@ -41,5 +41,17 @@ export type CustomTreeNode<TChild> = TChild[] | {
41
41
  /**
42
42
  * Builds an {@link CustomTree} from a cursor in Nodes mode.
43
43
  */
44
- export declare function customFromCursorInner<TChild, THandle>(reader: ITreeCursor, options: Required<EncodeOptions<THandle>>, schema: ReadonlyMap<string, TreeNodeSchema>, childHandler: (reader: ITreeCursor, options: Required<EncodeOptions<THandle>>, schema: ReadonlyMap<string, TreeNodeSchema>) => TChild): CustomTree<TChild, THandle>;
44
+ export declare function customFromCursor<TChild, THandle>(reader: ITreeCursor, options: Required<EncodeOptions<THandle>>, schema: ReadonlyMap<string, TreeNodeSchema>, childHandler: (reader: ITreeCursor, options: Required<EncodeOptions<THandle>>, schema: ReadonlyMap<string, TreeNodeSchema>) => TChild): CustomTree<TChild, THandle>;
45
+ /**
46
+ * Builds an {@link CustomTree} from a cursor in Nodes mode.
47
+ * @remarks
48
+ * Uses stored keys and stored schema.
49
+ */
50
+ export declare function customFromCursorStored<TChild>(reader: ITreeCursor, schema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>, childHandler: (reader: ITreeCursor, schema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>) => TChild): CustomTree<TChild, IFluidHandle>;
51
+ /**
52
+ * Assumes `schema` corresponds to a simple-tree schema.
53
+ * If it is an array schema, returns the allowed types for the array field.
54
+ * Otherwise returns `undefined`.
55
+ */
56
+ export declare function tryStoredSchemaAsArray(schema: TreeNodeStoredSchema): ReadonlySet<string> | undefined;
45
57
  //# sourceMappingURL=customTree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"customTree.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/customTree.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAIpE,OAAO,EAKN,KAAK,WAAW,EAChB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAUjE;;;GAGG;AACH,MAAM,WAAW,aAAa,CAAC,OAAO;IACrC;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,MAAM,EAAE,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,GAAG,eAAe,CAAC,OA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under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.customFromCursorInner = void 0;
7
+ exports.tryStoredSchemaAsArray = exports.customFromCursorStored = exports.customFromCursor = void 0;
8
8
  const internal_1 = require("@fluidframework/runtime-utils/internal");
9
9
  const internal_2 = require("@fluidframework/core-utils/internal");
10
10
  const index_js_1 = require("../../core/index.js");
@@ -12,10 +12,11 @@ const index_js_2 = require("../../util/index.js");
12
12
  const index_js_3 = require("../core/index.js");
13
13
  const leafNodeSchema_js_1 = require("../leafNodeSchema.js");
14
14
  const objectNodeTypes_js_1 = require("../objectNodeTypes.js");
15
+ const index_js_4 = require("../../feature-libraries/index.js");
15
16
  /**
16
17
  * Builds an {@link CustomTree} from a cursor in Nodes mode.
17
18
  */
18
- function customFromCursorInner(reader, options, schema, childHandler) {
19
+ function customFromCursor(reader, options, schema, childHandler) {
19
20
  const type = reader.type;
20
21
  const nodeSchema = schema.get(type) ?? (0, index_js_2.fail)("missing schema for type in cursor");
21
22
  switch (type) {
@@ -59,5 +60,54 @@ function customFromCursorInner(reader, options, schema, childHandler) {
59
60
  }
60
61
  }
61
62
  }
62
- exports.customFromCursorInner = customFromCursorInner;
63
+ exports.customFromCursor = customFromCursor;
64
+ /**
65
+ * Builds an {@link CustomTree} from a cursor in Nodes mode.
66
+ * @remarks
67
+ * Uses stored keys and stored schema.
68
+ */
69
+ function customFromCursorStored(reader, schema, childHandler) {
70
+ const type = reader.type;
71
+ const nodeSchema = schema.get(type) ?? (0, index_js_2.fail)("missing schema for type in cursor");
72
+ if (nodeSchema instanceof index_js_1.LeafNodeStoredSchema) {
73
+ (0, internal_2.assert)((0, index_js_4.valueSchemaAllows)(nodeSchema.leafValue, reader.value), 0xa9c /* invalid value */);
74
+ return reader.value;
75
+ }
76
+ (0, internal_2.assert)(reader.value === undefined, 0xa9d /* out of schema: unexpected value */);
77
+ const arrayTypes = tryStoredSchemaAsArray(nodeSchema);
78
+ if (arrayTypes !== undefined) {
79
+ const field = (0, index_js_1.inCursorField)(reader, index_js_1.EmptyKey, () => (0, index_js_1.mapCursorField)(reader, () => childHandler(reader, schema)));
80
+ return field;
81
+ }
82
+ const fields = {};
83
+ (0, index_js_1.forEachField)(reader, () => {
84
+ const children = (0, index_js_1.mapCursorField)(reader, () => childHandler(reader, schema));
85
+ if (children.length === 1) {
86
+ const storedKey = reader.getFieldKey();
87
+ // Length is checked above.
88
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
89
+ fields[storedKey] = children[0];
90
+ }
91
+ else {
92
+ (0, internal_2.assert)(children.length === 0, 0xa9e /* invalid children number */);
93
+ }
94
+ });
95
+ return fields;
96
+ }
97
+ exports.customFromCursorStored = customFromCursorStored;
98
+ /**
99
+ * Assumes `schema` corresponds to a simple-tree schema.
100
+ * If it is an array schema, returns the allowed types for the array field.
101
+ * Otherwise returns `undefined`.
102
+ */
103
+ function tryStoredSchemaAsArray(schema) {
104
+ if (schema instanceof index_js_1.ObjectNodeStoredSchema) {
105
+ const empty = schema.getFieldSchema(index_js_1.EmptyKey);
106
+ if (empty.kind === index_js_4.FieldKinds.sequence.identifier) {
107
+ (0, internal_2.assert)(schema.objectNodeFields.size === 1, 0xa9f /* invalid schema */);
108
+ return empty.types;
109
+ }
110
+ }
111
+ }
112
+ exports.tryStoredSchemaAsArray = tryStoredSchemaAsArray;
63
113
  //# sourceMappingURL=customTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"customTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/customTree.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qEAAuE;AACvE,kEAA6D;AAE7D,kDAM6B;AAC7B,kDAA2C;AAE3C,+CAAiE;AACjE,4DAM8B;AAC9B,8DAA2D;AAoC3D;;GAEG;AACH,SAAgB,qBAAqB,CACpC,MAAmB,EACnB,OAAyC,EACzC,MAA2C,EAC3C,YAIW;IAEX,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACzB,MAAM,U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AAC;YACf,CAAC;iBAAM,CAAC;gBACP,MAAM,MAAM,GAA2B,EAAE,CAAC;gBAC1C,IAAA,uBAAY,EAAC,MAAM,EAAE,GAAG,EAAE;oBACzB,MAAM,QAAQ,GAAG,IAAA,yBAAc,EAAC,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;oBACrF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;wBAC3B,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;wBACvC,MAAM,GAAG,GACR,IAAA,uCAAkB,EAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa;4BACvD,CAAC,CAAC,CAAC,UAAU,CAAC,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAC;gCAClD,IAAA,eAAI,EAAC,sBAAsB,CAAC,CAAC;4BAC9B,CAAC,CAAC,SAAS,CAAC;wBACd,2BAA2B;wBAC3B,oEAAoE;wBACpE,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC;oBAC5B,CAAC;yBAAM,CAAC;wBACP,IAAA,iBAAM,EAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;oBACpE,CAAC;gBACF,CAAC,CAAC,CAAC;gBACH,OAAO,MAAM,CAAC;YACf,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC;AAtDD,sDAsDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tEmptyKey,\n\tforEachField,\n\tinCursorField,\n\tmapCursorField,\n\ttype ITreeCursor,\n} from \"../../core/index.js\";\nimport { fail } from \"../../util/index.js\";\nimport type { TreeLeafValue } from \"../schemaTypes.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isObjectNodeSchema } from \"../objectNodeTypes.js\";\n\n/**\n * Options for how to encode a tree.\n * @alpha\n */\nexport interface EncodeOptions<TCustom> {\n\t/**\n\t * How to encode any {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles} in the tree.\n\t * @remarks\n\t * See note on {@link ParseOptions.valueConverter}.\n\t */\n\tvalueConverter(data: IFluidHandle): TCustom;\n\t/**\n\t * If true, interpret the input keys of object nodes as stored keys.\n\t * If false, interpret them as property keys.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Tree representation with fields as properties and customized handle and child representations.\n */\nexport type CustomTree<TChild, THandle> = CustomTreeNode<TChild> | CustomTreeValue<THandle>;\n\n/**\n * TreeLeafValue except the handle type is customized.\n */\nexport type CustomTreeValue<THandle> = Exclude<TreeLeafValue, IFluidHandle> | THandle;\n\n/**\n * Tree node representation with fields as properties and customized child representation.\n */\nexport type CustomTreeNode<TChild> = TChild[] | { [key: string]: TChild };\n\n/**\n * Builds an {@link CustomTree} from a cursor in Nodes mode.\n */\nexport function customFromCursorInner<TChild, THandle>(\n\treader: ITreeCursor,\n\toptions: Required<EncodeOptions<THandle>>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n\tchildHandler: (\n\t\treader: ITreeCursor,\n\t\toptions: Required<EncodeOptions<THandle>>,\n\t\tschema: ReadonlyMap<string, TreeNodeSchema>,\n\t) => TChild,\n): CustomTree<TChild, THandle> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(\"missing schema for type in cursor\");\n\n\tswitch (type) {\n\t\tcase numberSchema.identifier:\n\t\tcase booleanSchema.identifier:\n\t\tcase nullSchema.identifier:\n\t\tcase stringSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa50 /* out of schema: missing value */);\n\t\t\tassert(!isFluidHandle(reader.value), 0xa51 /* out of schema: unexpected FluidHandle */);\n\t\t\treturn reader.value;\n\t\tcase handleSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa52 /* out of schema: missing value */);\n\t\t\tassert(isFluidHandle(reader.value), 0xa53 /* out of schema: expected FluidHandle */);\n\t\t\treturn options.valueConverter(reader.value);\n\t\tdefault: {\n\t\t\tassert(reader.value === undefined, 0xa54 /* out of schema: unexpected value */);\n\t\t\tif (nodeSchema.kind === NodeKind.Array) {\n\t\t\t\tconst fields = inCursorField(reader, EmptyKey, () =>\n\t\t\t\t\tmapCursorField(reader, () => childHandler(reader, options, schema)),\n\t\t\t\t);\n\t\t\t\treturn fields;\n\t\t\t} else {\n\t\t\t\tconst fields: Record<string, TChild> = {};\n\t\t\t\tforEachField(reader, () => {\n\t\t\t\t\tconst children = mapCursorField(reader, () => childHandler(reader, options, schema));\n\t\t\t\t\tif (children.length === 1) {\n\t\t\t\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t\t\t\tconst key =\n\t\t\t\t\t\t\tisObjectNodeSchema(nodeSchema) && !options.useStoredKeys\n\t\t\t\t\t\t\t\t? (nodeSchema.storedKeyToPropertyKey.get(storedKey) ??\n\t\t\t\t\t\t\t\t\tfail(\"missing property key\"))\n\t\t\t\t\t\t\t\t: storedKey;\n\t\t\t\t\t\t// Length is checked above.\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tfields[key] = children[0]!;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(children.length === 0, 0xa19 /* invalid children number */);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn fields;\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"customTree.js","sourceRoot":"","sources":["../../../src/simple-tree/api/customTree.ts"],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C3B,oEAAoE;YACpE,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC;QAClC,CAAC;aAAM,CAAC;YACP,IAAA,iBAAM,EAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACpE,CAAC;IACF,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AACf,CAAC;AAvCD,wDAuCC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CACrC,MAA4B;IAE5B,IAAI,MAAM,YAAY,iCAAsB,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,mBAAQ,CAAC,CAAC;QAC9C,IAAI,KAAK,CAAC,IAAI,KAAK,qBAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;YACnD,IAAA,iBAAM,EAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACvE,OAAO,KAAK,CAAC,KAAK,CAAC;QACpB,CAAC;IACF,CAAC;AACF,CAAC;AAVD,wDAUC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { isFluidHandle } from \"@fluidframework/runtime-utils/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport {\n\tEmptyKey,\n\tforEachField,\n\tinCursorField,\n\tLeafNodeStoredSchema,\n\tmapCursorField,\n\tObjectNodeStoredSchema,\n\ttype ITreeCursor,\n\ttype TreeNodeSchemaIdentifier,\n\ttype TreeNodeStoredSchema,\n} from \"../../core/index.js\";\nimport { fail } from \"../../util/index.js\";\nimport type { TreeLeafValue } from \"../schemaTypes.js\";\nimport { NodeKind, type TreeNodeSchema } from \"../core/index.js\";\nimport {\n\tbooleanSchema,\n\thandleSchema,\n\tnullSchema,\n\tnumberSchema,\n\tstringSchema,\n} from \"../leafNodeSchema.js\";\nimport { isObjectNodeSchema } from \"../objectNodeTypes.js\";\nimport { FieldKinds, valueSchemaAllows } from \"../../feature-libraries/index.js\";\n\n/**\n * Options for how to encode a tree.\n * @alpha\n */\nexport interface EncodeOptions<TCustom> {\n\t/**\n\t * How to encode any {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles} in the tree.\n\t * @remarks\n\t * See note on {@link ParseOptions.valueConverter}.\n\t */\n\tvalueConverter(data: IFluidHandle): TCustom;\n\t/**\n\t * If true, interpret the input keys of object nodes as stored keys.\n\t * If false, interpret them as property keys.\n\t * @defaultValue false.\n\t */\n\treadonly useStoredKeys?: boolean;\n}\n\n/**\n * Tree representation with fields as properties and customized handle and child representations.\n */\nexport type CustomTree<TChild, THandle> = CustomTreeNode<TChild> | CustomTreeValue<THandle>;\n\n/**\n * TreeLeafValue except the handle type is customized.\n */\nexport type CustomTreeValue<THandle> = Exclude<TreeLeafValue, IFluidHandle> | THandle;\n\n/**\n * Tree node representation with fields as properties and customized child representation.\n */\nexport type CustomTreeNode<TChild> = TChild[] | { [key: string]: TChild };\n\n/**\n * Builds an {@link CustomTree} from a cursor in Nodes mode.\n */\nexport function customFromCursor<TChild, THandle>(\n\treader: ITreeCursor,\n\toptions: Required<EncodeOptions<THandle>>,\n\tschema: ReadonlyMap<string, TreeNodeSchema>,\n\tchildHandler: (\n\t\treader: ITreeCursor,\n\t\toptions: Required<EncodeOptions<THandle>>,\n\t\tschema: ReadonlyMap<string, TreeNodeSchema>,\n\t) => TChild,\n): CustomTree<TChild, THandle> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(\"missing schema for type in cursor\");\n\n\tswitch (type) {\n\t\tcase numberSchema.identifier:\n\t\tcase booleanSchema.identifier:\n\t\tcase nullSchema.identifier:\n\t\tcase stringSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa50 /* out of schema: missing value */);\n\t\t\tassert(!isFluidHandle(reader.value), 0xa51 /* out of schema: unexpected FluidHandle */);\n\t\t\treturn reader.value;\n\t\tcase handleSchema.identifier:\n\t\t\tassert(reader.value !== undefined, 0xa52 /* out of schema: missing value */);\n\t\t\tassert(isFluidHandle(reader.value), 0xa53 /* out of schema: expected FluidHandle */);\n\t\t\treturn options.valueConverter(reader.value);\n\t\tdefault: {\n\t\t\tassert(reader.value === undefined, 0xa54 /* out of schema: unexpected value */);\n\t\t\tif (nodeSchema.kind === NodeKind.Array) {\n\t\t\t\tconst fields = inCursorField(reader, EmptyKey, () =>\n\t\t\t\t\tmapCursorField(reader, () => childHandler(reader, options, schema)),\n\t\t\t\t);\n\t\t\t\treturn fields;\n\t\t\t} else {\n\t\t\t\tconst fields: Record<string, TChild> = {};\n\t\t\t\tforEachField(reader, () => {\n\t\t\t\t\tconst children = mapCursorField(reader, () => childHandler(reader, options, schema));\n\t\t\t\t\tif (children.length === 1) {\n\t\t\t\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t\t\t\tconst key =\n\t\t\t\t\t\t\tisObjectNodeSchema(nodeSchema) && !options.useStoredKeys\n\t\t\t\t\t\t\t\t? (nodeSchema.storedKeyToPropertyKey.get(storedKey) ??\n\t\t\t\t\t\t\t\t\tfail(\"missing property key\"))\n\t\t\t\t\t\t\t\t: storedKey;\n\t\t\t\t\t\t// Length is checked above.\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tfields[key] = children[0]!;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(children.length === 0, 0xa19 /* invalid children number */);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn fields;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Builds an {@link CustomTree} from a cursor in Nodes mode.\n * @remarks\n * Uses stored keys and stored schema.\n */\nexport function customFromCursorStored<TChild>(\n\treader: ITreeCursor,\n\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n\tchildHandler: (\n\t\treader: ITreeCursor,\n\t\tschema: ReadonlyMap<TreeNodeSchemaIdentifier, TreeNodeStoredSchema>,\n\t) => TChild,\n): CustomTree<TChild, IFluidHandle> {\n\tconst type = reader.type;\n\tconst nodeSchema = schema.get(type) ?? fail(\"missing schema for type in cursor\");\n\n\tif (nodeSchema instanceof LeafNodeStoredSchema) {\n\t\tassert(valueSchemaAllows(nodeSchema.leafValue, reader.value), 0xa9c /* invalid value */);\n\t\treturn reader.value;\n\t}\n\n\tassert(reader.value === undefined, 0xa9d /* out of schema: unexpected value */);\n\n\tconst arrayTypes = tryStoredSchemaAsArray(nodeSchema);\n\tif (arrayTypes !== undefined) {\n\t\tconst field = inCursorField(reader, EmptyKey, () =>\n\t\t\tmapCursorField(reader, () => childHandler(reader, schema)),\n\t\t);\n\t\treturn field;\n\t}\n\n\tconst fields: Record<string, TChild> = {};\n\tforEachField(reader, () => {\n\t\tconst children = mapCursorField(reader, () => childHandler(reader, schema));\n\t\tif (children.length === 1) {\n\t\t\tconst storedKey = reader.getFieldKey();\n\t\t\t// Length is checked above.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tfields[storedKey] = children[0]!;\n\t\t} else {\n\t\t\tassert(children.length === 0, 0xa9e /* invalid children number */);\n\t\t}\n\t});\n\treturn fields;\n}\n\n/**\n * Assumes `schema` corresponds to a simple-tree schema.\n * If it is an array schema, returns the allowed types for the array field.\n * Otherwise returns `undefined`.\n */\nexport function tryStoredSchemaAsArray(\n\tschema: TreeNodeStoredSchema,\n): ReadonlySet<string> | undefined {\n\tif (schema instanceof ObjectNodeStoredSchema) {\n\t\tconst empty = schema.getFieldSchema(EmptyKey);\n\t\tif (empty.kind === FieldKinds.sequence.identifier) {\n\t\t\tassert(schema.objectNodeFields.size === 1, 0xa9f /* invalid schema */);\n\t\t\treturn empty.types;\n\t\t}\n\t}\n}\n"]}
@@ -3,7 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { type ITree, type TreeView, type ViewableTree, type TreeViewEvents, TreeViewConfiguration, type ITreeViewConfiguration, type SchemaCompatibilityStatus, type ITreeConfigurationOptions, type TreeViewAlpha, type TreeBranch, type TreeBranchEvents, asTreeViewAlpha, } from "./tree.js";
6
- export { SchemaFactory, type ScopedSchemaName } from "./schemaFactory.js";
6
+ export { SchemaFactory, type ScopedSchemaName, type SchemaFactoryObjectOptions, } from "./schemaFactory.js";
7
+ export { SchemaFactoryAlpha } from "./schemaFactoryAlpha.js";
7
8
  export type { ValidateRecursiveSchema, FixRecursiveArraySchema, } from "./schemaFactoryRecursive.js";
8
9
  export { adaptEnum, enumFromStrings, singletonSchema, } from "./schemaCreationUtilities.js";
9
10
  export { treeNodeApi, type TreeNodeApi, tryGetSchema } from "./treeNodeApi.js";
@@ -15,7 +16,7 @@ export { getSimpleSchema } from "./getSimpleSchema.js";
15
16
  export { ViewSchema } from "./view.js";
16
17
  export type { Unenforced, FieldHasDefaultUnsafe, ObjectFromSchemaRecordUnsafe, TreeObjectNodeUnsafe, TreeFieldFromImplicitFieldUnsafe, TreeNodeFromImplicitAllowedTypesUnsafe, FieldSchemaUnsafe, InsertableTreeNodeFromImplicitAllowedTypesUnsafe, TreeArrayNodeUnsafe, TreeMapNodeUnsafe, InsertableObjectFromSchemaRecordUnsafe, InsertableTreeFieldFromImplicitFieldUnsafe, InsertableTypedNodeUnsafe, NodeBuilderDataUnsafe, NodeFromSchemaUnsafe, ReadonlyMapInlined, TreeNodeSchemaClassUnsafe, TreeNodeSchemaUnsafe, AllowedTypesUnsafe, TreeNodeSchemaNonClassUnsafe, InsertableTreeNodeFromAllowedTypesUnsafe, } from "./typesUnsafe.js";
17
18
  export { type VerboseTreeNode, type ParseOptions, type VerboseTree, applySchemaToParserOptions, cursorFromVerbose, verboseFromCursor, } from "./verboseTree.js";
18
- export type { EncodeOptions } from "./customTree.js";
19
+ export { type EncodeOptions, customFromCursorStored, type CustomTreeNode, type CustomTreeValue, tryStoredSchemaAsArray, } from "./customTree.js";
19
20
  export { type ConciseTree, conciseFromCursor } from "./conciseTree.js";
20
21
  export { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from "./treeApiBeta.js";
21
22
  export { createSimpleTreeIndex, type SimpleTreeIndex } from "./simpleTreeIndex.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,eAAe,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,YAAY,EACX,uBAAuB,EACvB,uBAAuB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,SAAS,EACT,eAAe,EACf,eAAe,GACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3F,YAAY,EACX,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,WAAW,E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AAI,IAAI,yBAAyB,EACjC,uBAAuB,IAAI,4BAA4B,GACvD,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,eAAe,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EACX,uBAAuB,EACvB,uBAAuB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,SAAS,EACT,eAAe,EACf,eAAe,GACf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3F,YAAY,EACX,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK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,IAAI,oBAAoB,EACvC,IAAI,IAAI,yBAAyB,EACjC,uBAAuB,IAAI,4BAA4B,GACvD,MAAM,0BAA0B,CAAC"}
@@ -4,12 +4,14 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.comparePersistedSchema = exports.comparePersistedSchemaInternal = exports.extractPersistedSchema = exports.createIdentifierIndex = exports.createSimpleTreeIndex = exports.TreeBeta = exports.conciseFromCursor = exports.verboseFromCursor = exports.cursorFromVerbose = exports.applySchemaToParserOptions = exports.ViewSchema = exports.getSimpleSchema = exports.getJsonSchema = exports.createFromCursor = exports.cursorFromInsertable = exports.createFromInsertable = exports.tryGetSchema = exports.treeNodeApi = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.SchemaFactory = exports.asTreeViewAlpha = exports.TreeViewConfiguration = void 0;
7
+ exports.test_RecursiveObjectPojoMode = exports.test_RecursiveObject_base = exports.test_RecursiveObject = exports.comparePersistedSchema = exports.comparePersistedSchemaInternal = exports.extractPersistedSchema = exports.createIdentifierIndex = exports.createSimpleTreeIndex = exports.TreeBeta = exports.conciseFromCursor = exports.tryStoredSchemaAsArray = exports.customFromCursorStored = exports.verboseFromCursor = exports.cursorFromVerbose = exports.applySchemaToParserOptions = exports.ViewSchema = exports.getSimpleSchema = exports.getJsonSchema = exports.createFromCursor = exports.cursorFromInsertable = exports.createFromInsertable = exports.tryGetSchema = exports.treeNodeApi = exports.singletonSchema = exports.enumFromStrings = exports.adaptEnum = exports.SchemaFactoryAlpha = exports.SchemaFactory = exports.asTreeViewAlpha = exports.TreeViewConfiguration = void 0;
8
8
  var tree_js_1 = require("./tree.js");
9
9
  Object.defineProperty(exports, "TreeViewConfiguration", { enumerable: true, get: function () { return tree_js_1.TreeViewConfiguration; } });
10
10
  Object.defineProperty(exports, "asTreeViewAlpha", { enumerable: true, get: function () { return tree_js_1.asTreeViewAlpha; } });
11
11
  var schemaFactory_js_1 = require("./schemaFactory.js");
12
12
  Object.defineProperty(exports, "SchemaFactory", { enumerable: true, get: function () { return schemaFactory_js_1.SchemaFactory; } });
13
+ var schemaFactoryAlpha_js_1 = require("./schemaFactoryAlpha.js");
14
+ Object.defineProperty(exports, "SchemaFactoryAlpha", { enumerable: true, get: function () { return schemaFactoryAlpha_js_1.SchemaFactoryAlpha; } });
13
15
  var schemaCreationUtilities_js_1 = require("./schemaCreationUtilities.js");
14
16
  Object.defineProperty(exports, "adaptEnum", { enumerable: true, get: function () { return schemaCreationUtilities_js_1.adaptEnum; } });
15
17
  Object.defineProperty(exports, "enumFromStrings", { enumerable: true, get: function () { return schemaCreationUtilities_js_1.enumFromStrings; } });
@@ -31,6 +33,9 @@ var verboseTree_js_1 = require("./verboseTree.js");
31
33
  Object.defineProperty(exports, "applySchemaToParserOptions", { enumerable: true, get: function () { return verboseTree_js_1.applySchemaToParserOptions; } });
32
34
  Object.defineProperty(exports, "cursorFromVerbose", { enumerable: true, get: function () { return verboseTree_js_1.cursorFromVerbose; } });
33
35
  Object.defineProperty(exports, "verboseFromCursor", { enumerable: true, get: function () { return verboseTree_js_1.verboseFromCursor; } });
36
+ var customTree_js_1 = require("./customTree.js");
37
+ Object.defineProperty(exports, "customFromCursorStored", { enumerable: true, get: function () { return customTree_js_1.customFromCursorStored; } });
38
+ Object.defineProperty(exports, "tryStoredSchemaAsArray", { enumerable: true, get: function () { return customTree_js_1.tryStoredSchemaAsArray; } });
34
39
  var conciseTree_js_1 = require("./conciseTree.js");
35
40
  Object.defineProperty(exports, "conciseFromCursor", { enumerable: true, get: function () { return conciseTree_js_1.conciseFromCursor; } });
36
41
  var treeApiBeta_js_1 = require("./treeApiBeta.js");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAamB;AARlB,gHAAA,qBAAqB,OAAA;AAOrB,0GAAA,eAAe,OAAA;AAEhB,uDAA0E;AAAjE,iHAAA,aAAa,OAAA;AAKtB,2EAIsC;AAHrC,uHAAA,SAAS,OAAA;AACT,6HAAA,eAAe,OAAA;AACf,6HAAA,eAAe,OAAA;AAEhB,mDAA+E;AAAtE,6GAAA,WAAW,OAAA;AAAoB,8GAAA,YAAY,OAAA;AACpD,yCAA2F;AAAlF,iHAAA,oBAAoB,OAAA;AAAE,iHAAA,oBAAoB,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AA0BrE,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AACtB,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AACxB,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AAyBnB,mDAO0B;AAHzB,4HAAA,0BAA0B,OAAA;AAC1B,mHAAA,iBAAiB,OAAA;AACjB,mHAAA,iBAAiB,OAAA;AAKlB,mDAAuE;AAA5C,mHAAA,iBAAiB,OAAA;AAE5C,mDAA6F;AAApF,0GAAA,QAAQ,OAAA;AACjB,2DAAmF;AAA1E,2HAAA,qBAAqB,OAAA;AAC9B,2DAG8B;AAF7B,2HAAA,qBAAqB,OAAA;AAItB,qDAI2B;AAH1B,yHAAA,sBAAsB,OAAA;AACtB,iIAAA,8BAA8B,OAAA;AAC9B,yHAAA,sBAAsB,OAAA;AAGvB,6FAA6F;AAC7F,4IAA4I;AAC5I,mEAIkC;AAHjC,8HAAA,eAAe,OAAwB;AACvC,mIAAA,IAAI,OAA6B;AACjC,sIAAA,uBAAuB,OAAgC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ITree,\n\ttype TreeView,\n\ttype ViewableTree,\n\ttype TreeViewEvents,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype SchemaCompatibilityStatus,\n\ttype ITreeConfigurationOptions,\n\ttype TreeViewAlpha,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n} from \"./tree.js\";\nexport { SchemaFactory, type ScopedSchemaName } from \"./schemaFactory.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n} from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n} from \"./schemaCreationUtilities.js\";\nexport { treeNodeApi, type TreeNodeApi, tryGetSchema } from \"./treeNodeApi.js\";\nexport { createFromInsertable, cursorFromInsertable, createFromCursor } from \"./create.js\";\nexport type {\n\tSimpleTreeSchema,\n\tSimpleNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleArrayNodeSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleNodeSchemaBase,\n} from \"./simpleSchema.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n} from \"./jsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { ViewSchema } from \"./view.js\";\nexport type {\n\tUnenforced,\n\tFieldHasDefaultUnsafe,\n\tObjectFromSchemaRecordUnsafe,\n\tTreeObjectNodeUnsafe,\n\tTreeFieldFromImplicitFieldUnsafe,\n\tTreeNodeFromImplicitAllowedTypesUnsafe,\n\tFieldSchemaUnsafe,\n\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\tTreeArrayNodeUnsafe,\n\tTreeMapNodeUnsafe,\n\tInsertableObjectFromSchemaRecordUnsafe,\n\tInsertableTreeFieldFromImplicitFieldUnsafe,\n\tInsertableTypedNodeUnsafe,\n\tNodeBuilderDataUnsafe,\n\tNodeFromSchemaUnsafe,\n\tReadonlyMapInlined,\n\tTreeNodeSchemaClassUnsafe,\n\tTreeNodeSchemaUnsafe,\n\tAllowedTypesUnsafe,\n\tTreeNodeSchemaNonClassUnsafe,\n\tInsertableTreeNodeFromAllowedTypesUnsafe,\n} from \"./typesUnsafe.js\";\n\nexport {\n\ttype VerboseTreeNode,\n\ttype ParseOptions,\n\ttype VerboseTree,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n} from \"./verboseTree.js\";\n\nexport type { EncodeOptions } from \"./customTree.js\";\n\nexport { type ConciseTree, conciseFromCursor } from \"./conciseTree.js\";\n\nexport { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from \"./treeApiBeta.js\";\nexport { createSimpleTreeIndex, type SimpleTreeIndex } from \"./simpleTreeIndex.js\";\nexport {\n\tcreateIdentifierIndex,\n\ttype IdentifierIndex,\n} from \"./identifierIndex.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchemaInternal,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\n// Exporting the schema (RecursiveObject) to test that recursive types are working correctly.\n// These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639\nexport {\n\tRecursiveObject as test_RecursiveObject,\n\tbase as test_RecursiveObject_base,\n\tRecursiveObjectPojoMode as test_RecursiveObjectPojoMode,\n} from \"./testRecursiveDomain.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/simple-tree/api/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAamB;AARlB,gHAAA,qBAAqB,OAAA;AAOrB,0GAAA,eAAe,OAAA;AAEhB,uDAI4B;AAH3B,iHAAA,aAAa,OAAA;AAId,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA;AAK3B,2EAIsC;AAHrC,uHAAA,SAAS,OAAA;AACT,6HAAA,eAAe,OAAA;AACf,6HAAA,eAAe,OAAA;AAEhB,mDAA+E;AAAtE,6GAAA,WAAW,OAAA;AAAoB,8GAAA,YAAY,OAAA;AACpD,yCAA2F;AAAlF,iHAAA,oBAAoB,OAAA;AAAE,iHAAA,oBAAoB,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AA0BrE,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AACtB,2DAAuD;AAA9C,qHAAA,eAAe,OAAA;AACxB,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AAyBnB,mDAO0B;AAHzB,4HAAA,0BAA0B,OAAA;AAC1B,mHAAA,iBAAiB,OAAA;AACjB,mHAAA,iBAAiB,OAAA;AAGlB,iDAMyB;AAJxB,uHAAA,sBAAsB,OAAA;AAGtB,uHAAA,sBAAsB,OAAA;AAGvB,mDAAuE;AAA5C,mHAAA,iBAAiB,OAAA;AAE5C,mDAA6F;AAApF,0GAAA,QAAQ,OAAA;AACjB,2DAAmF;AAA1E,2HAAA,qBAAqB,OAAA;AAC9B,2DAG8B;AAF7B,2HAAA,qBAAqB,OAAA;AAItB,qDAI2B;AAH1B,yHAAA,sBAAsB,OAAA;AACtB,iIAAA,8BAA8B,OAAA;AAC9B,yHAAA,sBAAsB,OAAA;AAGvB,6FAA6F;AAC7F,4IAA4I;AAC5I,mEAIkC;AAHjC,8HAAA,eAAe,OAAwB;AACvC,mIAAA,IAAI,OAA6B;AACjC,sIAAA,uBAAuB,OAAgC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\ttype ITree,\n\ttype TreeView,\n\ttype ViewableTree,\n\ttype TreeViewEvents,\n\tTreeViewConfiguration,\n\ttype ITreeViewConfiguration,\n\ttype SchemaCompatibilityStatus,\n\ttype ITreeConfigurationOptions,\n\ttype TreeViewAlpha,\n\ttype TreeBranch,\n\ttype TreeBranchEvents,\n\tasTreeViewAlpha,\n} from \"./tree.js\";\nexport {\n\tSchemaFactory,\n\ttype ScopedSchemaName,\n\ttype SchemaFactoryObjectOptions,\n} from \"./schemaFactory.js\";\nexport { SchemaFactoryAlpha } from \"./schemaFactoryAlpha.js\";\nexport type {\n\tValidateRecursiveSchema,\n\tFixRecursiveArraySchema,\n} from \"./schemaFactoryRecursive.js\";\nexport {\n\tadaptEnum,\n\tenumFromStrings,\n\tsingletonSchema,\n} from \"./schemaCreationUtilities.js\";\nexport { treeNodeApi, type TreeNodeApi, tryGetSchema } from \"./treeNodeApi.js\";\nexport { createFromInsertable, cursorFromInsertable, createFromCursor } from \"./create.js\";\nexport type {\n\tSimpleTreeSchema,\n\tSimpleNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleArrayNodeSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleNodeSchemaBase,\n} from \"./simpleSchema.js\";\nexport {\n\ttype JsonSchemaId,\n\ttype JsonSchemaType,\n\ttype JsonObjectNodeSchema,\n\ttype JsonArrayNodeSchema,\n\ttype JsonMapNodeSchema,\n\ttype JsonLeafNodeSchema,\n\ttype JsonSchemaRef,\n\ttype JsonRefPath,\n\ttype JsonNodeSchema,\n\ttype JsonNodeSchemaBase,\n\ttype JsonTreeSchema,\n\ttype JsonFieldSchema,\n\ttype JsonLeafSchemaType,\n} from \"./jsonSchema.js\";\nexport { getJsonSchema } from \"./getJsonSchema.js\";\nexport { getSimpleSchema } from \"./getSimpleSchema.js\";\nexport { ViewSchema } from \"./view.js\";\nexport type {\n\tUnenforced,\n\tFieldHasDefaultUnsafe,\n\tObjectFromSchemaRecordUnsafe,\n\tTreeObjectNodeUnsafe,\n\tTreeFieldFromImplicitFieldUnsafe,\n\tTreeNodeFromImplicitAllowedTypesUnsafe,\n\tFieldSchemaUnsafe,\n\tInsertableTreeNodeFromImplicitAllowedTypesUnsafe,\n\tTreeArrayNodeUnsafe,\n\tTreeMapNodeUnsafe,\n\tInsertableObjectFromSchemaRecordUnsafe,\n\tInsertableTreeFieldFromImplicitFieldUnsafe,\n\tInsertableTypedNodeUnsafe,\n\tNodeBuilderDataUnsafe,\n\tNodeFromSchemaUnsafe,\n\tReadonlyMapInlined,\n\tTreeNodeSchemaClassUnsafe,\n\tTreeNodeSchemaUnsafe,\n\tAllowedTypesUnsafe,\n\tTreeNodeSchemaNonClassUnsafe,\n\tInsertableTreeNodeFromAllowedTypesUnsafe,\n} from \"./typesUnsafe.js\";\n\nexport {\n\ttype VerboseTreeNode,\n\ttype ParseOptions,\n\ttype VerboseTree,\n\tapplySchemaToParserOptions,\n\tcursorFromVerbose,\n\tverboseFromCursor,\n} from \"./verboseTree.js\";\n\nexport {\n\ttype EncodeOptions,\n\tcustomFromCursorStored,\n\ttype CustomTreeNode,\n\ttype CustomTreeValue,\n\ttryStoredSchemaAsArray,\n} from \"./customTree.js\";\n\nexport { type ConciseTree, conciseFromCursor } from \"./conciseTree.js\";\n\nexport { TreeBeta, type NodeChangedData, type TreeChangeEventsBeta } from \"./treeApiBeta.js\";\nexport { createSimpleTreeIndex, type SimpleTreeIndex } from \"./simpleTreeIndex.js\";\nexport {\n\tcreateIdentifierIndex,\n\ttype IdentifierIndex,\n} from \"./identifierIndex.js\";\n\nexport {\n\textractPersistedSchema,\n\tcomparePersistedSchemaInternal,\n\tcomparePersistedSchema,\n} from \"./storedSchema.js\";\n\n// Exporting the schema (RecursiveObject) to test that recursive types are working correctly.\n// These are `@internal` so they can't be included in the `InternalClassTreeTypes` due to https://github.com/microsoft/rushstack/issues/3639\nexport {\n\tRecursiveObject as test_RecursiveObject,\n\tbase as test_RecursiveObject_base,\n\tRecursiveObjectPojoMode as test_RecursiveObjectPojoMode,\n} from \"./testRecursiveDomain.js\";\n"]}
@@ -48,6 +48,12 @@ export interface JsonNodeSchemaBase<TNodeKind extends NodeKind, TJsonSchemaType
48
48
  * {@inheritDoc JsonSchemaType}
49
49
  */
50
50
  readonly type: TJsonSchemaType;
51
+ /**
52
+ * Description of the node schema.
53
+ * @remarks Derived from {@link NodeSchemaMetadata.description}.
54
+ * @see {@link https://json-schema.org/draft/2020-12/json-schema-validation#name-title-and-description}
55
+ */
56
+ readonly description?: string | undefined;
51
57
  }
52
58
  /**
53
59
  * JSON Schema for an object node.
@@ -1 +1 @@
1
- {"version":3,"file":"jsonSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/jsonSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,YAAY,EAAE,CAAC;AAEpD;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,OAAO,GAAG,kBAAkB,CAAC;AAErE;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB,CAClC,SAAS,SAAS,QAAQ,EAC1B,eAAe,SAAS,cAAc;IAEtC;;;;;;;OAOG;IACH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,CAAC;IAExC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1F;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAErD;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CACxC;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BAAkB,SAAQ,kBAAkB,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IACpF;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE;QAC3B;;;WAGG;QACH,MAAM,EAAE,eAAe,CAAC;KACxB,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAChB,SAAQ,kBAAkB,CAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAC7D;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,IAAI,EAAE,WAAW,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACvB,kBAAkB,GAClB,iBAAiB,GACjB,mBAAmB,GACnB,oBAAoB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,GAAG,CACD;IACA;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,CAAC;CAC/B,GACD,aAAa,CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG;IAC9C;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;CACrD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"jsonSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/jsonSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { NodeKind } from \"../core/index.js\";\n\n/**\n * The fully-qualified {@link TreeNodeSchemaCore.identifier}.\n * @alpha\n */\nexport type JsonSchemaId = string;\n\n/**\n * Reference string pointing to a definition in the schema.\n * Should be the fully-qualified {@link TreeNodeSchemaCore.identifier}.\n * @remarks Of the form `#/$defs/<schema-identifier>`, where the `schema-identifier` is the fully-qualified {@link TreeNodeSchemaCore.identifier}.\n * @example Schema `com.myapp.foo` would be referenced via `#/$defs/com.myapp.foo`.\n * @alpha\n */\nexport type JsonRefPath = `#/$defs/${JsonSchemaId}`;\n\n/**\n * JSON entity type.\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n * @alpha\n */\nexport type JsonSchemaType = \"object\" | \"array\" | JsonLeafSchemaType;\n\n/**\n * JSON primitive types.\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n * @alpha\n */\nexport type JsonLeafSchemaType = \"string\" | \"number\" | \"boolean\" | \"null\";\n\n/**\n * Base interface for node schemas represented in {@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} format.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonNodeSchemaBase<\n\tTNodeKind extends NodeKind,\n\tTJsonSchemaType extends JsonSchemaType,\n> {\n\t/**\n\t * Kind of {@link TreeNodeSchema} this JSON Schema entry represents.\n\t *\n\t * @remarks There is not a 1:1 mapping between {@link TreeNodeSchema} types and JSON Schema types.\n\t * This is used to disambiguate the type of {@link TreeNodeSchema} this JSON Schema maps to.\n\t *\n\t * Note: This property name is not a part of the JSON Schema spec. This is a Fluid-specific extension.\n\t */\n\treadonly _treeNodeSchemaKind: TNodeKind;\n\n\t/**\n\t * {@inheritDoc JsonSchemaType}\n\t */\n\treadonly type: TJsonSchemaType;\n}\n\n/**\n * JSON Schema for an object node.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonObjectNodeSchema extends JsonNodeSchemaBase<NodeKind.Object, \"object\"> {\n\t/**\n\t * Object fields.\n\t * @remarks Required fields should have a corresponding entry in {@link JsonObjectNodeSchema.required}.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-properties}.\n\t */\n\treadonly properties: Record<string, JsonFieldSchema>;\n\n\t/**\n\t * List of keys for required fields.\n\t *\n\t * @remarks\n\t * Optional fields should not be included in this list.\n\t * Each key specified must have an entry in {@link JsonObjectNodeSchema.properties}.\n\t */\n\treadonly required?: string[];\n\n\t/**\n\t * Whether or not additional properties (properties not specified by the schema) are allowed in objects of this type.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-additionalproperties}.\n\t */\n\treadonly additionalProperties?: boolean;\n}\n\n/**\n * JSON Schema for an array node.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonArrayNodeSchema extends JsonNodeSchemaBase<NodeKind.Array, \"array\"> {\n\t/**\n\t * The kinds of items allowed under the array.\n\t *\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-items}.\n\t */\n\treadonly items: JsonFieldSchema;\n}\n\n/**\n * JSON Schema for a map node.\n *\n * @remarks Special case for map nodes, which do not have a native JSON schema corollary.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonMapNodeSchema extends JsonNodeSchemaBase<NodeKind.Map, \"object\"> {\n\t/**\n\t * Used to control the types of properties that can appear in the \"object\" representation of the map.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-patternproperties}.\n\t */\n\treadonly patternProperties: {\n\t\t/**\n\t\t * Types allowed in the map.\n\t\t * @remarks This format allows for any (JSON-compliant) key, but restricts the allowed types to only those specified.\n\t\t */\n\t\t\"^.*$\": JsonFieldSchema;\n\t};\n}\n\n/**\n * JSON Schema for a leaf node.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonLeafNodeSchema\n\textends JsonNodeSchemaBase<NodeKind.Leaf, JsonLeafSchemaType> {\n\t/**\n\t * Primitive type.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n\t */\n\treadonly type: JsonLeafSchemaType;\n}\n\n/**\n * Type entry containing a reference to a definition in the schema.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-schema-references}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonSchemaRef {\n\t/**\n\t * Reference to a definition in the schema.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-direct-references-with-ref}.\n\t */\n\t$ref: JsonRefPath;\n}\n\n/**\n * {@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} representation of a {@link TreeNodeSchema}.\n *\n * @alpha\n */\nexport type JsonNodeSchema =\n\t| JsonLeafNodeSchema\n\t| JsonMapNodeSchema\n\t| JsonArrayNodeSchema\n\t| JsonObjectNodeSchema;\n\n/**\n *{@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} representation of a {@link FieldSchema}.\n *\n * @sealed\n * @alpha\n */\nexport type JsonFieldSchema = {\n\t/**\n\t * Description of the field.\n\t * @remarks Derived from {@link FieldSchemaMetadata.description}.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-validation#name-title-and-description}\n\t */\n\treadonly description?: string | undefined;\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * The kinds of items allowed under the field, for polymorphic types.\n\t\t\t * @remarks Always represented via references to {@link JsonTreeSchema.$defs}.\n\t\t\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-anyof}.\n\t\t\t */\n\t\t\treadonly anyOf: JsonSchemaRef[];\n\t }\n\t| JsonSchemaRef\n);\n\n/**\n * {@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} representation of a tree schema.\n *\n * @remarks\n * Includes the complete set of definitions reachable from the \"root\" schema.\n *\n * Note: This representation only uses a limited subset of supported JSON Schema features.\n * It is scoped to a format that can be used to sufficiently represent supported SharedTree schema.\n *\n * Also note that this schema format contains Fluid-specific extensions, such as the {@link JsonNodeSchemaBase._treeNodeSchemaKind}\n * property, meaning that it is not a *strict* subset.\n * When using these schemas with validation tools (for example, {@link https://ajv.js.org/}), you will need to opt out\n * of *strict* validation to ensure extra properties are allowed.\n *\n * @privateRemarks\n * Extending JSON Schema is permitted by the spec.\n * See {@link https://json-schema.org/draft/2020-12/json-schema-core#name-extending-json-schema}.\n *\n * @sealed\n * @alpha\n */\nexport type JsonTreeSchema = JsonFieldSchema & {\n\t/**\n\t * The set of definitions reachable from this schema's root.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-schema-re-use-with-defs}\n\t */\n\treadonly $defs: Record<JsonSchemaId, JsonNodeSchema>;\n};\n"]}
1
+ {"version":3,"file":"jsonSchema.js","sourceRoot":"","sources":["../../../src/simple-tree/api/jsonSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { NodeKind } from \"../core/index.js\";\n\n/**\n * The fully-qualified {@link TreeNodeSchemaCore.identifier}.\n * @alpha\n */\nexport type JsonSchemaId = string;\n\n/**\n * Reference string pointing to a definition in the schema.\n * Should be the fully-qualified {@link TreeNodeSchemaCore.identifier}.\n * @remarks Of the form `#/$defs/<schema-identifier>`, where the `schema-identifier` is the fully-qualified {@link TreeNodeSchemaCore.identifier}.\n * @example Schema `com.myapp.foo` would be referenced via `#/$defs/com.myapp.foo`.\n * @alpha\n */\nexport type JsonRefPath = `#/$defs/${JsonSchemaId}`;\n\n/**\n * JSON entity type.\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n * @alpha\n */\nexport type JsonSchemaType = \"object\" | \"array\" | JsonLeafSchemaType;\n\n/**\n * JSON primitive types.\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n * @alpha\n */\nexport type JsonLeafSchemaType = \"string\" | \"number\" | \"boolean\" | \"null\";\n\n/**\n * Base interface for node schemas represented in {@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} format.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonNodeSchemaBase<\n\tTNodeKind extends NodeKind,\n\tTJsonSchemaType extends JsonSchemaType,\n> {\n\t/**\n\t * Kind of {@link TreeNodeSchema} this JSON Schema entry represents.\n\t *\n\t * @remarks There is not a 1:1 mapping between {@link TreeNodeSchema} types and JSON Schema types.\n\t * This is used to disambiguate the type of {@link TreeNodeSchema} this JSON Schema maps to.\n\t *\n\t * Note: This property name is not a part of the JSON Schema spec. This is a Fluid-specific extension.\n\t */\n\treadonly _treeNodeSchemaKind: TNodeKind;\n\n\t/**\n\t * {@inheritDoc JsonSchemaType}\n\t */\n\treadonly type: TJsonSchemaType;\n\n\t/**\n\t * Description of the node schema.\n\t * @remarks Derived from {@link NodeSchemaMetadata.description}.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-validation#name-title-and-description}\n\t */\n\treadonly description?: string | undefined;\n}\n\n/**\n * JSON Schema for an object node.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonObjectNodeSchema extends JsonNodeSchemaBase<NodeKind.Object, \"object\"> {\n\t/**\n\t * Object fields.\n\t * @remarks Required fields should have a corresponding entry in {@link JsonObjectNodeSchema.required}.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-properties}.\n\t */\n\treadonly properties: Record<string, JsonFieldSchema>;\n\n\t/**\n\t * List of keys for required fields.\n\t *\n\t * @remarks\n\t * Optional fields should not be included in this list.\n\t * Each key specified must have an entry in {@link JsonObjectNodeSchema.properties}.\n\t */\n\treadonly required?: string[];\n\n\t/**\n\t * Whether or not additional properties (properties not specified by the schema) are allowed in objects of this type.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-additionalproperties}.\n\t */\n\treadonly additionalProperties?: boolean;\n}\n\n/**\n * JSON Schema for an array node.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonArrayNodeSchema extends JsonNodeSchemaBase<NodeKind.Array, \"array\"> {\n\t/**\n\t * The kinds of items allowed under the array.\n\t *\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-items}.\n\t */\n\treadonly items: JsonFieldSchema;\n}\n\n/**\n * JSON Schema for a map node.\n *\n * @remarks Special case for map nodes, which do not have a native JSON schema corollary.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonMapNodeSchema extends JsonNodeSchemaBase<NodeKind.Map, \"object\"> {\n\t/**\n\t * Used to control the types of properties that can appear in the \"object\" representation of the map.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-patternproperties}.\n\t */\n\treadonly patternProperties: {\n\t\t/**\n\t\t * Types allowed in the map.\n\t\t * @remarks This format allows for any (JSON-compliant) key, but restricts the allowed types to only those specified.\n\t\t */\n\t\t\"^.*$\": JsonFieldSchema;\n\t};\n}\n\n/**\n * JSON Schema for a leaf node.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonLeafNodeSchema\n\textends JsonNodeSchemaBase<NodeKind.Leaf, JsonLeafSchemaType> {\n\t/**\n\t * Primitive type.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-instance-data-model}.\n\t */\n\treadonly type: JsonLeafSchemaType;\n}\n\n/**\n * Type entry containing a reference to a definition in the schema.\n *\n * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-schema-references}.\n *\n * @sealed\n * @alpha\n */\nexport interface JsonSchemaRef {\n\t/**\n\t * Reference to a definition in the schema.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-direct-references-with-ref}.\n\t */\n\t$ref: JsonRefPath;\n}\n\n/**\n * {@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} representation of a {@link TreeNodeSchema}.\n *\n * @alpha\n */\nexport type JsonNodeSchema =\n\t| JsonLeafNodeSchema\n\t| JsonMapNodeSchema\n\t| JsonArrayNodeSchema\n\t| JsonObjectNodeSchema;\n\n/**\n *{@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} representation of a {@link FieldSchema}.\n *\n * @sealed\n * @alpha\n */\nexport type JsonFieldSchema = {\n\t/**\n\t * Description of the field.\n\t * @remarks Derived from {@link FieldSchemaMetadata.description}.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-validation#name-title-and-description}\n\t */\n\treadonly description?: string | undefined;\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * The kinds of items allowed under the field, for polymorphic types.\n\t\t\t * @remarks Always represented via references to {@link JsonTreeSchema.$defs}.\n\t\t\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-anyof}.\n\t\t\t */\n\t\t\treadonly anyOf: JsonSchemaRef[];\n\t }\n\t| JsonSchemaRef\n);\n\n/**\n * {@link https://json-schema.org/draft/2020-12/json-schema-core | JSON Schema} representation of a tree schema.\n *\n * @remarks\n * Includes the complete set of definitions reachable from the \"root\" schema.\n *\n * Note: This representation only uses a limited subset of supported JSON Schema features.\n * It is scoped to a format that can be used to sufficiently represent supported SharedTree schema.\n *\n * Also note that this schema format contains Fluid-specific extensions, such as the {@link JsonNodeSchemaBase._treeNodeSchemaKind}\n * property, meaning that it is not a *strict* subset.\n * When using these schemas with validation tools (for example, {@link https://ajv.js.org/}), you will need to opt out\n * of *strict* validation to ensure extra properties are allowed.\n *\n * @privateRemarks\n * Extending JSON Schema is permitted by the spec.\n * See {@link https://json-schema.org/draft/2020-12/json-schema-core#name-extending-json-schema}.\n *\n * @sealed\n * @alpha\n */\nexport type JsonTreeSchema = JsonFieldSchema & {\n\t/**\n\t * The set of definitions reachable from this schema's root.\n\t * @see {@link https://json-schema.org/draft/2020-12/json-schema-core#name-schema-re-use-with-defs}\n\t */\n\treadonly $defs: Record<JsonSchemaId, JsonNodeSchema>;\n};\n"]}
@@ -5,16 +5,67 @@
5
5
  import type { IFluidHandle as _dummyImport } from "@fluidframework/core-interfaces";
6
6
  import type { TreeValue } from "../../core/index.js";
7
7
  import { type RestrictiveStringRecord } from "../../util/index.js";
8
- import { FieldKind, type FieldSchema, type ImplicitAllowedTypes, type ImplicitFieldSchema, type InsertableTreeNodeFromImplicitAllowedTypes, type FieldProps } from "../schemaTypes.js";
8
+ import { FieldKind, type FieldSchema, type ImplicitAllowedTypes, type ImplicitFieldSchema, type InsertableTreeNodeFromImplicitAllowedTypes, type FieldProps, type NodeSchemaOptions } from "../schemaTypes.js";
9
9
  import type { NodeKind, WithType, TreeNodeSchema, TreeNodeSchemaClass, TreeNodeSchemaNonClass } from "../core/index.js";
10
10
  import { type TreeArrayNode } from "../arrayNode.js";
11
11
  import { type InsertableObjectFromSchemaRecord, type TreeObjectNode } from "../objectNode.js";
12
12
  import { type MapNodeInsertableData, type TreeMapNode } from "../mapNode.js";
13
- import type { FieldSchemaUnsafe, FieldHasDefaultUnsafe, InsertableTreeFieldFromImplicitFieldUnsafe, InsertableTreeNodeFromImplicitAllowedTypesUnsafe, TreeArrayNodeUnsafe, TreeMapNodeUnsafe, TreeObjectNodeUnsafe, Unenforced } from "./typesUnsafe.js";
13
+ import type { FieldSchemaUnsafe, InsertableObjectFromSchemaRecordUnsafe, InsertableTreeNodeFromImplicitAllowedTypesUnsafe, TreeArrayNodeUnsafe, TreeMapNodeUnsafe, TreeObjectNodeUnsafe, Unenforced } from "./typesUnsafe.js";
14
14
  /**
15
15
  * Gets the leaf domain schema compatible with a given {@link TreeValue}.
16
16
  */
17
17
  export declare function schemaFromValue(value: TreeValue): TreeNodeSchema;
18
+ /**
19
+ * Options when declaring an {@link SchemaFactory.object|object node}'s schema
20
+ *
21
+ * @alpha
22
+ */
23
+ export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown> extends NodeSchemaOptions<TCustomMetadata> {
24
+ /**
25
+ * Allow nodes typed with this object node schema to contain optional fields that are not present in the schema declaration.
26
+ * Such nodes can come into existence either via import APIs (see remarks) or by way of collaboration with another client
27
+ * that has upgraded the document's schema to include those optional fields.
28
+ *
29
+ * @defaultValue `false`
30
+ * @remarks
31
+ * The advantage of enabling this option is that it allows an application ecosystem with staged rollout to more quickly
32
+ * upgrade documents to include schema for new optional features.
33
+ *
34
+ * However, it does come with trade-offs that applications should weigh carefully when it comes to interactions between
35
+ * code and documents.
36
+ * When opening such documents, the API presented is still determined by the view schema.
37
+ * This can have implications on the behavior of edits or code which uses portions of the view schema,
38
+ * since this may inadvertently drop data which is present in those optional fields in the document schema.
39
+ *
40
+ * Consider the following example:
41
+ *
42
+ * ```typescript
43
+ * const sf = new SchemaFactory("com.example");
44
+ * class PersonView extends sf.object("Person", { name: sf.string }, { allowUnknownOptionalFields: true }) {}
45
+ * class PersonStored extends sf.object("Person", { name: sf.string, nickname: sf.optional(sf.string) }) {}
46
+ *
47
+ * // Say we have a document which uses `PersonStored` in its schema, and application code constructs
48
+ * // a tree view using `PersonView`. If the application for some reason had implemented a function like this:
49
+ * function clonePerson(a: PersonView): PersonView {
50
+ * return new PersonView({ name: a.name });
51
+ * }
52
+ * // ...or even like this:
53
+ * function clonePerson(a: PersonView): PersonView {
54
+ * return new PersonView({ ...a})
55
+ * }
56
+ * // Then the alleged clone wouldn't actually clone the entire person in either case, it would drop the nickname.
57
+ * ```
58
+ *
59
+ * If an application wants to be particularly careful to preserve all data on a node when editing it, it can use
60
+ * {@link TreeAlpha.(importVerbose:2)|import}/{@link TreeAlpha.(exportVerbose:2)|export} APIs with persistent keys.
61
+ *
62
+ * Note that public API methods which operate on entire nodes (such as `moveTo`, `moveToEnd`, etc. on arrays) do not encounter
63
+ * this problem as SharedTree's implementation stores the entire node in its lower layers. It's only when application code
64
+ * reaches into a node (either by accessing its fields, spreading it, or some other means) that this problem arises.
65
+ */
66
+ allowUnknownOptionalFields?: boolean;
67
+ }
68
+ export declare const defaultSchemaFactoryObjectOptions: Required<Omit<SchemaFactoryObjectOptions, "metadata">>;
18
69
  /**
19
70
  * The name of a schema produced by {@link SchemaFactory}, including its optional scope prefix.
20
71
  *
@@ -205,7 +256,7 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
205
256
  * We should be much more clear about what happens if you use problematic values.
206
257
  * We should validate and/or normalize them when inserting content.
207
258
  */
208
- readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never>;
259
+ readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>;
209
260
  /**
210
261
  * {@link TreeNodeSchema} for holding a JavaScript `number`.
211
262
  *
@@ -220,11 +271,11 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
220
271
  * We should be much more clear about what happens if you use problematic values.
221
272
  * We should validate and/or normalize them when inserting content.
222
273
  */
223
- readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never>;
274
+ readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>;
224
275
  /**
225
276
  * {@link TreeNodeSchema} for holding a boolean.
226
277
  */
227
- readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never>;
278
+ readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>;
228
279
  /**
229
280
  * {@link TreeNodeSchema} for JavaScript `null`.
230
281
  *
@@ -233,11 +284,11 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
233
284
  * This {@link TreeNodeSchema} node provides the option to include nulls in trees when desired.
234
285
  * Unless directly inter-operating with existing data using null, consider other approaches, like wrapping the value in an optional field, or using a more specifically named empty object node.
235
286
  */
236
- readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never>;
287
+ readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>;
237
288
  /**
238
289
  * {@link TreeNodeSchema} for holding an {@link @fluidframework/core-interfaces#(IFluidHandle:interface)}.
239
290
  */
240
- readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, _dummyImport<unknown>, _dummyImport<unknown>, true, unknown, never>;
291
+ readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, _dummyImport<unknown>, _dummyImport<unknown>, true, unknown, never, unknown>;
241
292
  /**
242
293
  * Define a {@link TreeNodeSchemaClass} for a {@link TreeObjectNode}.
243
294
  *
@@ -248,6 +299,8 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
248
299
  /**
249
300
  * Define a structurally typed {@link TreeNodeSchema} for a {@link TreeMapNode}.
250
301
  *
302
+ * @param allowedTypes - The types that may appear as values in the map.
303
+ *
251
304
  * @remarks
252
305
  * The unique identifier for this Map is defined as a function of the provided types.
253
306
  * It is still scoped to this SchemaBuilder, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.
@@ -273,6 +326,7 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
273
326
  * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.
274
327
  *
275
328
  * @param name - Unique identifier for this schema within this factory's scope.
329
+ * @param allowedTypes - The types that may appear as values in the map.
276
330
  *
277
331
  * @example
278
332
  * ```typescript
@@ -289,6 +343,8 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
289
343
  /**
290
344
  * Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.
291
345
  *
346
+ * @param allowedTypes - The types that may appear in the array.
347
+ *
292
348
  * @remarks
293
349
  * The identifier for this Array is defined as a function of the provided types.
294
350
  * It is still scoped to this SchemaFactory, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.
@@ -324,6 +380,7 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
324
380
  * Define (and add to this library) a {@link TreeNodeSchemaClass} for a {@link (TreeArrayNode:interface)}.
325
381
  *
326
382
  * @param name - Unique identifier for this schema within this factory's scope.
383
+ * @param allowedTypes - The types that may appear in the array.
327
384
  *
328
385
  * @example
329
386
  * ```typescript
@@ -415,7 +472,7 @@ export declare class SchemaFactory<out TScope extends string | undefined = strin
415
472
  * `error TS2589: Type instantiation is excessively deep and possibly infinite.`
416
473
  * which otherwise gets reported at sometimes incorrect source locations that vary based on incremental builds.
417
474
  */
418
- objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & { readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property], import("../../util/typeUtils.js").UnionToIntersection<T[Property]>>; } & { readonly [Property_1 in keyof T as FieldHasDefaultUnsafe<T[Property_1]> extends true ? Property_1 : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property_1], import("../../util/typeUtils.js").UnionToIntersection<T[Property_1]>> | undefined; }, false, T>;
475
+ objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecordUnsafe<T>, false, T>;
419
476
  /**
420
477
  * `SchemaFactory.array` except tweaked to work better for recursive types.
421
478
  * Use with {@link ValidateRecursiveSchema} for improved type safety.
@@ -1 +1 @@
1
- {"version":3,"file":"schemaFactory.d.ts","source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G,sCAAsC,CAAC,CAAC,CAAC,EAClD,KAAK,EACL,CAAC,CACD;IAeD;;;;;;OAMG;IAEI,cAAc,CACpB,KAAK,CAAC,IAAI,SAAS,KAAK,EACxB,KAAK,CAAC,CAAC,SAAS,UAAU,CAAC,oBAAoB,CAAC,EAC/C,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;QAa1B;;;;;;;;;;WAUG;6BACkB,SAAS,iDAAiD,CAAC,CAAC,CAAC;;IAQrF;;;;;;OAMG;IAEI,YAAY,CAAC,IAAI,SAAS,KAAK,EAAE,KAAK,CAAC,CAAC,SAAS,UAAU,CAAC,oBAAoB,CAAC,EACvF,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,CAAC;QAgBZ;;;;;;;;;;WAUG;6BACkB,SACpB;YAAC,MAAM;YAAE,iDAAiD,CAAC,CAAC;SAAC,CAC7D;;;;CAcL;AAED,wBAAgB,cAAc,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EACpD,cAAc,EAAE,CAAC,EACjB,YAAY,EAAE,cAAc,GAAG,SAAS,cAAc,EAAE,GACtD,GAAG,CAAC,IAAI,MAAM,GAAG,CAmBnB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAelE"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.markSchemaMostDerived = exports.structuralName = exports.SchemaFactory = exports.schemaFromValue = void 0;
7
+ exports.markSchemaMostDerived = exports.structuralName = exports.SchemaFactory = exports.defaultSchemaFactoryObjectOptions = exports.schemaFromValue = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
10
  const internal_3 = require("@fluidframework/runtime-utils/internal");
@@ -41,6 +41,9 @@ function schemaFromValue(value) {
41
41
  }
42
42
  }
43
43
  exports.schemaFromValue = schemaFromValue;
44
+ exports.defaultSchemaFactoryObjectOptions = {
45
+ allowUnknownOptionalFields: false,
46
+ };
44
47
  // > = `${TScope extends undefined ? "" : `${TScope}.`}${TName}`;
45
48
  // TODO:
46
49
  // SchemaFactory.array references should link to the correct overloads, however the syntax for this does not seems to work currently for methods unless the they are not qualified with the class.
@@ -242,9 +245,11 @@ class SchemaFactory {
242
245
  * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.
243
246
  */
244
247
  object(name, fields) {
245
- return (0, objectNode_js_1.objectSchema)(this.scoped(name), fields, true);
248
+ return (0, objectNode_js_1.objectSchema)(this.scoped(name), fields, true, exports.defaultSchemaFactoryObjectOptions.allowUnknownOptionalFields);
246
249
  }
247
250
  /**
251
+ * {@link SchemaFactory.map} implementation.
252
+ *
248
253
  * @privateRemarks
249
254
  * This should return `TreeNodeSchemaBoth`, however TypeScript gives an error if one of the overloads implicitly up-casts the return type of the implementation.
250
255
  * This seems like a TypeScript bug getting variance backwards for overload return types since it's erroring when the relation between the overload
@@ -268,9 +273,11 @@ class SchemaFactory {
268
273
  namedMap(name, allowedTypes, customizable, implicitlyConstructable) {
269
274
  return (0, mapNode_js_1.mapSchema)(this.scoped(name), allowedTypes, implicitlyConstructable,
270
275
  // The current policy is customizable nodes don't get fake prototypes.
271
- !customizable);
276
+ !customizable, undefined);
272
277
  }
273
278
  /**
279
+ * {@link SchemaFactory.array} implementation.
280
+ *
274
281
  * @privateRemarks
275
282
  * This should return TreeNodeSchemaBoth: see note on "map" implementation for details.
276
283
  */
@@ -388,7 +395,6 @@ class SchemaFactory {
388
395
  * `error TS2589: Type instantiation is excessively deep and possibly infinite.`
389
396
  * which otherwise gets reported at sometimes incorrect source locations that vary based on incremental builds.
390
397
  */
391
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
392
398
  objectRecursive(name, t) {
393
399
  return this.object(name, t);
394
400
  }