fluid-framework 2.3.1 → 2.4.0-297027
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/api-report/fluid-framework.alpha.api.md +77 -38
- package/api-report/fluid-framework.beta.api.md +50 -30
- package/api-report/fluid-framework.legacy.alpha.api.md +54 -30
- package/api-report/fluid-framework.legacy.public.api.md +50 -30
- package/api-report/fluid-framework.public.api.md +50 -30
- package/dist/alpha.d.ts +7 -0
- package/dist/beta.d.ts +4 -0
- package/dist/legacy.d.ts +4 -0
- package/dist/public.d.ts +4 -0
- package/lib/alpha.d.ts +7 -0
- package/lib/beta.d.ts +4 -0
- package/lib/legacy.d.ts +4 -0
- package/lib/public.d.ts +4 -0
- package/package.json +11 -11
|
@@ -89,21 +89,29 @@ export enum FieldKind {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// @public
|
|
92
|
-
export interface FieldProps {
|
|
92
|
+
export interface FieldProps<TCustomMetadata = unknown> {
|
|
93
93
|
readonly defaultProvider?: DefaultProvider;
|
|
94
94
|
readonly key?: string;
|
|
95
|
+
readonly metadata?: FieldSchemaMetadata<TCustomMetadata>;
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
// @public @sealed
|
|
98
|
-
export class FieldSchema<out Kind extends FieldKind = FieldKind, out Types extends ImplicitAllowedTypes = ImplicitAllowedTypes> {
|
|
99
|
+
export class FieldSchema<out Kind extends FieldKind = FieldKind, out Types extends ImplicitAllowedTypes = ImplicitAllowedTypes, out TCustomMetadata = unknown> {
|
|
99
100
|
readonly allowedTypes: Types;
|
|
100
101
|
get allowedTypeSet(): ReadonlySet<TreeNodeSchema>;
|
|
101
102
|
readonly kind: Kind;
|
|
102
|
-
|
|
103
|
+
get metadata(): FieldSchemaMetadata<TCustomMetadata> | undefined;
|
|
104
|
+
readonly props?: FieldProps<TCustomMetadata> | undefined;
|
|
103
105
|
readonly requiresValue: boolean;
|
|
104
106
|
protected _typeCheck: MakeNominal;
|
|
105
107
|
}
|
|
106
108
|
|
|
109
|
+
// @public @sealed
|
|
110
|
+
export interface FieldSchemaMetadata<TCustomMetadata = unknown> {
|
|
111
|
+
readonly custom?: TCustomMetadata;
|
|
112
|
+
readonly description?: string | undefined;
|
|
113
|
+
}
|
|
114
|
+
|
|
107
115
|
// @public
|
|
108
116
|
export interface FieldSchemaUnsafe<out Kind extends FieldKind, out Types extends Unenforced<ImplicitAllowedTypes>> extends FieldSchema<Kind, any> {
|
|
109
117
|
readonly allowedTypes: Types;
|
|
@@ -134,7 +142,13 @@ export type FluidObject<T = unknown> = {
|
|
|
134
142
|
export type FluidObjectProviderKeys<T, TProp extends keyof T = keyof T> = string extends TProp ? never : number extends TProp ? never : TProp extends keyof Required<T>[TProp] ? Required<T>[TProp] extends Required<Required<T>[TProp]>[TProp] ? TProp : never : never;
|
|
135
143
|
|
|
136
144
|
// @alpha
|
|
137
|
-
export function
|
|
145
|
+
export function getBranch(tree: ITree): TreeBranch;
|
|
146
|
+
|
|
147
|
+
// @alpha
|
|
148
|
+
export function getBranch(view: TreeView<ImplicitFieldSchema>): TreeBranch;
|
|
149
|
+
|
|
150
|
+
// @alpha
|
|
151
|
+
export function getJsonSchema(schema: ImplicitFieldSchema): JsonTreeSchema;
|
|
138
152
|
|
|
139
153
|
// @public
|
|
140
154
|
export interface IConnection {
|
|
@@ -404,14 +418,14 @@ export type InitialObjects<T extends ContainerSchema> = {
|
|
|
404
418
|
type _InlineTrick = 0;
|
|
405
419
|
|
|
406
420
|
// @public
|
|
407
|
-
type InsertableObjectFromSchemaRecord<T extends
|
|
408
|
-
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property]>;
|
|
421
|
+
type InsertableObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = FlattenKeys<{
|
|
422
|
+
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property] & string>;
|
|
409
423
|
} & {
|
|
410
|
-
readonly [Property in keyof T as FieldHasDefault<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitField<T[Property]>;
|
|
424
|
+
readonly [Property in keyof T as FieldHasDefault<T[Property] & string> extends false ? Property : never]: InsertableTreeFieldFromImplicitField<T[Property] & string>;
|
|
411
425
|
}>;
|
|
412
426
|
|
|
413
427
|
// @public
|
|
414
|
-
export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<
|
|
428
|
+
export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>> = {
|
|
415
429
|
readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
|
|
416
430
|
} & {
|
|
417
431
|
readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends true ? Property : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
|
|
@@ -452,7 +466,6 @@ declare namespace InternalTypes {
|
|
|
452
466
|
ApplyKind,
|
|
453
467
|
NodeBuilderData,
|
|
454
468
|
FieldHasDefault,
|
|
455
|
-
TreeNodeSchemaNonClass,
|
|
456
469
|
TreeArrayNodeBase,
|
|
457
470
|
ScopedSchemaName,
|
|
458
471
|
DefaultProvider,
|
|
@@ -520,8 +533,7 @@ export class IterableTreeArrayContent<T> implements Iterable<T> {
|
|
|
520
533
|
}
|
|
521
534
|
|
|
522
535
|
// @public @sealed
|
|
523
|
-
export interface ITree extends IFluidLoadable {
|
|
524
|
-
viewWith<TRoot extends ImplicitFieldSchema>(config: TreeViewConfiguration<TRoot>): TreeView<TRoot>;
|
|
536
|
+
export interface ITree extends ViewableTree, IFluidLoadable {
|
|
525
537
|
}
|
|
526
538
|
|
|
527
539
|
// @public
|
|
@@ -537,15 +549,15 @@ export interface ITreeViewConfiguration<TSchema extends ImplicitFieldSchema = Im
|
|
|
537
549
|
|
|
538
550
|
// @alpha @sealed
|
|
539
551
|
export interface JsonArrayNodeSchema extends JsonNodeSchemaBase<NodeKind.Array, "array"> {
|
|
540
|
-
readonly items:
|
|
541
|
-
anyOf: JsonSchemaRef[];
|
|
542
|
-
};
|
|
552
|
+
readonly items: JsonFieldSchema;
|
|
543
553
|
}
|
|
544
554
|
|
|
545
555
|
// @alpha @sealed
|
|
546
|
-
export
|
|
556
|
+
export type JsonFieldSchema = {
|
|
557
|
+
readonly description?: string | undefined;
|
|
558
|
+
} & ({
|
|
547
559
|
readonly anyOf: JsonSchemaRef[];
|
|
548
|
-
}
|
|
560
|
+
} | JsonSchemaRef);
|
|
549
561
|
|
|
550
562
|
// @alpha @sealed
|
|
551
563
|
export interface JsonLeafNodeSchema extends JsonNodeSchemaBase<NodeKind.Leaf, JsonLeafSchemaType> {
|
|
@@ -593,9 +605,9 @@ export interface JsonSchemaRef {
|
|
|
593
605
|
export type JsonSchemaType = "object" | "array" | JsonLeafSchemaType;
|
|
594
606
|
|
|
595
607
|
// @alpha @sealed
|
|
596
|
-
export
|
|
608
|
+
export type JsonTreeSchema = JsonFieldSchema & {
|
|
597
609
|
readonly $defs: Record<JsonSchemaId, JsonNodeSchema>;
|
|
598
|
-
}
|
|
610
|
+
};
|
|
599
611
|
|
|
600
612
|
// @public
|
|
601
613
|
export type LazyItem<Item = unknown> = Item | (() => Item);
|
|
@@ -615,7 +627,7 @@ export interface MakeNominal {
|
|
|
615
627
|
}
|
|
616
628
|
|
|
617
629
|
// @public
|
|
618
|
-
export type MapNodeInsertableData<T extends ImplicitAllowedTypes> = Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]> |
|
|
630
|
+
export type MapNodeInsertableData<T extends ImplicitAllowedTypes> = Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]> | RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;
|
|
619
631
|
|
|
620
632
|
// @public
|
|
621
633
|
export type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
|
|
@@ -659,12 +671,12 @@ export enum NodeKind {
|
|
|
659
671
|
}
|
|
660
672
|
|
|
661
673
|
// @public
|
|
662
|
-
type ObjectFromSchemaRecord<T extends
|
|
663
|
-
-readonly [Property in keyof T]: TreeFieldFromImplicitField<T[Property]
|
|
674
|
+
type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = {
|
|
675
|
+
-readonly [Property in keyof T]: Property extends string ? TreeFieldFromImplicitField<T[Property]> : unknown;
|
|
664
676
|
};
|
|
665
677
|
|
|
666
678
|
// @public
|
|
667
|
-
type ObjectFromSchemaRecordUnsafe<T extends Unenforced<
|
|
679
|
+
type ObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>> = {
|
|
668
680
|
-readonly [Property in keyof T]: TreeFieldFromImplicitFieldUnsafe<T[Property]>;
|
|
669
681
|
};
|
|
670
682
|
|
|
@@ -692,11 +704,18 @@ export type ReplaceIEventThisPlaceHolder<L extends any[], TThis> = L extends any
|
|
|
692
704
|
[K in keyof L]: L[K] extends IEventThisPlaceHolder ? TThis : L[K];
|
|
693
705
|
} : L;
|
|
694
706
|
|
|
695
|
-
// @public
|
|
707
|
+
// @public @deprecated
|
|
696
708
|
export type RestrictiveReadonlyRecord<K extends symbol | string, T> = {
|
|
697
709
|
readonly [P in symbol | string]: P extends K ? T : never;
|
|
698
710
|
};
|
|
699
711
|
|
|
712
|
+
// @public
|
|
713
|
+
export type RestrictiveStringRecord<T> = {
|
|
714
|
+
readonly [P in string]: T;
|
|
715
|
+
} & {
|
|
716
|
+
readonly [P in symbol]?: never;
|
|
717
|
+
};
|
|
718
|
+
|
|
700
719
|
// @public @sealed
|
|
701
720
|
export interface Revertible {
|
|
702
721
|
dispose(): void;
|
|
@@ -745,7 +764,7 @@ export interface SchemaCompatibilityStatus {
|
|
|
745
764
|
// @public @sealed
|
|
746
765
|
export class SchemaFactory<out TScope extends string | undefined = string | undefined, TName extends number | string = string> {
|
|
747
766
|
constructor(scope: TScope);
|
|
748
|
-
array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T):
|
|
767
|
+
array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array, TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true, T>;
|
|
749
768
|
array<const Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true, T>;
|
|
750
769
|
arrayRecursive<const Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array, unknown>, {
|
|
751
770
|
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
@@ -753,7 +772,7 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
753
772
|
readonly boolean: TreeNodeSchema<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean>;
|
|
754
773
|
readonly handle: TreeNodeSchema<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>>;
|
|
755
774
|
get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
|
|
756
|
-
map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T):
|
|
775
|
+
map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map>, MapNodeInsertableData<T>, true, T>;
|
|
757
776
|
map<Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>, MapNodeInsertableData<T>, true, T>;
|
|
758
777
|
mapRecursive<Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map, unknown>, {
|
|
759
778
|
[Symbol.iterator](): Iterator<[
|
|
@@ -763,11 +782,11 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
763
782
|
}, false, T>;
|
|
764
783
|
readonly null: TreeNodeSchema<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null>;
|
|
765
784
|
readonly number: TreeNodeSchema<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
|
|
766
|
-
object<const Name extends TName, const T extends
|
|
767
|
-
objectRecursive<const Name extends TName, const T extends Unenforced<
|
|
768
|
-
optional<const T extends ImplicitAllowedTypes>(t: T, props?: Omit<FieldProps
|
|
785
|
+
object<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchema>>(name: Name, fields: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNode<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecord<T>, true, T>;
|
|
786
|
+
objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveStringRecord<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>;
|
|
787
|
+
optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
769
788
|
optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Optional, T>;
|
|
770
|
-
required<const T extends ImplicitAllowedTypes>(t: T, props?: Omit<FieldProps
|
|
789
|
+
required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
771
790
|
requiredRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Required, T>;
|
|
772
791
|
// (undocumented)
|
|
773
792
|
readonly scope: TScope;
|
|
@@ -827,14 +846,14 @@ interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<
|
|
|
827
846
|
insertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
828
847
|
moveRangeToEnd(sourceStart: number, sourceEnd: number): void;
|
|
829
848
|
moveRangeToEnd(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;
|
|
830
|
-
moveRangeToIndex(
|
|
831
|
-
moveRangeToIndex(
|
|
849
|
+
moveRangeToIndex(destinationGap: number, sourceStart: number, sourceEnd: number): void;
|
|
850
|
+
moveRangeToIndex(destinationGap: number, sourceStart: number, sourceEnd: number, source: TMoveFrom): void;
|
|
832
851
|
moveRangeToStart(sourceStart: number, sourceEnd: number): void;
|
|
833
852
|
moveRangeToStart(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;
|
|
834
853
|
moveToEnd(sourceIndex: number): void;
|
|
835
854
|
moveToEnd(sourceIndex: number, source: TMoveFrom): void;
|
|
836
|
-
moveToIndex(
|
|
837
|
-
moveToIndex(
|
|
855
|
+
moveToIndex(destinationGap: number, sourceIndex: number): void;
|
|
856
|
+
moveToIndex(destinationGap: number, sourceIndex: number, source: TMoveFrom): void;
|
|
838
857
|
moveToStart(sourceIndex: number): void;
|
|
839
858
|
moveToStart(sourceIndex: number, source: TMoveFrom): void;
|
|
840
859
|
removeAt(index: number): void;
|
|
@@ -851,6 +870,19 @@ export const TreeBeta: {
|
|
|
851
870
|
readonly on: <K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>) => () => void;
|
|
852
871
|
};
|
|
853
872
|
|
|
873
|
+
// @alpha @sealed
|
|
874
|
+
export interface TreeBranch extends ViewableTree {
|
|
875
|
+
branch(): TreeBranchFork;
|
|
876
|
+
merge(branch: TreeBranchFork): void;
|
|
877
|
+
merge(branch: TreeBranchFork, disposeMerged: boolean): void;
|
|
878
|
+
rebase(branch: TreeBranchFork): void;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
// @alpha @sealed
|
|
882
|
+
export interface TreeBranchFork extends TreeBranch, IDisposable {
|
|
883
|
+
rebaseOnto(branch: TreeBranch): void;
|
|
884
|
+
}
|
|
885
|
+
|
|
854
886
|
// @public @sealed
|
|
855
887
|
export interface TreeChangeEvents {
|
|
856
888
|
nodeChanged(unstable?: unknown): void;
|
|
@@ -925,6 +957,7 @@ export interface TreeNodeSchemaClass<out Name extends string = string, out Kind
|
|
|
925
957
|
|
|
926
958
|
// @public @sealed
|
|
927
959
|
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown> {
|
|
960
|
+
readonly childTypes: ReadonlySet<TreeNodeSchema>;
|
|
928
961
|
readonly identifier: Name;
|
|
929
962
|
readonly implicitlyConstructable: ImplicitlyConstructable;
|
|
930
963
|
readonly info: Info;
|
|
@@ -933,16 +966,16 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
933
966
|
}
|
|
934
967
|
|
|
935
968
|
// @public @sealed
|
|
936
|
-
interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
969
|
+
export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
937
970
|
// (undocumented)
|
|
938
971
|
create(data: TInsertable): TNode;
|
|
939
972
|
}
|
|
940
973
|
|
|
941
974
|
// @public
|
|
942
|
-
export type TreeObjectNode<T extends
|
|
975
|
+
export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
|
|
943
976
|
|
|
944
977
|
// @public
|
|
945
|
-
export type TreeObjectNodeUnsafe<T extends Unenforced<
|
|
978
|
+
export type TreeObjectNodeUnsafe<T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object>;
|
|
946
979
|
|
|
947
980
|
// @public
|
|
948
981
|
export enum TreeStatus {
|
|
@@ -959,6 +992,7 @@ export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposab
|
|
|
959
992
|
initialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;
|
|
960
993
|
get root(): TreeFieldFromImplicitField<TSchema>;
|
|
961
994
|
set root(newRoot: InsertableTreeFieldFromImplicitField<TSchema>);
|
|
995
|
+
readonly schema: TSchema;
|
|
962
996
|
upgradeSchema(): void;
|
|
963
997
|
}
|
|
964
998
|
|
|
@@ -993,15 +1027,20 @@ export type Unhydrated<T> = T;
|
|
|
993
1027
|
|
|
994
1028
|
// @public
|
|
995
1029
|
export type ValidateRecursiveSchema<T extends TreeNodeSchemaClass<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
|
|
996
|
-
[NodeKind.Object]: T["info"] extends
|
|
1030
|
+
[NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
|
|
997
1031
|
[NodeKind.Array]: T["info"] extends ImplicitAllowedTypes ? Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>> : unknown;
|
|
998
1032
|
[NodeKind.Map]: T["info"] extends ImplicitAllowedTypes ? Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>]> : unknown;
|
|
999
1033
|
}[T["kind"]], false, {
|
|
1000
|
-
[NodeKind.Object]:
|
|
1034
|
+
[NodeKind.Object]: RestrictiveStringRecord<ImplicitFieldSchema>;
|
|
1001
1035
|
[NodeKind.Array]: ImplicitAllowedTypes;
|
|
1002
1036
|
[NodeKind.Map]: ImplicitAllowedTypes;
|
|
1003
1037
|
}[T["kind"]]>> = true;
|
|
1004
1038
|
|
|
1039
|
+
// @public @sealed
|
|
1040
|
+
export interface ViewableTree {
|
|
1041
|
+
viewWith<TRoot extends ImplicitFieldSchema>(config: TreeViewConfiguration<TRoot>): TreeView<TRoot>;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1005
1044
|
// @public @sealed
|
|
1006
1045
|
export interface WithType<out TName extends string = string, out TKind extends NodeKind = NodeKind, out TInfo = unknown> {
|
|
1007
1046
|
// @deprecated
|
|
@@ -89,21 +89,29 @@ export enum FieldKind {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// @public
|
|
92
|
-
export interface FieldProps {
|
|
92
|
+
export interface FieldProps<TCustomMetadata = unknown> {
|
|
93
93
|
readonly defaultProvider?: DefaultProvider;
|
|
94
94
|
readonly key?: string;
|
|
95
|
+
readonly metadata?: FieldSchemaMetadata<TCustomMetadata>;
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
// @public @sealed
|
|
98
|
-
export class FieldSchema<out Kind extends FieldKind = FieldKind, out Types extends ImplicitAllowedTypes = ImplicitAllowedTypes> {
|
|
99
|
+
export class FieldSchema<out Kind extends FieldKind = FieldKind, out Types extends ImplicitAllowedTypes = ImplicitAllowedTypes, out TCustomMetadata = unknown> {
|
|
99
100
|
readonly allowedTypes: Types;
|
|
100
101
|
get allowedTypeSet(): ReadonlySet<TreeNodeSchema>;
|
|
101
102
|
readonly kind: Kind;
|
|
102
|
-
|
|
103
|
+
get metadata(): FieldSchemaMetadata<TCustomMetadata> | undefined;
|
|
104
|
+
readonly props?: FieldProps<TCustomMetadata> | undefined;
|
|
103
105
|
readonly requiresValue: boolean;
|
|
104
106
|
protected _typeCheck: MakeNominal;
|
|
105
107
|
}
|
|
106
108
|
|
|
109
|
+
// @public @sealed
|
|
110
|
+
export interface FieldSchemaMetadata<TCustomMetadata = unknown> {
|
|
111
|
+
readonly custom?: TCustomMetadata;
|
|
112
|
+
readonly description?: string | undefined;
|
|
113
|
+
}
|
|
114
|
+
|
|
107
115
|
// @public
|
|
108
116
|
export interface FieldSchemaUnsafe<out Kind extends FieldKind, out Types extends Unenforced<ImplicitAllowedTypes>> extends FieldSchema<Kind, any> {
|
|
109
117
|
readonly allowedTypes: Types;
|
|
@@ -398,14 +406,14 @@ export type InitialObjects<T extends ContainerSchema> = {
|
|
|
398
406
|
type _InlineTrick = 0;
|
|
399
407
|
|
|
400
408
|
// @public
|
|
401
|
-
type InsertableObjectFromSchemaRecord<T extends
|
|
402
|
-
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property]>;
|
|
409
|
+
type InsertableObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = FlattenKeys<{
|
|
410
|
+
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property] & string>;
|
|
403
411
|
} & {
|
|
404
|
-
readonly [Property in keyof T as FieldHasDefault<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitField<T[Property]>;
|
|
412
|
+
readonly [Property in keyof T as FieldHasDefault<T[Property] & string> extends false ? Property : never]: InsertableTreeFieldFromImplicitField<T[Property] & string>;
|
|
405
413
|
}>;
|
|
406
414
|
|
|
407
415
|
// @public
|
|
408
|
-
export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<
|
|
416
|
+
export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>> = {
|
|
409
417
|
readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
|
|
410
418
|
} & {
|
|
411
419
|
readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends true ? Property : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
|
|
@@ -446,7 +454,6 @@ declare namespace InternalTypes {
|
|
|
446
454
|
ApplyKind,
|
|
447
455
|
NodeBuilderData,
|
|
448
456
|
FieldHasDefault,
|
|
449
|
-
TreeNodeSchemaNonClass,
|
|
450
457
|
TreeArrayNodeBase,
|
|
451
458
|
ScopedSchemaName,
|
|
452
459
|
DefaultProvider,
|
|
@@ -514,8 +521,7 @@ export class IterableTreeArrayContent<T> implements Iterable<T> {
|
|
|
514
521
|
}
|
|
515
522
|
|
|
516
523
|
// @public @sealed
|
|
517
|
-
export interface ITree extends IFluidLoadable {
|
|
518
|
-
viewWith<TRoot extends ImplicitFieldSchema>(config: TreeViewConfiguration<TRoot>): TreeView<TRoot>;
|
|
524
|
+
export interface ITree extends ViewableTree, IFluidLoadable {
|
|
519
525
|
}
|
|
520
526
|
|
|
521
527
|
// @public
|
|
@@ -547,7 +553,7 @@ export interface MakeNominal {
|
|
|
547
553
|
}
|
|
548
554
|
|
|
549
555
|
// @public
|
|
550
|
-
export type MapNodeInsertableData<T extends ImplicitAllowedTypes> = Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]> |
|
|
556
|
+
export type MapNodeInsertableData<T extends ImplicitAllowedTypes> = Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]> | RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;
|
|
551
557
|
|
|
552
558
|
// @public
|
|
553
559
|
export type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
|
|
@@ -591,12 +597,12 @@ export enum NodeKind {
|
|
|
591
597
|
}
|
|
592
598
|
|
|
593
599
|
// @public
|
|
594
|
-
type ObjectFromSchemaRecord<T extends
|
|
595
|
-
-readonly [Property in keyof T]: TreeFieldFromImplicitField<T[Property]
|
|
600
|
+
type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = {
|
|
601
|
+
-readonly [Property in keyof T]: Property extends string ? TreeFieldFromImplicitField<T[Property]> : unknown;
|
|
596
602
|
};
|
|
597
603
|
|
|
598
604
|
// @public
|
|
599
|
-
type ObjectFromSchemaRecordUnsafe<T extends Unenforced<
|
|
605
|
+
type ObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>> = {
|
|
600
606
|
-readonly [Property in keyof T]: TreeFieldFromImplicitFieldUnsafe<T[Property]>;
|
|
601
607
|
};
|
|
602
608
|
|
|
@@ -624,11 +630,18 @@ export type ReplaceIEventThisPlaceHolder<L extends any[], TThis> = L extends any
|
|
|
624
630
|
[K in keyof L]: L[K] extends IEventThisPlaceHolder ? TThis : L[K];
|
|
625
631
|
} : L;
|
|
626
632
|
|
|
627
|
-
// @public
|
|
633
|
+
// @public @deprecated
|
|
628
634
|
export type RestrictiveReadonlyRecord<K extends symbol | string, T> = {
|
|
629
635
|
readonly [P in symbol | string]: P extends K ? T : never;
|
|
630
636
|
};
|
|
631
637
|
|
|
638
|
+
// @public
|
|
639
|
+
export type RestrictiveStringRecord<T> = {
|
|
640
|
+
readonly [P in string]: T;
|
|
641
|
+
} & {
|
|
642
|
+
readonly [P in symbol]?: never;
|
|
643
|
+
};
|
|
644
|
+
|
|
632
645
|
// @public @sealed
|
|
633
646
|
export interface Revertible {
|
|
634
647
|
dispose(): void;
|
|
@@ -677,7 +690,7 @@ export interface SchemaCompatibilityStatus {
|
|
|
677
690
|
// @public @sealed
|
|
678
691
|
export class SchemaFactory<out TScope extends string | undefined = string | undefined, TName extends number | string = string> {
|
|
679
692
|
constructor(scope: TScope);
|
|
680
|
-
array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T):
|
|
693
|
+
array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array, TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, `Array<${string}>`>, NodeKind.Array>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true, T>;
|
|
681
694
|
array<const Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true, T>;
|
|
682
695
|
arrayRecursive<const Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array, unknown>, {
|
|
683
696
|
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
@@ -685,7 +698,7 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
685
698
|
readonly boolean: TreeNodeSchema<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean>;
|
|
686
699
|
readonly handle: TreeNodeSchema<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>>;
|
|
687
700
|
get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
|
|
688
|
-
map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T):
|
|
701
|
+
map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map>, MapNodeInsertableData<T>, true, T>;
|
|
689
702
|
map<Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>, MapNodeInsertableData<T>, true, T>;
|
|
690
703
|
mapRecursive<Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map, unknown>, {
|
|
691
704
|
[Symbol.iterator](): Iterator<[
|
|
@@ -695,11 +708,11 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
695
708
|
}, false, T>;
|
|
696
709
|
readonly null: TreeNodeSchema<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null>;
|
|
697
710
|
readonly number: TreeNodeSchema<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
|
|
698
|
-
object<const Name extends TName, const T extends
|
|
699
|
-
objectRecursive<const Name extends TName, const T extends Unenforced<
|
|
700
|
-
optional<const T extends ImplicitAllowedTypes>(t: T, props?: Omit<FieldProps
|
|
711
|
+
object<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchema>>(name: Name, fields: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNode<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecord<T>, true, T>;
|
|
712
|
+
objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveStringRecord<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>;
|
|
713
|
+
optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
701
714
|
optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Optional, T>;
|
|
702
|
-
required<const T extends ImplicitAllowedTypes>(t: T, props?: Omit<FieldProps
|
|
715
|
+
required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
703
716
|
requiredRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Required, T>;
|
|
704
717
|
// (undocumented)
|
|
705
718
|
readonly scope: TScope;
|
|
@@ -759,14 +772,14 @@ interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<
|
|
|
759
772
|
insertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
760
773
|
moveRangeToEnd(sourceStart: number, sourceEnd: number): void;
|
|
761
774
|
moveRangeToEnd(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;
|
|
762
|
-
moveRangeToIndex(
|
|
763
|
-
moveRangeToIndex(
|
|
775
|
+
moveRangeToIndex(destinationGap: number, sourceStart: number, sourceEnd: number): void;
|
|
776
|
+
moveRangeToIndex(destinationGap: number, sourceStart: number, sourceEnd: number, source: TMoveFrom): void;
|
|
764
777
|
moveRangeToStart(sourceStart: number, sourceEnd: number): void;
|
|
765
778
|
moveRangeToStart(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;
|
|
766
779
|
moveToEnd(sourceIndex: number): void;
|
|
767
780
|
moveToEnd(sourceIndex: number, source: TMoveFrom): void;
|
|
768
|
-
moveToIndex(
|
|
769
|
-
moveToIndex(
|
|
781
|
+
moveToIndex(destinationGap: number, sourceIndex: number): void;
|
|
782
|
+
moveToIndex(destinationGap: number, sourceIndex: number, source: TMoveFrom): void;
|
|
770
783
|
moveToStart(sourceIndex: number): void;
|
|
771
784
|
moveToStart(sourceIndex: number, source: TMoveFrom): void;
|
|
772
785
|
removeAt(index: number): void;
|
|
@@ -857,6 +870,7 @@ export interface TreeNodeSchemaClass<out Name extends string = string, out Kind
|
|
|
857
870
|
|
|
858
871
|
// @public @sealed
|
|
859
872
|
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown> {
|
|
873
|
+
readonly childTypes: ReadonlySet<TreeNodeSchema>;
|
|
860
874
|
readonly identifier: Name;
|
|
861
875
|
readonly implicitlyConstructable: ImplicitlyConstructable;
|
|
862
876
|
readonly info: Info;
|
|
@@ -865,16 +879,16 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
865
879
|
}
|
|
866
880
|
|
|
867
881
|
// @public @sealed
|
|
868
|
-
interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
882
|
+
export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
869
883
|
// (undocumented)
|
|
870
884
|
create(data: TInsertable): TNode;
|
|
871
885
|
}
|
|
872
886
|
|
|
873
887
|
// @public
|
|
874
|
-
export type TreeObjectNode<T extends
|
|
888
|
+
export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
|
|
875
889
|
|
|
876
890
|
// @public
|
|
877
|
-
export type TreeObjectNodeUnsafe<T extends Unenforced<
|
|
891
|
+
export type TreeObjectNodeUnsafe<T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object>;
|
|
878
892
|
|
|
879
893
|
// @public
|
|
880
894
|
export enum TreeStatus {
|
|
@@ -891,6 +905,7 @@ export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposab
|
|
|
891
905
|
initialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;
|
|
892
906
|
get root(): TreeFieldFromImplicitField<TSchema>;
|
|
893
907
|
set root(newRoot: InsertableTreeFieldFromImplicitField<TSchema>);
|
|
908
|
+
readonly schema: TSchema;
|
|
894
909
|
upgradeSchema(): void;
|
|
895
910
|
}
|
|
896
911
|
|
|
@@ -925,15 +940,20 @@ export type Unhydrated<T> = T;
|
|
|
925
940
|
|
|
926
941
|
// @public
|
|
927
942
|
export type ValidateRecursiveSchema<T extends TreeNodeSchemaClass<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
|
|
928
|
-
[NodeKind.Object]: T["info"] extends
|
|
943
|
+
[NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
|
|
929
944
|
[NodeKind.Array]: T["info"] extends ImplicitAllowedTypes ? Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>> : unknown;
|
|
930
945
|
[NodeKind.Map]: T["info"] extends ImplicitAllowedTypes ? Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>]> : unknown;
|
|
931
946
|
}[T["kind"]], false, {
|
|
932
|
-
[NodeKind.Object]:
|
|
947
|
+
[NodeKind.Object]: RestrictiveStringRecord<ImplicitFieldSchema>;
|
|
933
948
|
[NodeKind.Array]: ImplicitAllowedTypes;
|
|
934
949
|
[NodeKind.Map]: ImplicitAllowedTypes;
|
|
935
950
|
}[T["kind"]]>> = true;
|
|
936
951
|
|
|
952
|
+
// @public @sealed
|
|
953
|
+
export interface ViewableTree {
|
|
954
|
+
viewWith<TRoot extends ImplicitFieldSchema>(config: TreeViewConfiguration<TRoot>): TreeView<TRoot>;
|
|
955
|
+
}
|
|
956
|
+
|
|
937
957
|
// @public @sealed
|
|
938
958
|
export interface WithType<out TName extends string = string, out TKind extends NodeKind = NodeKind, out TInfo = unknown> {
|
|
939
959
|
// @deprecated
|