@fluidframework/tree 2.74.0-365691 → 2.74.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 (856) hide show
  1. package/.vscode/settings.json +4 -2
  2. package/CHANGELOG.md +11 -0
  3. package/api-report/tree.alpha.api.md +125 -87
  4. package/api-report/tree.beta.api.md +0 -1
  5. package/api-report/tree.legacy.beta.api.md +0 -1
  6. package/api-report/tree.legacy.public.api.md +0 -1
  7. package/api-report/tree.public.api.md +0 -1
  8. package/assertTagging.config.mjs +1 -1
  9. package/dist/alpha.d.ts +6 -2
  10. package/dist/codec/codec.d.ts +41 -13
  11. package/dist/codec/codec.d.ts.map +1 -1
  12. package/dist/codec/codec.js +46 -19
  13. package/dist/codec/codec.js.map +1 -1
  14. package/dist/codec/versioned/codec.d.ts +1 -1
  15. package/dist/codec/versioned/codec.d.ts.map +1 -1
  16. package/dist/codec/versioned/codec.js.map +1 -1
  17. package/dist/codec/versioned/format.d.ts +4 -1
  18. package/dist/codec/versioned/format.d.ts.map +1 -1
  19. package/dist/codec/versioned/format.js +4 -1
  20. package/dist/codec/versioned/format.js.map +1 -1
  21. package/dist/core/index.d.ts +2 -2
  22. package/dist/core/index.d.ts.map +1 -1
  23. package/dist/core/index.js +4 -3
  24. package/dist/core/index.js.map +1 -1
  25. package/dist/core/rebase/index.d.ts +1 -1
  26. package/dist/core/rebase/index.d.ts.map +1 -1
  27. package/dist/core/rebase/index.js.map +1 -1
  28. package/dist/core/rebase/types.d.ts +20 -1
  29. package/dist/core/rebase/types.d.ts.map +1 -1
  30. package/dist/core/rebase/types.js.map +1 -1
  31. package/dist/core/schema-stored/schema.d.ts +4 -7
  32. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  33. package/dist/core/schema-stored/schema.js +2 -2
  34. package/dist/core/schema-stored/schema.js.map +1 -1
  35. package/dist/core/tree/detachedFieldIndex.d.ts +34 -13
  36. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  37. package/dist/core/tree/detachedFieldIndex.js +12 -12
  38. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  39. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +4 -4
  40. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  41. package/dist/core/tree/detachedFieldIndexFormatCommon.js +2 -2
  42. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  43. package/dist/core/tree/index.d.ts +3 -2
  44. package/dist/core/tree/index.d.ts.map +1 -1
  45. package/dist/core/tree/index.js +3 -0
  46. package/dist/core/tree/index.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  48. package/dist/feature-libraries/chunked-forest/codec/codecs.js +2 -2
  49. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  50. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +5 -5
  51. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  52. package/dist/feature-libraries/chunked-forest/codec/format.js +4 -4
  53. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +14 -6
  55. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +7 -2
  58. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  59. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +3 -3
  60. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  61. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +22 -26
  62. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  63. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts +30 -8
  64. package/dist/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  65. package/dist/feature-libraries/detachedFieldIndexSummarizer.js +41 -11
  66. package/dist/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  67. package/dist/feature-libraries/forest-summary/codec.d.ts +7 -1
  68. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  69. package/dist/feature-libraries/forest-summary/codec.js +13 -11
  70. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  71. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +10 -13
  72. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  73. package/dist/feature-libraries/forest-summary/forestSummarizer.js +35 -31
  74. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  75. package/dist/feature-libraries/forest-summary/formatCommon.d.ts +61 -0
  76. package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -0
  77. package/dist/feature-libraries/forest-summary/formatCommon.js +27 -0
  78. package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -0
  79. package/dist/feature-libraries/forest-summary/formatV1.d.ts +51 -0
  80. package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -0
  81. package/dist/feature-libraries/forest-summary/formatV1.js +11 -0
  82. package/dist/feature-libraries/forest-summary/formatV1.js.map +1 -0
  83. package/dist/feature-libraries/forest-summary/formatV2.d.ts +51 -0
  84. package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -0
  85. package/dist/feature-libraries/forest-summary/formatV2.js +11 -0
  86. package/dist/feature-libraries/forest-summary/formatV2.js.map +1 -0
  87. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +18 -24
  88. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  89. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +21 -43
  90. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  91. package/dist/feature-libraries/forest-summary/index.d.ts +2 -2
  92. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  93. package/dist/feature-libraries/forest-summary/index.js +3 -4
  94. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  95. package/dist/feature-libraries/forest-summary/summaryFormatCommon.d.ts +35 -0
  96. package/dist/feature-libraries/forest-summary/summaryFormatCommon.d.ts.map +1 -0
  97. package/dist/feature-libraries/forest-summary/summaryFormatCommon.js +43 -0
  98. package/dist/feature-libraries/forest-summary/summaryFormatCommon.js.map +1 -0
  99. package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts +11 -0
  100. package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts.map +1 -0
  101. package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.js +14 -0
  102. package/dist/feature-libraries/forest-summary/summaryFormatV1ToV2.js.map +1 -0
  103. package/dist/feature-libraries/forest-summary/summaryFormatV3.d.ts +18 -0
  104. package/dist/feature-libraries/forest-summary/summaryFormatV3.d.ts.map +1 -0
  105. package/dist/feature-libraries/forest-summary/summaryFormatV3.js +21 -0
  106. package/dist/feature-libraries/forest-summary/summaryFormatV3.js.map +1 -0
  107. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts +17 -0
  108. package/dist/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -0
  109. package/dist/feature-libraries/forest-summary/summaryTypes.js +35 -0
  110. package/dist/feature-libraries/forest-summary/summaryTypes.js.map +1 -0
  111. package/dist/feature-libraries/index.d.ts +1 -1
  112. package/dist/feature-libraries/index.d.ts.map +1 -1
  113. package/dist/feature-libraries/index.js +3 -2
  114. package/dist/feature-libraries/index.js.map +1 -1
  115. package/dist/feature-libraries/modular-schema/comparison.d.ts +18 -2
  116. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  117. package/dist/feature-libraries/modular-schema/comparison.js +54 -3
  118. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  119. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +25 -13
  120. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  121. package/dist/feature-libraries/modular-schema/fieldKind.js +0 -21
  122. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  123. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  124. package/dist/feature-libraries/modular-schema/genericFieldKind.js +4 -1
  125. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  126. package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
  127. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  128. package/dist/feature-libraries/modular-schema/index.js +2 -1
  129. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  130. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  131. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +2 -3
  132. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  133. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  134. package/dist/feature-libraries/schema-index/codec.js +4 -4
  135. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  136. package/dist/feature-libraries/schema-index/formatV1.d.ts +1 -1
  137. package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -1
  138. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +27 -8
  139. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  140. package/dist/feature-libraries/schema-index/schemaSummarizer.js +42 -16
  141. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  142. package/dist/index.d.ts +2 -2
  143. package/dist/index.d.ts.map +1 -1
  144. package/dist/index.js +5 -3
  145. package/dist/index.js.map +1 -1
  146. package/dist/packageVersion.d.ts +1 -1
  147. package/dist/packageVersion.d.ts.map +1 -1
  148. package/dist/packageVersion.js +1 -1
  149. package/dist/packageVersion.js.map +1 -1
  150. package/dist/shared-tree/independentView.d.ts +1 -1
  151. package/dist/shared-tree/independentView.d.ts.map +1 -1
  152. package/dist/shared-tree/independentView.js +1 -1
  153. package/dist/shared-tree/independentView.js.map +1 -1
  154. package/dist/shared-tree/schematizingTreeView.d.ts +2 -1
  155. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  156. package/dist/shared-tree/schematizingTreeView.js +3 -0
  157. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  158. package/dist/shared-tree/sharedTree.d.ts +2 -2
  159. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  160. package/dist/shared-tree/sharedTree.js +4 -4
  161. package/dist/shared-tree/sharedTree.js.map +1 -1
  162. package/dist/shared-tree/sharedTreeChangeCodecs.js +2 -2
  163. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  164. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts +20 -8
  165. package/dist/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  166. package/dist/shared-tree/sharedTreeChangeEnricher.js +25 -11
  167. package/dist/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  168. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  169. package/dist/shared-tree/treeAlpha.js +1 -1
  170. package/dist/shared-tree/treeAlpha.js.map +1 -1
  171. package/dist/shared-tree/treeCheckout.d.ts +10 -5
  172. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  173. package/dist/shared-tree/treeCheckout.js +72 -17
  174. package/dist/shared-tree/treeCheckout.js.map +1 -1
  175. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  176. package/dist/shared-tree-core/editManagerCodecs.js +10 -8
  177. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  178. package/{lib/shared-tree-core/editManagerCodecsV5.d.ts → dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts} +3 -3
  179. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -0
  180. package/dist/shared-tree-core/{editManagerCodecsV5.js → editManagerCodecsVSharedBranches.js} +7 -7
  181. package/dist/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -0
  182. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +8 -30
  183. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  184. package/dist/shared-tree-core/editManagerFormatCommons.js +18 -9
  185. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  186. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +1 -1
  187. package/dist/shared-tree-core/{editManagerFormatV5.d.ts → editManagerFormatVSharedBranches.d.ts} +3 -3
  188. package/dist/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -0
  189. package/dist/shared-tree-core/{editManagerFormatV5.js → editManagerFormatVSharedBranches.js} +2 -2
  190. package/dist/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -0
  191. package/dist/shared-tree-core/editManagerSummarizer.d.ts +29 -9
  192. package/dist/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  193. package/dist/shared-tree-core/editManagerSummarizer.js +41 -13
  194. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  195. package/dist/shared-tree-core/index.d.ts +5 -2
  196. package/dist/shared-tree-core/index.d.ts.map +1 -1
  197. package/dist/shared-tree-core/index.js +7 -1
  198. package/dist/shared-tree-core/index.js.map +1 -1
  199. package/{lib/shared-tree-core/messageCodecV5.d.ts → dist/shared-tree-core/messageCodecVSharedBranches.d.ts} +2 -2
  200. package/dist/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -0
  201. package/dist/shared-tree-core/{messageCodecV5.js → messageCodecVSharedBranches.js} +6 -6
  202. package/dist/shared-tree-core/messageCodecVSharedBranches.js.map +1 -0
  203. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  204. package/dist/shared-tree-core/messageCodecs.js +12 -10
  205. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  206. package/dist/shared-tree-core/messageFormat.d.ts +9 -36
  207. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  208. package/dist/shared-tree-core/messageFormat.js +19 -9
  209. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  210. package/{lib/shared-tree-core/messageFormatV5.d.ts → dist/shared-tree-core/messageFormatVSharedBranches.d.ts} +5 -7
  211. package/dist/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -0
  212. package/dist/shared-tree-core/{messageFormatV5.js → messageFormatVSharedBranches.js} +3 -2
  213. package/dist/shared-tree-core/messageFormatVSharedBranches.js.map +1 -0
  214. package/dist/shared-tree-core/sharedTreeCore.d.ts +13 -47
  215. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  216. package/dist/shared-tree-core/sharedTreeCore.js +29 -17
  217. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  218. package/dist/shared-tree-core/summaryTypes.d.ts +94 -0
  219. package/dist/shared-tree-core/summaryTypes.d.ts.map +1 -0
  220. package/dist/shared-tree-core/summaryTypes.js +47 -0
  221. package/dist/shared-tree-core/summaryTypes.js.map +1 -0
  222. package/dist/shared-tree-core/versionedSummarizer.d.ts +72 -0
  223. package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -0
  224. package/dist/shared-tree-core/versionedSummarizer.js +64 -0
  225. package/dist/shared-tree-core/versionedSummarizer.js.map +1 -0
  226. package/dist/simple-tree/api/configuration.d.ts +3 -26
  227. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  228. package/dist/simple-tree/api/configuration.js +10 -21
  229. package/dist/simple-tree/api/configuration.js.map +1 -1
  230. package/dist/simple-tree/api/dirtyIndex.d.ts +11 -0
  231. package/dist/simple-tree/api/dirtyIndex.d.ts.map +1 -1
  232. package/dist/simple-tree/api/dirtyIndex.js +7 -0
  233. package/dist/simple-tree/api/dirtyIndex.js.map +1 -1
  234. package/dist/simple-tree/api/discrepancies.d.ts +1 -1
  235. package/dist/simple-tree/api/discrepancies.d.ts.map +1 -1
  236. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  237. package/dist/simple-tree/api/eraseSchemaDetails.d.ts +89 -0
  238. package/dist/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -0
  239. package/dist/simple-tree/api/eraseSchemaDetails.js +97 -0
  240. package/dist/simple-tree/api/eraseSchemaDetails.js.map +1 -0
  241. package/dist/simple-tree/api/getSimpleSchema.d.ts +3 -3
  242. package/dist/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  243. package/dist/simple-tree/api/getSimpleSchema.js +9 -3
  244. package/dist/simple-tree/api/getSimpleSchema.js.map +1 -1
  245. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  246. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  247. package/dist/simple-tree/api/incrementalAllowedTypes.js +7 -0
  248. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  249. package/dist/simple-tree/api/index.d.ts +4 -4
  250. package/dist/simple-tree/api/index.d.ts.map +1 -1
  251. package/dist/simple-tree/api/index.js +8 -5
  252. package/dist/simple-tree/api/index.js.map +1 -1
  253. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
  254. package/dist/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  255. package/dist/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  256. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +5 -5
  257. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  258. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  259. package/dist/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  260. package/dist/simple-tree/api/schemaFactoryRecursive.js +0 -1
  261. package/dist/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  262. package/dist/simple-tree/api/schemaFromSimple.d.ts +6 -1
  263. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  264. package/dist/simple-tree/api/schemaFromSimple.js +5 -0
  265. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  266. package/dist/simple-tree/api/schemaStatics.d.ts +12 -12
  267. package/dist/simple-tree/api/simpleSchemaCodec.d.ts +15 -3
  268. package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
  269. package/dist/simple-tree/api/simpleSchemaCodec.js +18 -6
  270. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  271. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
  272. package/dist/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  273. package/dist/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  274. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +8 -1
  275. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  276. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +13 -8
  277. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  278. package/dist/simple-tree/api/storedSchema.d.ts +1 -1
  279. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  280. package/dist/simple-tree/api/storedSchema.js +1 -2
  281. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  282. package/dist/simple-tree/api/tree.d.ts +15 -2
  283. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  284. package/dist/simple-tree/api/tree.js.map +1 -1
  285. package/dist/simple-tree/api/typesUnsafe.d.ts +3 -3
  286. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  287. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  288. package/dist/simple-tree/core/allowedTypes.d.ts +2 -2
  289. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
  290. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  291. package/dist/simple-tree/core/index.d.ts +1 -1
  292. package/dist/simple-tree/core/index.d.ts.map +1 -1
  293. package/dist/simple-tree/core/index.js +2 -3
  294. package/dist/simple-tree/core/index.js.map +1 -1
  295. package/dist/simple-tree/core/toStored.d.ts +17 -15
  296. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  297. package/dist/simple-tree/core/toStored.js +5 -40
  298. package/dist/simple-tree/core/toStored.js.map +1 -1
  299. package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
  300. package/dist/simple-tree/core/treeNode.js +1 -0
  301. package/dist/simple-tree/core/treeNode.js.map +1 -1
  302. package/dist/simple-tree/core/walkSchema.d.ts.map +1 -1
  303. package/dist/simple-tree/core/walkSchema.js +4 -0
  304. package/dist/simple-tree/core/walkSchema.js.map +1 -1
  305. package/dist/simple-tree/createContext.d.ts.map +1 -1
  306. package/dist/simple-tree/createContext.js +20 -5
  307. package/dist/simple-tree/createContext.js.map +1 -1
  308. package/dist/simple-tree/fieldSchema.d.ts +3 -3
  309. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  310. package/dist/simple-tree/fieldSchema.js.map +1 -1
  311. package/dist/simple-tree/index.d.ts +6 -5
  312. package/dist/simple-tree/index.d.ts.map +1 -1
  313. package/dist/simple-tree/index.js +16 -11
  314. package/dist/simple-tree/index.js.map +1 -1
  315. package/dist/simple-tree/leafNodeSchema.d.ts +5 -5
  316. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  317. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  318. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  319. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
  320. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  321. package/dist/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  322. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  323. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  324. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts +3 -3
  325. package/dist/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  326. package/dist/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  327. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts +2 -2
  328. package/dist/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  329. package/dist/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  330. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  331. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  332. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -3
  333. package/dist/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  334. package/dist/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  335. package/dist/simple-tree/simpleSchema.d.ts +55 -23
  336. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  337. package/dist/simple-tree/simpleSchema.js +17 -0
  338. package/dist/simple-tree/simpleSchema.js.map +1 -1
  339. package/dist/simple-tree/simpleSchemaFormatV1.d.ts +1 -1
  340. package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
  341. package/dist/simple-tree/simpleSchemaFormatV1.js +8 -1
  342. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  343. package/dist/simple-tree/toStoredSchema.d.ts +58 -11
  344. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  345. package/dist/simple-tree/toStoredSchema.js +205 -30
  346. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  347. package/dist/simple-tree/treeSchema.d.ts +23 -0
  348. package/dist/simple-tree/treeSchema.d.ts.map +1 -0
  349. package/dist/simple-tree/treeSchema.js +25 -0
  350. package/dist/simple-tree/treeSchema.js.map +1 -0
  351. package/dist/tableSchema.d.ts +107 -64
  352. package/dist/tableSchema.d.ts.map +1 -1
  353. package/dist/tableSchema.js +161 -60
  354. package/dist/tableSchema.js.map +1 -1
  355. package/dist/util/brand.d.ts +49 -0
  356. package/dist/util/brand.d.ts.map +1 -1
  357. package/dist/util/brand.js +47 -1
  358. package/dist/util/brand.js.map +1 -1
  359. package/dist/util/index.d.ts +2 -1
  360. package/dist/util/index.d.ts.map +1 -1
  361. package/dist/util/index.js +6 -2
  362. package/dist/util/index.js.map +1 -1
  363. package/dist/util/readSnapshotBlob.d.ts +13 -0
  364. package/dist/util/readSnapshotBlob.d.ts.map +1 -0
  365. package/dist/util/readSnapshotBlob.js +18 -0
  366. package/dist/util/readSnapshotBlob.js.map +1 -0
  367. package/eslint.config.mts +98 -0
  368. package/lib/alpha.d.ts +6 -2
  369. package/lib/codec/codec.d.ts +41 -13
  370. package/lib/codec/codec.d.ts.map +1 -1
  371. package/lib/codec/codec.js +40 -13
  372. package/lib/codec/codec.js.map +1 -1
  373. package/lib/codec/versioned/codec.d.ts +1 -1
  374. package/lib/codec/versioned/codec.d.ts.map +1 -1
  375. package/lib/codec/versioned/codec.js.map +1 -1
  376. package/lib/codec/versioned/format.d.ts +4 -1
  377. package/lib/codec/versioned/format.d.ts.map +1 -1
  378. package/lib/codec/versioned/format.js +4 -1
  379. package/lib/codec/versioned/format.js.map +1 -1
  380. package/lib/core/index.d.ts +2 -2
  381. package/lib/core/index.d.ts.map +1 -1
  382. package/lib/core/index.js +1 -1
  383. package/lib/core/index.js.map +1 -1
  384. package/lib/core/rebase/index.d.ts +1 -1
  385. package/lib/core/rebase/index.d.ts.map +1 -1
  386. package/lib/core/rebase/index.js.map +1 -1
  387. package/lib/core/rebase/types.d.ts +20 -1
  388. package/lib/core/rebase/types.d.ts.map +1 -1
  389. package/lib/core/rebase/types.js.map +1 -1
  390. package/lib/core/schema-stored/schema.d.ts +4 -7
  391. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  392. package/lib/core/schema-stored/schema.js +3 -3
  393. package/lib/core/schema-stored/schema.js.map +1 -1
  394. package/lib/core/tree/detachedFieldIndex.d.ts +34 -13
  395. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  396. package/lib/core/tree/detachedFieldIndex.js +12 -12
  397. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  398. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +4 -4
  399. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  400. package/lib/core/tree/detachedFieldIndexFormatCommon.js +3 -3
  401. package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  402. package/lib/core/tree/index.d.ts +3 -2
  403. package/lib/core/tree/index.d.ts.map +1 -1
  404. package/lib/core/tree/index.js +2 -1
  405. package/lib/core/tree/index.js.map +1 -1
  406. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  407. package/lib/feature-libraries/chunked-forest/codec/codecs.js +3 -3
  408. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  409. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +5 -5
  410. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  411. package/lib/feature-libraries/chunked-forest/codec/format.js +5 -5
  412. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  413. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +14 -6
  414. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
  415. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
  416. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +7 -2
  417. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  418. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +3 -3
  419. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  420. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +23 -27
  421. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  422. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts +30 -8
  423. package/lib/feature-libraries/detachedFieldIndexSummarizer.d.ts.map +1 -1
  424. package/lib/feature-libraries/detachedFieldIndexSummarizer.js +38 -8
  425. package/lib/feature-libraries/detachedFieldIndexSummarizer.js.map +1 -1
  426. package/lib/feature-libraries/forest-summary/codec.d.ts +7 -1
  427. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  428. package/lib/feature-libraries/forest-summary/codec.js +12 -11
  429. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  430. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +10 -13
  431. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  432. package/lib/feature-libraries/forest-summary/forestSummarizer.js +33 -29
  433. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  434. package/lib/feature-libraries/forest-summary/formatCommon.d.ts +61 -0
  435. package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -0
  436. package/lib/feature-libraries/forest-summary/formatCommon.js +23 -0
  437. package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -0
  438. package/lib/feature-libraries/forest-summary/formatV1.d.ts +51 -0
  439. package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -0
  440. package/lib/feature-libraries/forest-summary/formatV1.js +8 -0
  441. package/lib/feature-libraries/forest-summary/formatV1.js.map +1 -0
  442. package/lib/feature-libraries/forest-summary/formatV2.d.ts +51 -0
  443. package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -0
  444. package/lib/feature-libraries/forest-summary/formatV2.js +8 -0
  445. package/lib/feature-libraries/forest-summary/formatV2.js.map +1 -0
  446. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +18 -24
  447. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  448. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +20 -42
  449. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  450. package/lib/feature-libraries/forest-summary/index.d.ts +2 -2
  451. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  452. package/lib/feature-libraries/forest-summary/index.js +2 -2
  453. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  454. package/lib/feature-libraries/forest-summary/summaryFormatCommon.d.ts +35 -0
  455. package/lib/feature-libraries/forest-summary/summaryFormatCommon.d.ts.map +1 -0
  456. package/lib/feature-libraries/forest-summary/summaryFormatCommon.js +40 -0
  457. package/lib/feature-libraries/forest-summary/summaryFormatCommon.js.map +1 -0
  458. package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts +11 -0
  459. package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.d.ts.map +1 -0
  460. package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.js +11 -0
  461. package/lib/feature-libraries/forest-summary/summaryFormatV1ToV2.js.map +1 -0
  462. package/lib/feature-libraries/forest-summary/summaryFormatV3.d.ts +18 -0
  463. package/lib/feature-libraries/forest-summary/summaryFormatV3.d.ts.map +1 -0
  464. package/lib/feature-libraries/forest-summary/summaryFormatV3.js +18 -0
  465. package/lib/feature-libraries/forest-summary/summaryFormatV3.js.map +1 -0
  466. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts +17 -0
  467. package/lib/feature-libraries/forest-summary/summaryTypes.d.ts.map +1 -0
  468. package/lib/feature-libraries/forest-summary/summaryTypes.js +30 -0
  469. package/lib/feature-libraries/forest-summary/summaryTypes.js.map +1 -0
  470. package/lib/feature-libraries/index.d.ts +1 -1
  471. package/lib/feature-libraries/index.d.ts.map +1 -1
  472. package/lib/feature-libraries/index.js +1 -1
  473. package/lib/feature-libraries/index.js.map +1 -1
  474. package/lib/feature-libraries/modular-schema/comparison.d.ts +18 -2
  475. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  476. package/lib/feature-libraries/modular-schema/comparison.js +55 -5
  477. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  478. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +25 -13
  479. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  480. package/lib/feature-libraries/modular-schema/fieldKind.js +0 -21
  481. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  482. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  483. package/lib/feature-libraries/modular-schema/genericFieldKind.js +4 -1
  484. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  485. package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
  486. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  487. package/lib/feature-libraries/modular-schema/index.js +1 -1
  488. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  489. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  490. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +2 -3
  491. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  492. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  493. package/lib/feature-libraries/schema-index/codec.js +5 -5
  494. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  495. package/lib/feature-libraries/schema-index/formatV1.d.ts +1 -1
  496. package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -1
  497. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +27 -8
  498. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  499. package/lib/feature-libraries/schema-index/schemaSummarizer.js +38 -12
  500. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  501. package/lib/index.d.ts +2 -2
  502. package/lib/index.d.ts.map +1 -1
  503. package/lib/index.js +1 -1
  504. package/lib/index.js.map +1 -1
  505. package/lib/packageVersion.d.ts +1 -1
  506. package/lib/packageVersion.d.ts.map +1 -1
  507. package/lib/packageVersion.js +1 -1
  508. package/lib/packageVersion.js.map +1 -1
  509. package/lib/shared-tree/independentView.d.ts +1 -1
  510. package/lib/shared-tree/independentView.d.ts.map +1 -1
  511. package/lib/shared-tree/independentView.js +2 -2
  512. package/lib/shared-tree/independentView.js.map +1 -1
  513. package/lib/shared-tree/schematizingTreeView.d.ts +2 -1
  514. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  515. package/lib/shared-tree/schematizingTreeView.js +3 -0
  516. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  517. package/lib/shared-tree/sharedTree.d.ts +2 -2
  518. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  519. package/lib/shared-tree/sharedTree.js +4 -4
  520. package/lib/shared-tree/sharedTree.js.map +1 -1
  521. package/lib/shared-tree/sharedTreeChangeCodecs.js +2 -2
  522. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  523. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts +20 -8
  524. package/lib/shared-tree/sharedTreeChangeEnricher.d.ts.map +1 -1
  525. package/lib/shared-tree/sharedTreeChangeEnricher.js +25 -11
  526. package/lib/shared-tree/sharedTreeChangeEnricher.js.map +1 -1
  527. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  528. package/lib/shared-tree/treeAlpha.js +2 -2
  529. package/lib/shared-tree/treeAlpha.js.map +1 -1
  530. package/lib/shared-tree/treeCheckout.d.ts +10 -5
  531. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  532. package/lib/shared-tree/treeCheckout.js +73 -18
  533. package/lib/shared-tree/treeCheckout.js.map +1 -1
  534. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  535. package/lib/shared-tree-core/editManagerCodecs.js +11 -9
  536. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  537. package/{dist/shared-tree-core/editManagerCodecsV5.d.ts → lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts} +3 -3
  538. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.d.ts.map +1 -0
  539. package/lib/shared-tree-core/{editManagerCodecsV5.js → editManagerCodecsVSharedBranches.js} +4 -4
  540. package/lib/shared-tree-core/editManagerCodecsVSharedBranches.js.map +1 -0
  541. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +8 -30
  542. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  543. package/lib/shared-tree-core/editManagerFormatCommons.js +19 -10
  544. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  545. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +1 -1
  546. package/lib/shared-tree-core/{editManagerFormatV5.d.ts → editManagerFormatVSharedBranches.d.ts} +3 -3
  547. package/lib/shared-tree-core/editManagerFormatVSharedBranches.d.ts.map +1 -0
  548. package/lib/shared-tree-core/{editManagerFormatV5.js → editManagerFormatVSharedBranches.js} +2 -2
  549. package/lib/shared-tree-core/editManagerFormatVSharedBranches.js.map +1 -0
  550. package/lib/shared-tree-core/editManagerSummarizer.d.ts +29 -9
  551. package/lib/shared-tree-core/editManagerSummarizer.d.ts.map +1 -1
  552. package/lib/shared-tree-core/editManagerSummarizer.js +39 -11
  553. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  554. package/lib/shared-tree-core/index.d.ts +5 -2
  555. package/lib/shared-tree-core/index.d.ts.map +1 -1
  556. package/lib/shared-tree-core/index.js +3 -1
  557. package/lib/shared-tree-core/index.js.map +1 -1
  558. package/{dist/shared-tree-core/messageCodecV5.d.ts → lib/shared-tree-core/messageCodecVSharedBranches.d.ts} +2 -2
  559. package/lib/shared-tree-core/messageCodecVSharedBranches.d.ts.map +1 -0
  560. package/lib/shared-tree-core/{messageCodecV5.js → messageCodecVSharedBranches.js} +3 -3
  561. package/lib/shared-tree-core/messageCodecVSharedBranches.js.map +1 -0
  562. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  563. package/lib/shared-tree-core/messageCodecs.js +13 -11
  564. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  565. package/lib/shared-tree-core/messageFormat.d.ts +9 -36
  566. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  567. package/lib/shared-tree-core/messageFormat.js +19 -9
  568. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  569. package/{dist/shared-tree-core/messageFormatV5.d.ts → lib/shared-tree-core/messageFormatVSharedBranches.d.ts} +5 -7
  570. package/lib/shared-tree-core/messageFormatVSharedBranches.d.ts.map +1 -0
  571. package/lib/shared-tree-core/{messageFormatV5.js → messageFormatVSharedBranches.js} +3 -2
  572. package/lib/shared-tree-core/messageFormatVSharedBranches.js.map +1 -0
  573. package/lib/shared-tree-core/sharedTreeCore.d.ts +13 -47
  574. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  575. package/lib/shared-tree-core/sharedTreeCore.js +27 -15
  576. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  577. package/lib/shared-tree-core/summaryTypes.d.ts +94 -0
  578. package/lib/shared-tree-core/summaryTypes.d.ts.map +1 -0
  579. package/lib/shared-tree-core/summaryTypes.js +43 -0
  580. package/lib/shared-tree-core/summaryTypes.js.map +1 -0
  581. package/lib/shared-tree-core/versionedSummarizer.d.ts +72 -0
  582. package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -0
  583. package/lib/shared-tree-core/versionedSummarizer.js +60 -0
  584. package/lib/shared-tree-core/versionedSummarizer.js.map +1 -0
  585. package/lib/simple-tree/api/configuration.d.ts +3 -26
  586. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  587. package/lib/simple-tree/api/configuration.js +14 -25
  588. package/lib/simple-tree/api/configuration.js.map +1 -1
  589. package/lib/simple-tree/api/dirtyIndex.d.ts +11 -0
  590. package/lib/simple-tree/api/dirtyIndex.d.ts.map +1 -1
  591. package/lib/simple-tree/api/dirtyIndex.js +7 -0
  592. package/lib/simple-tree/api/dirtyIndex.js.map +1 -1
  593. package/lib/simple-tree/api/discrepancies.d.ts +1 -1
  594. package/lib/simple-tree/api/discrepancies.d.ts.map +1 -1
  595. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  596. package/lib/simple-tree/api/eraseSchemaDetails.d.ts +89 -0
  597. package/lib/simple-tree/api/eraseSchemaDetails.d.ts.map +1 -0
  598. package/lib/simple-tree/api/eraseSchemaDetails.js +92 -0
  599. package/lib/simple-tree/api/eraseSchemaDetails.js.map +1 -0
  600. package/lib/simple-tree/api/getSimpleSchema.d.ts +3 -3
  601. package/lib/simple-tree/api/getSimpleSchema.d.ts.map +1 -1
  602. package/lib/simple-tree/api/getSimpleSchema.js +9 -3
  603. package/lib/simple-tree/api/getSimpleSchema.js.map +1 -1
  604. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  605. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  606. package/lib/simple-tree/api/incrementalAllowedTypes.js +8 -1
  607. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  608. package/lib/simple-tree/api/index.d.ts +4 -4
  609. package/lib/simple-tree/api/index.d.ts.map +1 -1
  610. package/lib/simple-tree/api/index.js +3 -3
  611. package/lib/simple-tree/api/index.js.map +1 -1
  612. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts +1 -1
  613. package/lib/simple-tree/api/schemaCompatibilityTester.d.ts.map +1 -1
  614. package/lib/simple-tree/api/schemaCompatibilityTester.js.map +1 -1
  615. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +5 -5
  616. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  617. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  618. package/lib/simple-tree/api/schemaFactoryRecursive.d.ts.map +1 -1
  619. package/lib/simple-tree/api/schemaFactoryRecursive.js +0 -1
  620. package/lib/simple-tree/api/schemaFactoryRecursive.js.map +1 -1
  621. package/lib/simple-tree/api/schemaFromSimple.d.ts +6 -1
  622. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  623. package/lib/simple-tree/api/schemaFromSimple.js +5 -0
  624. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  625. package/lib/simple-tree/api/schemaStatics.d.ts +12 -12
  626. package/lib/simple-tree/api/simpleSchemaCodec.d.ts +15 -3
  627. package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -1
  628. package/lib/simple-tree/api/simpleSchemaCodec.js +15 -3
  629. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  630. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts +1 -1
  631. package/lib/simple-tree/api/simpleSchemaToJsonSchema.d.ts.map +1 -1
  632. package/lib/simple-tree/api/simpleSchemaToJsonSchema.js.map +1 -1
  633. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +8 -1
  634. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -1
  635. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +15 -10
  636. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -1
  637. package/lib/simple-tree/api/storedSchema.d.ts +1 -1
  638. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  639. package/lib/simple-tree/api/storedSchema.js +1 -2
  640. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  641. package/lib/simple-tree/api/tree.d.ts +15 -2
  642. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  643. package/lib/simple-tree/api/tree.js.map +1 -1
  644. package/lib/simple-tree/api/typesUnsafe.d.ts +3 -3
  645. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  646. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  647. package/lib/simple-tree/core/allowedTypes.d.ts +2 -2
  648. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
  649. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  650. package/lib/simple-tree/core/index.d.ts +1 -1
  651. package/lib/simple-tree/core/index.d.ts.map +1 -1
  652. package/lib/simple-tree/core/index.js +1 -1
  653. package/lib/simple-tree/core/index.js.map +1 -1
  654. package/lib/simple-tree/core/toStored.d.ts +17 -15
  655. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  656. package/lib/simple-tree/core/toStored.js +4 -37
  657. package/lib/simple-tree/core/toStored.js.map +1 -1
  658. package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
  659. package/lib/simple-tree/core/treeNode.js +1 -0
  660. package/lib/simple-tree/core/treeNode.js.map +1 -1
  661. package/lib/simple-tree/core/walkSchema.d.ts.map +1 -1
  662. package/lib/simple-tree/core/walkSchema.js +5 -1
  663. package/lib/simple-tree/core/walkSchema.js.map +1 -1
  664. package/lib/simple-tree/createContext.d.ts.map +1 -1
  665. package/lib/simple-tree/createContext.js +20 -5
  666. package/lib/simple-tree/createContext.js.map +1 -1
  667. package/lib/simple-tree/fieldSchema.d.ts +3 -3
  668. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  669. package/lib/simple-tree/fieldSchema.js.map +1 -1
  670. package/lib/simple-tree/index.d.ts +6 -5
  671. package/lib/simple-tree/index.d.ts.map +1 -1
  672. package/lib/simple-tree/index.js +5 -4
  673. package/lib/simple-tree/index.js.map +1 -1
  674. package/lib/simple-tree/leafNodeSchema.d.ts +5 -5
  675. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  676. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  677. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  678. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts +3 -3
  679. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.d.ts.map +1 -1
  680. package/lib/simple-tree/node-kinds/array/arrayNodeTypes.js.map +1 -1
  681. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  682. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  683. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts +3 -3
  684. package/lib/simple-tree/node-kinds/map/mapNodeTypes.d.ts.map +1 -1
  685. package/lib/simple-tree/node-kinds/map/mapNodeTypes.js.map +1 -1
  686. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts +2 -2
  687. package/lib/simple-tree/node-kinds/object/objectNodeTypes.d.ts.map +1 -1
  688. package/lib/simple-tree/node-kinds/object/objectNodeTypes.js.map +1 -1
  689. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  690. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  691. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts +3 -3
  692. package/lib/simple-tree/node-kinds/record/recordNodeTypes.d.ts.map +1 -1
  693. package/lib/simple-tree/node-kinds/record/recordNodeTypes.js.map +1 -1
  694. package/lib/simple-tree/simpleSchema.d.ts +55 -23
  695. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  696. package/lib/simple-tree/simpleSchema.js +16 -1
  697. package/lib/simple-tree/simpleSchema.js.map +1 -1
  698. package/lib/simple-tree/simpleSchemaFormatV1.d.ts +1 -1
  699. package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -1
  700. package/lib/simple-tree/simpleSchemaFormatV1.js +8 -1
  701. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -1
  702. package/lib/simple-tree/toStoredSchema.d.ts +58 -11
  703. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  704. package/lib/simple-tree/toStoredSchema.js +204 -31
  705. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  706. package/lib/simple-tree/treeSchema.d.ts +23 -0
  707. package/lib/simple-tree/treeSchema.d.ts.map +1 -0
  708. package/lib/simple-tree/treeSchema.js +21 -0
  709. package/lib/simple-tree/treeSchema.js.map +1 -0
  710. package/lib/tableSchema.d.ts +107 -64
  711. package/lib/tableSchema.d.ts.map +1 -1
  712. package/lib/tableSchema.js +162 -61
  713. package/lib/tableSchema.js.map +1 -1
  714. package/lib/util/brand.d.ts +49 -0
  715. package/lib/util/brand.d.ts.map +1 -1
  716. package/lib/util/brand.js +44 -0
  717. package/lib/util/brand.js.map +1 -1
  718. package/lib/util/index.d.ts +2 -1
  719. package/lib/util/index.d.ts.map +1 -1
  720. package/lib/util/index.js +2 -1
  721. package/lib/util/index.js.map +1 -1
  722. package/lib/util/readSnapshotBlob.d.ts +13 -0
  723. package/lib/util/readSnapshotBlob.d.ts.map +1 -0
  724. package/lib/util/readSnapshotBlob.js +14 -0
  725. package/lib/util/readSnapshotBlob.js.map +1 -0
  726. package/package.json +24 -23
  727. package/src/codec/codec.ts +44 -14
  728. package/src/codec/versioned/codec.ts +1 -1
  729. package/src/codec/versioned/format.ts +4 -1
  730. package/src/core/index.ts +4 -1
  731. package/src/core/rebase/index.ts +1 -0
  732. package/src/core/rebase/types.ts +25 -0
  733. package/src/core/schema-stored/schema.ts +5 -7
  734. package/src/core/tree/detachedFieldIndex.ts +54 -13
  735. package/src/core/tree/detachedFieldIndexFormatCommon.ts +4 -7
  736. package/src/core/tree/index.ts +7 -2
  737. package/src/feature-libraries/chunked-forest/codec/codecs.ts +3 -2
  738. package/src/feature-libraries/chunked-forest/codec/format.ts +6 -9
  739. package/src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts +15 -7
  740. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +9 -9
  741. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +22 -33
  742. package/src/feature-libraries/detachedFieldIndexSummarizer.ts +62 -15
  743. package/src/feature-libraries/forest-summary/codec.ts +22 -10
  744. package/src/feature-libraries/forest-summary/forestSummarizer.ts +77 -44
  745. package/src/feature-libraries/forest-summary/{format.ts → formatCommon.ts} +12 -13
  746. package/src/feature-libraries/forest-summary/formatV1.ts +12 -0
  747. package/src/feature-libraries/forest-summary/formatV2.ts +12 -0
  748. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +37 -56
  749. package/src/feature-libraries/forest-summary/index.ts +2 -2
  750. package/src/feature-libraries/forest-summary/summaryFormatCommon.ts +41 -0
  751. package/src/feature-libraries/forest-summary/summaryFormatV1ToV2.ts +11 -0
  752. package/src/feature-libraries/forest-summary/summaryFormatV3.ts +18 -0
  753. package/src/feature-libraries/forest-summary/summaryTypes.ts +41 -0
  754. package/src/feature-libraries/index.ts +1 -1
  755. package/src/feature-libraries/modular-schema/comparison.ts +64 -5
  756. package/src/feature-libraries/modular-schema/fieldKind.ts +24 -40
  757. package/src/feature-libraries/modular-schema/genericFieldKind.ts +4 -1
  758. package/src/feature-libraries/modular-schema/index.ts +1 -0
  759. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +2 -3
  760. package/src/feature-libraries/schema-index/codec.ts +7 -9
  761. package/src/feature-libraries/schema-index/schemaSummarizer.ts +59 -18
  762. package/src/index.ts +6 -2
  763. package/src/packageVersion.ts +1 -1
  764. package/src/shared-tree/independentView.ts +2 -3
  765. package/src/shared-tree/schematizingTreeView.ts +5 -0
  766. package/src/shared-tree/sharedTree.ts +20 -9
  767. package/src/shared-tree/sharedTreeChangeCodecs.ts +2 -2
  768. package/src/shared-tree/sharedTreeChangeEnricher.ts +31 -11
  769. package/src/shared-tree/treeAlpha.ts +2 -3
  770. package/src/shared-tree/treeCheckout.ts +103 -20
  771. package/src/shared-tree-core/editManagerCodecs.ts +11 -9
  772. package/src/shared-tree-core/{editManagerCodecsV5.ts → editManagerCodecsVSharedBranches.ts} +3 -3
  773. package/src/shared-tree-core/editManagerFormatCommons.ts +22 -16
  774. package/src/shared-tree-core/{editManagerFormatV5.ts → editManagerFormatVSharedBranches.ts} +2 -2
  775. package/src/shared-tree-core/editManagerSummarizer.ts +58 -16
  776. package/src/shared-tree-core/index.ts +12 -3
  777. package/src/shared-tree-core/{messageCodecV5.ts → messageCodecVSharedBranches.ts} +3 -3
  778. package/src/shared-tree-core/messageCodecs.ts +13 -11
  779. package/src/shared-tree-core/messageFormat.ts +23 -16
  780. package/src/shared-tree-core/{messageFormatV5.ts → messageFormatVSharedBranches.ts} +4 -6
  781. package/src/shared-tree-core/sharedTreeCore.ts +63 -75
  782. package/src/shared-tree-core/summaryTypes.ts +122 -0
  783. package/src/shared-tree-core/versionedSummarizer.ts +114 -0
  784. package/src/simple-tree/api/configuration.ts +21 -68
  785. package/src/simple-tree/api/dirtyIndex.ts +11 -0
  786. package/src/simple-tree/api/discrepancies.ts +1 -1
  787. package/src/simple-tree/api/eraseSchemaDetails.ts +123 -0
  788. package/src/simple-tree/api/getSimpleSchema.ts +13 -6
  789. package/src/simple-tree/api/incrementalAllowedTypes.ts +15 -3
  790. package/src/simple-tree/api/index.ts +7 -4
  791. package/src/simple-tree/api/schemaCompatibilityTester.ts +1 -1
  792. package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -2
  793. package/src/simple-tree/api/schemaFactoryRecursive.ts +0 -2
  794. package/src/simple-tree/api/schemaFromSimple.ts +11 -5
  795. package/src/simple-tree/api/simpleSchemaCodec.ts +17 -3
  796. package/src/simple-tree/api/simpleSchemaToJsonSchema.ts +1 -1
  797. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +18 -10
  798. package/src/simple-tree/api/storedSchema.ts +2 -2
  799. package/src/simple-tree/api/tree.ts +16 -1
  800. package/src/simple-tree/api/typesUnsafe.ts +7 -3
  801. package/src/simple-tree/core/allowedTypes.ts +3 -3
  802. package/src/simple-tree/core/index.ts +2 -2
  803. package/src/simple-tree/core/toStored.ts +22 -55
  804. package/src/simple-tree/core/treeNode.ts +1 -0
  805. package/src/simple-tree/core/walkSchema.ts +6 -0
  806. package/src/simple-tree/createContext.ts +29 -11
  807. package/src/simple-tree/fieldSchema.ts +10 -3
  808. package/src/simple-tree/index.ts +12 -10
  809. package/src/simple-tree/node-kinds/array/arrayNode.ts +5 -2
  810. package/src/simple-tree/node-kinds/array/arrayNodeTypes.ts +3 -3
  811. package/src/simple-tree/node-kinds/map/mapNode.ts +5 -2
  812. package/src/simple-tree/node-kinds/map/mapNodeTypes.ts +3 -3
  813. package/src/simple-tree/node-kinds/object/objectNodeTypes.ts +6 -2
  814. package/src/simple-tree/node-kinds/record/recordNode.ts +5 -2
  815. package/src/simple-tree/node-kinds/record/recordNodeTypes.ts +3 -3
  816. package/src/simple-tree/simpleSchema.ts +79 -32
  817. package/src/simple-tree/simpleSchemaFormatV1.ts +9 -1
  818. package/src/simple-tree/toStoredSchema.ts +319 -61
  819. package/src/simple-tree/treeSchema.ts +54 -0
  820. package/src/tableSchema.ts +487 -173
  821. package/src/util/brand.ts +61 -0
  822. package/src/util/index.ts +5 -0
  823. package/src/util/readSnapshotBlob.ts +23 -0
  824. package/dist/feature-libraries/forest-summary/format.d.ts +0 -23
  825. package/dist/feature-libraries/forest-summary/format.d.ts.map +0 -1
  826. package/dist/feature-libraries/forest-summary/format.js +0 -24
  827. package/dist/feature-libraries/forest-summary/format.js.map +0 -1
  828. package/dist/shared-tree-core/editManagerCodecsV5.d.ts.map +0 -1
  829. package/dist/shared-tree-core/editManagerCodecsV5.js.map +0 -1
  830. package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +0 -1
  831. package/dist/shared-tree-core/editManagerFormatV5.js.map +0 -1
  832. package/dist/shared-tree-core/messageCodecV5.d.ts.map +0 -1
  833. package/dist/shared-tree-core/messageCodecV5.js.map +0 -1
  834. package/dist/shared-tree-core/messageFormatV5.d.ts.map +0 -1
  835. package/dist/shared-tree-core/messageFormatV5.js.map +0 -1
  836. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +0 -40
  837. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +0 -1
  838. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +0 -177
  839. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +0 -1
  840. package/lib/feature-libraries/forest-summary/format.d.ts +0 -23
  841. package/lib/feature-libraries/forest-summary/format.d.ts.map +0 -1
  842. package/lib/feature-libraries/forest-summary/format.js +0 -21
  843. package/lib/feature-libraries/forest-summary/format.js.map +0 -1
  844. package/lib/shared-tree-core/editManagerCodecsV5.d.ts.map +0 -1
  845. package/lib/shared-tree-core/editManagerCodecsV5.js.map +0 -1
  846. package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +0 -1
  847. package/lib/shared-tree-core/editManagerFormatV5.js.map +0 -1
  848. package/lib/shared-tree-core/messageCodecV5.d.ts.map +0 -1
  849. package/lib/shared-tree-core/messageCodecV5.js.map +0 -1
  850. package/lib/shared-tree-core/messageFormatV5.d.ts.map +0 -1
  851. package/lib/shared-tree-core/messageFormatV5.js.map +0 -1
  852. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +0 -40
  853. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +0 -1
  854. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +0 -171
  855. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +0 -1
  856. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +0 -209
@@ -1 +1 @@
1
- {"version":3,"file":"mapNodeTypes.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/map/mapNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AA+D/C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B;;OAEG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAqB;QACzC,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;CACQ,CAAC;AAEX;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAsB;IACrD,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,GAAG,CAAC;AACrC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { MapNodeInsertableData, TreeMapNode } from \"./mapNode.js\";\nimport { NodeKind } from \"../../core/index.js\";\nimport type {\n\tTreeNodeSchemaClass,\n\tTreeNodeSchema,\n\tTreeNodeSchemaNonClass,\n\tWithType,\n\tImplicitAllowedTypes,\n} from \"../../core/index.js\";\n\nimport type { SimpleMapNodeSchema } from \"../../simpleSchema.js\";\n\n/**\n * A schema for customizable {@link (TreeMapNode:interface)}s.\n * @system @sealed @alpha\n */\nexport interface MapNodeCustomizableSchema<\n\tout TName extends string = string,\n\tin out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tout ImplicitlyConstructable extends boolean = true,\n\tout TCustomMetadata = unknown,\n> extends TreeNodeSchemaClass<\n\t\t\tTName,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<T> & WithType<TName, NodeKind.Map, T>,\n\t\t\tMapNodeInsertableData<T>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\n\t\t\tundefined,\n\t\t\tTCustomMetadata\n\t\t>,\n\t\tSimpleMapNodeSchema<TCustomMetadata> {}\n\n/**\n * A schema for POJO emulation mode {@link (TreeMapNode:interface)}s.\n * @system @sealed @alpha\n */\nexport interface MapNodePojoEmulationSchema<\n\tout TName extends string = string,\n\tin out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tout ImplicitlyConstructable extends boolean = true,\n\tout TCustomMetadata = unknown,\n> extends TreeNodeSchemaNonClass<\n\t\t\tTName,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<T> & WithType<TName, NodeKind.Map, T>,\n\t\t\tMapNodeInsertableData<T>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\n\t\t\tundefined,\n\t\t\tTCustomMetadata\n\t\t>,\n\t\tSimpleMapNodeSchema<TCustomMetadata> {}\n\n/**\n * A schema for {@link (TreeMapNode:interface)}s.\n * @privateRemarks\n * This could have generic arguments added and forwarded.\n * The expected use-cases for this don't need them however, and if they did want an argument it would probably be the allowed types;\n * perhaps if moving to an order independent way to pass generic arguments, adding support for them here would make sense.\n * @alpha\n */\nexport type MapNodeSchema = MapNodeCustomizableSchema | MapNodePojoEmulationSchema;\n\n/**\n * @alpha\n */\nexport const MapNodeSchema = {\n\t/**\n\t * instanceof-based narrowing support for MapNodeSchema in Javascript and TypeScript 5.3 or newer.\n\t */\n\t[Symbol.hasInstance](value: TreeNodeSchema): value is MapNodeSchema {\n\t\treturn isMapNodeSchema(value);\n\t},\n} as const;\n\n/**\n * Narrows a {@link (TreeNodeSchema:interface)} to an {@link (MapNodeSchema:interface)}.\n * @privateRemarks\n * If at some point we want to have internal only APIs for MapNodeSchema (like done for objects),\n * this can include those since its not the public facing API.\n */\nexport function isMapNodeSchema(schema: TreeNodeSchema): schema is MapNodeSchema {\n\treturn schema.kind === NodeKind.Map;\n}\n"]}
1
+ {"version":3,"file":"mapNodeTypes.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/map/mapNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AA+D/C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B;;OAEG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAqB;QACzC,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;CACQ,CAAC;AAEX;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAsB;IACrD,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,GAAG,CAAC;AACrC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { MapNodeInsertableData, TreeMapNode } from \"./mapNode.js\";\nimport { NodeKind } from \"../../core/index.js\";\nimport type {\n\tTreeNodeSchemaClass,\n\tTreeNodeSchema,\n\tTreeNodeSchemaNonClass,\n\tWithType,\n\tImplicitAllowedTypes,\n} from \"../../core/index.js\";\n\nimport type { SchemaType, SimpleMapNodeSchema } from \"../../simpleSchema.js\";\n\n/**\n * A schema for customizable {@link (TreeMapNode:interface)}s.\n * @system @sealed @alpha\n */\nexport interface MapNodeCustomizableSchema<\n\tout TName extends string = string,\n\tin out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tout ImplicitlyConstructable extends boolean = true,\n\tout TCustomMetadata = unknown,\n> extends TreeNodeSchemaClass<\n\t\t\tTName,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<T> & WithType<TName, NodeKind.Map, T>,\n\t\t\tMapNodeInsertableData<T>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\n\t\t\tundefined,\n\t\t\tTCustomMetadata\n\t\t>,\n\t\tSimpleMapNodeSchema<SchemaType.View, TCustomMetadata> {}\n\n/**\n * A schema for POJO emulation mode {@link (TreeMapNode:interface)}s.\n * @system @sealed @alpha\n */\nexport interface MapNodePojoEmulationSchema<\n\tout TName extends string = string,\n\tin out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tout ImplicitlyConstructable extends boolean = true,\n\tout TCustomMetadata = unknown,\n> extends TreeNodeSchemaNonClass<\n\t\t\tTName,\n\t\t\tNodeKind.Map,\n\t\t\tTreeMapNode<T> & WithType<TName, NodeKind.Map, T>,\n\t\t\tMapNodeInsertableData<T>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\n\t\t\tundefined,\n\t\t\tTCustomMetadata\n\t\t>,\n\t\tSimpleMapNodeSchema<SchemaType.View, TCustomMetadata> {}\n\n/**\n * A schema for {@link (TreeMapNode:interface)}s.\n * @privateRemarks\n * This could have generic arguments added and forwarded.\n * The expected use-cases for this don't need them however, and if they did want an argument it would probably be the allowed types;\n * perhaps if moving to an order independent way to pass generic arguments, adding support for them here would make sense.\n * @alpha\n */\nexport type MapNodeSchema = MapNodeCustomizableSchema | MapNodePojoEmulationSchema;\n\n/**\n * @alpha\n */\nexport const MapNodeSchema = {\n\t/**\n\t * instanceof-based narrowing support for MapNodeSchema in Javascript and TypeScript 5.3 or newer.\n\t */\n\t[Symbol.hasInstance](value: TreeNodeSchema): value is MapNodeSchema {\n\t\treturn isMapNodeSchema(value);\n\t},\n} as const;\n\n/**\n * Narrows a {@link (TreeNodeSchema:interface)} to an {@link (MapNodeSchema:interface)}.\n * @privateRemarks\n * If at some point we want to have internal only APIs for MapNodeSchema (like done for objects),\n * this can include those since its not the public facing API.\n */\nexport function isMapNodeSchema(schema: TreeNodeSchema): schema is MapNodeSchema {\n\treturn schema.kind === NodeKind.Map;\n}\n"]}
@@ -7,13 +7,13 @@ import type { TreeObjectNode, SimpleKeyMap, InsertableObjectFromSchemaRecord } f
7
7
  import type { FieldSchemaAlpha, ImplicitFieldSchema } from "../../fieldSchema.js";
8
8
  import { NodeKind, type TreeNodeSchemaClass, type TreeNodeSchema, type TreeNodeSchemaCorePrivate } from "../../core/index.js";
9
9
  import type { FieldKey } from "../../../core/index.js";
10
- import type { SimpleObjectFieldSchema, SimpleObjectNodeSchema } from "../../simpleSchema.js";
10
+ import type { SchemaType, SimpleObjectFieldSchema, SimpleObjectNodeSchema } from "../../simpleSchema.js";
11
11
  /**
12
12
  * A schema for {@link TreeObjectNode}s.
13
13
  * @sealed
14
14
  * @alpha
15
15
  */
16
- export interface ObjectNodeSchema<out TName extends string = string, in out T extends RestrictiveStringRecord<ImplicitFieldSchema> = RestrictiveStringRecord<ImplicitFieldSchema>, ImplicitlyConstructable extends boolean = boolean, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Object, TreeObjectNode<T, TName>, InsertableObjectFromSchemaRecord<T>, ImplicitlyConstructable, T, never, TCustomMetadata>, SimpleObjectNodeSchema<TCustomMetadata> {
16
+ export interface ObjectNodeSchema<out TName extends string = string, in out T extends RestrictiveStringRecord<ImplicitFieldSchema> = RestrictiveStringRecord<ImplicitFieldSchema>, ImplicitlyConstructable extends boolean = boolean, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Object, TreeObjectNode<T, TName>, InsertableObjectFromSchemaRecord<T>, ImplicitlyConstructable, T, never, TCustomMetadata>, SimpleObjectNodeSchema<SchemaType.View, TCustomMetadata> {
17
17
  /**
18
18
  * From property keys to the associated schema.
19
19
  */
@@ -1 +1 @@
1
- {"version":3,"file":"objectNodeTypes.d.ts","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/object/objectNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,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,EAAE,CAAC;IAElD;;OAEG;IACH,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;CAC7C;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC5B;;OAEG;2CACyB,cAAc;CAGjC,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,GACrD,4BAA4B,GAC5B,yBAAyB,CAAC;AAE3B,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,IAAI,uBAAuB,CAE5F"}
1
+ {"version":3,"file":"objectNodeTypes.d.ts","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/object/objectNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EACX,cAAc,EACd,YAAY,EACZ,gCAAgC,EAChC,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EACN,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,yBAAyB,EAC9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EACX,UAAU,EACV,uBAAuB,EACvB,sBAAsB,EACtB,MAAM,uBAAuB,CAAC;AAE/B;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAChC,GAAG,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EACjC,EAAE,CAAC,GAAG,CAAC,CAAC,SACP,uBAAuB,CAAC,mBAAmB,CAAC,GAAG,uBAAuB,CAAC,mBAAmB,CAAC,EAC5F,uBAAuB,SAAS,OAAO,GAAG,OAAO,EACjD,GAAG,CAAC,eAAe,GAAG,OAAO,CAC5B,SAAQ,mBAAmB,CAC1B,KAAK,EACL,QAAQ,CAAC,MAAM,EACf,cAAc,CAAC,CAAC,EAAE,KAAK,CAAC,EACxB,gCAAgC,CAAC,CAAC,CAAC,EACnC,uBAAuB,EACvB,CAAC,EACD,KAAK,EACL,eAAe,CACf,EACD,sBAAsB,CAAC,UAAU,CAAC,IAAI,EAAE,eAAe,CAAC;IACzD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,uBAAuB,CAAC,CAAC;CACjF;AAED;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,yBAAyB;IAC9E;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAE/D;;OAEG;IACH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,QAAQ,EAAE,CAAC;IAElD;;OAEG;IACH,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;CAC7C;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC5B;;OAEG;2CACyB,cAAc;CAGjC,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,GACrD,4BAA4B,GAC5B,yBAAyB,CAAC;AAE3B,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,IAAI,uBAAuB,CAE5F"}
@@ -1 +1 @@
1
- {"version":3,"file":"objectNodeTypes.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/object/objectNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EACN,QAAQ,GAIR,MAAM,qBAAqB,CAAC;AAyD7B;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B;;OAEG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAqB;QACzC,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACQ,CAAC;AASX,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACxD,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,CAAC;AACxC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { RestrictiveStringRecord } from \"../../../util/index.js\";\nimport type {\n\tTreeObjectNode,\n\tSimpleKeyMap,\n\tInsertableObjectFromSchemaRecord,\n} from \"./objectNode.js\";\nimport type { FieldSchemaAlpha, ImplicitFieldSchema } from \"../../fieldSchema.js\";\nimport {\n\tNodeKind,\n\ttype TreeNodeSchemaClass,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaCorePrivate,\n} from \"../../core/index.js\";\nimport type { FieldKey } from \"../../../core/index.js\";\nimport type { SimpleObjectFieldSchema, SimpleObjectNodeSchema } from \"../../simpleSchema.js\";\n\n/**\n * A schema for {@link TreeObjectNode}s.\n * @sealed\n * @alpha\n */\nexport interface ObjectNodeSchema<\n\tout TName extends string = string,\n\tin out T extends\n\t\tRestrictiveStringRecord<ImplicitFieldSchema> = RestrictiveStringRecord<ImplicitFieldSchema>,\n\tImplicitlyConstructable extends boolean = boolean,\n\tout TCustomMetadata = unknown,\n> extends TreeNodeSchemaClass<\n\t\t\tTName,\n\t\t\tNodeKind.Object,\n\t\t\tTreeObjectNode<T, TName>,\n\t\t\tInsertableObjectFromSchemaRecord<T>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t\t>,\n\t\tSimpleObjectNodeSchema<TCustomMetadata> {\n\t/**\n\t * From property keys to the associated schema.\n\t */\n\treadonly fields: ReadonlyMap<string, FieldSchemaAlpha & SimpleObjectFieldSchema>;\n}\n\n/**\n * Extra data provided on all {@link ObjectNodeSchema} that is not included in the (soon possibly public) ObjectNodeSchema type.\n */\nexport interface ObjectNodeSchemaInternalData extends TreeNodeSchemaCorePrivate {\n\t/**\n\t * {@inheritdoc SimpleKeyMap}\n\t */\n\treadonly flexKeyMap: SimpleKeyMap;\n\n\t/**\n\t * Lookup the property keys from the stored keys.\n\t */\n\treadonly storedKeyToPropertyKey: ReadonlyMap<FieldKey, string>;\n\n\t/**\n\t * Stored keys which hold identifiers.\n\t */\n\treadonly identifierFieldKeys: readonly FieldKey[];\n\n\t/**\n\t * Whether to tolerate (and preserve) additional unknown optional fields in instances of this object node.\n\t */\n\treadonly allowUnknownOptionalFields: boolean;\n}\n\n/**\n * @alpha\n */\nexport const ObjectNodeSchema = {\n\t/**\n\t * instanceof-based narrowing support for ObjectNodeSchema in Javascript and TypeScript 5.3 or newer.\n\t */\n\t[Symbol.hasInstance](value: TreeNodeSchema): value is ObjectNodeSchema {\n\t\treturn isObjectNodeSchema(value);\n\t},\n} as const;\n\n/**\n * {@link ObjectNodeSchema} with data that is not part of the package-exported API surface.\n */\nexport type ObjectNodeSchemaPrivate = ObjectNodeSchema &\n\tObjectNodeSchemaInternalData &\n\tTreeNodeSchemaCorePrivate;\n\nexport function isObjectNodeSchema(schema: TreeNodeSchema): schema is ObjectNodeSchemaPrivate {\n\treturn schema.kind === NodeKind.Object;\n}\n"]}
1
+ {"version":3,"file":"objectNodeTypes.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/object/objectNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EACN,QAAQ,GAIR,MAAM,qBAAqB,CAAC;AA6D7B;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B;;OAEG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAqB;QACzC,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACQ,CAAC;AASX,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACxD,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,CAAC;AACxC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { RestrictiveStringRecord } from \"../../../util/index.js\";\nimport type {\n\tTreeObjectNode,\n\tSimpleKeyMap,\n\tInsertableObjectFromSchemaRecord,\n} from \"./objectNode.js\";\nimport type { FieldSchemaAlpha, ImplicitFieldSchema } from \"../../fieldSchema.js\";\nimport {\n\tNodeKind,\n\ttype TreeNodeSchemaClass,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaCorePrivate,\n} from \"../../core/index.js\";\nimport type { FieldKey } from \"../../../core/index.js\";\nimport type {\n\tSchemaType,\n\tSimpleObjectFieldSchema,\n\tSimpleObjectNodeSchema,\n} from \"../../simpleSchema.js\";\n\n/**\n * A schema for {@link TreeObjectNode}s.\n * @sealed\n * @alpha\n */\nexport interface ObjectNodeSchema<\n\tout TName extends string = string,\n\tin out T extends\n\t\tRestrictiveStringRecord<ImplicitFieldSchema> = RestrictiveStringRecord<ImplicitFieldSchema>,\n\tImplicitlyConstructable extends boolean = boolean,\n\tout TCustomMetadata = unknown,\n> extends TreeNodeSchemaClass<\n\t\t\tTName,\n\t\t\tNodeKind.Object,\n\t\t\tTreeObjectNode<T, TName>,\n\t\t\tInsertableObjectFromSchemaRecord<T>,\n\t\t\tImplicitlyConstructable,\n\t\t\tT,\n\t\t\tnever,\n\t\t\tTCustomMetadata\n\t\t>,\n\t\tSimpleObjectNodeSchema<SchemaType.View, TCustomMetadata> {\n\t/**\n\t * From property keys to the associated schema.\n\t */\n\treadonly fields: ReadonlyMap<string, FieldSchemaAlpha & SimpleObjectFieldSchema>;\n}\n\n/**\n * Extra data provided on all {@link ObjectNodeSchema} that is not included in the (soon possibly public) ObjectNodeSchema type.\n */\nexport interface ObjectNodeSchemaInternalData extends TreeNodeSchemaCorePrivate {\n\t/**\n\t * {@inheritdoc SimpleKeyMap}\n\t */\n\treadonly flexKeyMap: SimpleKeyMap;\n\n\t/**\n\t * Lookup the property keys from the stored keys.\n\t */\n\treadonly storedKeyToPropertyKey: ReadonlyMap<FieldKey, string>;\n\n\t/**\n\t * Stored keys which hold identifiers.\n\t */\n\treadonly identifierFieldKeys: readonly FieldKey[];\n\n\t/**\n\t * Whether to tolerate (and preserve) additional unknown optional fields in instances of this object node.\n\t */\n\treadonly allowUnknownOptionalFields: boolean;\n}\n\n/**\n * @alpha\n */\nexport const ObjectNodeSchema = {\n\t/**\n\t * instanceof-based narrowing support for ObjectNodeSchema in Javascript and TypeScript 5.3 or newer.\n\t */\n\t[Symbol.hasInstance](value: TreeNodeSchema): value is ObjectNodeSchema {\n\t\treturn isObjectNodeSchema(value);\n\t},\n} as const;\n\n/**\n * {@link ObjectNodeSchema} with data that is not part of the package-exported API surface.\n */\nexport type ObjectNodeSchemaPrivate = ObjectNodeSchema &\n\tObjectNodeSchemaInternalData &\n\tTreeNodeSchemaCorePrivate;\n\nexport function isObjectNodeSchema(schema: TreeNodeSchema): schema is ObjectNodeSchemaPrivate {\n\treturn schema.kind === NodeKind.Object;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"recordNode.d.ts","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/record/recordNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAEN,QAAQ,EASR,KAAK,oBAAoB,EAMzB,KAAK,yBAAyB,EAO9B,MAAM,qBAAqB,CAAC;AAS7B,OAAO,KAAK,EACX,4BAA4B,EAE5B,6BAA6B,EAG7B,MAAM,sBAAsB,CAAC;AAS9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAoJjE;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CACnC,KAAK,SAAS,MAAM,EACpB,aAAa,SAAS,oBAAoB,EAC1C,wBAAwB,SAAS,OAAO,EACxC,eAAe,GAAG,OAAO;IAEzB;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC;IAE3B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAE/B;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IACpB,CAAC;AACF,CAAC;AAED;;GAEG;AACH,SAAS,wBAAwB,CAAC,IAAoB;IACrD,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,kBAAkB,CAAC,IAAI,CAAC;IAChC,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC;QAC7B,OAAO,kBAAkB,CAAC,IAAI,CAAC;IAChC,CAAC;IAED,OAAO,kBAAkB,CAAC,MAAM,CAAC;AAClC,CAAC;AAED;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,IAAoB,EAAE,MAAwB;IAC1E,IAAI,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,UAAU,CAAC,kDAAkD,IAAI,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,MAAM,cAAc,GAAmD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5F,OAAO,2BAA2B,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Lazy } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type JsonCompatibleReadOnlyObject, brand } from \"../../../util/index.js\";\n\nimport {\n\ttype TreeNodeSchema,\n\tNodeKind,\n\t// eslint-disable-next-line import-x/no-deprecated\n\ttypeNameSymbol,\n\ttypeSchemaSymbol,\n\ttype UnhydratedFlexTreeNode,\n\tgetInnerNode,\n\tgetKernel,\n\ttype InternalTreeNode,\n\ttype NodeSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tTreeNodeValid,\n\ttype MostDerivedData,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaCorePrivate,\n\tprivateDataSymbol,\n\tcreateTreeNodeSchemaPrivateData,\n\ttype FlexContent,\n\tCompatibilityLevel,\n\ttype TreeNodeSchemaPrivateData,\n\tAnnotatedAllowedTypesInternal,\n} from \"../../core/index.js\";\nimport { getTreeNodeSchemaInitializedData } from \"../../createContext.js\";\nimport { tryGetTreeNodeForField } from \"../../getTreeNodeForField.js\";\nimport { createFieldSchema, FieldKind } from \"../../fieldSchema.js\";\nimport {\n\tunhydratedFlexTreeFromInsertable,\n\ttype FactoryContent,\n\ttype InsertableContent,\n} from \"../../unhydratedFlexTreeFromInsertable.js\";\nimport type {\n\tRecordNodeCustomizableSchema,\n\tRecordNodeInsertableData,\n\tRecordNodePojoEmulationSchema,\n\tRecordNodeSchema,\n\tTreeRecordNode,\n} from \"./recordNodeTypes.js\";\nimport {\n\tisTreeValue,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n} from \"../../../feature-libraries/index.js\";\nimport { prepareForInsertion } from \"../../prepareForInsertion.js\";\nimport { recordLikeDataToFlexContent } from \"../common.js\";\nimport { MapNodeStoredSchema } from \"../../../core/index.js\";\nimport type { NodeSchemaOptionsAlpha } from \"../../api/index.js\";\nimport type { SimpleAllowedTypeAttributes } from \"../../simpleSchema.js\";\n\n/**\n * Create a proxy which implements the {@link TreeRecordNode} API.\n * @param proxyTarget - Target object of the proxy.\n * @param customizable - See {@link RecordNodeSchemaOptions.customizable}.\n * @param schema - The schema of the record node.\n */\nfunction createRecordNodeProxy(\n\tproxyTarget: object,\n\tcustomizable: boolean,\n\tschema: RecordNodeSchema,\n): TreeRecordNode {\n\tconst proxy: TreeRecordNode = new Proxy<TreeRecordNode>(proxyTarget as TreeRecordNode, {\n\t\tget: (target, key, receiver): unknown => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\tswitch (key) {\n\t\t\t\t\t// POJO mode records don't have TreeNode's build in members on their targets, so special case them:\n\t\t\t\t\tcase typeSchemaSymbol: {\n\t\t\t\t\t\treturn schema;\n\t\t\t\t\t}\n\t\t\t\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\t\t\t\tcase typeNameSymbol: {\n\t\t\t\t\t\treturn schema.identifier;\n\t\t\t\t\t}\n\t\t\t\t\tcase Symbol.iterator: {\n\t\t\t\t\t\treturn () => recordIterator(proxy);\n\t\t\t\t\t}\n\t\t\t\t\tcase Symbol.toPrimitive: {\n\t\t\t\t\t\t// Handle string interpolation and coercion to string\n\t\t\t\t\t\treturn () => Object.prototype.toString.call(proxy);\n\t\t\t\t\t}\n\t\t\t\t\tcase Symbol.toStringTag: {\n\t\t\t\t\t\t// In order to satisfy deep equality checks in POJO (non-customizable) mode,\n\t\t\t\t\t\t// we cannot override the behavior of this.\n\t\t\t\t\t\tif (customizable) {\n\t\t\t\t\t\t\t// Generates nicer toString behavior for customizable records.\n\t\t\t\t\t\t\t// E.g. `[object My.Record]` instead of `[object Object]`.\n\t\t\t\t\t\t\treturn schema.identifier;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\t// No-op\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof key === \"string\") {\n\t\t\t\tconst innerNode = getInnerNode(receiver);\n\t\t\t\tconst field = innerNode.tryGetField(brand(key));\n\t\t\t\tif (field !== undefined) {\n\t\t\t\t\treturn tryGetTreeNodeForField(field);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t},\n\t\tset: (target, key, value: InsertableContent | undefined, receiver): boolean => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(receiver);\n\t\t\tconst field = innerNode.getBoxed(brand(key)) as FlexTreeOptionalField;\n\t\t\tconst kernel = getKernel(receiver);\n\t\t\tconst innerSchema = innerNode.context.schema.nodeSchema.get(brand(schema.identifier));\n\t\t\tassert(\n\t\t\t\tinnerSchema instanceof MapNodeStoredSchema,\n\t\t\t\t0xc1a /* Expected MapNodeStoredSchema */,\n\t\t\t);\n\n\t\t\tconst mapTree = prepareForInsertion(\n\t\t\t\tvalue,\n\t\t\t\tcreateFieldSchema(FieldKind.Optional, kernel.schema.info as ImplicitAllowedTypes),\n\t\t\t\tinnerNode.context,\n\t\t\t\tinnerSchema.mapFields,\n\t\t\t);\n\n\t\t\tfield.editor.set(mapTree, field.length === 0);\n\t\t\treturn true;\n\t\t},\n\t\thas: (target, key): boolean => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\tconst childField = innerNode.tryGetField(brand(key));\n\n\t\t\treturn childField !== undefined;\n\t\t},\n\t\townKeys: (target) => {\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\treturn [...innerNode.keys()];\n\t\t},\n\t\tgetOwnPropertyDescriptor: (target, key) => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\tconst field = innerNode.tryGetField(brand(key));\n\n\t\t\tif (field === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tvalue: tryGetTreeNodeForField(field),\n\t\t\t\twritable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true, // Must be 'configurable' if property is absent from proxy target.\n\t\t\t};\n\t\t},\n\t\tdefineProperty(target, key, attributes) {\n\t\t\tthrow new UsageError(\"Shadowing properties of record nodes is not permitted.\");\n\t\t},\n\t\tdeleteProperty(target, key) {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\tconst field = innerNode.tryGetField(brand(key)) as FlexTreeOptionalField | undefined;\n\t\t\tif (field !== undefined) {\n\t\t\t\tfield.editor.set(undefined, field.length === 0);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t});\n\treturn proxy;\n}\n\nabstract class CustomRecordNodeBase<\n\tconst TAllowedTypes extends ImplicitAllowedTypes,\n> extends TreeNodeValid<RecordNodeInsertableData<TAllowedTypes>> {\n\tpublic static readonly kind = NodeKind.Record;\n\n\tpublic constructor(\n\t\tinput?: InternalTreeNode | RecordNodeInsertableData<TAllowedTypes> | undefined,\n\t) {\n\t\tsuper(input ?? {});\n\t}\n}\n\n/**\n * {@link recordSchema} options.\n * @input\n */\nexport interface RecordSchemaOptions<\n\tTName extends string,\n\tTAllowedTypes extends ImplicitAllowedTypes,\n\tTImplicitlyConstructable extends boolean,\n\tTCustomMetadata = unknown,\n> {\n\t/**\n\t * Unique identifier for this schema within this factory's scope.\n\t */\n\treadonly identifier: TName;\n\n\treadonly customizable: boolean;\n\n\t/**\n\t * The kinds of nodes that are allowed as children of this record.\n\t */\n\treadonly info: TAllowedTypes;\n\n\treadonly implicitlyConstructable: TImplicitlyConstructable;\n\n\treadonly nodeOptions?: NodeSchemaOptionsAlpha<TCustomMetadata>;\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link TreeRecordNode}.\n *\n * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n * @param persistedMetadata -\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function recordSchema<\n\tTName extends string,\n\tconst TAllowedTypes extends ImplicitAllowedTypes,\n\tconst TImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\toptions: RecordSchemaOptions<\n\t\tTName,\n\t\tTAllowedTypes,\n\t\tTImplicitlyConstructable,\n\t\tTCustomMetadata\n\t>,\n) {\n\tconst { identifier, info, customizable, implicitlyConstructable, nodeOptions } = options;\n\tconst persistedMetadata = nodeOptions?.persistedMetadata;\n\n\tconst normalizedTypes = normalizeAllowedTypes(info);\n\tconst lazyAllowedTypesIdentifiers = new Lazy(\n\t\t() => new Set(normalizedTypes.evaluate().map((type) => type.identifier)),\n\t);\n\tconst lazySimpleAllowedTypes = new Lazy(() => {\n\t\treturn AnnotatedAllowedTypesInternal.evaluateSimpleAllowedTypes(normalizedTypes);\n\t});\n\n\tlet privateData: TreeNodeSchemaPrivateData | undefined;\n\n\tclass Schema\n\t\textends CustomRecordNodeBase<TAllowedTypes>\n\t\timplements TreeRecordNode<TAllowedTypes>\n\t{\n\t\t/**\n\t\t * Record-like index signature for the node.\n\t\t */\n\t\t[key: string]: TreeNodeFromImplicitAllowedTypes<TAllowedTypes>;\n\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\t// Differentiate between the following cases:\n\t\t\t//\n\t\t\t// Case 1: Direct construction (POJO emulation)\n\t\t\t//\n\t\t\t// const Foo = schemaFactory.record(\"Foo\", schemaFactory.number);\n\t\t\t//\n\t\t\t// assert.deepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t//\t\t \"Prototype chain equivalent to POJO.\");\n\t\t\t//\n\t\t\t// Case 2: Subclass construction (Customizable Record)\n\t\t\t//\n\t\t\t// \t class Foo extends schemaFactory.record(\"Foo\", schemaFactory.number) {}\n\t\t\t//\n\t\t\t// \t assert.notDeepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t// \t \"Subclass prototype chain differs from POJO.\");\n\t\t\t//\n\t\t\t// In Case 1 (POJO emulation), the prototype chain match '{}' (proxyTarget = undefined)\n\t\t\t// In Case 2 (Customizable Object), the prototype chain include the user's subclass (proxyTarget = this)\n\t\t\tconst proxyTarget = customizable ? instance : {};\n\t\t\treturn createRecordNodeProxy(\n\t\t\t\tproxyTarget,\n\t\t\t\tcustomizable,\n\t\t\t\tthis as unknown as RecordNodeSchema,\n\t\t\t) as unknown as Schema;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn unhydratedFlexTreeFromInsertable(input as object, this as typeof Schema);\n\t\t}\n\n\t\tprotected static override oneTimeSetup(): TreeNodeSchemaInitializedData {\n\t\t\t// First run, do extra validation.\n\t\t\t// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.\n\t\t\t// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).\n\t\t\t{\n\t\t\t\tlet prototype: object = this.prototype;\n\t\t\t\t// There isn't a clear cleaner way to author this loop.\n\t\t\t\twhile (prototype !== Schema.prototype) {\n\t\t\t\t\tfor (const key of Object.getOwnPropertyNames(prototype)) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t// constructor is a special case, since one is built in on the derived type, and shadowing it works fine since we only use it before fields are applied.\n\t\t\t\t\t\t\tkey !== \"constructor\" &&\n\t\t\t\t\t\t\tReflect.getOwnPropertyDescriptor(prototype, key) !== undefined\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Schema ${identifier} defines an inherited property \"${key.toString()}\" which could shadow a legal entry. Since child fields are exposed as own properties, shadowing properties of record nodes is not permitted.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Since this stops at CustomRecordNode, it should never see a null prototype, so this case is safe.\n\t\t\t\t\t// Additionally, if the prototype chain is ever messed up such that CustomRecordNode is not in it,\n\t\t\t\t\t// the null that would show up here does at least ensure this code throws instead of hanging.\n\t\t\t\t\tprototype = Reflect.getPrototypeOf(prototype) as object;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst schema = this as RecordNodeSchema;\n\t\t\treturn getTreeNodeSchemaInitializedData(this, {\n\t\t\t\tshallowCompatibilityTest,\n\t\t\t\ttoFlexContent: (data: FactoryContent): FlexContent =>\n\t\t\t\t\trecordToFlexContent(data, schema),\n\t\t\t});\n\t\t}\n\n\t\tpublic static get allowedTypesIdentifiers(): ReadonlySet<string> {\n\t\t\treturn lazyAllowedTypesIdentifiers.value;\n\t\t}\n\n\t\tpublic static get simpleAllowedTypes(): ReadonlyMap<string, SimpleAllowedTypeAttributes> {\n\t\t\treturn lazySimpleAllowedTypes.value;\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: TImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn normalizedTypes.evaluateSet();\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> =\n\t\t\tnodeOptions?.metadata ?? {};\n\t\tpublic static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =\n\t\t\tpersistedMetadata;\n\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): Output {\n\t\t\treturn Schema.constructorCached?.constructor as unknown as Output;\n\t\t}\n\n\t\tpublic [Symbol.iterator](): IterableIterator<\n\t\t\t[string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>]\n\t\t> {\n\t\t\treturn recordIterator(this);\n\t\t}\n\t\tpublic get [Symbol.toStringTag](): string {\n\t\t\treturn identifier;\n\t\t}\n\n\t\tpublic static get [privateDataSymbol](): TreeNodeSchemaPrivateData {\n\t\t\treturn (privateData ??= createTreeNodeSchemaPrivateData(this, [normalizedTypes]));\n\t\t}\n\t}\n\n\ttype Output = RecordNodeCustomizableSchema<\n\t\tTName,\n\t\tTAllowedTypes,\n\t\tTImplicitlyConstructable,\n\t\tTCustomMetadata\n\t> &\n\t\tRecordNodePojoEmulationSchema<\n\t\t\tTName,\n\t\t\tTAllowedTypes,\n\t\t\tTImplicitlyConstructable,\n\t\t\tTCustomMetadata\n\t\t> &\n\t\tTreeNodeSchemaCorePrivate;\n\n\tconst output: Output = Schema;\n\treturn output;\n}\n\nfunction* recordIterator<TAllowedTypes extends ImplicitAllowedTypes>(\n\trecord: TreeRecordNode<TAllowedTypes>,\n): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>]> {\n\tfor (const [key, value] of Object.entries(record)) {\n\t\tyield [key, value];\n\t}\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.shallowCompatibilityTest} for Record nodes.\n */\nfunction shallowCompatibilityTest(data: FactoryContent): CompatibilityLevel {\n\tif (isTreeValue(data)) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\tif (Symbol.iterator in data) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\treturn CompatibilityLevel.Normal;\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.toFlexContent} for Record nodes.\n *\n * Transforms data under a Record schema.\n * @param data - The tree data to be transformed. Must be a Record-like object.\n * @param schema - The schema to comply with.\n */\nfunction recordToFlexContent(data: FactoryContent, schema: RecordNodeSchema): FlexContent {\n\tif (!(typeof data === \"object\" && data !== null)) {\n\t\tthrow new UsageError(`Input data is incompatible with Record schema: ${data}`);\n\t}\n\n\tconst fieldsIterator: Iterable<readonly [string, InsertableContent]> = Object.entries(data);\n\treturn recordLikeDataToFlexContent(fieldsIterator, schema);\n}\n"]}
1
+ {"version":3,"file":"recordNode.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/record/recordNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAAqC,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAEN,QAAQ;AACR,kDA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Ac,GAAmD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5F,OAAO,2BAA2B,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Lazy } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { type JsonCompatibleReadOnlyObject, brand } from \"../../../util/index.js\";\n\nimport {\n\ttype TreeNodeSchema,\n\tNodeKind,\n\t// eslint-disable-next-line import-x/no-deprecated\n\ttypeNameSymbol,\n\ttypeSchemaSymbol,\n\ttype UnhydratedFlexTreeNode,\n\tgetInnerNode,\n\tgetKernel,\n\ttype InternalTreeNode,\n\ttype NodeSchemaMetadata,\n\ttype ImplicitAllowedTypes,\n\tnormalizeAllowedTypes,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tTreeNodeValid,\n\ttype MostDerivedData,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaCorePrivate,\n\tprivateDataSymbol,\n\tcreateTreeNodeSchemaPrivateData,\n\ttype FlexContent,\n\tCompatibilityLevel,\n\ttype TreeNodeSchemaPrivateData,\n\tAnnotatedAllowedTypesInternal,\n} from \"../../core/index.js\";\nimport { getTreeNodeSchemaInitializedData } from \"../../createContext.js\";\nimport { tryGetTreeNodeForField } from \"../../getTreeNodeForField.js\";\nimport { createFieldSchema, FieldKind } from \"../../fieldSchema.js\";\nimport {\n\tunhydratedFlexTreeFromInsertable,\n\ttype FactoryContent,\n\ttype InsertableContent,\n} from \"../../unhydratedFlexTreeFromInsertable.js\";\nimport type {\n\tRecordNodeCustomizableSchema,\n\tRecordNodeInsertableData,\n\tRecordNodePojoEmulationSchema,\n\tRecordNodeSchema,\n\tTreeRecordNode,\n} from \"./recordNodeTypes.js\";\nimport {\n\tisTreeValue,\n\ttype FlexTreeNode,\n\ttype FlexTreeOptionalField,\n} from \"../../../feature-libraries/index.js\";\nimport { prepareForInsertion } from \"../../prepareForInsertion.js\";\nimport { recordLikeDataToFlexContent } from \"../common.js\";\nimport { MapNodeStoredSchema } from \"../../../core/index.js\";\nimport type { NodeSchemaOptionsAlpha } from \"../../api/index.js\";\nimport type { SchemaType, SimpleAllowedTypeAttributes } from \"../../simpleSchema.js\";\n\n/**\n * Create a proxy which implements the {@link TreeRecordNode} API.\n * @param proxyTarget - Target object of the proxy.\n * @param customizable - See {@link RecordNodeSchemaOptions.customizable}.\n * @param schema - The schema of the record node.\n */\nfunction createRecordNodeProxy(\n\tproxyTarget: object,\n\tcustomizable: boolean,\n\tschema: RecordNodeSchema,\n): TreeRecordNode {\n\tconst proxy: TreeRecordNode = new Proxy<TreeRecordNode>(proxyTarget as TreeRecordNode, {\n\t\tget: (target, key, receiver): unknown => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\tswitch (key) {\n\t\t\t\t\t// POJO mode records don't have TreeNode's build in members on their targets, so special case them:\n\t\t\t\t\tcase typeSchemaSymbol: {\n\t\t\t\t\t\treturn schema;\n\t\t\t\t\t}\n\t\t\t\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\t\t\t\tcase typeNameSymbol: {\n\t\t\t\t\t\treturn schema.identifier;\n\t\t\t\t\t}\n\t\t\t\t\tcase Symbol.iterator: {\n\t\t\t\t\t\treturn () => recordIterator(proxy);\n\t\t\t\t\t}\n\t\t\t\t\tcase Symbol.toPrimitive: {\n\t\t\t\t\t\t// Handle string interpolation and coercion to string\n\t\t\t\t\t\treturn () => Object.prototype.toString.call(proxy);\n\t\t\t\t\t}\n\t\t\t\t\tcase Symbol.toStringTag: {\n\t\t\t\t\t\t// In order to satisfy deep equality checks in POJO (non-customizable) mode,\n\t\t\t\t\t\t// we cannot override the behavior of this.\n\t\t\t\t\t\tif (customizable) {\n\t\t\t\t\t\t\t// Generates nicer toString behavior for customizable records.\n\t\t\t\t\t\t\t// E.g. `[object My.Record]` instead of `[object Object]`.\n\t\t\t\t\t\t\treturn schema.identifier;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\t// No-op\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (typeof key === \"string\") {\n\t\t\t\tconst innerNode = getInnerNode(receiver);\n\t\t\t\tconst field = innerNode.tryGetField(brand(key));\n\t\t\t\tif (field !== undefined) {\n\t\t\t\t\treturn tryGetTreeNodeForField(field);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t},\n\t\tset: (target, key, value: InsertableContent | undefined, receiver): boolean => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(receiver);\n\t\t\tconst field = innerNode.getBoxed(brand(key)) as FlexTreeOptionalField;\n\t\t\tconst kernel = getKernel(receiver);\n\t\t\tconst innerSchema = innerNode.context.schema.nodeSchema.get(brand(schema.identifier));\n\t\t\tassert(\n\t\t\t\tinnerSchema instanceof MapNodeStoredSchema,\n\t\t\t\t0xc1a /* Expected MapNodeStoredSchema */,\n\t\t\t);\n\n\t\t\tconst mapTree = prepareForInsertion(\n\t\t\t\tvalue,\n\t\t\t\tcreateFieldSchema(FieldKind.Optional, kernel.schema.info as ImplicitAllowedTypes),\n\t\t\t\tinnerNode.context,\n\t\t\t\tinnerSchema.mapFields,\n\t\t\t);\n\n\t\t\tfield.editor.set(mapTree, field.length === 0);\n\t\t\treturn true;\n\t\t},\n\t\thas: (target, key): boolean => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\tconst childField = innerNode.tryGetField(brand(key));\n\n\t\t\treturn childField !== undefined;\n\t\t},\n\t\townKeys: (target) => {\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\treturn [...innerNode.keys()];\n\t\t},\n\t\tgetOwnPropertyDescriptor: (target, key) => {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\tconst field = innerNode.tryGetField(brand(key));\n\n\t\t\tif (field === undefined) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tvalue: tryGetTreeNodeForField(field),\n\t\t\t\twritable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true, // Must be 'configurable' if property is absent from proxy target.\n\t\t\t};\n\t\t},\n\t\tdefineProperty(target, key, attributes) {\n\t\t\tthrow new UsageError(\"Shadowing properties of record nodes is not permitted.\");\n\t\t},\n\t\tdeleteProperty(target, key) {\n\t\t\tif (typeof key === \"symbol\") {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst innerNode = getInnerNode(proxy);\n\t\t\tconst field = innerNode.tryGetField(brand(key)) as FlexTreeOptionalField | undefined;\n\t\t\tif (field !== undefined) {\n\t\t\t\tfield.editor.set(undefined, field.length === 0);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t});\n\treturn proxy;\n}\n\nabstract class CustomRecordNodeBase<\n\tconst TAllowedTypes extends ImplicitAllowedTypes,\n> extends TreeNodeValid<RecordNodeInsertableData<TAllowedTypes>> {\n\tpublic static readonly kind = NodeKind.Record;\n\n\tpublic constructor(\n\t\tinput?: InternalTreeNode | RecordNodeInsertableData<TAllowedTypes> | undefined,\n\t) {\n\t\tsuper(input ?? {});\n\t}\n}\n\n/**\n * {@link recordSchema} options.\n * @input\n */\nexport interface RecordSchemaOptions<\n\tTName extends string,\n\tTAllowedTypes extends ImplicitAllowedTypes,\n\tTImplicitlyConstructable extends boolean,\n\tTCustomMetadata = unknown,\n> {\n\t/**\n\t * Unique identifier for this schema within this factory's scope.\n\t */\n\treadonly identifier: TName;\n\n\treadonly customizable: boolean;\n\n\t/**\n\t * The kinds of nodes that are allowed as children of this record.\n\t */\n\treadonly info: TAllowedTypes;\n\n\treadonly implicitlyConstructable: TImplicitlyConstructable;\n\n\treadonly nodeOptions?: NodeSchemaOptionsAlpha<TCustomMetadata>;\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link TreeRecordNode}.\n *\n * @param fields - Schema for fields of the object node's schema. Defines what children can be placed under each key.\n * @param persistedMetadata -\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function recordSchema<\n\tTName extends string,\n\tconst TAllowedTypes extends ImplicitAllowedTypes,\n\tconst TImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\toptions: RecordSchemaOptions<\n\t\tTName,\n\t\tTAllowedTypes,\n\t\tTImplicitlyConstructable,\n\t\tTCustomMetadata\n\t>,\n) {\n\tconst { identifier, info, customizable, implicitlyConstructable, nodeOptions } = options;\n\tconst persistedMetadata = nodeOptions?.persistedMetadata;\n\n\tconst normalizedTypes = normalizeAllowedTypes(info);\n\tconst lazyAllowedTypesIdentifiers = new Lazy(\n\t\t() => new Set(normalizedTypes.evaluate().map((type) => type.identifier)),\n\t);\n\tconst lazySimpleAllowedTypes = new Lazy(() => {\n\t\treturn AnnotatedAllowedTypesInternal.evaluateSimpleAllowedTypes(normalizedTypes);\n\t});\n\n\tlet privateData: TreeNodeSchemaPrivateData | undefined;\n\n\tclass Schema\n\t\textends CustomRecordNodeBase<TAllowedTypes>\n\t\timplements TreeRecordNode<TAllowedTypes>\n\t{\n\t\t/**\n\t\t * Record-like index signature for the node.\n\t\t */\n\t\t[key: string]: TreeNodeFromImplicitAllowedTypes<TAllowedTypes>;\n\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\t// Differentiate between the following cases:\n\t\t\t//\n\t\t\t// Case 1: Direct construction (POJO emulation)\n\t\t\t//\n\t\t\t// const Foo = schemaFactory.record(\"Foo\", schemaFactory.number);\n\t\t\t//\n\t\t\t// assert.deepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t//\t\t \"Prototype chain equivalent to POJO.\");\n\t\t\t//\n\t\t\t// Case 2: Subclass construction (Customizable Record)\n\t\t\t//\n\t\t\t// \t class Foo extends schemaFactory.record(\"Foo\", schemaFactory.number) {}\n\t\t\t//\n\t\t\t// \t assert.notDeepEqual(new Foo({ bar: 42 }), { bar: 42 },\n\t\t\t// \t \"Subclass prototype chain differs from POJO.\");\n\t\t\t//\n\t\t\t// In Case 1 (POJO emulation), the prototype chain match '{}' (proxyTarget = undefined)\n\t\t\t// In Case 2 (Customizable Object), the prototype chain include the user's subclass (proxyTarget = this)\n\t\t\tconst proxyTarget = customizable ? instance : {};\n\t\t\treturn createRecordNodeProxy(\n\t\t\t\tproxyTarget,\n\t\t\t\tcustomizable,\n\t\t\t\tthis as unknown as RecordNodeSchema,\n\t\t\t) as unknown as Schema;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn unhydratedFlexTreeFromInsertable(input as object, this as typeof Schema);\n\t\t}\n\n\t\tprotected static override oneTimeSetup(): TreeNodeSchemaInitializedData {\n\t\t\t// First run, do extra validation.\n\t\t\t// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.\n\t\t\t// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).\n\t\t\t{\n\t\t\t\tlet prototype: object = this.prototype;\n\t\t\t\t// There isn't a clear cleaner way to author this loop.\n\t\t\t\twhile (prototype !== Schema.prototype) {\n\t\t\t\t\tfor (const key of Object.getOwnPropertyNames(prototype)) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t// constructor is a special case, since one is built in on the derived type, and shadowing it works fine since we only use it before fields are applied.\n\t\t\t\t\t\t\tkey !== \"constructor\" &&\n\t\t\t\t\t\t\tReflect.getOwnPropertyDescriptor(prototype, key) !== undefined\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Schema ${identifier} defines an inherited property \"${key.toString()}\" which could shadow a legal entry. Since child fields are exposed as own properties, shadowing properties of record nodes is not permitted.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Since this stops at CustomRecordNode, it should never see a null prototype, so this case is safe.\n\t\t\t\t\t// Additionally, if the prototype chain is ever messed up such that CustomRecordNode is not in it,\n\t\t\t\t\t// the null that would show up here does at least ensure this code throws instead of hanging.\n\t\t\t\t\tprototype = Reflect.getPrototypeOf(prototype) as object;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst schema = this as RecordNodeSchema;\n\t\t\treturn getTreeNodeSchemaInitializedData(this, {\n\t\t\t\tshallowCompatibilityTest,\n\t\t\t\ttoFlexContent: (data: FactoryContent): FlexContent =>\n\t\t\t\t\trecordToFlexContent(data, schema),\n\t\t\t});\n\t\t}\n\n\t\tpublic static get allowedTypesIdentifiers(): ReadonlySet<string> {\n\t\t\treturn lazyAllowedTypesIdentifiers.value;\n\t\t}\n\n\t\tpublic static get simpleAllowedTypes(): ReadonlyMap<\n\t\t\tstring,\n\t\t\tSimpleAllowedTypeAttributes<SchemaType.View>\n\t\t> {\n\t\t\treturn lazySimpleAllowedTypes.value;\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: TImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn normalizedTypes.evaluateSet();\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> =\n\t\t\tnodeOptions?.metadata ?? {};\n\t\tpublic static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =\n\t\t\tpersistedMetadata;\n\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): Output {\n\t\t\treturn Schema.constructorCached?.constructor as unknown as Output;\n\t\t}\n\n\t\tpublic [Symbol.iterator](): IterableIterator<\n\t\t\t[string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>]\n\t\t> {\n\t\t\treturn recordIterator(this);\n\t\t}\n\t\tpublic get [Symbol.toStringTag](): string {\n\t\t\treturn identifier;\n\t\t}\n\n\t\tpublic static get [privateDataSymbol](): TreeNodeSchemaPrivateData {\n\t\t\treturn (privateData ??= createTreeNodeSchemaPrivateData(this, [normalizedTypes]));\n\t\t}\n\t}\n\n\ttype Output = RecordNodeCustomizableSchema<\n\t\tTName,\n\t\tTAllowedTypes,\n\t\tTImplicitlyConstructable,\n\t\tTCustomMetadata\n\t> &\n\t\tRecordNodePojoEmulationSchema<\n\t\t\tTName,\n\t\t\tTAllowedTypes,\n\t\t\tTImplicitlyConstructable,\n\t\t\tTCustomMetadata\n\t\t> &\n\t\tTreeNodeSchemaCorePrivate;\n\n\tconst output: Output = Schema;\n\treturn output;\n}\n\nfunction* recordIterator<TAllowedTypes extends ImplicitAllowedTypes>(\n\trecord: TreeRecordNode<TAllowedTypes>,\n): IterableIterator<[string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>]> {\n\tfor (const [key, value] of Object.entries(record)) {\n\t\tyield [key, value];\n\t}\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.shallowCompatibilityTest} for Record nodes.\n */\nfunction shallowCompatibilityTest(data: FactoryContent): CompatibilityLevel {\n\tif (isTreeValue(data)) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\tif (Symbol.iterator in data) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\treturn CompatibilityLevel.Normal;\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.toFlexContent} for Record nodes.\n *\n * Transforms data under a Record schema.\n * @param data - The tree data to be transformed. Must be a Record-like object.\n * @param schema - The schema to comply with.\n */\nfunction recordToFlexContent(data: FactoryContent, schema: RecordNodeSchema): FlexContent {\n\tif (!(typeof data === \"object\" && data !== null)) {\n\t\tthrow new UsageError(`Input data is incompatible with Record schema: ${data}`);\n\t}\n\n\tconst fieldsIterator: Iterable<readonly [string, InsertableContent]> = Object.entries(data);\n\treturn recordLikeDataToFlexContent(fieldsIterator, schema);\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { NodeKind } from "../../core/index.js";
6
6
  import type { TreeNodeSchemaClass, TreeNodeSchema, TreeNodeSchemaNonClass, WithType, TreeNode, ImplicitAllowedTypes, InsertableTreeNodeFromImplicitAllowedTypes, TreeNodeFromImplicitAllowedTypes } from "../../core/index.js";
7
- import type { SimpleRecordNodeSchema } from "../../simpleSchema.js";
7
+ import type { SchemaType, SimpleRecordNodeSchema } from "../../simpleSchema.js";
8
8
  import type { RestrictiveStringRecord } from "../../../util/index.js";
9
9
  /**
10
10
  * A {@link TreeNode} which models a TypeScript {@link https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type | record}.
@@ -50,13 +50,13 @@ export type RecordNodeInsertableData<T extends ImplicitAllowedTypes> = Restricti
50
50
  * A schema for customizable {@link (TreeMapNode:interface)}s.
51
51
  * @system @sealed @alpha
52
52
  */
53
- export interface RecordNodeCustomizableSchema<out TName extends string = string, in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Record, TreeRecordNode<T> & WithType<TName, NodeKind.Record, T>, RecordNodeInsertableData<T>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleRecordNodeSchema<TCustomMetadata> {
53
+ export interface RecordNodeCustomizableSchema<out TName extends string = string, in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Record, TreeRecordNode<T> & WithType<TName, NodeKind.Record, T>, RecordNodeInsertableData<T>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleRecordNodeSchema<SchemaType.View, TCustomMetadata> {
54
54
  }
55
55
  /**
56
56
  * A schema for POJO emulation mode {@link (TreeMapNode:interface)}s.
57
57
  * @system @sealed @alpha
58
58
  */
59
- export interface RecordNodePojoEmulationSchema<out TName extends string = string, in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaNonClass<TName, NodeKind.Record, TreeRecordNode<T> & WithType<TName, NodeKind.Record, T>, RecordNodeInsertableData<T>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleRecordNodeSchema<TCustomMetadata> {
59
+ export interface RecordNodePojoEmulationSchema<out TName extends string = string, in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaNonClass<TName, NodeKind.Record, TreeRecordNode<T> & WithType<TName, NodeKind.Record, T>, RecordNodeInsertableData<T>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleRecordNodeSchema<SchemaType.View, TCustomMetadata> {
60
60
  }
61
61
  /**
62
62
  * A schema for {@link (TreeRecordNode:interface)}s.
@@ -1 +1 @@
1
- {"version":3,"file":"recordNodeTypes.d.ts","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/record/recordNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EACX,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACR,QAAQ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C,MAAM,gBAAgB,GAAG;IAC/B;;OAEG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAqB;QACzC,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACQ,CAAC;AAEX;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACxD,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,CAAC;AACxC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { NodeKind } from \"../../core/index.js\";\nimport type {\n\tTreeNodeSchemaClass,\n\tTreeNodeSchema,\n\tTreeNodeSchemaNonClass,\n\tWithType,\n\tTreeNode,\n\tImplicitAllowedTypes,\n\tInsertableTreeNodeFromImplicitAllowedTypes,\n\tTreeNodeFromImplicitAllowedTypes,\n} from \"../../core/index.js\";\n\nimport type { SimpleRecordNodeSchema } from \"../../simpleSchema.js\";\nimport type { RestrictiveStringRecord } from \"../../../util/index.js\";\n\n/**\n * A {@link TreeNode} which models a TypeScript {@link https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type | record}.\n *\n * @remarks\n * Due to {@link https://github.com/microsoft/TypeScript/issues/43826}, we can't enable implicit construction of {@link TreeNode|TreeNodes} for setters.\n * Therefore code assigning to these fields must explicitly construct nodes using the schema's constructor or create method,\n * or using some other method like {@link (TreeAlpha:interface).create}.\n *\n * Field Assignment and Deletion\n *\n * Unlike JavaScript's `Record` type, assigning `undefined` to a key in {@link TreeRecordNode} behaves like a `delete` operation,\n * removing the field's contents.\n *\n * This is to stay consistent with {@link TreeObjectNode} behavior.\n *\n * Example:\n * ```ts\n * const Numbers = schemaFactory.record(\"Numbers\", schemaFactory.number);\n * const record = new Numbers({ a:1, b:2 });\n *\n * // This is equivalent to delete record.a, and removes the entry.\n * record.a = undefined\n * ```\n *\n * @beta\n */\nexport interface TreeRecordNode<\n\tTAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n> extends TreeNode,\n\t\tRecord<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {\n\t/**\n\t * Allows the record's entries to be iterated over, including in contexts like `for...of` loops.\n\t */\n\t[Symbol.iterator](): IterableIterator<\n\t\t[string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>]\n\t>;\n}\n\n/**\n * Content which can be used to construct a Record node, explicitly or implicitly.\n * @system @beta\n */\nexport type RecordNodeInsertableData<T extends ImplicitAllowedTypes> = RestrictiveStringRecord<\n\tInsertableTreeNodeFromImplicitAllowedTypes<T>\n>;\n\n/**\n * A schema for customizable {@link (TreeMapNode:interface)}s.\n * @system @sealed @alpha\n */\nexport interface RecordNodeCustomizableSchema<\n\tout TName extends string = string,\n\tin out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tout ImplicitlyConstructable extends boolean = true,\n\tout TCustomMetadata = unknown,\n> extends TreeNodeSchemaClass<\n\t\t\t/* Name */ TName,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNode<T> & WithType<TName, NodeKind.Record, T>,\n\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t/* ImplicitlyConstructable */ ImplicitlyConstructable,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined,\n\t\t\t/* TCustomMetadata */ TCustomMetadata\n\t\t>,\n\t\tSimpleRecordNodeSchema<TCustomMetadata> {}\n\n/**\n * A schema for POJO emulation mode {@link (TreeMapNode:interface)}s.\n * @system @sealed @alpha\n */\nexport interface RecordNodePojoEmulationSchema<\n\tout TName extends string = string,\n\tin out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tout ImplicitlyConstructable extends boolean = true,\n\tout TCustomMetadata = unknown,\n> extends TreeNodeSchemaNonClass<\n\t\t\t/* Name */ TName,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNode<T> & WithType<TName, NodeKind.Record, T>,\n\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t/* ImplicitlyConstructable */ ImplicitlyConstructable,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined,\n\t\t\t/* TCustomMetadata */ TCustomMetadata\n\t\t>,\n\t\tSimpleRecordNodeSchema<TCustomMetadata> {}\n\n/**\n * A schema for {@link (TreeRecordNode:interface)}s.\n * @privateRemarks\n * This could have generic arguments added and forwarded.\n * The expected use-cases for this don't need them however, and if they did want an argument it would probably be the allowed types;\n * perhaps if moving to an order independent way to pass generic arguments, adding support for them here would make sense.\n * @alpha\n */\nexport type RecordNodeSchema<\n\tTName extends string = string,\n\tT extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tImplicitlyConstructable extends boolean = true,\n\tTCustomMetadata = unknown,\n> =\n\t| RecordNodeCustomizableSchema<TName, T, ImplicitlyConstructable, TCustomMetadata>\n\t| RecordNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata>;\n\n/**\n * @alpha\n */\nexport const RecordNodeSchema = {\n\t/**\n\t * `instanceof`-based narrowing support for {@link (RecordNodeSchema:type)} in JavaScript and TypeScript 5.3 or newer.\n\t */\n\t[Symbol.hasInstance](value: TreeNodeSchema): value is RecordNodeSchema {\n\t\treturn isRecordNodeSchema(value);\n\t},\n} as const;\n\n/**\n * Narrows a {@link (TreeNodeSchema:interface)} to an {@link (RecordNodeSchema:interface)}.\n * @privateRemarks\n * If at some point we want to have internal only APIs for RecordNodeSchema (like done for objects),\n * this can include those since its not the public-facing API.\n */\nexport function isRecordNodeSchema(schema: TreeNodeSchema): schema is RecordNodeSchema {\n\treturn schema.kind === NodeKind.Record;\n}\n"]}
1
+ {"version":3,"file":"recordNodeTypes.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/record/recordNodeTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAwH/C;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B;;OAEG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAqB;QACzC,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACQ,CAAC;AAEX;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACxD,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,CAAC;AACxC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { NodeKind } from \"../../core/index.js\";\nimport type {\n\tTreeNodeSchemaClass,\n\tTreeNodeSchema,\n\tTreeNodeSchemaNonClass,\n\tWithType,\n\tTreeNode,\n\tImplicitAllowedTypes,\n\tInsertableTreeNodeFromImplicitAllowedTypes,\n\tTreeNodeFromImplicitAllowedTypes,\n} from \"../../core/index.js\";\n\nimport type { SchemaType, SimpleRecordNodeSchema } from \"../../simpleSchema.js\";\nimport type { RestrictiveStringRecord } from \"../../../util/index.js\";\n\n/**\n * A {@link TreeNode} which models a TypeScript {@link https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type | record}.\n *\n * @remarks\n * Due to {@link https://github.com/microsoft/TypeScript/issues/43826}, we can't enable implicit construction of {@link TreeNode|TreeNodes} for setters.\n * Therefore code assigning to these fields must explicitly construct nodes using the schema's constructor or create method,\n * or using some other method like {@link (TreeAlpha:interface).create}.\n *\n * Field Assignment and Deletion\n *\n * Unlike JavaScript's `Record` type, assigning `undefined` to a key in {@link TreeRecordNode} behaves like a `delete` operation,\n * removing the field's contents.\n *\n * This is to stay consistent with {@link TreeObjectNode} behavior.\n *\n * Example:\n * ```ts\n * const Numbers = schemaFactory.record(\"Numbers\", schemaFactory.number);\n * const record = new Numbers({ a:1, b:2 });\n *\n * // This is equivalent to delete record.a, and removes the entry.\n * record.a = undefined\n * ```\n *\n * @beta\n */\nexport interface TreeRecordNode<\n\tTAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n> extends TreeNode,\n\t\tRecord<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {\n\t/**\n\t * Allows the record's entries to be iterated over, including in contexts like `for...of` loops.\n\t */\n\t[Symbol.iterator](): IterableIterator<\n\t\t[string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>]\n\t>;\n}\n\n/**\n * Content which can be used to construct a Record node, explicitly or implicitly.\n * @system @beta\n */\nexport type RecordNodeInsertableData<T extends ImplicitAllowedTypes> = RestrictiveStringRecord<\n\tInsertableTreeNodeFromImplicitAllowedTypes<T>\n>;\n\n/**\n * A schema for customizable {@link (TreeMapNode:interface)}s.\n * @system @sealed @alpha\n */\nexport interface RecordNodeCustomizableSchema<\n\tout TName extends string = string,\n\tin out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tout ImplicitlyConstructable extends boolean = true,\n\tout TCustomMetadata = unknown,\n> extends TreeNodeSchemaClass<\n\t\t\t/* Name */ TName,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNode<T> & WithType<TName, NodeKind.Record, T>,\n\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t/* ImplicitlyConstructable */ ImplicitlyConstructable,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined,\n\t\t\t/* TCustomMetadata */ TCustomMetadata\n\t\t>,\n\t\tSimpleRecordNodeSchema<SchemaType.View, TCustomMetadata> {}\n\n/**\n * A schema for POJO emulation mode {@link (TreeMapNode:interface)}s.\n * @system @sealed @alpha\n */\nexport interface RecordNodePojoEmulationSchema<\n\tout TName extends string = string,\n\tin out T extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tout ImplicitlyConstructable extends boolean = true,\n\tout TCustomMetadata = unknown,\n> extends TreeNodeSchemaNonClass<\n\t\t\t/* Name */ TName,\n\t\t\t/* Kind */ NodeKind.Record,\n\t\t\t/* TNode */ TreeRecordNode<T> & WithType<TName, NodeKind.Record, T>,\n\t\t\t/* TInsertable */ RecordNodeInsertableData<T>,\n\t\t\t/* ImplicitlyConstructable */ ImplicitlyConstructable,\n\t\t\t/* Info */ T,\n\t\t\t/* TConstructorExtra */ undefined,\n\t\t\t/* TCustomMetadata */ TCustomMetadata\n\t\t>,\n\t\tSimpleRecordNodeSchema<SchemaType.View, TCustomMetadata> {}\n\n/**\n * A schema for {@link (TreeRecordNode:interface)}s.\n * @privateRemarks\n * This could have generic arguments added and forwarded.\n * The expected use-cases for this don't need them however, and if they did want an argument it would probably be the allowed types;\n * perhaps if moving to an order independent way to pass generic arguments, adding support for them here would make sense.\n * @alpha\n */\nexport type RecordNodeSchema<\n\tTName extends string = string,\n\tT extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\tImplicitlyConstructable extends boolean = true,\n\tTCustomMetadata = unknown,\n> =\n\t| RecordNodeCustomizableSchema<TName, T, ImplicitlyConstructable, TCustomMetadata>\n\t| RecordNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata>;\n\n/**\n * @alpha\n */\nexport const RecordNodeSchema = {\n\t/**\n\t * `instanceof`-based narrowing support for {@link (RecordNodeSchema:type)} in JavaScript and TypeScript 5.3 or newer.\n\t */\n\t[Symbol.hasInstance](value: TreeNodeSchema): value is RecordNodeSchema {\n\t\treturn isRecordNodeSchema(value);\n\t},\n} as const;\n\n/**\n * Narrows a {@link (TreeNodeSchema:interface)} to an {@link (RecordNodeSchema:interface)}.\n * @privateRemarks\n * If at some point we want to have internal only APIs for RecordNodeSchema (like done for objects),\n * this can include those since its not the public-facing API.\n */\nexport function isRecordNodeSchema(schema: TreeNodeSchema): schema is RecordNodeSchema {\n\treturn schema.kind === NodeKind.Record;\n}\n"]}
@@ -13,7 +13,7 @@ import type { FieldKind, FieldSchemaMetadata } from "./fieldSchema.js";
13
13
  * @alpha
14
14
  * @sealed
15
15
  */
16
- export interface SimpleNodeSchemaBaseAlpha<out TNodeKind extends NodeKind, out TCustomMetadata = unknown> extends SimpleNodeSchemaBase<TNodeKind, TCustomMetadata> {
16
+ export interface SimpleNodeSchemaBaseAlpha<out Type extends SchemaType, out TNodeKind extends NodeKind, out TCustomMetadata = unknown> extends SimpleNodeSchemaBase<TNodeKind, TCustomMetadata> {
17
17
  /**
18
18
  * Persisted metadata for this node schema.
19
19
  * @remarks
@@ -27,6 +27,10 @@ export interface SimpleNodeSchemaBaseAlpha<out TNodeKind extends NodeKind, out T
27
27
  * If this does end up getting reflected in some compatibility value, that should also be documented.
28
28
  */
29
29
  readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined;
30
+ readonly metadata: SimpleNodeSchemaBase<TNodeKind, TCustomMetadata>["metadata"] & (Type extends SchemaType.View ? unknown : {
31
+ readonly custom?: undefined;
32
+ readonly description?: undefined;
33
+ });
30
34
  }
31
35
  /**
32
36
  * {@link AllowedTypes} for a location in the tree, expressed for use in the Simple Schema layer of abstraction.
@@ -35,14 +39,14 @@ export interface SimpleNodeSchemaBaseAlpha<out TNodeKind extends NodeKind, out T
35
39
  * Refers to the types by identifier.
36
40
  * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.
37
41
  */
38
- export type SimpleAllowedTypes = ReadonlyMap<string, SimpleAllowedTypeAttributes>;
42
+ export type SimpleAllowedTypes<Type extends SchemaType = SchemaType> = ReadonlyMap<string, SimpleAllowedTypeAttributes<Type>>;
39
43
  /**
40
44
  * A {@link SimpleNodeSchema} for an object node.
41
45
  *
42
46
  * @alpha
43
47
  * @sealed
44
48
  */
45
- export interface SimpleObjectNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBaseAlpha<NodeKind.Object, TCustomMetadata> {
49
+ export interface SimpleObjectNodeSchema<Type extends SchemaType = SchemaType, out TCustomMetadata = unknown> extends SimpleNodeSchemaBaseAlpha<Type, NodeKind.Object, TCustomMetadata> {
46
50
  /**
47
51
  * Schemas for each of the object's fields, keyed off of schema's keys.
48
52
  * @remarks
@@ -53,7 +57,7 @@ export interface SimpleObjectNodeSchema<out TCustomMetadata = unknown> extends S
53
57
  * TODO: Consider adding `storedKeysToFields` or something similar to reduce confusion,
54
58
  * especially if/when TreeNodeSchema for objects provide more maps.
55
59
  */
56
- readonly fields: ReadonlyMap<string, SimpleObjectFieldSchema>;
60
+ readonly fields: ReadonlyMap<string, SimpleObjectFieldSchema<Type>>;
57
61
  /**
58
62
  * Whether the object node allows unknown optional fields.
59
63
  *
@@ -61,7 +65,7 @@ export interface SimpleObjectNodeSchema<out TCustomMetadata = unknown> extends S
61
65
  *
62
66
  * @remarks Only populated for view schemas, undefined otherwise. Relevant for compatibility checking scenarios.
63
67
  */
64
- readonly allowUnknownOptionalFields: boolean | undefined;
68
+ readonly allowUnknownOptionalFields: Type extends SchemaType.View ? boolean : undefined;
65
69
  }
66
70
  /**
67
71
  * A {@link SimpleFieldSchema} for an {@link SimpleObjectNodeSchema} field.
@@ -71,7 +75,7 @@ export interface SimpleObjectNodeSchema<out TCustomMetadata = unknown> extends S
71
75
  * @alpha
72
76
  * @sealed
73
77
  */
74
- export interface SimpleObjectFieldSchema extends SimpleFieldSchema {
78
+ export interface SimpleObjectFieldSchema<Type extends SchemaType = SchemaType> extends SimpleFieldSchema<Type> {
75
79
  /**
76
80
  * The stored key of the field.
77
81
  * @remarks
@@ -85,14 +89,14 @@ export interface SimpleObjectFieldSchema extends SimpleFieldSchema {
85
89
  * @alpha
86
90
  * @sealed
87
91
  */
88
- export interface SimpleArrayNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBaseAlpha<NodeKind.Array, TCustomMetadata> {
92
+ export interface SimpleArrayNodeSchema<Type extends SchemaType = SchemaType, out TCustomMetadata = unknown> extends SimpleNodeSchemaBaseAlpha<Type, NodeKind.Array, TCustomMetadata> {
89
93
  /**
90
94
  * The types allowed in the array.
91
95
  *
92
96
  * @remarks Refers to the types by identifier.
93
97
  * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.
94
98
  */
95
- readonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>;
99
+ readonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes<Type>>;
96
100
  }
97
101
  /**
98
102
  * A {@link SimpleNodeSchema} for a map node.
@@ -100,14 +104,14 @@ export interface SimpleArrayNodeSchema<out TCustomMetadata = unknown> extends Si
100
104
  * @alpha
101
105
  * @sealed
102
106
  */
103
- export interface SimpleMapNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBaseAlpha<NodeKind.Map, TCustomMetadata> {
107
+ export interface SimpleMapNodeSchema<Type extends SchemaType = SchemaType, out TCustomMetadata = unknown> extends SimpleNodeSchemaBaseAlpha<Type, NodeKind.Map, TCustomMetadata> {
104
108
  /**
105
109
  * The types allowed as values in the map.
106
110
  *
107
111
  * @remarks Refers to the types by identifier.
108
112
  * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.
109
113
  */
110
- readonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>;
114
+ readonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes<Type>>;
111
115
  }
112
116
  /**
113
117
  * A {@link SimpleNodeSchema} for a map node.
@@ -115,14 +119,14 @@ export interface SimpleMapNodeSchema<out TCustomMetadata = unknown> extends Simp
115
119
  * @alpha
116
120
  * @sealed
117
121
  */
118
- export interface SimpleRecordNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBaseAlpha<NodeKind.Record, TCustomMetadata> {
122
+ export interface SimpleRecordNodeSchema<Type extends SchemaType = SchemaType, out TCustomMetadata = unknown> extends SimpleNodeSchemaBaseAlpha<Type, NodeKind.Record, TCustomMetadata> {
119
123
  /**
120
124
  * The types allowed as values in the record.
121
125
  *
122
126
  * @remarks Refers to the types by identifier.
123
127
  * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.
124
128
  */
125
- readonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>;
129
+ readonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes<Type>>;
126
130
  }
127
131
  /**
128
132
  * A {@link SimpleNodeSchema} for a leaf node.
@@ -130,7 +134,7 @@ export interface SimpleRecordNodeSchema<out TCustomMetadata = unknown> extends S
130
134
  * @alpha
131
135
  * @sealed
132
136
  */
133
- export interface SimpleLeafNodeSchema extends SimpleNodeSchemaBaseAlpha<NodeKind.Leaf> {
137
+ export interface SimpleLeafNodeSchema<Type extends SchemaType = SchemaType> extends SimpleNodeSchemaBaseAlpha<Type, NodeKind.Leaf> {
134
138
  /**
135
139
  * The kind of leaf node.
136
140
  */
@@ -150,14 +154,22 @@ export interface SimpleLeafNodeSchema extends SimpleNodeSchemaBaseAlpha<NodeKind
150
154
  *
151
155
  * @alpha
152
156
  */
153
- export type SimpleNodeSchema = SimpleLeafNodeSchema | SimpleMapNodeSchema | SimpleArrayNodeSchema | SimpleObjectNodeSchema | SimpleRecordNodeSchema;
157
+ export type SimpleNodeSchema<Type extends SchemaType = SchemaType> = SimpleLeafNodeSchema<Type> | SimpleMapNodeSchema<Type> | SimpleArrayNodeSchema<Type> | SimpleObjectNodeSchema<Type> | SimpleRecordNodeSchema<Type>;
154
158
  /**
155
159
  * Information about allowed types under a field.
156
160
  *
161
+ * @privateRemarks
162
+ * Variance annotations should not be used to change type checking: they are only used by the compiler as an optimization hint.
163
+ * However in this case, for unknown reasons, TypeScript makes this interface bi-variant without `out` on `Type`.
164
+ * That is bad as it allows schema of unknown type to be used as stored or view without errors.
165
+ * To mitigate this, `out` is added to make this interface properly covariant in `Type`.
166
+ * This may not be robust if TypeScript checks this type structurally,
167
+ * but whatever bug causes the bi-variant likely does not occur in that case anyway.
168
+ *
157
169
  * @alpha
158
170
  * @sealed
159
171
  */
160
- export interface SimpleAllowedTypeAttributes {
172
+ export interface SimpleAllowedTypeAttributes<out Type extends SchemaType = SchemaType> {
161
173
  /**
162
174
  * {@link SchemaUpgrade} if this schema is included as a {@link SchemaStaticsBeta.staged | staged} schema upgrade,
163
175
  * allowing the view schema be compatible with stored schema with (post upgrade) or without it (pre-upgrade).
@@ -169,7 +181,22 @@ export interface SimpleAllowedTypeAttributes {
169
181
  * The false and undefined cases here are a bit odd.
170
182
  * This API should be reevaluated before stabilizing.
171
183
  */
172
- readonly isStaged: false | SchemaUpgrade | undefined;
184
+ readonly isStaged: Type extends SchemaType.Stored ? undefined : false | SchemaUpgrade;
185
+ }
186
+ /**
187
+ * The type of simple schema being represented.
188
+ *
189
+ * @alpha
190
+ */
191
+ export declare enum SchemaType {
192
+ /**
193
+ * The schema is a stored schema, meaning it expresses exactly what could be validly persisted in a SharedTree.
194
+ */
195
+ Stored = 0,
196
+ /**
197
+ * The schema is a view schema, meaning it expresses how to view data which is using a compatible stored schema.
198
+ */
199
+ View = 1
173
200
  }
174
201
  /**
175
202
  * A simple, shallow representation of a schema for a field.
@@ -181,7 +208,7 @@ export interface SimpleAllowedTypeAttributes {
181
208
  * @alpha
182
209
  * @sealed
183
210
  */
184
- export interface SimpleFieldSchema {
211
+ export interface SimpleFieldSchema<Type extends SchemaType = SchemaType> {
185
212
  /**
186
213
  * The kind of tree field.
187
214
  */
@@ -192,11 +219,16 @@ export interface SimpleFieldSchema {
192
219
  * @remarks Refers to the types by identifier.
193
220
  * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.
194
221
  */
195
- readonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>;
222
+ readonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes<Type>>;
196
223
  /**
197
- * {@inheritDoc FieldSchemaMetadata}
224
+ * Metadata for this field schema, see {@link FieldSchemaMetadata}.
225
+ * @remarks
226
+ * As this is the non-persisted portion of the metadata, it is forced to store only undefined in the `SchemaType.Stored` case.
198
227
  */
199
- readonly metadata: FieldSchemaMetadata;
228
+ readonly metadata: FieldSchemaMetadata & (Type extends SchemaType.View ? unknown : {
229
+ readonly custom?: undefined;
230
+ readonly description?: undefined;
231
+ });
200
232
  /**
201
233
  * Persisted metadata for this field schema.
202
234
  * @remarks
@@ -214,11 +246,11 @@ export interface SimpleFieldSchema {
214
246
  * @alpha
215
247
  * @sealed
216
248
  */
217
- export interface SimpleTreeSchema {
249
+ export interface SimpleTreeSchema<Type extends SchemaType = SchemaType> {
218
250
  /**
219
251
  * The tree field representing the root of the tree.
220
252
  */
221
- readonly root: SimpleFieldSchema;
253
+ readonly root: SimpleFieldSchema<Type>;
222
254
  /**
223
255
  * The complete set of node schema definitions recursively referenced by the tree's {@link SimpleTreeSchema.root}.
224
256
  *
@@ -228,6 +260,6 @@ export interface SimpleTreeSchema {
228
260
  * Information about if a schema is {@link SchemaStaticsBeta.staged | staged} or not is not available as the "Simple Schema" layer of abstraction: they are included unconditionally.
229
261
  * Options for filtering out staged schemas from view schema are available in {@link extractPersistedSchema}.
230
262
  */
231
- readonly definitions: ReadonlyMap<string, SimpleNodeSchema>;
263
+ readonly definitions: ReadonlyMap<string, SimpleNodeSchema<Type>>;
232
264
  }
233
265
  //# sourceMappingURL=simpleSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"simpleSchema.d.ts","sourceRoot":"","sources":["../../src/simple-tree/simpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAOvE;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB,C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AQ,EAAE,mBAAmB,GACrC,CAAC,IAAI,SAAS,UAAU,CAAC,IAAI,GAC1B,OAAO,GACP;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;QAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAEvE;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,4BAA4B,GAAG,SAAS,CAAC;CACtE;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,SAAS,UAAU,GAAG,UAAU;IACrE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACvC;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;CAClE"}
@@ -2,5 +2,20 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export {};
5
+ /**
6
+ * The type of simple schema being represented.
7
+ *
8
+ * @alpha
9
+ */
10
+ export var SchemaType;
11
+ (function (SchemaType) {
12
+ /**
13
+ * The schema is a stored schema, meaning it expresses exactly what could be validly persisted in a SharedTree.
14
+ */
15
+ SchemaType[SchemaType["Stored"] = 0] = "Stored";
16
+ /**
17
+ * The schema is a view schema, meaning it expresses how to view data which is using a compatible stored schema.
18
+ */
19
+ SchemaType[SchemaType["View"] = 1] = "View";
20
+ })(SchemaType || (SchemaType = {}));
6
21
  //# sourceMappingURL=simpleSchema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"simpleSchema.js","sourceRoot":"","sources":["../../src/simple-tree/simpleSchema.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 { ValueSchema } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnlyObject } from \"../util/index.js\";\nimport type { NodeKind, SchemaUpgrade, SimpleNodeSchemaBase } from \"./core/index.js\";\nimport type { FieldKind, FieldSchemaMetadata } from \"./fieldSchema.js\";\n\n/*\n * TODO:\n * - Customize their JSON serialization to use these formats or provide some other serialization scheme.\n */\n\n/**\n * A {@link SimpleNodeSchema} containing fields for alpha features.\n *\n * @system\n * @alpha\n * @sealed\n */\nexport interface SimpleNodeSchemaBaseAlpha<\n\tout TNodeKind extends NodeKind,\n\tout TCustomMetadata = unknown,\n> extends SimpleNodeSchemaBase<TNodeKind, TCustomMetadata> {\n\t/**\n\t * Persisted metadata for this node schema.\n\t * @remarks\n\t * While this can be stored in the document, not all versions / configurations will do so.\n\t * Additionally, this is not part of {@link TreeView.compatibility|schema compatibility}, so different clients\n\t * (even within the same collaborative session) may see different `persistedMetadata` for the same node.\n\t * Specified using {@link NodeSchemaOptionsAlpha.persistedMetadata}.\n\t * @privateRemarks\n\t * How/when this gets updated in documents,\n\t * and how to read it from documents should be documented here when this feature is more mature and these questions have good answers.\n\t * If this does end up getting reflected in some compatibility value, that should also be documented.\n\t */\n\treadonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined;\n}\n\n/**\n * {@link AllowedTypes} for a location in the tree, expressed for use in the Simple Schema layer of abstraction.\n *\n * @remarks\n * Refers to the types by identifier.\n * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n */\nexport type SimpleAllowedTypes = ReadonlyMap<string, SimpleAllowedTypeAttributes>;\n\n/**\n * A {@link SimpleNodeSchema} for an object node.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleObjectNodeSchema<out TCustomMetadata = unknown>\n\textends SimpleNodeSchemaBaseAlpha<NodeKind.Object, TCustomMetadata> {\n\t/**\n\t * Schemas for each of the object's fields, keyed off of schema's keys.\n\t * @remarks\n\t * The keys are the property keys if known, otherwise they are the stored keys.\n\t * Use {@link SimpleObjectFieldSchema.storedKey} to get the stored key.\n\t * @privateRemarks\n\t * TODO: Provide and link a way to translate from stored keys to the property keys.\n\t * TODO: Consider adding `storedKeysToFields` or something similar to reduce confusion,\n\t * especially if/when TreeNodeSchema for objects provide more maps.\n\t */\n\treadonly fields: ReadonlyMap<string, SimpleObjectFieldSchema>;\n\n\t/**\n\t * Whether the object node allows unknown optional fields.\n\t *\n\t * @see {@link ObjectSchemaOptions.allowUnknownOptionalFields} for the API where this field is set as part of authoring a schema.\n\t *\n\t * @remarks Only populated for view schemas, undefined otherwise. Relevant for compatibility checking scenarios.\n\t */\n\treadonly allowUnknownOptionalFields: boolean | undefined;\n}\n\n/**\n * A {@link SimpleFieldSchema} for an {@link SimpleObjectNodeSchema} field.\n * @remarks\n * The only other case fields are uses in the root schema.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleObjectFieldSchema extends SimpleFieldSchema {\n\t/**\n\t * The stored key of the field.\n\t * @remarks\n\t * See {@link FieldProps.key} for more information.\n\t */\n\treadonly storedKey: string;\n}\n\n/**\n * A {@link SimpleNodeSchema} for an array node.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleArrayNodeSchema<out TCustomMetadata = unknown>\n\textends SimpleNodeSchemaBaseAlpha<NodeKind.Array, TCustomMetadata> {\n\t/**\n\t * The types allowed in the array.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a map node.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleMapNodeSchema<out TCustomMetadata = unknown>\n\textends SimpleNodeSchemaBaseAlpha<NodeKind.Map, TCustomMetadata> {\n\t/**\n\t * The types allowed as values in the map.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a map node.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleRecordNodeSchema<out TCustomMetadata = unknown>\n\textends SimpleNodeSchemaBaseAlpha<NodeKind.Record, TCustomMetadata> {\n\t/**\n\t * The types allowed as values in the record.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a leaf node.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleLeafNodeSchema extends SimpleNodeSchemaBaseAlpha<NodeKind.Leaf> {\n\t/**\n\t * The kind of leaf node.\n\t */\n\treadonly leafKind: ValueSchema;\n}\n\n/**\n * A simple, shallow representation of a schema for a node.\n *\n * @remarks This definition is incomplete, and references child types by identifiers.\n * To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which\n * contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.\n *\n * Note that, as documented on {@link NodeKind}, more kinds of nodes may be added,\n * and therefore code should not assume that switching over all these cases can be done exhaustively.\n * @privateRemarks\n * Because of the above mentioned extensibility of node kinds, does it make sense to stabilize this?\n *\n * @alpha\n */\nexport type SimpleNodeSchema =\n\t| SimpleLeafNodeSchema\n\t| SimpleMapNodeSchema\n\t| SimpleArrayNodeSchema\n\t| SimpleObjectNodeSchema\n\t| SimpleRecordNodeSchema;\n\n/**\n * Information about allowed types under a field.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleAllowedTypeAttributes {\n\t/**\n\t * {@link SchemaUpgrade} if this schema is included as a {@link SchemaStaticsBeta.staged | staged} schema upgrade,\n\t * allowing the view schema be compatible with stored schema with (post upgrade) or without it (pre-upgrade).\n\t * New documents and schema upgrades will omit any staged schema.\n\t *\n\t * Undefined if derived from a stored schema.\n\t *\n\t * @privateRemarks\n\t * The false and undefined cases here are a bit odd.\n\t * This API should be reevaluated before stabilizing.\n\t */\n\treadonly isStaged: false | SchemaUpgrade | undefined;\n}\n\n/**\n * A simple, shallow representation of a schema for a field.\n *\n * @remarks This definition is incomplete, and references child types by identifiers.\n * To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which\n * contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleFieldSchema {\n\t/**\n\t * The kind of tree field.\n\t */\n\treadonly kind: FieldKind;\n\n\t/**\n\t * Information about the allowed types under this field.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>;\n\n\t/**\n\t * {@inheritDoc FieldSchemaMetadata}\n\t */\n\treadonly metadata: FieldSchemaMetadata;\n\n\t/**\n\t * Persisted metadata for this field schema.\n\t * @remarks\n\t * Like {@link SimpleNodeSchemaBaseAlpha.persistedMetadata} but for fields.\n\t * Set via {@link FieldPropsAlpha.persistedMetadata}.\n\t */\n\treadonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;\n}\n\n/**\n * A simplified representation of a schema for a tree.\n *\n * @remarks Contains the complete set of schema {@link SimpleTreeSchema.definitions} required to resolve references,\n * which are represented inline with identifiers.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleTreeSchema {\n\t/**\n\t * The tree field representing the root of the tree.\n\t */\n\treadonly root: SimpleFieldSchema;\n\n\t/**\n\t * The complete set of node schema definitions recursively referenced by the tree's {@link SimpleTreeSchema.root}.\n\t *\n\t * @remarks\n\t * The keys are the schemas' {@link TreeNodeSchemaCore.identifier | identifiers}.\n\t *\n\t * Information about if a schema is {@link SchemaStaticsBeta.staged | staged} or not is not available as the \"Simple Schema\" layer of abstraction: they are included unconditionally.\n\t * Options for filtering out staged schemas from view schema are available in {@link extractPersistedSchema}.\n\t */\n\treadonly definitions: ReadonlyMap<string, SimpleNodeSchema>;\n}\n"]}
1
+ {"version":3,"file":"simpleSchema.js","sourceRoot":"","sources":["../../src/simple-tree/simpleSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoOH;;;;GAIG;AACH,MAAM,CAAN,IAAY,UASX;AATD,WAAY,UAAU;IACrB;;OAEG;IACH,+CAAM,CAAA;IACN;;OAEG;IACH,2CAAI,CAAA;AACL,CAAC,EATW,UAAU,KAAV,UAAU,QASrB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ValueSchema } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnlyObject } from \"../util/index.js\";\nimport type { NodeKind, SchemaUpgrade, SimpleNodeSchemaBase } from \"./core/index.js\";\nimport type { FieldKind, FieldSchemaMetadata } from \"./fieldSchema.js\";\n\n/*\n * TODO:\n * - Customize their JSON serialization to use these formats or provide some other serialization scheme.\n */\n\n/**\n * A {@link SimpleNodeSchema} containing fields for alpha features.\n *\n * @system\n * @alpha\n * @sealed\n */\nexport interface SimpleNodeSchemaBaseAlpha<\n\tout Type extends SchemaType,\n\tout TNodeKind extends NodeKind,\n\tout TCustomMetadata = unknown,\n> extends SimpleNodeSchemaBase<TNodeKind, TCustomMetadata> {\n\t/**\n\t * Persisted metadata for this node schema.\n\t * @remarks\n\t * While this can be stored in the document, not all versions / configurations will do so.\n\t * Additionally, this is not part of {@link TreeView.compatibility|schema compatibility}, so different clients\n\t * (even within the same collaborative session) may see different `persistedMetadata` for the same node.\n\t * Specified using {@link NodeSchemaOptionsAlpha.persistedMetadata}.\n\t * @privateRemarks\n\t * How/when this gets updated in documents,\n\t * and how to read it from documents should be documented here when this feature is more mature and these questions have good answers.\n\t * If this does end up getting reflected in some compatibility value, that should also be documented.\n\t */\n\treadonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined;\n\n\t// This overrides the type from SimpleNodeSchemaBase to make it more specific. When stabilized, this should be moved to the base interface.\n\treadonly metadata: SimpleNodeSchemaBase<TNodeKind, TCustomMetadata>[\"metadata\"] &\n\t\t(Type extends SchemaType.View\n\t\t\t? unknown\n\t\t\t: { readonly custom?: undefined; readonly description?: undefined });\n}\n\n/**\n * {@link AllowedTypes} for a location in the tree, expressed for use in the Simple Schema layer of abstraction.\n *\n * @remarks\n * Refers to the types by identifier.\n * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n */\nexport type SimpleAllowedTypes<Type extends SchemaType = SchemaType> = ReadonlyMap<\n\tstring,\n\tSimpleAllowedTypeAttributes<Type>\n>;\n\n/**\n * A {@link SimpleNodeSchema} for an object node.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleObjectNodeSchema<\n\tType extends SchemaType = SchemaType,\n\tout TCustomMetadata = unknown,\n> extends SimpleNodeSchemaBaseAlpha<Type, NodeKind.Object, TCustomMetadata> {\n\t/**\n\t * Schemas for each of the object's fields, keyed off of schema's keys.\n\t * @remarks\n\t * The keys are the property keys if known, otherwise they are the stored keys.\n\t * Use {@link SimpleObjectFieldSchema.storedKey} to get the stored key.\n\t * @privateRemarks\n\t * TODO: Provide and link a way to translate from stored keys to the property keys.\n\t * TODO: Consider adding `storedKeysToFields` or something similar to reduce confusion,\n\t * especially if/when TreeNodeSchema for objects provide more maps.\n\t */\n\treadonly fields: ReadonlyMap<string, SimpleObjectFieldSchema<Type>>;\n\n\t/**\n\t * Whether the object node allows unknown optional fields.\n\t *\n\t * @see {@link ObjectSchemaOptions.allowUnknownOptionalFields} for the API where this field is set as part of authoring a schema.\n\t *\n\t * @remarks Only populated for view schemas, undefined otherwise. Relevant for compatibility checking scenarios.\n\t */\n\treadonly allowUnknownOptionalFields: Type extends SchemaType.View ? boolean : undefined;\n}\n\n/**\n * A {@link SimpleFieldSchema} for an {@link SimpleObjectNodeSchema} field.\n * @remarks\n * The only other case fields are uses in the root schema.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleObjectFieldSchema<Type extends SchemaType = SchemaType>\n\textends SimpleFieldSchema<Type> {\n\t/**\n\t * The stored key of the field.\n\t * @remarks\n\t * See {@link FieldProps.key} for more information.\n\t */\n\treadonly storedKey: string;\n}\n\n/**\n * A {@link SimpleNodeSchema} for an array node.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleArrayNodeSchema<\n\tType extends SchemaType = SchemaType,\n\tout TCustomMetadata = unknown,\n> extends SimpleNodeSchemaBaseAlpha<Type, NodeKind.Array, TCustomMetadata> {\n\t/**\n\t * The types allowed in the array.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes<Type>>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a map node.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleMapNodeSchema<\n\tType extends SchemaType = SchemaType,\n\tout TCustomMetadata = unknown,\n> extends SimpleNodeSchemaBaseAlpha<Type, NodeKind.Map, TCustomMetadata> {\n\t/**\n\t * The types allowed as values in the map.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes<Type>>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a map node.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleRecordNodeSchema<\n\tType extends SchemaType = SchemaType,\n\tout TCustomMetadata = unknown,\n> extends SimpleNodeSchemaBaseAlpha<Type, NodeKind.Record, TCustomMetadata> {\n\t/**\n\t * The types allowed as values in the record.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes<Type>>;\n}\n\n/**\n * A {@link SimpleNodeSchema} for a leaf node.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleLeafNodeSchema<Type extends SchemaType = SchemaType>\n\textends SimpleNodeSchemaBaseAlpha<Type, NodeKind.Leaf> {\n\t/**\n\t * The kind of leaf node.\n\t */\n\treadonly leafKind: ValueSchema;\n}\n\n/**\n * A simple, shallow representation of a schema for a node.\n *\n * @remarks This definition is incomplete, and references child types by identifiers.\n * To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which\n * contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.\n *\n * Note that, as documented on {@link NodeKind}, more kinds of nodes may be added,\n * and therefore code should not assume that switching over all these cases can be done exhaustively.\n * @privateRemarks\n * Because of the above mentioned extensibility of node kinds, does it make sense to stabilize this?\n *\n * @alpha\n */\nexport type SimpleNodeSchema<Type extends SchemaType = SchemaType> =\n\t| SimpleLeafNodeSchema<Type>\n\t| SimpleMapNodeSchema<Type>\n\t| SimpleArrayNodeSchema<Type>\n\t| SimpleObjectNodeSchema<Type>\n\t| SimpleRecordNodeSchema<Type>;\n\n/**\n * Information about allowed types under a field.\n *\n * @privateRemarks\n * Variance annotations should not be used to change type checking: they are only used by the compiler as an optimization hint.\n * However in this case, for unknown reasons, TypeScript makes this interface bi-variant without `out` on `Type`.\n * That is bad as it allows schema of unknown type to be used as stored or view without errors.\n * To mitigate this, `out` is added to make this interface properly covariant in `Type`.\n * This may not be robust if TypeScript checks this type structurally,\n * but whatever bug causes the bi-variant likely does not occur in that case anyway.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleAllowedTypeAttributes<out Type extends SchemaType = SchemaType> {\n\t/**\n\t * {@link SchemaUpgrade} if this schema is included as a {@link SchemaStaticsBeta.staged | staged} schema upgrade,\n\t * allowing the view schema be compatible with stored schema with (post upgrade) or without it (pre-upgrade).\n\t * New documents and schema upgrades will omit any staged schema.\n\t *\n\t * Undefined if derived from a stored schema.\n\t *\n\t * @privateRemarks\n\t * The false and undefined cases here are a bit odd.\n\t * This API should be reevaluated before stabilizing.\n\t */\n\treadonly isStaged: Type extends SchemaType.Stored ? undefined : false | SchemaUpgrade;\n}\n\n/**\n * The type of simple schema being represented.\n *\n * @alpha\n */\nexport enum SchemaType {\n\t/**\n\t * The schema is a stored schema, meaning it expresses exactly what could be validly persisted in a SharedTree.\n\t */\n\tStored,\n\t/**\n\t * The schema is a view schema, meaning it expresses how to view data which is using a compatible stored schema.\n\t */\n\tView,\n}\n/**\n * A simple, shallow representation of a schema for a field.\n *\n * @remarks This definition is incomplete, and references child types by identifiers.\n * To be useful, this generally needs to be used as a part of a complete {@link SimpleTreeSchema}, which\n * contains backing {@link SimpleTreeSchema.definitions} for each referenced identifier.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleFieldSchema<Type extends SchemaType = SchemaType> {\n\t/**\n\t * The kind of tree field.\n\t */\n\treadonly kind: FieldKind;\n\n\t/**\n\t * Information about the allowed types under this field.\n\t *\n\t * @remarks Refers to the types by identifier.\n\t * A {@link SimpleTreeSchema} is needed to resolve these identifiers to their schema {@link SimpleTreeSchema.definitions}.\n\t */\n\treadonly simpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes<Type>>;\n\n\t/**\n\t * Metadata for this field schema, see {@link FieldSchemaMetadata}.\n\t * @remarks\n\t * As this is the non-persisted portion of the metadata, it is forced to store only undefined in the `SchemaType.Stored` case.\n\t */\n\treadonly metadata: FieldSchemaMetadata &\n\t\t(Type extends SchemaType.View\n\t\t\t? unknown\n\t\t\t: { readonly custom?: undefined; readonly description?: undefined });\n\n\t/**\n\t * Persisted metadata for this field schema.\n\t * @remarks\n\t * Like {@link SimpleNodeSchemaBaseAlpha.persistedMetadata} but for fields.\n\t * Set via {@link FieldPropsAlpha.persistedMetadata}.\n\t */\n\treadonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;\n}\n\n/**\n * A simplified representation of a schema for a tree.\n *\n * @remarks Contains the complete set of schema {@link SimpleTreeSchema.definitions} required to resolve references,\n * which are represented inline with identifiers.\n *\n * @alpha\n * @sealed\n */\nexport interface SimpleTreeSchema<Type extends SchemaType = SchemaType> {\n\t/**\n\t * The tree field representing the root of the tree.\n\t */\n\treadonly root: SimpleFieldSchema<Type>;\n\t/**\n\t * The complete set of node schema definitions recursively referenced by the tree's {@link SimpleTreeSchema.root}.\n\t *\n\t * @remarks\n\t * The keys are the schemas' {@link TreeNodeSchemaCore.identifier | identifiers}.\n\t *\n\t * Information about if a schema is {@link SchemaStaticsBeta.staged | staged} or not is not available as the \"Simple Schema\" layer of abstraction: they are included unconditionally.\n\t * Options for filtering out staged schemas from view schema are available in {@link extractPersistedSchema}.\n\t */\n\treadonly definitions: ReadonlyMap<string, SimpleNodeSchema<Type>>;\n}\n"]}
@@ -198,7 +198,7 @@ export declare const SimpleSchemaDefinitionsFormat: import("@sinclair/typebox").
198
198
  }>>;
199
199
  export type SimpleSchemaDefinitionsFormat = Static<typeof SimpleSchemaDefinitionsFormat>;
200
200
  /**
201
- * Persisted format for the entire tree schema in the simple schema format.
201
+ * Persisted format for the compatibility impacting subset of simple schema.
202
202
  * @see {@link SimpleTreeSchema}.
203
203
  */
204
204
  export declare const SimpleTreeSchemaFormat: import("@sinclair/typebox").TObject<{