@fluidframework/tree 2.63.0-359734 → 2.63.0-359962

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 (237) hide show
  1. package/api-report/tree.alpha.api.md +35 -0
  2. package/dist/alpha.d.ts +7 -0
  3. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts +67 -13
  4. package/dist/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  5. package/dist/feature-libraries/chunked-forest/chunkTree.js +70 -35
  6. package/dist/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  7. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +5 -5
  8. package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  9. package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  10. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +23 -0
  11. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -0
  12. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js +15 -0
  13. package/dist/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -0
  14. package/dist/feature-libraries/chunked-forest/codec/index.d.ts +1 -0
  15. package/dist/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  16. package/dist/feature-libraries/chunked-forest/codec/index.js +3 -1
  17. package/dist/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  18. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  19. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +3 -2
  20. package/dist/feature-libraries/chunked-forest/codec/schemaBasedEncode.js.map +1 -1
  21. package/dist/feature-libraries/chunked-forest/index.d.ts +1 -1
  22. package/dist/feature-libraries/chunked-forest/index.d.ts.map +1 -1
  23. package/dist/feature-libraries/chunked-forest/index.js +2 -1
  24. package/dist/feature-libraries/chunked-forest/index.js.map +1 -1
  25. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts +1 -1
  26. package/dist/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  27. package/dist/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  28. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -3
  29. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  30. package/dist/feature-libraries/forest-summary/forestSummarizer.js +3 -3
  31. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  32. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +4 -11
  33. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  34. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +2 -6
  35. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  36. package/dist/feature-libraries/index.d.ts +1 -1
  37. package/dist/feature-libraries/index.d.ts.map +1 -1
  38. package/dist/feature-libraries/index.js +2 -1
  39. package/dist/feature-libraries/index.js.map +1 -1
  40. package/dist/index.d.ts +1 -1
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js.map +1 -1
  43. package/dist/packageVersion.d.ts +1 -1
  44. package/dist/packageVersion.js +1 -1
  45. package/dist/packageVersion.js.map +1 -1
  46. package/dist/shared-tree/independentView.d.ts.map +1 -1
  47. package/dist/shared-tree/independentView.js +2 -2
  48. package/dist/shared-tree/independentView.js.map +1 -1
  49. package/dist/shared-tree/schematizingTreeView.d.ts +5 -0
  50. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  51. package/dist/shared-tree/schematizingTreeView.js +37 -7
  52. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  53. package/dist/shared-tree/sharedTree.d.ts +6 -8
  54. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  55. package/dist/shared-tree/sharedTree.js +6 -8
  56. package/dist/shared-tree/sharedTree.js.map +1 -1
  57. package/dist/shared-tree/tree.js +1 -1
  58. package/dist/shared-tree/tree.js.map +1 -1
  59. package/dist/shared-tree/treeAlpha.js +2 -2
  60. package/dist/shared-tree/treeAlpha.js.map +1 -1
  61. package/dist/simple-tree/api/index.d.ts +1 -1
  62. package/dist/simple-tree/api/index.d.ts.map +1 -1
  63. package/dist/simple-tree/api/index.js.map +1 -1
  64. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +37 -2
  65. package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  66. package/dist/simple-tree/api/schemaFactoryAlpha.js +34 -14
  67. package/dist/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  68. package/dist/simple-tree/api/schemaStatics.js +3 -0
  69. package/dist/simple-tree/api/schemaStatics.js.map +1 -1
  70. package/dist/simple-tree/api/treeBeta.js +2 -2
  71. package/dist/simple-tree/api/treeBeta.js.map +1 -1
  72. package/dist/simple-tree/api/treeNodeApi.js +3 -3
  73. package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
  74. package/dist/simple-tree/api/typesUnsafe.d.ts +60 -1
  75. package/dist/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  76. package/dist/simple-tree/api/typesUnsafe.js.map +1 -1
  77. package/dist/simple-tree/core/index.d.ts +1 -1
  78. package/dist/simple-tree/core/index.d.ts.map +1 -1
  79. package/dist/simple-tree/core/index.js +2 -2
  80. package/dist/simple-tree/core/index.js.map +1 -1
  81. package/dist/simple-tree/core/treeNodeKernel.d.ts +7 -11
  82. package/dist/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  83. package/dist/simple-tree/core/treeNodeKernel.js +24 -47
  84. package/dist/simple-tree/core/treeNodeKernel.js.map +1 -1
  85. package/dist/simple-tree/getTreeNodeForField.js +1 -1
  86. package/dist/simple-tree/getTreeNodeForField.js.map +1 -1
  87. package/dist/simple-tree/index.d.ts +2 -2
  88. package/dist/simple-tree/index.d.ts.map +1 -1
  89. package/dist/simple-tree/index.js +2 -2
  90. package/dist/simple-tree/index.js.map +1 -1
  91. package/dist/simple-tree/node-kinds/array/arrayNode.js +2 -2
  92. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  93. package/dist/simple-tree/node-kinds/map/mapNode.js +2 -2
  94. package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  95. package/dist/simple-tree/node-kinds/object/objectNode.js +3 -3
  96. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  97. package/dist/simple-tree/node-kinds/record/recordNode.js +6 -6
  98. package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  99. package/dist/simple-tree/prepareForInsertion.d.ts +36 -4
  100. package/dist/simple-tree/prepareForInsertion.d.ts.map +1 -1
  101. package/dist/simple-tree/prepareForInsertion.js +43 -15
  102. package/dist/simple-tree/prepareForInsertion.js.map +1 -1
  103. package/lib/alpha.d.ts +7 -0
  104. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts +67 -13
  105. package/lib/feature-libraries/chunked-forest/chunkTree.d.ts.map +1 -1
  106. package/lib/feature-libraries/chunked-forest/chunkTree.js +68 -32
  107. package/lib/feature-libraries/chunked-forest/chunkTree.js.map +1 -1
  108. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +5 -5
  109. package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
  110. package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
  111. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts +23 -0
  112. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.d.ts.map +1 -0
  113. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js +11 -0
  114. package/lib/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.js.map +1 -0
  115. package/lib/feature-libraries/chunked-forest/codec/index.d.ts +1 -0
  116. package/lib/feature-libraries/chunked-forest/codec/index.d.ts.map +1 -1
  117. package/lib/feature-libraries/chunked-forest/codec/index.js +1 -0
  118. package/lib/feature-libraries/chunked-forest/codec/index.js.map +1 -1
  119. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.d.ts.map +1 -1
  120. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.js +3 -2
  121. package/lib/feature-libraries/chunked-forest/codec/schemaBasedEncode.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/flexTreeTypes.d.ts +1 -1
  127. package/lib/feature-libraries/flex-tree/flexTreeTypes.d.ts.map +1 -1
  128. package/lib/feature-libraries/flex-tree/flexTreeTypes.js.map +1 -1
  129. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts +3 -3
  130. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  131. package/lib/feature-libraries/forest-summary/forestSummarizer.js +3 -3
  132. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  133. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +4 -11
  134. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  135. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +2 -6
  136. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  137. package/lib/feature-libraries/index.d.ts +1 -1
  138. package/lib/feature-libraries/index.d.ts.map +1 -1
  139. package/lib/feature-libraries/index.js +1 -1
  140. package/lib/feature-libraries/index.js.map +1 -1
  141. package/lib/index.d.ts +1 -1
  142. package/lib/index.d.ts.map +1 -1
  143. package/lib/index.js.map +1 -1
  144. package/lib/packageVersion.d.ts +1 -1
  145. package/lib/packageVersion.js +1 -1
  146. package/lib/packageVersion.js.map +1 -1
  147. package/lib/shared-tree/independentView.d.ts.map +1 -1
  148. package/lib/shared-tree/independentView.js +3 -3
  149. package/lib/shared-tree/independentView.js.map +1 -1
  150. package/lib/shared-tree/schematizingTreeView.d.ts +5 -0
  151. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  152. package/lib/shared-tree/schematizingTreeView.js +40 -10
  153. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  154. package/lib/shared-tree/sharedTree.d.ts +6 -8
  155. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  156. package/lib/shared-tree/sharedTree.js +7 -9
  157. package/lib/shared-tree/sharedTree.js.map +1 -1
  158. package/lib/shared-tree/tree.js +2 -2
  159. package/lib/shared-tree/tree.js.map +1 -1
  160. package/lib/shared-tree/treeAlpha.js +3 -3
  161. package/lib/shared-tree/treeAlpha.js.map +1 -1
  162. package/lib/simple-tree/api/index.d.ts +1 -1
  163. package/lib/simple-tree/api/index.d.ts.map +1 -1
  164. package/lib/simple-tree/api/index.js.map +1 -1
  165. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +37 -2
  166. package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
  167. package/lib/simple-tree/api/schemaFactoryAlpha.js +34 -14
  168. package/lib/simple-tree/api/schemaFactoryAlpha.js.map +1 -1
  169. package/lib/simple-tree/api/schemaStatics.js +3 -0
  170. package/lib/simple-tree/api/schemaStatics.js.map +1 -1
  171. package/lib/simple-tree/api/treeBeta.js +2 -2
  172. package/lib/simple-tree/api/treeBeta.js.map +1 -1
  173. package/lib/simple-tree/api/treeNodeApi.js +4 -4
  174. package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
  175. package/lib/simple-tree/api/typesUnsafe.d.ts +60 -1
  176. package/lib/simple-tree/api/typesUnsafe.d.ts.map +1 -1
  177. package/lib/simple-tree/api/typesUnsafe.js.map +1 -1
  178. package/lib/simple-tree/core/index.d.ts +1 -1
  179. package/lib/simple-tree/core/index.d.ts.map +1 -1
  180. package/lib/simple-tree/core/index.js +1 -1
  181. package/lib/simple-tree/core/index.js.map +1 -1
  182. package/lib/simple-tree/core/treeNodeKernel.d.ts +7 -11
  183. package/lib/simple-tree/core/treeNodeKernel.d.ts.map +1 -1
  184. package/lib/simple-tree/core/treeNodeKernel.js +23 -46
  185. package/lib/simple-tree/core/treeNodeKernel.js.map +1 -1
  186. package/lib/simple-tree/getTreeNodeForField.js +1 -1
  187. package/lib/simple-tree/getTreeNodeForField.js.map +1 -1
  188. package/lib/simple-tree/index.d.ts +2 -2
  189. package/lib/simple-tree/index.d.ts.map +1 -1
  190. package/lib/simple-tree/index.js +1 -1
  191. package/lib/simple-tree/index.js.map +1 -1
  192. package/lib/simple-tree/node-kinds/array/arrayNode.js +3 -3
  193. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  194. package/lib/simple-tree/node-kinds/map/mapNode.js +3 -3
  195. package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
  196. package/lib/simple-tree/node-kinds/object/objectNode.js +4 -4
  197. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  198. package/lib/simple-tree/node-kinds/record/recordNode.js +7 -7
  199. package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
  200. package/lib/simple-tree/prepareForInsertion.d.ts +36 -4
  201. package/lib/simple-tree/prepareForInsertion.d.ts.map +1 -1
  202. package/lib/simple-tree/prepareForInsertion.js +45 -17
  203. package/lib/simple-tree/prepareForInsertion.js.map +1 -1
  204. package/package.json +20 -20
  205. package/src/feature-libraries/chunked-forest/chunkTree.ts +112 -45
  206. package/src/feature-libraries/chunked-forest/codec/codecs.ts +4 -9
  207. package/src/feature-libraries/chunked-forest/codec/incrementalEncodingPolicy.ts +33 -0
  208. package/src/feature-libraries/chunked-forest/codec/index.ts +4 -0
  209. package/src/feature-libraries/chunked-forest/codec/schemaBasedEncode.ts +4 -7
  210. package/src/feature-libraries/chunked-forest/index.ts +2 -0
  211. package/src/feature-libraries/flex-tree/flexTreeTypes.ts +1 -1
  212. package/src/feature-libraries/forest-summary/forestSummarizer.ts +8 -12
  213. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +3 -12
  214. package/src/feature-libraries/index.ts +2 -0
  215. package/src/index.ts +7 -0
  216. package/src/packageVersion.ts +1 -1
  217. package/src/shared-tree/independentView.ts +3 -0
  218. package/src/shared-tree/schematizingTreeView.ts +57 -8
  219. package/src/shared-tree/sharedTree.ts +33 -20
  220. package/src/shared-tree/tree.ts +2 -2
  221. package/src/shared-tree/treeAlpha.ts +3 -3
  222. package/src/simple-tree/api/index.ts +7 -0
  223. package/src/simple-tree/api/schemaFactoryAlpha.ts +79 -19
  224. package/src/simple-tree/api/schemaStatics.ts +3 -0
  225. package/src/simple-tree/api/treeBeta.ts +2 -2
  226. package/src/simple-tree/api/treeNodeApi.ts +4 -4
  227. package/src/simple-tree/api/typesUnsafe.ts +81 -0
  228. package/src/simple-tree/core/TreeNodeBinding.md +14 -70
  229. package/src/simple-tree/core/index.ts +1 -1
  230. package/src/simple-tree/core/treeNodeKernel.ts +25 -59
  231. package/src/simple-tree/getTreeNodeForField.ts +1 -1
  232. package/src/simple-tree/index.ts +8 -1
  233. package/src/simple-tree/node-kinds/array/arrayNode.ts +3 -3
  234. package/src/simple-tree/node-kinds/map/mapNode.ts +3 -3
  235. package/src/simple-tree/node-kinds/object/objectNode.ts +4 -4
  236. package/src/simple-tree/node-kinds/record/recordNode.ts +7 -7
  237. package/src/simple-tree/prepareForInsertion.ts +87 -25
@@ -16,7 +16,6 @@ import {
16
16
  ValueSchema,
17
17
  Multiplicity,
18
18
  identifierFieldKindIdentifier,
19
- type FieldKey,
20
19
  } from "../../../core/index.js";
21
20
  import type { FullSchemaPolicy } from "../../modular-schema/index.js";
22
21
 
@@ -35,6 +34,7 @@ import type { FieldBatch } from "./fieldBatch.js";
35
34
  import { type EncodedFieldBatch, type EncodedValueShape, SpecialField } from "./format.js";
36
35
  import type { IncrementalEncoder } from "./codecs.js";
37
36
  import { NodeShapeBasedEncoder } from "./nodeEncoder.js";
37
+ import { defaultIncrementalEncodingPolicy } from "./incrementalEncodingPolicy.js";
38
38
 
39
39
  /**
40
40
  * Encode data from `fieldBatch` in into an `EncodedChunk`.
@@ -134,14 +134,11 @@ export function getNodeEncoder(
134
134
  // consider moving some optional and sequence fields to extra fields if they are commonly empty
135
135
  // to reduce encoded size.
136
136
 
137
- const shouldEncodeFieldIncrementallyLocal = (
138
- nodeIdentifier: TreeNodeSchemaIdentifier,
139
- fieldKey: FieldKey,
140
- ): boolean =>
141
- incrementalEncoder?.shouldEncodeFieldIncrementally(nodeIdentifier, fieldKey) ?? false;
137
+ const shouldEncodeIncrementally =
138
+ incrementalEncoder?.shouldEncodeIncrementally ?? defaultIncrementalEncodingPolicy;
142
139
  const objectNodeFields: KeyedFieldEncoder[] = [];
143
140
  for (const [key, field] of schema.objectNodeFields ?? []) {
144
- const fieldEncoder = shouldEncodeFieldIncrementallyLocal(schemaName, key)
141
+ const fieldEncoder = shouldEncodeIncrementally(schemaName, key)
145
142
  ? incrementalFieldEncoder
146
143
  : fieldBuilder.fieldEncoderFromSchema(field);
147
144
  objectNodeFields.push({
@@ -25,5 +25,7 @@ export {
25
25
  fluidVersionToFieldBatchCodecWriteVersion,
26
26
  type IncrementalEncoderDecoder,
27
27
  type ChunkReferenceId,
28
+ type IncrementalEncodingPolicy,
29
+ defaultIncrementalEncodingPolicy,
28
30
  } from "./codec/index.js";
29
31
  export { emptyChunk } from "./emptyChunk.js";
@@ -398,7 +398,7 @@ export interface FlexTreeOptionalField extends FlexTreeField {
398
398
  export type FlexTreeTypedField<Kind extends FlexFieldKind> =
399
399
  Kind extends typeof FieldKinds.sequence
400
400
  ? FlexTreeSequenceField
401
- : Kind extends typeof FieldKinds.required
401
+ : Kind extends typeof FieldKinds.required | typeof FieldKinds.identifier
402
402
  ? FlexTreeRequiredField
403
403
  : Kind extends typeof FieldKinds.optional
404
404
  ? FlexTreeOptionalField
@@ -23,7 +23,6 @@ import {
23
23
  type ITreeSubscriptionCursor,
24
24
  type RevisionTagCodec,
25
25
  TreeNavigationResult,
26
- type TreeNodeSchemaIdentifier,
27
26
  applyDelta,
28
27
  forEachField,
29
28
  makeDetachedFieldIndex,
@@ -36,7 +35,12 @@ import type {
36
35
  import { idAllocatorFromMaxId, type JsonCompatible } from "../../util/index.js";
37
36
  // eslint-disable-next-line import/no-internal-modules
38
37
  import { chunkFieldSingle, defaultChunkPolicy } from "../chunked-forest/chunkTree.js";
39
- import type { FieldBatchCodec, FieldBatchEncodingContext } from "../chunked-forest/index.js";
38
+ import {
39
+ defaultIncrementalEncodingPolicy,
40
+ type FieldBatchCodec,
41
+ type FieldBatchEncodingContext,
42
+ type IncrementalEncodingPolicy,
43
+ } from "../chunked-forest/index.js";
40
44
 
41
45
  import { type ForestCodec, makeForestSummarizerCodec } from "./codec.js";
42
46
  import {
@@ -74,23 +78,15 @@ export class ForestSummarizer implements Summarizable {
74
78
  private readonly encoderContext: FieldBatchEncodingContext,
75
79
  options: CodecWriteOptions,
76
80
  private readonly idCompressor: IIdCompressor,
77
- shouldEncodeFieldIncrementally?: (
78
- nodeIdentifier: TreeNodeSchemaIdentifier,
79
- fieldKey: FieldKey,
80
- ) => boolean,
81
+ shouldEncodeIncrementally: IncrementalEncodingPolicy = defaultIncrementalEncodingPolicy,
81
82
  ) {
82
83
  // TODO: this should take in CodecWriteOptions, and use it to pick the write version.
83
84
  this.codec = makeForestSummarizerCodec(options, fieldBatchCodec);
84
-
85
- const shouldEncodeFieldIncrementallyLocal = (
86
- nodeIdentifier: TreeNodeSchemaIdentifier,
87
- fieldKey: FieldKey,
88
- ): boolean => shouldEncodeFieldIncrementally?.(nodeIdentifier, fieldKey) ?? false;
89
85
  this.incrementalSummaryBuilder = new ForestIncrementalSummaryBuilder(
90
86
  encoderContext.encodeType ===
91
87
  TreeCompressionStrategyExtended.CompressedIncremental /* enableIncrementalSummary */,
92
88
  (cursor: ITreeCursorSynchronous) => this.forest.chunkField(cursor),
93
- shouldEncodeFieldIncrementallyLocal,
89
+ shouldEncodeIncrementally,
94
90
  );
95
91
  }
96
92
 
@@ -20,13 +20,10 @@ import type {
20
20
  ChunkReferenceId,
21
21
  EncodedFieldBatch,
22
22
  IncrementalEncoderDecoder,
23
+ IncrementalEncodingPolicy,
23
24
  TreeChunk,
24
25
  } from "../chunked-forest/index.js";
25
- import type {
26
- FieldKey,
27
- ITreeCursorSynchronous,
28
- TreeNodeSchemaIdentifier,
29
- } from "../../core/index.js";
26
+ import type { ITreeCursorSynchronous } from "../../core/index.js";
30
27
  import { SummaryType } from "@fluidframework/driver-definitions";
31
28
  import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
32
29
  import type { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
@@ -263,13 +260,7 @@ export class ForestIncrementalSummaryBuilder implements IncrementalEncoderDecode
263
260
  public constructor(
264
261
  private readonly enableIncrementalSummary: boolean,
265
262
  private readonly getChunkAtCursor: (cursor: ITreeCursorSynchronous) => TreeChunk,
266
- /**
267
- * {@link IncrementalEncoder.shouldEncodeFieldIncrementally}
268
- */
269
- public readonly shouldEncodeFieldIncrementally: (
270
- nodeIdentifier: TreeNodeSchemaIdentifier,
271
- fieldKey: FieldKey,
272
- ) => boolean,
263
+ public readonly shouldEncodeIncrementally: IncrementalEncodingPolicy,
273
264
  ) {}
274
265
 
275
266
  /**
@@ -110,6 +110,8 @@ export {
110
110
  fluidVersionToFieldBatchCodecWriteVersion,
111
111
  type FieldBatchEncodingContext,
112
112
  emptyChunk,
113
+ type IncrementalEncodingPolicy,
114
+ defaultIncrementalEncodingPolicy,
113
115
  } from "./chunked-forest/index.js";
114
116
 
115
117
  export {
package/src/index.ts CHANGED
@@ -137,6 +137,13 @@ export {
137
137
  type ArrayNodeCustomizableSchemaUnsafe,
138
138
  type MapNodeCustomizableSchemaUnsafe,
139
139
  type TreeRecordNodeUnsafe,
140
+ type UnannotateAllowedTypeUnsafe,
141
+ type AnnotatedAllowedTypeUnsafe,
142
+ type AnnotatedAllowedTypesUnsafe,
143
+ type AllowedTypesFullUnsafe,
144
+ type AllowedTypesFullFromMixedUnsafe,
145
+ type UnannotateAllowedTypesListUnsafe,
146
+ type AnnotateAllowedTypesListUnsafe,
140
147
  // System types (not in Internal types for various reasons, like doc links or cannot be named errors).
141
148
  type typeSchemaSymbol,
142
149
  type TreeNodeSchemaNonClass,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/tree";
9
- export const pkgVersion = "2.63.0-359734";
9
+ export const pkgVersion = "2.63.0-359962";
@@ -26,6 +26,7 @@ import {
26
26
  type FieldBatchEncodingContext,
27
27
  defaultSchemaPolicy,
28
28
  TreeCompressionStrategy,
29
+ defaultIncrementalEncodingPolicy,
29
30
  } from "../feature-libraries/index.js";
30
31
  // eslint-disable-next-line import/no-internal-modules
31
32
  import type { Format } from "../feature-libraries/schema-index/formatV1.js";
@@ -67,6 +68,7 @@ export function independentView<const TSchema extends ImplicitFieldSchema>(
67
68
  options.forest ?? defaultSharedTreeOptions.forest,
68
69
  schema,
69
70
  idCompressor,
71
+ defaultIncrementalEncodingPolicy,
70
72
  );
71
73
  const checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {
72
74
  forest,
@@ -144,6 +146,7 @@ export function independentInitializedViewInternal<const TSchema extends Implici
144
146
  options.forest ?? defaultSharedTreeOptions.forest,
145
147
  schemaRepository,
146
148
  idCompressor,
149
+ defaultIncrementalEncodingPolicy,
147
150
  );
148
151
 
149
152
  const checkout = createTreeCheckout(idCompressor, mintRevisionTag, revisionTagCodec, {
@@ -12,13 +12,17 @@ import type {
12
12
  import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
13
13
  import { UsageError } from "@fluidframework/telemetry-utils/internal";
14
14
 
15
- import { anchorSlot } from "../core/index.js";
15
+ import { anchorSlot, rootFieldKey } from "../core/index.js";
16
16
  import {
17
17
  type NodeIdentifierManager,
18
18
  defaultSchemaPolicy,
19
19
  cursorForMapTreeField,
20
20
  TreeStatus,
21
21
  Context,
22
+ type FlexTreeOptionalField,
23
+ type FlexTreeUnknownUnboxed,
24
+ FieldKinds,
25
+ type FlexTreeRequiredField,
22
26
  } from "../feature-libraries/index.js";
23
27
  import {
24
28
  type ImplicitFieldSchema,
@@ -38,7 +42,7 @@ import {
38
42
  type UnsafeUnknownSchema,
39
43
  type TreeBranch,
40
44
  type TreeBranchEvents,
41
- getOrCreateInnerNode,
45
+ getInnerNode,
42
46
  getKernel,
43
47
  type VoidTransactionCallbackStatus,
44
48
  type TransactionCallbackStatus,
@@ -117,6 +121,11 @@ export class SchematizingSimpleTreeView<
117
121
  */
118
122
  private midUpgrade = false;
119
123
 
124
+ /**
125
+ * Hydration work deferred until Context has been created.
126
+ */
127
+ private pendingHydration?: () => void;
128
+
120
129
  private readonly rootFieldSchema: FieldSchema;
121
130
  public readonly breaker: Breakable;
122
131
 
@@ -174,6 +183,13 @@ export class SchematizingSimpleTreeView<
174
183
 
175
184
  this.runSchemaEdit(() => {
176
185
  const schema = toInitialSchema(this.config.schema);
186
+ // This has to be the contextless version, since when "initialize" is called (right after this),
187
+ // it will do a schema change which would dispose of the current context (see inside `update`).
188
+ // Thus using the current context (if any) would hydrate nodes then
189
+ // immediately dispose them instead of having them actually be useable after initialize.
190
+ // For this to work,
191
+ // the hydration must be deferred until after the content is inserted into the tree and the final schema change is done (for required roots),
192
+ // but before any user event could could run.
177
193
  const mapTree = prepareForInsertionContextless(
178
194
  content as InsertableContent | undefined,
179
195
  this.rootFieldSchema,
@@ -183,6 +199,19 @@ export class SchematizingSimpleTreeView<
183
199
  },
184
200
  this,
185
201
  schema.rootFieldSchema,
202
+ (batches, doHydration) => {
203
+ assert(this.pendingHydration === undefined, "pendingHydration already set");
204
+ this.pendingHydration = () => {
205
+ assert(batches.length <= 1, "initialize should at most one hydration batch");
206
+ for (const batch of batches) {
207
+ doHydration(batch, {
208
+ parent: undefined,
209
+ parentField: rootFieldKey,
210
+ parentIndex: 0,
211
+ });
212
+ }
213
+ };
214
+ },
186
215
  );
187
216
 
188
217
  this.checkout.transaction.start();
@@ -350,7 +379,10 @@ export class SchematizingSimpleTreeView<
350
379
  // TODO: provide a better event: this.view.flexTree.on(????) and/or integrate with with the normal event code paths.
351
380
 
352
381
  // Track what the root was before to be able to detect changes.
353
- let lastRoot: ReadableField<TRootSchema> = this.root;
382
+ // This uses the flex tree root to avoid demanding the simple-tree TreeNode when it might not be hydrated yet.
383
+ let lastRoot: FlexTreeUnknownUnboxed | undefined = (
384
+ this.flexTreeContext.root as FlexTreeOptionalField
385
+ ).content;
354
386
 
355
387
  this.flexTreeViewUnregisterCallbacks.add(
356
388
  this.checkout.events.on("afterBatch", () => {
@@ -359,8 +391,8 @@ export class SchematizingSimpleTreeView<
359
391
  // - The rootChanged event will already be raised at the end of the current upgrade
360
392
  // - It doesn't matter that `lastRoot` isn't updated in this case, because `update` will be called again before the upgrade
361
393
  // completes (at which point this callback and the `lastRoot` captured here will be out of scope anyway)
362
- if (!this.midUpgrade && lastRoot !== this.root) {
363
- lastRoot = this.root;
394
+ if (!this.midUpgrade && lastRoot !== this.flexRoot.content) {
395
+ lastRoot = this.flexRoot.content;
364
396
  this.events.emit("rootChanged");
365
397
  }
366
398
  }),
@@ -374,6 +406,10 @@ export class SchematizingSimpleTreeView<
374
406
  );
375
407
 
376
408
  if (!this.midUpgrade) {
409
+ assert(
410
+ this.pendingHydration === undefined,
411
+ "no nodes should be pending hydration when triggering events that could access nodes",
412
+ );
377
413
  this.events.emit("schemaChanged");
378
414
  this.events.emit("rootChanged");
379
415
  }
@@ -386,6 +422,9 @@ export class SchematizingSimpleTreeView<
386
422
  } finally {
387
423
  this.midUpgrade = false;
388
424
  }
425
+ // Ensure hydration is flushed before events run which could access nodes.
426
+ this.pendingHydration?.();
427
+ this.pendingHydration = undefined;
389
428
  this.events.emit("schemaChanged");
390
429
  this.events.emit("rootChanged");
391
430
  }
@@ -426,7 +465,7 @@ export class SchematizingSimpleTreeView<
426
465
  }
427
466
  }
428
467
 
429
- public get root(): ReadableField<TRootSchema> {
468
+ private get flexRoot(): FlexTreeOptionalField | FlexTreeRequiredField {
430
469
  this.breaker.use();
431
470
  if (!this.compatibility.canView) {
432
471
  throw new UsageError(
@@ -434,7 +473,17 @@ export class SchematizingSimpleTreeView<
434
473
  );
435
474
  }
436
475
  const view = this.getFlexTreeContext();
437
- return tryGetTreeNodeForField(view.root) as ReadableField<TRootSchema>;
476
+ assert(
477
+ view.root.is(FieldKinds.optional) ||
478
+ view.root.is(FieldKinds.required) ||
479
+ view.root.is(FieldKinds.identifier),
480
+ "unexpected root field kind",
481
+ );
482
+ return view.root;
483
+ }
484
+
485
+ public get root(): ReadableField<TRootSchema> {
486
+ return tryGetTreeNodeForField(this.flexRoot) as ReadableField<TRootSchema>;
438
487
  }
439
488
 
440
489
  public set root(newRoot: InsertableField<TRootSchema>) {
@@ -499,7 +548,7 @@ export function addConstraintsToTransaction(
499
548
  for (const constraint of constraints) {
500
549
  switch (constraint.type) {
501
550
  case "nodeInDocument": {
502
- const node = getOrCreateInnerNode(constraint.node);
551
+ const node = getInnerNode(constraint.node);
503
552
  const nodeStatus = getKernel(constraint.node).getStatus();
504
553
  if (nodeStatus !== TreeStatus.InDocument) {
505
554
  const revertText = constraintsOnRevert ? " on revert" : "";
@@ -38,7 +38,6 @@ import {
38
38
  type SchemaFormatVersion,
39
39
  SchemaVersion,
40
40
  type TreeFieldStoredSchema,
41
- type TreeNodeSchemaIdentifier,
42
41
  type TreeNodeStoredSchema,
43
42
  type TreeStoredSchema,
44
43
  TreeStoredSchemaRepository,
@@ -55,6 +54,7 @@ import {
55
54
  TreeCompressionStrategy,
56
55
  buildChunkedForest,
57
56
  buildForest,
57
+ defaultIncrementalEncodingPolicy,
58
58
  defaultSchemaPolicy,
59
59
  getCodecTreeForFieldBatchFormat,
60
60
  getCodecTreeForForestFormat,
@@ -64,6 +64,7 @@ import {
64
64
  makeMitigatedChangeFamily,
65
65
  makeSchemaCodec,
66
66
  makeTreeChunker,
67
+ type IncrementalEncodingPolicy,
67
68
  type FieldBatchFormatVersion,
68
69
  type ForestFormatVersion,
69
70
  type TreeCompressionStrategyPrivate,
@@ -305,7 +306,13 @@ export class SharedTreeKernel
305
306
  const options = { ...defaultSharedTreeOptions, ...optionsParam };
306
307
  const codecVersions = getCodecVersions(options.formatVersion);
307
308
  const schema = new TreeStoredSchemaRepository();
308
- const forest = buildConfiguredForest(breaker, options.forest, schema, idCompressor);
309
+ const forest = buildConfiguredForest(
310
+ breaker,
311
+ options.forest,
312
+ schema,
313
+ idCompressor,
314
+ options.shouldEncodeIncrementally,
315
+ );
309
316
  const revisionTagCodec = new RevisionTagCodec(idCompressor);
310
317
  const removedRoots = makeDetachedFieldIndex(
311
318
  "repair",
@@ -339,7 +346,7 @@ export class SharedTreeKernel
339
346
  encoderContext,
340
347
  options,
341
348
  idCompressor,
342
- options.shouldEncodeFieldIncrementally,
349
+ options.shouldEncodeIncrementally,
343
350
  );
344
351
  const removedRootsSummarizer = new DetachedFieldIndexSummarizer(removedRoots);
345
352
  const innerChangeFamily = new SharedTreeChangeFamily(
@@ -794,16 +801,11 @@ export interface SharedTreeOptionsInternal
794
801
  Partial<SharedTreeFormatOptionsInternal> {
795
802
  disposeForksAfterTransaction?: boolean;
796
803
  /**
797
- * Returns whether a field should be incrementally encoded.
798
- * @param nodeIdentifier - The identifier of the node containing the field.
799
- * @param fieldKey - The key of the field to check.
804
+ * Returns whether a node / field should be incrementally encoded.
800
805
  * @remarks
801
- * The policy for which fields should get incremental encoding should eventually be specified some other way.
806
+ * See {@link IncrementalEncodingPolicy}.
802
807
  */
803
- shouldEncodeFieldIncrementally?(
804
- nodeIdentifier: TreeNodeSchemaIdentifier,
805
- fieldKey: FieldKey,
806
- ): boolean;
808
+ shouldEncodeIncrementally?: IncrementalEncodingPolicy;
807
809
  }
808
810
  /**
809
811
  * Configuration options for SharedTree's internal tree storage.
@@ -882,8 +884,17 @@ export const ForestTypeReference = toForestType(
882
884
  * @beta
883
885
  */
884
886
  export const ForestTypeOptimized = toForestType(
885
- (breaker: Breakable, schema: TreeStoredSchemaSubscription, idCompressor: IIdCompressor) =>
886
- buildChunkedForest(makeTreeChunker(schema, defaultSchemaPolicy), undefined, idCompressor),
887
+ (
888
+ breaker: Breakable,
889
+ schema: TreeStoredSchemaSubscription,
890
+ idCompressor: IIdCompressor,
891
+ shouldEncodeIncrementally: IncrementalEncodingPolicy,
892
+ ) =>
893
+ buildChunkedForest(
894
+ makeTreeChunker(schema, defaultSchemaPolicy, shouldEncodeIncrementally),
895
+ undefined,
896
+ idCompressor,
897
+ ),
887
898
  );
888
899
 
889
900
  /**
@@ -904,6 +915,7 @@ type ForestFactory = (
904
915
  breaker: Breakable,
905
916
  schema: TreeStoredSchemaSubscription,
906
917
  idCompressor: IIdCompressor,
918
+ shouldEncodeIncrementally: IncrementalEncodingPolicy,
907
919
  ) => IEditableForest;
908
920
 
909
921
  function toForestType(factory: ForestFactory): ForestType {
@@ -918,8 +930,14 @@ export function buildConfiguredForest(
918
930
  factory: ForestType,
919
931
  schema: TreeStoredSchemaSubscription,
920
932
  idCompressor: IIdCompressor,
933
+ shouldEncodeIncrementally: IncrementalEncodingPolicy,
921
934
  ): IEditableForest {
922
- return (factory as unknown as ForestFactory)(breaker, schema, idCompressor);
935
+ return (factory as unknown as ForestFactory)(
936
+ breaker,
937
+ schema,
938
+ idCompressor,
939
+ shouldEncodeIncrementally,
940
+ );
923
941
  }
924
942
 
925
943
  export const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {
@@ -929,12 +947,7 @@ export const defaultSharedTreeOptions: Required<SharedTreeOptionsInternal> = {
929
947
  treeEncodeType: TreeCompressionStrategy.Compressed,
930
948
  formatVersion: SharedTreeFormatVersion.v3,
931
949
  disposeForksAfterTransaction: true,
932
- shouldEncodeFieldIncrementally: (
933
- nodeIdentifier: TreeNodeSchemaIdentifier,
934
- fieldKey: FieldKey,
935
- ): boolean => {
936
- return false;
937
- },
950
+ shouldEncodeIncrementally: defaultIncrementalEncodingPolicy,
938
951
  };
939
952
 
940
953
  function exportSimpleFieldSchemaStored(schema: TreeFieldStoredSchema): SimpleFieldSchema {
@@ -11,7 +11,7 @@ import {
11
11
  type TreeNode,
12
12
  type TreeNodeApi,
13
13
  type TreeView,
14
- getOrCreateInnerNode,
14
+ getInnerNode,
15
15
  treeNodeApi,
16
16
  rollback,
17
17
  type TransactionConstraint,
@@ -447,7 +447,7 @@ export function runTransaction<
447
447
  } else {
448
448
  const node = treeOrNode as TNode;
449
449
  const t = transaction as (node: TNode) => TResult | typeof rollback;
450
- const context = getOrCreateInnerNode(node).context;
450
+ const context = getInnerNode(node).context;
451
451
  if (context.isHydrated() === false) {
452
452
  throw new UsageError(
453
453
  "Transactions cannot be run on Unhydrated nodes. Transactions apply to a TreeView and Unhydrated nodes are not part of a TreeView.",
@@ -44,7 +44,7 @@ import {
44
44
  unhydratedFlexTreeFromInsertable,
45
45
  getOrCreateNodeFromInnerNode,
46
46
  getOrCreateNodeFromInnerUnboxedNode,
47
- getOrCreateInnerNode,
47
+ getInnerNode,
48
48
  NodeKind,
49
49
  tryGetTreeNodeForField,
50
50
  isObjectNodeSchema,
@@ -881,7 +881,7 @@ export const TreeAlpha: TreeAlpha = {
881
881
  node: TreeNode,
882
882
  propertyKey: string | number,
883
883
  ): TreeNode | TreeLeafValue | undefined => {
884
- const flexNode = getOrCreateInnerNode(node);
884
+ const flexNode = getInnerNode(node);
885
885
  debugAssert(
886
886
  () => !flexNode.context.isDisposed() || "The provided tree node has been disposed.",
887
887
  );
@@ -951,7 +951,7 @@ export const TreeAlpha: TreeAlpha = {
951
951
  },
952
952
 
953
953
  children(node: TreeNode): [propertyKey: string | number, child: TreeNode | TreeLeafValue][] {
954
- const flexNode = getOrCreateInnerNode(node);
954
+ const flexNode = getInnerNode(node);
955
955
  debugAssert(
956
956
  () => !flexNode.context.isDisposed() || "The provided tree node has been disposed.",
957
957
  );
@@ -90,6 +90,13 @@ export type {
90
90
  MapNodeCustomizableSchemaUnsafe,
91
91
  System_Unsafe,
92
92
  TreeRecordNodeUnsafe,
93
+ UnannotateAllowedTypeUnsafe,
94
+ AnnotatedAllowedTypeUnsafe,
95
+ AnnotatedAllowedTypesUnsafe,
96
+ AllowedTypesFullUnsafe,
97
+ AllowedTypesFullFromMixedUnsafe,
98
+ UnannotateAllowedTypesListUnsafe,
99
+ AnnotateAllowedTypesListUnsafe,
93
100
  } from "./typesUnsafe.js";
94
101
 
95
102
  export {
@@ -40,10 +40,14 @@ import {
40
40
  AnnotatedAllowedTypesInternal,
41
41
  } from "../core/index.js";
42
42
  import type {
43
+ AllowedTypesFullFromMixedUnsafe,
44
+ AnnotatedAllowedTypeUnsafe,
43
45
  ArrayNodeCustomizableSchemaUnsafe,
44
46
  MapNodeCustomizableSchemaUnsafe,
45
47
  System_Unsafe,
46
48
  TreeRecordNodeUnsafe,
49
+ UnannotateAllowedTypeUnsafe,
50
+ Unenforced,
47
51
  } from "./typesUnsafe.js";
48
52
  import type { SimpleObjectNodeSchema } from "../simpleSchema.js";
49
53
  import { SchemaFactoryBeta } from "./schemaFactoryBeta.js";
@@ -113,28 +117,64 @@ export interface SchemaStaticsAlpha {
113
117
  t: T,
114
118
  metadata?: AllowedTypesMetadata,
115
119
  ) => AllowedTypesFullFromMixed<T>;
120
+
121
+ /**
122
+ * {@link SchemaStaticsAlpha.staged} except tweaked to work better for recursive types.
123
+ * Use with {@link ValidateRecursiveSchema} for improved type safety.
124
+ * @remarks
125
+ * This version of {@link SchemaStaticsAlpha.staged} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
126
+ * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
127
+ */
128
+ stagedRecursive: <
129
+ const T extends Unenforced<AnnotatedAllowedType | LazyItem<TreeNodeSchema>>,
130
+ >(
131
+ t: T,
132
+ ) => AnnotatedAllowedTypeUnsafe<UnannotateAllowedTypeUnsafe<T>>;
133
+
134
+ /**
135
+ * {@link SchemaStaticsAlpha.types} except tweaked to work better for recursive types.
136
+ * Use with {@link ValidateRecursiveSchema} for improved type safety.
137
+ * @remarks
138
+ * This version of {@link SchemaStaticsAlpha.types} has fewer type constraints to work around TypeScript limitations, see {@link Unenforced}.
139
+ * See {@link ValidateRecursiveSchema} for additional information about using recursive schema.
140
+ * @privateRemarks
141
+ * If all inputs (at least recursive ones) were required to be annotated, this could be typed more strongly.
142
+ * In that case it could use `T extends readonly (AnnotatedAllowedTypeUnsafe | LazyItem<System_Unsafe.TreeNodeSchemaUnsafe>)[]`.
143
+ */
144
+ readonly typesRecursive: <
145
+ const T extends readonly Unenforced<AnnotatedAllowedType | LazyItem<TreeNodeSchema>>[],
146
+ >(
147
+ t: T,
148
+ metadata?: AllowedTypesMetadata,
149
+ ) => AllowedTypesFullFromMixedUnsafe<T>;
116
150
  }
117
151
 
152
+ const staged = <const T extends LazyItem<TreeNodeSchema>>(
153
+ t: T | AnnotatedAllowedType<T>,
154
+ ): AnnotatedAllowedType<T> => {
155
+ const annotatedType = normalizeToAnnotatedAllowedType(t);
156
+ return {
157
+ type: annotatedType.type,
158
+ metadata: {
159
+ ...annotatedType.metadata,
160
+ stagedSchemaUpgrade: createSchemaUpgrade(),
161
+ },
162
+ };
163
+ };
164
+
165
+ const types = <const T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]>(
166
+ t: T,
167
+ metadata: AllowedTypesMetadata = {},
168
+ ): AllowedTypesFullFromMixed<T> => {
169
+ return AnnotatedAllowedTypesInternal.createMixed<T>(t, metadata);
170
+ };
171
+
118
172
  const schemaStaticsAlpha: SchemaStaticsAlpha = {
119
- staged: <const T extends LazyItem<TreeNodeSchema>>(
120
- t: T | AnnotatedAllowedType<T>,
121
- ): AnnotatedAllowedType<T> => {
122
- const annotatedType = normalizeToAnnotatedAllowedType(t);
123
- return {
124
- type: annotatedType.type,
125
- metadata: {
126
- ...annotatedType.metadata,
127
- stagedSchemaUpgrade: createSchemaUpgrade(),
128
- },
129
- };
130
- },
173
+ staged,
174
+ types,
131
175
 
132
- types: <const T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]>(
133
- t: T,
134
- metadata: AllowedTypesMetadata = {},
135
- ): AllowedTypesFullFromMixed<T> => {
136
- return AnnotatedAllowedTypesInternal.createMixed<T>(t, metadata);
137
- },
176
+ stagedRecursive: staged as SchemaStaticsAlpha["stagedRecursive"],
177
+ typesRecursive: types as unknown as SchemaStaticsAlpha["typesRecursive"],
138
178
  };
139
179
 
140
180
  /**
@@ -310,6 +350,16 @@ export class SchemaFactoryAlpha<
310
350
  */
311
351
  public staged = schemaStaticsAlpha.staged;
312
352
 
353
+ /**
354
+ * {@inheritDoc SchemaStaticsAlpha.stagedRecursive}
355
+ */
356
+ public static stagedRecursive = schemaStaticsAlpha.stagedRecursive;
357
+
358
+ /**
359
+ * {@inheritDoc SchemaStaticsAlpha.stagedRecursive}
360
+ */
361
+ public stagedRecursive = schemaStaticsAlpha.stagedRecursive;
362
+
313
363
  /**
314
364
  * {@inheritDoc SchemaStaticsAlpha.types}
315
365
  */
@@ -320,6 +370,16 @@ export class SchemaFactoryAlpha<
320
370
  */
321
371
  public types = schemaStaticsAlpha.types;
322
372
 
373
+ /**
374
+ * {@inheritDoc SchemaStaticsAlpha.typesRecursive}
375
+ */
376
+ public static typesRecursive = schemaStaticsAlpha.typesRecursive;
377
+
378
+ /**
379
+ * {@inheritDoc SchemaStaticsAlpha.typesRecursive}
380
+ */
381
+ public typesRecursive = schemaStaticsAlpha.typesRecursive;
382
+
323
383
  /**
324
384
  * Define a {@link TreeNodeSchema} for a {@link TreeMapNode}.
325
385
  *
@@ -405,7 +465,7 @@ export class SchemaFactoryAlpha<
405
465
  }
406
466
 
407
467
  /**
408
- * {@inheritDoc SchemaFactory.objectRecursive}
468
+ * {@link SchemaFactory.arrayRecursive} but with support for some alpha features.
409
469
  */
410
470
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
411
471
  public override arrayRecursive<
@@ -228,6 +228,9 @@ export const schemaStatics = {
228
228
  },
229
229
  } as const;
230
230
 
231
+ /**
232
+ * {@link Unenforced} version of {@link createFieldSchema}.
233
+ */
231
234
  function createFieldSchemaUnsafe<
232
235
  Kind extends FieldKind,
233
236
  Types extends System_Unsafe.ImplicitAllowedTypesUnsafe,