@fluidframework/tree 2.70.0-361248 → 2.70.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/api-report/tree.alpha.api.md +36 -17
  3. package/api-report/tree.beta.api.md +70 -2
  4. package/api-report/tree.legacy.beta.api.md +70 -2
  5. package/dist/alpha.d.ts +15 -11
  6. package/dist/api.d.ts +6 -1
  7. package/dist/api.d.ts.map +1 -1
  8. package/dist/api.js +9 -1
  9. package/dist/api.js.map +1 -1
  10. package/dist/beta.d.ts +13 -0
  11. package/dist/core/forest/forest.d.ts +3 -4
  12. package/dist/core/forest/forest.d.ts.map +1 -1
  13. package/dist/core/forest/forest.js.map +1 -1
  14. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +6 -0
  15. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  16. package/dist/feature-libraries/chunked-forest/chunkTree.js +11 -2
  17. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  18. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  19. package/dist/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  20. package/dist/feature-libraries/chunked-forest/chunkedForest.js +1 -1
  21. package/dist/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  22. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +21 -20
  23. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  24. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js +17 -43
  25. package/dist/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  26. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  27. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  28. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  29. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  30. package/dist/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  31. package/dist/feature-libraries/flex-tree/lazyField.js +2 -1
  32. package/dist/feature-libraries/flex-tree/lazyField.js.map +1 -1
  33. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
  34. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  35. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +43 -48
  36. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  37. package/dist/feature-libraries/index.d.ts +1 -1
  38. package/dist/feature-libraries/index.d.ts.map +1 -1
  39. package/dist/feature-libraries/index.js +2 -1
  40. package/dist/feature-libraries/index.js.map +1 -1
  41. package/dist/feature-libraries/object-forest/objectForest.d.ts +1 -1
  42. package/dist/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  43. package/dist/feature-libraries/object-forest/objectForest.js +1 -1
  44. package/dist/feature-libraries/object-forest/objectForest.js.map +1 -1
  45. package/dist/index.d.ts +2 -2
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +4 -2
  48. package/dist/index.js.map +1 -1
  49. package/dist/legacy.d.ts +13 -0
  50. package/dist/packageVersion.d.ts +1 -1
  51. package/dist/packageVersion.d.ts.map +1 -1
  52. package/dist/packageVersion.js +1 -1
  53. package/dist/packageVersion.js.map +1 -1
  54. package/dist/shared-tree/independentView.d.ts.map +1 -1
  55. package/dist/shared-tree/independentView.js +2 -1
  56. package/dist/shared-tree/independentView.js.map +1 -1
  57. package/dist/shared-tree/schematizingTreeView.d.ts +4 -3
  58. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  59. package/dist/shared-tree/schematizingTreeView.js +1 -1
  60. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  61. package/dist/shared-tree/treeAlpha.d.ts +28 -2
  62. package/dist/shared-tree/treeAlpha.d.ts.map +1 -1
  63. package/dist/shared-tree/treeAlpha.js +12 -0
  64. package/dist/shared-tree/treeAlpha.js.map +1 -1
  65. package/dist/shared-tree-core/sharedTreeCore.js +1 -1
  66. package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
  67. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts +47 -0
  68. package/dist/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -0
  69. package/dist/simple-tree/api/incrementalAllowedTypes.js +90 -0
  70. package/dist/simple-tree/api/incrementalAllowedTypes.js.map +1 -0
  71. package/dist/simple-tree/api/index.d.ts +2 -1
  72. package/dist/simple-tree/api/index.d.ts.map +1 -1
  73. package/dist/simple-tree/api/index.js +4 -1
  74. package/dist/simple-tree/api/index.js.map +1 -1
  75. package/dist/simple-tree/api/schemaFactoryBeta.d.ts +2 -2
  76. package/dist/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  77. package/dist/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  78. package/dist/simple-tree/api/tree.d.ts +51 -37
  79. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  80. package/dist/simple-tree/api/tree.js.map +1 -1
  81. package/dist/simple-tree/core/allowedTypes.d.ts +10 -11
  82. package/dist/simple-tree/core/allowedTypes.d.ts.map +1 -1
  83. package/dist/simple-tree/core/allowedTypes.js +1 -1
  84. package/dist/simple-tree/core/allowedTypes.js.map +1 -1
  85. package/dist/simple-tree/core/index.d.ts +1 -1
  86. package/dist/simple-tree/core/index.d.ts.map +1 -1
  87. package/dist/simple-tree/core/index.js +2 -1
  88. package/dist/simple-tree/core/index.js.map +1 -1
  89. package/dist/simple-tree/core/withType.d.ts +20 -0
  90. package/dist/simple-tree/core/withType.d.ts.map +1 -1
  91. package/dist/simple-tree/core/withType.js +21 -1
  92. package/dist/simple-tree/core/withType.js.map +1 -1
  93. package/dist/simple-tree/index.d.ts +2 -2
  94. package/dist/simple-tree/index.d.ts.map +1 -1
  95. package/dist/simple-tree/index.js +5 -2
  96. package/dist/simple-tree/index.js.map +1 -1
  97. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +1 -0
  98. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  99. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js +12 -0
  100. package/dist/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  101. package/lib/alpha.d.ts +15 -11
  102. package/lib/api.d.ts +6 -1
  103. package/lib/api.d.ts.map +1 -1
  104. package/lib/api.js +7 -0
  105. package/lib/api.js.map +1 -1
  106. package/lib/beta.d.ts +13 -0
  107. package/lib/core/forest/forest.d.ts +3 -4
  108. package/lib/core/forest/forest.d.ts.map +1 -1
  109. package/lib/core/forest/forest.js.map +1 -1
  110. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +6 -0
  111. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  112. package/lib/feature-libraries/chunked-forest/chunkTree.js +8 -0
  113. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  114. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts +1 -1
  115. package/lib/feature-libraries/chunked-forest/chunkedForest.d.ts.map +1 -1
  116. package/lib/feature-libraries/chunked-forest/chunkedForest.js +2 -2
  117. package/lib/feature-libraries/chunked-forest/chunkedForest.js.map +1 -1
  118. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts +21 -20
  119. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.d.ts.map +1 -1
  120. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js +17 -43
  121. package/lib/feature-libraries/chunked-forest/codec/compressedEncode.js.map +1 -1
  122. package/lib/feature-libraries/chunked-forest/index.d.ts +1 -1
  123. package/lib/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  124. package/lib/feature-libraries/chunked-forest/index.js +1 -1
  125. package/lib/feature-libraries/chunked-forest/index.js.map +1 -1
  126. package/lib/feature-libraries/flex-tree/lazyField.d.ts.map +1 -1
  127. package/lib/feature-libraries/flex-tree/lazyField.js +2 -1
  128. package/lib/feature-libraries/flex-tree/lazyField.js.map +1 -1
  129. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
  130. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  131. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +43 -48
  132. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  133. package/lib/feature-libraries/index.d.ts +1 -1
  134. package/lib/feature-libraries/index.d.ts.map +1 -1
  135. package/lib/feature-libraries/index.js +1 -1
  136. package/lib/feature-libraries/index.js.map +1 -1
  137. package/lib/feature-libraries/object-forest/objectForest.d.ts +1 -1
  138. package/lib/feature-libraries/object-forest/objectForest.d.ts.map +1 -1
  139. package/lib/feature-libraries/object-forest/objectForest.js +2 -2
  140. package/lib/feature-libraries/object-forest/objectForest.js.map +1 -1
  141. package/lib/index.d.ts +2 -2
  142. package/lib/index.d.ts.map +1 -1
  143. package/lib/index.js +2 -2
  144. package/lib/index.js.map +1 -1
  145. package/lib/legacy.d.ts +13 -0
  146. package/lib/packageVersion.d.ts +1 -1
  147. package/lib/packageVersion.d.ts.map +1 -1
  148. package/lib/packageVersion.js +1 -1
  149. package/lib/packageVersion.js.map +1 -1
  150. package/lib/shared-tree/independentView.d.ts.map +1 -1
  151. package/lib/shared-tree/independentView.js +2 -1
  152. package/lib/shared-tree/independentView.js.map +1 -1
  153. package/lib/shared-tree/schematizingTreeView.d.ts +4 -3
  154. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  155. package/lib/shared-tree/schematizingTreeView.js +2 -2
  156. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  157. package/lib/shared-tree/treeAlpha.d.ts +28 -2
  158. package/lib/shared-tree/treeAlpha.d.ts.map +1 -1
  159. package/lib/shared-tree/treeAlpha.js +13 -1
  160. package/lib/shared-tree/treeAlpha.js.map +1 -1
  161. package/lib/shared-tree-core/sharedTreeCore.js +1 -1
  162. package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
  163. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts +47 -0
  164. package/lib/simple-tree/api/incrementalAllowedTypes.d.ts.map +1 -0
  165. package/lib/simple-tree/api/incrementalAllowedTypes.js +86 -0
  166. package/lib/simple-tree/api/incrementalAllowedTypes.js.map +1 -0
  167. package/lib/simple-tree/api/index.d.ts +2 -1
  168. package/lib/simple-tree/api/index.d.ts.map +1 -1
  169. package/lib/simple-tree/api/index.js +1 -0
  170. package/lib/simple-tree/api/index.js.map +1 -1
  171. package/lib/simple-tree/api/schemaFactoryBeta.d.ts +2 -2
  172. package/lib/simple-tree/api/schemaFactoryBeta.d.ts.map +1 -1
  173. package/lib/simple-tree/api/schemaFactoryBeta.js.map +1 -1
  174. package/lib/simple-tree/api/tree.d.ts +51 -37
  175. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  176. package/lib/simple-tree/api/tree.js.map +1 -1
  177. package/lib/simple-tree/core/allowedTypes.d.ts +10 -11
  178. package/lib/simple-tree/core/allowedTypes.d.ts.map +1 -1
  179. package/lib/simple-tree/core/allowedTypes.js +1 -1
  180. package/lib/simple-tree/core/allowedTypes.js.map +1 -1
  181. package/lib/simple-tree/core/index.d.ts +1 -1
  182. package/lib/simple-tree/core/index.d.ts.map +1 -1
  183. package/lib/simple-tree/core/index.js +1 -1
  184. package/lib/simple-tree/core/index.js.map +1 -1
  185. package/lib/simple-tree/core/withType.d.ts +20 -0
  186. package/lib/simple-tree/core/withType.d.ts.map +1 -1
  187. package/lib/simple-tree/core/withType.js +20 -0
  188. package/lib/simple-tree/core/withType.js.map +1 -1
  189. package/lib/simple-tree/index.d.ts +2 -2
  190. package/lib/simple-tree/index.d.ts.map +1 -1
  191. package/lib/simple-tree/index.js +2 -2
  192. package/lib/simple-tree/index.js.map +1 -1
  193. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts +1 -0
  194. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.d.ts.map +1 -1
  195. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js +13 -1
  196. package/lib/simple-tree/unhydratedFlexTreeFromInsertable.js.map +1 -1
  197. package/package.json +21 -21
  198. package/src/api.ts +11 -0
  199. package/src/core/forest/forest.ts +3 -4
  200. package/src/feature-libraries/chunked-forest/chunkTree.ts +9 -0
  201. package/src/feature-libraries/chunked-forest/chunkedForest.ts +3 -3
  202. package/src/feature-libraries/chunked-forest/codec/compressedEncode.ts +20 -58
  203. package/src/feature-libraries/chunked-forest/index.ts +1 -0
  204. package/src/feature-libraries/flex-tree/lazyField.ts +3 -1
  205. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +65 -71
  206. package/src/feature-libraries/index.ts +1 -0
  207. package/src/feature-libraries/object-forest/objectForest.ts +3 -3
  208. package/src/index.ts +4 -1
  209. package/src/packageVersion.ts +1 -1
  210. package/src/shared-tree/independentView.ts +4 -1
  211. package/src/shared-tree/schematizingTreeView.ts +10 -5
  212. package/src/shared-tree/treeAlpha.ts +50 -2
  213. package/src/shared-tree-core/sharedTreeCore.ts +1 -1
  214. package/src/simple-tree/api/incrementalAllowedTypes.ts +107 -0
  215. package/src/simple-tree/api/index.ts +6 -0
  216. package/src/simple-tree/api/schemaFactoryBeta.ts +6 -2
  217. package/src/simple-tree/api/tree.ts +64 -44
  218. package/src/simple-tree/core/allowedTypes.ts +10 -11
  219. package/src/simple-tree/core/index.ts +6 -1
  220. package/src/simple-tree/core/withType.ts +24 -0
  221. package/src/simple-tree/index.ts +5 -0
  222. package/src/simple-tree/unhydratedFlexTreeFromInsertable.ts +13 -0
@@ -6,7 +6,7 @@ import { UsageError } from "@fluidframework/telemetry-utils/internal";
6
6
  import { assert } from "@fluidframework/core-utils/internal";
7
7
  import { hasSingle } from "../util/index.js";
8
8
  import { normalizeFieldSchema, FieldKind } from "./fieldSchema.js";
9
- import { CompatibilityLevel, getKernel, getTreeNodeSchemaPrivateData, isTreeNode, UnhydratedFlexTreeNode, } from "./core/index.js";
9
+ import { CompatibilityLevel, getKernel, getTreeNodeSchemaPrivateData, isTreeNode, contentSchemaSymbol, UnhydratedFlexTreeNode, } from "./core/index.js";
10
10
  import { getUnhydratedContext } from "./createContext.js";
11
11
  /**
12
12
  * Transforms an input {@link TypedNode} tree to an {@link UnhydratedFlexTreeNode}.
@@ -86,12 +86,24 @@ For class-based schema, this can be done by replacing an expression like "{foo:
86
86
  }
87
87
  /**
88
88
  * Returns all types for which the data is schema-compatible.
89
+ * @remarks This will respect the {@link contentSchemaSymbol} property on data to disambiguate types - if present, only that type will be returned.
89
90
  */
90
91
  export function getPossibleTypes(allowedTypes, data) {
91
92
  assert(data !== undefined, 0x889 /* undefined cannot be used as FactoryContent. */);
93
+ const type = typeof data === "object" && data !== null
94
+ ? data[contentSchemaSymbol]
95
+ : undefined;
92
96
  let best = CompatibilityLevel.None;
93
97
  const possibleTypes = [];
94
98
  for (const schema of allowedTypes) {
99
+ if (type !== undefined) {
100
+ if (schema.identifier === type) {
101
+ return [schema];
102
+ }
103
+ else {
104
+ continue;
105
+ }
106
+ }
95
107
  const handler = getTreeNodeSchemaPrivateData(schema).idempotentInitialize();
96
108
  const level = handler.shallowCompatibilityTest(data);
97
109
  if (level > best) {
@@ -1 +1 @@
1
- {"version":3,"file":"unhydratedFlexTreeFromInsertable.js","sourceRoot":"","sources":["../../src/simple-tree/unhydratedFlexTreeFromInsertable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAA4B,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EACN,kBAAkB,EAClB,SAAS,EACT,4BAA4B,EAC5B,UAAU,EAIV,sBAAsB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EA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AAwB,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC;YAClB,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;YACzB,IAAI,GAAG,KAAK,CAAC;QACd,CAAC;QACD,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;YACpB,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;IACF,CAAC;IACD,OAAO,IAAI,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC;AAC9D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { hasSingle } from \"../util/index.js\";\n\nimport { normalizeFieldSchema, FieldKind, type ImplicitFieldSchema } from \"./fieldSchema.js\";\nimport {\n\tCompatibilityLevel,\n\tgetKernel,\n\tgetTreeNodeSchemaPrivateData,\n\tisTreeNode,\n\ttype TreeNode,\n\ttype TreeNodeSchema,\n\ttype Unhydrated,\n\tUnhydratedFlexTreeNode,\n} from \"./core/index.js\";\nimport { getUnhydratedContext } from \"./createContext.js\";\n\n/**\n * Transforms an input {@link TypedNode} tree to an {@link UnhydratedFlexTreeNode}.\n * @param data - The input tree to be converted.\n * If the data is an unsupported value (e.g. NaN), a fallback value will be used when supported,\n * otherwise an error will be thrown.\n *\n * Fallbacks:\n *\n * * `NaN` =\\> `null`\n *\n * * `+/-∞` =\\> `null`\n *\n * * `-0` =\\> `+0`\n *\n * For fields with a default value, the field may be omitted.\n * If `context` is not provided, defaults which require a context will be left empty which can be out of schema.\n *\n * @param allowedTypes - The set of types allowed by the parent context. Used to validate the input tree.\n * @remarks\n * The resulting tree will be populated with any defaults from {@link FieldProvider}s in the schema.\n *\n * Often throws UsageErrors for invalid data, but may miss some cases.\n *\n * Output should comply with the provided view schema, but this is not explicitly validated:\n * validation against stored schema (to guard against document corruption) is done elsewhere.\n */\nexport function unhydratedFlexTreeFromInsertable<TIn extends InsertableContent | undefined>(\n\tdata: TIn,\n\tallowedTypes: ImplicitFieldSchema,\n): TIn extends undefined ? undefined : UnhydratedFlexTreeNode {\n\tconst normalizedFieldSchema = normalizeFieldSchema(allowedTypes);\n\n\tif (data === undefined) {\n\t\t// TODO: this code-path should support defaults\n\t\tif (normalizedFieldSchema.kind !== FieldKind.Optional) {\n\t\t\tthrow new UsageError(\"Got undefined for non-optional field.\");\n\t\t}\n\t\treturn undefined as TIn extends undefined ? undefined : UnhydratedFlexTreeNode;\n\t}\n\n\tconst flexTree: UnhydratedFlexTreeNode = unhydratedFlexTreeFromInsertableNode(\n\t\tdata,\n\t\tnormalizedFieldSchema.allowedTypeSet,\n\t);\n\n\treturn flexTree as TIn extends undefined ? undefined : UnhydratedFlexTreeNode;\n}\n\n/**\n * Copy content from `data` into a UnhydratedFlexTreeNode.\n */\nexport function unhydratedFlexTreeFromInsertableNode(\n\tdata: InsertableContent,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): UnhydratedFlexTreeNode {\n\tif (isTreeNode(data)) {\n\t\tconst kernel = getKernel(data);\n\t\tconst inner = kernel.getInnerNodeIfUnhydrated();\n\t\tif (inner === undefined) {\n\t\t\t// The node is already hydrated, meaning that it already got inserted into the tree previously\n\t\t\tthrow new UsageError(\"A node may not be inserted into the tree more than once\");\n\t\t} else {\n\t\t\tif (!allowedTypes.has(kernel.schema)) {\n\t\t\t\tthrow new UsageError(\"Invalid schema for this context.\");\n\t\t\t}\n\t\t\treturn inner;\n\t\t}\n\t}\n\n\tconst schema = getType(data, allowedTypes);\n\tconst handler = getTreeNodeSchemaPrivateData(schema).idempotentInitialize();\n\tconst result = handler.toFlexContent(data, allowedTypes);\n\n\treturn new UnhydratedFlexTreeNode(...result, getUnhydratedContext(schema));\n}\n\nfunction getType(\n\tdata: FactoryContent,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): TreeNodeSchema {\n\tconst possibleTypes = getPossibleTypes(allowedTypes, data);\n\tif (possibleTypes.length === 0) {\n\t\tthrow new UsageError(\n\t\t\t`The provided data is incompatible with all of the types allowed by the schema. The set of allowed types is: ${JSON.stringify(\n\t\t\t\t[...allowedTypes].map((schema) => schema.identifier),\n\t\t\t)}.`,\n\t\t);\n\t}\n\tif (!hasSingle(possibleTypes)) {\n\t\tthrow new UsageError(\n\t\t\t`The provided data is compatible with more than one type allowed by the schema.\nThe set of possible types is ${JSON.stringify([\n\t\t\t\t...possibleTypes.map((schema) => schema.identifier),\n\t\t\t])}.\nExplicitly construct an unhydrated node of the desired type to disambiguate.\nFor class-based schema, this can be done by replacing an expression like \"{foo: 1}\" with \"new MySchema({foo: 1})\".`,\n\t\t);\n\t}\n\treturn possibleTypes[0];\n}\n\n/**\n * Returns all types for which the data is schema-compatible.\n */\nexport function getPossibleTypes(\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\tdata: FactoryContent,\n): TreeNodeSchema[] {\n\tassert(data !== undefined, 0x889 /* undefined cannot be used as FactoryContent. */);\n\n\tlet best = CompatibilityLevel.None;\n\tconst possibleTypes: TreeNodeSchema[] = [];\n\tfor (const schema of allowedTypes) {\n\t\tconst handler = getTreeNodeSchemaPrivateData(schema).idempotentInitialize();\n\t\tconst level = handler.shallowCompatibilityTest(data);\n\t\tif (level > best) {\n\t\t\tpossibleTypes.length = 0;\n\t\t\tbest = level;\n\t\t}\n\t\tif (best === level) {\n\t\t\tpossibleTypes.push(schema);\n\t\t}\n\t}\n\treturn best === CompatibilityLevel.None ? [] : possibleTypes;\n}\n\n/**\n * Content which can be used to build a node.\n * @remarks\n * Can contain unhydrated nodes, but can not be an unhydrated node at the root.\n * @system @alpha\n */\nexport type FactoryContent =\n\t| IFluidHandle\n\t| string\n\t| number\n\t| boolean\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| Iterable<readonly [string, InsertableContent]>\n\t| readonly InsertableContent[]\n\t| FactoryContentObject;\n\n/**\n * Record-like object which can be used to build some kinds of nodes.\n * @remarks\n * Can contain unhydrated nodes, but can not be an unhydrated node at the root.\n *\n * Supports object and map nodes.\n * @system @alpha\n */\nexport type FactoryContentObject = {\n\treadonly [P in string]?: InsertableContent;\n};\n\n/**\n * Content which can be inserted into a tree.\n * @system @alpha\n */\nexport type InsertableContent = Unhydrated<TreeNode> | FactoryContent;\n"]}
1
+ {"version":3,"file":"unhydratedFlexTreeFromInsertable.js","sourceRoot":"","sources":["../../src/simple-tree/unhydratedFlexTreeFromInsertable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAA4B,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EACN,kBAAkB,EAClB,SAAS,EACT,4BAA4B,EAC5B,UAAU,EAGV,mBAAmB,EAEnB,sBAAsB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,gCAAgC,CAC/C,IAAS,EACT,YAAiC;IAEjC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAEjE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,+CAA+C;QAC/C,IAAI,qBAAqB,CAAC,IAAI,KAAK,SAAS,CAAC,QAAQ,EAAE,CAAC;YACvD,MAAM,IAAI,UAAU,CAAC,uCAAuC,CAAC,CAAC;QAC/D,CAAC;QACD,OAAO,SAAuE,CAAC;IAChF,CA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AE,CAAC;YAClB,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;YACzB,IAAI,GAAG,KAAK,CAAC;QACd,CAAC;QACD,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;YACpB,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;IACF,CAAC;IACD,OAAO,IAAI,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC;AAC9D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { hasSingle } from \"../util/index.js\";\n\nimport { normalizeFieldSchema, FieldKind, type ImplicitFieldSchema } from \"./fieldSchema.js\";\nimport {\n\tCompatibilityLevel,\n\tgetKernel,\n\tgetTreeNodeSchemaPrivateData,\n\tisTreeNode,\n\ttype TreeNode,\n\ttype TreeNodeSchema,\n\tcontentSchemaSymbol,\n\ttype Unhydrated,\n\tUnhydratedFlexTreeNode,\n} from \"./core/index.js\";\nimport { getUnhydratedContext } from \"./createContext.js\";\n\n/**\n * Transforms an input {@link TypedNode} tree to an {@link UnhydratedFlexTreeNode}.\n * @param data - The input tree to be converted.\n * If the data is an unsupported value (e.g. NaN), a fallback value will be used when supported,\n * otherwise an error will be thrown.\n *\n * Fallbacks:\n *\n * * `NaN` =\\> `null`\n *\n * * `+/-∞` =\\> `null`\n *\n * * `-0` =\\> `+0`\n *\n * For fields with a default value, the field may be omitted.\n * If `context` is not provided, defaults which require a context will be left empty which can be out of schema.\n *\n * @param allowedTypes - The set of types allowed by the parent context. Used to validate the input tree.\n * @remarks\n * The resulting tree will be populated with any defaults from {@link FieldProvider}s in the schema.\n *\n * Often throws UsageErrors for invalid data, but may miss some cases.\n *\n * Output should comply with the provided view schema, but this is not explicitly validated:\n * validation against stored schema (to guard against document corruption) is done elsewhere.\n */\nexport function unhydratedFlexTreeFromInsertable<TIn extends InsertableContent | undefined>(\n\tdata: TIn,\n\tallowedTypes: ImplicitFieldSchema,\n): TIn extends undefined ? undefined : UnhydratedFlexTreeNode {\n\tconst normalizedFieldSchema = normalizeFieldSchema(allowedTypes);\n\n\tif (data === undefined) {\n\t\t// TODO: this code-path should support defaults\n\t\tif (normalizedFieldSchema.kind !== FieldKind.Optional) {\n\t\t\tthrow new UsageError(\"Got undefined for non-optional field.\");\n\t\t}\n\t\treturn undefined as TIn extends undefined ? undefined : UnhydratedFlexTreeNode;\n\t}\n\n\tconst flexTree: UnhydratedFlexTreeNode = unhydratedFlexTreeFromInsertableNode(\n\t\tdata,\n\t\tnormalizedFieldSchema.allowedTypeSet,\n\t);\n\n\treturn flexTree as TIn extends undefined ? undefined : UnhydratedFlexTreeNode;\n}\n\n/**\n * Copy content from `data` into a UnhydratedFlexTreeNode.\n */\nexport function unhydratedFlexTreeFromInsertableNode(\n\tdata: InsertableContent,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): UnhydratedFlexTreeNode {\n\tif (isTreeNode(data)) {\n\t\tconst kernel = getKernel(data);\n\t\tconst inner = kernel.getInnerNodeIfUnhydrated();\n\t\tif (inner === undefined) {\n\t\t\t// The node is already hydrated, meaning that it already got inserted into the tree previously\n\t\t\tthrow new UsageError(\"A node may not be inserted into the tree more than once\");\n\t\t} else {\n\t\t\tif (!allowedTypes.has(kernel.schema)) {\n\t\t\t\tthrow new UsageError(\"Invalid schema for this context.\");\n\t\t\t}\n\t\t\treturn inner;\n\t\t}\n\t}\n\n\tconst schema = getType(data, allowedTypes);\n\tconst handler = getTreeNodeSchemaPrivateData(schema).idempotentInitialize();\n\tconst result = handler.toFlexContent(data, allowedTypes);\n\n\treturn new UnhydratedFlexTreeNode(...result, getUnhydratedContext(schema));\n}\n\nfunction getType(\n\tdata: FactoryContent,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): TreeNodeSchema {\n\tconst possibleTypes = getPossibleTypes(allowedTypes, data);\n\tif (possibleTypes.length === 0) {\n\t\tthrow new UsageError(\n\t\t\t`The provided data is incompatible with all of the types allowed by the schema. The set of allowed types is: ${JSON.stringify(\n\t\t\t\t[...allowedTypes].map((schema) => schema.identifier),\n\t\t\t)}.`,\n\t\t);\n\t}\n\tif (!hasSingle(possibleTypes)) {\n\t\tthrow new UsageError(\n\t\t\t`The provided data is compatible with more than one type allowed by the schema.\nThe set of possible types is ${JSON.stringify([\n\t\t\t\t...possibleTypes.map((schema) => schema.identifier),\n\t\t\t])}.\nExplicitly construct an unhydrated node of the desired type to disambiguate.\nFor class-based schema, this can be done by replacing an expression like \"{foo: 1}\" with \"new MySchema({foo: 1})\".`,\n\t\t);\n\t}\n\treturn possibleTypes[0];\n}\n\n/**\n * Returns all types for which the data is schema-compatible.\n * @remarks This will respect the {@link contentSchemaSymbol} property on data to disambiguate types - if present, only that type will be returned.\n */\nexport function getPossibleTypes(\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\tdata: FactoryContent,\n): TreeNodeSchema[] {\n\tassert(data !== undefined, 0x889 /* undefined cannot be used as FactoryContent. */);\n\tconst type =\n\t\ttypeof data === \"object\" && data !== null\n\t\t\t? (data as Partial<{ [contentSchemaSymbol]: string }>)[contentSchemaSymbol]\n\t\t\t: undefined;\n\n\tlet best = CompatibilityLevel.None;\n\tconst possibleTypes: TreeNodeSchema[] = [];\n\tfor (const schema of allowedTypes) {\n\t\tif (type !== undefined) {\n\t\t\tif (schema.identifier === type) {\n\t\t\t\treturn [schema];\n\t\t\t} else {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tconst handler = getTreeNodeSchemaPrivateData(schema).idempotentInitialize();\n\t\tconst level = handler.shallowCompatibilityTest(data);\n\t\tif (level > best) {\n\t\t\tpossibleTypes.length = 0;\n\t\t\tbest = level;\n\t\t}\n\t\tif (best === level) {\n\t\t\tpossibleTypes.push(schema);\n\t\t}\n\t}\n\treturn best === CompatibilityLevel.None ? [] : possibleTypes;\n}\n\n/**\n * Content which can be used to build a node.\n * @remarks\n * Can contain unhydrated nodes, but can not be an unhydrated node at the root.\n * @system @alpha\n */\nexport type FactoryContent =\n\t| IFluidHandle\n\t| string\n\t| number\n\t| boolean\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| Iterable<readonly [string, InsertableContent]>\n\t| readonly InsertableContent[]\n\t| FactoryContentObject;\n\n/**\n * Record-like object which can be used to build some kinds of nodes.\n * @remarks\n * Can contain unhydrated nodes, but can not be an unhydrated node at the root.\n *\n * Supports object and map nodes.\n * @system @alpha\n */\nexport type FactoryContentObject = {\n\treadonly [P in string]?: InsertableContent;\n};\n\n/**\n * Content which can be inserted into a tree.\n * @system @alpha\n */\nexport type InsertableContent = Unhydrated<TreeNode> | FactoryContent;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/tree",
3
- "version": "2.70.0-361248",
3
+ "version": "2.70.0",
4
4
  "description": "Distributed tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -101,17 +101,17 @@
101
101
  "temp-directory": "nyc/.nyc_output"
102
102
  },
103
103
  "dependencies": {
104
- "@fluid-internal/client-utils": "2.70.0-361248",
105
- "@fluidframework/container-runtime": "2.70.0-361248",
106
- "@fluidframework/core-interfaces": "2.70.0-361248",
107
- "@fluidframework/core-utils": "2.70.0-361248",
108
- "@fluidframework/datastore-definitions": "2.70.0-361248",
109
- "@fluidframework/driver-definitions": "2.70.0-361248",
110
- "@fluidframework/id-compressor": "2.70.0-361248",
111
- "@fluidframework/runtime-definitions": "2.70.0-361248",
112
- "@fluidframework/runtime-utils": "2.70.0-361248",
113
- "@fluidframework/shared-object-base": "2.70.0-361248",
114
- "@fluidframework/telemetry-utils": "2.70.0-361248",
104
+ "@fluid-internal/client-utils": "~2.70.0",
105
+ "@fluidframework/container-runtime": "~2.70.0",
106
+ "@fluidframework/core-interfaces": "~2.70.0",
107
+ "@fluidframework/core-utils": "~2.70.0",
108
+ "@fluidframework/datastore-definitions": "~2.70.0",
109
+ "@fluidframework/driver-definitions": "~2.70.0",
110
+ "@fluidframework/id-compressor": "~2.70.0",
111
+ "@fluidframework/runtime-definitions": "~2.70.0",
112
+ "@fluidframework/runtime-utils": "~2.70.0",
113
+ "@fluidframework/shared-object-base": "~2.70.0",
114
+ "@fluidframework/telemetry-utils": "~2.70.0",
115
115
  "@sinclair/typebox": "^0.34.13",
116
116
  "@tylerbu/sorted-btree-es6": "^1.8.0",
117
117
  "@types/ungap__structured-clone": "^1.2.0",
@@ -122,19 +122,19 @@
122
122
  "devDependencies": {
123
123
  "@arethetypeswrong/cli": "^0.17.1",
124
124
  "@biomejs/biome": "~1.9.3",
125
- "@fluid-internal/mocha-test-setup": "2.70.0-361248",
126
- "@fluid-private/stochastic-test-utils": "2.70.0-361248",
127
- "@fluid-private/test-dds-utils": "2.70.0-361248",
128
- "@fluid-private/test-drivers": "2.70.0-361248",
125
+ "@fluid-internal/mocha-test-setup": "~2.70.0",
126
+ "@fluid-private/stochastic-test-utils": "~2.70.0",
127
+ "@fluid-private/test-dds-utils": "~2.70.0",
128
+ "@fluid-private/test-drivers": "~2.70.0",
129
129
  "@fluid-tools/benchmark": "^0.51.0",
130
130
  "@fluid-tools/build-cli": "^0.58.3",
131
131
  "@fluidframework/build-common": "^2.0.3",
132
132
  "@fluidframework/build-tools": "^0.58.3",
133
- "@fluidframework/container-definitions": "2.70.0-361248",
134
- "@fluidframework/container-loader": "2.70.0-361248",
133
+ "@fluidframework/container-definitions": "~2.70.0",
134
+ "@fluidframework/container-loader": "~2.70.0",
135
135
  "@fluidframework/eslint-config-fluid": "^6.1.0",
136
- "@fluidframework/test-runtime-utils": "2.70.0-361248",
137
- "@fluidframework/test-utils": "2.70.0-361248",
136
+ "@fluidframework/test-runtime-utils": "~2.70.0",
137
+ "@fluidframework/test-utils": "~2.70.0",
138
138
  "@fluidframework/tree-previous": "npm:@fluidframework/tree@2.63.0",
139
139
  "@microsoft/api-extractor": "7.52.11",
140
140
  "@types/diff": "^3.5.1",
@@ -147,7 +147,7 @@
147
147
  "concurrently": "^8.2.1",
148
148
  "copyfiles": "^2.4.1",
149
149
  "cross-env": "^7.0.3",
150
- "dependency-cruiser": "^14.1.0",
150
+ "dependency-cruiser": "^17.1.0",
151
151
  "diff": "^3.5.0",
152
152
  "easy-table": "^1.1.1",
153
153
  "eslint": "~8.57.1",
package/src/api.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  import {
7
7
  type TreeView,
8
8
  type TreeViewAlpha,
9
+ type TreeViewBeta,
9
10
  type ImplicitFieldSchema,
10
11
  // eslint-disable-next-line import/no-deprecated
11
12
  asTreeViewAlpha,
@@ -28,3 +29,13 @@ export function asAlpha<TSchema extends ImplicitFieldSchema>(
28
29
  // eslint-disable-next-line import/no-deprecated
29
30
  return asTreeViewAlpha(view);
30
31
  }
32
+
33
+ /**
34
+ * Retrieve the {@link TreeViewBeta | beta API} for a {@link TreeView}.
35
+ * @beta
36
+ */
37
+ export function asBeta<TSchema extends ImplicitFieldSchema>(
38
+ view: TreeView<TSchema>,
39
+ ): TreeViewBeta<TSchema> {
40
+ return view as TreeViewBeta<TSchema>;
41
+ }
@@ -84,15 +84,14 @@ export interface IForestSubscription {
84
84
  clone(schema: TreeStoredSchemaSubscription, anchors: AnchorSet): IEditableForest;
85
85
 
86
86
  /**
87
- * Generate a TreeChunk for the content in the given field cursor.
87
+ * Generate a TreeChunk[] for the current field (and its children) of cursor.
88
88
  * This can be used to chunk data that is then inserted into the forest.
89
89
  *
90
90
  * @remarks
91
- * Like {@link chunkField}, but forces the results into a single TreeChunk.
92
- * While any TreeChunk is compatible with any forest, this method creates one optimized for this specific forest.
91
+ * Similar to {@link chunkField} but it creates chunks optimized for this specific forest by using its compression policy.
93
92
  * The provided data must be compatible with the forest's current schema.
94
93
  */
95
- chunkField(cursor: ITreeCursorSynchronous): TreeChunk;
94
+ chunkField(cursor: ITreeCursorSynchronous): TreeChunk[];
96
95
 
97
96
  /**
98
97
  * Allocates a cursor in the "cleared" state.
@@ -197,6 +197,15 @@ export function chunkFieldSingle(
197
197
  policy: ChunkCompressor,
198
198
  ): TreeChunk {
199
199
  const chunks = chunkField(cursor, policy);
200
+ return combineChunks(chunks);
201
+ }
202
+
203
+ /**
204
+ * Create a single TreeChunk from an array of TreeChunks.
205
+ * @remarks
206
+ * This takes ownership of the provided TreeChunk references, and returns an owned referenced.
207
+ */
208
+ export function combineChunks(chunks: TreeChunk[]): TreeChunk {
200
209
  if (chunks.length === 1) {
201
210
  return chunks[0] ?? oob();
202
211
  }
@@ -44,7 +44,7 @@ import {
44
44
  } from "../../util/index.js";
45
45
 
46
46
  import { BasicChunk, BasicChunkCursor, type SiblingsOrKey } from "./basicChunk.js";
47
- import { type IChunker, basicChunkTree, chunkFieldSingle, chunkTree } from "./chunkTree.js";
47
+ import { type IChunker, basicChunkTree, chunkField, chunkTree } from "./chunkTree.js";
48
48
 
49
49
  function makeRoot(): BasicChunk {
50
50
  return new BasicChunk(aboveRootPlaceholder, new Map());
@@ -90,8 +90,8 @@ export class ChunkedForest implements IEditableForest {
90
90
  return new ChunkedForest(this.roots, schema, this.chunker.clone(schema), anchors);
91
91
  }
92
92
 
93
- public chunkField(cursor: ITreeCursorSynchronous): TreeChunk {
94
- return chunkFieldSingle(cursor, { idCompressor: this.idCompressor, policy: this.chunker });
93
+ public chunkField(cursor: ITreeCursorSynchronous): TreeChunk[] {
94
+ return chunkField(cursor, { idCompressor: this.idCompressor, policy: this.chunker });
95
95
  }
96
96
 
97
97
  public forgetAnchor(anchor: Anchor): void {
@@ -36,7 +36,7 @@ import {
36
36
  SpecialField,
37
37
  version,
38
38
  } from "./format.js";
39
- import type { ChunkReferenceId, IncrementalEncoder } from "./codecs.js";
39
+ import type { IncrementalEncoder } from "./codecs.js";
40
40
 
41
41
  /**
42
42
  * Encode data from `FieldBatch` into an `EncodedFieldBatch`.
@@ -223,8 +223,8 @@ export const anyNodeEncoder: NodeEncoder = {
223
223
  outputBuffer: BufferFormat,
224
224
  ): void {
225
225
  // TODO: Fast path uniform chunk content.
226
- const shape = context.nodeEncoderFromSchema(cursor.type);
227
- AnyShape.encodeNode(cursor, context, outputBuffer, shape);
226
+ const nodeEncoder = context.nodeEncoderFromSchema(cursor.type);
227
+ AnyShape.encodeNode(cursor, context, outputBuffer, nodeEncoder);
228
228
  },
229
229
 
230
230
  shape: AnyShape.instance,
@@ -350,7 +350,7 @@ export class InlineArrayEncoder
350
350
  }
351
351
 
352
352
  /**
353
- * Encodes the shape for a nested array as {@link EncodedNestedArray} shape.
353
+ * Encodes the shape for a nested array as {@link EncodedNestedArrayShape} shape.
354
354
  */
355
355
  export class NestedArrayShape extends ShapeGeneric<EncodedChunkShape> {
356
356
  /**
@@ -420,30 +420,9 @@ export class NestedArrayEncoder implements FieldEncoder {
420
420
  }
421
421
 
422
422
  /**
423
- * Encodes a chunk with the {@link EncodedIncrementalChunkShape} shape.
424
- * This chunks will be encoded separately, i.e., the contents of the chunk will not be part of the main buffer.
425
- * A reference to the chunk will be stored in the main buffer as an {@link ChunkReferenceId}.
423
+ * Encodes the shape for an incremental chunk as {@link EncodedIncrementalChunkShape} shape.
426
424
  */
427
425
  export class IncrementalChunkShape extends ShapeGeneric<EncodedChunkShape> {
428
- /**
429
- * Encodes all the nodes in the chunk at the cursor position using `InlineArrayShape`.
430
- */
431
- public static encodeChunk(chunk: TreeChunk, context: EncoderContext): BufferFormat {
432
- const chunkOutputBuffer: BufferFormat = [];
433
- const nodesEncoder = asNodesEncoder(anyNodeEncoder);
434
- const chunkCursor = chunk.cursor();
435
- chunkCursor.firstNode();
436
- const chunkLength = chunkCursor.chunkLength;
437
- for (let index = 0; index < chunkLength; index++) {
438
- nodesEncoder.encodeNodes(chunkCursor, context, chunkOutputBuffer);
439
- }
440
- assert(
441
- chunkCursor.mode === CursorLocationType.Fields,
442
- 0xc29 /* should return to fields mode when finished encoding */,
443
- );
444
- return chunkOutputBuffer;
445
- }
446
-
447
426
  public encodeShape(
448
427
  identifiers: DeduplicationTable<string>,
449
428
  shapes: DeduplicationTable<Shape>,
@@ -464,9 +443,10 @@ export class IncrementalChunkShape extends ShapeGeneric<EncodedChunkShape> {
464
443
  }
465
444
 
466
445
  /**
467
- * Encodes an incremental field whose chunks are encoded separately and referenced by their {@link ChunkReferenceId}.
468
- * The shape of the content of this field is {@link NestedShape} where the items in the array are
469
- * the {@link ChunkReferenceId}s of the encoded chunks.
446
+ * Encodes an incremental field whose tree chunks are encoded separately and referenced by their {@link ChunkReferenceId}.
447
+ * The shape of the content of this field is {@link NestedArrayShape}.
448
+ * The inner items of the array have shape {@link IncrementalChunkShape} and are {@link ChunkReferenceId}s
449
+ * of the encoded chunks.
470
450
  */
471
451
  export const incrementalFieldEncoder: FieldEncoder = {
472
452
  encodeField(
@@ -475,12 +455,13 @@ export const incrementalFieldEncoder: FieldEncoder = {
475
455
  outputBuffer: BufferFormat,
476
456
  ): void {
477
457
  assert(
478
- context.shouldEncodeIncrementally,
479
- 0xc2a /* incremental encoding must be enabled to use IncrementalFieldShape */,
458
+ context.incrementalEncoder !== undefined,
459
+ 0xc88 /* incremental encoder must be defined to use incrementalFieldEncoder */,
480
460
  );
481
461
 
482
- const chunkReferenceIds = context.encodeIncrementalField(cursor, (chunk: TreeChunk) =>
483
- IncrementalChunkShape.encodeChunk(chunk, context),
462
+ const chunkReferenceIds = context.incrementalEncoder.encodeIncrementalField(
463
+ cursor,
464
+ (chunk: TreeChunk) => compressedEncode([chunk.cursor()], context),
484
465
  );
485
466
  outputBuffer.push(chunkReferenceIds);
486
467
  },
@@ -540,7 +521,12 @@ export class EncoderContext implements NodeEncodeBuilder, FieldEncodeBuilder {
540
521
  private readonly fieldEncoderFromPolicy: FieldEncoderPolicy,
541
522
  public readonly fieldShapes: ReadonlyMap<FieldKindIdentifier, FlexFieldKind>,
542
523
  public readonly idCompressor: IIdCompressor,
543
- private readonly incrementalEncoder: IncrementalEncoder | undefined,
524
+ /**
525
+ * To be used to encode incremental chunks, if any.
526
+ * @remarks
527
+ * See {@link IncrementalEncoder} for more information.
528
+ */
529
+ public readonly incrementalEncoder: IncrementalEncoder | undefined,
544
530
  ) {}
545
531
 
546
532
  public nodeEncoderFromSchema(schemaName: TreeNodeSchemaIdentifier): NodeEncoder {
@@ -556,30 +542,6 @@ export class EncoderContext implements NodeEncodeBuilder, FieldEncodeBuilder {
556
542
  public nestedArrayEncoder(inner: NodeEncoder): NestedArrayEncoder {
557
543
  return getOrCreate(this.nestedArrayEncoders, inner, () => new NestedArrayEncoder(inner));
558
544
  }
559
-
560
- public get shouldEncodeIncrementally(): boolean {
561
- return this.incrementalEncoder !== undefined;
562
- }
563
-
564
- /**
565
- * {@link IncrementalEncoder.encodeIncrementalField}
566
- */
567
- public encodeIncrementalField(
568
- cursor: ITreeCursorSynchronous,
569
- encoder: (chunk: TreeChunk) => BufferFormat,
570
- ): ChunkReferenceId[] {
571
- assert(
572
- this.incrementalEncoder !== undefined,
573
- 0xc2b /* incremental encoding must be enabled */,
574
- );
575
- // Encoder for the chunk that encodes its data using the provided encoder function and
576
- // updates the encoded data for shapes and identifiers.
577
- const chunkEncoder = (chunk: TreeChunk): EncodedFieldBatch => {
578
- const chunkOutputBuffer = encoder(chunk);
579
- return updateShapesAndIdentifiersEncoding(version, [chunkOutputBuffer]);
580
- };
581
- return this.incrementalEncoder.encodeIncrementalField(cursor, chunkEncoder);
582
- }
583
545
  }
584
546
 
585
547
  export interface NodeEncodeBuilder {
@@ -12,6 +12,7 @@ export {
12
12
  type IChunker,
13
13
  chunkFieldSingle,
14
14
  chunkField,
15
+ combineChunks,
15
16
  } from "./chunkTree.js";
16
17
  export { buildChunkedForest } from "./chunkedForest.js";
17
18
  export {
@@ -53,6 +53,7 @@ import {
53
53
  import { LazyEntity } from "./lazyEntity.js";
54
54
  import { type LazyTreeNode, getOrCreateHydratedFlexTreeNode } from "./lazyNode.js";
55
55
  import { indexForAt, treeStatusFromAnchorCache } from "./utilities.js";
56
+ import { combineChunks } from "../chunked-forest/index.js";
56
57
 
57
58
  /**
58
59
  * Reuse fields.
@@ -247,7 +248,8 @@ export abstract class LazyField extends LazyEntity<FieldAnchor> implements FlexT
247
248
  protected getEditor(): IDefaultEditBuilder<ITreeCursorSynchronous> {
248
249
  return new MappedEditBuilder(
249
250
  this.context.checkout.editor,
250
- (cursor: ITreeCursorSynchronous) => this.context.checkout.forest.chunkField(cursor),
251
+ (cursor: ITreeCursorSynchronous) =>
252
+ combineChunks(this.context.checkout.forest.chunkField(cursor)),
251
253
  );
252
254
  }
253
255
  }
@@ -288,7 +288,7 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
288
288
 
289
289
  public constructor(
290
290
  private readonly enableIncrementalSummary: boolean,
291
- private readonly getChunkAtCursor: (cursor: ITreeCursorSynchronous) => TreeChunk,
291
+ private readonly getChunkAtCursor: (cursor: ITreeCursorSynchronous) => TreeChunk[],
292
292
  public readonly shouldEncodeIncrementally: IncrementalEncodingPolicy,
293
293
  private readonly initialSequenceNumber: number,
294
294
  ) {}
@@ -392,80 +392,74 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
392
392
  // Validate that a summary is currently being tracked and that the tracked summary properties are defined.
393
393
  validateTrackingSummary(this.forestSummaryState, this.trackedSummaryProperties);
394
394
 
395
- if (cursor.getFieldLength() === 0) {
396
- return [];
397
- }
398
-
399
- let chunkReferenceId: ChunkReferenceId;
400
- let chunkProperties: ChunkSummaryProperties;
395
+ const chunkReferenceIds: ChunkReferenceId[] = [];
396
+ const chunks = this.getChunkAtCursor(cursor);
397
+ for (const chunk of chunks) {
398
+ let chunkProperties: ChunkSummaryProperties;
399
+
400
+ // Try and get the properties of the chunk from the latest successful summary.
401
+ // If it exists and the summary is not a full tree, use the properties to generate a summary handle.
402
+ // If it does not exist, encode the chunk and generate new properties for it.
403
+ const previousChunkProperties = tryGetFromNestedMap(
404
+ this.chunkTrackingPropertiesMap,
405
+ this.latestSummarySequenceNumber,
406
+ chunk,
407
+ );
408
+ if (previousChunkProperties !== undefined && !this.trackedSummaryProperties.fullTree) {
409
+ chunkProperties = previousChunkProperties;
410
+ this.trackedSummaryProperties.parentSummaryBuilder.addHandle(
411
+ `${chunkProperties.referenceId}`,
412
+ SummaryType.Tree,
413
+ `${this.trackedSummaryProperties.latestSummaryBasePath}/${chunkProperties.summaryPath}`,
414
+ );
415
+ } else {
416
+ // Generate a new reference ID for the chunk.
417
+ const newReferenceId: ChunkReferenceId = brand(this.nextReferenceId++);
418
+
419
+ // Add the reference ID of this chunk to the chunk summary path and use the path as the summary path
420
+ // for the chunk in its summary properties.
421
+ // This is done before encoding the chunk so that the summary path is updated correctly when encoding
422
+ // any incremental chunks that are under this chunk.
423
+ this.trackedSummaryProperties.chunkSummaryPath.push(newReferenceId);
424
+
425
+ chunkProperties = {
426
+ referenceId: newReferenceId,
427
+ summaryPath: this.trackedSummaryProperties.chunkSummaryPath.join("/"),
428
+ };
429
+
430
+ const parentSummaryBuilder = this.trackedSummaryProperties.parentSummaryBuilder;
431
+ // Create a new summary builder for this chunk to build its summary tree which will be stored in the
432
+ // parent's summary tree under its reference ID.
433
+ // Before encoding the chunk, set the parent summary builder to this chunk's summary builder so that
434
+ // any incremental chunks in the subtree of this chunk will use that as their parent summary builder.
435
+ const chunkSummaryBuilder = new SummaryTreeBuilder();
436
+ this.trackedSummaryProperties.parentSummaryBuilder = chunkSummaryBuilder;
437
+ chunkSummaryBuilder.addBlob(
438
+ chunkContentsBlobKey,
439
+ this.trackedSummaryProperties.stringify(chunkEncoder(chunk)),
440
+ );
401
441
 
402
- // An additional ref-count must be added to these chunks representing a reference from the summary tree to the chunk.
403
- // This will ensure that the blob's content never change and thus the reference stays accurate: instead of modifying it,
404
- // a copy will be created without the blob reference.
405
- // The "getChunkAtCursor" adds this additional ref-count.
406
- const chunk = this.getChunkAtCursor(cursor);
442
+ // Add this chunk's summary tree to the parent's summary tree. The summary tree contains its encoded
443
+ // contents and the summary trees of any incremental chunks under it.
444
+ parentSummaryBuilder.addWithStats(
445
+ `${newReferenceId}`,
446
+ chunkSummaryBuilder.getSummaryTree(),
447
+ );
407
448
 
408
- // Try and get the properties of the chunk from the latest successful summary.
409
- // If it exists and the summary is not a full tree, use the properties to generate a summary handle.
410
- // If it does not exist, encode the chunk and generate new properties for it.
411
- const previousChunkProperties = tryGetFromNestedMap(
412
- this.chunkTrackingPropertiesMap,
413
- this.latestSummarySequenceNumber,
414
- chunk,
415
- );
416
- if (previousChunkProperties !== undefined && !this.trackedSummaryProperties.fullTree) {
417
- chunkProperties = previousChunkProperties;
418
- chunkReferenceId = previousChunkProperties.referenceId;
419
- this.trackedSummaryProperties.parentSummaryBuilder.addHandle(
420
- `${chunkReferenceId}`,
421
- SummaryType.Tree,
422
- `${this.trackedSummaryProperties.latestSummaryBasePath}/${previousChunkProperties.summaryPath}`,
423
- );
424
- } else {
425
- // Generate a new reference ID for the chunk.
426
- chunkReferenceId = brand(this.nextReferenceId++);
427
- // Add the reference ID of this chunk to the chunk summary path and use the path as the summary path
428
- // for the chunk in its summary properties.
429
- // This is done before encoding the chunk so that the summary path is updated correctly when encoding
430
- // any incremental chunks that are under this chunk.
431
- this.trackedSummaryProperties.chunkSummaryPath.push(chunkReferenceId);
432
-
433
- chunkProperties = {
434
- referenceId: chunkReferenceId,
435
- summaryPath: this.trackedSummaryProperties.chunkSummaryPath.join("/"),
436
- };
437
-
438
- const parentSummaryBuilder = this.trackedSummaryProperties.parentSummaryBuilder;
439
- // Create a new summary builder for this chunk to build its summary tree which will be stored in the
440
- // parent's summary tree under its reference ID.
441
- // Before encoding the chunk, set the parent summary builder to this chunk's summary builder so that
442
- // any incremental chunks in the subtree of this chunk will use that as their parent summary builder.
443
- const chunkSummaryBuilder = new SummaryTreeBuilder();
444
- this.trackedSummaryProperties.parentSummaryBuilder = chunkSummaryBuilder;
445
- chunkSummaryBuilder.addBlob(
446
- chunkContentsBlobKey,
447
- this.trackedSummaryProperties.stringify(chunkEncoder(chunk)),
448
- );
449
+ // Restore the parent summary builder and chunk summary path.
450
+ this.trackedSummaryProperties.parentSummaryBuilder = parentSummaryBuilder;
451
+ this.trackedSummaryProperties.chunkSummaryPath.pop();
452
+ }
449
453
 
450
- // Add this chunk's summary tree to the parent's summary tree. The summary tree contains its encoded
451
- // contents and the summary trees of any incremental chunks under it.
452
- parentSummaryBuilder.addWithStats(
453
- `${chunkReferenceId}`,
454
- chunkSummaryBuilder.getSummaryTree(),
454
+ setInNestedMap(
455
+ this.chunkTrackingPropertiesMap,
456
+ this.trackedSummaryProperties.summarySequenceNumber,
457
+ chunk,
458
+ chunkProperties,
455
459
  );
456
-
457
- // Restore the parent summary builder and chunk summary path.
458
- this.trackedSummaryProperties.parentSummaryBuilder = parentSummaryBuilder;
459
- this.trackedSummaryProperties.chunkSummaryPath.pop();
460
+ chunkReferenceIds.push(chunkProperties.referenceId);
460
461
  }
461
-
462
- setInNestedMap(
463
- this.chunkTrackingPropertiesMap,
464
- this.trackedSummaryProperties.summarySequenceNumber,
465
- chunk,
466
- chunkProperties,
467
- );
468
- return [chunkReferenceId];
462
+ return chunkReferenceIds;
469
463
  }
470
464
 
471
465
  /**
@@ -535,7 +529,7 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
535
529
  chunkDecoder: (encoded: EncodedFieldBatch) => TreeChunk,
536
530
  ): TreeChunk {
537
531
  const ChunkLoadProperties = this.loadedChunksMap.get(`${referenceId}`);
538
- assert(ChunkLoadProperties !== undefined, "Encoded incremental chunk not found");
532
+ assert(ChunkLoadProperties !== undefined, 0xc86 /* Encoded incremental chunk not found */);
539
533
  const chunk = chunkDecoder(ChunkLoadProperties.encodedContents);
540
534
 
541
535
  // Account for the reference about to be added in `chunkTrackingPropertiesMap`
@@ -110,6 +110,7 @@ export {
110
110
  fluidVersionToFieldBatchCodecWriteVersion,
111
111
  type FieldBatchEncodingContext,
112
112
  emptyChunk,
113
+ combineChunks,
113
114
  type IncrementalEncodingPolicy,
114
115
  defaultIncrementalEncodingPolicy,
115
116
  } from "./chunked-forest/index.js";
@@ -49,7 +49,7 @@ import {
49
49
  type Breakable,
50
50
  type WithBreakable,
51
51
  } from "../../util/index.js";
52
- import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/index.js";
52
+ import { chunkField, defaultChunkPolicy } from "../chunked-forest/index.js";
53
53
  import { cursorForMapTreeNode, mapTreeFromCursor } from "../mapTreeCursor.js";
54
54
  import { type CursorWithNode, SynchronousCursor } from "../treeCursorUtils.js";
55
55
  import {
@@ -128,8 +128,8 @@ export class ObjectForest implements IEditableForest, WithBreakable {
128
128
  return new ObjectForest(this.breaker, schema, anchors, this.additionalAsserts, this.roots);
129
129
  }
130
130
 
131
- public chunkField(cursor: ITreeCursorSynchronous): TreeChunk {
132
- return chunkFieldSingle(cursor, { idCompressor: undefined, policy: defaultChunkPolicy });
131
+ public chunkField(cursor: ITreeCursorSynchronous): TreeChunk[] {
132
+ return chunkField(cursor, { idCompressor: undefined, policy: defaultChunkPolicy });
133
133
  }
134
134
 
135
135
  public forgetAnchor(anchor: Anchor): void {
package/src/index.ts CHANGED
@@ -123,6 +123,7 @@ export {
123
123
  type WithType,
124
124
  type NodeChangedData,
125
125
  type SchemaUpgrade,
126
+ contentSchemaSymbol,
126
127
  // Types not really intended for public use, but used in links.
127
128
  // Can not be moved to internalTypes since doing so causes app code to throw errors like:
128
129
  // Error: src/simple-tree/objectNode.ts:72:1 - (ae-unresolved-link) The @link reference could not be resolved: The package "@fluidframework/tree" does not have an export "TreeNodeApi"
@@ -164,6 +165,7 @@ export {
164
165
  singletonSchema,
165
166
  type UnsafeUnknownSchema,
166
167
  type TreeViewAlpha,
168
+ type TreeViewBeta,
167
169
  type InsertableField,
168
170
  type Insertable,
169
171
  type InsertableContent,
@@ -234,6 +236,7 @@ export {
234
236
  type InsertableTreeNodeFromAllowedTypes,
235
237
  type Input,
236
238
  type TreeBranch,
239
+ type TreeBranchAlpha,
237
240
  type TreeBranchEvents,
238
241
  asTreeViewAlpha,
239
242
  type NodeSchemaOptions,
@@ -337,4 +340,4 @@ export type { MapNodeInsertableData } from "./simple-tree/index.js";
337
340
  export { JsonAsTree } from "./jsonDomainSchema.js";
338
341
  export { FluidSerializableAsTree } from "./serializableDomainSchema.js";
339
342
  export { TableSchema, type System_TableSchema } from "./tableSchema.js";
340
- export { asAlpha } from "./api.js";
343
+ export { asAlpha, asBeta } from "./api.js";
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/tree";
9
- export const pkgVersion = "2.70.0-361248";
9
+ export const pkgVersion = "2.70.0";