@fluidframework/tree 2.41.0-338186 → 2.41.0-338401

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 (407) hide show
  1. package/api-report/tree.alpha.api.md +164 -4
  2. package/dist/alpha.d.ts +2 -0
  3. package/dist/codec/codec.d.ts +42 -7
  4. package/dist/codec/codec.d.ts.map +1 -1
  5. package/dist/codec/codec.js +50 -8
  6. package/dist/codec/codec.js.map +1 -1
  7. package/dist/core/change-family/editBuilder.d.ts.map +1 -1
  8. package/dist/core/change-family/editBuilder.js.map +1 -1
  9. package/dist/core/forest/forest.d.ts.map +1 -1
  10. package/dist/core/forest/forest.js.map +1 -1
  11. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  12. package/dist/core/schema-stored/schema.js.map +1 -1
  13. package/dist/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  14. package/dist/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  15. package/dist/core/schema-stored/storedSchemaRepository.js +1 -1
  16. package/dist/core/schema-stored/storedSchemaRepository.js.map +1 -1
  17. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  18. package/dist/core/tree/anchorSet.js +2 -2
  19. package/dist/core/tree/anchorSet.js.map +1 -1
  20. package/dist/core/tree/chunk.d.ts.map +1 -1
  21. package/dist/core/tree/chunk.js.map +1 -1
  22. package/dist/core/tree/delta.d.ts.map +1 -1
  23. package/dist/core/tree/delta.js.map +1 -1
  24. package/dist/core/tree/deltaUtil.d.ts.map +1 -1
  25. package/dist/core/tree/deltaUtil.js.map +1 -1
  26. package/dist/core/tree/detachedFieldIndex.d.ts +1 -1
  27. package/dist/core/tree/detachedFieldIndex.d.ts.map +1 -1
  28. package/dist/core/tree/detachedFieldIndex.js.map +1 -1
  29. package/dist/core/tree/detachedFieldIndexCodec.d.ts +1 -1
  30. package/dist/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  31. package/dist/core/tree/detachedFieldIndexCodec.js +1 -1
  32. package/dist/core/tree/detachedFieldIndexCodec.js.map +1 -1
  33. package/dist/core/tree/pathTree.d.ts.map +1 -1
  34. package/dist/core/tree/pathTree.js.map +1 -1
  35. package/dist/core/tree/treeTextFormat.d.ts.map +1 -1
  36. package/dist/core/tree/treeTextFormat.js.map +1 -1
  37. package/dist/core/tree/visitDelta.d.ts +1 -1
  38. package/dist/core/tree/visitDelta.d.ts.map +1 -1
  39. package/dist/core/tree/visitDelta.js.map +1 -1
  40. package/dist/core/tree/visitorUtils.d.ts +2 -2
  41. package/dist/core/tree/visitorUtils.d.ts.map +1 -1
  42. package/dist/core/tree/visitorUtils.js.map +1 -1
  43. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
  44. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  45. package/dist/feature-libraries/chunked-forest/chunkTree.js +1 -1
  46. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  47. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  48. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  49. package/dist/feature-libraries/chunked-forest/chunkedForest.js +1 -1
  50. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  51. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
  52. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  53. package/dist/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  54. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +2 -2
  55. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  56. package/dist/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  57. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  58. package/dist/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  59. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -2
  60. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  61. package/dist/feature-libraries/chunked-forest/codec/codecs.js +12 -1
  62. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  63. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  64. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  65. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  66. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  67. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  68. package/dist/feature-libraries/chunked-forest/codec/index.js +2 -1
  69. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  70. package/dist/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  71. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js +1 -1
  72. package/dist/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  73. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  74. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  75. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  76. package/dist/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  77. package/dist/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  78. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  79. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  80. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  81. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  82. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  83. package/dist/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  84. package/dist/feature-libraries/chunked-forest/sequenceChunk.js +4 -4
  85. package/dist/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  86. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -1
  87. package/dist/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  88. package/dist/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  89. package/dist/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  90. package/dist/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  91. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  92. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  93. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  94. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  95. package/dist/feature-libraries/default-schema/index.js +2 -1
  96. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  97. package/dist/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  98. package/dist/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  99. package/dist/feature-libraries/default-schema/schemaChecker.d.ts +4 -0
  100. package/dist/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  101. package/dist/feature-libraries/default-schema/schemaChecker.js +35 -26
  102. package/dist/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  103. package/dist/feature-libraries/index.d.ts +2 -2
  104. package/dist/feature-libraries/index.d.ts.map +1 -1
  105. package/dist/feature-libraries/index.js +3 -1
  106. package/dist/feature-libraries/index.js.map +1 -1
  107. package/dist/feature-libraries/initializeForest.d.ts.map +1 -1
  108. package/dist/feature-libraries/initializeForest.js.map +1 -1
  109. package/dist/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  110. package/dist/feature-libraries/treeCursorUtils.js +1 -1
  111. package/dist/feature-libraries/treeCursorUtils.js.map +1 -1
  112. package/dist/feature-libraries/valueUtilities.d.ts.map +1 -1
  113. package/dist/feature-libraries/valueUtilities.js +6 -6
  114. package/dist/feature-libraries/valueUtilities.js.map +1 -1
  115. package/dist/jsonDomainSchema.d.ts.map +1 -1
  116. package/dist/jsonDomainSchema.js.map +1 -1
  117. package/dist/packageVersion.d.ts +1 -1
  118. package/dist/packageVersion.js +1 -1
  119. package/dist/packageVersion.js.map +1 -1
  120. package/dist/serializableDomainSchema.d.ts.map +1 -1
  121. package/dist/serializableDomainSchema.js.map +1 -1
  122. package/dist/shared-tree/treeAlpha.d.ts +8 -0
  123. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  124. package/dist/shared-tree/treeAlpha.js +14 -7
  125. package/dist/shared-tree/treeAlpha.js.map +1 -1
  126. package/dist/sharedTreeAttributes.d.ts.map +1 -1
  127. package/dist/sharedTreeAttributes.js.map +1 -1
  128. package/dist/simple-tree/api/create.d.ts.map +1 -1
  129. package/dist/simple-tree/api/create.js +1 -1
  130. package/dist/simple-tree/api/create.js.map +1 -1
  131. package/dist/simple-tree/api/index.d.ts +1 -1
  132. package/dist/simple-tree/api/index.d.ts.map +1 -1
  133. package/dist/simple-tree/api/index.js +3 -1
  134. package/dist/simple-tree/api/index.js.map +1 -1
  135. package/dist/simple-tree/api/treeNodeApi.d.ts +8 -0
  136. package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  137. package/dist/simple-tree/api/treeNodeApi.js +3 -1
  138. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  139. package/dist/simple-tree/arrayNode.js +1 -1
  140. package/dist/simple-tree/arrayNode.js.map +1 -1
  141. package/dist/simple-tree/core/getOrCreateNode.js +1 -1
  142. package/dist/simple-tree/core/getOrCreateNode.js.map +1 -1
  143. package/dist/simple-tree/core/treeNodeKernel.d.ts +5 -17
  144. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  145. package/dist/simple-tree/core/treeNodeKernel.js +17 -48
  146. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  147. package/dist/simple-tree/{proxies.d.ts → getTreeNodeForField.d.ts} +1 -1
  148. package/dist/simple-tree/getTreeNodeForField.d.ts.map +1 -0
  149. package/dist/simple-tree/{proxies.js → getTreeNodeForField.js} +1 -1
  150. package/dist/simple-tree/getTreeNodeForField.js.map +1 -0
  151. package/dist/simple-tree/index.d.ts +2 -2
  152. package/dist/simple-tree/index.d.ts.map +1 -1
  153. package/dist/simple-tree/index.js +6 -4
  154. package/dist/simple-tree/index.js.map +1 -1
  155. package/dist/simple-tree/mapNode.js +4 -4
  156. package/dist/simple-tree/mapNode.js.map +1 -1
  157. package/dist/simple-tree/objectNode.js +3 -3
  158. package/dist/simple-tree/objectNode.js.map +1 -1
  159. package/dist/simple-tree/prepareForInsertion.d.ts +18 -6
  160. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  161. package/dist/simple-tree/prepareForInsertion.js +51 -22
  162. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  163. package/dist/simple-tree/toMapTree.d.ts +3 -8
  164. package/dist/simple-tree/toMapTree.d.ts.map +1 -1
  165. package/dist/simple-tree/toMapTree.js +3 -22
  166. package/dist/simple-tree/toMapTree.js.map +1 -1
  167. package/dist/tableSchema.d.ts +109 -62
  168. package/dist/tableSchema.d.ts.map +1 -1
  169. package/dist/tableSchema.js +83 -36
  170. package/dist/tableSchema.js.map +1 -1
  171. package/dist/treeFactory.d.ts.map +1 -1
  172. package/dist/treeFactory.js +2 -2
  173. package/dist/treeFactory.js.map +1 -1
  174. package/lib/alpha.d.ts +2 -0
  175. package/lib/codec/codec.d.ts +42 -7
  176. package/lib/codec/codec.d.ts.map +1 -1
  177. package/lib/codec/codec.js +50 -8
  178. package/lib/codec/codec.js.map +1 -1
  179. package/lib/core/change-family/editBuilder.d.ts.map +1 -1
  180. package/lib/core/change-family/editBuilder.js.map +1 -1
  181. package/lib/core/forest/forest.d.ts.map +1 -1
  182. package/lib/core/forest/forest.js.map +1 -1
  183. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  184. package/lib/core/schema-stored/schema.js.map +1 -1
  185. package/lib/core/schema-stored/storedSchemaRepository.d.ts +1 -1
  186. package/lib/core/schema-stored/storedSchemaRepository.d.ts.map +1 -1
  187. package/lib/core/schema-stored/storedSchemaRepository.js +1 -1
  188. package/lib/core/schema-stored/storedSchemaRepository.js.map +1 -1
  189. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  190. package/lib/core/tree/anchorSet.js +2 -2
  191. package/lib/core/tree/anchorSet.js.map +1 -1
  192. package/lib/core/tree/chunk.d.ts.map +1 -1
  193. package/lib/core/tree/chunk.js.map +1 -1
  194. package/lib/core/tree/delta.d.ts.map +1 -1
  195. package/lib/core/tree/delta.js.map +1 -1
  196. package/lib/core/tree/deltaUtil.d.ts.map +1 -1
  197. package/lib/core/tree/deltaUtil.js.map +1 -1
  198. package/lib/core/tree/detachedFieldIndex.d.ts +1 -1
  199. package/lib/core/tree/detachedFieldIndex.d.ts.map +1 -1
  200. package/lib/core/tree/detachedFieldIndex.js.map +1 -1
  201. package/lib/core/tree/detachedFieldIndexCodec.d.ts +1 -1
  202. package/lib/core/tree/detachedFieldIndexCodec.d.ts.map +1 -1
  203. package/lib/core/tree/detachedFieldIndexCodec.js +1 -1
  204. package/lib/core/tree/detachedFieldIndexCodec.js.map +1 -1
  205. package/lib/core/tree/pathTree.d.ts.map +1 -1
  206. package/lib/core/tree/pathTree.js.map +1 -1
  207. package/lib/core/tree/treeTextFormat.d.ts.map +1 -1
  208. package/lib/core/tree/treeTextFormat.js.map +1 -1
  209. package/lib/core/tree/visitDelta.d.ts +1 -1
  210. package/lib/core/tree/visitDelta.d.ts.map +1 -1
  211. package/lib/core/tree/visitDelta.js.map +1 -1
  212. package/lib/core/tree/visitorUtils.d.ts +2 -2
  213. package/lib/core/tree/visitorUtils.d.ts.map +1 -1
  214. package/lib/core/tree/visitorUtils.js.map +1 -1
  215. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +1 -1
  216. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  217. package/lib/feature-libraries/chunked-forest/chunkTree.js +1 -1
  218. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  219. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  220. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  221. package/lib/feature-libraries/chunked-forest/chunkedForest.js +1 -1
  222. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  223. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts +1 -1
  224. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.d.ts.map +1 -1
  225. package/lib/feature-libraries/chunked-forest/codec/chunkDecoding.js.map +1 -1
  226. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts +2 -2
  227. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.d.ts.map +1 -1
  228. package/lib/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.js.map +1 -1
  229. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.d.ts.map +1 -1
  230. package/lib/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.js.map +1 -1
  231. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +8 -2
  232. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  233. package/lib/feature-libraries/chunked-forest/codec/codecs.js +10 -0
  234. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  235. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +1 -1
  236. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  237. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  238. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -1
  239. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  240. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -1
  241. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  242. package/lib/feature-libraries/chunked-forest/codec/nodeShape.d.ts.map +1 -1
  243. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js +1 -1
  244. package/lib/feature-libraries/chunked-forest/codec/nodeShape.js.map +1 -1
  245. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts +1 -1
  246. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  247. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  248. package/lib/feature-libraries/chunked-forest/emptyChunk.d.ts.map +1 -1
  249. package/lib/feature-libraries/chunked-forest/emptyChunk.js.map +1 -1
  250. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  251. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  252. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  253. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  254. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts +1 -1
  255. package/lib/feature-libraries/chunked-forest/sequenceChunk.d.ts.map +1 -1
  256. package/lib/feature-libraries/chunked-forest/sequenceChunk.js +1 -1
  257. package/lib/feature-libraries/chunked-forest/sequenceChunk.js.map +1 -1
  258. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts +1 -1
  259. package/lib/feature-libraries/chunked-forest/uniformChunk.d.ts.map +1 -1
  260. package/lib/feature-libraries/chunked-forest/uniformChunk.js +1 -1
  261. package/lib/feature-libraries/chunked-forest/uniformChunk.js.map +1 -1
  262. package/lib/feature-libraries/default-schema/defaultEditBuilder.js.map +1 -1
  263. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  264. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  265. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  266. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  267. package/lib/feature-libraries/default-schema/index.js +1 -1
  268. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  269. package/lib/feature-libraries/default-schema/mappedEditBuilder.d.ts.map +1 -1
  270. package/lib/feature-libraries/default-schema/mappedEditBuilder.js.map +1 -1
  271. package/lib/feature-libraries/default-schema/schemaChecker.d.ts +4 -0
  272. package/lib/feature-libraries/default-schema/schemaChecker.d.ts.map +1 -1
  273. package/lib/feature-libraries/default-schema/schemaChecker.js +33 -25
  274. package/lib/feature-libraries/default-schema/schemaChecker.js.map +1 -1
  275. package/lib/feature-libraries/index.d.ts +2 -2
  276. package/lib/feature-libraries/index.d.ts.map +1 -1
  277. package/lib/feature-libraries/index.js +2 -2
  278. package/lib/feature-libraries/index.js.map +1 -1
  279. package/lib/feature-libraries/initializeForest.d.ts.map +1 -1
  280. package/lib/feature-libraries/initializeForest.js.map +1 -1
  281. package/lib/feature-libraries/treeCursorUtils.d.ts.map +1 -1
  282. package/lib/feature-libraries/treeCursorUtils.js +1 -1
  283. package/lib/feature-libraries/treeCursorUtils.js.map +1 -1
  284. package/lib/feature-libraries/valueUtilities.d.ts.map +1 -1
  285. package/lib/feature-libraries/valueUtilities.js +1 -1
  286. package/lib/feature-libraries/valueUtilities.js.map +1 -1
  287. package/lib/jsonDomainSchema.d.ts.map +1 -1
  288. package/lib/jsonDomainSchema.js.map +1 -1
  289. package/lib/packageVersion.d.ts +1 -1
  290. package/lib/packageVersion.js +1 -1
  291. package/lib/packageVersion.js.map +1 -1
  292. package/lib/serializableDomainSchema.d.ts.map +1 -1
  293. package/lib/serializableDomainSchema.js.map +1 -1
  294. package/lib/shared-tree/treeAlpha.d.ts +8 -0
  295. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  296. package/lib/shared-tree/treeAlpha.js +16 -9
  297. package/lib/shared-tree/treeAlpha.js.map +1 -1
  298. package/lib/sharedTreeAttributes.d.ts.map +1 -1
  299. package/lib/sharedTreeAttributes.js.map +1 -1
  300. package/lib/simple-tree/api/create.d.ts.map +1 -1
  301. package/lib/simple-tree/api/create.js +2 -2
  302. package/lib/simple-tree/api/create.js.map +1 -1
  303. package/lib/simple-tree/api/index.d.ts +1 -1
  304. package/lib/simple-tree/api/index.d.ts.map +1 -1
  305. package/lib/simple-tree/api/index.js +1 -1
  306. package/lib/simple-tree/api/index.js.map +1 -1
  307. package/lib/simple-tree/api/treeNodeApi.d.ts +8 -0
  308. package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
  309. package/lib/simple-tree/api/treeNodeApi.js +2 -2
  310. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  311. package/lib/simple-tree/arrayNode.js +2 -2
  312. package/lib/simple-tree/arrayNode.js.map +1 -1
  313. package/lib/simple-tree/core/getOrCreateNode.js +2 -2
  314. package/lib/simple-tree/core/getOrCreateNode.js.map +1 -1
  315. package/lib/simple-tree/core/treeNodeKernel.d.ts +5 -17
  316. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  317. package/lib/simple-tree/core/treeNodeKernel.js +16 -47
  318. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  319. package/lib/simple-tree/{proxies.d.ts → getTreeNodeForField.d.ts} +1 -1
  320. package/lib/simple-tree/getTreeNodeForField.d.ts.map +1 -0
  321. package/lib/simple-tree/{proxies.js → getTreeNodeForField.js} +1 -1
  322. package/lib/simple-tree/getTreeNodeForField.js.map +1 -0
  323. package/lib/simple-tree/index.d.ts +2 -2
  324. package/lib/simple-tree/index.d.ts.map +1 -1
  325. package/lib/simple-tree/index.js +2 -2
  326. package/lib/simple-tree/index.js.map +1 -1
  327. package/lib/simple-tree/mapNode.js +1 -1
  328. package/lib/simple-tree/mapNode.js.map +1 -1
  329. package/lib/simple-tree/objectNode.js +1 -1
  330. package/lib/simple-tree/objectNode.js.map +1 -1
  331. package/lib/simple-tree/prepareForInsertion.d.ts +18 -6
  332. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  333. package/lib/simple-tree/prepareForInsertion.js +51 -22
  334. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  335. package/lib/simple-tree/toMapTree.d.ts +3 -8
  336. package/lib/simple-tree/toMapTree.d.ts.map +1 -1
  337. package/lib/simple-tree/toMapTree.js +3 -21
  338. package/lib/simple-tree/toMapTree.js.map +1 -1
  339. package/lib/tableSchema.d.ts +109 -62
  340. package/lib/tableSchema.d.ts.map +1 -1
  341. package/lib/tableSchema.js +83 -36
  342. package/lib/tableSchema.js.map +1 -1
  343. package/lib/treeFactory.d.ts.map +1 -1
  344. package/lib/treeFactory.js +2 -2
  345. package/lib/treeFactory.js.map +1 -1
  346. package/package.json +20 -20
  347. package/src/codec/codec.ts +54 -8
  348. package/src/core/change-family/editBuilder.ts +1 -0
  349. package/src/core/forest/forest.ts +1 -1
  350. package/src/core/schema-stored/schema.ts +2 -0
  351. package/src/core/schema-stored/storedSchemaRepository.ts +2 -2
  352. package/src/core/tree/anchorSet.ts +4 -4
  353. package/src/core/tree/chunk.ts +2 -1
  354. package/src/core/tree/delta.ts +1 -0
  355. package/src/core/tree/deltaUtil.ts +1 -1
  356. package/src/core/tree/detachedFieldIndex.ts +1 -1
  357. package/src/core/tree/detachedFieldIndexCodec.ts +2 -2
  358. package/src/core/tree/pathTree.ts +1 -1
  359. package/src/core/tree/treeTextFormat.ts +1 -0
  360. package/src/core/tree/visitDelta.ts +1 -1
  361. package/src/core/tree/visitorUtils.ts +3 -2
  362. package/src/feature-libraries/chunked-forest/chunkTree.ts +2 -2
  363. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -3
  364. package/src/feature-libraries/chunked-forest/codec/chunkDecoding.ts +5 -5
  365. package/src/feature-libraries/chunked-forest/codec/chunkDecodingGeneric.ts +2 -2
  366. package/src/feature-libraries/chunked-forest/codec/chunkEncodingGeneric.ts +1 -0
  367. package/src/feature-libraries/chunked-forest/codec/codecs.ts +15 -1
  368. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +1 -1
  369. package/src/feature-libraries/chunked-forest/codec/index.ts +1 -0
  370. package/src/feature-libraries/chunked-forest/codec/nodeShape.ts +1 -1
  371. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +1 -1
  372. package/src/feature-libraries/chunked-forest/emptyChunk.ts +1 -0
  373. package/src/feature-libraries/chunked-forest/index.ts +1 -0
  374. package/src/feature-libraries/chunked-forest/sequenceChunk.ts +1 -1
  375. package/src/feature-libraries/chunked-forest/uniformChunk.ts +2 -3
  376. package/src/feature-libraries/default-schema/defaultEditBuilder.ts +1 -1
  377. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +1 -0
  378. package/src/feature-libraries/default-schema/index.ts +6 -1
  379. package/src/feature-libraries/default-schema/mappedEditBuilder.ts +1 -0
  380. package/src/feature-libraries/default-schema/schemaChecker.ts +37 -26
  381. package/src/feature-libraries/index.ts +2 -0
  382. package/src/feature-libraries/initializeForest.ts +1 -1
  383. package/src/feature-libraries/treeCursorUtils.ts +1 -1
  384. package/src/feature-libraries/valueUtilities.ts +1 -1
  385. package/src/jsonDomainSchema.ts +0 -1
  386. package/src/packageVersion.ts +1 -1
  387. package/src/serializableDomainSchema.ts +1 -0
  388. package/src/shared-tree/treeAlpha.ts +29 -8
  389. package/src/sharedTreeAttributes.ts +1 -0
  390. package/src/simple-tree/api/create.ts +2 -1
  391. package/src/simple-tree/api/index.ts +7 -1
  392. package/src/simple-tree/api/treeNodeApi.ts +2 -2
  393. package/src/simple-tree/arrayNode.ts +2 -2
  394. package/src/simple-tree/core/getOrCreateNode.ts +2 -2
  395. package/src/simple-tree/core/treeNodeKernel.ts +22 -53
  396. package/src/simple-tree/index.ts +3 -1
  397. package/src/simple-tree/mapNode.ts +1 -1
  398. package/src/simple-tree/objectNode.ts +1 -1
  399. package/src/simple-tree/prepareForInsertion.ts +67 -27
  400. package/src/simple-tree/toMapTree.ts +2 -26
  401. package/src/tableSchema.ts +109 -62
  402. package/src/treeFactory.ts +2 -4
  403. package/dist/simple-tree/proxies.d.ts.map +0 -1
  404. package/dist/simple-tree/proxies.js.map +0 -1
  405. package/lib/simple-tree/proxies.d.ts.map +0 -1
  406. package/lib/simple-tree/proxies.js.map +0 -1
  407. /package/src/simple-tree/{proxies.ts → getTreeNodeForField.ts} +0 -0
@@ -234,10 +234,8 @@ type FlexListToUnion<TList extends FlexList> = ExtractItemType<TList[number]>;
234
234
 
235
235
  // @alpha
236
236
  export enum FluidClientVersion {
237
- v2_0 = "v2_0",
238
- v2_1 = "v2_1",
239
- v2_2 = "v2_2",
240
- v2_3 = "v2_3"
237
+ EnableUnstableFeatures,
238
+ v2_0 = 2
241
239
  }
242
240
 
243
241
  // @alpha
@@ -887,6 +885,72 @@ export function singletonSchema<TScope extends string, TName extends string | nu
887
885
  readonly value: TName;
888
886
  }, Record<string, never>, true, Record<string, never>, undefined>;
889
887
 
888
+ // @alpha @system
889
+ export namespace System_TableSchema {
890
+ // @sealed @system
891
+ export type ColumnSchemaBase<TScope extends string | undefined = string | undefined, TCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes, TPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema> = ReturnType<typeof createColumnSchema<TScope, TCellSchema, TPropsSchema>>;
892
+ // @system
893
+ export type CreateColumnOptionsBase<TSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha, TCell extends ImplicitAllowedTypes = ImplicitAllowedTypes> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;
894
+ // @system
895
+ export function createColumnSchema<const TInputScope extends string | undefined, const TCellSchema extends ImplicitAllowedTypes, const TPropsSchema extends ImplicitAnnotatedFieldSchema>(inputSchemaFactory: SchemaFactoryAlpha<TInputScope>, cellSchema: TCellSchema, propsSchema: TPropsSchema): TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Column">, NodeKind.Object, TreeNode & TableSchema.Column<TCellSchema, TPropsSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Column">, NodeKind, unknown>, object & {
896
+ readonly id?: string | undefined;
897
+ } & (FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true ? {
898
+ props?: InsertableTreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TPropsSchema>> | undefined;
899
+ } : {
900
+ props: InsertableTreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TPropsSchema>>;
901
+ }), true, {
902
+ readonly props: TPropsSchema;
903
+ readonly id: FieldSchema_2<FieldKind_3.Identifier, LeafSchema_3<"string", string>, unknown>;
904
+ }>;
905
+ // @system
906
+ export type CreateRowOptionsBase<TSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha, TCell extends ImplicitAllowedTypes = ImplicitAllowedTypes> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;
907
+ // @sealed
908
+ export function createRowSchema<const TInputScope extends string | undefined, const TCellSchema extends ImplicitAllowedTypes, const TPropsSchema extends ImplicitAnnotatedFieldSchema>(inputSchemaFactory: SchemaFactoryAlpha<TInputScope>, cellSchema: TCellSchema, propsSchema: TPropsSchema): TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row">, NodeKind.Object, TreeNode & TableSchema.Row<TCellSchema, TPropsSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row">, NodeKind, unknown>, object & {
909
+ readonly id?: string | undefined;
910
+ readonly cells: (InsertableTypedNode_2<TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, TreeMapNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>, TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, true, TCellSchema, MapNodeInsertableData_2<TCellSchema>, unknown> & (new (data?: InternalTreeNode | MapNodeInsertableData_2<TCellSchema> | undefined) => TreeMapNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, TreeMapNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>, TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, true, TCellSchema, MapNodeInsertableData_2<TCellSchema>, unknown> & (new (data?: InternalTreeNode | MapNodeInsertableData_2<TCellSchema> | undefined) => TreeMapNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>)>;
911
+ } & (FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true ? {
912
+ props?: InsertableTreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TPropsSchema>> | undefined;
913
+ } : {
914
+ props: InsertableTreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TPropsSchema>>;
915
+ }), true, {
916
+ readonly props: TPropsSchema;
917
+ readonly id: FieldSchema_2<FieldKind_3.Identifier, LeafSchema_3<"string", string>, unknown>;
918
+ readonly cells: FieldSchema_2<FieldKind_3.Required, TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, TreeMapNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>, unknown>;
919
+ }>;
920
+ // @system
921
+ export function createTableSchema<const TInputScope extends string | undefined, const TCellSchema extends ImplicitAllowedTypes, const TColumnSchema extends ColumnSchemaBase<TInputScope, TCellSchema>, const TRowSchema extends RowSchemaBase<TInputScope, TCellSchema>>(inputSchemaFactory: SchemaFactoryAlpha<TInputScope>, _cellSchema: TCellSchema, columnSchema: TColumnSchema, rowSchema: TRowSchema): TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table">, NodeKind.Object, true, {
922
+ readonly rows: TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, true, TRowSchema, undefined>;
923
+ readonly columns: TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, true, TColumnSchema, undefined>;
924
+ }, object & {
925
+ readonly rows: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)>;
926
+ readonly columns: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)>;
927
+ }, unknown> & (new (data: InternalTreeNode | (object & {
928
+ readonly rows: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)>;
929
+ readonly columns: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)>;
930
+ })) => TreeNode & TableSchema.Table<TInputScope, TCellSchema, TColumnSchema, TRowSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table">, NodeKind, unknown>) & {
931
+ empty<TThis extends new (data: {
932
+ readonly rows: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, true, TRowSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>> | undefined) => TreeArrayNode<TRowSchema, [TRowSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TRowSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TRowSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.rows">, NodeKind.Array, unknown>)>;
933
+ readonly columns: (InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>), TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, true, TColumnSchema, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>>, unknown> & (new (data?: InternalTreeNode | Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>> | undefined) => TreeArrayNode<TColumnSchema, [TColumnSchema] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TColumnSchema> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, [TColumnSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema> : never, ReadonlyArrayNode_2<TreeNode | TreeLeafValue_2>> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table.columns">, NodeKind.Array, unknown>)>;
934
+ }) => TreeNode & TableSchema.Table<TInputScope, TCellSchema, TColumnSchema, TRowSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table">, NodeKind, unknown>>(this: TThis): InstanceType<TThis>;
935
+ };
936
+ // @system
937
+ export type DefaultPropsType = ReturnType<typeof SchemaFactory.optional<[]>>;
938
+ // @system
939
+ export interface OptionsWithCellSchema<TCellSchema extends ImplicitAllowedTypes> {
940
+ readonly cell: TCellSchema;
941
+ }
942
+ // @system
943
+ export interface OptionsWithSchemaFactory<TSchemaFactory extends SchemaFactoryAlpha> {
944
+ readonly schemaFactory: TSchemaFactory;
945
+ }
946
+ // @sealed @system
947
+ export type RowSchemaBase<TScope extends string | undefined = string | undefined, TCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes, TPropsSchema extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema> = ReturnType<typeof createRowSchema<TScope, TCellSchema, TPropsSchema>>;
948
+ // @system
949
+ export type TableFactoryOptionsBase<TSchemaFactory extends SchemaFactoryAlpha = SchemaFactoryAlpha, TCell extends ImplicitAllowedTypes = ImplicitAllowedTypes> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCell>;
950
+ // @sealed @system
951
+ export type TableSchemaBase<TScope extends string | undefined, TCell extends ImplicitAllowedTypes, TColumn extends ColumnSchemaBase<TScope, TCell>, TRow extends RowSchemaBase<TScope, TCell>> = ReturnType<typeof createTableSchema<TScope, TCell, TColumn, TRow>>;
952
+ }
953
+
890
954
  // @public @system
891
955
  export namespace System_Unsafe {
892
956
  // @system
@@ -970,6 +1034,101 @@ export namespace System_Unsafe {
970
1034
  export type TreeObjectNodeUnsafe<T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object, T>;
971
1035
  }
972
1036
 
1037
+ // @alpha
1038
+ export namespace TableSchema {
1039
+ export interface CellKey<TColumn extends ImplicitAllowedTypes, TRow extends ImplicitAllowedTypes> {
1040
+ readonly column: string | TreeNodeFromImplicitAllowedTypes<TColumn>;
1041
+ readonly row: string | TreeNodeFromImplicitAllowedTypes<TRow>;
1042
+ }
1043
+ // @sealed
1044
+ export interface Column<TCell extends ImplicitAllowedTypes, TProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema> {
1045
+ getCells(): readonly {
1046
+ rowId: string;
1047
+ cell: TreeNodeFromImplicitAllowedTypes<TCell>;
1048
+ }[];
1049
+ readonly id: string;
1050
+ get props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>;
1051
+ set props(value: InsertableTreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>);
1052
+ }
1053
+ export function column<const TScope extends string | undefined, const TCell extends ImplicitAllowedTypes>(params: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>, TCell>): System_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>;
1054
+ export function column<const TScope extends string | undefined, const TCell extends ImplicitAllowedTypes, const TProps extends ImplicitAnnotatedFieldSchema>(params: System_TableSchema.CreateColumnOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {
1055
+ readonly props: TProps;
1056
+ }): System_TableSchema.ColumnSchemaBase<TScope, TCell, TProps>;
1057
+ export interface InsertColumnParameters<TColumn extends ImplicitAllowedTypes> {
1058
+ readonly column: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>;
1059
+ readonly index?: number | undefined;
1060
+ }
1061
+ export interface InsertColumnsParameters<TColumn extends ImplicitAllowedTypes> {
1062
+ readonly columns: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>[];
1063
+ readonly index?: number | undefined;
1064
+ }
1065
+ export interface InsertRowParameters<TRow extends ImplicitAllowedTypes> {
1066
+ readonly index?: number | undefined;
1067
+ readonly row: InsertableTreeNodeFromImplicitAllowedTypes<TRow>;
1068
+ }
1069
+ export interface InsertRowsParameters<TRow extends ImplicitAllowedTypes> {
1070
+ readonly index?: number | undefined;
1071
+ readonly rows: InsertableTreeNodeFromImplicitAllowedTypes<TRow>[];
1072
+ }
1073
+ // @sealed
1074
+ export interface Row<TCell extends ImplicitAllowedTypes, TProps extends ImplicitAnnotatedFieldSchema = ImplicitAnnotatedFieldSchema> {
1075
+ getCell(column: Column<TCell>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1076
+ getCell(columnId: string): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1077
+ getCells(): readonly {
1078
+ columnId: string;
1079
+ cell: TreeNodeFromImplicitAllowedTypes<TCell>;
1080
+ }[];
1081
+ readonly id: string;
1082
+ get props(): TreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>;
1083
+ set props(value: InsertableTreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TProps>>);
1084
+ removeCell(column: Column<TCell>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1085
+ removeCell(columnId: string): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1086
+ setCell(column: Column<TCell>, value: InsertableTreeNodeFromImplicitAllowedTypes<TCell>): void;
1087
+ setCell(columnId: string, value: InsertableTreeNodeFromImplicitAllowedTypes<TCell>): void;
1088
+ }
1089
+ export function row<const TScope extends string | undefined, const TCell extends ImplicitAllowedTypes>(params: System_TableSchema.CreateRowOptionsBase<SchemaFactoryAlpha<TScope>, TCell>): System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>;
1090
+ export function row<const TScope extends string | undefined, const TCell extends ImplicitAllowedTypes, const TProps extends ImplicitAnnotatedFieldSchema>(params: System_TableSchema.CreateRowOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {
1091
+ readonly props: TProps;
1092
+ }): System_TableSchema.RowSchemaBase<TScope, TCell, TProps>;
1093
+ export interface SetCellParameters<TCell extends ImplicitAllowedTypes, TColumn extends ImplicitAllowedTypes, TRow extends ImplicitAllowedTypes> {
1094
+ readonly cell: InsertableTreeNodeFromImplicitAllowedTypes<TCell>;
1095
+ readonly key: CellKey<TColumn, TRow>;
1096
+ }
1097
+ // @sealed
1098
+ export interface Table<TScope extends string | undefined, TCell extends ImplicitAllowedTypes, TColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>, TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>> {
1099
+ readonly columns: TreeArrayNode<TColumn>;
1100
+ getCell(key: CellKey<TColumn, TRow>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1101
+ getColumn(id: string): TreeNodeFromImplicitAllowedTypes<TColumn> | undefined;
1102
+ getRow(id: string): TreeNodeFromImplicitAllowedTypes<TRow> | undefined;
1103
+ insertColumn(params: InsertColumnParameters<TColumn>): TreeNodeFromImplicitAllowedTypes<TColumn>;
1104
+ insertColumns(params: InsertColumnsParameters<TColumn>): TreeNodeFromImplicitAllowedTypes<TColumn>[];
1105
+ insertRow(params: InsertRowParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>;
1106
+ insertRows(params: InsertRowsParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>[];
1107
+ removeAllColumns(): TreeNodeFromImplicitAllowedTypes<TColumn>[];
1108
+ removeAllRows(): TreeNodeFromImplicitAllowedTypes<TRow>[];
1109
+ removeCell(key: CellKey<TColumn, TRow>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;
1110
+ removeColumn(column: string | TreeNodeFromImplicitAllowedTypes<TColumn>): TreeNodeFromImplicitAllowedTypes<TColumn>;
1111
+ removeColumns(columns: readonly TreeNodeFromImplicitAllowedTypes<TColumn>[]): TreeNodeFromImplicitAllowedTypes<TColumn>[];
1112
+ removeColumns(columns: readonly string[]): TreeNodeFromImplicitAllowedTypes<TColumn>[];
1113
+ removeRow(row: string | TreeNodeFromImplicitAllowedTypes<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>;
1114
+ removeRows(rows: readonly TreeNodeFromImplicitAllowedTypes<TRow>[]): TreeNodeFromImplicitAllowedTypes<TRow>[];
1115
+ removeRows(rows: readonly string[]): TreeNodeFromImplicitAllowedTypes<TRow>[];
1116
+ readonly rows: TreeArrayNode<TRow>;
1117
+ setCell(params: SetCellParameters<TCell, TColumn, TRow>): void;
1118
+ }
1119
+ export function table<const TScope extends string | undefined, const TCell extends ImplicitAllowedTypes>(params: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell>): System_TableSchema.TableSchemaBase<TScope, TCell, System_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>, System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>>;
1120
+ export function table<const TScope extends string | undefined, const TCell extends ImplicitAllowedTypes, const TColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>>(params: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {
1121
+ readonly column: TColumn;
1122
+ }): System_TableSchema.TableSchemaBase<TScope, TCell, TColumn, System_TableSchema.RowSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>>;
1123
+ export function table<const TScope extends string | undefined, const TCell extends ImplicitAllowedTypes, const TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>>(params: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {
1124
+ readonly row: TRow;
1125
+ }): System_TableSchema.TableSchemaBase<TScope, TCell, System_TableSchema.ColumnSchemaBase<TScope, TCell, System_TableSchema.DefaultPropsType>, TRow>;
1126
+ export function table<const TScope extends string | undefined, const TCell extends ImplicitAllowedTypes, const TColumn extends System_TableSchema.ColumnSchemaBase<TScope, TCell>, const TRow extends System_TableSchema.RowSchemaBase<TScope, TCell>>(params: System_TableSchema.TableFactoryOptionsBase<SchemaFactoryAlpha<TScope>, TCell> & {
1127
+ readonly column: TColumn;
1128
+ readonly row: TRow;
1129
+ }): System_TableSchema.TableSchemaBase<TScope, TCell, TColumn, TRow>;
1130
+ }
1131
+
973
1132
  // @alpha
974
1133
  export type TransactionCallbackStatus<TSuccessValue, TFailureValue> = ({
975
1134
  rollback?: false;
@@ -1027,6 +1186,7 @@ export interface TreeAlpha {
1027
1186
  } & ICodecOptions): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
1028
1187
  importConcise<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(schema: UnsafeUnknownSchema extends TSchema ? ImplicitFieldSchema : TSchema & ImplicitFieldSchema, data: ConciseTree | undefined): Unhydrated<TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeNode | TreeLeafValue | undefined>;
1029
1188
  importVerbose<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: VerboseTree | undefined, options?: Partial<TreeEncodingOptions>): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
1189
+ key2(node: TreeNode): string | number | undefined;
1030
1190
  }
1031
1191
 
1032
1192
  // @alpha
package/dist/alpha.d.ts CHANGED
@@ -168,6 +168,8 @@ export {
168
168
  SimpleObjectNodeSchema,
169
169
  SimpleTreeIndex,
170
170
  SimpleTreeSchema,
171
+ System_TableSchema,
172
+ TableSchema,
171
173
  TransactionCallbackStatus,
172
174
  TransactionResult,
173
175
  TransactionResultExt,
@@ -184,7 +184,23 @@ export declare function withSchemaValidation<TInMemoryFormat, EncodedSchema exte
184
184
  * Versions of Fluid Framework client packages.
185
185
  * @remarks
186
186
  * Used to express compatibility requirements by indicating the oldest version with which compatibility must be maintained.
187
+ *
188
+ * When no compatibility-impacting change is made in a given version, the value associated with its enum entry may point to the older version which it's fully compatible with.
189
+ * Note that this can change if a future version of the framework introduces an option to use something which is only supported at a particular version. In which case, the values of the enum may shift,
190
+ * but the semantics of keys in this enum will not change.
191
+ *
192
+ * Do not depend on the value of this enums's entries: only depend on the keys (enum members) themselves.
193
+ *
194
+ * Some release may also be omitted if there is currently no need to express that specific version.
195
+ * If the need arises, they might be added in the future.
196
+ *
187
197
  * @privateRemarks
198
+ * Entries in these enums should document the user facing impact of opting into a particular version.
199
+ * For example, document if there is an encoding efficiency improvement of oping into that version or newer.
200
+ * Versions with no notable impact can be omitted.
201
+ *
202
+ * These use numeric values for easy threshold comparisons.
203
+ *
188
204
  * This scheme assumes a single version will always be enough to communicate compatibility.
189
205
  * For this to work, compatibility has to be strictly increasing.
190
206
  * If this is violated (for example a subset of incompatible features from 3.x that are not in 3.0 are back ported to 2.x),
@@ -195,17 +211,36 @@ export declare function withSchemaValidation<TInMemoryFormat, EncodedSchema exte
195
211
  * @alpha
196
212
  */
197
213
  export declare enum FluidClientVersion {
214
+ /**
215
+ * Fluid Framework Client 1.4 and newer.
216
+ * @remarks
217
+ * This opts into support for the 1.4 LTS branch.
218
+ * @privateRemarks
219
+ * As long as this code is in Tree, there is no reason to have this option as SharedTree did not exist in 1.4.
220
+ */
198
221
  /** Fluid Framework Client 2.0 and newer. */
199
- v2_0 = "v2_0",
222
+ v2_0 = 2,
200
223
  /** Fluid Framework Client 2.1 and newer. */
201
- v2_1 = "v2_1",
202
- /** Fluid Framework Client 2.2 and newer. */
203
- v2_2 = "v2_2",
204
- /** Fluid Framework Client 2.3 and newer. */
205
- v2_3 = "v2_3"
224
+ /** Fluid Framework Client 2.41 and newer. */
225
+ /**
226
+ * Enable unreleased and unfinished features.
227
+ * @remarks
228
+ * Using this value can result in documents which can not be opened in future versions of the framework.
229
+ * It can also result in data corruption by enabling unfinished features which may not handle all cases correctly.
230
+ *
231
+ * This can be used with specific APIs when the caller has knowledge of what specific features those APIs will be opted into with it.
232
+ * This is useful for testing features before they are released, but should not be used in production code.
233
+ */
234
+ EnableUnstableFeatures
206
235
  }
207
236
  /**
208
- * The version of this code.
237
+ * An up to date version which includes all the important stable features.
238
+ * @remarks
239
+ * Use for cases when data is not persisted and thus would only ever be read by the current version of the framework.
240
+ *
241
+ * @privateRemarks
242
+ * Update as needed.
243
+ * TODO: Consider using packageVersion.ts to keep this current.
209
244
  */
210
245
  export declare const currentVersion: FluidClientVersion;
211
246
  //# sourceMappingURL=codec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/codec/codec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAkB,MAAM,8BAA8B,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ;IACrD;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACnD;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ;IACrD;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACnD;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB,CAAC,MAAM,SAAS,OAAO;IAC/D;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC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,CAAC,CAKvF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,EACtD,KAAK,EACF,iBAAiB,CAAC,QAAQ,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,QAAQ,CAAC,GACrF,UAAU,CAAC,QAAQ,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,QAAQ,CAAC,GAC/E,iBAAiB,CAAC,QAAQ,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,QAAQ,CAAC,CAEvF;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,iBAAiB,CACxC,CAAC,EACD,sBAAsB,EACtB,sBAAsB,EACtB,OAAO,CAUP,CAAC;AAEF;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,eAAe,EACf,aAAa,SAAS,OAAO,EAC7B,cAAc,GAAG,sBAAsB,EACvC,SAAS,GAAG,cAAc,EAC1B,QAAQ,GAAG,qBAAqB,EAEhC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,UAAU,CAAC,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,CAAC,EACvE,SAAS,CAAC,EAAE,aAAa,GACvB,UAAU,CAAC,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,CAAC,CAqBlE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,oBAAY,kBAAkB;IAC7B;;;;;;OAMG;IAGH,4CAA4C;IAC5C,IAAI,IAAM;IAEV,4CAA4C;IAM5C,6CAA6C;IAI7C;;;;;;;;OAQG;IACH,sBAAiD;CACjD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,EAAE,kBAA4C,CAAC"}
@@ -112,7 +112,23 @@ exports.withSchemaValidation = withSchemaValidation;
112
112
  * Versions of Fluid Framework client packages.
113
113
  * @remarks
114
114
  * Used to express compatibility requirements by indicating the oldest version with which compatibility must be maintained.
115
+ *
116
+ * When no compatibility-impacting change is made in a given version, the value associated with its enum entry may point to the older version which it's fully compatible with.
117
+ * Note that this can change if a future version of the framework introduces an option to use something which is only supported at a particular version. In which case, the values of the enum may shift,
118
+ * but the semantics of keys in this enum will not change.
119
+ *
120
+ * Do not depend on the value of this enums's entries: only depend on the keys (enum members) themselves.
121
+ *
122
+ * Some release may also be omitted if there is currently no need to express that specific version.
123
+ * If the need arises, they might be added in the future.
124
+ *
115
125
  * @privateRemarks
126
+ * Entries in these enums should document the user facing impact of opting into a particular version.
127
+ * For example, document if there is an encoding efficiency improvement of oping into that version or newer.
128
+ * Versions with no notable impact can be omitted.
129
+ *
130
+ * These use numeric values for easy threshold comparisons.
131
+ *
116
132
  * This scheme assumes a single version will always be enough to communicate compatibility.
117
133
  * For this to work, compatibility has to be strictly increasing.
118
134
  * If this is violated (for example a subset of incompatible features from 3.x that are not in 3.0 are back ported to 2.x),
@@ -124,17 +140,43 @@ exports.withSchemaValidation = withSchemaValidation;
124
140
  */
125
141
  var FluidClientVersion;
126
142
  (function (FluidClientVersion) {
143
+ /**
144
+ * Fluid Framework Client 1.4 and newer.
145
+ * @remarks
146
+ * This opts into support for the 1.4 LTS branch.
147
+ * @privateRemarks
148
+ * As long as this code is in Tree, there is no reason to have this option as SharedTree did not exist in 1.4.
149
+ */
150
+ // v1_4 = 1.4,
127
151
  /** Fluid Framework Client 2.0 and newer. */
128
- FluidClientVersion["v2_0"] = "v2_0";
152
+ FluidClientVersion[FluidClientVersion["v2_0"] = 2] = "v2_0";
129
153
  /** Fluid Framework Client 2.1 and newer. */
130
- FluidClientVersion["v2_1"] = "v2_1";
131
- /** Fluid Framework Client 2.2 and newer. */
132
- FluidClientVersion["v2_2"] = "v2_2";
133
- /** Fluid Framework Client 2.3 and newer. */
134
- FluidClientVersion["v2_3"] = "v2_3";
154
+ // If we think we might want to start allowing opting into something that landed in 2.1 (without opting into something newer),
155
+ // we could add an entry like this to allow users to indicate that they can be opted in once we are ready,
156
+ // then update it to "v2_1" once we actually have the opt in working.
157
+ // v2_1 = v2_0,
158
+ /** Fluid Framework Client 2.41 and newer. */
159
+ // If we land some new formats in 2.41, we can enable selecting
160
+ // v2_41 = 2.41,
161
+ /**
162
+ * Enable unreleased and unfinished features.
163
+ * @remarks
164
+ * Using this value can result in documents which can not be opened in future versions of the framework.
165
+ * It can also result in data corruption by enabling unfinished features which may not handle all cases correctly.
166
+ *
167
+ * This can be used with specific APIs when the caller has knowledge of what specific features those APIs will be opted into with it.
168
+ * This is useful for testing features before they are released, but should not be used in production code.
169
+ */
170
+ FluidClientVersion[FluidClientVersion["EnableUnstableFeatures"] = Number.POSITIVE_INFINITY] = "EnableUnstableFeatures";
135
171
  })(FluidClientVersion || (exports.FluidClientVersion = FluidClientVersion = {}));
136
172
  /**
137
- * The version of this code.
173
+ * An up to date version which includes all the important stable features.
174
+ * @remarks
175
+ * Use for cases when data is not persisted and thus would only ever be read by the current version of the framework.
176
+ *
177
+ * @privateRemarks
178
+ * Update as needed.
179
+ * TODO: Consider using packageVersion.ts to keep this current.
138
180
  */
139
- exports.currentVersion = FluidClientVersion.v2_3;
181
+ exports.currentVersion = FluidClientVersion.v2_0;
140
182
  //# sourceMappingURL=codec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/codec/codec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyE;AACzE,kEAAmE;AAmLnE;;;GAGG;AACH,SAAgB,eAAe,CAC9B,QAOC;IAED,MAAM,MAAM,GAGR,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,MAAM,CAAC,aAAa,EAAE,KAAK,CAAC,IAAI,QAAQ,EAAE,CAAC;QAC/C,IAAI,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;YAC/B,IAAA,eAAI,EAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAC/C,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC;IACxD,CAAC;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AC3G,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAA+B,CAAC;QACrE,CAAC;KACD,CAAC;AACH,CAAC;AA/BD,oDA+BC;AAED;;;;;;;;;;;;;GAaG;AACH,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC7B,4CAA4C;IAC5C,mCAAa,CAAA;IACb,4CAA4C;IAC5C,mCAAa,CAAA;IACb,4CAA4C;IAC5C,mCAAa,CAAA;IACb,4CAA4C;IAC5C,mCAAa,CAAA;AACd,CAAC,EATW,kBAAkB,kCAAlB,kBAAkB,QAS7B;AAED;;GAEG;AACU,QAAA,cAAc,GAAuB,kBAAkB,CAAC,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer, bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { Static, TAnySchema, TSchema } from \"@sinclair/typebox\";\n\nimport type { ChangeEncodingContext } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\n/**\n * Translates decoded data to encoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IEncoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Encodes `obj` into some encoded format.\n\t */\n\tencode(obj: TDecoded, context: TContext): TEncoded;\n}\n\n/**\n * Translates encoded data to decoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IDecoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Decodes `obj` from some encoded format.\n\t */\n\tdecode(obj: TEncoded, context: TContext): TDecoded;\n}\n\n/**\n * Validates data complies with some particular schema.\n * Implementations are typically created by a {@link JsonValidator}.\n * @alpha\n */\nexport interface SchemaValidationFunction<Schema extends TSchema> {\n\t/**\n\t * Returns whether the data matches a schema.\n\t */\n\tcheck(data: unknown): data is Static<Schema>;\n}\n\n/**\n * JSON schema validator compliant with draft 6 schema. See https://json-schema.org.\n * @alpha\n */\nexport interface JsonValidator {\n\t/**\n\t * Compiles the provided JSON schema into a validator for that schema.\n\t * @param schema - A valid draft 6 JSON schema\n\t * @remarks IFluidHandles--which have circular property references--are used in various places in SharedTree's persisted\n\t * format. Handles should only be contained in sections of data which are validated against the empty schema `{}`\n\t * (see https://datatracker.ietf.org/doc/html/draft-wright-json-schema-01#section-4.4).\n\t *\n\t * Implementations of `JsonValidator` must therefore tolerate these values, despite the input not being valid JSON.\n\t */\n\tcompile<Schema extends TSchema>(schema: Schema): SchemaValidationFunction<Schema>;\n}\n\n/**\n * Options relating to handling of persisted data.\n * @alpha\n */\nexport interface ICodecOptions {\n\t/**\n\t * {@link JsonValidator} which SharedTree uses to validate persisted data it reads & writes\n\t * matches the expected encoded format (i.e. the wire format for ops and summaries).\n\t *\n\t * See {@link noopValidator} and {@link typeboxValidator} for out-of-the-box implementations.\n\t *\n\t * This option is not \"on-by-default\" because JSON schema validation comes with a small but noticeable\n\t * runtime performance cost, and popular schema validation libraries have relatively large bundle size.\n\t *\n\t * SharedTree users are still encouraged to use a non-trivial validator (i.e. not `noopValidator`)\n\t * whenever reasonable: it gives better fail-fast behavior when unexpected encoded data is found,\n\t * which reduces the risk of unrecoverable data corruption.\n\t */\n\treadonly jsonValidator: JsonValidator;\n}\n\n/**\n * `TContext` allows passing context to the codec which may configure how data is encoded/decoded.\n * This parameter is typically used for:\n * - Codecs which can pick from multiple encoding options, and imbue the encoded data with information about which option was used.\n * The caller of such a codec can provide context about which encoding choice to make as part of the `encode` call without creating\n * additional codecs. Note that this pattern can always be implemented by having the caller create multiple codecs and selecting the\n * appropriate one, but depending on API layering this might be less ergonomic.\n * - Context for the object currently being encoded, which might enable more efficient encoding. When used in this fashion, the codec author\n * should be careful to include the context somewhere in the encoded data such that decoding can correctly round-trip.\n * For example, a composed set of codecs could implement a form of [dictionary coding](https://en.wikipedia.org/wiki/Dictionary_coder)\n * using a context map which was created by the top-level codec and passed to the inner codecs.\n * This pattern is used:\n * - To avoid repeatedly encoding session ids on commits (only recording it once at the top level)\n * @remarks `TEncoded` should always be valid Json (i.e. not contain functions), but due to TypeScript's handling\n * of index signatures and `JsonCompatibleReadOnly`'s index signature in the Json object case, specifying this as a\n * type-system level constraint makes code that uses this interface more difficult to write.\n *\n * If provided, `TValidate` allows the input type passed to `decode` to be different than `TEncoded`.\n * This is useful when, for example, the type being decoded is `unknown` and must be validated to be a `TEncoded` before being decoded to a `TDecoded`.\n */\nexport interface IJsonCodec<\n\tTDecoded,\n\tTEncoded = JsonCompatibleReadOnly,\n\tTValidate = TEncoded,\n\tTContext = void,\n> extends IEncoder<TDecoded, TEncoded, TContext>,\n\t\tIDecoder<TDecoded, TValidate, TContext> {\n\tencodedSchema?: TAnySchema;\n}\n\n/**\n * @remarks TODO: We might consider using DataView or some kind of writer instead of IsoBuffer.\n */\nexport interface IBinaryCodec<TDecoded, TContext = void>\n\textends IEncoder<TDecoded, IsoBuffer, TContext>,\n\t\tIDecoder<TDecoded, IsoBuffer, TContext> {}\n\n/**\n * Contains knowledge of how to encode some in-memory type into JSON and binary formats,\n * as well as how to decode those representations.\n *\n * @remarks Codecs are typically used in shared-tree to convert data into some persisted format.\n * For this common use case, any format for encoding that was ever actually used needs to\n * be supported for decoding in all future code versions.\n *\n * Using an {@link ICodecFamily} is the recommended strategy for managing this support, keeping in\n * mind evolution of encodings over time.\n */\nexport interface IMultiFormatCodec<\n\tTDecoded,\n\tTJsonEncoded extends JsonCompatibleReadOnly = JsonCompatibleReadOnly,\n\tTJsonValidate = TJsonEncoded,\n\tTContext = void,\n> {\n\tjson: IJsonCodec<TDecoded, TJsonEncoded, TJsonValidate, TContext>;\n\tbinary: IBinaryCodec<TDecoded, TContext>;\n\n\t/** Ensures multi-format codecs cannot also be single-format codecs. */\n\tencode?: never;\n\t/** Ensures multi-format codecs cannot also be single-format codecs. */\n\tdecode?: never;\n}\n\n/**\n * Represents a family of codecs that can be used to encode and decode data in different formats.\n * The family is identified by a format version, which is typically used to select the codec to use.\n *\n * Separating codecs into families rather than having a single codec support multiple versions (i.e. currying\n * the `formatVersion` parameter)\n * allows avoiding some duplicate work at encode/decode time, since the vast majority of document usage will not\n * involve mixed format versions.\n *\n * @privateRemarks - This interface currently assumes all codecs in a family require the same encode/decode context,\n * which isn't necessarily true.\n * This may need to be relaxed in the future.\n */\nexport interface ICodecFamily<TDecoded, TContext = void> {\n\t/**\n\t * @returns a codec that can be used to encode and decode data in the specified format.\n\t * @throws - if the format version is not supported by this family.\n\t * @remarks Implementations should typically emit telemetry (either indirectly by throwing a well-known error with\n\t * logged properties or directly using some logger) when a format version is requested that is not supported.\n\t * This ensures that applications can diagnose compatibility issues.\n\t */\n\tresolve(\n\t\tformatVersion: FormatVersion,\n\t): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>;\n\n\t/**\n\t * @returns an iterable of all format versions supported by this family.\n\t */\n\tgetSupportedFormats(): Iterable<FormatVersion>;\n}\n\n/**\n * A version stamp for encoded data.\n *\n * Undefined is tolerated to enable the scenario where data was not initially versioned.\n */\nexport type FormatVersion = number | undefined;\n\n/**\n * Creates a codec family from a registry of codecs.\n * Any codec that is not a {@link IMultiFormatCodec} will be wrapped with a default binary encoding.\n */\nexport function makeCodecFamily<TDecoded, TContext>(\n\tregistry: Iterable<\n\t\t[\n\t\t\tformatVersion: FormatVersion,\n\t\t\tcodec:\n\t\t\t\t| IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t\t\t\t| IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n\t\t]\n\t>,\n): ICodecFamily<TDecoded, TContext> {\n\tconst codecs: Map<\n\t\tFormatVersion,\n\t\tIMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t> = new Map();\n\tfor (const [formatVersion, codec] of registry) {\n\t\tif (codecs.has(formatVersion)) {\n\t\t\tfail(0xabf /* Duplicate codecs specified. */);\n\t\t}\n\t\tcodecs.set(formatVersion, ensureBinaryEncoding(codec));\n\t}\n\n\treturn {\n\t\tresolve(\n\t\t\tformatVersion: number,\n\t\t): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\t\t\tconst codec = codecs.get(formatVersion);\n\t\t\tassert(codec !== undefined, 0x5e6 /* Requested coded for unsupported format. */);\n\t\t\treturn codec;\n\t\t},\n\t\tgetSupportedFormats(): Iterable<FormatVersion> {\n\t\t\treturn codecs.keys();\n\t\t},\n\t};\n}\n\nclass DefaultBinaryCodec<TDecoded, TContext> implements IBinaryCodec<TDecoded, TContext> {\n\tpublic constructor(\n\t\tprivate readonly jsonCodec: IJsonCodec<TDecoded, unknown, unknown, TContext>,\n\t) {}\n\n\tpublic encode(change: TDecoded, context: TContext): IsoBuffer {\n\t\tconst jsonable = this.jsonCodec.encode(change, context);\n\t\tconst json = JSON.stringify(jsonable);\n\t\treturn IsoBuffer.from(json);\n\t}\n\n\tpublic decode(change: IsoBuffer, context: TContext): TDecoded {\n\t\tconst json = bufferToString(change, \"utf8\");\n\t\tconst jsonable = JSON.parse(json);\n\t\treturn this.jsonCodec.decode(jsonable, context);\n\t}\n}\n\nfunction isJsonCodec<TDecoded, TContext>(\n\tcodec:\n\t\t| IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t\t| IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n): codec is IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\treturn typeof codec.encode === \"function\" && typeof codec.decode === \"function\";\n}\n\n/**\n * Constructs a {@link IMultiFormatCodec} from a `IJsonCodec` using a generic binary encoding that simply writes\n * the json representation of the object to a buffer.\n */\nexport function withDefaultBinaryEncoding<TDecoded, TContext>(\n\tjsonCodec: IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\treturn {\n\t\tjson: jsonCodec,\n\t\tbinary: new DefaultBinaryCodec(jsonCodec),\n\t};\n}\n\n/**\n * Ensures that the provided single or multi-format codec has a binary encoding.\n * Adapts the json encoding using {@link withDefaultBinaryEncoding} if necessary.\n */\nexport function ensureBinaryEncoding<TDecoded, TContext>(\n\tcodec:\n\t\t| IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t\t| IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\treturn isJsonCodec(codec) ? withDefaultBinaryEncoding(codec) : codec;\n}\n\n/**\n * Codec for objects which carry no information.\n */\nexport const unitCodec: IMultiFormatCodec<\n\t0,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tunknown\n> = {\n\tjson: {\n\t\tencode: () => 0,\n\t\tdecode: () => 0,\n\t},\n\tbinary: {\n\t\tencode: () => IsoBuffer.from(\"\"),\n\t\tdecode: () => 0,\n\t},\n};\n\n/**\n * Wraps a codec with JSON schema validation for its encoded type.\n * @returns An {@link IJsonCodec} which validates the data it encodes and decodes matches the provided schema.\n */\nexport function withSchemaValidation<\n\tTInMemoryFormat,\n\tEncodedSchema extends TSchema,\n\tTEncodedFormat = JsonCompatibleReadOnly,\n\tTValidate = TEncodedFormat,\n\tTContext = ChangeEncodingContext,\n>(\n\tschema: EncodedSchema,\n\tcodec: IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext>,\n\tvalidator?: JsonValidator,\n): IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext> {\n\tif (!validator) {\n\t\treturn codec;\n\t}\n\tconst compiledFormat = validator.compile(schema);\n\treturn {\n\t\tencode: (obj: TInMemoryFormat, context: TContext): TEncodedFormat => {\n\t\t\tconst encoded = codec.encode(obj, context);\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac0 /* Encoded schema should validate */);\n\t\t\t}\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (encoded: TValidate, context: TContext): TInMemoryFormat => {\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac1 /* Encoded schema should validate */);\n\t\t\t}\n\t\t\t// TODO: would be nice to provide a more specific validate type to the inner codec than the outer one gets.\n\t\t\treturn codec.decode(encoded, context) as unknown as TInMemoryFormat;\n\t\t},\n\t};\n}\n\n/**\n * Versions of Fluid Framework client packages.\n * @remarks\n * Used to express compatibility requirements by indicating the oldest version with which compatibility must be maintained.\n * @privateRemarks\n * This scheme assumes a single version will always be enough to communicate compatibility.\n * For this to work, compatibility has to be strictly increasing.\n * If this is violated (for example a subset of incompatible features from 3.x that are not in 3.0 are back ported to 2.x),\n * a more complex scheme may be needed to allow safely opting into incompatible features in those cases:\n * such a system can be added if/when its needed since it will be opt in and thus non-breaking.\n *\n * TODO: this should likely be defined higher in the stack and specified when creating the container, possibly as part of its schema.\n * @alpha\n */\nexport enum FluidClientVersion {\n\t/** Fluid Framework Client 2.0 and newer. */\n\tv2_0 = \"v2_0\",\n\t/** Fluid Framework Client 2.1 and newer. */\n\tv2_1 = \"v2_1\",\n\t/** Fluid Framework Client 2.2 and newer. */\n\tv2_2 = \"v2_2\",\n\t/** Fluid Framework Client 2.3 and newer. */\n\tv2_3 = \"v2_3\",\n}\n\n/**\n * The version of this code.\n */\nexport const currentVersion: FluidClientVersion = FluidClientVersion.v2_3;\n"]}
1
+ {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/codec/codec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyE;AACzE,kEAAmE;AAmLnE;;;GAGG;AACH,SAAgB,eAAe,CAC9B,QAOC;IAED,MAAM,MAAM,GAGR,IAA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AAC;gBACpC,IAAA,eAAI,EAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;YAClD,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,MAAM,EAAE,CAAC,OAAkB,EAAE,OAAiB,EAAmB,EAAE;YAClE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;gBACpC,IAAA,eAAI,EAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;YAClD,CAAC;YACD,2GAA2G;YAC3G,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAA+B,CAAC;QACrE,CAAC;KACD,CAAC;AACH,CAAC;AA/BD,oDA+BC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,IAAY,kBAiCX;AAjCD,WAAY,kBAAkB;IAC7B;;;;;;OAMG;IACH,cAAc;IAEd,4CAA4C;IAC5C,2DAAU,CAAA;IAEV,4CAA4C;IAC5C,8HAA8H;IAC9H,0GAA0G;IAC1G,qEAAqE;IACrE,eAAe;IAEf,6CAA6C;IAC7C,+DAA+D;IAC/D,gBAAgB;IAEhB;;;;;;;;OAQG;IACH,kEAAyB,MAAM,CAAC,iBAAiB,4BAAA,CAAA;AAClD,CAAC,EAjCW,kBAAkB,kCAAlB,kBAAkB,QAiC7B;AAED;;;;;;;;GAQG;AACU,QAAA,cAAc,GAAuB,kBAAkB,CAAC,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer, bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { Static, TAnySchema, TSchema } from \"@sinclair/typebox\";\n\nimport type { ChangeEncodingContext } from \"../core/index.js\";\nimport type { JsonCompatibleReadOnly } from \"../util/index.js\";\n\n/**\n * Translates decoded data to encoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IEncoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Encodes `obj` into some encoded format.\n\t */\n\tencode(obj: TDecoded, context: TContext): TEncoded;\n}\n\n/**\n * Translates encoded data to decoded data.\n * @remarks Typically paired with an {@link IEncoder}.\n */\nexport interface IDecoder<TDecoded, TEncoded, TContext> {\n\t/**\n\t * Decodes `obj` from some encoded format.\n\t */\n\tdecode(obj: TEncoded, context: TContext): TDecoded;\n}\n\n/**\n * Validates data complies with some particular schema.\n * Implementations are typically created by a {@link JsonValidator}.\n * @alpha\n */\nexport interface SchemaValidationFunction<Schema extends TSchema> {\n\t/**\n\t * Returns whether the data matches a schema.\n\t */\n\tcheck(data: unknown): data is Static<Schema>;\n}\n\n/**\n * JSON schema validator compliant with draft 6 schema. See https://json-schema.org.\n * @alpha\n */\nexport interface JsonValidator {\n\t/**\n\t * Compiles the provided JSON schema into a validator for that schema.\n\t * @param schema - A valid draft 6 JSON schema\n\t * @remarks IFluidHandles--which have circular property references--are used in various places in SharedTree's persisted\n\t * format. Handles should only be contained in sections of data which are validated against the empty schema `{}`\n\t * (see https://datatracker.ietf.org/doc/html/draft-wright-json-schema-01#section-4.4).\n\t *\n\t * Implementations of `JsonValidator` must therefore tolerate these values, despite the input not being valid JSON.\n\t */\n\tcompile<Schema extends TSchema>(schema: Schema): SchemaValidationFunction<Schema>;\n}\n\n/**\n * Options relating to handling of persisted data.\n * @alpha\n */\nexport interface ICodecOptions {\n\t/**\n\t * {@link JsonValidator} which SharedTree uses to validate persisted data it reads & writes\n\t * matches the expected encoded format (i.e. the wire format for ops and summaries).\n\t *\n\t * See {@link noopValidator} and {@link typeboxValidator} for out-of-the-box implementations.\n\t *\n\t * This option is not \"on-by-default\" because JSON schema validation comes with a small but noticeable\n\t * runtime performance cost, and popular schema validation libraries have relatively large bundle size.\n\t *\n\t * SharedTree users are still encouraged to use a non-trivial validator (i.e. not `noopValidator`)\n\t * whenever reasonable: it gives better fail-fast behavior when unexpected encoded data is found,\n\t * which reduces the risk of unrecoverable data corruption.\n\t */\n\treadonly jsonValidator: JsonValidator;\n}\n\n/**\n * `TContext` allows passing context to the codec which may configure how data is encoded/decoded.\n * This parameter is typically used for:\n * - Codecs which can pick from multiple encoding options, and imbue the encoded data with information about which option was used.\n * The caller of such a codec can provide context about which encoding choice to make as part of the `encode` call without creating\n * additional codecs. Note that this pattern can always be implemented by having the caller create multiple codecs and selecting the\n * appropriate one, but depending on API layering this might be less ergonomic.\n * - Context for the object currently being encoded, which might enable more efficient encoding. When used in this fashion, the codec author\n * should be careful to include the context somewhere in the encoded data such that decoding can correctly round-trip.\n * For example, a composed set of codecs could implement a form of [dictionary coding](https://en.wikipedia.org/wiki/Dictionary_coder)\n * using a context map which was created by the top-level codec and passed to the inner codecs.\n * This pattern is used:\n * - To avoid repeatedly encoding session ids on commits (only recording it once at the top level)\n * @remarks `TEncoded` should always be valid Json (i.e. not contain functions), but due to TypeScript's handling\n * of index signatures and `JsonCompatibleReadOnly`'s index signature in the Json object case, specifying this as a\n * type-system level constraint makes code that uses this interface more difficult to write.\n *\n * If provided, `TValidate` allows the input type passed to `decode` to be different than `TEncoded`.\n * This is useful when, for example, the type being decoded is `unknown` and must be validated to be a `TEncoded` before being decoded to a `TDecoded`.\n */\nexport interface IJsonCodec<\n\tTDecoded,\n\tTEncoded = JsonCompatibleReadOnly,\n\tTValidate = TEncoded,\n\tTContext = void,\n> extends IEncoder<TDecoded, TEncoded, TContext>,\n\t\tIDecoder<TDecoded, TValidate, TContext> {\n\tencodedSchema?: TAnySchema;\n}\n\n/**\n * @remarks TODO: We might consider using DataView or some kind of writer instead of IsoBuffer.\n */\nexport interface IBinaryCodec<TDecoded, TContext = void>\n\textends IEncoder<TDecoded, IsoBuffer, TContext>,\n\t\tIDecoder<TDecoded, IsoBuffer, TContext> {}\n\n/**\n * Contains knowledge of how to encode some in-memory type into JSON and binary formats,\n * as well as how to decode those representations.\n *\n * @remarks Codecs are typically used in shared-tree to convert data into some persisted format.\n * For this common use case, any format for encoding that was ever actually used needs to\n * be supported for decoding in all future code versions.\n *\n * Using an {@link ICodecFamily} is the recommended strategy for managing this support, keeping in\n * mind evolution of encodings over time.\n */\nexport interface IMultiFormatCodec<\n\tTDecoded,\n\tTJsonEncoded extends JsonCompatibleReadOnly = JsonCompatibleReadOnly,\n\tTJsonValidate = TJsonEncoded,\n\tTContext = void,\n> {\n\tjson: IJsonCodec<TDecoded, TJsonEncoded, TJsonValidate, TContext>;\n\tbinary: IBinaryCodec<TDecoded, TContext>;\n\n\t/** Ensures multi-format codecs cannot also be single-format codecs. */\n\tencode?: never;\n\t/** Ensures multi-format codecs cannot also be single-format codecs. */\n\tdecode?: never;\n}\n\n/**\n * Represents a family of codecs that can be used to encode and decode data in different formats.\n * The family is identified by a format version, which is typically used to select the codec to use.\n *\n * Separating codecs into families rather than having a single codec support multiple versions (i.e. currying\n * the `formatVersion` parameter)\n * allows avoiding some duplicate work at encode/decode time, since the vast majority of document usage will not\n * involve mixed format versions.\n *\n * @privateRemarks - This interface currently assumes all codecs in a family require the same encode/decode context,\n * which isn't necessarily true.\n * This may need to be relaxed in the future.\n */\nexport interface ICodecFamily<TDecoded, TContext = void> {\n\t/**\n\t * @returns a codec that can be used to encode and decode data in the specified format.\n\t * @throws - if the format version is not supported by this family.\n\t * @remarks Implementations should typically emit telemetry (either indirectly by throwing a well-known error with\n\t * logged properties or directly using some logger) when a format version is requested that is not supported.\n\t * This ensures that applications can diagnose compatibility issues.\n\t */\n\tresolve(\n\t\tformatVersion: FormatVersion,\n\t): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>;\n\n\t/**\n\t * @returns an iterable of all format versions supported by this family.\n\t */\n\tgetSupportedFormats(): Iterable<FormatVersion>;\n}\n\n/**\n * A version stamp for encoded data.\n *\n * Undefined is tolerated to enable the scenario where data was not initially versioned.\n */\nexport type FormatVersion = number | undefined;\n\n/**\n * Creates a codec family from a registry of codecs.\n * Any codec that is not a {@link IMultiFormatCodec} will be wrapped with a default binary encoding.\n */\nexport function makeCodecFamily<TDecoded, TContext>(\n\tregistry: Iterable<\n\t\t[\n\t\t\tformatVersion: FormatVersion,\n\t\t\tcodec:\n\t\t\t\t| IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t\t\t\t| IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n\t\t]\n\t>,\n): ICodecFamily<TDecoded, TContext> {\n\tconst codecs: Map<\n\t\tFormatVersion,\n\t\tIMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t> = new Map();\n\tfor (const [formatVersion, codec] of registry) {\n\t\tif (codecs.has(formatVersion)) {\n\t\t\tfail(0xabf /* Duplicate codecs specified. */);\n\t\t}\n\t\tcodecs.set(formatVersion, ensureBinaryEncoding(codec));\n\t}\n\n\treturn {\n\t\tresolve(\n\t\t\tformatVersion: number,\n\t\t): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\t\t\tconst codec = codecs.get(formatVersion);\n\t\t\tassert(codec !== undefined, 0x5e6 /* Requested coded for unsupported format. */);\n\t\t\treturn codec;\n\t\t},\n\t\tgetSupportedFormats(): Iterable<FormatVersion> {\n\t\t\treturn codecs.keys();\n\t\t},\n\t};\n}\n\nclass DefaultBinaryCodec<TDecoded, TContext> implements IBinaryCodec<TDecoded, TContext> {\n\tpublic constructor(\n\t\tprivate readonly jsonCodec: IJsonCodec<TDecoded, unknown, unknown, TContext>,\n\t) {}\n\n\tpublic encode(change: TDecoded, context: TContext): IsoBuffer {\n\t\tconst jsonable = this.jsonCodec.encode(change, context);\n\t\tconst json = JSON.stringify(jsonable);\n\t\treturn IsoBuffer.from(json);\n\t}\n\n\tpublic decode(change: IsoBuffer, context: TContext): TDecoded {\n\t\tconst json = bufferToString(change, \"utf8\");\n\t\tconst jsonable = JSON.parse(json);\n\t\treturn this.jsonCodec.decode(jsonable, context);\n\t}\n}\n\nfunction isJsonCodec<TDecoded, TContext>(\n\tcodec:\n\t\t| IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t\t| IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n): codec is IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\treturn typeof codec.encode === \"function\" && typeof codec.decode === \"function\";\n}\n\n/**\n * Constructs a {@link IMultiFormatCodec} from a `IJsonCodec` using a generic binary encoding that simply writes\n * the json representation of the object to a buffer.\n */\nexport function withDefaultBinaryEncoding<TDecoded, TContext>(\n\tjsonCodec: IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\treturn {\n\t\tjson: jsonCodec,\n\t\tbinary: new DefaultBinaryCodec(jsonCodec),\n\t};\n}\n\n/**\n * Ensures that the provided single or multi-format codec has a binary encoding.\n * Adapts the json encoding using {@link withDefaultBinaryEncoding} if necessary.\n */\nexport function ensureBinaryEncoding<TDecoded, TContext>(\n\tcodec:\n\t\t| IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>\n\t\t| IJsonCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext>,\n): IMultiFormatCodec<TDecoded, JsonCompatibleReadOnly, JsonCompatibleReadOnly, TContext> {\n\treturn isJsonCodec(codec) ? withDefaultBinaryEncoding(codec) : codec;\n}\n\n/**\n * Codec for objects which carry no information.\n */\nexport const unitCodec: IMultiFormatCodec<\n\t0,\n\tJsonCompatibleReadOnly,\n\tJsonCompatibleReadOnly,\n\tunknown\n> = {\n\tjson: {\n\t\tencode: () => 0,\n\t\tdecode: () => 0,\n\t},\n\tbinary: {\n\t\tencode: () => IsoBuffer.from(\"\"),\n\t\tdecode: () => 0,\n\t},\n};\n\n/**\n * Wraps a codec with JSON schema validation for its encoded type.\n * @returns An {@link IJsonCodec} which validates the data it encodes and decodes matches the provided schema.\n */\nexport function withSchemaValidation<\n\tTInMemoryFormat,\n\tEncodedSchema extends TSchema,\n\tTEncodedFormat = JsonCompatibleReadOnly,\n\tTValidate = TEncodedFormat,\n\tTContext = ChangeEncodingContext,\n>(\n\tschema: EncodedSchema,\n\tcodec: IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext>,\n\tvalidator?: JsonValidator,\n): IJsonCodec<TInMemoryFormat, TEncodedFormat, TValidate, TContext> {\n\tif (!validator) {\n\t\treturn codec;\n\t}\n\tconst compiledFormat = validator.compile(schema);\n\treturn {\n\t\tencode: (obj: TInMemoryFormat, context: TContext): TEncodedFormat => {\n\t\t\tconst encoded = codec.encode(obj, context);\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac0 /* Encoded schema should validate */);\n\t\t\t}\n\t\t\treturn encoded;\n\t\t},\n\t\tdecode: (encoded: TValidate, context: TContext): TInMemoryFormat => {\n\t\t\tif (!compiledFormat.check(encoded)) {\n\t\t\t\tfail(0xac1 /* Encoded schema should validate */);\n\t\t\t}\n\t\t\t// TODO: would be nice to provide a more specific validate type to the inner codec than the outer one gets.\n\t\t\treturn codec.decode(encoded, context) as unknown as TInMemoryFormat;\n\t\t},\n\t};\n}\n\n/**\n * Versions of Fluid Framework client packages.\n * @remarks\n * Used to express compatibility requirements by indicating the oldest version with which compatibility must be maintained.\n *\n * When no compatibility-impacting change is made in a given version, the value associated with its enum entry may point to the older version which it's fully compatible with.\n * Note that this can change if a future version of the framework introduces an option to use something which is only supported at a particular version. In which case, the values of the enum may shift,\n * but the semantics of keys in this enum will not change.\n *\n * Do not depend on the value of this enums's entries: only depend on the keys (enum members) themselves.\n *\n * Some release may also be omitted if there is currently no need to express that specific version.\n * If the need arises, they might be added in the future.\n *\n * @privateRemarks\n * Entries in these enums should document the user facing impact of opting into a particular version.\n * For example, document if there is an encoding efficiency improvement of oping into that version or newer.\n * Versions with no notable impact can be omitted.\n *\n * These use numeric values for easy threshold comparisons.\n *\n * This scheme assumes a single version will always be enough to communicate compatibility.\n * For this to work, compatibility has to be strictly increasing.\n * If this is violated (for example a subset of incompatible features from 3.x that are not in 3.0 are back ported to 2.x),\n * a more complex scheme may be needed to allow safely opting into incompatible features in those cases:\n * such a system can be added if/when its needed since it will be opt in and thus non-breaking.\n *\n * TODO: this should likely be defined higher in the stack and specified when creating the container, possibly as part of its schema.\n * @alpha\n */\nexport enum FluidClientVersion {\n\t/**\n\t * Fluid Framework Client 1.4 and newer.\n\t * @remarks\n\t * This opts into support for the 1.4 LTS branch.\n\t * @privateRemarks\n\t * As long as this code is in Tree, there is no reason to have this option as SharedTree did not exist in 1.4.\n\t */\n\t// v1_4 = 1.4,\n\n\t/** Fluid Framework Client 2.0 and newer. */\n\tv2_0 = 2.0,\n\n\t/** Fluid Framework Client 2.1 and newer. */\n\t// If we think we might want to start allowing opting into something that landed in 2.1 (without opting into something newer),\n\t// we could add an entry like this to allow users to indicate that they can be opted in once we are ready,\n\t// then update it to \"v2_1\" once we actually have the opt in working.\n\t// v2_1 = v2_0,\n\n\t/** Fluid Framework Client 2.41 and newer. */\n\t// If we land some new formats in 2.41, we can enable selecting\n\t// v2_41 = 2.41,\n\n\t/**\n\t * Enable unreleased and unfinished features.\n\t * @remarks\n\t * Using this value can result in documents which can not be opened in future versions of the framework.\n\t * It can also result in data corruption by enabling unfinished features which may not handle all cases correctly.\n\t *\n\t * This can be used with specific APIs when the caller has knowledge of what specific features those APIs will be opted into with it.\n\t * This is useful for testing features before they are released, but should not be used in production code.\n\t */\n\tEnableUnstableFeatures = Number.POSITIVE_INFINITY,\n}\n\n/**\n * An up to date version which includes all the important stable features.\n * @remarks\n * Use for cases when data is not persisted and thus would only ever be read by the current version of the framework.\n *\n * @privateRemarks\n * Update as needed.\n * TODO: Consider using packageVersion.ts to keep this current.\n */\nexport const currentVersion: FluidClientVersion = FluidClientVersion.v2_0;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"editBuilder.d.ts","sourceRoot":"","sources":["../../../src/core/change-family/editBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE1E,8BAAsB,WAAW,CAAC,OAAO,CAAE,YAAW,kBAAkB;IAEtE,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAC1E,OAAO,CAAC,QAAQ,CAAC,cAAc;gBADZ,YAAY,EAAE,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC,EACzD,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,IAAI;IAGzE;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI;IAInD,gBAAgB,IAAI,IAAI;IACxB,eAAe,IAAI,IAAI;CAC9B"}
1
+ {"version":3,"file":"editBuilder.d.ts","sourceRoot":"","sources":["../../../src/core/change-family/editBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE1E,8BAAsB,WAAW,CAAC,OAAO,CAAE,YAAW,kBAAkB;IAEtE,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAC1E,OAAO,CAAC,QAAQ,CAAC,cAAc;gBADZ,YAAY,EAAE,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC,EACzD,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,IAAI;IAGzE;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI;IAInD,gBAAgB,IAAI,IAAI;IACxB,eAAe,IAAI,IAAI;CAC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"editBuilder.js","sourceRoot":"","sources":["../../../src/core/change-family/editBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,MAAsB,WAAW;IAChC,YACoB,YAAuD,EACzD,cAAuD;QADrD,iBAAY,GAAZ,YAAY,CAA2C;QACzD,mBAAc,GAAd,cAAc,CAAyC;IACtE,CAAC;IAEJ;;;;OAIG;IACO,WAAW,CAAC,MAA6B;QAClD,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAEM,gBAAgB,KAAU,CAAC;IAC3B,eAAe,KAAU,CAAC;CACjC;AAjBD,kCAiBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TaggedChange } from \"../rebase/index.js\";\nimport type { ChangeFamily, ChangeFamilyEditor } from \"./changeFamily.js\";\n\nexport abstract class EditBuilder<TChange> implements ChangeFamilyEditor {\n\tpublic constructor(\n\t\tprotected readonly changeFamily: ChangeFamily<ChangeFamilyEditor, TChange>,\n\t\tprivate readonly changeReceiver: (change: TaggedChange<TChange>) => void,\n\t) {}\n\n\t/**\n\t * Subclasses add editing methods which call this with their generated edits.\n\t *\n\t * @sealed\n\t */\n\tprotected applyChange(change: TaggedChange<TChange>): void {\n\t\tthis.changeReceiver(change);\n\t}\n\n\tpublic enterTransaction(): void {}\n\tpublic exitTransaction(): void {}\n}\n"]}
1
+ {"version":3,"file":"editBuilder.js","sourceRoot":"","sources":["../../../src/core/change-family/editBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,MAAsB,WAAW;IAChC,YACoB,YAAuD,EACzD,cAAuD;QADrD,iBAAY,GAAZ,YAAY,CAA2C;QACzD,mBAAc,GAAd,cAAc,CAAyC;IACtE,CAAC;IAEJ;;;;OAIG;IACO,WAAW,CAAC,MAA6B;QAClD,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAEM,gBAAgB,KAAU,CAAC;IAC3B,eAAe,KAAU,CAAC;CACjC;AAjBD,kCAiBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TaggedChange } from \"../rebase/index.js\";\n\nimport type { ChangeFamily, ChangeFamilyEditor } from \"./changeFamily.js\";\n\nexport abstract class EditBuilder<TChange> implements ChangeFamilyEditor {\n\tpublic constructor(\n\t\tprotected readonly changeFamily: ChangeFamily<ChangeFamilyEditor, TChange>,\n\t\tprivate readonly changeReceiver: (change: TaggedChange<TChange>) => void,\n\t) {}\n\n\t/**\n\t * Subclasses add editing methods which call this with their generated edits.\n\t *\n\t * @sealed\n\t */\n\tprotected applyChange(change: TaggedChange<TChange>): void {\n\t\tthis.changeReceiver(change);\n\t}\n\n\tpublic enterTransaction(): void {}\n\tpublic exitTransaction(): void {}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"forest.d.ts","sourceRoot":"","sources":["../../../src/core/forest/forest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACxF,OAAO,EACN,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,MAAM,EAGX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,MA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