@fluidframework/tree 2.72.0 → 2.74.0-365691

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 (696) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/api-report/tree.alpha.api.md +32 -31
  3. package/dist/alpha.d.ts +7 -1
  4. package/dist/api.d.ts +6 -2
  5. package/dist/api.d.ts.map +1 -1
  6. package/dist/api.js +2 -11
  7. package/dist/api.js.map +1 -1
  8. package/dist/codec/codec.d.ts +9 -2
  9. package/dist/codec/codec.d.ts.map +1 -1
  10. package/dist/codec/codec.js +9 -2
  11. package/dist/codec/codec.js.map +1 -1
  12. package/dist/codec/index.d.ts +1 -1
  13. package/dist/codec/index.d.ts.map +1 -1
  14. package/dist/codec/index.js +2 -1
  15. package/dist/codec/index.js.map +1 -1
  16. package/dist/codec/versioned/codec.d.ts +7 -2
  17. package/dist/codec/versioned/codec.d.ts.map +1 -1
  18. package/dist/codec/versioned/codec.js +24 -1
  19. package/dist/codec/versioned/codec.js.map +1 -1
  20. package/dist/codec/versioned/index.d.ts +1 -1
  21. package/dist/codec/versioned/index.d.ts.map +1 -1
  22. package/dist/codec/versioned/index.js +2 -1
  23. package/dist/codec/versioned/index.js.map +1 -1
  24. package/dist/core/schema-stored/schema.d.ts +12 -1
  25. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  26. package/dist/core/schema-stored/schema.js.map +1 -1
  27. package/dist/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  28. package/dist/core/tree/detachedFieldIndexCodecs.js +5 -3
  29. package/dist/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  30. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
  31. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  32. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  33. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  34. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js +1 -0
  35. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  36. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
  37. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  38. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  39. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +3 -3
  40. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  41. package/dist/feature-libraries/chunked-forest/codec/codecs.js +32 -18
  42. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
  44. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -2
  46. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/codec/format.d.ts +156 -4
  48. package/dist/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  49. package/dist/feature-libraries/chunked-forest/codec/format.js +7 -3
  50. package/dist/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  51. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
  52. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  53. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
  54. package/dist/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  55. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +2 -2
  56. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  59. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  60. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  61. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  62. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
  63. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +23 -6
  65. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
  67. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js +20 -4
  69. package/dist/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  71. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  72. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  73. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  74. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -17
  75. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  76. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +53 -55
  77. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  78. package/dist/feature-libraries/default-schema/index.d.ts +1 -3
  79. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  80. package/dist/feature-libraries/default-schema/index.js +2 -8
  81. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  82. package/dist/feature-libraries/forest-summary/forestSummarizer.js +1 -1
  83. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  84. package/dist/feature-libraries/forest-summary/format.d.ts +2 -2
  85. package/dist/feature-libraries/forest-summary/format.d.ts.map +1 -1
  86. package/dist/feature-libraries/forest-summary/format.js +4 -2
  87. package/dist/feature-libraries/forest-summary/format.js.map +1 -1
  88. package/dist/feature-libraries/index.d.ts +5 -4
  89. package/dist/feature-libraries/index.d.ts.map +1 -1
  90. package/dist/feature-libraries/index.js +8 -8
  91. package/dist/feature-libraries/index.js.map +1 -1
  92. package/dist/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  93. package/dist/feature-libraries/modular-schema/comparison.js +1 -2
  94. package/dist/feature-libraries/modular-schema/comparison.js.map +1 -1
  95. package/dist/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
  96. package/dist/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  97. package/dist/feature-libraries/modular-schema/fieldKind.js +29 -11
  98. package/dist/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  99. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
  100. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  101. package/dist/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  102. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
  103. package/dist/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  104. package/dist/feature-libraries/modular-schema/genericFieldKind.js +3 -2
  105. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  106. package/dist/feature-libraries/modular-schema/index.d.ts +0 -1
  107. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  108. package/dist/feature-libraries/modular-schema/index.js +1 -3
  109. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  110. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
  111. package/dist/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  112. package/dist/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  113. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  114. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  115. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  116. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
  117. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  118. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
  119. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  120. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
  121. package/dist/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  122. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  123. package/dist/feature-libraries/object-forest/objectForest.js +3 -2
  124. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  125. package/dist/feature-libraries/optional-field/index.d.ts +1 -1
  126. package/dist/feature-libraries/optional-field/index.d.ts.map +1 -1
  127. package/dist/feature-libraries/optional-field/index.js.map +1 -1
  128. package/dist/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  129. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  130. package/dist/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  131. package/dist/feature-libraries/schema-index/codec.d.ts.map +1 -1
  132. package/dist/feature-libraries/schema-index/codec.js +5 -3
  133. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  134. package/dist/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
  135. package/dist/feature-libraries/schemaChecker.d.ts.map +1 -0
  136. package/dist/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
  137. package/dist/feature-libraries/schemaChecker.js.map +1 -0
  138. package/dist/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  139. package/dist/feature-libraries/sequence-field/formatV2.js +1 -0
  140. package/dist/feature-libraries/sequence-field/formatV2.js.map +1 -1
  141. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  142. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
  143. package/dist/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  144. package/dist/feature-libraries/treeCompressionUtils.d.ts +2 -12
  145. package/dist/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
  146. package/dist/feature-libraries/treeCompressionUtils.js +4 -14
  147. package/dist/feature-libraries/treeCompressionUtils.js.map +1 -1
  148. package/dist/index.d.ts +4 -4
  149. package/dist/index.d.ts.map +1 -1
  150. package/dist/index.js +8 -3
  151. package/dist/index.js.map +1 -1
  152. package/dist/packageVersion.d.ts +1 -1
  153. package/dist/packageVersion.d.ts.map +1 -1
  154. package/dist/packageVersion.js +1 -1
  155. package/dist/packageVersion.js.map +1 -1
  156. package/dist/shared-tree/index.d.ts +1 -1
  157. package/dist/shared-tree/index.d.ts.map +1 -1
  158. package/dist/shared-tree/index.js +1 -2
  159. package/dist/shared-tree/index.js.map +1 -1
  160. package/dist/shared-tree/sharedTree.d.ts +7 -54
  161. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  162. package/dist/shared-tree/sharedTree.js +2 -52
  163. package/dist/shared-tree/sharedTree.js.map +1 -1
  164. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  165. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  166. package/dist/shared-tree/sharedTreeChangeCodecs.js +0 -2
  167. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  168. package/dist/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  169. package/dist/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  170. package/dist/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  171. package/dist/shared-tree/treeCheckout.d.ts +2 -2
  172. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  173. package/dist/shared-tree/treeCheckout.js.map +1 -1
  174. package/dist/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  175. package/dist/shared-tree-core/editManagerCodecs.js +12 -6
  176. package/dist/shared-tree-core/editManagerCodecs.js.map +1 -1
  177. package/dist/shared-tree-core/editManagerFormatCommons.d.ts +3 -4
  178. package/dist/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  179. package/dist/shared-tree-core/editManagerFormatCommons.js +5 -8
  180. package/dist/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  181. package/dist/shared-tree-core/index.d.ts +3 -3
  182. package/dist/shared-tree-core/index.d.ts.map +1 -1
  183. package/dist/shared-tree-core/index.js +3 -2
  184. package/dist/shared-tree-core/index.js.map +1 -1
  185. package/dist/shared-tree-core/messageCodecs.d.ts.map +1 -1
  186. package/dist/shared-tree-core/messageCodecs.js +20 -9
  187. package/dist/shared-tree-core/messageCodecs.js.map +1 -1
  188. package/dist/shared-tree-core/messageFormat.d.ts +4 -6
  189. package/dist/shared-tree-core/messageFormat.d.ts.map +1 -1
  190. package/dist/shared-tree-core/messageFormat.js +9 -7
  191. package/dist/shared-tree-core/messageFormat.js.map +1 -1
  192. package/dist/simple-tree/api/configuration.d.ts +2 -0
  193. package/dist/simple-tree/api/configuration.d.ts.map +1 -1
  194. package/dist/simple-tree/api/configuration.js +10 -0
  195. package/dist/simple-tree/api/configuration.js.map +1 -1
  196. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +15 -12
  197. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  198. package/dist/simple-tree/api/incrementalAllowedTypes.js +17 -14
  199. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  200. package/dist/simple-tree/api/index.d.ts +2 -1
  201. package/dist/simple-tree/api/index.d.ts.map +1 -1
  202. package/dist/simple-tree/api/index.js +6 -2
  203. package/dist/simple-tree/api/index.js.map +1 -1
  204. package/dist/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  205. package/dist/simple-tree/api/schemaFromSimple.js +7 -1
  206. package/dist/simple-tree/api/schemaFromSimple.js.map +1 -1
  207. package/dist/simple-tree/api/simpleSchemaCodec.js +4 -6
  208. package/dist/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  209. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
  210. package/dist/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
  211. package/dist/simple-tree/api/snapshotCompatibilityChecker.js +128 -0
  212. package/dist/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
  213. package/dist/simple-tree/api/tree.d.ts +2 -2
  214. package/dist/simple-tree/api/tree.js +1 -1
  215. package/dist/simple-tree/api/tree.js.map +1 -1
  216. package/dist/simple-tree/core/allowedTypes.js +1 -1
  217. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  218. package/dist/simple-tree/core/index.d.ts +3 -3
  219. package/dist/simple-tree/core/index.d.ts.map +1 -1
  220. package/dist/simple-tree/core/index.js +3 -1
  221. package/dist/simple-tree/core/index.js.map +1 -1
  222. package/dist/simple-tree/core/toStored.d.ts +12 -5
  223. package/dist/simple-tree/core/toStored.d.ts.map +1 -1
  224. package/dist/simple-tree/core/toStored.js +26 -10
  225. package/dist/simple-tree/core/toStored.js.map +1 -1
  226. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  227. package/dist/simple-tree/core/treeNodeKernel.js +1 -0
  228. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  229. package/dist/simple-tree/core/treeNodeSchema.d.ts +1 -6
  230. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  231. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  232. package/dist/simple-tree/core/treeNodeValid.d.ts +1 -1
  233. package/dist/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  234. package/dist/simple-tree/core/treeNodeValid.js +1 -2
  235. package/dist/simple-tree/core/treeNodeValid.js.map +1 -1
  236. package/dist/simple-tree/fieldSchema.d.ts.map +1 -1
  237. package/dist/simple-tree/fieldSchema.js +1 -8
  238. package/dist/simple-tree/fieldSchema.js.map +1 -1
  239. package/dist/simple-tree/index.d.ts +3 -3
  240. package/dist/simple-tree/index.d.ts.map +1 -1
  241. package/dist/simple-tree/index.js +10 -4
  242. package/dist/simple-tree/index.js.map +1 -1
  243. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  244. package/dist/simple-tree/leafNodeSchema.js +0 -1
  245. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  246. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  247. package/dist/simple-tree/node-kinds/array/arrayNode.js +14 -49
  248. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  249. package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  250. package/dist/simple-tree/node-kinds/map/mapNode.js +1 -5
  251. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  252. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  253. package/dist/simple-tree/node-kinds/object/objectNode.js +3 -10
  254. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  255. package/dist/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  256. package/dist/simple-tree/node-kinds/record/recordNode.js +1 -5
  257. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  258. package/dist/simple-tree/simpleSchema.d.ts +15 -3
  259. package/dist/simple-tree/simpleSchema.d.ts.map +1 -1
  260. package/dist/simple-tree/simpleSchema.js.map +1 -1
  261. package/dist/simple-tree/toStoredSchema.d.ts +20 -8
  262. package/dist/simple-tree/toStoredSchema.d.ts.map +1 -1
  263. package/dist/simple-tree/toStoredSchema.js +27 -22
  264. package/dist/simple-tree/toStoredSchema.js.map +1 -1
  265. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  266. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +18 -15
  267. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  268. package/dist/tableSchema.d.ts +22 -52
  269. package/dist/tableSchema.d.ts.map +1 -1
  270. package/dist/tableSchema.js +141 -277
  271. package/dist/tableSchema.js.map +1 -1
  272. package/dist/treeFactory.d.ts +5 -0
  273. package/dist/treeFactory.d.ts.map +1 -1
  274. package/dist/treeFactory.js +12 -5
  275. package/dist/treeFactory.js.map +1 -1
  276. package/dist/util/arrayUtilities.d.ts +45 -0
  277. package/dist/util/arrayUtilities.d.ts.map +1 -0
  278. package/dist/util/arrayUtilities.js +76 -0
  279. package/dist/util/arrayUtilities.js.map +1 -0
  280. package/dist/util/breakable.js +3 -3
  281. package/dist/util/breakable.js.map +1 -1
  282. package/dist/util/index.d.ts +1 -0
  283. package/dist/util/index.d.ts.map +1 -1
  284. package/dist/util/index.js +7 -2
  285. package/dist/util/index.js.map +1 -1
  286. package/dist/util/typeCheckTests.d.ts.map +1 -1
  287. package/dist/util/typeCheckTests.js.map +1 -1
  288. package/lib/alpha.d.ts +7 -1
  289. package/lib/api.d.ts +6 -2
  290. package/lib/api.d.ts.map +1 -1
  291. package/lib/api.js +2 -13
  292. package/lib/api.js.map +1 -1
  293. package/lib/codec/codec.d.ts +9 -2
  294. package/lib/codec/codec.d.ts.map +1 -1
  295. package/lib/codec/codec.js +9 -2
  296. package/lib/codec/codec.js.map +1 -1
  297. package/lib/codec/index.d.ts +1 -1
  298. package/lib/codec/index.d.ts.map +1 -1
  299. package/lib/codec/index.js +1 -1
  300. package/lib/codec/index.js.map +1 -1
  301. package/lib/codec/versioned/codec.d.ts +7 -2
  302. package/lib/codec/versioned/codec.d.ts.map +1 -1
  303. package/lib/codec/versioned/codec.js +22 -0
  304. package/lib/codec/versioned/codec.js.map +1 -1
  305. package/lib/codec/versioned/index.d.ts +1 -1
  306. package/lib/codec/versioned/index.d.ts.map +1 -1
  307. package/lib/codec/versioned/index.js +1 -1
  308. package/lib/codec/versioned/index.js.map +1 -1
  309. package/lib/core/schema-stored/schema.d.ts +12 -1
  310. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  311. package/lib/core/schema-stored/schema.js.map +1 -1
  312. package/lib/core/tree/detachedFieldIndexCodecs.d.ts.map +1 -1
  313. package/lib/core/tree/detachedFieldIndexCodecs.js +5 -3
  314. package/lib/core/tree/detachedFieldIndexCodecs.js.map +1 -1
  315. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +4 -5
  316. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  317. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  318. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  319. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js +2 -1
  320. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  321. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts +2 -1
  322. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  323. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  324. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +3 -3
  325. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  326. package/lib/feature-libraries/chunked-forest/codec/codecs.js +36 -22
  327. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  328. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +6 -6
  329. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  330. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +4 -2
  331. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  332. package/lib/feature-libraries/chunked-forest/codec/format.d.ts +156 -4
  333. package/lib/feature-libraries/chunked-forest/codec/format.d.ts.map +1 -1
  334. package/lib/feature-libraries/chunked-forest/codec/format.js +6 -2
  335. package/lib/feature-libraries/chunked-forest/codec/format.js.map +1 -1
  336. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts +8 -3
  337. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.d.ts.map +1 -1
  338. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js +4 -1
  339. package/lib/feature-libraries/chunked-forest/codec/formatGeneric.js.map +1 -1
  340. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +2 -2
  341. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -1
  342. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -1
  343. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  344. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  345. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  346. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  347. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +13 -13
  348. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  349. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +22 -6
  350. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  351. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts +9 -8
  352. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.d.ts.map +1 -1
  353. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js +17 -2
  354. package/lib/feature-libraries/chunked-forest/codec/uncompressedEncode.js.map +1 -1
  355. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  356. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  357. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  358. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  359. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +35 -17
  360. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  361. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +55 -57
  362. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  363. package/lib/feature-libraries/default-schema/index.d.ts +1 -3
  364. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  365. package/lib/feature-libraries/default-schema/index.js +1 -3
  366. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  367. package/lib/feature-libraries/forest-summary/forestSummarizer.js +2 -2
  368. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  369. package/lib/feature-libraries/forest-summary/format.d.ts +2 -2
  370. package/lib/feature-libraries/forest-summary/format.d.ts.map +1 -1
  371. package/lib/feature-libraries/forest-summary/format.js +4 -2
  372. package/lib/feature-libraries/forest-summary/format.js.map +1 -1
  373. package/lib/feature-libraries/index.d.ts +5 -4
  374. package/lib/feature-libraries/index.d.ts.map +1 -1
  375. package/lib/feature-libraries/index.js +5 -4
  376. package/lib/feature-libraries/index.js.map +1 -1
  377. package/lib/feature-libraries/modular-schema/comparison.d.ts.map +1 -1
  378. package/lib/feature-libraries/modular-schema/comparison.js +1 -2
  379. package/lib/feature-libraries/modular-schema/comparison.js.map +1 -1
  380. package/lib/feature-libraries/modular-schema/fieldKind.d.ts +38 -12
  381. package/lib/feature-libraries/modular-schema/fieldKind.d.ts.map +1 -1
  382. package/lib/feature-libraries/modular-schema/fieldKind.js +29 -11
  383. package/lib/feature-libraries/modular-schema/fieldKind.js.map +1 -1
  384. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts +2 -2
  385. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.d.ts.map +1 -1
  386. package/lib/feature-libraries/modular-schema/fieldKindConfiguration.js.map +1 -1
  387. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts +2 -2
  388. package/lib/feature-libraries/modular-schema/genericFieldKind.d.ts.map +1 -1
  389. package/lib/feature-libraries/modular-schema/genericFieldKind.js +3 -2
  390. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  391. package/lib/feature-libraries/modular-schema/index.d.ts +0 -1
  392. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  393. package/lib/feature-libraries/modular-schema/index.js +0 -1
  394. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  395. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts +5 -6
  396. package/lib/feature-libraries/modular-schema/isNeverTree.d.ts.map +1 -1
  397. package/lib/feature-libraries/modular-schema/isNeverTree.js.map +1 -1
  398. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +2 -2
  399. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  400. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +1 -1
  401. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  402. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts +8 -8
  403. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  404. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +1 -2
  405. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  406. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts +66 -9
  407. package/lib/feature-libraries/modular-schema/modularChangeFormat.d.ts.map +1 -1
  408. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  409. package/lib/feature-libraries/object-forest/objectForest.js +2 -1
  410. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  411. package/lib/feature-libraries/optional-field/index.d.ts +1 -1
  412. package/lib/feature-libraries/optional-field/index.d.ts.map +1 -1
  413. package/lib/feature-libraries/optional-field/index.js.map +1 -1
  414. package/lib/feature-libraries/optional-field/optionalFieldCodecs.d.ts.map +1 -1
  415. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js +1 -5
  416. package/lib/feature-libraries/optional-field/optionalFieldCodecs.js.map +1 -1
  417. package/lib/feature-libraries/schema-index/codec.d.ts.map +1 -1
  418. package/lib/feature-libraries/schema-index/codec.js +5 -3
  419. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  420. package/lib/feature-libraries/{default-schema/schemaChecker.d.ts → schemaChecker.d.ts} +2 -2
  421. package/lib/feature-libraries/schemaChecker.d.ts.map +1 -0
  422. package/lib/feature-libraries/{default-schema/schemaChecker.js → schemaChecker.js} +3 -3
  423. package/lib/feature-libraries/schemaChecker.js.map +1 -0
  424. package/lib/feature-libraries/sequence-field/formatV2.d.ts.map +1 -1
  425. package/lib/feature-libraries/sequence-field/formatV2.js +1 -0
  426. package/lib/feature-libraries/sequence-field/formatV2.js.map +1 -1
  427. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.d.ts.map +1 -1
  428. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js +0 -2
  429. package/lib/feature-libraries/sequence-field/sequenceFieldCodecs.js.map +1 -1
  430. package/lib/feature-libraries/treeCompressionUtils.d.ts +2 -12
  431. package/lib/feature-libraries/treeCompressionUtils.d.ts.map +1 -1
  432. package/lib/feature-libraries/treeCompressionUtils.js +3 -13
  433. package/lib/feature-libraries/treeCompressionUtils.js.map +1 -1
  434. package/lib/index.d.ts +4 -4
  435. package/lib/index.d.ts.map +1 -1
  436. package/lib/index.js +3 -3
  437. package/lib/index.js.map +1 -1
  438. package/lib/packageVersion.d.ts +1 -1
  439. package/lib/packageVersion.d.ts.map +1 -1
  440. package/lib/packageVersion.js +1 -1
  441. package/lib/packageVersion.js.map +1 -1
  442. package/lib/shared-tree/index.d.ts +1 -1
  443. package/lib/shared-tree/index.d.ts.map +1 -1
  444. package/lib/shared-tree/index.js +1 -1
  445. package/lib/shared-tree/index.js.map +1 -1
  446. package/lib/shared-tree/sharedTree.d.ts +7 -54
  447. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  448. package/lib/shared-tree/sharedTree.js +1 -51
  449. package/lib/shared-tree/sharedTree.js.map +1 -1
  450. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +1 -1
  451. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  452. package/lib/shared-tree/sharedTreeChangeCodecs.js +0 -2
  453. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  454. package/lib/shared-tree/sharedTreeChangeFamily.d.ts +2 -2
  455. package/lib/shared-tree/sharedTreeChangeFamily.d.ts.map +1 -1
  456. package/lib/shared-tree/sharedTreeChangeFamily.js.map +1 -1
  457. package/lib/shared-tree/treeCheckout.d.ts +2 -2
  458. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  459. package/lib/shared-tree/treeCheckout.js.map +1 -1
  460. package/lib/shared-tree-core/editManagerCodecs.d.ts.map +1 -1
  461. package/lib/shared-tree-core/editManagerCodecs.js +13 -7
  462. package/lib/shared-tree-core/editManagerCodecs.js.map +1 -1
  463. package/lib/shared-tree-core/editManagerFormatCommons.d.ts +3 -4
  464. package/lib/shared-tree-core/editManagerFormatCommons.d.ts.map +1 -1
  465. package/lib/shared-tree-core/editManagerFormatCommons.js +4 -7
  466. package/lib/shared-tree-core/editManagerFormatCommons.js.map +1 -1
  467. package/lib/shared-tree-core/index.d.ts +3 -3
  468. package/lib/shared-tree-core/index.d.ts.map +1 -1
  469. package/lib/shared-tree-core/index.js +2 -2
  470. package/lib/shared-tree-core/index.js.map +1 -1
  471. package/lib/shared-tree-core/messageCodecs.d.ts.map +1 -1
  472. package/lib/shared-tree-core/messageCodecs.js +21 -10
  473. package/lib/shared-tree-core/messageCodecs.js.map +1 -1
  474. package/lib/shared-tree-core/messageFormat.d.ts +4 -6
  475. package/lib/shared-tree-core/messageFormat.d.ts.map +1 -1
  476. package/lib/shared-tree-core/messageFormat.js +8 -6
  477. package/lib/shared-tree-core/messageFormat.js.map +1 -1
  478. package/lib/simple-tree/api/configuration.d.ts +2 -0
  479. package/lib/simple-tree/api/configuration.d.ts.map +1 -1
  480. package/lib/simple-tree/api/configuration.js +10 -0
  481. package/lib/simple-tree/api/configuration.js.map +1 -1
  482. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +15 -12
  483. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -1
  484. package/lib/simple-tree/api/incrementalAllowedTypes.js +15 -12
  485. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -1
  486. package/lib/simple-tree/api/index.d.ts +2 -1
  487. package/lib/simple-tree/api/index.d.ts.map +1 -1
  488. package/lib/simple-tree/api/index.js +2 -1
  489. package/lib/simple-tree/api/index.js.map +1 -1
  490. package/lib/simple-tree/api/schemaFromSimple.d.ts.map +1 -1
  491. package/lib/simple-tree/api/schemaFromSimple.js +8 -2
  492. package/lib/simple-tree/api/schemaFromSimple.js.map +1 -1
  493. package/lib/simple-tree/api/simpleSchemaCodec.js +5 -7
  494. package/lib/simple-tree/api/simpleSchemaCodec.js.map +1 -1
  495. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts +103 -0
  496. package/lib/simple-tree/api/snapshotCompatibilityChecker.d.ts.map +1 -0
  497. package/lib/simple-tree/api/snapshotCompatibilityChecker.js +122 -0
  498. package/lib/simple-tree/api/snapshotCompatibilityChecker.js.map +1 -0
  499. package/lib/simple-tree/api/tree.d.ts +2 -2
  500. package/lib/simple-tree/api/tree.js +1 -1
  501. package/lib/simple-tree/api/tree.js.map +1 -1
  502. package/lib/simple-tree/core/allowedTypes.js +1 -1
  503. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  504. package/lib/simple-tree/core/index.d.ts +3 -3
  505. package/lib/simple-tree/core/index.d.ts.map +1 -1
  506. package/lib/simple-tree/core/index.js +2 -2
  507. package/lib/simple-tree/core/index.js.map +1 -1
  508. package/lib/simple-tree/core/toStored.d.ts +12 -5
  509. package/lib/simple-tree/core/toStored.d.ts.map +1 -1
  510. package/lib/simple-tree/core/toStored.js +25 -9
  511. package/lib/simple-tree/core/toStored.js.map +1 -1
  512. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  513. package/lib/simple-tree/core/treeNodeKernel.js +1 -0
  514. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  515. package/lib/simple-tree/core/treeNodeSchema.d.ts +1 -6
  516. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  517. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  518. package/lib/simple-tree/core/treeNodeValid.d.ts +1 -1
  519. package/lib/simple-tree/core/treeNodeValid.d.ts.map +1 -1
  520. package/lib/simple-tree/core/treeNodeValid.js +1 -2
  521. package/lib/simple-tree/core/treeNodeValid.js.map +1 -1
  522. package/lib/simple-tree/fieldSchema.d.ts.map +1 -1
  523. package/lib/simple-tree/fieldSchema.js +2 -9
  524. package/lib/simple-tree/fieldSchema.js.map +1 -1
  525. package/lib/simple-tree/index.d.ts +3 -3
  526. package/lib/simple-tree/index.d.ts.map +1 -1
  527. package/lib/simple-tree/index.js +3 -3
  528. package/lib/simple-tree/index.js.map +1 -1
  529. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  530. package/lib/simple-tree/leafNodeSchema.js +1 -2
  531. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  532. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  533. package/lib/simple-tree/node-kinds/array/arrayNode.js +16 -51
  534. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  535. package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
  536. package/lib/simple-tree/node-kinds/map/mapNode.js +3 -7
  537. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  538. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  539. package/lib/simple-tree/node-kinds/object/objectNode.js +4 -11
  540. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  541. package/lib/simple-tree/node-kinds/record/recordNode.d.ts.map +1 -1
  542. package/lib/simple-tree/node-kinds/record/recordNode.js +3 -7
  543. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  544. package/lib/simple-tree/simpleSchema.d.ts +15 -3
  545. package/lib/simple-tree/simpleSchema.d.ts.map +1 -1
  546. package/lib/simple-tree/simpleSchema.js.map +1 -1
  547. package/lib/simple-tree/toStoredSchema.d.ts +20 -8
  548. package/lib/simple-tree/toStoredSchema.d.ts.map +1 -1
  549. package/lib/simple-tree/toStoredSchema.js +28 -24
  550. package/lib/simple-tree/toStoredSchema.js.map +1 -1
  551. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  552. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +20 -17
  553. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  554. package/lib/tableSchema.d.ts +22 -52
  555. package/lib/tableSchema.d.ts.map +1 -1
  556. package/lib/tableSchema.js +143 -279
  557. package/lib/tableSchema.js.map +1 -1
  558. package/lib/treeFactory.d.ts +5 -0
  559. package/lib/treeFactory.d.ts.map +1 -1
  560. package/lib/treeFactory.js +10 -4
  561. package/lib/treeFactory.js.map +1 -1
  562. package/lib/util/arrayUtilities.d.ts +45 -0
  563. package/lib/util/arrayUtilities.d.ts.map +1 -0
  564. package/lib/util/arrayUtilities.js +69 -0
  565. package/lib/util/arrayUtilities.js.map +1 -0
  566. package/lib/util/breakable.js +3 -3
  567. package/lib/util/breakable.js.map +1 -1
  568. package/lib/util/index.d.ts +1 -0
  569. package/lib/util/index.d.ts.map +1 -1
  570. package/lib/util/index.js +1 -0
  571. package/lib/util/index.js.map +1 -1
  572. package/lib/util/typeCheckTests.d.ts.map +1 -1
  573. package/lib/util/typeCheckTests.js.map +1 -1
  574. package/package.json +22 -22
  575. package/src/api.ts +22 -11
  576. package/src/codec/codec.ts +10 -2
  577. package/src/codec/index.ts +1 -0
  578. package/src/codec/versioned/codec.ts +40 -2
  579. package/src/codec/versioned/index.ts +1 -0
  580. package/src/core/schema-stored/schema.ts +12 -1
  581. package/src/core/tree/detachedFieldIndexCodecs.ts +10 -3
  582. package/src/feature-libraries/README.md +1 -1
  583. package/src/feature-libraries/chunked-forest/chunkTree.ts +3 -3
  584. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +5 -0
  585. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +2 -1
  586. package/src/feature-libraries/chunked-forest/codec/codecs.ts +55 -26
  587. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +8 -3
  588. package/src/feature-libraries/chunked-forest/codec/format.ts +14 -4
  589. package/src/feature-libraries/chunked-forest/codec/formatGeneric.ts +7 -2
  590. package/src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts +5 -6
  591. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -4
  592. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +62 -9
  593. package/src/feature-libraries/chunked-forest/codec/uncompressedEncode.ts +24 -2
  594. package/src/feature-libraries/chunked-forest/index.ts +1 -1
  595. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +86 -74
  596. package/src/feature-libraries/default-schema/index.ts +1 -9
  597. package/src/feature-libraries/forest-summary/forestSummarizer.ts +2 -2
  598. package/src/feature-libraries/forest-summary/format.ts +15 -9
  599. package/src/feature-libraries/index.ts +8 -10
  600. package/src/feature-libraries/modular-schema/comparison.ts +2 -3
  601. package/src/feature-libraries/modular-schema/fieldKind.ts +90 -13
  602. package/src/feature-libraries/modular-schema/fieldKindConfiguration.ts +2 -3
  603. package/src/feature-libraries/modular-schema/genericFieldKind.ts +6 -6
  604. package/src/feature-libraries/modular-schema/index.ts +0 -1
  605. package/src/feature-libraries/modular-schema/isNeverTree.ts +7 -8
  606. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +3 -6
  607. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +13 -13
  608. package/src/feature-libraries/object-forest/objectForest.ts +2 -6
  609. package/src/feature-libraries/optional-field/index.ts +1 -0
  610. package/src/feature-libraries/optional-field/optionalFieldCodecs.ts +1 -5
  611. package/src/feature-libraries/schema-index/codec.ts +10 -3
  612. package/src/feature-libraries/{default-schema/schemaChecker.ts → schemaChecker.ts} +4 -4
  613. package/src/feature-libraries/sequence-field/formatV2.ts +1 -0
  614. package/src/feature-libraries/sequence-field/sequenceFieldCodecs.ts +0 -2
  615. package/src/feature-libraries/treeCompressionUtils.ts +1 -15
  616. package/src/index.ts +7 -1
  617. package/src/packageVersion.ts +1 -1
  618. package/src/shared-tree/index.ts +0 -1
  619. package/src/shared-tree/sharedTree.ts +12 -88
  620. package/src/shared-tree/sharedTreeChangeCodecs.ts +1 -6
  621. package/src/shared-tree/sharedTreeChangeFamily.ts +2 -2
  622. package/src/shared-tree/treeCheckout.ts +2 -2
  623. package/src/shared-tree-core/editManagerCodecs.ts +19 -7
  624. package/src/shared-tree-core/editManagerFormatCommons.ts +11 -12
  625. package/src/shared-tree-core/index.ts +7 -3
  626. package/src/shared-tree-core/messageCodecs.ts +32 -17
  627. package/src/shared-tree-core/messageFormat.ts +8 -6
  628. package/src/simple-tree/api/configuration.ts +17 -4
  629. package/src/simple-tree/api/incrementalAllowedTypes.ts +20 -18
  630. package/src/simple-tree/api/index.ts +6 -1
  631. package/src/simple-tree/api/schemaFromSimple.ts +14 -6
  632. package/src/simple-tree/api/simpleSchemaCodec.ts +10 -9
  633. package/src/simple-tree/api/snapshotCompatibilityChecker.ts +135 -0
  634. package/src/simple-tree/api/tree.ts +2 -2
  635. package/src/simple-tree/core/allowedTypes.ts +1 -1
  636. package/src/simple-tree/core/index.ts +3 -1
  637. package/src/simple-tree/core/toStored.ts +42 -18
  638. package/src/simple-tree/core/treeNodeKernel.ts +1 -0
  639. package/src/simple-tree/core/treeNodeSchema.ts +1 -7
  640. package/src/simple-tree/core/treeNodeValid.ts +0 -2
  641. package/src/simple-tree/fieldSchema.ts +2 -11
  642. package/src/simple-tree/index.ts +7 -2
  643. package/src/simple-tree/leafNodeSchema.ts +1 -2
  644. package/src/simple-tree/node-kinds/array/arrayNode.ts +28 -75
  645. package/src/simple-tree/node-kinds/map/mapNode.ts +1 -15
  646. package/src/simple-tree/node-kinds/object/objectNode.ts +4 -18
  647. package/src/simple-tree/node-kinds/record/recordNode.ts +1 -15
  648. package/src/simple-tree/simpleSchema.ts +16 -3
  649. package/src/simple-tree/toStoredSchema.ts +54 -38
  650. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +22 -17
  651. package/src/tableSchema.ts +110 -334
  652. package/src/treeFactory.ts +13 -4
  653. package/src/util/arrayUtilities.ts +88 -0
  654. package/src/util/breakable.ts +4 -4
  655. package/src/util/index.ts +6 -0
  656. package/src/util/typeCheckTests.ts +0 -1
  657. package/dist/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
  658. package/dist/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
  659. package/dist/feature-libraries/default-schema/defaultSchema.js +0 -15
  660. package/dist/feature-libraries/default-schema/defaultSchema.js.map +0 -1
  661. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
  662. package/dist/feature-libraries/default-schema/schemaChecker.js.map +0 -1
  663. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
  664. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
  665. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -76
  666. package/dist/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
  667. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
  668. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
  669. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -158
  670. package/dist/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
  671. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
  672. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
  673. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -245
  674. package/dist/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
  675. package/lib/feature-libraries/default-schema/defaultSchema.d.ts +0 -10
  676. package/lib/feature-libraries/default-schema/defaultSchema.d.ts.map +0 -1
  677. package/lib/feature-libraries/default-schema/defaultSchema.js +0 -12
  678. package/lib/feature-libraries/default-schema/defaultSchema.js.map +0 -1
  679. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +0 -1
  680. package/lib/feature-libraries/default-schema/schemaChecker.js.map +0 -1
  681. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts +0 -50
  682. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.d.ts.map +0 -1
  683. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js +0 -71
  684. package/lib/feature-libraries/modular-schema/fieldKindWithEditor.js.map +0 -1
  685. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts +0 -12
  686. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.d.ts.map +0 -1
  687. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js +0 -154
  688. package/lib/feature-libraries/optional-field/optionalFieldCodecV1.js.map +0 -1
  689. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts +0 -11
  690. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.d.ts.map +0 -1
  691. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js +0 -241
  692. package/lib/feature-libraries/sequence-field/sequenceFieldCodecV1.js.map +0 -1
  693. package/src/feature-libraries/default-schema/defaultSchema.ts +0 -15
  694. package/src/feature-libraries/modular-schema/fieldKindWithEditor.ts +0 -108
  695. package/src/feature-libraries/optional-field/optionalFieldCodecV1.ts +0 -208
  696. package/src/feature-libraries/sequence-field/sequenceFieldCodecV1.ts +0 -344
@@ -0,0 +1,69 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
6
+ /**
7
+ * Validates that the provided index is a safe integer.
8
+ * @throws If the index is invalid.
9
+ * @param index - The index to validate.
10
+ * @param apiName - The name of the API performing the validation.
11
+ * @throws If the index is invalid.
12
+ */
13
+ export function validateSafeInteger(index, apiName) {
14
+ if (!Number.isSafeInteger(index)) {
15
+ throw new UsageError(`Expected a safe integer passed to ${apiName}, got ${index}.`);
16
+ }
17
+ }
18
+ /**
19
+ * Validates that the provided index is a 0 or greater safe integer.
20
+ * @param index - The index to validate.
21
+ * @param apiName - The name of the API performing the validation.
22
+ * @throws If the index is invalid.
23
+ */
24
+ export function validatePositiveIndex(index, apiName) {
25
+ validateSafeInteger(index, apiName);
26
+ if (index < 0) {
27
+ throw new UsageError(`Expected non-negative index passed to ${apiName}, got ${index}.`);
28
+ }
29
+ }
30
+ /**
31
+ * Validates that the provided index is a non-negative safe integer within the bounds of the provided array (or, optionally, 1 past its end).
32
+ * @throws If the index is invalid.
33
+ * @param index - The index to validate.
34
+ * @param array - The array to validate against.
35
+ * @param apiName - The name of the API performing the validation.
36
+ * @param allowOnePastEnd - Whether to allow the index to be one past the end of the array.
37
+ */
38
+ export function validateIndex(index, array, apiName, allowOnePastEnd = false) {
39
+ validatePositiveIndex(index, apiName);
40
+ if (allowOnePastEnd) {
41
+ if (index > array.length) {
42
+ throw new UsageError(`Index value passed to ${apiName} is out of bounds. Expected at most ${array.length}, got ${index}.`);
43
+ }
44
+ }
45
+ else {
46
+ if (index >= array.length) {
47
+ throw new UsageError(`Index value passed to ${apiName} is out of bounds. Expected at most ${array.length - 1}, got ${index}.`);
48
+ }
49
+ }
50
+ }
51
+ /**
52
+ * Validates that the provided range `[startIndex, endIndex)` is valid and within the bounds of the provided array.
53
+ * @remarks
54
+ * This is intended for ranges which are inclusive for the lower bound, and exclusive for the upper bound,
55
+ * and permits 0 length ranges, even `[array.length, array.length)`.
56
+ * @throws If the index is invalid.
57
+ * @param startIndex - The index that starts the range (inclusive).
58
+ * @param endIndex - The index that ends the range (exclusive).
59
+ * @param array - The array to validate against.
60
+ * @param apiName - The name of the API performing the validation.
61
+ */
62
+ export function validateIndexRange(startIndex, endIndex, array, apiName) {
63
+ if (startIndex > endIndex) {
64
+ throw new UsageError(`Malformed range passed to ${apiName}. Start index ${startIndex} is greater than end index ${endIndex}.`);
65
+ }
66
+ validateIndex(startIndex, array, apiName, true);
67
+ validateIndex(endIndex, array, apiName, true);
68
+ }
69
+ //# sourceMappingURL=arrayUtilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrayUtilities.js","sourceRoot":"","sources":["../../src/util/arrayUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,OAAe;IACjE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,UAAU,CAAC,qCAAqC,OAAO,SAAS,KAAK,GAAG,CAAC,CAAC;IACrF,CAAC;AACF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAa,EAAE,OAAe;IACnE,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,UAAU,CAAC,yCAAyC,OAAO,SAAS,KAAK,GAAG,CAAC,CAAC;IACzF,CAAC;AACF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC5B,KAAa,EACb,KAAkC,EAClC,OAAe,EACf,kBAA2B,KAAK;IAEhC,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACtC,IAAI,eAAe,EAAE,CAAC;QACrB,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC1B,MAAM,IAAI,UAAU,CACnB,yBAAyB,OAAO,uCAAuC,KAAK,CAAC,MAAM,SAAS,KAAK,GAAG,CACpG,CAAC;QACH,CAAC;IACF,CAAC;SAAM,CAAC;QACP,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YAC3B,MAAM,IAAI,UAAU,CACnB,yBAAyB,OAAO,uCAAuC,KAAK,CAAC,MAAM,GAAG,CAAC,SAAS,KAAK,GAAG,CACxG,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CACjC,UAAkB,EAClB,QAAgB,EAChB,KAAkC,EAClC,OAAe;IAEf,IAAI,UAAU,GAAG,QAAQ,EAAE,CAAC;QAC3B,MAAM,IAAI,UAAU,CACnB,6BAA6B,OAAO,iBAAiB,UAAU,8BAA8B,QAAQ,GAAG,CACxG,CAAC;IACH,CAAC;IACD,aAAa,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAChD,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Validates that the provided index is a safe integer.\n * @throws If the index is invalid.\n * @param index - The index to validate.\n * @param apiName - The name of the API performing the validation.\n * @throws If the index is invalid.\n */\nexport function validateSafeInteger(index: number, apiName: string): void {\n\tif (!Number.isSafeInteger(index)) {\n\t\tthrow new UsageError(`Expected a safe integer passed to ${apiName}, got ${index}.`);\n\t}\n}\n\n/**\n * Validates that the provided index is a 0 or greater safe integer.\n * @param index - The index to validate.\n * @param apiName - The name of the API performing the validation.\n * @throws If the index is invalid.\n */\nexport function validatePositiveIndex(index: number, apiName: string): void {\n\tvalidateSafeInteger(index, apiName);\n\tif (index < 0) {\n\t\tthrow new UsageError(`Expected non-negative index passed to ${apiName}, got ${index}.`);\n\t}\n}\n\n/**\n * Validates that the provided index is a non-negative safe integer within the bounds of the provided array (or, optionally, 1 past its end).\n * @throws If the index is invalid.\n * @param index - The index to validate.\n * @param array - The array to validate against.\n * @param apiName - The name of the API performing the validation.\n * @param allowOnePastEnd - Whether to allow the index to be one past the end of the array.\n */\nexport function validateIndex(\n\tindex: number,\n\tarray: { readonly length: number },\n\tapiName: string,\n\tallowOnePastEnd: boolean = false,\n): void {\n\tvalidatePositiveIndex(index, apiName);\n\tif (allowOnePastEnd) {\n\t\tif (index > array.length) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Index value passed to ${apiName} is out of bounds. Expected at most ${array.length}, got ${index}.`,\n\t\t\t);\n\t\t}\n\t} else {\n\t\tif (index >= array.length) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Index value passed to ${apiName} is out of bounds. Expected at most ${array.length - 1}, got ${index}.`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Validates that the provided range `[startIndex, endIndex)` is valid and within the bounds of the provided array.\n * @remarks\n * This is intended for ranges which are inclusive for the lower bound, and exclusive for the upper bound,\n * and permits 0 length ranges, even `[array.length, array.length)`.\n * @throws If the index is invalid.\n * @param startIndex - The index that starts the range (inclusive).\n * @param endIndex - The index that ends the range (exclusive).\n * @param array - The array to validate against.\n * @param apiName - The name of the API performing the validation.\n */\nexport function validateIndexRange(\n\tstartIndex: number,\n\tendIndex: number,\n\tarray: { readonly length: number },\n\tapiName: string,\n): void {\n\tif (startIndex > endIndex) {\n\t\tthrow new UsageError(\n\t\t\t`Malformed range passed to ${apiName}. Start index ${startIndex} is greater than end index ${endIndex}.`,\n\t\t);\n\t}\n\tvalidateIndex(startIndex, array, apiName, true);\n\tvalidateIndex(endIndex, array, apiName, true);\n}\n"]}
@@ -131,19 +131,19 @@ export function throwIfBroken(target, context) {
131
131
  nameFunctionFrom(replacementMethod, target);
132
132
  return replacementMethod;
133
133
  }
134
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types
134
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
135
135
  function nameFunctionFrom(toName, nameFrom) {
136
136
  toName.displayName =
137
137
  nameFrom.displayName ?? nameFrom.name;
138
138
  }
139
139
  const isBreakerSymbol = Symbol("isBreaker");
140
140
  // Accepting any function like value is desired and safe here as this does not call the provided function.
141
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types
141
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
142
142
  function markBreaker(f) {
143
143
  f[isBreakerSymbol] = true;
144
144
  }
145
145
  // Accepting any function like value is desired and safe here as this does not call the provided function.
146
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types
146
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
147
147
  function isBreaker(f) {
148
148
  return isBreakerSymbol in f;
149
149
  }
@@ -1 +1 @@
1
- {"version":3,"file":"breakable.js","sourceRoot":"","sources":["../../src/util/breakable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,OAAO,SAAS;IAGrB;IACC;;;;OAIG;IACc,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAC3B,CAAC;IAEJ;;;;OAIG;IACI,GAAG;QACT,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,KAAK,GAAG,IAAI,UAAU,CAC3B,kBAAkB,IAAI,CAAC,IAAI,+EAA+E,IAAI,CAAC,QAAQ,EAAE,CACzH,CAAC;YAEF,+GAA+G;YAC/G,mGAAmG;YACnG,6DAA6D;YAC5D,KAA6B,CAAC,KAAK;gBAClC,IAAI,CAAC,QAAgC,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC;YAE/D,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,QAAe;QAC3B,2FAA2F;QAC3F,0KAA0K;QAC1K,IAAI,IAAI,CAAC,QAAQ,KAAK,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,aAAa,CAAC,CAAC,CAAC;IAEjE,IAAI,SAAS,GAAkB,MAAM,CAAC,SAAS,CAAC;IAChD,OAAO,SAAS,KAAK,IAAI,EAAE,CAAC;QAC3B,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzB,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACnB,MAAM,UAAU,GAAG,OAAO,CAAC,wBAAwB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;gBACpE,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;oBAC9B,SAAS;oBACT,IAAI,OAAO,UAAU,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;wBAC5C,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;4BAClC,gKAAgK;4BAChK,UAAU,CAAC,KAAK,GAAG,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;4BACpD,MAAM,CAAC,cAAc,CAAC,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;wBACtE,CAAC;oBACF,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QACD,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC3B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * An object which can enter a \"broken\" state where trying to use it is a UsageError.\n * @remarks\n * Use {@link WithBreakable} to apply this to another object.\n * @sealed\n */\nexport class Breakable {\n\tprivate brokenBy?: Error;\n\n\tpublic constructor(\n\t\t/**\n\t\t * A name for a given breakable scope.\n\t\t * @remarks\n\t\t * This is useful for documenting the semantics of a given Breakable and when inspecting things in the debugger, but is currently otherwise unused.\n\t\t */\n\t\tprivate readonly name: string,\n\t) {}\n\n\t/**\n\t * Throws if this object is in the broken state.\n\t * @remarks\n\t * Can use {@link throwIfBroken} to apply this to a method.\n\t */\n\tpublic use(): void {\n\t\tif (this.brokenBy !== undefined) {\n\t\t\tconst error = new UsageError(\n\t\t\t\t`Invalid use of ${this.name} after it was put into an invalid state by another error.\\nOriginal Error:\\n${this.brokenBy}`,\n\t\t\t);\n\n\t\t\t// This \"cause\" field is added in ES2022, but using if even without that built in support, it is still helpful.\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause\n\t\t\t// TODO: remove this cast when targeting ES2022 lib or later.\n\t\t\t(error as { cause?: unknown }).cause =\n\t\t\t\t(this.brokenBy as { cause?: unknown }).cause ?? this.brokenBy;\n\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Puts this object into the broken state, and throws an error.\n\t *\n\t * @throws If already broken by a different error, throws a UsageError, otherwise throws `brokenBy`.\n\t */\n\tpublic break(brokenBy: Error): never {\n\t\t// If already broken by this error, let it bubble up without rethrowing a modified version.\n\t\t// This prevents internal errors like asserts getting rethrown as different errors when wrapped with multiple call to `{@link Breakable.run}` or `{@link breakingMethod}`.\n\t\tif (this.brokenBy !== brokenBy) {\n\t\t\tthis.use();\n\t\t\tthis.brokenBy = brokenBy;\n\t\t}\n\t\tthrow brokenBy;\n\t}\n\n\t/**\n\t * {@link Breakable.break}, except tolerates `unknown` to be more easily used by catch blocks.\n\t * @privateRemarks\n\t * If there is a use-case, this should be made public.\n\t */\n\tprivate rethrowCaught(brokenBy: unknown): never {\n\t\tif (brokenBy instanceof Error) {\n\t\t\tthis.break(brokenBy);\n\t\t}\n\t\tthis.break(\n\t\t\tnew Error(`Non-error thrown breaking ${this.name}. Thrown value: \"${brokenBy}\"`),\n\t\t);\n\t}\n\n\t/**\n\t * Runs code which should break the object if it throws.\n\t * @remarks\n\t * Like {@link Breakable.use}, this also throws if already broken.\n\t * Any exceptions this catches are re-thrown.\n\t * Can use {@link breakingMethod} to apply this to a method.\n\t */\n\tpublic run<TResult>(breaker: () => TResult): TResult {\n\t\tthis.use();\n\t\ttry {\n\t\t\treturn breaker();\n\t\t} catch (error: unknown) {\n\t\t\tthis.rethrowCaught(error);\n\t\t}\n\t}\n\n\t/**\n\t * Clears the existing broken state.\n\t * @remarks\n\t * This is rarely safe to to: it is only ok when all objects using this breaker are known to not have been left in an invalid state.\n\t * This is pretty much only safe in tests which just were checking a specific error was thrown, and which know that error closepath is actually exception safe.\n\t */\n\tpublic clearError(): void {\n\t\tassert(this.brokenBy !== undefined, 0x9b6 /* No error to clear */);\n\t\tthis.brokenBy = undefined;\n\t}\n}\n\n/**\n * Marks an object as being able to be in a broken state (unknown/unspecified/broken state due to unhandled exception).\n * @remarks\n * See decorators {@link breakingMethod} and {@link throwIfBroken} for ease of use.\n */\nexport interface WithBreakable {\n\t/**\n\t * The breaker for this object.\n\t * @remarks\n\t * If this `breaker` is in the broken state, the `WithBreakable` should be considered in a broken state.\n\t */\n\treadonly breaker: Breakable;\n}\n\n/**\n * Decorator for methods which should break the object when they throw.\n * @remarks\n * This also throws if already broken like {@link throwIfBroken}.\n * See {@link Breakable.run} for details.\n *\n * This should be used on methods which modify data that could result in an unsupported/broken state if an exception is thrown while modifying.\n * It is ok for breakingMethods to call each-other.\n * @privateRemarks\n * Explicitly capturing the full `Target` type is necessary to make this work with generic methods with unknown numbers of type parameters.\n */\nexport function breakingMethod<\n\tTarget extends ((...args: any[]) => unknown) & ((this: This, ...args: Args) => Return),\n\tThis extends WithBreakable,\n\tArgs extends never[],\n\tReturn,\n>(target: Target, context?: ClassMethodDecoratorContext<This, Target>): Target {\n\tfunction replacementMethod(this: This, ...args: Args): Return {\n\t\tif (this.breaker === undefined) {\n\t\t\t// This case is necessary for when wrapping methods which are invoked inside the constructor of the base class before `breaker` is set.\n\t\t\t// Since the constructor throwing does not return an object, failing to put it into a broken state is not too bad.\n\t\t\t// However when more than just the constructed object should be broken, this can result in missing a break.\n\t\t\treturn target.call(this, ...args);\n\t\t}\n\t\treturn this.breaker.run(() => {\n\t\t\treturn target.call(this, ...args);\n\t\t});\n\t}\n\tmarkBreaker(replacementMethod);\n\tnameFunctionFrom(replacementMethod, target);\n\treturn replacementMethod as Target;\n}\n\n/**\n * Decorator for methods which should throw if the object is in a broken state.\n * @remarks\n * This should be used on methods which read data that could be invalid when the object is broken.\n * @privateRemarks\n * Explicitly capturing the full `Target` type is necessary to make this work with generic methods with unknown numbers of type parameters.\n */\nexport function throwIfBroken<\n\tTarget extends ((...args: any[]) => unknown) & ((this: This, ...args: Args) => Return),\n\tThis extends WithBreakable,\n\tArgs extends never[],\n\tReturn,\n>(target: Target, context: ClassMethodDecoratorContext<This, Target>): Target {\n\tfunction replacementMethod(this: This, ...args: Args): Return {\n\t\tthis.breaker.use();\n\t\treturn target.call(this, ...args);\n\t}\n\tmarkBreaker(replacementMethod);\n\tnameFunctionFrom(replacementMethod, target);\n\treturn replacementMethod as Target;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types\ntype PossiblyNamedFunction = Function & { displayName?: undefined | string };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types\nfunction nameFunctionFrom(toName: Function, nameFrom: Function): void {\n\t(toName as PossiblyNamedFunction).displayName =\n\t\t(nameFrom as PossiblyNamedFunction).displayName ?? nameFrom.name;\n}\n\nconst isBreakerSymbol: unique symbol = Symbol(\"isBreaker\");\n\n// Accepting any function like value is desired and safe here as this does not call the provided function.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types\nfunction markBreaker(f: Function): void {\n\t(f as unknown as Record<typeof isBreakerSymbol, true>)[isBreakerSymbol] = true;\n}\n\n// Accepting any function like value is desired and safe here as this does not call the provided function.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/ban-types\nfunction isBreaker(f: Function): boolean {\n\treturn isBreakerSymbol in (f as unknown as Record<typeof isBreakerSymbol, true>);\n}\n\n/**\n * Decorator for classes which should break when their methods throw.\n * @remarks\n * Applies {@link breakingMethod} to all methods declared directly by class or its base classes.\n * Does not include those on derived classes.\n * Does not include getters or setters, or value properties.\n * Methods already marked as {@link breakingMethod} or {@link throwIfBroken} are unaffected.\n */\nexport function breakingClass<Target extends abstract new (...args: any[]) => WithBreakable>(\n\ttarget: Target,\n\tcontext: ClassDecoratorContext<Target>,\n): Target {\n\t// This could extend target, but doing so adds an extra step in the prototype chain and makes the instances just show up as \"DecoratedBreakable\" in the debugger.\n\tconst DecoratedBreakable = target;\n\n\t// Keep track of what keys we have seen (and already wrapped if needed).\n\t// Used to avoid rewrapping already wrapped properties.\n\t// Preloaded with \"constructor\" to avoid wrapping the constructor as there is no need to set the broken flag when the constructor throws and does not return an object.\n\t// Avoiding wrapping the constructor also avoids messing up the displayed name in the debugger.\n\tconst doNotWrap: Set<string | symbol> = new Set([\"constructor\"]);\n\n\tlet prototype: object | null = target.prototype;\n\twhile (prototype !== null) {\n\t\tfor (const key of Reflect.ownKeys(prototype)) {\n\t\t\tif (!doNotWrap.has(key)) {\n\t\t\t\tdoNotWrap.add(key);\n\t\t\t\tconst descriptor = Reflect.getOwnPropertyDescriptor(prototype, key);\n\t\t\t\tif (descriptor !== undefined) {\n\t\t\t\t\t// Method\n\t\t\t\t\tif (typeof descriptor.value === \"function\") {\n\t\t\t\t\t\tif (!isBreaker(descriptor.value)) {\n\t\t\t\t\t\t\t// This does not affect the original class, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor\n\t\t\t\t\t\t\tdescriptor.value = breakingMethod(descriptor.value);\n\t\t\t\t\t\t\tObject.defineProperty(DecoratedBreakable.prototype, key, descriptor);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprototype = Reflect.getPrototypeOf(prototype);\n\t}\n\n\treturn DecoratedBreakable;\n}\n"]}
1
+ {"version":3,"file":"breakable.js","sourceRoot":"","sources":["../../src/util/breakable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,OAAO,SAAS;IAGrB;IACC;;;;OAIG;IACc,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAC3B,CAAC;IAEJ;;;;OAIG;IACI,GAAG;QACT,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,KAAK,GAAG,IAAI,UAAU,CAC3B,kBAAkB,IAAI,CAAC,IAAI,+EAA+E,IAAI,CAAC,QAAQ,EAAE,CACzH,CAAC;YAEF,+GAA+G;YAC/G,mGAAmG;YACnG,6DAA6D;YAC5D,KAA6B,CAAC,KAAK;gBAClC,IAAI,CAAC,QAAgC,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC;YAE/D,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,QAAe;QAC3B,2FAA2F;QAC3F,0KAA0K;QAC1K,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAChC,IAAI,CAAC,GAAG,EAAE,CAAC;YACX,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC1B,CAAC;QACD,MAAM,QAAQ,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACK,aAAa,CAAC,QAAiB;QACtC,IAAI,QAAQ,YAAY,KAAK,EAAE,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,KAA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;gBACnB,MAAM,UAAU,GAAG,OAAO,CAAC,wBAAwB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;gBACpE,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;oBAC9B,SAAS;oBACT,IAAI,OAAO,UAAU,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;wBAC5C,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;4BAClC,gKAAgK;4BAChK,UAAU,CAAC,KAAK,GAAG,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;4BACpD,MAAM,CAAC,cAAc,CAAC,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;wBACtE,CAAC;oBACF,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;QACD,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC3B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * An object which can enter a \"broken\" state where trying to use it is a UsageError.\n * @remarks\n * Use {@link WithBreakable} to apply this to another object.\n * @sealed\n */\nexport class Breakable {\n\tprivate brokenBy?: Error;\n\n\tpublic constructor(\n\t\t/**\n\t\t * A name for a given breakable scope.\n\t\t * @remarks\n\t\t * This is useful for documenting the semantics of a given Breakable and when inspecting things in the debugger, but is currently otherwise unused.\n\t\t */\n\t\tprivate readonly name: string,\n\t) {}\n\n\t/**\n\t * Throws if this object is in the broken state.\n\t * @remarks\n\t * Can use {@link throwIfBroken} to apply this to a method.\n\t */\n\tpublic use(): void {\n\t\tif (this.brokenBy !== undefined) {\n\t\t\tconst error = new UsageError(\n\t\t\t\t`Invalid use of ${this.name} after it was put into an invalid state by another error.\\nOriginal Error:\\n${this.brokenBy}`,\n\t\t\t);\n\n\t\t\t// This \"cause\" field is added in ES2022, but using if even without that built in support, it is still helpful.\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause\n\t\t\t// TODO: remove this cast when targeting ES2022 lib or later.\n\t\t\t(error as { cause?: unknown }).cause =\n\t\t\t\t(this.brokenBy as { cause?: unknown }).cause ?? this.brokenBy;\n\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Puts this object into the broken state, and throws an error.\n\t *\n\t * @throws If already broken by a different error, throws a UsageError, otherwise throws `brokenBy`.\n\t */\n\tpublic break(brokenBy: Error): never {\n\t\t// If already broken by this error, let it bubble up without rethrowing a modified version.\n\t\t// This prevents internal errors like asserts getting rethrown as different errors when wrapped with multiple call to `{@link Breakable.run}` or `{@link breakingMethod}`.\n\t\tif (this.brokenBy !== brokenBy) {\n\t\t\tthis.use();\n\t\t\tthis.brokenBy = brokenBy;\n\t\t}\n\t\tthrow brokenBy;\n\t}\n\n\t/**\n\t * {@link Breakable.break}, except tolerates `unknown` to be more easily used by catch blocks.\n\t * @privateRemarks\n\t * If there is a use-case, this should be made public.\n\t */\n\tprivate rethrowCaught(brokenBy: unknown): never {\n\t\tif (brokenBy instanceof Error) {\n\t\t\tthis.break(brokenBy);\n\t\t}\n\t\tthis.break(\n\t\t\tnew Error(`Non-error thrown breaking ${this.name}. Thrown value: \"${brokenBy}\"`),\n\t\t);\n\t}\n\n\t/**\n\t * Runs code which should break the object if it throws.\n\t * @remarks\n\t * Like {@link Breakable.use}, this also throws if already broken.\n\t * Any exceptions this catches are re-thrown.\n\t * Can use {@link breakingMethod} to apply this to a method.\n\t */\n\tpublic run<TResult>(breaker: () => TResult): TResult {\n\t\tthis.use();\n\t\ttry {\n\t\t\treturn breaker();\n\t\t} catch (error: unknown) {\n\t\t\tthis.rethrowCaught(error);\n\t\t}\n\t}\n\n\t/**\n\t * Clears the existing broken state.\n\t * @remarks\n\t * This is rarely safe to to: it is only ok when all objects using this breaker are known to not have been left in an invalid state.\n\t * This is pretty much only safe in tests which just were checking a specific error was thrown, and which know that error closepath is actually exception safe.\n\t */\n\tpublic clearError(): void {\n\t\tassert(this.brokenBy !== undefined, 0x9b6 /* No error to clear */);\n\t\tthis.brokenBy = undefined;\n\t}\n}\n\n/**\n * Marks an object as being able to be in a broken state (unknown/unspecified/broken state due to unhandled exception).\n * @remarks\n * See decorators {@link breakingMethod} and {@link throwIfBroken} for ease of use.\n */\nexport interface WithBreakable {\n\t/**\n\t * The breaker for this object.\n\t * @remarks\n\t * If this `breaker` is in the broken state, the `WithBreakable` should be considered in a broken state.\n\t */\n\treadonly breaker: Breakable;\n}\n\n/**\n * Decorator for methods which should break the object when they throw.\n * @remarks\n * This also throws if already broken like {@link throwIfBroken}.\n * See {@link Breakable.run} for details.\n *\n * This should be used on methods which modify data that could result in an unsupported/broken state if an exception is thrown while modifying.\n * It is ok for breakingMethods to call each-other.\n * @privateRemarks\n * Explicitly capturing the full `Target` type is necessary to make this work with generic methods with unknown numbers of type parameters.\n */\nexport function breakingMethod<\n\tTarget extends ((...args: any[]) => unknown) & ((this: This, ...args: Args) => Return),\n\tThis extends WithBreakable,\n\tArgs extends never[],\n\tReturn,\n>(target: Target, context?: ClassMethodDecoratorContext<This, Target>): Target {\n\tfunction replacementMethod(this: This, ...args: Args): Return {\n\t\tif (this.breaker === undefined) {\n\t\t\t// This case is necessary for when wrapping methods which are invoked inside the constructor of the base class before `breaker` is set.\n\t\t\t// Since the constructor throwing does not return an object, failing to put it into a broken state is not too bad.\n\t\t\t// However when more than just the constructed object should be broken, this can result in missing a break.\n\t\t\treturn target.call(this, ...args);\n\t\t}\n\t\treturn this.breaker.run(() => {\n\t\t\treturn target.call(this, ...args);\n\t\t});\n\t}\n\tmarkBreaker(replacementMethod);\n\tnameFunctionFrom(replacementMethod, target);\n\treturn replacementMethod as Target;\n}\n\n/**\n * Decorator for methods which should throw if the object is in a broken state.\n * @remarks\n * This should be used on methods which read data that could be invalid when the object is broken.\n * @privateRemarks\n * Explicitly capturing the full `Target` type is necessary to make this work with generic methods with unknown numbers of type parameters.\n */\nexport function throwIfBroken<\n\tTarget extends ((...args: any[]) => unknown) & ((this: This, ...args: Args) => Return),\n\tThis extends WithBreakable,\n\tArgs extends never[],\n\tReturn,\n>(target: Target, context: ClassMethodDecoratorContext<This, Target>): Target {\n\tfunction replacementMethod(this: This, ...args: Args): Return {\n\t\tthis.breaker.use();\n\t\treturn target.call(this, ...args);\n\t}\n\tmarkBreaker(replacementMethod);\n\tnameFunctionFrom(replacementMethod, target);\n\treturn replacementMethod as Target;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ntype PossiblyNamedFunction = Function & { displayName?: undefined | string };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nfunction nameFunctionFrom(toName: Function, nameFrom: Function): void {\n\t(toName as PossiblyNamedFunction).displayName =\n\t\t(nameFrom as PossiblyNamedFunction).displayName ?? nameFrom.name;\n}\n\nconst isBreakerSymbol: unique symbol = Symbol(\"isBreaker\");\n\n// Accepting any function like value is desired and safe here as this does not call the provided function.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nfunction markBreaker(f: Function): void {\n\t(f as unknown as Record<typeof isBreakerSymbol, true>)[isBreakerSymbol] = true;\n}\n\n// Accepting any function like value is desired and safe here as this does not call the provided function.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nfunction isBreaker(f: Function): boolean {\n\treturn isBreakerSymbol in (f as unknown as Record<typeof isBreakerSymbol, true>);\n}\n\n/**\n * Decorator for classes which should break when their methods throw.\n * @remarks\n * Applies {@link breakingMethod} to all methods declared directly by class or its base classes.\n * Does not include those on derived classes.\n * Does not include getters or setters, or value properties.\n * Methods already marked as {@link breakingMethod} or {@link throwIfBroken} are unaffected.\n */\nexport function breakingClass<Target extends abstract new (...args: any[]) => WithBreakable>(\n\ttarget: Target,\n\tcontext: ClassDecoratorContext<Target>,\n): Target {\n\t// This could extend target, but doing so adds an extra step in the prototype chain and makes the instances just show up as \"DecoratedBreakable\" in the debugger.\n\tconst DecoratedBreakable = target;\n\n\t// Keep track of what keys we have seen (and already wrapped if needed).\n\t// Used to avoid rewrapping already wrapped properties.\n\t// Preloaded with \"constructor\" to avoid wrapping the constructor as there is no need to set the broken flag when the constructor throws and does not return an object.\n\t// Avoiding wrapping the constructor also avoids messing up the displayed name in the debugger.\n\tconst doNotWrap: Set<string | symbol> = new Set([\"constructor\"]);\n\n\tlet prototype: object | null = target.prototype;\n\twhile (prototype !== null) {\n\t\tfor (const key of Reflect.ownKeys(prototype)) {\n\t\t\tif (!doNotWrap.has(key)) {\n\t\t\t\tdoNotWrap.add(key);\n\t\t\t\tconst descriptor = Reflect.getOwnPropertyDescriptor(prototype, key);\n\t\t\t\tif (descriptor !== undefined) {\n\t\t\t\t\t// Method\n\t\t\t\t\tif (typeof descriptor.value === \"function\") {\n\t\t\t\t\t\tif (!isBreaker(descriptor.value)) {\n\t\t\t\t\t\t\t// This does not affect the original class, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor\n\t\t\t\t\t\t\tdescriptor.value = breakingMethod(descriptor.value);\n\t\t\t\t\t\t\tObject.defineProperty(DecoratedBreakable.prototype, key, descriptor);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprototype = Reflect.getPrototypeOf(prototype);\n\t}\n\n\treturn DecoratedBreakable;\n}\n"]}
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ export { validateIndex, validateIndexRange, validatePositiveIndex, validateSafeInteger, } from "./arrayUtilities.js";
5
6
  export { brand, type Brand, BrandedType, type NameFromBranded, type ValueFromBranded, brandConst, } from "./brand.js";
6
7
  export { brandedNumberType, brandedStringType } from "./typeboxBrand.js";
7
8
  export { brandOpaque, extractFromOpaque, type ExtractFromOpaque, type Opaque, } from "./opaque.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,EACL,KAAK,KAAK,EACV,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,UAAU,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACN,WAAW,EACX,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,MAAM,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,KAAK,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,YAAY,EACX,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,WAAW,EACX,qBAAqB,EACrB,SAAS,EACT,KAAK,EACL,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,WAAW,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACN,SAAS,EACT,cAAc,EACd,KAAK,EACL,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,eAAe,EACf,KAAK,cAAc,E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AAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,EACL,KAAK,KAAK,EACV,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,UAAU,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACN,WAAW,EACX,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,MAAM,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,KAAK,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,YAAY,EACX,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,WAAW,EACX,qBAAqB,EACrB,SAAS,EACT,KAAK,EACL,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,WAAW,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAC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AAa,EAClB,cAAc,EACd,aAAa,EACb,aAAa,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
package/lib/util/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ export { validateIndex, validateIndexRange, validatePositiveIndex, validateSafeInteger, } from "./arrayUtilities.js";
5
6
  export { brand, BrandedType, brandConst, } from "./brand.js";
6
7
  export { brandedNumberType, brandedStringType } from "./typeboxBrand.js";
7
8
  export { brandOpaque, extractFromOpaque, } from "./opaque.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,EAEL,WAAW,EAGX,UAAU,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACN,WAAW,EACX,iBAAiB,GAGjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAGlB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAkB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAmB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAiBrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACN,SAAS,EACT,cAAc,EACd,KAAK,EACL,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,eAAe,EAKf,4BAA4B,EAC5B,SAAS,EACT,WAAW,EACX,cAAc,EAId,gBAAgB,EAChB,gBAAgB,EAChB,4BAA4B,EAC5B,WAAW,EACX,SAAS,EACT,eAAe,EAEf,YAAY,EACZ,aAAa,EAEb,UAAU,EACV,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,IAAI,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAS,EACT,wBAAwB,EACxB,qBAAqB,IAAI,YAAY,EACrC,aAAa,EACb,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAyB,MAAM,wBAAwB,CAAC;AAcrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAIN,sBAAsB,EACtB,WAAW,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,QAAQ,EAER,kBAAkB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAEN,oBAAoB,EACpB,oBAAoB,EAEpB,eAAe,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,SAAS,EAET,cAAc,EACd,aAAa,EACb,aAAa,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAmB,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tbrand,\n\ttype Brand,\n\tBrandedType,\n\ttype NameFromBranded,\n\ttype ValueFromBranded,\n\tbrandConst,\n} from \"./brand.js\";\nexport { brandedNumberType, brandedStringType } from \"./typeboxBrand.js\";\nexport {\n\tbrandOpaque,\n\textractFromOpaque,\n\ttype ExtractFromOpaque,\n\ttype Opaque,\n} from \"./opaque.js\";\nexport {\n\tdeleteFromNestedMap,\n\tgetOrAddInNestedMap,\n\tgetOrDefaultInNestedMap,\n\tforEachInNestedMap,\n\ttype NestedMap,\n\ttype ReadonlyNestedMap,\n\tSizedNestedMap,\n\tpopulateNestedMap,\n\tsetInNestedMap,\n\ttryAddToNestedMap,\n\ttryGetFromNestedMap,\n\tmapNestedMap,\n\tnestedMapToFlatList,\n\tnestedMapFromFlatList,\n\tgetOrCreateInNestedMap,\n} from \"./nestedMap.js\";\nexport { addToNestedSet, type NestedSet, nestedSetContains } from \"./nestedSet.js\";\nexport { type OffsetList, OffsetListFactory } from \"./offsetList.js\";\nexport type {\n\tareSafelyAssignable,\n\tContravariant,\n\tCovariant,\n\teitherIsAny,\n\tEnforceTypeCheckTests,\n\tInvariant,\n\tisAny,\n\tisAssignableTo,\n\tisStrictSubset,\n\tMakeNominal,\n\trequireFalse,\n\trequireTrue,\n\trequireAssignableTo,\n\tareOnlyKeys,\n} from \"./typeCheck.js\";\nexport { StackyIterator } from \"./stackyIterator.js\";\nexport {\n\tasMutable,\n\tbalancedReduce,\n\tclone,\n\tcompareSets,\n\tgetOrAddEmptyToMap,\n\tgetOrCreate,\n\tisJsonObject,\n\tisReadonlyArray,\n\ttype JsonCompatible,\n\ttype JsonCompatibleObject,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n\tJsonCompatibleReadOnlySchema,\n\tmakeArray,\n\tmapIterable,\n\tfilterIterable,\n\ttype Mutable,\n\ttype Populated,\n\ttype RecursiveReadonly,\n\tassertValidIndex,\n\tassertValidRange,\n\tassertNonNegativeSafeInteger,\n\tobjectToMap,\n\tinvertMap,\n\toneFromIterable,\n\ttype Named,\n\tcompareNamed,\n\tdisposeSymbol,\n\ttype IDisposable,\n\tcapitalize,\n\tassertValidRangeIndices,\n\ttransformObjectMap,\n\tcompareStrings,\n\tfind,\n\tcount,\n\tgetLast,\n\thasSome,\n\thasSingle,\n\tdefineLazyCachedProperty,\n\tcopyPropertyIfDefined as copyProperty,\n\tgetOrAddInMap,\n\titerableHasSome,\n} from \"./utils.js\";\nexport { ReferenceCountedBase, type ReferenceCounted } from \"./referenceCounting.js\";\n\nexport type {\n\t_RecursiveTrick,\n\tRestrictiveReadonlyRecord,\n\tRestrictiveStringRecord,\n\t_InlineTrick,\n\tFlattenKeys,\n\tIsUnion,\n\tUnionToIntersection,\n\tUnionToTuple,\n\tPopUnion,\n} from \"./typeUtils.js\";\n\nexport { unsafeArrayToTuple } from \"./typeUtils.js\";\n\nexport {\n\ttype BrandedKey,\n\ttype BrandedKeyContent,\n\ttype BrandedMapSubset,\n\tgetOrCreateSlotContent,\n\tbrandedSlot,\n} from \"./brandedMap.js\";\n\nexport {\n\tRangeMap,\n\ttype RangeQueryResult,\n\tnewIntegerRangeMap,\n} from \"./rangeMap.js\";\n\nexport {\n\ttype IdAllocator,\n\tidAllocatorFromMaxId,\n\tidAllocatorFromState,\n\ttype IdAllocationState,\n\tfakeIdAllocator,\n} from \"./idAllocator.js\";\n\nexport {\n\tBreakable,\n\ttype WithBreakable,\n\tbreakingMethod,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"./breakable.js\";\n\nexport { type TupleBTree, newTupleBTree, mergeTupleBTrees } from \"./bTreeUtils.js\";\n\nexport { cloneWithReplacements } from \"./cloneWithReplacements.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,EAEL,WAAW,EAGX,UAAU,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACN,WAAW,EACX,iBAAiB,GAGjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,u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,MAAM,iBAAiB,CAAC;AAEnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tvalidateIndex,\n\tvalidateIndexRange,\n\tvalidatePositiveIndex,\n\tvalidateSafeInteger,\n} from \"./arrayUtilities.js\";\nexport {\n\tbrand,\n\ttype Brand,\n\tBrandedType,\n\ttype NameFromBranded,\n\ttype ValueFromBranded,\n\tbrandConst,\n} from \"./brand.js\";\nexport { brandedNumberType, brandedStringType } from \"./typeboxBrand.js\";\nexport {\n\tbrandOpaque,\n\textractFromOpaque,\n\ttype ExtractFromOpaque,\n\ttype Opaque,\n} from \"./opaque.js\";\nexport {\n\tdeleteFromNestedMap,\n\tgetOrAddInNestedMap,\n\tgetOrDefaultInNestedMap,\n\tforEachInNestedMap,\n\ttype NestedMap,\n\ttype ReadonlyNestedMap,\n\tSizedNestedMap,\n\tpopulateNestedMap,\n\tsetInNestedMap,\n\ttryAddToNestedMap,\n\ttryGetFromNestedMap,\n\tmapNestedMap,\n\tnestedMapToFlatList,\n\tnestedMapFromFlatList,\n\tgetOrCreateInNestedMap,\n} from \"./nestedMap.js\";\nexport { addToNestedSet, type NestedSet, nestedSetContains } from \"./nestedSet.js\";\nexport { type OffsetList, OffsetListFactory } from \"./offsetList.js\";\nexport type {\n\tareSafelyAssignable,\n\tContravariant,\n\tCovariant,\n\teitherIsAny,\n\tEnforceTypeCheckTests,\n\tInvariant,\n\tisAny,\n\tisAssignableTo,\n\tisStrictSubset,\n\tMakeNominal,\n\trequireFalse,\n\trequireTrue,\n\trequireAssignableTo,\n\tareOnlyKeys,\n} from \"./typeCheck.js\";\nexport { StackyIterator } from \"./stackyIterator.js\";\nexport {\n\tasMutable,\n\tbalancedReduce,\n\tclone,\n\tcompareSets,\n\tgetOrAddEmptyToMap,\n\tgetOrCreate,\n\tisJsonObject,\n\tisReadonlyArray,\n\ttype JsonCompatible,\n\ttype JsonCompatibleObject,\n\ttype JsonCompatibleReadOnly,\n\ttype JsonCompatibleReadOnlyObject,\n\tJsonCompatibleReadOnlySchema,\n\tmakeArray,\n\tmapIterable,\n\tfilterIterable,\n\ttype Mutable,\n\ttype Populated,\n\ttype RecursiveReadonly,\n\tassertValidIndex,\n\tassertValidRange,\n\tassertNonNegativeSafeInteger,\n\tobjectToMap,\n\tinvertMap,\n\toneFromIterable,\n\ttype Named,\n\tcompareNamed,\n\tdisposeSymbol,\n\ttype IDisposable,\n\tcapitalize,\n\tassertValidRangeIndices,\n\ttransformObjectMap,\n\tcompareStrings,\n\tfind,\n\tcount,\n\tgetLast,\n\thasSome,\n\thasSingle,\n\tdefineLazyCachedProperty,\n\tcopyPropertyIfDefined as copyProperty,\n\tgetOrAddInMap,\n\titerableHasSome,\n} from \"./utils.js\";\nexport { ReferenceCountedBase, type ReferenceCounted } from \"./referenceCounting.js\";\n\nexport type {\n\t_RecursiveTrick,\n\tRestrictiveReadonlyRecord,\n\tRestrictiveStringRecord,\n\t_InlineTrick,\n\tFlattenKeys,\n\tIsUnion,\n\tUnionToIntersection,\n\tUnionToTuple,\n\tPopUnion,\n} from \"./typeUtils.js\";\n\nexport { unsafeArrayToTuple } from \"./typeUtils.js\";\n\nexport {\n\ttype BrandedKey,\n\ttype BrandedKeyContent,\n\ttype BrandedMapSubset,\n\tgetOrCreateSlotContent,\n\tbrandedSlot,\n} from \"./brandedMap.js\";\n\nexport {\n\tRangeMap,\n\ttype RangeQueryResult,\n\tnewIntegerRangeMap,\n} from \"./rangeMap.js\";\n\nexport {\n\ttype IdAllocator,\n\tidAllocatorFromMaxId,\n\tidAllocatorFromState,\n\ttype IdAllocationState,\n\tfakeIdAllocator,\n} from \"./idAllocator.js\";\n\nexport {\n\tBreakable,\n\ttype WithBreakable,\n\tbreakingMethod,\n\tthrowIfBroken,\n\tbreakingClass,\n} from \"./breakable.js\";\n\nexport { type TupleBTree, newTupleBTree, mergeTupleBTrees } from \"./bTreeUtils.js\";\n\nexport { cloneWithReplacements } from \"./cloneWithReplacements.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"typeCheckTests.d.ts","sourceRoot":"","sources":["../../src/util/typeCheckTests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EACX,aAAa,EACb,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,KAAK,EACL,cAAc,EACd,cAAc,EACd,YAAY,EACZ,WAAW,EACX,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AAEH,OAAO,OAAO,MAAM;CAAG;AACvB,OAAO,OAAO,MAAM;CAAG;AAEvB,OAAO,OAAO,QAAQ;IACrB,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;CAClC;AAED,OAAO,OAAO,QAAQ;IACrB,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;CAClC;AAED,OAAO,OAAO,QAAS,SAAQ,QAAQ;IACtC,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;CAClC;AAED,OAAO,OAAO,QAAS,SAAQ,QAAQ;IACtC,SAAS,CAAC,UAAU,EAAE,WAAW,CAAC;CAClC;AAED,OAAO,OAAO,OAAO,CAAC,EAAE;CAAI;AAE5B,OAAO,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACnC,SAAS,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CACpC;AAED,OAAO,OAAO,oBAAoB,CAAC,EAAE,CAAC,CAAC;IACtC,SAAS,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CACxC;AAED,OAAO,OAAO,gBAAgB,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACtC,SAAS,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CACpC;AAED,OAAO,OAAO,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,E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AC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAGtC,WAAW,CAAC,WAAW,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,GAC7D,WAAW,CAAC,WAAW,CAAC;IAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,GAC9D,YAAY,CAAC,WAAW,CAAC;IAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,CAAC,CAAC,GACzD,YAAY,CAAC,WAAW,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"typeCheckTests.js","sourceRoot":"","sources":["../../src/util/typeCheckTests.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// These tests include making sure some banned types (like `{}`) work correctly,\n// and are authored with awareness of the issues with these types.\n\n/* eslint-disable @typescript-eslint/ban-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-extraneous-class */\n\nimport type {\n\tContravariant,\n\tCovariant,\n\tInvariant,\n\tMakeNominal,\n\tareOnlyKeys,\n\tareSafelyAssignable,\n\teitherIsAny,\n\tisAny,\n\tisAssignableTo,\n\tisStrictSubset,\n\trequireFalse,\n\trequireTrue,\n} from \"./typeCheck.js\";\n\n/**\n * Checks that typeCheck's constraints work as intended.\n * Since typescript does type erasure, these tests have to be compile time checks.\n */\n\ndeclare class Empty1 {}\ndeclare class Empty2 {}\n\ndeclare class Nominal1 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Nominal2 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Derived1 extends Nominal1 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Derived2 extends Nominal1 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Generic<_T> {}\n\ndeclare class GenericCovariant<out T> {\n\tprotected _typeCheck?: Covariant<T>;\n}\n\ndeclare class GenericContravariant<in T> {\n\tprotected _typeCheck?: Contravariant<T>;\n}\n\ndeclare class GenericInvariant<in out T> {\n\tprotected _typeCheck?: Invariant<T>;\n}\n\ndeclare class GenericMulti<in out T, out K> {\n\tprotected _typeCheck?: Invariant<T> & Covariant<K>;\n}\n\ninterface GenericCovariantInterface<out T> {\n\t_typeCheck?: Covariant<T>;\n}\n\ninterface GenericContravariantInterface<in T> {\n\t_typeCheck?: Contravariant<T>;\n}\n\ninterface GenericInvariantInterface<in out T> {\n\t_typeCheck?: Invariant<T>;\n}\n\n// Check that interface can be implemented without needing extra members\ndeclare class GenericInvariantImplementation<T> implements GenericInvariantInterface<T> {}\n\n/**\n * Import this into a context where you want to be sure the TypeCheck library is functioning properly.\n *\n * It's functionality depends on compiler settings (requires several of the strict options),\n * and could break with compiler version changes.\n * Thus for maximal confidence everything is working correctly, you need to import this.\n */\nexport type EnforceTypeCheckTests =\n\t// Add dummy use of type checking types above\n\t| requireTrue<\n\t\t\tisAssignableTo<GenericInvariantImplementation<number>, GenericInvariantInterface<number>>\n\t >\n\n\t// Positive tests\n\t| requireTrue<true>\n\t| requireFalse<false>\n\n\t// test isAssignableTo for normal types\n\t| requireTrue<isAssignableTo<Empty1, Empty1>>\n\t| requireTrue<isAssignableTo<Empty1, Empty2>>\n\t| requireTrue<isAssignableTo<Nominal1, Nominal1>>\n\t| requireFalse<isAssignableTo<Nominal1, Nominal2>>\n\t| requireTrue<isAssignableTo<Derived1, Nominal1>>\n\t| requireFalse<isAssignableTo<Derived1, Derived2>>\n\t| requireTrue<isAssignableTo<Generic<Nominal1>, Generic<Nominal2>>>\n\n\t// test isAssignableTo for any\n\t| requireTrue<isAssignableTo<any, Nominal1>>\n\t| requireTrue<isAssignableTo<Nominal1, any>>\n\n\t// test isAssignableTo for unknown: all types are assignable to unknown\n\t| requireFalse<isAssignableTo<unknown, Nominal1>>\n\t| requireTrue<isAssignableTo<Nominal1, unknown>>\n\n\t// test isAssignableTo for never: all types are assignable from never\n\t| requireTrue<isAssignableTo<never, Nominal1>>\n\t| requireFalse<isAssignableTo<Nominal1, never>>\n\n\t// test Covariant\n\t| requireFalse<isAssignableTo<GenericCovariant<Nominal1>, GenericCovariant<Nominal2>>>\n\t| requireTrue<isAssignableTo<GenericCovariant<Derived1>, GenericCovariant<Nominal1>>>\n\t| requireFalse<isAssignableTo<GenericCovariant<Nominal1>, GenericCovariant<Derived1>>>\n\n\t// test Contravariant\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericContravariant<Nominal1>, GenericContravariant<Nominal2>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericContravariant<Derived1>, GenericContravariant<Nominal1>>\n\t >\n\t| requireTrue<isAssignableTo<GenericContravariant<Nominal1>, GenericContravariant<Derived1>>>\n\n\t// test Invariant\n\t| requireFalse<isAssignableTo<GenericInvariant<Nominal1>, GenericInvariant<Nominal2>>>\n\t| requireFalse<isAssignableTo<GenericInvariant<Derived1>, GenericInvariant<Nominal1>>>\n\t| requireFalse<isAssignableTo<GenericInvariant<Nominal1>, GenericInvariant<Derived1>>>\n\n\t// test Multiple parameters\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericMulti<Nominal1, number>, GenericMulti<Derived1, number>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericMulti<number, Nominal1>, GenericMulti<number, Derived1>>\n\t >\n\t| requireTrue<isAssignableTo<GenericMulti<number, Derived1>, GenericMulti<number, Nominal1>>>\n\n\t// test Covariant Interface\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericCovariantInterface<Nominal1>, GenericCovariantInterface<Nominal2>>\n\t >\n\t| requireTrue<\n\t\t\tisAssignableTo<GenericCovariantInterface<Derived1>, GenericCovariantInterface<Nominal1>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericCovariantInterface<Nominal1>, GenericCovariantInterface<Derived1>>\n\t >\n\n\t// test Contravariant Interface\n\t| requireFalse<\n\t\t\tisAssignableTo<\n\t\t\t\tGenericContravariantInterface<Nominal1>,\n\t\t\t\tGenericContravariantInterface<Nominal2>\n\t\t\t>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<\n\t\t\t\tGenericContravariantInterface<Derived1>,\n\t\t\t\tGenericContravariantInterface<Nominal1>\n\t\t\t>\n\t >\n\t| requireTrue<\n\t\t\tisAssignableTo<\n\t\t\t\tGenericContravariantInterface<Nominal1>,\n\t\t\t\tGenericContravariantInterface<Derived1>\n\t\t\t>\n\t >\n\n\t// test Invariant Interface\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericInvariantInterface<Nominal1>, GenericInvariantInterface<Nominal2>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericInvariantInterface<Derived1>, GenericInvariantInterface<Nominal1>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericInvariantInterface<Nominal1>, GenericInvariantInterface<Derived1>>\n\t >\n\n\t// test eitherIsAny\n\t| requireTrue<eitherIsAny<any, Nominal1>>\n\t| requireTrue<eitherIsAny<Nominal1, any>>\n\t| requireTrue<eitherIsAny<any, any>>\n\t| requireFalse<eitherIsAny<Nominal1, Nominal1>>\n\n\t// areSafelyAssignable tests\n\t| requireTrue<areSafelyAssignable<Nominal1, Nominal1>>\n\t| requireFalse<areSafelyAssignable<unknown, Nominal1>>\n\t| requireFalse<areSafelyAssignable<any, any>>\n\t| requireTrue<areSafelyAssignable<unknown, unknown>>\n\t| requireFalse<areSafelyAssignable<any, Nominal1>>\n\t| requireFalse<areSafelyAssignable<Nominal1, any>>\n\t| requireFalse<areSafelyAssignable<unknown, any>>\n\n\t// test isAny\n\t| requireTrue<isAny<any>>\n\t| requireFalse<isAny<unknown>>\n\t| requireFalse<isAny<Nominal1>>\n\t| requireFalse<isAny<never>>\n\t| requireFalse<isAny<{}>>\n\t| requireFalse<isAny<boolean>>\n\t| requireFalse<isAny<number | undefined>>\n\t| requireFalse<isAny<1 & \"x\">>\n\t| requireFalse<isAny<(1 & 2) | {}>>\n\n\t// test isStrictSubset\n\t| requireTrue<isStrictSubset<1, 1 | 2>>\n\t| requireTrue<isStrictSubset<[1, true], [1 | 2, true]>>\n\t| requireTrue<isStrictSubset<[1, true], [1 | 2, true | false]>>\n\t| requireTrue<isStrictSubset<[1, true], [1, true | false]>>\n\t| requireTrue<isStrictSubset<[1, true], [1, true] | [1 | false]>>\n\t| requireTrue<isStrictSubset<1, number>>\n\t| requireFalse<isStrictSubset<1, 1>>\n\t| requireFalse<isStrictSubset<1, 2>>\n\t| requireFalse<isStrictSubset<[1, true], [1, true]>>\n\t| requireFalse<isStrictSubset<1 | 2, 1>>\n\n\t// areOnlyKeys\n\t| requireTrue<areOnlyKeys<{ a: number; b: number }, \"a\" | \"b\">>\n\t| requireTrue<areOnlyKeys<{ a?: number; b: number }, \"a\" | \"b\">>\n\t| requireFalse<areOnlyKeys<{ a?: number; b: number }, \"b\">>\n\t| requireFalse<areOnlyKeys<{ a: number; b: number }, \"a\">>;\n// This case is explicitly documented as unsupported.\n// | requireFalse<areOnlyKeys<Record<string, unknown>, \"a\">>;\n\n// negative tests (should not build)\n// @ts-expect-error negative test\ntype _falseIsTrue = requireTrue<false>;\n// @ts-expect-error negative test\ntype _trueIsFalse = requireFalse<true>;\n// @ts-expect-error negative test\ntype _booleanIsTrue = requireTrue<boolean>;\n// @ts-expect-error negative test\ntype _booleanIsFalse = requireFalse<boolean>;\n// @ts-expect-error negative test\ntype _emptyNotAssignable = requireFalse<isAssignableTo<Empty1, Empty2>>;\n// @ts-expect-error negative test\ntype _numberAssignableToString = requireTrue<isAssignableTo<number, string>>;\n// @ts-expect-error negative test\ntype _anyNotAny = requireFalse<isAny<any>>;\n"]}
1
+ {"version":3,"file":"typeCheckTests.js","sourceRoot":"","sources":["../../src/util/typeCheckTests.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// These tests include making sure some banned types (like `{}`) work correctly,\n// and are authored with awareness of the issues with these types.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-extraneous-class */\n\nimport type {\n\tContravariant,\n\tCovariant,\n\tInvariant,\n\tMakeNominal,\n\tareOnlyKeys,\n\tareSafelyAssignable,\n\teitherIsAny,\n\tisAny,\n\tisAssignableTo,\n\tisStrictSubset,\n\trequireFalse,\n\trequireTrue,\n} from \"./typeCheck.js\";\n\n/**\n * Checks that typeCheck's constraints work as intended.\n * Since typescript does type erasure, these tests have to be compile time checks.\n */\n\ndeclare class Empty1 {}\ndeclare class Empty2 {}\n\ndeclare class Nominal1 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Nominal2 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Derived1 extends Nominal1 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Derived2 extends Nominal1 {\n\tprotected _typeCheck: MakeNominal;\n}\n\ndeclare class Generic<_T> {}\n\ndeclare class GenericCovariant<out T> {\n\tprotected _typeCheck?: Covariant<T>;\n}\n\ndeclare class GenericContravariant<in T> {\n\tprotected _typeCheck?: Contravariant<T>;\n}\n\ndeclare class GenericInvariant<in out T> {\n\tprotected _typeCheck?: Invariant<T>;\n}\n\ndeclare class GenericMulti<in out T, out K> {\n\tprotected _typeCheck?: Invariant<T> & Covariant<K>;\n}\n\ninterface GenericCovariantInterface<out T> {\n\t_typeCheck?: Covariant<T>;\n}\n\ninterface GenericContravariantInterface<in T> {\n\t_typeCheck?: Contravariant<T>;\n}\n\ninterface GenericInvariantInterface<in out T> {\n\t_typeCheck?: Invariant<T>;\n}\n\n// Check that interface can be implemented without needing extra members\ndeclare class GenericInvariantImplementation<T> implements GenericInvariantInterface<T> {}\n\n/**\n * Import this into a context where you want to be sure the TypeCheck library is functioning properly.\n *\n * It's functionality depends on compiler settings (requires several of the strict options),\n * and could break with compiler version changes.\n * Thus for maximal confidence everything is working correctly, you need to import this.\n */\nexport type EnforceTypeCheckTests =\n\t// Add dummy use of type checking types above\n\t| requireTrue<\n\t\t\tisAssignableTo<GenericInvariantImplementation<number>, GenericInvariantInterface<number>>\n\t >\n\n\t// Positive tests\n\t| requireTrue<true>\n\t| requireFalse<false>\n\n\t// test isAssignableTo for normal types\n\t| requireTrue<isAssignableTo<Empty1, Empty1>>\n\t| requireTrue<isAssignableTo<Empty1, Empty2>>\n\t| requireTrue<isAssignableTo<Nominal1, Nominal1>>\n\t| requireFalse<isAssignableTo<Nominal1, Nominal2>>\n\t| requireTrue<isAssignableTo<Derived1, Nominal1>>\n\t| requireFalse<isAssignableTo<Derived1, Derived2>>\n\t| requireTrue<isAssignableTo<Generic<Nominal1>, Generic<Nominal2>>>\n\n\t// test isAssignableTo for any\n\t| requireTrue<isAssignableTo<any, Nominal1>>\n\t| requireTrue<isAssignableTo<Nominal1, any>>\n\n\t// test isAssignableTo for unknown: all types are assignable to unknown\n\t| requireFalse<isAssignableTo<unknown, Nominal1>>\n\t| requireTrue<isAssignableTo<Nominal1, unknown>>\n\n\t// test isAssignableTo for never: all types are assignable from never\n\t| requireTrue<isAssignableTo<never, Nominal1>>\n\t| requireFalse<isAssignableTo<Nominal1, never>>\n\n\t// test Covariant\n\t| requireFalse<isAssignableTo<GenericCovariant<Nominal1>, GenericCovariant<Nominal2>>>\n\t| requireTrue<isAssignableTo<GenericCovariant<Derived1>, GenericCovariant<Nominal1>>>\n\t| requireFalse<isAssignableTo<GenericCovariant<Nominal1>, GenericCovariant<Derived1>>>\n\n\t// test Contravariant\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericContravariant<Nominal1>, GenericContravariant<Nominal2>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericContravariant<Derived1>, GenericContravariant<Nominal1>>\n\t >\n\t| requireTrue<isAssignableTo<GenericContravariant<Nominal1>, GenericContravariant<Derived1>>>\n\n\t// test Invariant\n\t| requireFalse<isAssignableTo<GenericInvariant<Nominal1>, GenericInvariant<Nominal2>>>\n\t| requireFalse<isAssignableTo<GenericInvariant<Derived1>, GenericInvariant<Nominal1>>>\n\t| requireFalse<isAssignableTo<GenericInvariant<Nominal1>, GenericInvariant<Derived1>>>\n\n\t// test Multiple parameters\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericMulti<Nominal1, number>, GenericMulti<Derived1, number>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericMulti<number, Nominal1>, GenericMulti<number, Derived1>>\n\t >\n\t| requireTrue<isAssignableTo<GenericMulti<number, Derived1>, GenericMulti<number, Nominal1>>>\n\n\t// test Covariant Interface\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericCovariantInterface<Nominal1>, GenericCovariantInterface<Nominal2>>\n\t >\n\t| requireTrue<\n\t\t\tisAssignableTo<GenericCovariantInterface<Derived1>, GenericCovariantInterface<Nominal1>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericCovariantInterface<Nominal1>, GenericCovariantInterface<Derived1>>\n\t >\n\n\t// test Contravariant Interface\n\t| requireFalse<\n\t\t\tisAssignableTo<\n\t\t\t\tGenericContravariantInterface<Nominal1>,\n\t\t\t\tGenericContravariantInterface<Nominal2>\n\t\t\t>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<\n\t\t\t\tGenericContravariantInterface<Derived1>,\n\t\t\t\tGenericContravariantInterface<Nominal1>\n\t\t\t>\n\t >\n\t| requireTrue<\n\t\t\tisAssignableTo<\n\t\t\t\tGenericContravariantInterface<Nominal1>,\n\t\t\t\tGenericContravariantInterface<Derived1>\n\t\t\t>\n\t >\n\n\t// test Invariant Interface\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericInvariantInterface<Nominal1>, GenericInvariantInterface<Nominal2>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericInvariantInterface<Derived1>, GenericInvariantInterface<Nominal1>>\n\t >\n\t| requireFalse<\n\t\t\tisAssignableTo<GenericInvariantInterface<Nominal1>, GenericInvariantInterface<Derived1>>\n\t >\n\n\t// test eitherIsAny\n\t| requireTrue<eitherIsAny<any, Nominal1>>\n\t| requireTrue<eitherIsAny<Nominal1, any>>\n\t| requireTrue<eitherIsAny<any, any>>\n\t| requireFalse<eitherIsAny<Nominal1, Nominal1>>\n\n\t// areSafelyAssignable tests\n\t| requireTrue<areSafelyAssignable<Nominal1, Nominal1>>\n\t| requireFalse<areSafelyAssignable<unknown, Nominal1>>\n\t| requireFalse<areSafelyAssignable<any, any>>\n\t| requireTrue<areSafelyAssignable<unknown, unknown>>\n\t| requireFalse<areSafelyAssignable<any, Nominal1>>\n\t| requireFalse<areSafelyAssignable<Nominal1, any>>\n\t| requireFalse<areSafelyAssignable<unknown, any>>\n\n\t// test isAny\n\t| requireTrue<isAny<any>>\n\t| requireFalse<isAny<unknown>>\n\t| requireFalse<isAny<Nominal1>>\n\t| requireFalse<isAny<never>>\n\t| requireFalse<isAny<{}>>\n\t| requireFalse<isAny<boolean>>\n\t| requireFalse<isAny<number | undefined>>\n\t| requireFalse<isAny<1 & \"x\">>\n\t| requireFalse<isAny<(1 & 2) | {}>>\n\n\t// test isStrictSubset\n\t| requireTrue<isStrictSubset<1, 1 | 2>>\n\t| requireTrue<isStrictSubset<[1, true], [1 | 2, true]>>\n\t| requireTrue<isStrictSubset<[1, true], [1 | 2, true | false]>>\n\t| requireTrue<isStrictSubset<[1, true], [1, true | false]>>\n\t| requireTrue<isStrictSubset<[1, true], [1, true] | [1 | false]>>\n\t| requireTrue<isStrictSubset<1, number>>\n\t| requireFalse<isStrictSubset<1, 1>>\n\t| requireFalse<isStrictSubset<1, 2>>\n\t| requireFalse<isStrictSubset<[1, true], [1, true]>>\n\t| requireFalse<isStrictSubset<1 | 2, 1>>\n\n\t// areOnlyKeys\n\t| requireTrue<areOnlyKeys<{ a: number; b: number }, \"a\" | \"b\">>\n\t| requireTrue<areOnlyKeys<{ a?: number; b: number }, \"a\" | \"b\">>\n\t| requireFalse<areOnlyKeys<{ a?: number; b: number }, \"b\">>\n\t| requireFalse<areOnlyKeys<{ a: number; b: number }, \"a\">>;\n// This case is explicitly documented as unsupported.\n// | requireFalse<areOnlyKeys<Record<string, unknown>, \"a\">>;\n\n// negative tests (should not build)\n// @ts-expect-error negative test\ntype _falseIsTrue = requireTrue<false>;\n// @ts-expect-error negative test\ntype _trueIsFalse = requireFalse<true>;\n// @ts-expect-error negative test\ntype _booleanIsTrue = requireTrue<boolean>;\n// @ts-expect-error negative test\ntype _booleanIsFalse = requireFalse<boolean>;\n// @ts-expect-error negative test\ntype _emptyNotAssignable = requireFalse<isAssignableTo<Empty1, Empty2>>;\n// @ts-expect-error negative test\ntype _numberAssignableToString = requireTrue<isAssignableTo<number, string>>;\n// @ts-expect-error negative test\ntype _anyNotAny = requireFalse<isAny<any>>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/tree",
3
- "version": "2.72.0",
3
+ "version": "2.74.0-365691",
4
4
  "description": "Distributed tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -101,17 +101,17 @@
101
101
  "temp-directory": "nyc/.nyc_output"
102
102
  },
103
103
  "dependencies": {
104
- "@fluid-internal/client-utils": "~2.72.0",
105
- "@fluidframework/container-runtime": "~2.72.0",
106
- "@fluidframework/core-interfaces": "~2.72.0",
107
- "@fluidframework/core-utils": "~2.72.0",
108
- "@fluidframework/datastore-definitions": "~2.72.0",
109
- "@fluidframework/driver-definitions": "~2.72.0",
110
- "@fluidframework/id-compressor": "~2.72.0",
111
- "@fluidframework/runtime-definitions": "~2.72.0",
112
- "@fluidframework/runtime-utils": "~2.72.0",
113
- "@fluidframework/shared-object-base": "~2.72.0",
114
- "@fluidframework/telemetry-utils": "~2.72.0",
104
+ "@fluid-internal/client-utils": "2.74.0-365691",
105
+ "@fluidframework/container-runtime": "2.74.0-365691",
106
+ "@fluidframework/core-interfaces": "2.74.0-365691",
107
+ "@fluidframework/core-utils": "2.74.0-365691",
108
+ "@fluidframework/datastore-definitions": "2.74.0-365691",
109
+ "@fluidframework/driver-definitions": "2.74.0-365691",
110
+ "@fluidframework/id-compressor": "2.74.0-365691",
111
+ "@fluidframework/runtime-definitions": "2.74.0-365691",
112
+ "@fluidframework/runtime-utils": "2.74.0-365691",
113
+ "@fluidframework/shared-object-base": "2.74.0-365691",
114
+ "@fluidframework/telemetry-utils": "2.74.0-365691",
115
115
  "@sinclair/typebox": "^0.34.13",
116
116
  "@tylerbu/sorted-btree-es6": "^1.8.0",
117
117
  "@types/ungap__structured-clone": "^1.2.0",
@@ -122,20 +122,20 @@
122
122
  "devDependencies": {
123
123
  "@arethetypeswrong/cli": "^0.17.1",
124
124
  "@biomejs/biome": "~1.9.3",
125
- "@fluid-internal/mocha-test-setup": "~2.72.0",
126
- "@fluid-private/stochastic-test-utils": "~2.72.0",
127
- "@fluid-private/test-dds-utils": "~2.72.0",
128
- "@fluid-private/test-drivers": "~2.72.0",
125
+ "@fluid-internal/mocha-test-setup": "2.74.0-365691",
126
+ "@fluid-private/stochastic-test-utils": "2.74.0-365691",
127
+ "@fluid-private/test-dds-utils": "2.74.0-365691",
128
+ "@fluid-private/test-drivers": "2.74.0-365691",
129
129
  "@fluid-tools/benchmark": "^0.51.0",
130
130
  "@fluid-tools/build-cli": "^0.60.0",
131
131
  "@fluidframework/build-common": "^2.0.3",
132
132
  "@fluidframework/build-tools": "^0.60.0",
133
- "@fluidframework/container-definitions": "~2.72.0",
134
- "@fluidframework/container-loader": "~2.72.0",
135
- "@fluidframework/eslint-config-fluid": "~2.72.0",
136
- "@fluidframework/test-runtime-utils": "~2.72.0",
137
- "@fluidframework/test-utils": "~2.72.0",
138
- "@fluidframework/tree-previous": "npm:@fluidframework/tree@2.71.0",
133
+ "@fluidframework/container-definitions": "2.74.0-365691",
134
+ "@fluidframework/container-loader": "2.74.0-365691",
135
+ "@fluidframework/eslint-config-fluid": "2.74.0-365691",
136
+ "@fluidframework/test-runtime-utils": "2.74.0-365691",
137
+ "@fluidframework/test-utils": "2.74.0-365691",
138
+ "@fluidframework/tree-previous": "npm:@fluidframework/tree@2.73.0",
139
139
  "@microsoft/api-extractor": "7.52.11",
140
140
  "@types/diff": "^3.5.1",
141
141
  "@types/easy-table": "^0.0.32",
package/src/api.ts CHANGED
@@ -3,19 +3,18 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
7
- type TreeView,
8
- type TreeViewAlpha,
9
- type TreeViewBeta,
10
- type ImplicitFieldSchema,
11
- // eslint-disable-next-line import-x/no-deprecated
12
- asTreeViewAlpha,
6
+ import type {
7
+ TreeView,
8
+ TreeViewAlpha,
9
+ TreeViewBeta,
10
+ ImplicitFieldSchema,
11
+ TreeViewConfiguration,
12
+ TreeViewConfigurationAlpha,
13
13
  } from "./simple-tree/index.js";
14
14
 
15
15
  /**
16
16
  * Module entry points for retrieving alternate (alpha/beta) versions of tree APIs.
17
17
  * For each API (usually a class) that has an alpha/beta version, add overloads to the function(s) below.
18
- * In the future, `asBeta` may be added here too.
19
18
  * These functions should only be used by external consumers, not referenced internally within the tree package, to avoid circular import dependencies.
20
19
  */
21
20
 
@@ -25,9 +24,21 @@ import {
25
24
  */
26
25
  export function asAlpha<TSchema extends ImplicitFieldSchema>(
27
26
  view: TreeView<TSchema>,
28
- ): TreeViewAlpha<TSchema> {
29
- // eslint-disable-next-line import-x/no-deprecated
30
- return asTreeViewAlpha(view);
27
+ ): TreeViewAlpha<TSchema>;
28
+
29
+ /**
30
+ * Retrieve the {@link TreeViewConfigurationAlpha | alpha API} for a {@link TreeViewConfiguration}.
31
+ * @alpha
32
+ */
33
+ export function asAlpha<TSchema extends ImplicitFieldSchema>(
34
+ view: TreeViewConfiguration<TSchema>,
35
+ ): TreeViewConfigurationAlpha<TSchema>;
36
+
37
+ /**
38
+ * Implementation of overloads for {@link asAlpha}.
39
+ */
40
+ export function asAlpha(view: unknown): unknown {
41
+ return view;
31
42
  }
32
43
 
33
44
  /**
@@ -501,7 +501,7 @@ export const FluidClientVersion = {
501
501
 
502
502
  /**
503
503
  * Fluid Framework Client 2.43 and newer.
504
- *
504
+ * @remarks
505
505
  * New formats introduced in 2.43:
506
506
  * - SchemaFormatVersion.v2
507
507
  * - MessageFormatVersion.v4
@@ -512,11 +512,19 @@ export const FluidClientVersion = {
512
512
 
513
513
  /**
514
514
  * Fluid Framework Client 2.52 and newer.
515
- *
515
+ * @remarks
516
516
  * New formats introduced in 2.52:
517
517
  * - DetachedFieldIndexFormatVersion.v2
518
518
  */
519
519
  v2_52: "2.52.0",
520
+
521
+ /**
522
+ * Fluid Framework Client 2.73 and newer.
523
+ * @remarks
524
+ * New formats introduced in 2.73:
525
+ * - FieldBatchFormatVersion v2
526
+ */
527
+ v2_73: "2.73.0",
520
528
  } as const satisfies Record<string, MinimumVersionForCollab>;
521
529
 
522
530
  /**
@@ -39,4 +39,5 @@ export {
39
39
  makeVersionedCodec,
40
40
  makeVersionedValidatedCodec,
41
41
  makeVersionDispatchingCodec,
42
+ makeDiscontinuedCodecVersion,
42
43
  } from "./versioned/index.js";
@@ -5,7 +5,8 @@
5
5
 
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
7
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
8
- import type { TSchema } from "@sinclair/typebox";
8
+ import type { SemanticVersion } from "@fluidframework/runtime-utils/internal";
9
+ import { Type, type TSchema } from "@sinclair/typebox";
9
10
 
10
11
  import type { JsonCompatibleReadOnly } from "../../util/index.js";
11
12
  import {
@@ -66,7 +67,7 @@ export function makeVersionedValidatedCodec<
66
67
  TContext = void,
67
68
  >(
68
69
  options: ICodecOptions,
69
- supportedVersions: Set<number>,
70
+ supportedVersions: Set<FormatVersion>,
70
71
  schema: EncodedSchema,
71
72
  codec: IJsonCodec<TDecoded, TEncoded, TValidate, TContext>,
72
73
  ): IJsonCodec<TDecoded, TEncoded, TValidate, TContext> {
@@ -77,6 +78,43 @@ export function makeVersionedValidatedCodec<
77
78
  );
78
79
  }
79
80
 
81
+ /**
82
+ * Creates a codec which always throws a UsageError when encoding or decoding, indicating that the format version is discontinued.
83
+ */
84
+ export function makeDiscontinuedCodecVersion<
85
+ TDecoded,
86
+ TEncoded extends Versioned = JsonCompatibleReadOnly & Versioned,
87
+ TContext = unknown,
88
+ >(
89
+ options: ICodecOptions,
90
+ discontinuedVersion: FormatVersion,
91
+ discontinuedSince: SemanticVersion,
92
+ ): IJsonCodec<TDecoded, TEncoded, TEncoded, TContext> {
93
+ const schema = Type.Object(
94
+ {
95
+ version:
96
+ discontinuedVersion === undefined
97
+ ? Type.Undefined()
98
+ : Type.Literal(discontinuedVersion),
99
+ },
100
+ // Using `additionalProperties: true` allows this schema to be used when loading data encoded by older versions even though they contain additional properties.
101
+ { additionalProperties: true },
102
+ );
103
+ const codec: IJsonCodec<TDecoded, TEncoded, TEncoded, TContext> = {
104
+ encode: (_: TDecoded): TEncoded => {
105
+ throw new UsageError(
106
+ `Cannot encode data to format ${discontinuedVersion}. The codec was discontinued in FF version ${discontinuedSince}.`,
107
+ );
108
+ },
109
+ decode: (data: TEncoded): TDecoded => {
110
+ throw new UsageError(
111
+ `Cannot decode data to format ${data.version}. The codec was discontinued in FF version ${discontinuedSince}.`,
112
+ );
113
+ },
114
+ };
115
+ return makeVersionedValidatedCodec(options, new Set([discontinuedVersion]), schema, codec);
116
+ }
117
+
80
118
  /**
81
119
  * Creates a codec which dispatches to the appropriate member of a codec family based on the version of
82
120
  * data it encounters.
@@ -8,4 +8,5 @@ export {
8
8
  makeVersionedCodec,
9
9
  makeVersionedValidatedCodec,
10
10
  makeVersionDispatchingCodec,
11
+ makeDiscontinuedCodecVersion,
11
12
  } from "./codec.js";
@@ -91,13 +91,24 @@ export enum ValueSchema {
91
91
  export type TreeTypeSet = ReadonlySet<TreeNodeSchemaIdentifier>;
92
92
 
93
93
  /**
94
- * Declarative portion of a Field Kind.
94
+ * Declarative portion of a {@link FlexFieldKind}.
95
95
  *
96
96
  * @remarks
97
97
  * Enough info about a field kind to know if a given tree is is schema.
98
+ *
99
+ * Note that compatibility between trees and schema is not sufficient to evaluate if a schema upgrade should be allowed.
100
+ * Currently schema upgrades are restricted to field kind changes which can not be cyclic (like version upgrades but not down grades).
101
+ * See {@link FlexFieldKind.allowsFieldSuperset} for more details.
98
102
  */
99
103
  export interface FieldKindData {
104
+ /**
105
+ * Globally scoped identifier.
106
+ */
100
107
  readonly identifier: FieldKindIdentifier;
108
+ /**
109
+ * Bound on the number of children that fields of this kind may have.
110
+ * TODO: consider replacing this with numeric upper and lower bounds.
111
+ */
101
112
  readonly multiplicity: Multiplicity;
102
113
  }
103
114
 
@@ -5,6 +5,10 @@
5
5
 
6
6
  import type { IIdCompressor } from "@fluidframework/id-compressor";
7
7
  import type { MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
8
+ import {
9
+ getConfigForMinVersionForCollab,
10
+ lowestMinVersionForCollab,
11
+ } from "@fluidframework/runtime-utils/internal";
8
12
 
9
13
  import {
10
14
  type CodecTree,
@@ -31,9 +35,12 @@ import { brand } from "../../util/index.js";
31
35
  function clientVersionToDetachedFieldVersion(
32
36
  clientVersion: MinimumVersionForCollab,
33
37
  ): DetachedFieldIndexFormatVersion {
34
- return clientVersion < FluidClientVersion.v2_52
35
- ? brand(DetachedFieldIndexFormatVersion.v1)
36
- : brand(DetachedFieldIndexFormatVersion.v2);
38
+ return brand(
39
+ getConfigForMinVersionForCollab(clientVersion, {
40
+ [lowestMinVersionForCollab]: DetachedFieldIndexFormatVersion.v1,
41
+ [FluidClientVersion.v2_52]: DetachedFieldIndexFormatVersion.v2,
42
+ }),
43
+ );
37
44
  }
38
45
 
39
46
  export function makeDetachedFieldIndexCodec(
@@ -2,7 +2,7 @@
2
2
 
3
3
  Libraries which plug into the [Core Libraries](../core/README.md) to provide specializations, either for performance, or compatibility with specific tools or use-cases.
4
4
 
5
- This includes concrete implementations of abstractions used to parameterize `SharedTreeCore` (Like `Index` and `ChangeFamily`), or any other entry points to the `core` libraries] package (like `Forest`).
5
+ This includes concrete implementations of abstractions used to parameterize `SharedTreeCore` (Like `Index` and `ChangeFamily`), or any other entry points to the `core` libraries package (like `Forest`).
6
6
 
7
7
  `SharedTreeCore` should be usable with alternative versions of anything within this library.
8
8