fluid-framework 2.43.0-343119 → 2.50.0-345060

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,194 @@
1
1
  # fluid-framework
2
2
 
3
+ ## 2.43.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Tree's enum schema utility are now beta ([#24749](https://github.com/microsoft/FluidFramework/pull/24749)) [a23bc9e4d02](https://github.com/microsoft/FluidFramework/commit/a23bc9e4d025f0925d09daadc2952bf0bfacc06b)
8
+
9
+ The functions [singletonSchema](https://fluidframework.com/docs/api/tree/#singletonschema-function), [adaptEnum](https://fluidframework.com/docs/api/tree/#adaptenum-function) and [enumFromStrings](https://fluidframework.com/docs/api/tree/#enumfromstrings-function) are now `@beta` instead of `@alpha`.
10
+
11
+ - Add TreeAlpha.child and TreeAlpha.children APIs for generic tree traversal ([#24723](https://github.com/microsoft/FluidFramework/pull/24723)) [87941b7fa05](https://github.com/microsoft/FluidFramework/commit/87941b7fa0575e030344079a25f65d25d8457367)
12
+
13
+ #### TreeAlpha.child
14
+
15
+ Access a child node or value of a `TreeNode` by its property key.
16
+
17
+ ```typescript
18
+ class MyObject extends schemaFactory.object("MyObject", {
19
+ foo: schemaFactory.string;
20
+ bar: schemaFactory.optional(schemaFactory.string);
21
+ }) {}
22
+
23
+ const myObject = new MyObject({
24
+ foo: "Hello world!"
25
+ });
26
+
27
+ const foo = TreeAlpha.child(myObject, "foo"); // "Hello world!"
28
+ const bar = TreeAlpha.child(myObject, "bar"); // undefined
29
+ const baz = TreeAlpha.child(myObject, "baz"); // undefined
30
+ ```
31
+
32
+ ```typescript
33
+ class MyArray extends schemaFactory.array("MyArray", schemaFactory.string) {}
34
+
35
+ const myArray = new MyArray("Hello", "World");
36
+
37
+ const child0 = TreeAlpha.child(myArray, 0); // "Hello"
38
+ const child1 = TreeAlpha.child(myArray, 1); // "World
39
+ const child2 = TreeAlpha.child(myArray, 2); // undefined
40
+ ```
41
+
42
+ #### TreeAlpha.children
43
+
44
+ Get all child nodes / values of a `TreeNode`, keyed by their property keys.
45
+
46
+ ```typescript
47
+ class MyObject extends schemaFactory.object("MyObject", {
48
+ foo: schemaFactory.string;
49
+ bar: schemaFactory.optional(schemaFactory.string);
50
+ baz: schemaFactory.optional(schemaFactory.number);
51
+ }) {}
52
+
53
+ const myObject = new MyObject({
54
+ foo: "Hello world!",
55
+ baz: 42,
56
+ });
57
+
58
+ const children = TreeAlpha.children(myObject); // [["foo", "Hello world!"], ["baz", 42]]
59
+ ```
60
+
61
+ ```typescript
62
+ class MyArray extends schemaFactory.array("MyArray", schemaFactory.string) {}
63
+
64
+ const myArray = new MyArray("Hello", "World");
65
+
66
+ const children = TreeAlpha.children(myObject); // [[0, "Hello"], [1, "World"]]
67
+ ```
68
+
69
+ - Rename and change type of annotatedAllowedTypeSet on FieldSchemaAlpha to more closely align with allowedTypesSet ([#24820](https://github.com/microsoft/FluidFramework/pull/24820)) [f4e8dc8cd09](https://github.com/microsoft/FluidFramework/commit/f4e8dc8cd09f052f21e436e2c0584a1a34d2be77)
70
+
71
+ This changes the `annotatedAllowedTypeSet` property on [`FieldSchemaAlpha`](https://fluidframework.com/docs/api/fluid-framework/fieldschemaalpha-class).
72
+ It is now called `annotatedAllowedTypesNormalized` and stores evaluated schemas along with their annotations in a list of objects rather than as a mapping from the schemas to their annotations. This makes the API easier to use and better aligns with the current public APIs.
73
+
74
+ - Persisted metadata for Shared Tree schemas (Alpha) ([#24812](https://github.com/microsoft/FluidFramework/pull/24812)) [3f81ab52ff7](https://github.com/microsoft/FluidFramework/commit/3f81ab52ff7265a8533c0e192c8b77d298b70eea)
75
+
76
+ The persisted metadata feature for Shared Tree allows an application author to write document-persisted metadata along with the schema. This feature is supported for both node and field schemas.
77
+
78
+ #### Using the persisted metadata feature
79
+
80
+ As of now, persisted metadata support is available via the SchemaFactoryAlpha API:
81
+
82
+ ```ts
83
+ // Construct a schema factory with alpha APIs
84
+ const schemaFactory = new SchemaFactoryAlpha("com.example");
85
+ ```
86
+
87
+ Persisted metadata can take the shape of any JSON-serializable object, e.g.:
88
+
89
+ ```ts
90
+ const persistedMetadata = { a: 2 };
91
+ ```
92
+
93
+ #### Feature flag
94
+
95
+ To enable persisted metadata, use `configuredSharedTree` to specify the format version. The tree that is returned can be substituted in place of the default `SharedTree` object exported by the Fluid Framework. For example:
96
+
97
+ ```ts
98
+ const tree = configuredSharedTree({
99
+ formatVersion: SharedTreeFormatVersion.v5,
100
+ }).create(runtime);
101
+
102
+ export const MyContainerSchema = {
103
+ initialObjects: {
104
+ appData: tree,
105
+ },
106
+ } satisfies ContainerSchema;
107
+ ```
108
+
109
+ #### Examples
110
+
111
+ ##### Field schemas with persisted metadata
112
+
113
+ ```ts
114
+ // Construct a schema factory with alpha APIs
115
+ const schemaFactory = new SchemaFactoryAlpha("com.example");
116
+
117
+ // Define metadata. This can take the shape of any JSON-serializable object.
118
+ const persistedMetadata = { a: 2 };
119
+
120
+ // Foo is an object type with metadata
121
+ class Foo extends schemaFactory.objectAlpha(
122
+ "Foo",
123
+ {
124
+ // Metadata for a required number field
125
+ bar: schemaFactory.required(schemaFactory.number, { persistedMetadata }),
126
+
127
+ // Metadata for an optional string field
128
+ baz: schemaFactory.optional(schemaFactory.string, { persistedMetadata }),
129
+ // Metadata for the object type Foo
130
+ },
131
+ { persistedMetadata },
132
+ ) {}
133
+ ```
134
+
135
+ ##### Recursive field schemas
136
+
137
+ ```ts
138
+ // Construct a schema factory with alpha APIs
139
+ const schemaFactory = new SchemaFactoryAlpha("com.example");
140
+
141
+ // Define metadata. This can take the shape of any JSON-serializable object.
142
+ const persistedMetadata = { a: 2 };
143
+
144
+ // Recursive object schema with persisted metadata
145
+ class RecursiveObject extends schemaFactory.objectRecursive(
146
+ "RecursiveObject",
147
+ {
148
+ x: [() => RecursiveObject, schemaFactory.number],
149
+ },
150
+ { persistedMetadata },
151
+ ) {}
152
+
153
+ // Recursive field schema with metadata
154
+ const recursiveField = schemaFactory.optionalRecursive(
155
+ [() => RecursiveObject, schemaFactory.number],
156
+ { persistedMetadata },
157
+ );
158
+ ```
159
+
160
+ ##### Recursive object schemas
161
+
162
+ ```ts
163
+ // Construct a schema factory with alpha APIs
164
+ const schemaFactory = new SchemaFactoryAlpha("com.example");
165
+
166
+ // Define metadata. This can take the shape of any JSON-serializable object.
167
+ const persistedMetadata = { a: 2 };
168
+
169
+ // Recursive array schema
170
+ class Foos extends schemaFactory.arrayRecursive("FooList", [() => Foo], {
171
+ persistedMetadata,
172
+ }) {}
173
+
174
+ // Recursive object schema
175
+ class Foo extends schemaFactory.objectRecursive(
176
+ "Foo",
177
+ { fooList: Foos },
178
+ { persistedMetadata },
179
+ ) {}
180
+
181
+ // Recursive map schema
182
+ class FooMap extends schemaFactory.mapRecursive("FooMap", [() => Foo], {
183
+ persistedMetadata,
184
+ }) {}
185
+ ```
186
+
187
+ - Improved Schema Validation ([#24866](https://github.com/microsoft/FluidFramework/pull/24866)) [caae4ae15ed](https://github.com/microsoft/FluidFramework/commit/caae4ae15edeb8aeae33b0520b18dbb1993965f6)
188
+
189
+ When constructing a [`TreeViewConfiguration`](https://fluidframework.com/docs/api/fluid-framework/treeviewconfiguration-class), the same schema listed more than once in a given [`AllowedTypes`](https://fluidframework.com/docs/api/fluid-framework/allowedtypes-typealias) is now an error even when [`preventAmbiguity`](https://fluidframework.com/docs/api/fluid-framework/treeviewconfiguration-class#preventambiguity-property) is false.
190
+ Previously a bug resulted in this only being rejected when `preventAmbiguity` was true.
191
+
3
192
  ## 2.42.0
4
193
 
5
194
  ### Minor Changes
@@ -32,9 +32,9 @@ export interface AllowedTypesMetadata {
32
32
  export function allowUnused<T>(t?: T): void;
33
33
 
34
34
  // @alpha
35
- export interface AnnotatedAllowedType<T extends TreeNodeSchema = TreeNodeSchema> {
35
+ export interface AnnotatedAllowedType<T = LazyItem<TreeNodeSchema>> {
36
36
  readonly metadata: AllowedTypeMetadata;
37
- readonly type: LazyItem<T>;
37
+ readonly type: T;
38
38
  }
39
39
 
40
40
  // @alpha
@@ -258,7 +258,7 @@ export class FieldSchemaAlpha<Kind extends FieldKind = FieldKind, Types extends
258
258
  readonly allowedTypesMetadata: AllowedTypesMetadata;
259
259
  // (undocumented)
260
260
  readonly annotatedAllowedTypes: ImplicitAnnotatedAllowedTypes;
261
- get annotatedAllowedTypeSet(): ReadonlyMap<TreeNodeSchema, AllowedTypeMetadata>;
261
+ get annotatedAllowedTypesNormalized(): NormalizedAnnotatedAllowedTypes;
262
262
  get persistedMetadata(): JsonCompatibleReadOnlyObject | undefined;
263
263
  }
264
264
 
@@ -768,9 +768,7 @@ export namespace JsonAsTree {
768
768
  export class JsonObject extends _APIExtractorWorkaroundObjectBase {
769
769
  }
770
770
  const // @system
771
- _APIExtractorWorkaroundObjectBase: TreeNodeSchemaClass<"com.fluidframework.json.object", NodeKind.Map, System_Unsafe.TreeMapNodeUnsafe<readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>, () => typeof JsonObject, () => typeof Array]> & WithType<"com.fluidframework.json.object", NodeKind.Map, unknown>, {
772
- [Symbol.iterator](): Iterator<[string, string | number | JsonObject | Array | System_Unsafe.InsertableTypedNodeUnsafe<LeafSchema<"boolean", boolean>, LeafSchema<"boolean", boolean>> | null], any, undefined>;
773
- } | {
771
+ _APIExtractorWorkaroundObjectBase: TreeNodeSchemaClass<"com.fluidframework.json.object", NodeKind.Record, TreeRecordNodeUnsafe_2<readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>, () => typeof JsonObject, () => typeof Array]> & WithType<"com.fluidframework.json.object", NodeKind.Record, unknown>, {
774
772
  readonly [x: string]: string | number | JsonObject | Array | System_Unsafe.InsertableTypedNodeUnsafe<LeafSchema<"boolean", boolean>, LeafSchema<"boolean", boolean>> | null;
775
773
  }, false, readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>, () => typeof JsonObject, () => typeof Array], undefined>;
776
774
  // (undocumented)
@@ -778,9 +776,7 @@ export namespace JsonAsTree {
778
776
  // @system
779
777
  export type _RecursiveArrayWorkaroundJsonArray = FixRecursiveArraySchema<typeof Array>;
780
778
  const // @system
781
- _APIExtractorWorkaroundArrayBase: TreeNodeSchemaClass<"com.fluidframework.json.array", NodeKind.Array, System_Unsafe.TreeArrayNodeUnsafe<readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>, () => typeof JsonObject, () => typeof Array]> & WithType<"com.fluidframework.json.array", NodeKind.Array, unknown>, {
782
- [Symbol.iterator](): Iterator<string | number | JsonObject | Array | System_Unsafe.InsertableTypedNodeUnsafe<LeafSchema<"boolean", boolean>, LeafSchema<"boolean", boolean>> | null, any, undefined>;
783
- }, false, readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>, () => typeof JsonObject, () => typeof Array], undefined>;
779
+ _APIExtractorWorkaroundArrayBase: ArrayNodeCustomizableSchemaUnsafe_2<"com.fluidframework.json.array", readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>, () => typeof JsonObject, () => typeof Array], unknown>;
784
780
  // (undocumented)
785
781
  export type Tree = TreeNodeFromImplicitAllowedTypes<typeof Tree>;
786
782
  }
@@ -818,13 +814,11 @@ export type JsonLeafSchemaType = "string" | "number" | "boolean" | "null";
818
814
 
819
815
  // @alpha @sealed
820
816
  export interface JsonMapNodeSchema extends JsonNodeSchemaBase<NodeKind.Map, "object"> {
821
- readonly patternProperties: {
822
- "^.*$": JsonFieldSchema;
823
- };
817
+ readonly patternProperties: JsonStringKeyPatternProperties;
824
818
  }
825
819
 
826
820
  // @alpha
827
- export type JsonNodeSchema = JsonLeafNodeSchema | JsonMapNodeSchema | JsonArrayNodeSchema | JsonObjectNodeSchema;
821
+ export type JsonNodeSchema = JsonLeafNodeSchema | JsonMapNodeSchema | JsonArrayNodeSchema | JsonObjectNodeSchema | JsonRecordNodeSchema;
828
822
 
829
823
  // @alpha @sealed
830
824
  export interface JsonNodeSchemaBase<TNodeKind extends NodeKind, TJsonSchemaType extends JsonSchemaType> {
@@ -840,6 +834,11 @@ export interface JsonObjectNodeSchema extends JsonNodeSchemaBase<NodeKind.Object
840
834
  readonly required?: string[];
841
835
  }
842
836
 
837
+ // @alpha @sealed
838
+ export interface JsonRecordNodeSchema extends JsonNodeSchemaBase<NodeKind.Record, "object"> {
839
+ readonly patternProperties: JsonStringKeyPatternProperties;
840
+ }
841
+
843
842
  // @alpha
844
843
  export type JsonRefPath = `#/$defs/${JsonSchemaId}`;
845
844
 
@@ -854,6 +853,11 @@ export interface JsonSchemaRef {
854
853
  // @alpha
855
854
  export type JsonSchemaType = "object" | "array" | JsonLeafSchemaType;
856
855
 
856
+ // @alpha @sealed
857
+ export interface JsonStringKeyPatternProperties {
858
+ "^.*$": JsonFieldSchema;
859
+ }
860
+
857
861
  // @alpha @sealed
858
862
  export type JsonTreeSchema = JsonFieldSchema & {
859
863
  readonly $defs: Record<JsonSchemaId, JsonNodeSchema>;
@@ -948,7 +952,8 @@ export enum NodeKind {
948
952
  Array = 1,
949
953
  Leaf = 3,
950
954
  Map = 0,
951
- Object = 2
955
+ Object = 2,
956
+ Record = 4
952
957
  }
953
958
 
954
959
  // @public @sealed
@@ -970,6 +975,12 @@ export interface NodeSchemaOptionsAlpha<out TCustomMetadata = unknown> extends N
970
975
  // @alpha
971
976
  export const noopValidator: JsonValidator;
972
977
 
978
+ // @alpha
979
+ export interface NormalizedAnnotatedAllowedTypes {
980
+ readonly metadata: AllowedTypesMetadata;
981
+ readonly types: readonly AnnotatedAllowedType<TreeNodeSchema>[];
982
+ }
983
+
973
984
  // @public @system
974
985
  export type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = RestrictiveStringRecord<ImplicitFieldSchema> extends T ? {} : {
975
986
  -readonly [Property in keyof T]: Property extends string ? TreeFieldFromImplicitField<T[Property]> : unknown;
@@ -1009,6 +1020,25 @@ export type ReadSchema<TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema
1009
1020
  TSchema
1010
1021
  ] extends [ImplicitFieldSchema] ? TSchema : ImplicitFieldSchema;
1011
1022
 
1023
+ // @alpha @sealed @system
1024
+ export interface RecordNodeCustomizableSchema<out TName extends string = string, in out T extends ImplicitAnnotatedAllowedTypes = ImplicitAnnotatedAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Record, TreeRecordNode<UnannotateImplicitAllowedTypes<T>> & WithType<TName, NodeKind.Record, T>, RecordNodeInsertableData<UnannotateImplicitAllowedTypes<T>>, ImplicitlyConstructable, T, never, TCustomMetadata>, SimpleRecordNodeSchema<TCustomMetadata> {
1025
+ }
1026
+
1027
+ // @alpha @system
1028
+ export type RecordNodeInsertableData<T extends ImplicitAllowedTypes> = RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;
1029
+
1030
+ // @alpha @sealed @system
1031
+ export interface RecordNodePojoEmulationSchema<out TName extends string = string, in out T extends ImplicitAnnotatedAllowedTypes = ImplicitAnnotatedAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaNonClass<TName, NodeKind.Record, TreeRecordNode<UnannotateImplicitAllowedTypes<T>> & WithType<TName, NodeKind.Record, T>, RecordNodeInsertableData<UnannotateImplicitAllowedTypes<T>>, ImplicitlyConstructable, T, never, TCustomMetadata>, SimpleRecordNodeSchema<TCustomMetadata> {
1032
+ }
1033
+
1034
+ // @alpha
1035
+ export type RecordNodeSchema<TName extends string = string, T extends ImplicitAnnotatedAllowedTypes = ImplicitAnnotatedAllowedTypes, ImplicitlyConstructable extends boolean = true, TCustomMetadata = unknown> = RecordNodeCustomizableSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> | RecordNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata>;
1036
+
1037
+ // @alpha (undocumented)
1038
+ export const RecordNodeSchema: {
1039
+ readonly [Symbol.hasInstance]: (value: TreeNodeSchema) => value is RecordNodeSchema<string, ImplicitAnnotatedAllowedTypes, true, unknown>;
1040
+ };
1041
+
1012
1042
  // @alpha
1013
1043
  export function replaceConciseTreeHandles<T>(tree: ConciseTree, replacer: HandleConverter<T>): ConciseTree<T>;
1014
1044
 
@@ -1104,6 +1134,7 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
1104
1134
  }, false, T, undefined>;
1105
1135
  readonly boolean: LeafSchema<"boolean", boolean>;
1106
1136
  static readonly boolean: LeafSchema<"boolean", boolean>;
1137
+ protected getStructuralType(fullName: string, types: TreeNodeSchema | readonly TreeNodeSchema[], builder: () => TreeNodeSchema): TreeNodeSchema;
1107
1138
  readonly handle: LeafSchema<"handle", IFluidHandle<unknown>>;
1108
1139
  static readonly handle: LeafSchema<"handle", IFluidHandle<unknown>>;
1109
1140
  get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
@@ -1161,6 +1192,12 @@ export class SchemaFactoryAlpha<out TScope extends string | undefined = string |
1161
1192
  };
1162
1193
  static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2<FieldKind_2.Optional, T, TCustomMetadata>;
1163
1194
  readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2<FieldKind_2.Optional, T, TCustomMetadata>;
1195
+ record<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, `Record<${string}>`>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>;
1196
+ record<const Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record>, RecordNodeInsertableData<T>, true, T, undefined>;
1197
+ recordAlpha<const Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): RecordNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
1198
+ recordRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Record, TreeRecordNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Record, unknown>, {
1199
+ readonly [x: string]: System_Unsafe.InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
1200
+ }, false, T, undefined>;
1164
1201
  static readonly required: {
1165
1202
  <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha_2<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Required, T, TCustomMetadata>;
1166
1203
  <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldPropsAlpha_2<TCustomMetadata_1>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Required, UnannotateImplicitAllowedTypes_2<T_1>, TCustomMetadata_1>;
@@ -1259,7 +1296,7 @@ export interface SimpleMapNodeSchema<out TCustomMetadata = unknown> extends Simp
1259
1296
  }
1260
1297
 
1261
1298
  // @alpha
1262
- export type SimpleNodeSchema = SimpleLeafNodeSchema | SimpleMapNodeSchema | SimpleArrayNodeSchema | SimpleObjectNodeSchema;
1299
+ export type SimpleNodeSchema = SimpleLeafNodeSchema | SimpleMapNodeSchema | SimpleArrayNodeSchema | SimpleObjectNodeSchema | SimpleRecordNodeSchema;
1263
1300
 
1264
1301
  // @public @sealed @system
1265
1302
  export interface SimpleNodeSchemaBase<out TNodeKind extends NodeKind, out TCustomMetadata = unknown> {
@@ -1282,6 +1319,11 @@ export interface SimpleObjectNodeSchema<out TCustomMetadata = unknown> extends S
1282
1319
  readonly fields: ReadonlyMap<string, SimpleObjectFieldSchema>;
1283
1320
  }
1284
1321
 
1322
+ // @alpha @sealed
1323
+ export interface SimpleRecordNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBaseAlpha<NodeKind.Record, TCustomMetadata> {
1324
+ readonly allowedTypesIdentifiers: ReadonlySet<string>;
1325
+ }
1326
+
1285
1327
  // @alpha
1286
1328
  export type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey, TValue>;
1287
1329
 
@@ -1318,7 +1360,7 @@ export namespace System_TableSchema {
1318
1360
  // @sealed
1319
1361
  export function createRowSchema<const TInputScope extends string | undefined, const TCellSchema extends ImplicitAllowedTypes, const TPropsSchema extends ImplicitAnnotatedFieldSchema>(inputSchemaFactory: SchemaFactoryAlpha<TInputScope>, cellSchema: TCellSchema, propsSchema: TPropsSchema): TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row">, NodeKind.Object, TreeNode & TableSchema.Row<TCellSchema, TPropsSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row">, NodeKind, unknown>, object & {
1320
1362
  readonly id?: string | undefined;
1321
- readonly cells: (InsertableTypedNode_2<TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, TreeMapNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>, TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, true, TCellSchema, MapNodeInsertableData_2<TCellSchema>, unknown> & (new (data?: InternalTreeNode | MapNodeInsertableData_2<TCellSchema> | undefined) => TreeMapNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, TreeMapNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>, TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, true, TCellSchema, MapNodeInsertableData_2<TCellSchema>, unknown> & (new (data?: InternalTreeNode | MapNodeInsertableData_2<TCellSchema> | undefined) => TreeMapNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>)>;
1363
+ readonly cells: (InsertableTypedNode_2<TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, TreeRecordNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, unknown>, RecordNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>, TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, true, TCellSchema, RecordNodeInsertableData_2<TCellSchema>, unknown> & (new (data?: InternalTreeNode | RecordNodeInsertableData_2<TCellSchema> | undefined) => TreeRecordNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, unknown>)> | undefined) & InsertableTypedNode_2<TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, TreeRecordNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, unknown>, RecordNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>, TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, true, TCellSchema, RecordNodeInsertableData_2<TCellSchema>, unknown> & (new (data?: InternalTreeNode | RecordNodeInsertableData_2<TCellSchema> | undefined) => TreeRecordNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, unknown>)>;
1322
1364
  } & (FieldHasDefault<UnannotateImplicitFieldSchema<TPropsSchema>> extends true ? {
1323
1365
  props?: InsertableTreeFieldFromImplicitField<UnannotateImplicitFieldSchema<TPropsSchema>> | undefined;
1324
1366
  } : {
@@ -1326,7 +1368,7 @@ export namespace System_TableSchema {
1326
1368
  }), true, {
1327
1369
  readonly props: TPropsSchema;
1328
1370
  readonly id: FieldSchema_2<FieldKind_3.Identifier, LeafSchema_3<"string", string>, unknown>;
1329
- readonly cells: FieldSchemaAlpha_3<FieldKind_3.Required, TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, TreeMapNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>, unknown>;
1371
+ readonly cells: FieldSchemaAlpha_3<FieldKind_3.Required, TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, TreeRecordNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Record, unknown>, RecordNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>, unknown>;
1330
1372
  }>;
1331
1373
  // @system
1332
1374
  export function createTableSchema<const TInputScope extends string | undefined, const TCellSchema extends ImplicitAllowedTypes, const TColumnSchema extends ColumnSchemaBase<TInputScope, TCellSchema>, const TRowSchema extends RowSchemaBase<TInputScope, TCellSchema>>(inputSchemaFactory: SchemaFactoryAlpha<TInputScope>, _cellSchema: TCellSchema, columnSchema: TColumnSchema, rowSchema: TRowSchema): TreeNodeSchemaCore_2<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Table">, NodeKind.Object, true, {
@@ -1598,6 +1640,8 @@ export const Tree: Tree;
1598
1640
  // @alpha @sealed @system
1599
1641
  export interface TreeAlpha {
1600
1642
  branch(node: TreeNode): TreeBranch | undefined;
1643
+ child(node: TreeNode, key: string | number): TreeNode | TreeLeafValue | undefined;
1644
+ children(node: TreeNode): Iterable<[propertyKey: string | number, child: TreeNode | TreeLeafValue]>;
1601
1645
  create<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(schema: UnsafeUnknownSchema extends TSchema ? ImplicitFieldSchema : TSchema & ImplicitFieldSchema, data: InsertableField<TSchema>): Unhydrated<TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeNode | TreeLeafValue | undefined>;
1602
1646
  exportCompressed(tree: TreeNode | TreeLeafValue, options: {
1603
1647
  idCompressor?: IIdCompressor;
@@ -1682,7 +1726,7 @@ export interface TreeChangeEvents {
1682
1726
 
1683
1727
  // @beta @sealed
1684
1728
  export interface TreeChangeEventsBeta<TNode extends TreeNode = TreeNode> extends TreeChangeEvents {
1685
- nodeChanged: (data: NodeChangedData<TNode> & (TNode extends WithType<string, NodeKind.Map | NodeKind.Object> ? Required<Pick<NodeChangedData<TNode>, "changedProperties">> : unknown)) => void;
1729
+ nodeChanged: (data: NodeChangedData<TNode> & (TNode extends WithType<string, NodeKind.Map | NodeKind.Object | NodeKind.Record> ? Required<Pick<NodeChangedData<TNode>, "changedProperties">> : unknown)) => void;
1686
1730
  }
1687
1731
 
1688
1732
  // @alpha
@@ -1787,6 +1831,23 @@ export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends No
1787
1831
  // @public
1788
1832
  export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
1789
1833
 
1834
+ // @alpha
1835
+ export interface TreeRecordNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeNode, Record<string, TreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {
1836
+ [Symbol.iterator](): IterableIterator<[
1837
+ string,
1838
+ TreeNodeFromImplicitAllowedTypes<TAllowedTypes>
1839
+ ]>;
1840
+ }
1841
+
1842
+ // @alpha @sealed @system
1843
+ export interface TreeRecordNodeUnsafe<TAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe> extends Record<string, System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>>, TreeNode {
1844
+ // (undocumented)
1845
+ [Symbol.iterator](): IterableIterator<[
1846
+ string,
1847
+ System_Unsafe.TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>
1848
+ ]>;
1849
+ }
1850
+
1790
1851
  // @alpha @sealed (undocumented)
1791
1852
  export interface TreeSchema extends SimpleTreeSchema {
1792
1853
  readonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;
@@ -1835,6 +1896,7 @@ export interface TreeViewAlpha<in out TSchema extends ImplicitFieldSchema | Unsa
1835
1896
  // @public @sealed
1836
1897
  export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
1837
1898
  constructor(props: ITreeViewConfiguration<TSchema>);
1899
+ protected readonly definitionsInternal: ReadonlyMap<string, TreeNodeSchema>;
1838
1900
  readonly enableSchemaValidation: boolean;
1839
1901
  readonly preventAmbiguity: boolean;
1840
1902
  readonly schema: TSchema;
@@ -1845,7 +1907,7 @@ export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = I
1845
1907
  // @alpha @sealed
1846
1908
  export class TreeViewConfigurationAlpha<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> extends TreeViewConfiguration<TSchema> implements TreeSchema {
1847
1909
  constructor(props: ITreeViewConfiguration<TSchema>);
1848
- readonly definitions: ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;
1910
+ get definitions(): ReadonlyMap<string, SimpleNodeSchema & TreeNodeSchema>;
1849
1911
  readonly root: FieldSchemaAlpha;
1850
1912
  }
1851
1913
 
@@ -1912,15 +1974,19 @@ export type UnsafeUnknownSchema = typeof UnsafeUnknownSchema;
1912
1974
  export type ValidateRecursiveSchema<T extends ValidateRecursiveSchemaTemplate<T>> = true;
1913
1975
 
1914
1976
  // @public @system
1915
- export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
1977
+ export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<string, NodeKind.Array | NodeKind.Map | NodeKind.Object | NodeKind.Record, TreeNode & WithType<T["identifier"], T["kind"]>, {
1916
1978
  [NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
1917
1979
  [NodeKind.Array]: T["info"] extends ImplicitAllowedTypes ? Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>> : unknown;
1918
1980
  [NodeKind.Map]: T["info"] extends ImplicitAllowedTypes ? Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>]> : unknown;
1981
+ [NodeKind.Record]: {
1982
+ readonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypes<T>;
1983
+ };
1919
1984
  [NodeKind.Leaf]: unknown;
1920
1985
  }[T["kind"]], false, {
1921
1986
  [NodeKind.Object]: RestrictiveStringRecord<ImplicitFieldSchema>;
1922
1987
  [NodeKind.Array]: ImplicitAllowedTypes;
1923
1988
  [NodeKind.Map]: ImplicitAllowedTypes;
1989
+ [NodeKind.Record]: ImplicitAllowedTypes;
1924
1990
  [NodeKind.Leaf]: unknown;
1925
1991
  }[T["kind"]]>;
1926
1992
 
@@ -591,7 +591,8 @@ export enum NodeKind {
591
591
  Array = 1,
592
592
  Leaf = 3,
593
593
  Map = 0,
594
- Object = 2
594
+ Object = 2,
595
+ Record = 4
595
596
  }
596
597
 
597
598
  // @public @sealed
@@ -693,6 +694,7 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
693
694
  }, false, T, undefined>;
694
695
  readonly boolean: LeafSchema<"boolean", boolean>;
695
696
  static readonly boolean: LeafSchema<"boolean", boolean>;
697
+ protected getStructuralType(fullName: string, types: TreeNodeSchema | readonly TreeNodeSchema[], builder: () => TreeNodeSchema): TreeNodeSchema;
696
698
  readonly handle: LeafSchema<"handle", IFluidHandle<unknown>>;
697
699
  static readonly handle: LeafSchema<"handle", IFluidHandle<unknown>>;
698
700
  get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
@@ -922,7 +924,7 @@ export interface TreeChangeEvents {
922
924
 
923
925
  // @beta @sealed
924
926
  export interface TreeChangeEventsBeta<TNode extends TreeNode = TreeNode> extends TreeChangeEvents {
925
- nodeChanged: (data: NodeChangedData<TNode> & (TNode extends WithType<string, NodeKind.Map | NodeKind.Object> ? Required<Pick<NodeChangedData<TNode>, "changedProperties">> : unknown)) => void;
927
+ nodeChanged: (data: NodeChangedData<TNode> & (TNode extends WithType<string, NodeKind.Map | NodeKind.Object | NodeKind.Record> ? Required<Pick<NodeChangedData<TNode>, "changedProperties">> : unknown)) => void;
926
928
  }
927
929
 
928
930
  // @public
@@ -1018,6 +1020,7 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
1018
1020
  // @public @sealed
1019
1021
  export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
1020
1022
  constructor(props: ITreeViewConfiguration<TSchema>);
1023
+ protected readonly definitionsInternal: ReadonlyMap<string, TreeNodeSchema>;
1021
1024
  readonly enableSchemaValidation: boolean;
1022
1025
  readonly preventAmbiguity: boolean;
1023
1026
  readonly schema: TSchema;
@@ -1054,15 +1057,19 @@ export type UnionToTuple<Union, A extends unknown[] = [], First = PopUnion<Union
1054
1057
  export type ValidateRecursiveSchema<T extends ValidateRecursiveSchemaTemplate<T>> = true;
1055
1058
 
1056
1059
  // @public @system
1057
- export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
1060
+ export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<string, NodeKind.Array | NodeKind.Map | NodeKind.Object | NodeKind.Record, TreeNode & WithType<T["identifier"], T["kind"]>, {
1058
1061
  [NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
1059
1062
  [NodeKind.Array]: T["info"] extends ImplicitAllowedTypes ? Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>> : unknown;
1060
1063
  [NodeKind.Map]: T["info"] extends ImplicitAllowedTypes ? Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>]> : unknown;
1064
+ [NodeKind.Record]: {
1065
+ readonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypes<T>;
1066
+ };
1061
1067
  [NodeKind.Leaf]: unknown;
1062
1068
  }[T["kind"]], false, {
1063
1069
  [NodeKind.Object]: RestrictiveStringRecord<ImplicitFieldSchema>;
1064
1070
  [NodeKind.Array]: ImplicitAllowedTypes;
1065
1071
  [NodeKind.Map]: ImplicitAllowedTypes;
1072
+ [NodeKind.Record]: ImplicitAllowedTypes;
1066
1073
  [NodeKind.Leaf]: unknown;
1067
1074
  }[T["kind"]]>;
1068
1075
 
@@ -431,7 +431,7 @@ export interface IInterval {
431
431
  compareEnd(b: IInterval): number;
432
432
  compareStart(b: IInterval): number;
433
433
  // @deprecated
434
- modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): IInterval | undefined;
434
+ modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, canSlideToEndpoint?: boolean): IInterval | undefined;
435
435
  // (undocumented)
436
436
  overlaps(b: IInterval): boolean;
437
437
  // @deprecated
@@ -856,7 +856,8 @@ export enum NodeKind {
856
856
  Array = 1,
857
857
  Leaf = 3,
858
858
  Map = 0,
859
- Object = 2
859
+ Object = 2,
860
+ Record = 4
860
861
  }
861
862
 
862
863
  // @public @sealed
@@ -955,6 +956,7 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
955
956
  }, false, T, undefined>;
956
957
  readonly boolean: LeafSchema<"boolean", boolean>;
957
958
  static readonly boolean: LeafSchema<"boolean", boolean>;
959
+ protected getStructuralType(fullName: string, types: TreeNodeSchema | readonly TreeNodeSchema[], builder: () => TreeNodeSchema): TreeNodeSchema;
958
960
  readonly handle: LeafSchema<"handle", IFluidHandle<unknown>>;
959
961
  static readonly handle: LeafSchema<"handle", IFluidHandle<unknown>>;
960
962
  get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
@@ -1047,7 +1049,7 @@ export interface SequenceInterval extends ISerializableInterval {
1047
1049
  // (undocumented)
1048
1050
  readonly intervalType: IntervalType;
1049
1051
  // @deprecated
1050
- modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): SequenceInterval | undefined;
1052
+ modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, canSlideToEndpoint?: boolean): SequenceInterval | undefined;
1051
1053
  // (undocumented)
1052
1054
  overlaps(b: SequenceInterval): boolean;
1053
1055
  // (undocumented)
@@ -1351,6 +1353,7 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
1351
1353
  // @public @sealed
1352
1354
  export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
1353
1355
  constructor(props: ITreeViewConfiguration<TSchema>);
1356
+ protected readonly definitionsInternal: ReadonlyMap<string, TreeNodeSchema>;
1354
1357
  readonly enableSchemaValidation: boolean;
1355
1358
  readonly preventAmbiguity: boolean;
1356
1359
  readonly schema: TSchema;
@@ -1384,15 +1387,19 @@ export type UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) e
1384
1387
  export type ValidateRecursiveSchema<T extends ValidateRecursiveSchemaTemplate<T>> = true;
1385
1388
 
1386
1389
  // @public @system
1387
- export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
1390
+ export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<string, NodeKind.Array | NodeKind.Map | NodeKind.Object | NodeKind.Record, TreeNode & WithType<T["identifier"], T["kind"]>, {
1388
1391
  [NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
1389
1392
  [NodeKind.Array]: T["info"] extends ImplicitAllowedTypes ? Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>> : unknown;
1390
1393
  [NodeKind.Map]: T["info"] extends ImplicitAllowedTypes ? Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>]> : unknown;
1394
+ [NodeKind.Record]: {
1395
+ readonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypes<T>;
1396
+ };
1391
1397
  [NodeKind.Leaf]: unknown;
1392
1398
  }[T["kind"]], false, {
1393
1399
  [NodeKind.Object]: RestrictiveStringRecord<ImplicitFieldSchema>;
1394
1400
  [NodeKind.Array]: ImplicitAllowedTypes;
1395
1401
  [NodeKind.Map]: ImplicitAllowedTypes;
1402
+ [NodeKind.Record]: ImplicitAllowedTypes;
1396
1403
  [NodeKind.Leaf]: unknown;
1397
1404
  }[T["kind"]]>;
1398
1405
 
@@ -598,7 +598,8 @@ export enum NodeKind {
598
598
  Array = 1,
599
599
  Leaf = 3,
600
600
  Map = 0,
601
- Object = 2
601
+ Object = 2,
602
+ Record = 4
602
603
  }
603
604
 
604
605
  // @public @sealed
@@ -697,6 +698,7 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
697
698
  }, false, T, undefined>;
698
699
  readonly boolean: LeafSchema<"boolean", boolean>;
699
700
  static readonly boolean: LeafSchema<"boolean", boolean>;
701
+ protected getStructuralType(fullName: string, types: TreeNodeSchema | readonly TreeNodeSchema[], builder: () => TreeNodeSchema): TreeNodeSchema;
700
702
  readonly handle: LeafSchema<"handle", IFluidHandle<unknown>>;
701
703
  static readonly handle: LeafSchema<"handle", IFluidHandle<unknown>>;
702
704
  get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
@@ -1003,6 +1005,7 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
1003
1005
  // @public @sealed
1004
1006
  export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
1005
1007
  constructor(props: ITreeViewConfiguration<TSchema>);
1008
+ protected readonly definitionsInternal: ReadonlyMap<string, TreeNodeSchema>;
1006
1009
  readonly enableSchemaValidation: boolean;
1007
1010
  readonly preventAmbiguity: boolean;
1008
1011
  readonly schema: TSchema;
@@ -1036,15 +1039,19 @@ export type UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) e
1036
1039
  export type ValidateRecursiveSchema<T extends ValidateRecursiveSchemaTemplate<T>> = true;
1037
1040
 
1038
1041
  // @public @system
1039
- export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
1042
+ export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<string, NodeKind.Array | NodeKind.Map | NodeKind.Object | NodeKind.Record, TreeNode & WithType<T["identifier"], T["kind"]>, {
1040
1043
  [NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
1041
1044
  [NodeKind.Array]: T["info"] extends ImplicitAllowedTypes ? Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>> : unknown;
1042
1045
  [NodeKind.Map]: T["info"] extends ImplicitAllowedTypes ? Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>]> : unknown;
1046
+ [NodeKind.Record]: {
1047
+ readonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypes<T>;
1048
+ };
1043
1049
  [NodeKind.Leaf]: unknown;
1044
1050
  }[T["kind"]], false, {
1045
1051
  [NodeKind.Object]: RestrictiveStringRecord<ImplicitFieldSchema>;
1046
1052
  [NodeKind.Array]: ImplicitAllowedTypes;
1047
1053
  [NodeKind.Map]: ImplicitAllowedTypes;
1054
+ [NodeKind.Record]: ImplicitAllowedTypes;
1048
1055
  [NodeKind.Leaf]: unknown;
1049
1056
  }[T["kind"]]>;
1050
1057
 
@@ -564,7 +564,8 @@ export enum NodeKind {
564
564
  Array = 1,
565
565
  Leaf = 3,
566
566
  Map = 0,
567
- Object = 2
567
+ Object = 2,
568
+ Record = 4
568
569
  }
569
570
 
570
571
  // @public @sealed
@@ -663,6 +664,7 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
663
664
  }, false, T, undefined>;
664
665
  readonly boolean: LeafSchema<"boolean", boolean>;
665
666
  static readonly boolean: LeafSchema<"boolean", boolean>;
667
+ protected getStructuralType(fullName: string, types: TreeNodeSchema | readonly TreeNodeSchema[], builder: () => TreeNodeSchema): TreeNodeSchema;
666
668
  readonly handle: LeafSchema<"handle", IFluidHandle<unknown>>;
667
669
  static readonly handle: LeafSchema<"handle", IFluidHandle<unknown>>;
668
670
  get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
@@ -969,6 +971,7 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
969
971
  // @public @sealed
970
972
  export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
971
973
  constructor(props: ITreeViewConfiguration<TSchema>);
974
+ protected readonly definitionsInternal: ReadonlyMap<string, TreeNodeSchema>;
972
975
  readonly enableSchemaValidation: boolean;
973
976
  readonly preventAmbiguity: boolean;
974
977
  readonly schema: TSchema;
@@ -1002,15 +1005,19 @@ export type UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) e
1002
1005
  export type ValidateRecursiveSchema<T extends ValidateRecursiveSchemaTemplate<T>> = true;
1003
1006
 
1004
1007
  // @public @system
1005
- export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
1008
+ export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<string, NodeKind.Array | NodeKind.Map | NodeKind.Object | NodeKind.Record, TreeNode & WithType<T["identifier"], T["kind"]>, {
1006
1009
  [NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
1007
1010
  [NodeKind.Array]: T["info"] extends ImplicitAllowedTypes ? Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>> : unknown;
1008
1011
  [NodeKind.Map]: T["info"] extends ImplicitAllowedTypes ? Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>]> : unknown;
1012
+ [NodeKind.Record]: {
1013
+ readonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypes<T>;
1014
+ };
1009
1015
  [NodeKind.Leaf]: unknown;
1010
1016
  }[T["kind"]], false, {
1011
1017
  [NodeKind.Object]: RestrictiveStringRecord<ImplicitFieldSchema>;
1012
1018
  [NodeKind.Array]: ImplicitAllowedTypes;
1013
1019
  [NodeKind.Map]: ImplicitAllowedTypes;
1020
+ [NodeKind.Record]: ImplicitAllowedTypes;
1014
1021
  [NodeKind.Leaf]: unknown;
1015
1022
  }[T["kind"]]>;
1016
1023
 
package/dist/alpha.d.ts CHANGED
@@ -189,10 +189,12 @@ export {
189
189
  JsonNodeSchema,
190
190
  JsonNodeSchemaBase,
191
191
  JsonObjectNodeSchema,
192
+ JsonRecordNodeSchema,
192
193
  JsonRefPath,
193
194
  JsonSchemaId,
194
195
  JsonSchemaRef,
195
196
  JsonSchemaType,
197
+ JsonStringKeyPatternProperties,
196
198
  JsonTreeSchema,
197
199
  JsonValidator,
198
200
  MapNodeCustomizableSchema,
@@ -200,9 +202,14 @@ export {
200
202
  MapNodePojoEmulationSchema,
201
203
  MapNodeSchema,
202
204
  NodeSchemaOptionsAlpha,
205
+ NormalizedAnnotatedAllowedTypes,
203
206
  ObjectNodeSchema,
204
207
  ReadSchema,
205
208
  ReadableField,
209
+ RecordNodeCustomizableSchema,
210
+ RecordNodeInsertableData,
211
+ RecordNodePojoEmulationSchema,
212
+ RecordNodeSchema,
206
213
  RevertibleAlpha,
207
214
  RevertibleAlphaFactory,
208
215
  RunTransactionParams,
@@ -220,6 +227,7 @@ export {
220
227
  SimpleNodeSchemaBaseAlpha,
221
228
  SimpleObjectFieldSchema,
222
229
  SimpleObjectNodeSchema,
230
+ SimpleRecordNodeSchema,
223
231
  SimpleTreeIndex,
224
232
  SimpleTreeSchema,
225
233
  System_TableSchema,
@@ -239,6 +247,8 @@ export {
239
247
  TreeIndex,
240
248
  TreeIndexKey,
241
249
  TreeIndexNodes,
250
+ TreeRecordNode,
251
+ TreeRecordNodeUnsafe,
242
252
  TreeSchema,
243
253
  TreeSchemaEncodingOptions,
244
254
  TreeViewAlpha,
package/lib/alpha.d.ts CHANGED
@@ -189,10 +189,12 @@ export {
189
189
  JsonNodeSchema,
190
190
  JsonNodeSchemaBase,
191
191
  JsonObjectNodeSchema,
192
+ JsonRecordNodeSchema,
192
193
  JsonRefPath,
193
194
  JsonSchemaId,
194
195
  JsonSchemaRef,
195
196
  JsonSchemaType,
197
+ JsonStringKeyPatternProperties,
196
198
  JsonTreeSchema,
197
199
  JsonValidator,
198
200
  MapNodeCustomizableSchema,
@@ -200,9 +202,14 @@ export {
200
202
  MapNodePojoEmulationSchema,
201
203
  MapNodeSchema,
202
204
  NodeSchemaOptionsAlpha,
205
+ NormalizedAnnotatedAllowedTypes,
203
206
  ObjectNodeSchema,
204
207
  ReadSchema,
205
208
  ReadableField,
209
+ RecordNodeCustomizableSchema,
210
+ RecordNodeInsertableData,
211
+ RecordNodePojoEmulationSchema,
212
+ RecordNodeSchema,
206
213
  RevertibleAlpha,
207
214
  RevertibleAlphaFactory,
208
215
  RunTransactionParams,
@@ -220,6 +227,7 @@ export {
220
227
  SimpleNodeSchemaBaseAlpha,
221
228
  SimpleObjectFieldSchema,
222
229
  SimpleObjectNodeSchema,
230
+ SimpleRecordNodeSchema,
223
231
  SimpleTreeIndex,
224
232
  SimpleTreeSchema,
225
233
  System_TableSchema,
@@ -239,6 +247,8 @@ export {
239
247
  TreeIndex,
240
248
  TreeIndexKey,
241
249
  TreeIndexNodes,
250
+ TreeRecordNode,
251
+ TreeRecordNodeUnsafe,
242
252
  TreeSchema,
243
253
  TreeSchemaEncodingOptions,
244
254
  TreeViewAlpha,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluid-framework",
3
- "version": "2.43.0-343119",
3
+ "version": "2.50.0-345060",
4
4
  "description": "The main entry point into Fluid Framework public packages",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -57,24 +57,24 @@
57
57
  "main": "lib/index.js",
58
58
  "types": "lib/public.d.ts",
59
59
  "dependencies": {
60
- "@fluidframework/container-definitions": "2.43.0-343119",
61
- "@fluidframework/container-loader": "2.43.0-343119",
62
- "@fluidframework/core-interfaces": "2.43.0-343119",
63
- "@fluidframework/core-utils": "2.43.0-343119",
64
- "@fluidframework/driver-definitions": "2.43.0-343119",
65
- "@fluidframework/fluid-static": "2.43.0-343119",
66
- "@fluidframework/map": "2.43.0-343119",
67
- "@fluidframework/runtime-utils": "2.43.0-343119",
68
- "@fluidframework/sequence": "2.43.0-343119",
69
- "@fluidframework/shared-object-base": "2.43.0-343119",
70
- "@fluidframework/tree": "2.43.0-343119"
60
+ "@fluidframework/container-definitions": "2.50.0-345060",
61
+ "@fluidframework/container-loader": "2.50.0-345060",
62
+ "@fluidframework/core-interfaces": "2.50.0-345060",
63
+ "@fluidframework/core-utils": "2.50.0-345060",
64
+ "@fluidframework/driver-definitions": "2.50.0-345060",
65
+ "@fluidframework/fluid-static": "2.50.0-345060",
66
+ "@fluidframework/map": "2.50.0-345060",
67
+ "@fluidframework/runtime-utils": "2.50.0-345060",
68
+ "@fluidframework/sequence": "2.50.0-345060",
69
+ "@fluidframework/shared-object-base": "2.50.0-345060",
70
+ "@fluidframework/tree": "2.50.0-345060"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@arethetypeswrong/cli": "^0.17.1",
74
74
  "@biomejs/biome": "~1.9.3",
75
- "@fluid-tools/build-cli": "^0.55.0",
75
+ "@fluid-tools/build-cli": "^0.56.0",
76
76
  "@fluidframework/build-common": "^2.0.3",
77
- "@fluidframework/build-tools": "^0.55.0",
77
+ "@fluidframework/build-tools": "^0.56.0",
78
78
  "@fluidframework/eslint-config-fluid": "^5.7.4",
79
79
  "@microsoft/api-extractor": "7.52.8",
80
80
  "@types/node": "^18.19.0",