fluid-framework 2.0.0-dev-rc.5.0.0.270987 → 2.0.0-dev-rc.5.0.0.271262

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.
@@ -105,6 +105,12 @@ export abstract class ErasedType<out Name = unknown> {
105
105
  // @public
106
106
  type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result ? Result : Item;
107
107
 
108
+ // @public
109
+ export type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<FieldKind.Optional | FieldKind.Identifier> ? true : false;
110
+
111
+ // @public
112
+ export type FieldHasDefaultUnsafe<T extends Unenforced<ImplicitFieldSchema>> = T extends FieldSchemaUnsafe<FieldKind.Optional | FieldKind.Identifier, Unenforced<ImplicitAllowedTypes>> ? true : false;
113
+
108
114
  // @public
109
115
  export enum FieldKind {
110
116
  Identifier = 2,
@@ -134,6 +140,11 @@ export interface FieldSchemaUnsafe<out Kind extends FieldKind, out Types extends
134
140
  readonly kind: Kind;
135
141
  }
136
142
 
143
+ // @public
144
+ type FlattenKeys<T> = [{
145
+ [Property in keyof T]: T[Property];
146
+ }][_InlineTrick];
147
+
137
148
  // @public
138
149
  export type FlexList<Item = unknown> = readonly LazyItem<Item>[];
139
150
 
@@ -510,13 +521,20 @@ export type InitialObjects<T extends ContainerSchema> = {
510
521
  };
511
522
 
512
523
  // @public
513
- export type InsertableObjectFromSchemaRecord<T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>> = {
514
- readonly [Property in keyof T]: InsertableTreeFieldFromImplicitField<T[Property]>;
515
- };
524
+ type _InlineTrick = 0;
525
+
526
+ // @public
527
+ export type InsertableObjectFromSchemaRecord<T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>> = InternalUtilTypes.FlattenKeys<{
528
+ readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property]>;
529
+ } & {
530
+ readonly [Property in keyof T as FieldHasDefault<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitField<T[Property]>;
531
+ }>;
516
532
 
517
533
  // @public
518
534
  export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>> = {
519
- readonly [Property in keyof T]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
535
+ readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
536
+ } & {
537
+ readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends true ? Property : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
520
538
  };
521
539
 
522
540
  // @public
@@ -568,6 +586,14 @@ export { InternalSimpleTreeTypes }
568
586
  export interface InternalTreeNode extends ErasedType<"@fluidframework/tree.InternalTreeNode"> {
569
587
  }
570
588
 
589
+ declare namespace InternalUtilTypes {
590
+ export {
591
+ _InlineTrick,
592
+ FlattenKeys
593
+ }
594
+ }
595
+ export { InternalUtilTypes }
596
+
571
597
  // @alpha
572
598
  export interface IntervalIndex<TInterval extends ISerializableInterval> {
573
599
  add(interval: TInterval): void;
@@ -803,7 +829,9 @@ export interface ITrace {
803
829
 
804
830
  // @public
805
831
  export interface ITree extends IFluidLoadable {
832
+ // @deprecated
806
833
  schematize<TRoot extends ImplicitFieldSchema>(config: TreeConfiguration<TRoot>): TreeView<TRoot>;
834
+ viewWith<TRoot extends ImplicitFieldSchema>(config: TreeViewConfiguration<TRoot>): TreeView<TRoot>;
807
835
  }
808
836
 
809
837
  // @public
@@ -811,6 +839,12 @@ export interface ITreeConfigurationOptions {
811
839
  enableSchemaValidation?: boolean;
812
840
  }
813
841
 
842
+ // @public
843
+ export interface ITreeViewConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> {
844
+ readonly enableSchemaValidation?: boolean;
845
+ readonly schema: TSchema;
846
+ }
847
+
814
848
  // @alpha @sealed
815
849
  export interface IValueChanged {
816
850
  readonly key: string;
@@ -930,6 +964,14 @@ export interface RunTransaction {
930
964
  readonly rollback: typeof rollback;
931
965
  }
932
966
 
967
+ // @public
968
+ export interface SchemaCompatibilityStatus {
969
+ readonly canInitialize: boolean;
970
+ readonly canUpgrade: boolean;
971
+ readonly canView: boolean;
972
+ readonly isEquivalent: boolean;
973
+ }
974
+
933
975
  // @public @sealed
934
976
  export class SchemaFactory<out TScope extends string | undefined = string | undefined, TName extends number | string = string> {
935
977
  constructor(scope: TScope);
@@ -952,7 +994,7 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
952
994
  readonly null: TreeNodeSchema<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null>;
953
995
  readonly number: TreeNodeSchema<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
954
996
  object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>(name: Name, fields: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNode<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecord<T>, true, T>;
955
- objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecordUnsafe<T>, false, T>;
997
+ objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & { readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>; } & { readonly [Property_1 in keyof T as FieldHasDefaultUnsafe<T[Property_1]> extends true ? Property_1 : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property_1]> | undefined; }, false, T>;
956
998
  optional<const T extends ImplicitAllowedTypes>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchema<FieldKind.Optional, T>;
957
999
  optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Optional, T>;
958
1000
  required<const T extends ImplicitAllowedTypes>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchema<FieldKind.Required, T>;
@@ -962,11 +1004,6 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
962
1004
  readonly string: TreeNodeSchema<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string>;
963
1005
  }
964
1006
 
965
- // @public
966
- export interface SchemaIncompatible {
967
- readonly canUpgrade: boolean;
968
- }
969
-
970
1007
  // @public
971
1008
  export type ScopedSchemaName<TScope extends string | undefined, TName extends number | string> = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;
972
1009
 
@@ -1141,12 +1178,12 @@ export interface TreeChangeEvents {
1141
1178
  treeChanged(): void;
1142
1179
  }
1143
1180
 
1144
- // @public
1181
+ // @public @deprecated
1145
1182
  export class TreeConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> {
1146
1183
  constructor(schema: TSchema, initialTree: () => InsertableTreeFieldFromImplicitField<TSchema>, options?: ITreeConfigurationOptions);
1184
+ readonly enableSchemaValidation: boolean;
1147
1185
  // (undocumented)
1148
1186
  readonly initialTree: () => InsertableTreeFieldFromImplicitField<TSchema>;
1149
- readonly options: Required<ITreeConfigurationOptions>;
1150
1187
  // (undocumented)
1151
1188
  readonly schema: TSchema;
1152
1189
  }
@@ -1240,18 +1277,27 @@ export enum TreeStatus {
1240
1277
 
1241
1278
  // @public
1242
1279
  export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposable {
1243
- readonly error?: SchemaIncompatible;
1280
+ readonly compatibility: SchemaCompatibilityStatus;
1244
1281
  readonly events: Listenable<TreeViewEvents>;
1282
+ initialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;
1245
1283
  get root(): TreeFieldFromImplicitField<TSchema>;
1246
1284
  set root(newRoot: InsertableTreeFieldFromImplicitField<TSchema>);
1247
1285
  upgradeSchema(): void;
1248
1286
  }
1249
1287
 
1288
+ // @public
1289
+ export class TreeViewConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
1290
+ constructor(props: ITreeViewConfiguration<TSchema>);
1291
+ readonly enableSchemaValidation: boolean;
1292
+ readonly schema: TSchema;
1293
+ }
1294
+
1250
1295
  // @public
1251
1296
  export interface TreeViewEvents {
1252
1297
  afterBatch(): void;
1253
1298
  commitApplied(data: CommitMetadata, getRevertible?: RevertibleFactory): void;
1254
1299
  rootChanged(): void;
1300
+ schemaChanged(): void;
1255
1301
  }
1256
1302
 
1257
1303
  // @public
@@ -102,6 +102,12 @@ export abstract class ErasedType<out Name = unknown> {
102
102
  // @public
103
103
  type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result ? Result : Item;
104
104
 
105
+ // @public
106
+ export type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<FieldKind.Optional | FieldKind.Identifier> ? true : false;
107
+
108
+ // @public
109
+ export type FieldHasDefaultUnsafe<T extends Unenforced<ImplicitFieldSchema>> = T extends FieldSchemaUnsafe<FieldKind.Optional | FieldKind.Identifier, Unenforced<ImplicitAllowedTypes>> ? true : false;
110
+
105
111
  // @public
106
112
  export enum FieldKind {
107
113
  Identifier = 2,
@@ -131,6 +137,11 @@ export interface FieldSchemaUnsafe<out Kind extends FieldKind, out Types extends
131
137
  readonly kind: Kind;
132
138
  }
133
139
 
140
+ // @public
141
+ type FlattenKeys<T> = [{
142
+ [Property in keyof T]: T[Property];
143
+ }][_InlineTrick];
144
+
134
145
  // @public
135
146
  export type FlexList<Item = unknown> = readonly LazyItem<Item>[];
136
147
 
@@ -410,13 +421,20 @@ export type InitialObjects<T extends ContainerSchema> = {
410
421
  };
411
422
 
412
423
  // @public
413
- export type InsertableObjectFromSchemaRecord<T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>> = {
414
- readonly [Property in keyof T]: InsertableTreeFieldFromImplicitField<T[Property]>;
415
- };
424
+ type _InlineTrick = 0;
425
+
426
+ // @public
427
+ export type InsertableObjectFromSchemaRecord<T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>> = InternalUtilTypes.FlattenKeys<{
428
+ readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property]>;
429
+ } & {
430
+ readonly [Property in keyof T as FieldHasDefault<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitField<T[Property]>;
431
+ }>;
416
432
 
417
433
  // @public
418
434
  export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>> = {
419
- readonly [Property in keyof T]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
435
+ readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
436
+ } & {
437
+ readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends true ? Property : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
420
438
  };
421
439
 
422
440
  // @public
@@ -460,6 +478,14 @@ export { InternalSimpleTreeTypes }
460
478
  export interface InternalTreeNode extends ErasedType<"@fluidframework/tree.InternalTreeNode"> {
461
479
  }
462
480
 
481
+ declare namespace InternalUtilTypes {
482
+ export {
483
+ _InlineTrick,
484
+ FlattenKeys
485
+ }
486
+ }
487
+ export { InternalUtilTypes }
488
+
463
489
  // @public (undocumented)
464
490
  export interface IProvideFluidLoadable {
465
491
  // (undocumented)
@@ -497,7 +523,9 @@ export class IterableTreeArrayContent<T> implements Iterable<T> {
497
523
 
498
524
  // @public
499
525
  export interface ITree extends IFluidLoadable {
526
+ // @deprecated
500
527
  schematize<TRoot extends ImplicitFieldSchema>(config: TreeConfiguration<TRoot>): TreeView<TRoot>;
528
+ viewWith<TRoot extends ImplicitFieldSchema>(config: TreeViewConfiguration<TRoot>): TreeView<TRoot>;
501
529
  }
502
530
 
503
531
  // @public
@@ -505,6 +533,12 @@ export interface ITreeConfigurationOptions {
505
533
  enableSchemaValidation?: boolean;
506
534
  }
507
535
 
536
+ // @public
537
+ export interface ITreeViewConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> {
538
+ readonly enableSchemaValidation?: boolean;
539
+ readonly schema: TSchema;
540
+ }
541
+
508
542
  // @public
509
543
  export type LazyItem<Item = unknown> = Item | (() => Item);
510
544
 
@@ -618,6 +652,14 @@ export interface RunTransaction {
618
652
  readonly rollback: typeof rollback;
619
653
  }
620
654
 
655
+ // @public
656
+ export interface SchemaCompatibilityStatus {
657
+ readonly canInitialize: boolean;
658
+ readonly canUpgrade: boolean;
659
+ readonly canView: boolean;
660
+ readonly isEquivalent: boolean;
661
+ }
662
+
621
663
  // @public @sealed
622
664
  export class SchemaFactory<out TScope extends string | undefined = string | undefined, TName extends number | string = string> {
623
665
  constructor(scope: TScope);
@@ -640,7 +682,7 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
640
682
  readonly null: TreeNodeSchema<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null>;
641
683
  readonly number: TreeNodeSchema<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
642
684
  object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>(name: Name, fields: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNode<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecord<T>, true, T>;
643
- objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecordUnsafe<T>, false, T>;
685
+ objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & { readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>; } & { readonly [Property_1 in keyof T as FieldHasDefaultUnsafe<T[Property_1]> extends true ? Property_1 : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property_1]> | undefined; }, false, T>;
644
686
  optional<const T extends ImplicitAllowedTypes>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchema<FieldKind.Optional, T>;
645
687
  optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Optional, T>;
646
688
  required<const T extends ImplicitAllowedTypes>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchema<FieldKind.Required, T>;
@@ -650,11 +692,6 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
650
692
  readonly string: TreeNodeSchema<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string>;
651
693
  }
652
694
 
653
- // @public
654
- export interface SchemaIncompatible {
655
- readonly canUpgrade: boolean;
656
- }
657
-
658
695
  // @public
659
696
  export type ScopedSchemaName<TScope extends string | undefined, TName extends number | string> = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;
660
697
 
@@ -731,12 +768,12 @@ export interface TreeChangeEvents {
731
768
  treeChanged(): void;
732
769
  }
733
770
 
734
- // @public
771
+ // @public @deprecated
735
772
  export class TreeConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> {
736
773
  constructor(schema: TSchema, initialTree: () => InsertableTreeFieldFromImplicitField<TSchema>, options?: ITreeConfigurationOptions);
774
+ readonly enableSchemaValidation: boolean;
737
775
  // (undocumented)
738
776
  readonly initialTree: () => InsertableTreeFieldFromImplicitField<TSchema>;
739
- readonly options: Required<ITreeConfigurationOptions>;
740
777
  // (undocumented)
741
778
  readonly schema: TSchema;
742
779
  }
@@ -830,18 +867,27 @@ export enum TreeStatus {
830
867
 
831
868
  // @public
832
869
  export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposable {
833
- readonly error?: SchemaIncompatible;
870
+ readonly compatibility: SchemaCompatibilityStatus;
834
871
  readonly events: Listenable<TreeViewEvents>;
872
+ initialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;
835
873
  get root(): TreeFieldFromImplicitField<TSchema>;
836
874
  set root(newRoot: InsertableTreeFieldFromImplicitField<TSchema>);
837
875
  upgradeSchema(): void;
838
876
  }
839
877
 
878
+ // @public
879
+ export class TreeViewConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
880
+ constructor(props: ITreeViewConfiguration<TSchema>);
881
+ readonly enableSchemaValidation: boolean;
882
+ readonly schema: TSchema;
883
+ }
884
+
840
885
  // @public
841
886
  export interface TreeViewEvents {
842
887
  afterBatch(): void;
843
888
  commitApplied(data: CommitMetadata, getRevertible?: RevertibleFactory): void;
844
889
  rootChanged(): void;
890
+ schemaChanged(): void;
845
891
  }
846
892
 
847
893
  // @public
@@ -102,6 +102,12 @@ export abstract class ErasedType<out Name = unknown> {
102
102
  // @public
103
103
  type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result ? Result : Item;
104
104
 
105
+ // @public
106
+ export type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<FieldKind.Optional | FieldKind.Identifier> ? true : false;
107
+
108
+ // @public
109
+ export type FieldHasDefaultUnsafe<T extends Unenforced<ImplicitFieldSchema>> = T extends FieldSchemaUnsafe<FieldKind.Optional | FieldKind.Identifier, Unenforced<ImplicitAllowedTypes>> ? true : false;
110
+
105
111
  // @public
106
112
  export enum FieldKind {
107
113
  Identifier = 2,
@@ -131,6 +137,11 @@ export interface FieldSchemaUnsafe<out Kind extends FieldKind, out Types extends
131
137
  readonly kind: Kind;
132
138
  }
133
139
 
140
+ // @public
141
+ type FlattenKeys<T> = [{
142
+ [Property in keyof T]: T[Property];
143
+ }][_InlineTrick];
144
+
134
145
  // @public
135
146
  export type FlexList<Item = unknown> = readonly LazyItem<Item>[];
136
147
 
@@ -410,13 +421,20 @@ export type InitialObjects<T extends ContainerSchema> = {
410
421
  };
411
422
 
412
423
  // @public
413
- export type InsertableObjectFromSchemaRecord<T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>> = {
414
- readonly [Property in keyof T]: InsertableTreeFieldFromImplicitField<T[Property]>;
415
- };
424
+ type _InlineTrick = 0;
425
+
426
+ // @public
427
+ export type InsertableObjectFromSchemaRecord<T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>> = InternalUtilTypes.FlattenKeys<{
428
+ readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property]>;
429
+ } & {
430
+ readonly [Property in keyof T as FieldHasDefault<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitField<T[Property]>;
431
+ }>;
416
432
 
417
433
  // @public
418
434
  export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>> = {
419
- readonly [Property in keyof T]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
435
+ readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
436
+ } & {
437
+ readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends true ? Property : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
420
438
  };
421
439
 
422
440
  // @public
@@ -460,6 +478,14 @@ export { InternalSimpleTreeTypes }
460
478
  export interface InternalTreeNode extends ErasedType<"@fluidframework/tree.InternalTreeNode"> {
461
479
  }
462
480
 
481
+ declare namespace InternalUtilTypes {
482
+ export {
483
+ _InlineTrick,
484
+ FlattenKeys
485
+ }
486
+ }
487
+ export { InternalUtilTypes }
488
+
463
489
  // @public (undocumented)
464
490
  export interface IProvideFluidLoadable {
465
491
  // (undocumented)
@@ -497,7 +523,9 @@ export class IterableTreeArrayContent<T> implements Iterable<T> {
497
523
 
498
524
  // @public
499
525
  export interface ITree extends IFluidLoadable {
526
+ // @deprecated
500
527
  schematize<TRoot extends ImplicitFieldSchema>(config: TreeConfiguration<TRoot>): TreeView<TRoot>;
528
+ viewWith<TRoot extends ImplicitFieldSchema>(config: TreeViewConfiguration<TRoot>): TreeView<TRoot>;
501
529
  }
502
530
 
503
531
  // @public
@@ -505,6 +533,12 @@ export interface ITreeConfigurationOptions {
505
533
  enableSchemaValidation?: boolean;
506
534
  }
507
535
 
536
+ // @public
537
+ export interface ITreeViewConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> {
538
+ readonly enableSchemaValidation?: boolean;
539
+ readonly schema: TSchema;
540
+ }
541
+
508
542
  // @public
509
543
  export type LazyItem<Item = unknown> = Item | (() => Item);
510
544
 
@@ -618,6 +652,14 @@ export interface RunTransaction {
618
652
  readonly rollback: typeof rollback;
619
653
  }
620
654
 
655
+ // @public
656
+ export interface SchemaCompatibilityStatus {
657
+ readonly canInitialize: boolean;
658
+ readonly canUpgrade: boolean;
659
+ readonly canView: boolean;
660
+ readonly isEquivalent: boolean;
661
+ }
662
+
621
663
  // @public @sealed
622
664
  export class SchemaFactory<out TScope extends string | undefined = string | undefined, TName extends number | string = string> {
623
665
  constructor(scope: TScope);
@@ -640,7 +682,7 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
640
682
  readonly null: TreeNodeSchema<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null>;
641
683
  readonly number: TreeNodeSchema<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
642
684
  object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>(name: Name, fields: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNode<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecord<T>, true, T>;
643
- objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecordUnsafe<T>, false, T>;
685
+ objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & { readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>; } & { readonly [Property_1 in keyof T as FieldHasDefaultUnsafe<T[Property_1]> extends true ? Property_1 : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property_1]> | undefined; }, false, T>;
644
686
  optional<const T extends ImplicitAllowedTypes>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchema<FieldKind.Optional, T>;
645
687
  optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Optional, T>;
646
688
  required<const T extends ImplicitAllowedTypes>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchema<FieldKind.Required, T>;
@@ -650,11 +692,6 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
650
692
  readonly string: TreeNodeSchema<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string>;
651
693
  }
652
694
 
653
- // @public
654
- export interface SchemaIncompatible {
655
- readonly canUpgrade: boolean;
656
- }
657
-
658
695
  // @public
659
696
  export type ScopedSchemaName<TScope extends string | undefined, TName extends number | string> = TScope extends undefined ? `${TName}` : `${TScope}.${TName}`;
660
697
 
@@ -731,12 +768,12 @@ export interface TreeChangeEvents {
731
768
  treeChanged(): void;
732
769
  }
733
770
 
734
- // @public
771
+ // @public @deprecated
735
772
  export class TreeConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> {
736
773
  constructor(schema: TSchema, initialTree: () => InsertableTreeFieldFromImplicitField<TSchema>, options?: ITreeConfigurationOptions);
774
+ readonly enableSchemaValidation: boolean;
737
775
  // (undocumented)
738
776
  readonly initialTree: () => InsertableTreeFieldFromImplicitField<TSchema>;
739
- readonly options: Required<ITreeConfigurationOptions>;
740
777
  // (undocumented)
741
778
  readonly schema: TSchema;
742
779
  }
@@ -830,18 +867,27 @@ export enum TreeStatus {
830
867
 
831
868
  // @public
832
869
  export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposable {
833
- readonly error?: SchemaIncompatible;
870
+ readonly compatibility: SchemaCompatibilityStatus;
834
871
  readonly events: Listenable<TreeViewEvents>;
872
+ initialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;
835
873
  get root(): TreeFieldFromImplicitField<TSchema>;
836
874
  set root(newRoot: InsertableTreeFieldFromImplicitField<TSchema>);
837
875
  upgradeSchema(): void;
838
876
  }
839
877
 
878
+ // @public
879
+ export class TreeViewConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
880
+ constructor(props: ITreeViewConfiguration<TSchema>);
881
+ readonly enableSchemaValidation: boolean;
882
+ readonly schema: TSchema;
883
+ }
884
+
840
885
  // @public
841
886
  export interface TreeViewEvents {
842
887
  afterBatch(): void;
843
888
  commitApplied(data: CommitMetadata, getRevertible?: RevertibleFactory): void;
844
889
  rootChanged(): void;
890
+ schemaChanged(): void;
845
891
  }
846
892
 
847
893
  // @public
package/dist/legacy.d.ts CHANGED
@@ -11,7 +11,8 @@
11
11
  export {
12
12
  // Unrestricted APIs
13
13
  InternalFlexListTypes,
14
- InternalSimpleTreeTypes,
14
+ InternalSimpleTreeTypes,
15
+ InternalUtilTypes,
15
16
 
16
17
  // @public APIs
17
18
  AllowedTypes,
@@ -24,6 +25,8 @@ export {
24
25
  ContainerSchema,
25
26
  DefaultProvider,
26
27
  ErasedType,
28
+ FieldHasDefault,
29
+ FieldHasDefaultUnsafe,
27
30
  FieldKind,
28
31
  FieldProps,
29
32
  FieldSchema,
@@ -52,6 +55,7 @@ export {
52
55
  ITelemetryBaseProperties,
53
56
  ITree,
54
57
  ITreeConfigurationOptions,
58
+ ITreeViewConfiguration,
55
59
  ImplicitAllowedTypes,
56
60
  ImplicitFieldSchema,
57
61
  InitialObjects,
@@ -87,8 +91,8 @@ export {
87
91
  RevertibleFactory,
88
92
  RevertibleStatus,
89
93
  RunTransaction,
94
+ SchemaCompatibilityStatus,
90
95
  SchemaFactory,
91
- SchemaIncompatible,
92
96
  ScopedSchemaName,
93
97
  SharedObjectKind,
94
98
  SharedTree,
@@ -120,6 +124,7 @@ export {
120
124
  TreeObjectNodeUnsafe,
121
125
  TreeStatus,
122
126
  TreeView,
127
+ TreeViewConfiguration,
123
128
  TreeViewEvents,
124
129
  Unenforced,
125
130
  Unhydrated,
package/dist/public.d.ts CHANGED
@@ -11,7 +11,8 @@
11
11
  export {
12
12
  // Unrestricted APIs
13
13
  InternalFlexListTypes,
14
- InternalSimpleTreeTypes,
14
+ InternalSimpleTreeTypes,
15
+ InternalUtilTypes,
15
16
 
16
17
  // @public APIs
17
18
  AllowedTypes,
@@ -24,6 +25,8 @@ export {
24
25
  ContainerSchema,
25
26
  DefaultProvider,
26
27
  ErasedType,
28
+ FieldHasDefault,
29
+ FieldHasDefaultUnsafe,
27
30
  FieldKind,
28
31
  FieldProps,
29
32
  FieldSchema,
@@ -52,6 +55,7 @@ export {
52
55
  ITelemetryBaseProperties,
53
56
  ITree,
54
57
  ITreeConfigurationOptions,
58
+ ITreeViewConfiguration,
55
59
  ImplicitAllowedTypes,
56
60
  ImplicitFieldSchema,
57
61
  InitialObjects,
@@ -87,8 +91,8 @@ export {
87
91
  RevertibleFactory,
88
92
  RevertibleStatus,
89
93
  RunTransaction,
94
+ SchemaCompatibilityStatus,
90
95
  SchemaFactory,
91
- SchemaIncompatible,
92
96
  ScopedSchemaName,
93
97
  SharedObjectKind,
94
98
  SharedTree,
@@ -120,6 +124,7 @@ export {
120
124
  TreeObjectNodeUnsafe,
121
125
  TreeStatus,
122
126
  TreeView,
127
+ TreeViewConfiguration,
123
128
  TreeViewEvents,
124
129
  Unenforced,
125
130
  Unhydrated,
package/lib/legacy.d.ts CHANGED
@@ -11,7 +11,8 @@
11
11
  export {
12
12
  // Unrestricted APIs
13
13
  InternalFlexListTypes,
14
- InternalSimpleTreeTypes,
14
+ InternalSimpleTreeTypes,
15
+ InternalUtilTypes,
15
16
 
16
17
  // @public APIs
17
18
  AllowedTypes,
@@ -24,6 +25,8 @@ export {
24
25
  ContainerSchema,
25
26
  DefaultProvider,
26
27
  ErasedType,
28
+ FieldHasDefault,
29
+ FieldHasDefaultUnsafe,
27
30
  FieldKind,
28
31
  FieldProps,
29
32
  FieldSchema,
@@ -52,6 +55,7 @@ export {
52
55
  ITelemetryBaseProperties,
53
56
  ITree,
54
57
  ITreeConfigurationOptions,
58
+ ITreeViewConfiguration,
55
59
  ImplicitAllowedTypes,
56
60
  ImplicitFieldSchema,
57
61
  InitialObjects,
@@ -87,8 +91,8 @@ export {
87
91
  RevertibleFactory,
88
92
  RevertibleStatus,
89
93
  RunTransaction,
94
+ SchemaCompatibilityStatus,
90
95
  SchemaFactory,
91
- SchemaIncompatible,
92
96
  ScopedSchemaName,
93
97
  SharedObjectKind,
94
98
  SharedTree,
@@ -120,6 +124,7 @@ export {
120
124
  TreeObjectNodeUnsafe,
121
125
  TreeStatus,
122
126
  TreeView,
127
+ TreeViewConfiguration,
123
128
  TreeViewEvents,
124
129
  Unenforced,
125
130
  Unhydrated,
package/lib/public.d.ts CHANGED
@@ -11,7 +11,8 @@
11
11
  export {
12
12
  // Unrestricted APIs
13
13
  InternalFlexListTypes,
14
- InternalSimpleTreeTypes,
14
+ InternalSimpleTreeTypes,
15
+ InternalUtilTypes,
15
16
 
16
17
  // @public APIs
17
18
  AllowedTypes,
@@ -24,6 +25,8 @@ export {
24
25
  ContainerSchema,
25
26
  DefaultProvider,
26
27
  ErasedType,
28
+ FieldHasDefault,
29
+ FieldHasDefaultUnsafe,
27
30
  FieldKind,
28
31
  FieldProps,
29
32
  FieldSchema,
@@ -52,6 +55,7 @@ export {
52
55
  ITelemetryBaseProperties,
53
56
  ITree,
54
57
  ITreeConfigurationOptions,
58
+ ITreeViewConfiguration,
55
59
  ImplicitAllowedTypes,
56
60
  ImplicitFieldSchema,
57
61
  InitialObjects,
@@ -87,8 +91,8 @@ export {
87
91
  RevertibleFactory,
88
92
  RevertibleStatus,
89
93
  RunTransaction,
94
+ SchemaCompatibilityStatus,
90
95
  SchemaFactory,
91
- SchemaIncompatible,
92
96
  ScopedSchemaName,
93
97
  SharedObjectKind,
94
98
  SharedTree,
@@ -120,6 +124,7 @@ export {
120
124
  TreeObjectNodeUnsafe,
121
125
  TreeStatus,
122
126
  TreeView,
127
+ TreeViewConfiguration,
123
128
  TreeViewEvents,
124
129
  Unenforced,
125
130
  Unhydrated,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluid-framework",
3
- "version": "2.0.0-dev-rc.5.0.0.270987",
3
+ "version": "2.0.0-dev-rc.5.0.0.271262",
4
4
  "description": "The main entry point into Fluid Framework public packages",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -37,15 +37,15 @@
37
37
  "main": "lib/index.js",
38
38
  "types": "lib/public.d.ts",
39
39
  "dependencies": {
40
- "@fluidframework/container-definitions": "2.0.0-dev-rc.5.0.0.270987",
41
- "@fluidframework/container-loader": "2.0.0-dev-rc.5.0.0.270987",
42
- "@fluidframework/core-interfaces": "2.0.0-dev-rc.5.0.0.270987",
43
- "@fluidframework/driver-definitions": "2.0.0-dev-rc.5.0.0.270987",
44
- "@fluidframework/fluid-static": "2.0.0-dev-rc.5.0.0.270987",
45
- "@fluidframework/map": "2.0.0-dev-rc.5.0.0.270987",
46
- "@fluidframework/sequence": "2.0.0-dev-rc.5.0.0.270987",
47
- "@fluidframework/shared-object-base": "2.0.0-dev-rc.5.0.0.270987",
48
- "@fluidframework/tree": "2.0.0-dev-rc.5.0.0.270987"
40
+ "@fluidframework/container-definitions": "2.0.0-dev-rc.5.0.0.271262",
41
+ "@fluidframework/container-loader": "2.0.0-dev-rc.5.0.0.271262",
42
+ "@fluidframework/core-interfaces": "2.0.0-dev-rc.5.0.0.271262",
43
+ "@fluidframework/driver-definitions": "2.0.0-dev-rc.5.0.0.271262",
44
+ "@fluidframework/fluid-static": "2.0.0-dev-rc.5.0.0.271262",
45
+ "@fluidframework/map": "2.0.0-dev-rc.5.0.0.271262",
46
+ "@fluidframework/sequence": "2.0.0-dev-rc.5.0.0.271262",
47
+ "@fluidframework/shared-object-base": "2.0.0-dev-rc.5.0.0.271262",
48
+ "@fluidframework/tree": "2.0.0-dev-rc.5.0.0.271262"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@arethetypeswrong/cli": "^0.15.2",