fluid-framework 2.42.0 → 2.43.0-343119

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.
@@ -4,7 +4,7 @@
4
4
 
5
5
  ```ts
6
6
 
7
- // @alpha
7
+ // @beta
8
8
  export function adaptEnum<TScope extends string, const TEnum extends Record<string, string | number>>(factory: SchemaFactory<TScope>, members: TEnum): (<TValue extends TEnum[keyof TEnum]>(value: TValue) => TValue extends unknown ? TreeNode & {
9
9
  readonly value: TValue;
10
10
  } : never) & { readonly [Property in keyof TEnum]: TreeNodeSchemaClass<ScopedSchemaName<TScope, TEnum[Property]>, NodeKind.Object, TreeNode & {
@@ -177,7 +177,7 @@ export function createSimpleTreeIndex<TFieldSchema extends ImplicitFieldSchema,
177
177
  interface DefaultProvider extends ErasedType<"@fluidframework/tree.FieldProvider"> {
178
178
  }
179
179
 
180
- // @alpha
180
+ // @beta
181
181
  export function enumFromStrings<TScope extends string, const Members extends readonly string[]>(factory: SchemaFactory<TScope>, members: Members): (<TValue extends Members[number]>(value: TValue) => TValue extends unknown ? TreeNode & {
182
182
  readonly value: TValue;
183
183
  } : never) & { [Index in Extract<keyof Members, `${number}`> extends `${infer N extends number}` ? N : never as Members[Index]]: TreeNodeSchemaClass<ScopedSchemaName<TScope, Members[Index]>, NodeKind.Object, TreeNode & {
@@ -230,6 +230,11 @@ export interface FieldProps<TCustomMetadata = unknown> {
230
230
  readonly metadata?: FieldSchemaMetadata<TCustomMetadata>;
231
231
  }
232
232
 
233
+ // @alpha @input
234
+ export interface FieldPropsAlpha<TCustomMetadata = unknown> extends FieldProps<TCustomMetadata> {
235
+ readonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;
236
+ }
237
+
233
238
  // @public @sealed
234
239
  export class FieldSchema<out Kind extends FieldKind = FieldKind, out Types extends ImplicitAllowedTypes = ImplicitAllowedTypes, out TCustomMetadata = unknown> {
235
240
  protected constructor(
@@ -247,13 +252,14 @@ export class FieldSchema<out Kind extends FieldKind = FieldKind, out Types exten
247
252
 
248
253
  // @alpha @sealed
249
254
  export class FieldSchemaAlpha<Kind extends FieldKind = FieldKind, Types extends ImplicitAllowedTypes = ImplicitAllowedTypes, TCustomMetadata = unknown> extends FieldSchema<Kind, Types, TCustomMetadata> implements SimpleFieldSchema {
250
- protected constructor(kind: Kind, types: Types, annotatedAllowedTypes: ImplicitAnnotatedAllowedTypes, props?: FieldProps<TCustomMetadata>);
255
+ protected constructor(kind: Kind, types: Types, annotatedAllowedTypes: ImplicitAnnotatedAllowedTypes, props?: FieldPropsAlpha<TCustomMetadata>);
251
256
  // (undocumented)
252
257
  get allowedTypesIdentifiers(): ReadonlySet<string>;
253
258
  readonly allowedTypesMetadata: AllowedTypesMetadata;
254
259
  // (undocumented)
255
260
  readonly annotatedAllowedTypes: ImplicitAnnotatedAllowedTypes;
256
261
  get annotatedAllowedTypeSet(): ReadonlyMap<TreeNodeSchema, AllowedTypeMetadata>;
262
+ get persistedMetadata(): JsonCompatibleReadOnlyObject | undefined;
257
263
  }
258
264
 
259
265
  // @alpha @sealed @system
@@ -787,6 +793,14 @@ export type JsonCompatibleObject<TExtra = never> = {
787
793
  [P in string]?: JsonCompatible<TExtra>;
788
794
  };
789
795
 
796
+ // @alpha
797
+ export type JsonCompatibleReadOnly = string | number | boolean | null | readonly JsonCompatibleReadOnly[] | JsonCompatibleReadOnlyObject;
798
+
799
+ // @alpha
800
+ export type JsonCompatibleReadOnlyObject = {
801
+ readonly [P in string]?: JsonCompatibleReadOnly;
802
+ };
803
+
790
804
  // @alpha @sealed
791
805
  export type JsonFieldSchema = {
792
806
  readonly description?: string | undefined;
@@ -948,6 +962,11 @@ export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
948
962
  readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
949
963
  }
950
964
 
965
+ // @alpha
966
+ export interface NodeSchemaOptionsAlpha<out TCustomMetadata = unknown> extends NodeSchemaOptions<TCustomMetadata> {
967
+ readonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;
968
+ }
969
+
951
970
  // @alpha
952
971
  export const noopValidator: JsonValidator;
953
972
 
@@ -975,7 +994,7 @@ export function onAssertionFailure(handler: (error: Error) => void): () => void;
975
994
  // @alpha
976
995
  export function persistedToSimpleSchema(persisted: JsonCompatible, options: ICodecOptions): SimpleTreeSchema;
977
996
 
978
- // @alpha @system
997
+ // @beta @system
979
998
  export type PopUnion<Union, AsOverloadedFunction = UnionToIntersection<Union extends unknown ? (f: Union) => void : never>> = AsOverloadedFunction extends (a: infer First) => void ? First : never;
980
999
 
981
1000
  // @alpha @system
@@ -1121,30 +1140,42 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
1121
1140
 
1122
1141
  // @alpha
1123
1142
  export class SchemaFactoryAlpha<out TScope extends string | undefined = string | undefined, TName extends number | string = string> extends SchemaFactory<TScope, TName> {
1124
- arrayAlpha<const Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
1125
- arrayRecursive<const Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): ArrayNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
1143
+ arrayAlpha<const Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
1144
+ arrayRecursive<const Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): ArrayNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
1126
1145
  static readonly identifier: <const TCustomMetadata = unknown>(props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlpha_2<FieldKind_2.Identifier, LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, TCustomMetadata>;
1127
1146
  static readonly leaves: readonly [LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, LeafSchema_2<"number", number> & SimpleLeafNodeSchema_2, LeafSchema_2<"boolean", boolean> & SimpleLeafNodeSchema_2, LeafSchema_2<"null", null> & SimpleLeafNodeSchema_2, LeafSchema_2<"handle", IFluidHandle_2<unknown>> & SimpleLeafNodeSchema_2];
1128
- mapAlpha<Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
1129
- mapRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): MapNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
1147
+ readonly leaves: readonly [LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, LeafSchema_2<"number", number> & SimpleLeafNodeSchema_2, LeafSchema_2<"boolean", boolean> & SimpleLeafNodeSchema_2, LeafSchema_2<"null", null> & SimpleLeafNodeSchema_2, LeafSchema_2<"handle", IFluidHandle_2<unknown>> & SimpleLeafNodeSchema_2];
1148
+ mapAlpha<Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
1149
+ mapRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptionsAlpha<TCustomMetadata>): MapNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
1130
1150
  objectAlpha<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>, const TCustomMetadata = unknown>(name: Name, fields: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> & {
1131
1151
  readonly createFromInsertable: unknown;
1132
1152
  };
1133
1153
  objectRecursive<const Name extends TName, const T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>, const TCustomMetadata = unknown>(name: Name, t: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, System_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>, false, T, never, TCustomMetadata> & SimpleObjectNodeSchema<TCustomMetadata> & Pick<ObjectNodeSchema, "fields">;
1134
1154
  static readonly optional: {
1135
- <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Optional, T, TCustomMetadata>;
1136
- <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldProps_2<TCustomMetadata_1>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Optional, UnannotateImplicitAllowedTypes_2<T_1>, TCustomMetadata_1>;
1155
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha_2<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Optional, T, TCustomMetadata>;
1156
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldPropsAlpha_2<TCustomMetadata_1>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Optional, UnannotateImplicitAllowedTypes_2<T_1>, TCustomMetadata_1>;
1157
+ };
1158
+ readonly optional: {
1159
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha_2<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Optional, T, TCustomMetadata>;
1160
+ <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldPropsAlpha_2<TCustomMetadata_1>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Optional, UnannotateImplicitAllowedTypes_2<T_1>, TCustomMetadata_1>;
1137
1161
  };
1138
- static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2<FieldKind_2.Optional, T, TCustomMetadata>;
1162
+ 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
+ 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>;
1139
1164
  static readonly required: {
1140
- <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Required, T, TCustomMetadata>;
1141
- <const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldProps_2<TCustomMetadata_1>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Required, UnannotateImplicitAllowedTypes_2<T_1>, TCustomMetadata_1>;
1165
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha_2<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Required, T, TCustomMetadata>;
1166
+ <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>;
1167
+ };
1168
+ readonly required: {
1169
+ <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha_2<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Required, T, TCustomMetadata>;
1170
+ <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>;
1142
1171
  };
1172
+ static readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2<FieldKind_2.Required, T, TCustomMetadata>;
1173
+ readonly requiredRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldPropsAlpha_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2<FieldKind_2.Required, T, TCustomMetadata>;
1143
1174
  scopedFactory<const T extends TName, TNameInner extends number | string = string>(name: T): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner>;
1144
1175
  }
1145
1176
 
1146
1177
  // @alpha
1147
- export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown> extends NodeSchemaOptions<TCustomMetadata> {
1178
+ export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown> extends NodeSchemaOptionsAlpha<TCustomMetadata> {
1148
1179
  allowUnknownOptionalFields?: boolean;
1149
1180
  }
1150
1181
 
@@ -1195,6 +1226,7 @@ export const SharedTreeFormatVersion: {
1195
1226
  readonly v1: 1;
1196
1227
  readonly v2: 2;
1197
1228
  readonly v3: 3;
1229
+ readonly v5: 5;
1198
1230
  };
1199
1231
 
1200
1232
  // @alpha
@@ -1204,7 +1236,7 @@ export type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;
1204
1236
  export type SharedTreeOptions = Partial<CodecWriteOptions> & Partial<SharedTreeFormatOptions> & ForestOptions;
1205
1237
 
1206
1238
  // @alpha @sealed
1207
- export interface SimpleArrayNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBase<NodeKind.Array, TCustomMetadata> {
1239
+ export interface SimpleArrayNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBaseAlpha<NodeKind.Array, TCustomMetadata> {
1208
1240
  readonly allowedTypesIdentifiers: ReadonlySet<string>;
1209
1241
  }
1210
1242
 
@@ -1213,15 +1245,16 @@ export interface SimpleFieldSchema {
1213
1245
  readonly allowedTypesIdentifiers: ReadonlySet<string>;
1214
1246
  readonly kind: FieldKind;
1215
1247
  readonly metadata: FieldSchemaMetadata;
1248
+ readonly persistedMetadata?: JsonCompatibleReadOnlyObject | undefined;
1216
1249
  }
1217
1250
 
1218
1251
  // @alpha @sealed
1219
- export interface SimpleLeafNodeSchema extends SimpleNodeSchemaBase<NodeKind.Leaf> {
1252
+ export interface SimpleLeafNodeSchema extends SimpleNodeSchemaBaseAlpha<NodeKind.Leaf> {
1220
1253
  readonly leafKind: ValueSchema;
1221
1254
  }
1222
1255
 
1223
1256
  // @alpha @sealed
1224
- export interface SimpleMapNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBase<NodeKind.Map, TCustomMetadata> {
1257
+ export interface SimpleMapNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBaseAlpha<NodeKind.Map, TCustomMetadata> {
1225
1258
  readonly allowedTypesIdentifiers: ReadonlySet<string>;
1226
1259
  }
1227
1260
 
@@ -1234,13 +1267,18 @@ export interface SimpleNodeSchemaBase<out TNodeKind extends NodeKind, out TCusto
1234
1267
  readonly metadata: NodeSchemaMetadata<TCustomMetadata>;
1235
1268
  }
1236
1269
 
1270
+ // @alpha @sealed @system
1271
+ export interface SimpleNodeSchemaBaseAlpha<out TNodeKind extends NodeKind, out TCustomMetadata = unknown> extends SimpleNodeSchemaBase<TNodeKind, TCustomMetadata> {
1272
+ readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined;
1273
+ }
1274
+
1237
1275
  // @alpha @sealed
1238
1276
  export interface SimpleObjectFieldSchema extends SimpleFieldSchema {
1239
1277
  readonly storedKey: string;
1240
1278
  }
1241
1279
 
1242
1280
  // @alpha @sealed
1243
- export interface SimpleObjectNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBase<NodeKind.Object, TCustomMetadata> {
1281
+ export interface SimpleObjectNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBaseAlpha<NodeKind.Object, TCustomMetadata> {
1244
1282
  readonly fields: ReadonlyMap<string, SimpleObjectFieldSchema>;
1245
1283
  }
1246
1284
 
@@ -1253,7 +1291,7 @@ export interface SimpleTreeSchema {
1253
1291
  readonly root: SimpleFieldSchema;
1254
1292
  }
1255
1293
 
1256
- // @alpha
1294
+ // @beta
1257
1295
  export function singletonSchema<TScope extends string, TName extends string | number>(factory: SchemaFactory<TScope, TName>, name: TName): TreeNodeSchemaClass<ScopedSchemaName<TScope, TName>, NodeKind.Object, TreeNode & {
1258
1296
  readonly value: TName;
1259
1297
  }, Record<string, never>, true, Record<string, never>, undefined>;
@@ -1288,7 +1326,7 @@ export namespace System_TableSchema {
1288
1326
  }), true, {
1289
1327
  readonly props: TPropsSchema;
1290
1328
  readonly id: FieldSchema_2<FieldKind_3.Identifier, LeafSchema_3<"string", string>, unknown>;
1291
- readonly cells: FieldSchema_2<FieldKind_3.Required, TreeNodeSchemaClass<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, TreeMapNode_2<TCellSchema> & WithType<ScopedSchemaName<ScopedSchemaName<TInputScope, "table">, "Row.cells">, NodeKind.Map, unknown>, MapNodeInsertableData_2<TCellSchema>, true, TCellSchema, undefined>, unknown>;
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>;
1292
1330
  }>;
1293
1331
  // @system
1294
1332
  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, {
@@ -1861,7 +1899,7 @@ export type Unhydrated<T> = T;
1861
1899
  // @public @system
1862
1900
  export type UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) extends (k: infer U) => unknown ? U : never;
1863
1901
 
1864
- // @alpha
1902
+ // @beta @system
1865
1903
  export type UnionToTuple<Union, A extends unknown[] = [], First = PopUnion<Union>> = IsUnion<Union> extends true ? UnionToTuple<Exclude<Union, First>, [First, ...A]> : [Union, ...A];
1866
1904
 
1867
1905
  // @alpha
@@ -4,6 +4,17 @@
4
4
 
5
5
  ```ts
6
6
 
7
+ // @beta
8
+ export function adaptEnum<TScope extends string, const TEnum extends Record<string, string | number>>(factory: SchemaFactory<TScope>, members: TEnum): (<TValue extends TEnum[keyof TEnum]>(value: TValue) => TValue extends unknown ? TreeNode & {
9
+ readonly value: TValue;
10
+ } : never) & { readonly [Property in keyof TEnum]: TreeNodeSchemaClass<ScopedSchemaName<TScope, TEnum[Property]>, NodeKind.Object, TreeNode & {
11
+ readonly value: TEnum[Property];
12
+ }, Record<string, never>, true, Record<string, never>, undefined>; } & {
13
+ readonly schema: UnionToTuple<{ readonly [Property in keyof TEnum]: TreeNodeSchemaClass<ScopedSchemaName<TScope, TEnum[Property]>, NodeKind.Object, TreeNode & {
14
+ readonly value: TEnum[Property];
15
+ }, Record<string, never>, true, Record<string, never>, undefined>; }[keyof TEnum]>;
16
+ };
17
+
7
18
  // @public @system
8
19
  export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
9
20
 
@@ -71,6 +82,17 @@ export interface ContainerSchema {
71
82
  interface DefaultProvider extends ErasedType<"@fluidframework/tree.FieldProvider"> {
72
83
  }
73
84
 
85
+ // @beta
86
+ export function enumFromStrings<TScope extends string, const Members extends readonly string[]>(factory: SchemaFactory<TScope>, members: Members): (<TValue extends Members[number]>(value: TValue) => TValue extends unknown ? TreeNode & {
87
+ readonly value: TValue;
88
+ } : never) & { [Index in Extract<keyof Members, `${number}`> extends `${infer N extends number}` ? N : never as Members[Index]]: TreeNodeSchemaClass<ScopedSchemaName<TScope, Members[Index]>, NodeKind.Object, TreeNode & {
89
+ readonly value: Members[Index];
90
+ }, Record<string, never>, true, Record<string, never>, undefined>; } & {
91
+ readonly schema: UnionToTuple<Members[number] extends unknown ? { [Index in Extract<keyof Members, `${number}`> extends `${infer N extends number}` ? N : never as Members[Index]]: TreeNodeSchemaClass<ScopedSchemaName<TScope, Members[Index]>, NodeKind.Object, TreeNode & {
92
+ readonly value: Members[Index];
93
+ }, Record<string, never>, true, Record<string, never>, undefined>; }[Members[number]] : never>;
94
+ };
95
+
74
96
  // @public @sealed
75
97
  export abstract class ErasedType<out Name = unknown> {
76
98
  static [Symbol.hasInstance](value: never): value is never;
@@ -591,6 +613,9 @@ export type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFie
591
613
  // @public
592
614
  export type Off = () => void;
593
615
 
616
+ // @beta @system
617
+ export type PopUnion<Union, AsOverloadedFunction = UnionToIntersection<Union extends unknown ? (f: Union) => void : never>> = AsOverloadedFunction extends (a: infer First) => void ? First : never;
618
+
594
619
  // @public @sealed @system
595
620
  export interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue> extends ReadonlyArray<T>, Awaited<TreeNode & WithType<string, NodeKind.Array>> {
596
621
  }
@@ -739,6 +764,11 @@ export interface SimpleNodeSchemaBase<out TNodeKind extends NodeKind, out TCusto
739
764
  readonly metadata: NodeSchemaMetadata<TCustomMetadata>;
740
765
  }
741
766
 
767
+ // @beta
768
+ export function singletonSchema<TScope extends string, TName extends string | number>(factory: SchemaFactory<TScope, TName>, name: TName): TreeNodeSchemaClass<ScopedSchemaName<TScope, TName>, NodeKind.Object, TreeNode & {
769
+ readonly value: TName;
770
+ }, Record<string, never>, true, Record<string, never>, undefined>;
771
+
742
772
  // @public @system
743
773
  export namespace System_Unsafe {
744
774
  // @system
@@ -1017,6 +1047,9 @@ export type Unhydrated<T> = T;
1017
1047
  // @public @system
1018
1048
  export type UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) extends (k: infer U) => unknown ? U : never;
1019
1049
 
1050
+ // @beta @system
1051
+ export type UnionToTuple<Union, A extends unknown[] = [], First = PopUnion<Union>> = IsUnion<Union> extends true ? UnionToTuple<Exclude<Union, First>, [First, ...A]> : [Union, ...A];
1052
+
1020
1053
  // @public
1021
1054
  export type ValidateRecursiveSchema<T extends ValidateRecursiveSchemaTemplate<T>> = true;
1022
1055
 
@@ -425,14 +425,16 @@ export interface IFluidLoadable extends IProvideFluidLoadable {
425
425
 
426
426
  // @alpha @legacy
427
427
  export interface IInterval {
428
- // (undocumented)
428
+ // @deprecated (undocumented)
429
429
  clone(): IInterval;
430
430
  compare(b: IInterval): number;
431
431
  compareEnd(b: IInterval): number;
432
432
  compareStart(b: IInterval): number;
433
+ // @deprecated
433
434
  modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): IInterval | undefined;
434
435
  // (undocumented)
435
436
  overlaps(b: IInterval): boolean;
437
+ // @deprecated
436
438
  union(b: IInterval): IInterval;
437
439
  }
438
440
 
@@ -571,7 +573,7 @@ export interface ISequenceIntervalCollection extends TypedEventEmitter<ISequence
571
573
  end: SequencePlace;
572
574
  props?: PropertySet;
573
575
  }): SequenceInterval;
574
- // (undocumented)
576
+ // @deprecated (undocumented)
575
577
  attachDeserializer(onDeserialize: DeserializeCallback): void;
576
578
  // (undocumented)
577
579
  readonly attached: boolean;
@@ -611,11 +613,11 @@ export interface ISequenceIntervalCollectionEvents extends IEvent {
611
613
  (event: "changed", listener: (interval: SequenceInterval, propertyDeltas: PropertySet, previousInterval: SequenceInterval | undefined, local: boolean, slide: boolean) => void): void;
612
614
  }
613
615
 
614
- // @alpha @legacy (undocumented)
616
+ // @alpha @deprecated @legacy (undocumented)
615
617
  export interface ISerializableInterval extends IInterval {
616
618
  getIntervalId(): string;
617
619
  properties: PropertySet;
618
- // (undocumented)
620
+ // @deprecated (undocumented)
619
621
  serialize(): ISerializedInterval;
620
622
  }
621
623
 
@@ -1031,8 +1033,9 @@ export interface SequenceEvent<TOperation extends MergeTreeDeltaOperationTypes =
1031
1033
 
1032
1034
  // @alpha @legacy
1033
1035
  export interface SequenceInterval extends ISerializableInterval {
1036
+ // @deprecated
1034
1037
  addPositionChangeListeners(beforePositionChange: () => void, afterPositionChange: () => void): void;
1035
- // (undocumented)
1038
+ // @deprecated (undocumented)
1036
1039
  clone(): SequenceInterval;
1037
1040
  compare(b: SequenceInterval): number;
1038
1041
  compareEnd(b: SequenceInterval): number;
@@ -1040,13 +1043,17 @@ export interface SequenceInterval extends ISerializableInterval {
1040
1043
  readonly end: LocalReferencePosition;
1041
1044
  // (undocumented)
1042
1045
  readonly endSide: Side;
1046
+ getIntervalId(): string;
1043
1047
  // (undocumented)
1044
1048
  readonly intervalType: IntervalType;
1049
+ // @deprecated
1045
1050
  modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): SequenceInterval | undefined;
1046
1051
  // (undocumented)
1047
1052
  overlaps(b: SequenceInterval): boolean;
1048
1053
  // (undocumented)
1049
1054
  overlapsPos(bstart: number, bend: number): boolean;
1055
+ properties: PropertySet;
1056
+ // @deprecated
1050
1057
  removePositionChangeListeners(): void;
1051
1058
  // (undocumented)
1052
1059
  readonly start: LocalReferencePosition;
@@ -1054,6 +1061,7 @@ export interface SequenceInterval extends ISerializableInterval {
1054
1061
  readonly startSide: Side;
1055
1062
  // (undocumented)
1056
1063
  readonly stickiness: IntervalStickiness;
1064
+ // @deprecated
1057
1065
  union(b: SequenceInterval): SequenceInterval;
1058
1066
  }
1059
1067
 
package/dist/alpha.d.ts CHANGED
@@ -134,8 +134,13 @@ export {
134
134
 
135
135
  // @beta APIs
136
136
  NodeChangedData,
137
+ PopUnion,
137
138
  TreeBeta,
138
- TreeChangeEventsBeta,
139
+ TreeChangeEventsBeta,
140
+ UnionToTuple,
141
+ adaptEnum,
142
+ enumFromStrings,
143
+ singletonSchema,
139
144
 
140
145
  // @alpha APIs
141
146
  AllowedTypeMetadata,
@@ -151,6 +156,7 @@ export {
151
156
  ConciseTree,
152
157
  FactoryContent,
153
158
  FactoryContentObject,
159
+ FieldPropsAlpha,
154
160
  FieldSchemaAlpha,
155
161
  FieldSchemaAlphaUnsafe,
156
162
  FixRecursiveArraySchema,
@@ -174,6 +180,8 @@ export {
174
180
  JsonAsTree,
175
181
  JsonCompatible,
176
182
  JsonCompatibleObject,
183
+ JsonCompatibleReadOnly,
184
+ JsonCompatibleReadOnlyObject,
177
185
  JsonFieldSchema,
178
186
  JsonLeafNodeSchema,
179
187
  JsonLeafSchemaType,
@@ -191,8 +199,8 @@ export {
191
199
  MapNodeCustomizableSchemaUnsafe,
192
200
  MapNodePojoEmulationSchema,
193
201
  MapNodeSchema,
202
+ NodeSchemaOptionsAlpha,
194
203
  ObjectNodeSchema,
195
- PopUnion,
196
204
  ReadSchema,
197
205
  ReadableField,
198
206
  RevertibleAlpha,
@@ -209,6 +217,7 @@ export {
209
217
  SimpleLeafNodeSchema,
210
218
  SimpleMapNodeSchema,
211
219
  SimpleNodeSchema,
220
+ SimpleNodeSchemaBaseAlpha,
212
221
  SimpleObjectFieldSchema,
213
222
  SimpleObjectNodeSchema,
214
223
  SimpleTreeIndex,
@@ -241,14 +250,12 @@ export {
241
250
  UnannotateImplicitAllowedTypes,
242
251
  UnannotateImplicitFieldSchema,
243
252
  UnannotateSchemaRecord,
244
- UnionToTuple,
245
253
  UnsafeUnknownSchema,
246
254
  ValueSchema,
247
255
  VerboseTree,
248
256
  VerboseTreeNode,
249
257
  ViewContent,
250
258
  VoidTransactionCallbackStatus,
251
- adaptEnum,
252
259
  allowUnused,
253
260
  asTreeViewAlpha,
254
261
  cloneWithReplacements,
@@ -256,7 +263,6 @@ export {
256
263
  configuredSharedTree,
257
264
  createIdentifierIndex,
258
265
  createSimpleTreeIndex,
259
- enumFromStrings,
260
266
  evaluateLazySchema,
261
267
  extractPersistedSchema,
262
268
  generateSchemaFromSimpleSchema,
@@ -271,6 +277,5 @@ export {
271
277
  replaceConciseTreeHandles,
272
278
  replaceHandles,
273
279
  replaceVerboseTreeHandles,
274
- singletonSchema,
275
280
  typeboxValidator
276
281
  } from "./index.js";
package/dist/beta.d.ts CHANGED
@@ -134,6 +134,11 @@ export {
134
134
 
135
135
  // @beta APIs
136
136
  NodeChangedData,
137
+ PopUnion,
137
138
  TreeBeta,
138
- TreeChangeEventsBeta
139
+ TreeChangeEventsBeta,
140
+ UnionToTuple,
141
+ adaptEnum,
142
+ enumFromStrings,
143
+ singletonSchema
139
144
  } from "./index.js";
package/lib/alpha.d.ts CHANGED
@@ -134,8 +134,13 @@ export {
134
134
 
135
135
  // @beta APIs
136
136
  NodeChangedData,
137
+ PopUnion,
137
138
  TreeBeta,
138
- TreeChangeEventsBeta,
139
+ TreeChangeEventsBeta,
140
+ UnionToTuple,
141
+ adaptEnum,
142
+ enumFromStrings,
143
+ singletonSchema,
139
144
 
140
145
  // @alpha APIs
141
146
  AllowedTypeMetadata,
@@ -151,6 +156,7 @@ export {
151
156
  ConciseTree,
152
157
  FactoryContent,
153
158
  FactoryContentObject,
159
+ FieldPropsAlpha,
154
160
  FieldSchemaAlpha,
155
161
  FieldSchemaAlphaUnsafe,
156
162
  FixRecursiveArraySchema,
@@ -174,6 +180,8 @@ export {
174
180
  JsonAsTree,
175
181
  JsonCompatible,
176
182
  JsonCompatibleObject,
183
+ JsonCompatibleReadOnly,
184
+ JsonCompatibleReadOnlyObject,
177
185
  JsonFieldSchema,
178
186
  JsonLeafNodeSchema,
179
187
  JsonLeafSchemaType,
@@ -191,8 +199,8 @@ export {
191
199
  MapNodeCustomizableSchemaUnsafe,
192
200
  MapNodePojoEmulationSchema,
193
201
  MapNodeSchema,
202
+ NodeSchemaOptionsAlpha,
194
203
  ObjectNodeSchema,
195
- PopUnion,
196
204
  ReadSchema,
197
205
  ReadableField,
198
206
  RevertibleAlpha,
@@ -209,6 +217,7 @@ export {
209
217
  SimpleLeafNodeSchema,
210
218
  SimpleMapNodeSchema,
211
219
  SimpleNodeSchema,
220
+ SimpleNodeSchemaBaseAlpha,
212
221
  SimpleObjectFieldSchema,
213
222
  SimpleObjectNodeSchema,
214
223
  SimpleTreeIndex,
@@ -241,14 +250,12 @@ export {
241
250
  UnannotateImplicitAllowedTypes,
242
251
  UnannotateImplicitFieldSchema,
243
252
  UnannotateSchemaRecord,
244
- UnionToTuple,
245
253
  UnsafeUnknownSchema,
246
254
  ValueSchema,
247
255
  VerboseTree,
248
256
  VerboseTreeNode,
249
257
  ViewContent,
250
258
  VoidTransactionCallbackStatus,
251
- adaptEnum,
252
259
  allowUnused,
253
260
  asTreeViewAlpha,
254
261
  cloneWithReplacements,
@@ -256,7 +263,6 @@ export {
256
263
  configuredSharedTree,
257
264
  createIdentifierIndex,
258
265
  createSimpleTreeIndex,
259
- enumFromStrings,
260
266
  evaluateLazySchema,
261
267
  extractPersistedSchema,
262
268
  generateSchemaFromSimpleSchema,
@@ -271,6 +277,5 @@ export {
271
277
  replaceConciseTreeHandles,
272
278
  replaceHandles,
273
279
  replaceVerboseTreeHandles,
274
- singletonSchema,
275
280
  typeboxValidator
276
281
  } from "./index.js";
package/lib/beta.d.ts CHANGED
@@ -134,6 +134,11 @@ export {
134
134
 
135
135
  // @beta APIs
136
136
  NodeChangedData,
137
+ PopUnion,
137
138
  TreeBeta,
138
- TreeChangeEventsBeta
139
+ TreeChangeEventsBeta,
140
+ UnionToTuple,
141
+ adaptEnum,
142
+ enumFromStrings,
143
+ singletonSchema
139
144
  } from "./index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluid-framework",
3
- "version": "2.42.0",
3
+ "version": "2.43.0-343119",
4
4
  "description": "The main entry point into Fluid Framework public packages",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -57,17 +57,17 @@
57
57
  "main": "lib/index.js",
58
58
  "types": "lib/public.d.ts",
59
59
  "dependencies": {
60
- "@fluidframework/container-definitions": "~2.42.0",
61
- "@fluidframework/container-loader": "~2.42.0",
62
- "@fluidframework/core-interfaces": "~2.42.0",
63
- "@fluidframework/core-utils": "~2.42.0",
64
- "@fluidframework/driver-definitions": "~2.42.0",
65
- "@fluidframework/fluid-static": "~2.42.0",
66
- "@fluidframework/map": "~2.42.0",
67
- "@fluidframework/runtime-utils": "~2.42.0",
68
- "@fluidframework/sequence": "~2.42.0",
69
- "@fluidframework/shared-object-base": "~2.42.0",
70
- "@fluidframework/tree": "~2.42.0"
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"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@arethetypeswrong/cli": "^0.17.1",