@fluidframework/tree 2.71.0 → 2.73.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 (941) hide show
  1. package/CHANGELOG.md +125 -40
  2. package/api-report/tree.alpha.api.md +44 -48
  3. package/api-report/tree.beta.api.md +42 -0
  4. package/api-report/tree.legacy.beta.api.md +42 -0
  5. package/dist/alpha.d.ts +12 -8
  6. package/dist/api.d.ts +6 -2
  7. package/dist/api.d.ts.map +1 -1
  8. package/dist/api.js +2 -11
  9. package/dist/api.js.map +1 -1
  10. package/dist/beta.d.ts +7 -0
  11. package/dist/codec/codec.d.ts +23 -1
  12. package/dist/codec/codec.d.ts.map +1 -1
  13. package/dist/codec/codec.js +23 -3
  14. package/dist/codec/codec.js.map +1 -1
  15. package/dist/codec/index.d.ts +1 -1
  16. package/dist/codec/index.d.ts.map +1 -1
  17. package/dist/codec/index.js +2 -1
  18. package/dist/codec/index.js.map +1 -1
  19. package/dist/codec/versioned/codec.d.ts +7 -2
  20. package/dist/codec/versioned/codec.d.ts.map +1 -1
  21. package/dist/codec/versioned/codec.js +24 -1
  22. package/dist/codec/versioned/codec.js.map +1 -1
  23. package/dist/codec/versioned/index.d.ts +1 -1
  24. package/dist/codec/versioned/index.d.ts.map +1 -1
  25. package/dist/codec/versioned/index.js +2 -1
  26. package/dist/codec/versioned/index.js.map +1 -1
  27. package/dist/core/index.d.ts +1 -1
  28. package/dist/core/index.d.ts.map +1 -1
  29. package/dist/core/index.js +2 -2
  30. package/dist/core/index.js.map +1 -1
  31. package/dist/core/schema-stored/index.d.ts +1 -1
  32. package/dist/core/schema-stored/index.d.ts.map +1 -1
  33. package/dist/core/schema-stored/index.js +2 -2
  34. package/dist/core/schema-stored/index.js.map +1 -1
  35. package/dist/core/schema-stored/schema.d.ts +18 -7
  36. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  37. package/dist/core/schema-stored/schema.js +6 -7
  38. package/dist/core/schema-stored/schema.js.map +1 -1
  39. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
  40. package/dist/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  41. package/dist/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  42. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
  43. package/dist/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  44. package/dist/core/tree/detachedFieldIndexCodecV1.js +3 -2
  45. package/dist/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  46. package/dist/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  47. package/dist/core/tree/detachedFieldIndexCodecV2.js +3 -1
  48. package/dist/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  49. package/dist/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
  50. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  51. package/dist/core/tree/detachedFieldIndexCodecs.js +31 -8
  52. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  53. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
  54. package/dist/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  55. package/dist/core/tree/detachedFieldIndexFormatCommon.js +8 -1
  56. package/dist/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  57. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
  58. package/dist/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  59. package/dist/core/tree/detachedFieldIndexFormatV1.js +3 -3
  60. package/dist/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  61. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  62. package/dist/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  63. package/dist/core/tree/detachedFieldIndexFormatV2.js +3 -3
  64. package/dist/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  65. package/dist/core/tree/index.d.ts +2 -1
  66. package/dist/core/tree/index.d.ts.map +1 -1
  67. package/dist/core/tree/index.js.map +1 -1
  68. package/dist/external-utilities/typeboxValidator.js +1 -1
  69. package/dist/external-utilities/typeboxValidator.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
  71. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  74. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +1 -0
  75. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
  77. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  79. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
  80. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  81. package/dist/feature-libraries/chunked-forest/codec/codecs.js +39 -21
  82. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  83. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
  84. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  85. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -2
  86. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  87. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +163 -6
  88. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  89. package/dist/feature-libraries/chunked-forest/codec/format.js +13 -4
  90. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  91. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
  92. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  93. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
  94. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  95. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  96. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  97. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -2
  98. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  99. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
  100. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  101. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +23 -6
  102. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  103. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
  104. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  105. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +20 -4
  106. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  107. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  108. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  109. package/dist/feature-libraries/chunked-forest/index.js +2 -2
  110. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  111. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -25
  112. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  113. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +54 -74
  114. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  115. package/dist/feature-libraries/default-schema/index.d.ts +1 -3
  116. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  117. package/dist/feature-libraries/default-schema/index.js +2 -8
  118. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  119. package/dist/feature-libraries/forest-summary/codec.d.ts +4 -5
  120. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  121. package/dist/feature-libraries/forest-summary/codec.js +15 -4
  122. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  123. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  124. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  125. package/dist/feature-libraries/forest-summary/format.d.ts +9 -2
  126. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  127. package/dist/feature-libraries/forest-summary/format.js +11 -4
  128. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  129. package/dist/feature-libraries/forest-summary/index.d.ts +2 -1
  130. package/dist/feature-libraries/forest-summary/index.d.ts.map +1 -1
  131. package/dist/feature-libraries/forest-summary/index.js +3 -1
  132. package/dist/feature-libraries/forest-summary/index.js.map +1 -1
  133. package/dist/feature-libraries/index.d.ts +6 -5
  134. package/dist/feature-libraries/index.d.ts.map +1 -1
  135. package/dist/feature-libraries/index.js +9 -8
  136. package/dist/feature-libraries/index.js.map +1 -1
  137. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  138. package/dist/feature-libraries/modular-schema/comparison.js +1 -2
  139. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  140. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
  141. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  142. package/dist/feature-libraries/modular-schema/fieldKind.js +29 -11
  143. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  144. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
  145. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  146. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  147. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
  148. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  149. package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -2
  150. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  151. package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
  152. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  153. package/dist/feature-libraries/modular-schema/index.js +1 -3
  154. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  155. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
  156. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  157. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  158. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
  159. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  160. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
  161. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  162. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
  163. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  164. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  165. package/dist/feature-libraries/object-forest/objectForest.js +3 -2
  166. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  167. package/dist/feature-libraries/optional-field/index.d.ts +1 -1
  168. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  169. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  170. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  171. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  172. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  173. package/dist/feature-libraries/schema-edits/index.d.ts +1 -1
  174. package/dist/feature-libraries/schema-edits/index.d.ts.map +1 -1
  175. package/dist/feature-libraries/schema-edits/index.js.map +1 -1
  176. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
  177. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  178. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js +5 -4
  179. package/dist/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  180. package/dist/feature-libraries/schema-index/codec.d.ts +10 -10
  181. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  182. package/dist/feature-libraries/schema-index/codec.js +24 -18
  183. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  184. package/dist/feature-libraries/schema-index/formatV1.d.ts +2 -2
  185. package/dist/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  186. package/dist/feature-libraries/schema-index/formatV1.js +1 -1
  187. package/dist/feature-libraries/schema-index/formatV1.js.map +1 -1
  188. package/dist/feature-libraries/schema-index/formatV2.d.ts +1 -2
  189. package/dist/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  190. package/dist/feature-libraries/schema-index/formatV2.js +1 -1
  191. package/dist/feature-libraries/schema-index/formatV2.js.map +1 -1
  192. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  193. package/dist/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  194. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  195. package/dist/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
  196. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -0
  197. package/dist/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
  198. package/dist/feature-libraries/schemaChecker.js.map +1 -0
  199. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  200. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
  201. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  202. package/dist/index.d.ts +2 -2
  203. package/dist/index.d.ts.map +1 -1
  204. package/dist/index.js +7 -3
  205. package/dist/index.js.map +1 -1
  206. package/dist/legacy.d.ts +7 -0
  207. package/dist/packageVersion.d.ts +1 -1
  208. package/dist/packageVersion.js +1 -1
  209. package/dist/packageVersion.js.map +1 -1
  210. package/dist/shared-tree/independentView.d.ts +1 -1
  211. package/dist/shared-tree/independentView.d.ts.map +1 -1
  212. package/dist/shared-tree/independentView.js +22 -15
  213. package/dist/shared-tree/independentView.js.map +1 -1
  214. package/dist/shared-tree/index.d.ts +1 -1
  215. package/dist/shared-tree/index.d.ts.map +1 -1
  216. package/dist/shared-tree/index.js +1 -2
  217. package/dist/shared-tree/index.js.map +1 -1
  218. package/dist/shared-tree/sharedTree.d.ts +12 -60
  219. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  220. package/dist/shared-tree/sharedTree.js +68 -159
  221. package/dist/shared-tree/sharedTree.js.map +1 -1
  222. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +8 -7
  223. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  224. package/dist/shared-tree/sharedTreeChangeCodecs.js +10 -11
  225. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  226. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  227. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  228. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  229. package/dist/shared-tree/treeAlpha.d.ts +1 -1
  230. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  231. package/dist/shared-tree/treeAlpha.js +4 -2
  232. package/dist/shared-tree/treeAlpha.js.map +1 -1
  233. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  234. package/dist/shared-tree/treeCheckout.js +1 -3
  235. package/dist/shared-tree/treeCheckout.js.map +1 -1
  236. package/dist/shared-tree-core/editManagerCodecs.d.ts +19 -6
  237. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  238. package/dist/shared-tree-core/editManagerCodecs.js +42 -18
  239. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  240. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +36 -0
  241. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  242. package/dist/shared-tree-core/editManagerFormatCommons.js +40 -1
  243. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  244. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  245. package/dist/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  246. package/dist/shared-tree-core/editManagerFormatV1toV4.js +4 -4
  247. package/dist/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  248. package/dist/shared-tree-core/editManagerFormatV5.d.ts +2 -2
  249. package/dist/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
  250. package/dist/shared-tree-core/editManagerFormatV5.js +1 -1
  251. package/dist/shared-tree-core/editManagerFormatV5.js.map +1 -1
  252. package/dist/shared-tree-core/index.d.ts +5 -3
  253. package/dist/shared-tree-core/index.d.ts.map +1 -1
  254. package/dist/shared-tree-core/index.js +12 -3
  255. package/dist/shared-tree-core/index.js.map +1 -1
  256. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts +2 -1
  257. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  258. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  259. package/dist/shared-tree-core/messageCodecV5.d.ts +2 -1
  260. package/dist/shared-tree-core/messageCodecV5.d.ts.map +1 -1
  261. package/dist/shared-tree-core/messageCodecV5.js.map +1 -1
  262. package/dist/shared-tree-core/messageCodecs.d.ts +19 -6
  263. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  264. package/dist/shared-tree-core/messageCodecs.js +49 -21
  265. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  266. package/dist/shared-tree-core/messageFormat.d.ts +48 -0
  267. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -0
  268. package/dist/shared-tree-core/messageFormat.js +53 -0
  269. package/dist/shared-tree-core/messageFormat.js.map +1 -0
  270. package/dist/shared-tree-core/sharedTreeCore.d.ts +8 -8
  271. package/dist/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  272. package/dist/shared-tree-core/sharedTreeCore.js +3 -3
  273. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  274. package/dist/simple-tree/api/configuration.d.ts +2 -0
  275. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  276. package/dist/simple-tree/api/configuration.js +10 -0
  277. package/dist/simple-tree/api/configuration.js.map +1 -1
  278. package/dist/simple-tree/api/discrepancies.d.ts +2 -2
  279. package/dist/simple-tree/api/discrepancies.js.map +1 -1
  280. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  281. package/dist/simple-tree/api/incrementalAllowedTypes.js +1 -1
  282. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  283. package/dist/simple-tree/api/index.d.ts +4 -2
  284. package/dist/simple-tree/api/index.d.ts.map +1 -1
  285. package/dist/simple-tree/api/index.js +8 -1
  286. package/dist/simple-tree/api/index.js.map +1 -1
  287. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
  288. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  289. package/dist/simple-tree/api/schemaFactoryAlpha.js +1 -52
  290. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  291. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
  292. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  293. package/dist/simple-tree/api/schemaFactoryBeta.js +61 -7
  294. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  295. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  296. package/dist/simple-tree/api/schemaFromSimple.js +13 -4
  297. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  298. package/dist/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
  299. package/dist/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
  300. package/dist/simple-tree/api/simpleSchemaCodec.js +290 -0
  301. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -0
  302. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
  303. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
  304. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +128 -0
  305. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
  306. package/dist/simple-tree/api/storedSchema.d.ts +2 -2
  307. package/dist/simple-tree/api/storedSchema.d.ts.map +1 -1
  308. package/dist/simple-tree/api/storedSchema.js +8 -6
  309. package/dist/simple-tree/api/storedSchema.js.map +1 -1
  310. package/dist/simple-tree/api/tree.d.ts +3 -3
  311. package/dist/simple-tree/api/tree.js +1 -1
  312. package/dist/simple-tree/api/tree.js.map +1 -1
  313. package/dist/simple-tree/api/typesUnsafe.d.ts +6 -6
  314. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  315. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts +18 -3
  316. package/dist/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  317. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js +78 -35
  318. package/dist/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  319. package/dist/simple-tree/core/allowedTypes.d.ts +3 -3
  320. package/dist/simple-tree/core/allowedTypes.js +2 -2
  321. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  322. package/dist/simple-tree/core/index.d.ts +3 -3
  323. package/dist/simple-tree/core/index.d.ts.map +1 -1
  324. package/dist/simple-tree/core/index.js +3 -1
  325. package/dist/simple-tree/core/index.js.map +1 -1
  326. package/dist/simple-tree/core/toStored.d.ts +12 -5
  327. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  328. package/dist/simple-tree/core/toStored.js +26 -10
  329. package/dist/simple-tree/core/toStored.js.map +1 -1
  330. package/dist/simple-tree/core/treeNode.js +1 -1
  331. package/dist/simple-tree/core/treeNode.js.map +1 -1
  332. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -6
  333. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  334. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  335. package/dist/simple-tree/core/treeNodeValid.d.ts +1 -1
  336. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  337. package/dist/simple-tree/core/treeNodeValid.js +1 -2
  338. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  339. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  340. package/dist/simple-tree/fieldSchema.js +1 -8
  341. package/dist/simple-tree/fieldSchema.js.map +1 -1
  342. package/dist/simple-tree/index.d.ts +3 -2
  343. package/dist/simple-tree/index.d.ts.map +1 -1
  344. package/dist/simple-tree/index.js +12 -2
  345. package/dist/simple-tree/index.js.map +1 -1
  346. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  347. package/dist/simple-tree/leafNodeSchema.js +0 -1
  348. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  349. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  350. package/dist/simple-tree/node-kinds/array/arrayNode.js +14 -50
  351. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  352. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  353. package/dist/simple-tree/node-kinds/map/mapNode.js +2 -6
  354. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  355. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  356. package/dist/simple-tree/node-kinds/object/objectNode.js +4 -12
  357. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  358. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  359. package/dist/simple-tree/node-kinds/record/recordNode.js +3 -7
  360. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  361. package/dist/simple-tree/simpleSchema.d.ts +25 -5
  362. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  363. package/dist/simple-tree/simpleSchema.js.map +1 -1
  364. package/dist/simple-tree/simpleSchemaFormatV1.d.ts +249 -0
  365. package/dist/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
  366. package/dist/simple-tree/simpleSchemaFormatV1.js +115 -0
  367. package/dist/simple-tree/simpleSchemaFormatV1.js.map +1 -0
  368. package/dist/simple-tree/toStoredSchema.d.ts +20 -8
  369. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  370. package/dist/simple-tree/toStoredSchema.js +27 -22
  371. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  372. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  373. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +18 -15
  374. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  375. package/dist/tableSchema.d.ts +22 -52
  376. package/dist/tableSchema.d.ts.map +1 -1
  377. package/dist/tableSchema.js +141 -277
  378. package/dist/tableSchema.js.map +1 -1
  379. package/dist/treeFactory.d.ts +3 -1
  380. package/dist/treeFactory.d.ts.map +1 -1
  381. package/dist/treeFactory.js +26 -2
  382. package/dist/treeFactory.js.map +1 -1
  383. package/dist/util/arrayUtilities.d.ts +45 -0
  384. package/dist/util/arrayUtilities.d.ts.map +1 -0
  385. package/dist/util/arrayUtilities.js +76 -0
  386. package/dist/util/arrayUtilities.js.map +1 -0
  387. package/dist/util/brand.d.ts +31 -2
  388. package/dist/util/brand.d.ts.map +1 -1
  389. package/dist/util/brand.js +28 -2
  390. package/dist/util/brand.js.map +1 -1
  391. package/dist/util/brandedMap.d.ts +3 -1
  392. package/dist/util/brandedMap.d.ts.map +1 -1
  393. package/dist/util/brandedMap.js.map +1 -1
  394. package/dist/util/index.d.ts +2 -1
  395. package/dist/util/index.d.ts.map +1 -1
  396. package/dist/util/index.js +8 -2
  397. package/dist/util/index.js.map +1 -1
  398. package/lib/alpha.d.ts +12 -8
  399. package/lib/api.d.ts +6 -2
  400. package/lib/api.d.ts.map +1 -1
  401. package/lib/api.js +2 -13
  402. package/lib/api.js.map +1 -1
  403. package/lib/beta.d.ts +7 -0
  404. package/lib/codec/codec.d.ts +23 -1
  405. package/lib/codec/codec.d.ts.map +1 -1
  406. package/lib/codec/codec.js +23 -3
  407. package/lib/codec/codec.js.map +1 -1
  408. package/lib/codec/index.d.ts +1 -1
  409. package/lib/codec/index.d.ts.map +1 -1
  410. package/lib/codec/index.js +1 -1
  411. package/lib/codec/index.js.map +1 -1
  412. package/lib/codec/versioned/codec.d.ts +7 -2
  413. package/lib/codec/versioned/codec.d.ts.map +1 -1
  414. package/lib/codec/versioned/codec.js +22 -0
  415. package/lib/codec/versioned/codec.js.map +1 -1
  416. package/lib/codec/versioned/index.d.ts +1 -1
  417. package/lib/codec/versioned/index.d.ts.map +1 -1
  418. package/lib/codec/versioned/index.js +1 -1
  419. package/lib/codec/versioned/index.js.map +1 -1
  420. package/lib/core/index.d.ts +1 -1
  421. package/lib/core/index.d.ts.map +1 -1
  422. package/lib/core/index.js +1 -1
  423. package/lib/core/index.js.map +1 -1
  424. package/lib/core/schema-stored/index.d.ts +1 -1
  425. package/lib/core/schema-stored/index.d.ts.map +1 -1
  426. package/lib/core/schema-stored/index.js +1 -1
  427. package/lib/core/schema-stored/index.js.map +1 -1
  428. package/lib/core/schema-stored/schema.d.ts +18 -7
  429. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  430. package/lib/core/schema-stored/schema.js +6 -7
  431. package/lib/core/schema-stored/schema.js.map +1 -1
  432. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts +2 -1
  433. package/lib/core/tree/detachedFieldIndexCodecCommon.d.ts.map +1 -1
  434. package/lib/core/tree/detachedFieldIndexCodecCommon.js.map +1 -1
  435. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts +1 -1
  436. package/lib/core/tree/detachedFieldIndexCodecV1.d.ts.map +1 -1
  437. package/lib/core/tree/detachedFieldIndexCodecV1.js +3 -2
  438. package/lib/core/tree/detachedFieldIndexCodecV1.js.map +1 -1
  439. package/lib/core/tree/detachedFieldIndexCodecV2.d.ts.map +1 -1
  440. package/lib/core/tree/detachedFieldIndexCodecV2.js +4 -2
  441. package/lib/core/tree/detachedFieldIndexCodecV2.js.map +1 -1
  442. package/lib/core/tree/detachedFieldIndexCodecs.d.ts +2 -3
  443. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  444. package/lib/core/tree/detachedFieldIndexCodecs.js +31 -8
  445. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  446. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts +10 -1
  447. package/lib/core/tree/detachedFieldIndexFormatCommon.d.ts.map +1 -1
  448. package/lib/core/tree/detachedFieldIndexFormatCommon.js +7 -0
  449. package/lib/core/tree/detachedFieldIndexFormatCommon.js.map +1 -1
  450. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts +2 -2
  451. package/lib/core/tree/detachedFieldIndexFormatV1.d.ts.map +1 -1
  452. package/lib/core/tree/detachedFieldIndexFormatV1.js +3 -3
  453. package/lib/core/tree/detachedFieldIndexFormatV1.js.map +1 -1
  454. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts +2 -2
  455. package/lib/core/tree/detachedFieldIndexFormatV2.d.ts.map +1 -1
  456. package/lib/core/tree/detachedFieldIndexFormatV2.js +3 -3
  457. package/lib/core/tree/detachedFieldIndexFormatV2.js.map +1 -1
  458. package/lib/core/tree/index.d.ts +2 -1
  459. package/lib/core/tree/index.d.ts.map +1 -1
  460. package/lib/core/tree/index.js +1 -1
  461. package/lib/core/tree/index.js.map +1 -1
  462. package/lib/external-utilities/typeboxValidator.js +1 -1
  463. package/lib/external-utilities/typeboxValidator.js.map +1 -1
  464. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
  465. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  466. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  467. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  468. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +2 -1
  469. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  470. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
  471. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  472. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  473. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +4 -10
  474. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  475. package/lib/feature-libraries/chunked-forest/codec/codecs.js +42 -23
  476. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  477. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
  478. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  479. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +5 -3
  480. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  481. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +163 -6
  482. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  483. package/lib/feature-libraries/chunked-forest/codec/format.js +12 -3
  484. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  485. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
  486. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  487. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
  488. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  489. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +2 -2
  490. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  491. package/lib/feature-libraries/chunked-forest/codec/index.js +2 -2
  492. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  493. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
  494. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  495. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +22 -6
  496. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  497. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
  498. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  499. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +17 -2
  500. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  501. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  502. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  503. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  504. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  505. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -25
  506. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  507. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +56 -76
  508. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  509. package/lib/feature-libraries/default-schema/index.d.ts +1 -3
  510. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  511. package/lib/feature-libraries/default-schema/index.js +1 -3
  512. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  513. package/lib/feature-libraries/forest-summary/codec.d.ts +4 -5
  514. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  515. package/lib/feature-libraries/forest-summary/codec.js +16 -5
  516. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  517. package/lib/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  518. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  519. package/lib/feature-libraries/forest-summary/format.d.ts +9 -2
  520. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  521. package/lib/feature-libraries/forest-summary/format.js +9 -2
  522. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  523. package/lib/feature-libraries/forest-summary/index.d.ts +2 -1
  524. package/lib/feature-libraries/forest-summary/index.d.ts.map +1 -1
  525. package/lib/feature-libraries/forest-summary/index.js +1 -0
  526. package/lib/feature-libraries/forest-summary/index.js.map +1 -1
  527. package/lib/feature-libraries/index.d.ts +6 -5
  528. package/lib/feature-libraries/index.d.ts.map +1 -1
  529. package/lib/feature-libraries/index.js +5 -4
  530. package/lib/feature-libraries/index.js.map +1 -1
  531. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  532. package/lib/feature-libraries/modular-schema/comparison.js +1 -2
  533. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  534. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
  535. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  536. package/lib/feature-libraries/modular-schema/fieldKind.js +29 -11
  537. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  538. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
  539. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  540. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  541. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
  542. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  543. package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -2
  544. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  545. package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
  546. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  547. package/lib/feature-libraries/modular-schema/index.js +0 -1
  548. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  549. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
  550. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  551. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  552. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
  553. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  554. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
  555. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  556. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
  557. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  558. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  559. package/lib/feature-libraries/object-forest/objectForest.js +2 -1
  560. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  561. package/lib/feature-libraries/optional-field/index.d.ts +1 -1
  562. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  563. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  564. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  565. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  566. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  567. package/lib/feature-libraries/schema-edits/index.d.ts +1 -1
  568. package/lib/feature-libraries/schema-edits/index.d.ts.map +1 -1
  569. package/lib/feature-libraries/schema-edits/index.js.map +1 -1
  570. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts +6 -7
  571. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.d.ts.map +1 -1
  572. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js +6 -5
  573. package/lib/feature-libraries/schema-edits/schemaChangeCodecs.js.map +1 -1
  574. package/lib/feature-libraries/schema-index/codec.d.ts +10 -10
  575. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  576. package/lib/feature-libraries/schema-index/codec.js +26 -20
  577. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  578. package/lib/feature-libraries/schema-index/formatV1.d.ts +2 -2
  579. package/lib/feature-libraries/schema-index/formatV1.d.ts.map +1 -1
  580. package/lib/feature-libraries/schema-index/formatV1.js +2 -2
  581. package/lib/feature-libraries/schema-index/formatV1.js.map +1 -1
  582. package/lib/feature-libraries/schema-index/formatV2.d.ts +1 -2
  583. package/lib/feature-libraries/schema-index/formatV2.d.ts.map +1 -1
  584. package/lib/feature-libraries/schema-index/formatV2.js +2 -2
  585. package/lib/feature-libraries/schema-index/formatV2.js.map +1 -1
  586. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts +2 -2
  587. package/lib/feature-libraries/schema-index/schemaSummarizer.d.ts.map +1 -1
  588. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  589. package/lib/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
  590. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -0
  591. package/lib/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
  592. package/lib/feature-libraries/schemaChecker.js.map +1 -0
  593. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  594. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
  595. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  596. package/lib/index.d.ts +2 -2
  597. package/lib/index.d.ts.map +1 -1
  598. package/lib/index.js +2 -2
  599. package/lib/index.js.map +1 -1
  600. package/lib/legacy.d.ts +7 -0
  601. package/lib/packageVersion.d.ts +1 -1
  602. package/lib/packageVersion.js +1 -1
  603. package/lib/packageVersion.js.map +1 -1
  604. package/lib/shared-tree/independentView.d.ts +1 -1
  605. package/lib/shared-tree/independentView.d.ts.map +1 -1
  606. package/lib/shared-tree/independentView.js +11 -4
  607. package/lib/shared-tree/independentView.js.map +1 -1
  608. package/lib/shared-tree/index.d.ts +1 -1
  609. package/lib/shared-tree/index.d.ts.map +1 -1
  610. package/lib/shared-tree/index.js +1 -1
  611. package/lib/shared-tree/index.js.map +1 -1
  612. package/lib/shared-tree/sharedTree.d.ts +12 -60
  613. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  614. package/lib/shared-tree/sharedTree.js +70 -161
  615. package/lib/shared-tree/sharedTree.js.map +1 -1
  616. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +8 -7
  617. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  618. package/lib/shared-tree/sharedTreeChangeCodecs.js +5 -6
  619. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  620. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  621. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  622. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  623. package/lib/shared-tree/treeAlpha.d.ts +1 -1
  624. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  625. package/lib/shared-tree/treeAlpha.js +5 -3
  626. package/lib/shared-tree/treeAlpha.js.map +1 -1
  627. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  628. package/lib/shared-tree/treeCheckout.js +1 -3
  629. package/lib/shared-tree/treeCheckout.js.map +1 -1
  630. package/lib/shared-tree-core/editManagerCodecs.d.ts +19 -6
  631. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  632. package/lib/shared-tree-core/editManagerCodecs.js +39 -17
  633. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  634. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +36 -0
  635. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  636. package/lib/shared-tree-core/editManagerFormatCommons.js +39 -0
  637. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  638. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts +2 -2
  639. package/lib/shared-tree-core/editManagerFormatV1toV4.d.ts.map +1 -1
  640. package/lib/shared-tree-core/editManagerFormatV1toV4.js +5 -5
  641. package/lib/shared-tree-core/editManagerFormatV1toV4.js.map +1 -1
  642. package/lib/shared-tree-core/editManagerFormatV5.d.ts +2 -2
  643. package/lib/shared-tree-core/editManagerFormatV5.d.ts.map +1 -1
  644. package/lib/shared-tree-core/editManagerFormatV5.js +2 -2
  645. package/lib/shared-tree-core/editManagerFormatV5.js.map +1 -1
  646. package/lib/shared-tree-core/index.d.ts +5 -3
  647. package/lib/shared-tree-core/index.d.ts.map +1 -1
  648. package/lib/shared-tree-core/index.js +4 -2
  649. package/lib/shared-tree-core/index.js.map +1 -1
  650. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts +2 -1
  651. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  652. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  653. package/lib/shared-tree-core/messageCodecV5.d.ts +2 -1
  654. package/lib/shared-tree-core/messageCodecV5.d.ts.map +1 -1
  655. package/lib/shared-tree-core/messageCodecV5.js.map +1 -1
  656. package/lib/shared-tree-core/messageCodecs.d.ts +19 -6
  657. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  658. package/lib/shared-tree-core/messageCodecs.js +46 -20
  659. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  660. package/lib/shared-tree-core/messageFormat.d.ts +48 -0
  661. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -0
  662. package/lib/shared-tree-core/messageFormat.js +50 -0
  663. package/lib/shared-tree-core/messageFormat.js.map +1 -0
  664. package/lib/shared-tree-core/sharedTreeCore.d.ts +8 -8
  665. package/lib/shared-tree-core/sharedTreeCore.d.ts.map +1 -1
  666. package/lib/shared-tree-core/sharedTreeCore.js +3 -3
  667. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  668. package/lib/simple-tree/api/configuration.d.ts +2 -0
  669. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  670. package/lib/simple-tree/api/configuration.js +10 -0
  671. package/lib/simple-tree/api/configuration.js.map +1 -1
  672. package/lib/simple-tree/api/discrepancies.d.ts +2 -2
  673. package/lib/simple-tree/api/discrepancies.js.map +1 -1
  674. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +1 -1
  675. package/lib/simple-tree/api/incrementalAllowedTypes.js +1 -1
  676. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  677. package/lib/simple-tree/api/index.d.ts +4 -2
  678. package/lib/simple-tree/api/index.d.ts.map +1 -1
  679. package/lib/simple-tree/api/index.js +2 -0
  680. package/lib/simple-tree/api/index.js.map +1 -1
  681. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +2 -98
  682. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  683. package/lib/simple-tree/api/schemaFactoryAlpha.js +1 -52
  684. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  685. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +98 -2
  686. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  687. package/lib/simple-tree/api/schemaFactoryBeta.js +58 -4
  688. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  689. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  690. package/lib/simple-tree/api/schemaFromSimple.js +14 -5
  691. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  692. package/lib/simple-tree/api/simpleSchemaCodec.d.ts +28 -0
  693. package/lib/simple-tree/api/simpleSchemaCodec.d.ts.map +1 -0
  694. package/lib/simple-tree/api/simpleSchemaCodec.js +262 -0
  695. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -0
  696. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
  697. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
  698. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +122 -0
  699. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
  700. package/lib/simple-tree/api/storedSchema.d.ts +2 -2
  701. package/lib/simple-tree/api/storedSchema.d.ts.map +1 -1
  702. package/lib/simple-tree/api/storedSchema.js +5 -3
  703. package/lib/simple-tree/api/storedSchema.js.map +1 -1
  704. package/lib/simple-tree/api/tree.d.ts +3 -3
  705. package/lib/simple-tree/api/tree.js +1 -1
  706. package/lib/simple-tree/api/tree.js.map +1 -1
  707. package/lib/simple-tree/api/typesUnsafe.d.ts +6 -6
  708. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  709. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts +18 -3
  710. package/lib/simple-tree/api/viewSchemaToSimpleSchema.d.ts.map +1 -1
  711. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js +75 -34
  712. package/lib/simple-tree/api/viewSchemaToSimpleSchema.js.map +1 -1
  713. package/lib/simple-tree/core/allowedTypes.d.ts +3 -3
  714. package/lib/simple-tree/core/allowedTypes.js +2 -2
  715. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  716. package/lib/simple-tree/core/index.d.ts +3 -3
  717. package/lib/simple-tree/core/index.d.ts.map +1 -1
  718. package/lib/simple-tree/core/index.js +2 -2
  719. package/lib/simple-tree/core/index.js.map +1 -1
  720. package/lib/simple-tree/core/toStored.d.ts +12 -5
  721. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  722. package/lib/simple-tree/core/toStored.js +25 -9
  723. package/lib/simple-tree/core/toStored.js.map +1 -1
  724. package/lib/simple-tree/core/treeNode.js +1 -1
  725. package/lib/simple-tree/core/treeNode.js.map +1 -1
  726. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -6
  727. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  728. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  729. package/lib/simple-tree/core/treeNodeValid.d.ts +1 -1
  730. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  731. package/lib/simple-tree/core/treeNodeValid.js +1 -2
  732. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  733. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  734. package/lib/simple-tree/fieldSchema.js +2 -9
  735. package/lib/simple-tree/fieldSchema.js.map +1 -1
  736. package/lib/simple-tree/index.d.ts +3 -2
  737. package/lib/simple-tree/index.d.ts.map +1 -1
  738. package/lib/simple-tree/index.js +2 -1
  739. package/lib/simple-tree/index.js.map +1 -1
  740. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  741. package/lib/simple-tree/leafNodeSchema.js +1 -2
  742. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  743. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  744. package/lib/simple-tree/node-kinds/array/arrayNode.js +17 -53
  745. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  746. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  747. package/lib/simple-tree/node-kinds/map/mapNode.js +5 -9
  748. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  749. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  750. package/lib/simple-tree/node-kinds/object/objectNode.js +6 -14
  751. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  752. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  753. package/lib/simple-tree/node-kinds/record/recordNode.js +6 -10
  754. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  755. package/lib/simple-tree/simpleSchema.d.ts +25 -5
  756. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  757. package/lib/simple-tree/simpleSchema.js.map +1 -1
  758. package/lib/simple-tree/simpleSchemaFormatV1.d.ts +249 -0
  759. package/lib/simple-tree/simpleSchemaFormatV1.d.ts.map +1 -0
  760. package/lib/simple-tree/simpleSchemaFormatV1.js +112 -0
  761. package/lib/simple-tree/simpleSchemaFormatV1.js.map +1 -0
  762. package/lib/simple-tree/toStoredSchema.d.ts +20 -8
  763. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  764. package/lib/simple-tree/toStoredSchema.js +28 -24
  765. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  766. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  767. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +20 -17
  768. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  769. package/lib/tableSchema.d.ts +22 -52
  770. package/lib/tableSchema.d.ts.map +1 -1
  771. package/lib/tableSchema.js +143 -279
  772. package/lib/tableSchema.js.map +1 -1
  773. package/lib/treeFactory.d.ts +3 -1
  774. package/lib/treeFactory.d.ts.map +1 -1
  775. package/lib/treeFactory.js +23 -1
  776. package/lib/treeFactory.js.map +1 -1
  777. package/lib/util/arrayUtilities.d.ts +45 -0
  778. package/lib/util/arrayUtilities.d.ts.map +1 -0
  779. package/lib/util/arrayUtilities.js +69 -0
  780. package/lib/util/arrayUtilities.js.map +1 -0
  781. package/lib/util/brand.d.ts +31 -2
  782. package/lib/util/brand.d.ts.map +1 -1
  783. package/lib/util/brand.js +26 -1
  784. package/lib/util/brand.js.map +1 -1
  785. package/lib/util/brandedMap.d.ts +3 -1
  786. package/lib/util/brandedMap.d.ts.map +1 -1
  787. package/lib/util/brandedMap.js.map +1 -1
  788. package/lib/util/index.d.ts +2 -1
  789. package/lib/util/index.d.ts.map +1 -1
  790. package/lib/util/index.js +2 -1
  791. package/lib/util/index.js.map +1 -1
  792. package/package.json +24 -24
  793. package/src/api.ts +22 -11
  794. package/src/codec/codec.ts +25 -3
  795. package/src/codec/index.ts +1 -0
  796. package/src/codec/versioned/codec.ts +40 -2
  797. package/src/codec/versioned/index.ts +1 -0
  798. package/src/core/index.ts +1 -2
  799. package/src/core/schema-stored/index.ts +1 -2
  800. package/src/core/schema-stored/schema.ts +22 -8
  801. package/src/core/tree/detachedFieldIndexCodecCommon.ts +2 -1
  802. package/src/core/tree/detachedFieldIndexCodecV1.ts +4 -2
  803. package/src/core/tree/detachedFieldIndexCodecV2.ts +4 -6
  804. package/src/core/tree/detachedFieldIndexCodecs.ts +40 -11
  805. package/src/core/tree/detachedFieldIndexFormatCommon.ts +17 -2
  806. package/src/core/tree/detachedFieldIndexFormatV1.ts +6 -4
  807. package/src/core/tree/detachedFieldIndexFormatV2.ts +6 -4
  808. package/src/core/tree/index.ts +2 -4
  809. package/src/external-utilities/typeboxValidator.ts +1 -1
  810. package/src/feature-libraries/README.md +1 -1
  811. package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -3
  812. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +5 -0
  813. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -1
  814. package/src/feature-libraries/chunked-forest/codec/codecs.ts +65 -27
  815. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +9 -4
  816. package/src/feature-libraries/chunked-forest/codec/format.ts +26 -5
  817. package/src/feature-libraries/chunked-forest/codec/formatGeneric.ts +7 -2
  818. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -2
  819. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +62 -9
  820. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +24 -2
  821. package/src/feature-libraries/chunked-forest/index.ts +1 -2
  822. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +88 -103
  823. package/src/feature-libraries/default-schema/index.ts +1 -9
  824. package/src/feature-libraries/forest-summary/codec.ts +24 -9
  825. package/src/feature-libraries/forest-summary/forestSummarizer.ts +1 -1
  826. package/src/feature-libraries/forest-summary/format.ts +25 -9
  827. package/src/feature-libraries/forest-summary/index.ts +2 -1
  828. package/src/feature-libraries/index.ts +8 -7
  829. package/src/feature-libraries/modular-schema/comparison.ts +2 -3
  830. package/src/feature-libraries/modular-schema/fieldKind.ts +90 -13
  831. package/src/feature-libraries/modular-schema/fieldKindConfiguration.ts +2 -3
  832. package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -6
  833. package/src/feature-libraries/modular-schema/index.ts +0 -1
  834. package/src/feature-libraries/modular-schema/isNeverTree.ts +7 -8
  835. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +13 -13
  836. package/src/feature-libraries/object-forest/objectForest.ts +2 -6
  837. package/src/feature-libraries/optional-field/index.ts +1 -0
  838. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +1 -5
  839. package/src/feature-libraries/schema-edits/index.ts +0 -1
  840. package/src/feature-libraries/schema-edits/schemaChangeCodecs.ts +16 -16
  841. package/src/feature-libraries/schema-index/codec.ts +41 -22
  842. package/src/feature-libraries/schema-index/formatV1.ts +2 -2
  843. package/src/feature-libraries/schema-index/formatV2.ts +2 -2
  844. package/src/feature-libraries/schema-index/schemaSummarizer.ts +2 -1
  845. package/src/feature-libraries/{default-schema/schemaChecker.ts → schemaChecker.ts} +4 -4
  846. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +0 -2
  847. package/src/index.ts +6 -2
  848. package/src/packageVersion.ts +1 -1
  849. package/src/shared-tree/independentView.ts +16 -5
  850. package/src/shared-tree/index.ts +0 -1
  851. package/src/shared-tree/sharedTree.ts +92 -222
  852. package/src/shared-tree/sharedTreeChangeCodecs.ts +14 -13
  853. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
  854. package/src/shared-tree/treeAlpha.ts +6 -5
  855. package/src/shared-tree/treeCheckout.ts +1 -3
  856. package/src/shared-tree-core/editManagerCodecs.ts +69 -20
  857. package/src/shared-tree-core/editManagerFormatCommons.ts +46 -0
  858. package/src/shared-tree-core/editManagerFormatV1toV4.ts +10 -5
  859. package/src/shared-tree-core/editManagerFormatV5.ts +3 -3
  860. package/src/shared-tree-core/index.ts +15 -5
  861. package/src/shared-tree-core/messageCodecV1ToV4.ts +6 -1
  862. package/src/shared-tree-core/messageCodecV5.ts +2 -1
  863. package/src/shared-tree-core/messageCodecs.ts +77 -28
  864. package/src/shared-tree-core/messageFormat.ts +58 -0
  865. package/src/shared-tree-core/sharedTreeCore.ts +11 -13
  866. package/src/simple-tree/api/configuration.ts +17 -4
  867. package/src/simple-tree/api/discrepancies.ts +2 -2
  868. package/src/simple-tree/api/incrementalAllowedTypes.ts +1 -1
  869. package/src/simple-tree/api/index.ts +11 -2
  870. package/src/simple-tree/api/schemaFactoryAlpha.ts +2 -168
  871. package/src/simple-tree/api/schemaFactoryBeta.ts +180 -14
  872. package/src/simple-tree/api/schemaFromSimple.ts +20 -9
  873. package/src/simple-tree/api/simpleSchemaCodec.ts +361 -0
  874. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +135 -0
  875. package/src/simple-tree/api/storedSchema.ts +8 -5
  876. package/src/simple-tree/api/tree.ts +3 -3
  877. package/src/simple-tree/api/typesUnsafe.ts +6 -6
  878. package/src/simple-tree/api/viewSchemaToSimpleSchema.ts +80 -47
  879. package/src/simple-tree/core/allowedTypes.ts +4 -4
  880. package/src/simple-tree/core/index.ts +3 -1
  881. package/src/simple-tree/core/toStored.ts +42 -18
  882. package/src/simple-tree/core/treeNode.ts +2 -2
  883. package/src/simple-tree/core/treeNodeSchema.ts +1 -7
  884. package/src/simple-tree/core/treeNodeValid.ts +0 -2
  885. package/src/simple-tree/fieldSchema.ts +2 -11
  886. package/src/simple-tree/index.ts +11 -2
  887. package/src/simple-tree/leafNodeSchema.ts +1 -2
  888. package/src/simple-tree/node-kinds/array/arrayNode.ts +28 -77
  889. package/src/simple-tree/node-kinds/map/mapNode.ts +3 -17
  890. package/src/simple-tree/node-kinds/object/objectNode.ts +5 -20
  891. package/src/simple-tree/node-kinds/record/recordNode.ts +4 -18
  892. package/src/simple-tree/simpleSchema.ts +27 -5
  893. package/src/simple-tree/simpleSchemaFormatV1.ts +179 -0
  894. package/src/simple-tree/toStoredSchema.ts +54 -38
  895. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +22 -17
  896. package/src/tableSchema.ts +110 -331
  897. package/src/treeFactory.ts +33 -1
  898. package/src/util/arrayUtilities.ts +88 -0
  899. package/src/util/brand.ts +40 -2
  900. package/src/util/brandedMap.ts +3 -1
  901. package/src/util/index.ts +7 -0
  902. package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
  903. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
  904. package/dist/feature-libraries/default-schema/defaultSchema.js +0 -15
  905. package/dist/feature-libraries/default-schema/defaultSchema.js.map +0 -1
  906. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
  907. package/dist/feature-libraries/default-schema/schemaChecker.js.map +0 -1
  908. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
  909. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
  910. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -76
  911. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
  912. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
  913. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
  914. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -158
  915. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
  916. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
  917. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
  918. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -245
  919. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
  920. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
  921. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
  922. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -12
  923. package/lib/feature-libraries/default-schema/defaultSchema.js.map +0 -1
  924. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
  925. package/lib/feature-libraries/default-schema/schemaChecker.js.map +0 -1
  926. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
  927. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
  928. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -71
  929. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
  930. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
  931. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
  932. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -154
  933. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
  934. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
  935. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
  936. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -241
  937. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
  938. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -15
  939. package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +0 -108
  940. package/src/feature-libraries/optional-field/optionalFieldCodecV1.ts +0 -208
  941. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +0 -344
@@ -0,0 +1,290 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || function (mod) {
23
+ if (mod && mod.__esModule) return mod;
24
+ var result = {};
25
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
+ __setModuleDefault(result, mod);
27
+ return result;
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.decodeSimpleSchema = exports.encodeSimpleSchema = void 0;
31
+ const index_js_1 = require("../../util/index.js");
32
+ const internal_1 = require("@fluidframework/core-utils/internal");
33
+ const index_js_2 = require("../core/index.js");
34
+ const internal_2 = require("@fluidframework/telemetry-utils/internal");
35
+ const Format = __importStar(require("../simpleSchemaFormatV1.js"));
36
+ const index_js_3 = require("../../codec/index.js");
37
+ /**
38
+ * Encodes a simple schema (view or stored) into a serializable format.
39
+ * @remarks The JSON-compatible schema returned from this method is only intended for use in snapshots/comparisons of schemas.
40
+ * It is not possible to reconstruct a full schema (including metadata and persistedMetadata) from the encoded format.
41
+ * @param treeSchema - The tree schema to convert.
42
+ * @returns A serializable representation of the schema.
43
+ *
44
+ * @alpha
45
+ */
46
+ function encodeSimpleSchema(simpleSchema) {
47
+ // Convert types to serializable forms
48
+ const encodedDefinitions = {};
49
+ for (const [identifier, schema] of simpleSchema.definitions) {
50
+ const encodedDefinition = encodeNodeSchema(schema);
51
+ encodedDefinitions[identifier] = encodedDefinition;
52
+ }
53
+ const encodedSchema = {
54
+ version: Format.SimpleSchemaFormatVersion.v1,
55
+ root: encodeField(simpleSchema.root),
56
+ definitions: encodedDefinitions,
57
+ };
58
+ return encodedSchema;
59
+ }
60
+ exports.encodeSimpleSchema = encodeSimpleSchema;
61
+ /**
62
+ * Decodes a JSON-compatible schema into a simple schema.
63
+ * @param encodedSchema - The encoded schema to decode.
64
+ * @param validator - The format validator to use to validate the encoded schema.
65
+ * @returns A decoded simple schema.
66
+ * @throws Will throw a usage error if the encoded schema is not in the expected format.
67
+ *
68
+ * @alpha
69
+ */
70
+ function decodeSimpleSchema(encodedSchema, validator) {
71
+ const effectiveValidator = validator ?? index_js_3.FormatValidatorNoOp;
72
+ const compiledValidator = (0, index_js_3.extractJsonValidator)(effectiveValidator).compile(Format.SimpleTreeSchemaFormat);
73
+ if (!compiledValidator.check(encodedSchema)) {
74
+ throw new internal_2.UsageError("The provided simple schema is not valid according to the schema format.");
75
+ }
76
+ return {
77
+ root: decodeSimpleFieldSchema(encodedSchema.root),
78
+ definitions: new Map((0, internal_1.transformMapValues)((0, index_js_1.objectToMap)(encodedSchema.definitions), (value, key) => {
79
+ return decodeNodeSchema(value);
80
+ })),
81
+ };
82
+ }
83
+ exports.decodeSimpleSchema = decodeSimpleSchema;
84
+ /**
85
+ * Encodes a node schema to a serializable object.
86
+ * @param schema - The node schema to convert.
87
+ * @returns A serializable representation of the node schema.
88
+ */
89
+ function encodeNodeSchema(schema) {
90
+ const kind = schema.kind;
91
+ switch (kind) {
92
+ case index_js_2.NodeKind.Leaf:
93
+ return { leaf: encodeLeafNode(schema) };
94
+ case index_js_2.NodeKind.Array:
95
+ return { array: encodeContainerNode(schema) };
96
+ case index_js_2.NodeKind.Map:
97
+ return { map: encodeContainerNode(schema) };
98
+ case index_js_2.NodeKind.Record:
99
+ return { record: encodeContainerNode(schema) };
100
+ case index_js_2.NodeKind.Object:
101
+ return { object: encodeObjectNode(schema) };
102
+ default: {
103
+ (0, internal_1.unreachableCase)(kind);
104
+ }
105
+ }
106
+ }
107
+ /**
108
+ * Encodes a leaf node schema to a serializable object.
109
+ * @param schema - The leaf node schema to convert.
110
+ * @returns A serializable representation of the leaf node schema.
111
+ */
112
+ function encodeLeafNode(schema) {
113
+ return {
114
+ kind: schema.kind,
115
+ leafKind: schema.leafKind,
116
+ };
117
+ }
118
+ /**
119
+ * Encodes a container node schema (a simple schema that is a Map, Array, or Record) to a serializable object.
120
+ * @param schema - The container node schema to convert.
121
+ * @returns A serializable representation of the container node schema. Includes the `kind` for disambiguation between different
122
+ * container kinds.
123
+ */
124
+ function encodeContainerNode(schema) {
125
+ return {
126
+ kind: schema.kind,
127
+ simpleAllowedTypes: encodeSimpleAllowedTypes(schema.simpleAllowedTypes),
128
+ };
129
+ }
130
+ /**
131
+ * Encodes a simple allowed types map to a serializable object. Needed because JSON serialization does not support Maps.
132
+ * @param simpleAllowedTypes - The simple allowed types map to convert.
133
+ * @returns A serializable representation of the simple allowed types.
134
+ */
135
+ function encodeSimpleAllowedTypes(simpleAllowedTypes) {
136
+ const encodedAllowedTypes = {};
137
+ for (const [identifier, attributes] of simpleAllowedTypes) {
138
+ const isStaged = attributes.isStaged instanceof index_js_2.SchemaUpgrade ? true : attributes.isStaged;
139
+ encodedAllowedTypes[identifier] = { isStaged };
140
+ }
141
+ return encodedAllowedTypes;
142
+ }
143
+ /**
144
+ * Encodes an object node schema to a serializable object.
145
+ * @param schema - The object node schema to convert.
146
+ * @returns A serializable representation of the object node schema.
147
+ */
148
+ function encodeObjectNode(schema) {
149
+ const encodedFields = {};
150
+ for (const [fieldKey, fieldSchema] of schema.fields) {
151
+ encodedFields[fieldKey] = encodeObjectField(fieldSchema);
152
+ }
153
+ return {
154
+ kind: schema.kind,
155
+ fields: encodedFields,
156
+ allowUnknownOptionalFields: schema.allowUnknownOptionalFields,
157
+ };
158
+ }
159
+ /**
160
+ * Encodes an object field schema to a serializable object.
161
+ * @param fieldSchema - The object field schema to convert.
162
+ * @returns A serializable representation of the object field schema.
163
+ */
164
+ function encodeObjectField(fieldSchema) {
165
+ const encodedField = encodeField(fieldSchema);
166
+ return { ...encodedField, storedKey: fieldSchema.storedKey };
167
+ }
168
+ /**
169
+ * Encodes a field schema to a serializable object.
170
+ * @param fieldSchema - The field schema to convert.
171
+ * @returns A serializable representation of the field schema.
172
+ */
173
+ function encodeField(fieldSchema) {
174
+ return {
175
+ kind: fieldSchema.kind,
176
+ simpleAllowedTypes: encodeSimpleAllowedTypes(fieldSchema.simpleAllowedTypes),
177
+ };
178
+ }
179
+ const decodeNodeSchemaDispatcher = new index_js_3.DiscriminatedUnionDispatcher({
180
+ leaf: decodeLeafNode,
181
+ array: decodeContainerNode,
182
+ map: decodeContainerNode,
183
+ record: decodeContainerNode,
184
+ object: decodeObjectNode,
185
+ });
186
+ /**
187
+ * Decodes a node schema from a JSON-compatible object.
188
+ * @param encodedNodeSchema - The encoded node schema to decode.
189
+ * @returns The decoded node schema.
190
+ */
191
+ function decodeNodeSchema(encodedNodeSchema) {
192
+ return decodeNodeSchemaDispatcher.dispatch(encodedNodeSchema);
193
+ }
194
+ /**
195
+ * Decodes a container node schema (array, map, record) from a JSON-compatible object.
196
+ * @param encodedContainerSchema - The encoded schema to decode.
197
+ * @returns The decoded container node schema.
198
+ */
199
+ function decodeContainerNode(encodedContainerSchema) {
200
+ return {
201
+ kind: encodedContainerSchema.kind,
202
+ simpleAllowedTypes: decodeSimpleAllowedTypes(encodedContainerSchema.simpleAllowedTypes),
203
+ // We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values.
204
+ persistedMetadata: undefined,
205
+ metadata: {},
206
+ };
207
+ }
208
+ /**
209
+ * Decodes a leaf node schema from a JSON-compatible object.
210
+ * @param encodedLeafSchema - The encoded leaf node schema.
211
+ * @returns The decoded leaf node schema.
212
+ */
213
+ function decodeLeafNode(encodedLeafSchema) {
214
+ return {
215
+ kind: index_js_2.NodeKind.Leaf,
216
+ leafKind: encodedLeafSchema.leafKind,
217
+ // We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values.
218
+ persistedMetadata: undefined,
219
+ metadata: {},
220
+ };
221
+ }
222
+ /**
223
+ * Decodes a object node schema from a JSON-compatible object.
224
+ * @param encodedObjectSchema - The encoded object node schema.
225
+ * @returns The decoded object node schema.
226
+ */
227
+ function decodeObjectNode(encodedObjectSchema) {
228
+ return {
229
+ kind: index_js_2.NodeKind.Object,
230
+ fields: decodeObjectFields(encodedObjectSchema.fields),
231
+ // It is possible for allowUnknownOptionalFields to be undefined. This happens when serializing a Simple Schema derived
232
+ // from a stored schema.
233
+ allowUnknownOptionalFields: encodedObjectSchema.allowUnknownOptionalFields,
234
+ // We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values when decoding.
235
+ persistedMetadata: undefined,
236
+ metadata: {},
237
+ };
238
+ }
239
+ /**
240
+ * Decodes a map of object fields from a JSON-compatible object.
241
+ * @param encodedFields - The encoded fields.
242
+ * @returns A map of the decoded object fields.
243
+ */
244
+ function decodeObjectFields(encodedFields) {
245
+ const fields = new Map();
246
+ for (const [fieldKey, fieldSchema] of Object.entries(encodedFields)) {
247
+ fields.set(fieldKey, decodeObjectField(fieldSchema));
248
+ }
249
+ return fields;
250
+ }
251
+ /**
252
+ * Decodes a {@link SimpleObjectFieldSchema} from a JSON-compatible object.
253
+ * @param encodedField - The encoded field schema.
254
+ * @returns The decoded simple object field schema.
255
+ */
256
+ function decodeObjectField(encodedField) {
257
+ const baseField = decodeSimpleFieldSchema(encodedField);
258
+ return {
259
+ ...baseField,
260
+ storedKey: encodedField.storedKey,
261
+ };
262
+ }
263
+ /**
264
+ * Decodes a {@link SimpleFieldSchema} from a JSON-compatible object.
265
+ * @param encodedField - The encoded field schema.
266
+ * @returns The decoded simple field schema.
267
+ */
268
+ function decodeSimpleFieldSchema(encodedField) {
269
+ return {
270
+ kind: encodedField.kind,
271
+ simpleAllowedTypes: decodeSimpleAllowedTypes(encodedField.simpleAllowedTypes),
272
+ // We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values when decoding.
273
+ persistedMetadata: undefined,
274
+ metadata: {},
275
+ };
276
+ }
277
+ /**
278
+ * Decodes a simple allowed types map from a JSON-compatible object.
279
+ * @param encodedAllowedTypes - The encoded simple allowed types.
280
+ * @returns A map of the decoded simple allowed types.
281
+ */
282
+ function decodeSimpleAllowedTypes(encodedAllowedTypes) {
283
+ const untypedMap = (0, index_js_1.objectToMap)(encodedAllowedTypes);
284
+ const simpleAllowedTypes = (0, internal_1.transformMapValues)(untypedMap, (value) => {
285
+ const isStaged = value.isStaged === true ? (0, index_js_2.createSchemaUpgrade)() : value.isStaged;
286
+ return { isStaged };
287
+ });
288
+ return simpleAllowedTypes;
289
+ }
290
+ //# sourceMappingURL=simpleSchemaCodec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simpleSchemaCodec.js","sourceRoot":"","sources":["../../../src/simple-tree/api/simpleSchemaCodec.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { objectToMap, type JsonCompatibleReadOnly } from \"../../util/index.js\";\nimport { unreachableCase, transformMapValues } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tSimpleAllowedTypeAttributes,\n\tSimpleArrayNodeSchema,\n\tSimpleFieldSchema,\n\tSimpleLeafNodeSchema,\n\tSimpleMapNodeSchema,\n\tSimpleNodeSchema,\n\tSimpleObjectFieldSchema,\n\tSimpleObjectNodeSchema,\n\tSimpleRecordNodeSchema,\n\tSimpleTreeSchema,\n} from \"../simpleSchema.js\";\nimport { createSchemaUpgrade, NodeKind, SchemaUpgrade } from \"../core/index.js\";\nimport type { FieldKind } from \"../fieldSchema.js\";\nimport type { ValueSchema } from \"../../core/index.js\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport * as Format from \"../simpleSchemaFormatV1.js\";\nimport {\n\tDiscriminatedUnionDispatcher,\n\textractJsonValidator,\n\tFormatValidatorNoOp,\n\ttype FormatValidator,\n} from \"../../codec/index.js\";\n\n/**\n * Encodes a simple schema (view or stored) into a serializable format.\n * @remarks The JSON-compatible schema returned from this method is only intended for use in snapshots/comparisons of schemas.\n * It is not possible to reconstruct a full schema (including metadata and persistedMetadata) from the encoded format.\n * @param treeSchema - The tree schema to convert.\n * @returns A serializable representation of the schema.\n *\n * @alpha\n */\nexport function encodeSimpleSchema(simpleSchema: SimpleTreeSchema): JsonCompatibleReadOnly {\n\t// Convert types to serializable forms\n\tconst encodedDefinitions: Format.SimpleSchemaDefinitionsFormat = {};\n\n\tfor (const [identifier, schema] of simpleSchema.definitions) {\n\t\tconst encodedDefinition = encodeNodeSchema(schema);\n\t\tencodedDefinitions[identifier] = encodedDefinition;\n\t}\n\n\tconst encodedSchema: Format.SimpleTreeSchemaFormat = {\n\t\tversion: Format.SimpleSchemaFormatVersion.v1,\n\t\troot: encodeField(simpleSchema.root),\n\t\tdefinitions: encodedDefinitions,\n\t};\n\n\treturn encodedSchema;\n}\n\n/**\n * Decodes a JSON-compatible schema into a simple schema.\n * @param encodedSchema - The encoded schema to decode.\n * @param validator - The format validator to use to validate the encoded schema.\n * @returns A decoded simple schema.\n * @throws Will throw a usage error if the encoded schema is not in the expected format.\n *\n * @alpha\n */\nexport function decodeSimpleSchema(\n\tencodedSchema: JsonCompatibleReadOnly,\n\tvalidator?: FormatValidator,\n): SimpleTreeSchema {\n\tconst effectiveValidator = validator ?? FormatValidatorNoOp;\n\tconst compiledValidator = extractJsonValidator(effectiveValidator).compile(\n\t\tFormat.SimpleTreeSchemaFormat,\n\t);\n\tif (!compiledValidator.check(encodedSchema)) {\n\t\tthrow new UsageError(\n\t\t\t\"The provided simple schema is not valid according to the schema format.\",\n\t\t);\n\t}\n\n\treturn {\n\t\troot: decodeSimpleFieldSchema(encodedSchema.root),\n\t\tdefinitions: new Map(\n\t\t\ttransformMapValues(objectToMap(encodedSchema.definitions), (value, key) => {\n\t\t\t\treturn decodeNodeSchema(value);\n\t\t\t}),\n\t\t),\n\t};\n}\n\n/**\n * Encodes a node schema to a serializable object.\n * @param schema - The node schema to convert.\n * @returns A serializable representation of the node schema.\n */\nfunction encodeNodeSchema(schema: SimpleNodeSchema): Format.SimpleNodeSchemaUnionFormat {\n\tconst kind = schema.kind;\n\tswitch (kind) {\n\t\tcase NodeKind.Leaf:\n\t\t\treturn { leaf: encodeLeafNode(schema) };\n\t\tcase NodeKind.Array:\n\t\t\treturn { array: encodeContainerNode(schema) };\n\t\tcase NodeKind.Map:\n\t\t\treturn { map: encodeContainerNode(schema) };\n\t\tcase NodeKind.Record:\n\t\t\treturn { record: encodeContainerNode(schema) };\n\t\tcase NodeKind.Object:\n\t\t\treturn { object: encodeObjectNode(schema) };\n\t\tdefault: {\n\t\t\tunreachableCase(kind);\n\t\t}\n\t}\n}\n\n/**\n * Encodes a leaf node schema to a serializable object.\n * @param schema - The leaf node schema to convert.\n * @returns A serializable representation of the leaf node schema.\n */\nfunction encodeLeafNode(schema: SimpleLeafNodeSchema): Format.SimpleLeafNodeSchemaFormat {\n\treturn {\n\t\tkind: schema.kind,\n\t\tleafKind: schema.leafKind,\n\t};\n}\n\n/**\n * Encodes a container node schema (a simple schema that is a Map, Array, or Record) to a serializable object.\n * @param schema - The container node schema to convert.\n * @returns A serializable representation of the container node schema. Includes the `kind` for disambiguation between different\n * container kinds.\n */\nfunction encodeContainerNode(\n\tschema: SimpleArrayNodeSchema | SimpleMapNodeSchema | SimpleRecordNodeSchema,\n):\n\t| Format.SimpleArrayNodeSchemaFormat\n\t| Format.SimpleMapNodeSchemaFormat\n\t| Format.SimpleRecordNodeSchemaFormat {\n\treturn {\n\t\tkind: schema.kind,\n\t\tsimpleAllowedTypes: encodeSimpleAllowedTypes(schema.simpleAllowedTypes),\n\t};\n}\n\n/**\n * Encodes a simple allowed types map to a serializable object. Needed because JSON serialization does not support Maps.\n * @param simpleAllowedTypes - The simple allowed types map to convert.\n * @returns A serializable representation of the simple allowed types.\n */\nfunction encodeSimpleAllowedTypes(\n\tsimpleAllowedTypes: ReadonlyMap<string, SimpleAllowedTypeAttributes>,\n): Format.SimpleAllowedTypesFormat {\n\tconst encodedAllowedTypes: Format.SimpleAllowedTypesFormat = {};\n\tfor (const [identifier, attributes] of simpleAllowedTypes) {\n\t\tconst isStaged = attributes.isStaged instanceof SchemaUpgrade ? true : attributes.isStaged;\n\t\tencodedAllowedTypes[identifier] = { isStaged };\n\t}\n\treturn encodedAllowedTypes;\n}\n\n/**\n * Encodes an object node schema to a serializable object.\n * @param schema - The object node schema to convert.\n * @returns A serializable representation of the object node schema.\n */\nfunction encodeObjectNode(\n\tschema: SimpleObjectNodeSchema,\n): Format.SimpleObjectNodeSchemaFormat {\n\tconst encodedFields: Format.SimpleObjectFieldSchemasFormat = {};\n\tfor (const [fieldKey, fieldSchema] of schema.fields) {\n\t\tencodedFields[fieldKey] = encodeObjectField(fieldSchema);\n\t}\n\n\treturn {\n\t\tkind: schema.kind,\n\t\tfields: encodedFields,\n\t\tallowUnknownOptionalFields: schema.allowUnknownOptionalFields,\n\t};\n}\n\n/**\n * Encodes an object field schema to a serializable object.\n * @param fieldSchema - The object field schema to convert.\n * @returns A serializable representation of the object field schema.\n */\nfunction encodeObjectField(\n\tfieldSchema: SimpleObjectFieldSchema,\n): Format.SimpleObjectFieldSchemaFormat {\n\tconst encodedField = encodeField(fieldSchema);\n\treturn { ...encodedField, storedKey: fieldSchema.storedKey };\n}\n\n/**\n * Encodes a field schema to a serializable object.\n * @param fieldSchema - The field schema to convert.\n * @returns A serializable representation of the field schema.\n */\nfunction encodeField(fieldSchema: SimpleFieldSchema): Format.SimpleFieldSchemaFormat {\n\treturn {\n\t\tkind: fieldSchema.kind,\n\t\tsimpleAllowedTypes: encodeSimpleAllowedTypes(fieldSchema.simpleAllowedTypes),\n\t};\n}\n\nconst decodeNodeSchemaDispatcher: DiscriminatedUnionDispatcher<\n\tFormat.SimpleNodeSchemaUnionFormat,\n\t[],\n\t| SimpleLeafNodeSchema\n\t| SimpleArrayNodeSchema\n\t| SimpleMapNodeSchema\n\t| SimpleRecordNodeSchema\n\t| SimpleObjectNodeSchema\n> = new DiscriminatedUnionDispatcher({\n\tleaf: decodeLeafNode,\n\tarray: decodeContainerNode,\n\tmap: decodeContainerNode,\n\trecord: decodeContainerNode,\n\tobject: decodeObjectNode,\n});\n\n/**\n * Decodes a node schema from a JSON-compatible object.\n * @param encodedNodeSchema - The encoded node schema to decode.\n * @returns The decoded node schema.\n */\nfunction decodeNodeSchema(\n\tencodedNodeSchema: Format.SimpleNodeSchemaUnionFormat,\n):\n\t| SimpleLeafNodeSchema\n\t| SimpleArrayNodeSchema\n\t| SimpleMapNodeSchema\n\t| SimpleRecordNodeSchema\n\t| SimpleObjectNodeSchema {\n\treturn decodeNodeSchemaDispatcher.dispatch(encodedNodeSchema);\n}\n\n/**\n * Decodes a container node schema (array, map, record) from a JSON-compatible object.\n * @param encodedContainerSchema - The encoded schema to decode.\n * @returns The decoded container node schema.\n */\nfunction decodeContainerNode(\n\tencodedContainerSchema:\n\t\t| Format.SimpleArrayNodeSchemaFormat\n\t\t| Format.SimpleMapNodeSchemaFormat\n\t\t| Format.SimpleRecordNodeSchemaFormat,\n): SimpleArrayNodeSchema | SimpleMapNodeSchema | SimpleRecordNodeSchema {\n\treturn {\n\t\tkind: encodedContainerSchema.kind as NodeKind.Array | NodeKind.Map | NodeKind.Record,\n\t\tsimpleAllowedTypes: decodeSimpleAllowedTypes(encodedContainerSchema.simpleAllowedTypes),\n\t\t// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values.\n\t\tpersistedMetadata: undefined,\n\t\tmetadata: {},\n\t};\n}\n\n/**\n * Decodes a leaf node schema from a JSON-compatible object.\n * @param encodedLeafSchema - The encoded leaf node schema.\n * @returns The decoded leaf node schema.\n */\nfunction decodeLeafNode(\n\tencodedLeafSchema: Format.SimpleLeafNodeSchemaFormat,\n): SimpleLeafNodeSchema {\n\treturn {\n\t\tkind: NodeKind.Leaf,\n\t\tleafKind: encodedLeafSchema.leafKind as ValueSchema,\n\t\t// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values.\n\t\tpersistedMetadata: undefined,\n\t\tmetadata: {},\n\t};\n}\n\n/**\n * Decodes a object node schema from a JSON-compatible object.\n * @param encodedObjectSchema - The encoded object node schema.\n * @returns The decoded object node schema.\n */\nfunction decodeObjectNode(\n\tencodedObjectSchema: Format.SimpleObjectNodeSchemaFormat,\n): SimpleObjectNodeSchema {\n\treturn {\n\t\tkind: NodeKind.Object,\n\t\tfields: decodeObjectFields(encodedObjectSchema.fields),\n\t\t// It is possible for allowUnknownOptionalFields to be undefined. This happens when serializing a Simple Schema derived\n\t\t// from a stored schema.\n\t\tallowUnknownOptionalFields: encodedObjectSchema.allowUnknownOptionalFields,\n\t\t// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values when decoding.\n\t\tpersistedMetadata: undefined,\n\t\tmetadata: {},\n\t};\n}\n\n/**\n * Decodes a map of object fields from a JSON-compatible object.\n * @param encodedFields - The encoded fields.\n * @returns A map of the decoded object fields.\n */\nfunction decodeObjectFields(\n\tencodedFields: Format.SimpleObjectFieldSchemasFormat,\n): ReadonlyMap<string, SimpleObjectFieldSchema> {\n\tconst fields = new Map<string, SimpleObjectFieldSchema>();\n\tfor (const [fieldKey, fieldSchema] of Object.entries(encodedFields)) {\n\t\tfields.set(fieldKey, decodeObjectField(fieldSchema));\n\t}\n\treturn fields;\n}\n\n/**\n * Decodes a {@link SimpleObjectFieldSchema} from a JSON-compatible object.\n * @param encodedField - The encoded field schema.\n * @returns The decoded simple object field schema.\n */\nfunction decodeObjectField(\n\tencodedField: Format.SimpleObjectFieldSchemaFormat,\n): SimpleObjectFieldSchema {\n\tconst baseField = decodeSimpleFieldSchema(encodedField);\n\treturn {\n\t\t...baseField,\n\t\tstoredKey: encodedField.storedKey,\n\t};\n}\n\n/**\n * Decodes a {@link SimpleFieldSchema} from a JSON-compatible object.\n * @param encodedField - The encoded field schema.\n * @returns The decoded simple field schema.\n */\nfunction decodeSimpleFieldSchema(\n\tencodedField: Format.SimpleFieldSchemaFormat,\n): SimpleFieldSchema {\n\treturn {\n\t\tkind: encodedField.kind as FieldKind,\n\t\tsimpleAllowedTypes: decodeSimpleAllowedTypes(encodedField.simpleAllowedTypes),\n\t\t// We cannot encode persistedMetadata or metadata, so we explicitly set them to empty values when decoding.\n\t\tpersistedMetadata: undefined,\n\t\tmetadata: {},\n\t};\n}\n\n/**\n * Decodes a simple allowed types map from a JSON-compatible object.\n * @param encodedAllowedTypes - The encoded simple allowed types.\n * @returns A map of the decoded simple allowed types.\n */\nfunction decodeSimpleAllowedTypes(\n\tencodedAllowedTypes: Format.SimpleAllowedTypesFormat,\n): ReadonlyMap<string, SimpleAllowedTypeAttributes> {\n\tconst untypedMap = objectToMap(encodedAllowedTypes);\n\n\tconst simpleAllowedTypes = transformMapValues(\n\t\tuntypedMap,\n\t\t(value): SimpleAllowedTypeAttributes => {\n\t\t\tconst isStaged = value.isStaged === true ? createSchemaUpgrade() : value.isStaged;\n\t\t\treturn { isStaged };\n\t\t},\n\t);\n\n\treturn simpleAllowedTypes;\n}\n"]}
@@ -0,0 +1,103 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { JsonCompatibleReadOnly } from "../../util/index.js";
6
+ import { TreeViewConfiguration } from "./configuration.js";
7
+ import type { SchemaCompatibilityStatus } from "./tree.js";
8
+ /**
9
+ * Compute the compatibility of using `view` to {@link ViewableTree.viewWith | view a tree} who's {@link ITreeAlpha.exportSimpleSchema | stored schema} could be derived from `viewWhichCreatedStoredSchema` via either {@link TreeView.initialize} or {@link TreeView.upgradeSchema}.
10
+ *
11
+ * @remarks See {@link SchemaCompatibilityStatus} for details on the compatibility results.
12
+ *
13
+ * @example This example demonstrates checking the compatibility of a historical schema against a current schema.
14
+ * In this case, the historical schema is a Point2D object with x and y fields, while the current schema is a Point3D object
15
+ * that adds an optional z field.
16
+ *
17
+ * ```ts
18
+ * // This snapshot is assumed to be the same as Point3D, except missing `z`.
19
+ * const encodedSchema = JSON.parse(fs.readFileSync("PointSchema.json", "utf8"));
20
+ * const oldViewSchema = importCompatibilitySchemaSnapshot(encodedSchema);
21
+ *
22
+ * // Build the current view schema
23
+ * class Point3D extends factory.object("Point", {
24
+ * x: factory.number,
25
+ * y: factory.number,
26
+ *
27
+ * // The current schema has a new optional field that was not present on Point2D
28
+ * z: factory.optional(factory.number),
29
+ * }) {}
30
+ * const currentViewSchema = new TreeViewConfiguration({ schema: Point3D });
31
+ *
32
+ * // Check to see if the document created by the historical view schema can be opened with the current view schema
33
+ * const backwardsCompatibilityStatus = checkCompatibility(oldViewSchema, currentViewSchema);
34
+ *
35
+ * // z is not present in Point2D, so the schema must be upgraded
36
+ * assert.equal(backwardsCompatibilityStatus.canView, false);
37
+ *
38
+ * // The schema can be upgraded to add the new optional field
39
+ * assert.equal(backwardsCompatibilityStatus.canUpgrade, true);
40
+ *
41
+ * // Test what the old version of the application would do with a tree using the new schema:
42
+ * const forwardsCompatibilityStatus = checkCompatibility(currentViewSchema, oldViewSchema);
43
+ *
44
+ * // If the old schema set allowUnknownOptionalFields, this would be true, but since it did not,
45
+ * // this assert will fail, detecting the forwards compatibility break:
46
+ * // this means these two versions of the application cannot collaborate on content using these schema.
47
+ * assert.equal(forwardsCompatibilityStatus.canView, true);
48
+ * ```
49
+ *
50
+ * @param viewWhichCreatedStoredSchema - From which to derive the stored schema, as if it initialized or upgraded a tree via {@link TreeView}.
51
+ * @param view - The view being tested to see if it could view tree created or initialized using `viewWhichCreatedStoredSchema`.
52
+ * @returns The compatibility status.
53
+ *
54
+ * @alpha
55
+ */
56
+ export declare function checkCompatibility(viewWhichCreatedStoredSchema: TreeViewConfiguration, view: TreeViewConfiguration): Omit<SchemaCompatibilityStatus, "canInitialize">;
57
+ /**
58
+ * Returns a JSON compatible representation of the tree schema for snapshot compatibility checking.
59
+ *
60
+ * Snapshots can be loaded by the same or newer package versions, but not necessarily older versions.
61
+ *
62
+ * @see {@link importCompatibilitySchemaSnapshot} which loads these snapshots.
63
+ *
64
+ * @param config - The schema to snapshot. Only the schema field of the `TreeViewConfiguration` is used.
65
+ * @returns The JSON representation of the schema.
66
+ *
67
+ * @example This example creates and persists a snapshot of a Point2D schema.
68
+ *
69
+ * ```ts
70
+ * const schemaFactory = new SchemaFactory("test");
71
+ * class Point2D extends schemaFactory.object("Point", {
72
+ * x: factory.number,
73
+ * y: factory.number,
74
+ * }) {}
75
+ * const viewSchema = new TreeViewConfiguration({ schema: Point2D });
76
+ * const encodedSchema = JSON.stringify(exportCompatibilitySchemaSnapshot(viewSchema));
77
+ * fs.writeFileSync("PointSchema.json", encodedSchema);
78
+ * ```
79
+ *
80
+ * @alpha
81
+ */
82
+ export declare function exportCompatibilitySchemaSnapshot(config: Pick<TreeViewConfiguration, "schema">): JsonCompatibleReadOnly;
83
+ /**
84
+ * Parse the format exported by {@link exportCompatibilitySchemaSnapshot} into a schema.
85
+ *
86
+ * Can load snapshots created by the same or older package versions, but not necessarily newer versions.
87
+ *
88
+ * @see {@link exportCompatibilitySchemaSnapshot} which creates these snapshots.
89
+ *
90
+ * @param config - The JSON representation of the schema.
91
+ * @returns The schema. Only the schema field of the {@link TreeViewConfiguration} is populated.
92
+ * @throws Will throw a usage error if the encoded schema is not in the expected format.
93
+ *
94
+ * @example This example loads and parses a snapshot of a Point2D schema.
95
+ *
96
+ * ```ts;
97
+ * const oldViewSchema = importCompatibilitySchemaSnapshot(fs.readFileSync("PointSchema.json", "utf8"));
98
+ * ```
99
+ *
100
+ * @alpha
101
+ */
102
+ export declare function importCompatibilitySchemaSnapshot(config: JsonCompatibleReadOnly): TreeViewConfiguration;
103
+ //# sourceMappingURL=snapshotCompatibilityChecker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotCompatibilityChecker.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/snapshotCompatibilityChecker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAA8B,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAIvF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAG3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,kBAAkB,CACjC,4BAA4B,EAAE,qBAAqB,EACnD,IAAI,EAAE,qBAAqB,GACzB,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAOlD;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iCAAiC,CAChD,MAAM,EAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,GAC3C,sBAAsB,CAGxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iCAAiC,CAChD,MAAM,EAAE,sBAAsB,GAC5B,qBAAqB,CAOvB"}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.importCompatibilitySchemaSnapshot = exports.exportCompatibilitySchemaSnapshot = exports.checkCompatibility = void 0;
8
+ const toStoredSchema_js_1 = require("../toStoredSchema.js");
9
+ const configuration_js_1 = require("./configuration.js");
10
+ const schemaCompatibilityTester_js_1 = require("./schemaCompatibilityTester.js");
11
+ const schemaFromSimple_js_1 = require("./schemaFromSimple.js");
12
+ const simpleSchemaCodec_js_1 = require("./simpleSchemaCodec.js");
13
+ const viewSchemaToSimpleSchema_js_1 = require("./viewSchemaToSimpleSchema.js");
14
+ /**
15
+ * Compute the compatibility of using `view` to {@link ViewableTree.viewWith | view a tree} who's {@link ITreeAlpha.exportSimpleSchema | stored schema} could be derived from `viewWhichCreatedStoredSchema` via either {@link TreeView.initialize} or {@link TreeView.upgradeSchema}.
16
+ *
17
+ * @remarks See {@link SchemaCompatibilityStatus} for details on the compatibility results.
18
+ *
19
+ * @example This example demonstrates checking the compatibility of a historical schema against a current schema.
20
+ * In this case, the historical schema is a Point2D object with x and y fields, while the current schema is a Point3D object
21
+ * that adds an optional z field.
22
+ *
23
+ * ```ts
24
+ * // This snapshot is assumed to be the same as Point3D, except missing `z`.
25
+ * const encodedSchema = JSON.parse(fs.readFileSync("PointSchema.json", "utf8"));
26
+ * const oldViewSchema = importCompatibilitySchemaSnapshot(encodedSchema);
27
+ *
28
+ * // Build the current view schema
29
+ * class Point3D extends factory.object("Point", {
30
+ * x: factory.number,
31
+ * y: factory.number,
32
+ *
33
+ * // The current schema has a new optional field that was not present on Point2D
34
+ * z: factory.optional(factory.number),
35
+ * }) {}
36
+ * const currentViewSchema = new TreeViewConfiguration({ schema: Point3D });
37
+ *
38
+ * // Check to see if the document created by the historical view schema can be opened with the current view schema
39
+ * const backwardsCompatibilityStatus = checkCompatibility(oldViewSchema, currentViewSchema);
40
+ *
41
+ * // z is not present in Point2D, so the schema must be upgraded
42
+ * assert.equal(backwardsCompatibilityStatus.canView, false);
43
+ *
44
+ * // The schema can be upgraded to add the new optional field
45
+ * assert.equal(backwardsCompatibilityStatus.canUpgrade, true);
46
+ *
47
+ * // Test what the old version of the application would do with a tree using the new schema:
48
+ * const forwardsCompatibilityStatus = checkCompatibility(currentViewSchema, oldViewSchema);
49
+ *
50
+ * // If the old schema set allowUnknownOptionalFields, this would be true, but since it did not,
51
+ * // this assert will fail, detecting the forwards compatibility break:
52
+ * // this means these two versions of the application cannot collaborate on content using these schema.
53
+ * assert.equal(forwardsCompatibilityStatus.canView, true);
54
+ * ```
55
+ *
56
+ * @param viewWhichCreatedStoredSchema - From which to derive the stored schema, as if it initialized or upgraded a tree via {@link TreeView}.
57
+ * @param view - The view being tested to see if it could view tree created or initialized using `viewWhichCreatedStoredSchema`.
58
+ * @returns The compatibility status.
59
+ *
60
+ * @alpha
61
+ */
62
+ function checkCompatibility(viewWhichCreatedStoredSchema, view) {
63
+ const viewAsAlpha = new configuration_js_1.TreeViewConfigurationAlpha({ schema: view.schema });
64
+ const stored = (0, toStoredSchema_js_1.toStoredSchema)(viewWhichCreatedStoredSchema.schema, {
65
+ includeStaged: () => true,
66
+ });
67
+ const tester = new schemaCompatibilityTester_js_1.SchemaCompatibilityTester(viewAsAlpha);
68
+ return tester.checkCompatibility(stored);
69
+ }
70
+ exports.checkCompatibility = checkCompatibility;
71
+ /**
72
+ * Returns a JSON compatible representation of the tree schema for snapshot compatibility checking.
73
+ *
74
+ * Snapshots can be loaded by the same or newer package versions, but not necessarily older versions.
75
+ *
76
+ * @see {@link importCompatibilitySchemaSnapshot} which loads these snapshots.
77
+ *
78
+ * @param config - The schema to snapshot. Only the schema field of the `TreeViewConfiguration` is used.
79
+ * @returns The JSON representation of the schema.
80
+ *
81
+ * @example This example creates and persists a snapshot of a Point2D schema.
82
+ *
83
+ * ```ts
84
+ * const schemaFactory = new SchemaFactory("test");
85
+ * class Point2D extends schemaFactory.object("Point", {
86
+ * x: factory.number,
87
+ * y: factory.number,
88
+ * }) {}
89
+ * const viewSchema = new TreeViewConfiguration({ schema: Point2D });
90
+ * const encodedSchema = JSON.stringify(exportCompatibilitySchemaSnapshot(viewSchema));
91
+ * fs.writeFileSync("PointSchema.json", encodedSchema);
92
+ * ```
93
+ *
94
+ * @alpha
95
+ */
96
+ function exportCompatibilitySchemaSnapshot(config) {
97
+ const simpleSchema = (0, viewSchemaToSimpleSchema_js_1.toSimpleTreeSchema)(config.schema, true);
98
+ return (0, simpleSchemaCodec_js_1.encodeSimpleSchema)(simpleSchema);
99
+ }
100
+ exports.exportCompatibilitySchemaSnapshot = exportCompatibilitySchemaSnapshot;
101
+ /**
102
+ * Parse the format exported by {@link exportCompatibilitySchemaSnapshot} into a schema.
103
+ *
104
+ * Can load snapshots created by the same or older package versions, but not necessarily newer versions.
105
+ *
106
+ * @see {@link exportCompatibilitySchemaSnapshot} which creates these snapshots.
107
+ *
108
+ * @param config - The JSON representation of the schema.
109
+ * @returns The schema. Only the schema field of the {@link TreeViewConfiguration} is populated.
110
+ * @throws Will throw a usage error if the encoded schema is not in the expected format.
111
+ *
112
+ * @example This example loads and parses a snapshot of a Point2D schema.
113
+ *
114
+ * ```ts;
115
+ * const oldViewSchema = importCompatibilitySchemaSnapshot(fs.readFileSync("PointSchema.json", "utf8"));
116
+ * ```
117
+ *
118
+ * @alpha
119
+ */
120
+ function importCompatibilitySchemaSnapshot(config) {
121
+ const simpleSchema = (0, simpleSchemaCodec_js_1.decodeSimpleSchema)(config);
122
+ const viewSchema = (0, schemaFromSimple_js_1.generateSchemaFromSimpleSchema)(simpleSchema);
123
+ // We construct a TreeViewConfiguration here with the default parameters. The default set of validation parameters are fine for
124
+ // a schema produced by `generateSchemaFromSimpleSchema`.
125
+ return new configuration_js_1.TreeViewConfiguration({ schema: viewSchema.root });
126
+ }
127
+ exports.importCompatibilitySchemaSnapshot = importCompatibilitySchemaSnapshot;
128
+ //# sourceMappingURL=snapshotCompatibilityChecker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotCompatibilityChecker.js","sourceRoot":"","sources":["../../../src/simple-tree/api/snapshotCompatibilityChecker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,4DAAsD;AACtD,yDAAuF;AACvF,iFAA2E;AAC3E,+DAAuE;AACvE,iEAAgF;AAEhF,+EAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,SAAgB,kBAAkB,CACjC,4BAAmD,EACnD,IAA2B;IAE3B,MAAM,WAAW,GAAG,IAAI,6CAA0B,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,IAAA,kCAAc,EAAC,4BAA4B,CAAC,MAAM,EAAE;QAClE,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI;KACzB,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,IAAI,wDAAyB,CAAC,WAAW,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC;AAVD,gDAUC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,iCAAiC,CAChD,MAA6C;IAE7C,MAAM,YAAY,GAAG,IAAA,gDAAkB,EAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC7D,OAAO,IAAA,yCAAkB,EAAC,YAAY,CAAC,CAAC;AACzC,CAAC;AALD,8EAKC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,iCAAiC,CAChD,MAA8B;IAE9B,MAAM,YAAY,GAAG,IAAA,yCAAkB,EAAC,MAAM,CAAC,CAAC;IAChD,MAAM,UAAU,GAAG,IAAA,oDAA8B,EAAC,YAAY,CAAC,CAAC;IAEhE,+HAA+H;IAC/H,yDAAyD;IACzD,OAAO,IAAI,wCAAqB,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;AAC/D,CAAC;AATD,8EASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { JsonCompatibleReadOnly } from \"../../util/index.js\";\nimport { toStoredSchema } from \"../toStoredSchema.js\";\nimport { TreeViewConfigurationAlpha, TreeViewConfiguration } from \"./configuration.js\";\nimport { SchemaCompatibilityTester } from \"./schemaCompatibilityTester.js\";\nimport { generateSchemaFromSimpleSchema } from \"./schemaFromSimple.js\";\nimport { decodeSimpleSchema, encodeSimpleSchema } from \"./simpleSchemaCodec.js\";\nimport type { SchemaCompatibilityStatus } from \"./tree.js\";\nimport { toSimpleTreeSchema } from \"./viewSchemaToSimpleSchema.js\";\n\n/**\n * Compute the compatibility of using `view` to {@link ViewableTree.viewWith | view a tree} who's {@link ITreeAlpha.exportSimpleSchema | stored schema} could be derived from `viewWhichCreatedStoredSchema` via either {@link TreeView.initialize} or {@link TreeView.upgradeSchema}.\n *\n * @remarks See {@link SchemaCompatibilityStatus} for details on the compatibility results.\n *\n * @example This example demonstrates checking the compatibility of a historical schema against a current schema.\n * In this case, the historical schema is a Point2D object with x and y fields, while the current schema is a Point3D object\n * that adds an optional z field.\n *\n * ```ts\n * // This snapshot is assumed to be the same as Point3D, except missing `z`.\n * const encodedSchema = JSON.parse(fs.readFileSync(\"PointSchema.json\", \"utf8\"));\n * const oldViewSchema = importCompatibilitySchemaSnapshot(encodedSchema);\n *\n * // Build the current view schema\n * class Point3D extends factory.object(\"Point\", {\n * \tx: factory.number,\n * \ty: factory.number,\n *\n * \t// The current schema has a new optional field that was not present on Point2D\n * \tz: factory.optional(factory.number),\n * }) {}\n * const currentViewSchema = new TreeViewConfiguration({ schema: Point3D });\n *\n * // Check to see if the document created by the historical view schema can be opened with the current view schema\n * const backwardsCompatibilityStatus = checkCompatibility(oldViewSchema, currentViewSchema);\n *\n * // z is not present in Point2D, so the schema must be upgraded\n * assert.equal(backwardsCompatibilityStatus.canView, false);\n *\n * // The schema can be upgraded to add the new optional field\n * assert.equal(backwardsCompatibilityStatus.canUpgrade, true);\n *\n * // Test what the old version of the application would do with a tree using the new schema:\n * const forwardsCompatibilityStatus = checkCompatibility(currentViewSchema, oldViewSchema);\n *\n * // If the old schema set allowUnknownOptionalFields, this would be true, but since it did not,\n * // this assert will fail, detecting the forwards compatibility break:\n * // this means these two versions of the application cannot collaborate on content using these schema.\n * assert.equal(forwardsCompatibilityStatus.canView, true);\n * ```\n *\n * @param viewWhichCreatedStoredSchema - From which to derive the stored schema, as if it initialized or upgraded a tree via {@link TreeView}.\n * @param view - The view being tested to see if it could view tree created or initialized using `viewWhichCreatedStoredSchema`.\n * @returns The compatibility status.\n *\n * @alpha\n */\nexport function checkCompatibility(\n\tviewWhichCreatedStoredSchema: TreeViewConfiguration,\n\tview: TreeViewConfiguration,\n): Omit<SchemaCompatibilityStatus, \"canInitialize\"> {\n\tconst viewAsAlpha = new TreeViewConfigurationAlpha({ schema: view.schema });\n\tconst stored = toStoredSchema(viewWhichCreatedStoredSchema.schema, {\n\t\tincludeStaged: () => true,\n\t});\n\tconst tester = new SchemaCompatibilityTester(viewAsAlpha);\n\treturn tester.checkCompatibility(stored);\n}\n\n/**\n * Returns a JSON compatible representation of the tree schema for snapshot compatibility checking.\n *\n * Snapshots can be loaded by the same or newer package versions, but not necessarily older versions.\n *\n * @see {@link importCompatibilitySchemaSnapshot} which loads these snapshots.\n *\n * @param config - The schema to snapshot. Only the schema field of the `TreeViewConfiguration` is used.\n * @returns The JSON representation of the schema.\n *\n * @example This example creates and persists a snapshot of a Point2D schema.\n *\n * ```ts\n * const schemaFactory = new SchemaFactory(\"test\");\n * class Point2D extends schemaFactory.object(\"Point\", {\n * \tx: factory.number,\n * \ty: factory.number,\n * }) {}\n * const viewSchema = new TreeViewConfiguration({ schema: Point2D });\n * const encodedSchema = JSON.stringify(exportCompatibilitySchemaSnapshot(viewSchema));\n * fs.writeFileSync(\"PointSchema.json\", encodedSchema);\n * ```\n *\n * @alpha\n */\nexport function exportCompatibilitySchemaSnapshot(\n\tconfig: Pick<TreeViewConfiguration, \"schema\">,\n): JsonCompatibleReadOnly {\n\tconst simpleSchema = toSimpleTreeSchema(config.schema, true);\n\treturn encodeSimpleSchema(simpleSchema);\n}\n\n/**\n * Parse the format exported by {@link exportCompatibilitySchemaSnapshot} into a schema.\n *\n * Can load snapshots created by the same or older package versions, but not necessarily newer versions.\n *\n * @see {@link exportCompatibilitySchemaSnapshot} which creates these snapshots.\n *\n * @param config - The JSON representation of the schema.\n * @returns The schema. Only the schema field of the {@link TreeViewConfiguration} is populated.\n * @throws Will throw a usage error if the encoded schema is not in the expected format.\n *\n * @example This example loads and parses a snapshot of a Point2D schema.\n *\n * ```ts;\n * const oldViewSchema = importCompatibilitySchemaSnapshot(fs.readFileSync(\"PointSchema.json\", \"utf8\"));\n * ```\n *\n * @alpha\n */\nexport function importCompatibilitySchemaSnapshot(\n\tconfig: JsonCompatibleReadOnly,\n): TreeViewConfiguration {\n\tconst simpleSchema = decodeSimpleSchema(config);\n\tconst viewSchema = generateSchemaFromSimpleSchema(simpleSchema);\n\n\t// We construct a TreeViewConfiguration here with the default parameters. The default set of validation parameters are fine for\n\t// a schema produced by `generateSchemaFromSimpleSchema`.\n\treturn new TreeViewConfiguration({ schema: viewSchema.root });\n}\n"]}
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
6
- import type { ICodecOptions } from "../../codec/index.js";
7
- import type { JsonCompatible } from "../../util/index.js";
6
+ import { type ICodecOptions } from "../../codec/index.js";
7
+ import { type JsonCompatible } from "../../util/index.js";
8
8
  import type { SchemaUpgrade } from "../core/index.js";
9
9
  import { type ImplicitFieldSchema } from "../fieldSchema.js";
10
10
  import type { SchemaCompatibilityStatus } from "./tree.js";
@@ -1 +1 @@
1
- {"version":3,"file":"storedSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/storedSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAQ1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAKnF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,mBAAmB,EAC3B,mBAAmB,EAAE,uBAAuB,EAC5C,aAAa,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,GAChD,cAAc,CAIhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,cAAc,EACzB,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,aAAa,GACpB,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAUlD"}
1
+ {"version":3,"file":"storedSchema.d.ts","sourceRoot":"","sources":["../../../src/simple-tree/api/storedSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAQ9E,OAAO,EAAS,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAwB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAKnF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,mBAAmB,EAC3B,mBAAmB,EAAE,uBAAuB,EAC5C,aAAa,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,GAChD,cAAc,CAIhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,cAAc,EACzB,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,aAAa,GACpB,IAAI,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAalD"}
@@ -5,9 +5,11 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.comparePersistedSchema = exports.extractPersistedSchema = void 0;
8
- const index_js_1 = require("../../core/index.js");
9
- const index_js_2 = require("../../feature-libraries/index.js");
10
- const index_js_3 = require("../../feature-libraries/schema-index/index.js");
8
+ const index_js_1 = require("../../codec/index.js");
9
+ const index_js_2 = require("../../core/index.js");
10
+ const index_js_3 = require("../../feature-libraries/index.js");
11
+ const index_js_4 = require("../../feature-libraries/schema-index/index.js");
12
+ const index_js_5 = require("../../util/index.js");
11
13
  const fieldSchema_js_1 = require("../fieldSchema.js");
12
14
  const toStoredSchema_js_1 = require("../toStoredSchema.js");
13
15
  const configuration_js_1 = require("./configuration.js");
@@ -46,8 +48,8 @@ const schemaCompatibilityTester_js_1 = require("./schemaCompatibilityTester.js")
46
48
  */
47
49
  function extractPersistedSchema(schema, minVersionForCollab, includeStaged) {
48
50
  const stored = (0, toStoredSchema_js_1.toStoredSchema)(schema, { includeStaged });
49
- const schemaWriteVersion = (0, index_js_3.clientVersionToSchemaVersion)(minVersionForCollab);
50
- return (0, index_js_2.encodeTreeSchema)(stored, schemaWriteVersion);
51
+ const schemaWriteVersion = (0, index_js_4.clientVersionToSchemaVersion)(minVersionForCollab);
52
+ return (0, index_js_3.encodeTreeSchema)(stored, schemaWriteVersion);
51
53
  }
52
54
  exports.extractPersistedSchema = extractPersistedSchema;
53
55
  /**
@@ -83,7 +85,7 @@ exports.extractPersistedSchema = extractPersistedSchema;
83
85
  function comparePersistedSchema(persisted, view, options) {
84
86
  // Any version can be passed down to makeSchemaCodec here.
85
87
  // We only use the decode part, which always dispatches to the correct codec based on the version in the data, not the version passed to `makeSchemaCodec`.
86
- const schemaCodec = (0, index_js_2.makeSchemaCodec)(options, index_js_1.SchemaVersion.v1);
88
+ const schemaCodec = (0, index_js_3.makeSchemaCodec)({ ...options, minVersionForCollab: index_js_1.FluidClientVersion.v2_0 }, (0, index_js_5.brand)(index_js_2.SchemaFormatVersion.v1));
87
89
  const stored = schemaCodec.decode(persisted);
88
90
  const config = new configuration_js_1.TreeViewConfigurationAlpha({
89
91
  schema: (0, fieldSchema_js_1.normalizeFieldSchema)(view),