fluid-framework 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +301 -0
- package/api-report/fluid-framework.alpha.api.md +271 -80
- package/api-report/fluid-framework.beta.api.md +100 -51
- package/api-report/fluid-framework.legacy.alpha.api.md +99 -50
- package/api-report/fluid-framework.legacy.public.api.md +99 -50
- package/api-report/fluid-framework.public.api.md +99 -50
- package/dist/alpha.d.ts +32 -2
- package/dist/beta.d.ts +6 -0
- package/dist/legacy.d.ts +6 -0
- package/dist/public.d.ts +6 -0
- package/lib/alpha.d.ts +32 -2
- package/lib/beta.d.ts +6 -0
- package/lib/legacy.d.ts +6 -0
- package/lib/public.d.ts +6 -0
- package/package.json +14 -14
|
@@ -9,20 +9,33 @@ export function adaptEnum<TScope extends string, const TEnum extends Record<stri
|
|
|
9
9
|
readonly value: TValue;
|
|
10
10
|
}) & { readonly [Property in keyof TEnum]: TreeNodeSchemaClass<ScopedSchemaName<TScope, TEnum[Property]>, NodeKind.Object, TreeNode & {
|
|
11
11
|
readonly value: TEnum[Property];
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
};
|
|
15
17
|
|
|
16
18
|
// @public
|
|
17
19
|
export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
|
|
18
20
|
|
|
19
21
|
// @public
|
|
20
|
-
type
|
|
22
|
+
type AllowedTypesUnsafe = readonly LazyItem<TreeNodeSchemaUnsafe>[];
|
|
23
|
+
|
|
24
|
+
// @public
|
|
25
|
+
type ApplyKind<T, Kind extends FieldKind> = {
|
|
21
26
|
[FieldKind.Required]: T;
|
|
22
27
|
[FieldKind.Optional]: T | undefined;
|
|
23
|
-
[FieldKind.Identifier]:
|
|
28
|
+
[FieldKind.Identifier]: T;
|
|
24
29
|
}[Kind];
|
|
25
30
|
|
|
31
|
+
// @public
|
|
32
|
+
type ApplyKindInput<T, Kind extends FieldKind, DefaultsAreOptional extends boolean> = [
|
|
33
|
+
Kind
|
|
34
|
+
] extends [FieldKind.Required] ? T : [Kind] extends [FieldKind.Optional] ? T | undefined : [Kind] extends [FieldKind.Identifier] ? DefaultsAreOptional extends true ? T | undefined : T : never;
|
|
35
|
+
|
|
36
|
+
// @alpha
|
|
37
|
+
export function asTreeViewAlpha<TSchema extends ImplicitFieldSchema>(view: TreeView<TSchema>): TreeViewAlpha<TSchema>;
|
|
38
|
+
|
|
26
39
|
// @public
|
|
27
40
|
export enum AttachState {
|
|
28
41
|
Attached = "Attached",
|
|
@@ -30,6 +43,14 @@ export enum AttachState {
|
|
|
30
43
|
Detached = "Detached"
|
|
31
44
|
}
|
|
32
45
|
|
|
46
|
+
// @alpha @sealed
|
|
47
|
+
export interface BranchableTree extends ViewableTree {
|
|
48
|
+
branch(): TreeBranchFork;
|
|
49
|
+
merge(branch: TreeBranchFork): void;
|
|
50
|
+
merge(branch: TreeBranchFork, disposeMerged: boolean): void;
|
|
51
|
+
rebase(branch: TreeBranchFork): void;
|
|
52
|
+
}
|
|
53
|
+
|
|
33
54
|
// @public
|
|
34
55
|
export enum CommitKind {
|
|
35
56
|
Default = 0,
|
|
@@ -46,6 +67,11 @@ export interface CommitMetadata {
|
|
|
46
67
|
// @alpha
|
|
47
68
|
export function comparePersistedSchema(persisted: JsonCompatible, view: JsonCompatible, options: ICodecOptions, canInitialize: boolean): SchemaCompatibilityStatus;
|
|
48
69
|
|
|
70
|
+
// @alpha
|
|
71
|
+
export type ConciseTree<THandle = IFluidHandle> = Exclude<TreeLeafValue, IFluidHandle> | THandle | ConciseTree<THandle>[] | {
|
|
72
|
+
[key: string]: ConciseTree<THandle>;
|
|
73
|
+
};
|
|
74
|
+
|
|
49
75
|
// @alpha
|
|
50
76
|
export function configuredSharedTree(options: SharedTreeOptions): SharedObjectKind<ITree>;
|
|
51
77
|
|
|
@@ -82,13 +108,21 @@ interface DefaultProvider extends ErasedType<"@fluidframework/tree.FieldProvider
|
|
|
82
108
|
}
|
|
83
109
|
|
|
84
110
|
// @alpha
|
|
85
|
-
export
|
|
111
|
+
export interface EncodeOptions<TCustom> {
|
|
112
|
+
readonly useStoredKeys?: boolean;
|
|
113
|
+
valueConverter(data: IFluidHandle): TCustom;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// @alpha
|
|
117
|
+
export function enumFromStrings<TScope extends string, const Members extends readonly string[]>(factory: SchemaFactory<TScope>, members: Members): (<TValue extends Members[number]>(value: TValue) => TreeNode & {
|
|
86
118
|
readonly value: TValue;
|
|
87
|
-
}) & Record<Members, TreeNodeSchemaClass<ScopedSchemaName<TScope, Members>, NodeKind.Object, TreeNode & {
|
|
88
|
-
readonly value: Members;
|
|
89
|
-
},
|
|
90
|
-
readonly
|
|
91
|
-
|
|
119
|
+
}) & Record<Members[number], TreeNodeSchemaClass<ScopedSchemaName<TScope, Members[number]>, NodeKind.Object, TreeNode & {
|
|
120
|
+
readonly value: Members[number];
|
|
121
|
+
}, Record<string, never>, true, Record<string, never>, undefined>> & {
|
|
122
|
+
readonly schema: UnionToTuple<Record<Members[number], TreeNodeSchemaClass<ScopedSchemaName<TScope, Members[number]>, NodeKind.Object, TreeNode & {
|
|
123
|
+
readonly value: Members[number];
|
|
124
|
+
}, Record<string, never>, true, Record<string, never>, undefined>>[Members[number]]>;
|
|
125
|
+
};
|
|
92
126
|
|
|
93
127
|
// @public @sealed
|
|
94
128
|
export abstract class ErasedType<out Name = unknown> {
|
|
@@ -102,6 +136,14 @@ type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result ?
|
|
|
102
136
|
// @alpha
|
|
103
137
|
export function extractPersistedSchema(schema: ImplicitFieldSchema): JsonCompatible;
|
|
104
138
|
|
|
139
|
+
// @alpha
|
|
140
|
+
export type FactoryContent = IFluidHandle | string | number | boolean | null | Iterable<readonly [string, InsertableContent]> | readonly InsertableContent[] | FactoryContentObject;
|
|
141
|
+
|
|
142
|
+
// @alpha
|
|
143
|
+
export type FactoryContentObject = {
|
|
144
|
+
readonly [P in string]?: InsertableContent;
|
|
145
|
+
};
|
|
146
|
+
|
|
105
147
|
// @public
|
|
106
148
|
type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<FieldKind.Optional | FieldKind.Identifier> ? true : false;
|
|
107
149
|
|
|
@@ -160,6 +202,14 @@ type FlexList<Item = unknown> = readonly LazyItem<Item>[];
|
|
|
160
202
|
// @public
|
|
161
203
|
type FlexListToUnion<TList extends FlexList> = ExtractItemType<TList[number]>;
|
|
162
204
|
|
|
205
|
+
// @alpha
|
|
206
|
+
export enum FluidClientVersion {
|
|
207
|
+
v2_0 = "v2_0",
|
|
208
|
+
v2_1 = "v2_1",
|
|
209
|
+
v2_2 = "v2_2",
|
|
210
|
+
v2_3 = "v2_3"
|
|
211
|
+
}
|
|
212
|
+
|
|
163
213
|
// @public
|
|
164
214
|
export type FluidObject<T = unknown> = {
|
|
165
215
|
[P in FluidObjectProviderKeys<T>]?: T[P];
|
|
@@ -180,11 +230,11 @@ export enum ForestType {
|
|
|
180
230
|
Reference = 0
|
|
181
231
|
}
|
|
182
232
|
|
|
183
|
-
// @alpha
|
|
184
|
-
export function getBranch(tree: ITree):
|
|
233
|
+
// @alpha @deprecated
|
|
234
|
+
export function getBranch(tree: ITree): BranchableTree;
|
|
185
235
|
|
|
186
|
-
// @alpha
|
|
187
|
-
export function getBranch(view:
|
|
236
|
+
// @alpha @deprecated
|
|
237
|
+
export function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(view: TreeViewAlpha<T>): BranchableTree;
|
|
188
238
|
|
|
189
239
|
// @alpha
|
|
190
240
|
export function getJsonSchema(schema: ImplicitFieldSchema): JsonTreeSchema;
|
|
@@ -453,6 +503,14 @@ export type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;
|
|
|
453
503
|
// @public
|
|
454
504
|
export type ImplicitFieldSchema = FieldSchema | ImplicitAllowedTypes;
|
|
455
505
|
|
|
506
|
+
// @alpha
|
|
507
|
+
export function independentInitializedView<const TSchema extends ImplicitFieldSchema>(config: TreeViewConfiguration<TSchema>, options: ForestOptions & ICodecOptions, content: ViewContent): TreeViewAlpha<TSchema>;
|
|
508
|
+
|
|
509
|
+
// @alpha
|
|
510
|
+
export function independentView<const TSchema extends ImplicitFieldSchema>(config: TreeViewConfiguration<TSchema>, options: ForestOptions & {
|
|
511
|
+
idCompressor?: IIdCompressor_2 | undefined;
|
|
512
|
+
}): TreeViewAlpha<TSchema>;
|
|
513
|
+
|
|
456
514
|
// @public
|
|
457
515
|
export type InitialObjects<T extends ContainerSchema> = {
|
|
458
516
|
[K in keyof T["initialObjects"]]: T["initialObjects"][K] extends SharedObjectKind<infer TChannel> ? TChannel : never;
|
|
@@ -461,11 +519,25 @@ export type InitialObjects<T extends ContainerSchema> = {
|
|
|
461
519
|
// @public
|
|
462
520
|
type _InlineTrick = 0;
|
|
463
521
|
|
|
522
|
+
// @public
|
|
523
|
+
export type Input<T extends never> = T;
|
|
524
|
+
|
|
525
|
+
// @alpha
|
|
526
|
+
export type Insertable<TSchema extends ImplicitAllowedTypes | UnsafeUnknownSchema> = TSchema extends ImplicitAllowedTypes ? InsertableTreeNodeFromImplicitAllowedTypes<TSchema> : InsertableContent;
|
|
527
|
+
|
|
528
|
+
// @alpha
|
|
529
|
+
export type InsertableContent = Unhydrated<TreeNode> | FactoryContent;
|
|
530
|
+
|
|
531
|
+
// @alpha
|
|
532
|
+
export type InsertableField<TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> = [
|
|
533
|
+
TSchema
|
|
534
|
+
] extends [ImplicitFieldSchema] ? InsertableTreeFieldFromImplicitField<TSchema> : [TSchema] extends [UnsafeUnknownSchema] ? InsertableContent | undefined : never;
|
|
535
|
+
|
|
464
536
|
// @public
|
|
465
537
|
type InsertableObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = FlattenKeys<{
|
|
466
|
-
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property
|
|
538
|
+
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property & string]>;
|
|
467
539
|
} & {
|
|
468
|
-
readonly [Property in keyof T as FieldHasDefault<T[Property
|
|
540
|
+
readonly [Property in keyof T as FieldHasDefault<T[Property & string]> extends false ? Property : never]: InsertableTreeFieldFromImplicitField<T[Property & string]>;
|
|
469
541
|
}>;
|
|
470
542
|
|
|
471
543
|
// @public
|
|
@@ -476,28 +548,36 @@ export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<Restrict
|
|
|
476
548
|
};
|
|
477
549
|
|
|
478
550
|
// @public
|
|
479
|
-
export type InsertableTreeFieldFromImplicitField<
|
|
551
|
+
export type InsertableTreeFieldFromImplicitField<TSchemaInput extends ImplicitFieldSchema, TSchema = UnionToIntersection<TSchemaInput>> = [TSchema] extends [FieldSchema<infer Kind, infer Types>] ? ApplyKindInput<InsertableTreeNodeFromImplicitAllowedTypes<Types>, Kind, true> : [TSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TSchema> : never;
|
|
552
|
+
|
|
553
|
+
// @public
|
|
554
|
+
export type InsertableTreeFieldFromImplicitFieldUnsafe<TSchemaInput extends Unenforced<ImplicitFieldSchema>, TSchema = UnionToIntersection<TSchemaInput>> = [TSchema] extends [FieldSchemaUnsafe<infer Kind, infer Types>] ? ApplyKindInput<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true> : [TSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : never;
|
|
480
555
|
|
|
481
556
|
// @public
|
|
482
|
-
export type
|
|
557
|
+
export type InsertableTreeNodeFromAllowedTypes<TList extends AllowedTypes> = TList extends readonly [
|
|
558
|
+
LazyItem<infer TSchema extends TreeNodeSchema>,
|
|
559
|
+
...infer Rest extends AllowedTypes
|
|
560
|
+
] ? InsertableTypedNode<TSchema> | InsertableTreeNodeFromAllowedTypes<Rest> : never;
|
|
483
561
|
|
|
484
562
|
// @public
|
|
485
|
-
export type
|
|
563
|
+
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends Unenforced<AllowedTypesUnsafe>> = TList extends readonly [
|
|
564
|
+
LazyItem<infer TSchema extends TreeNodeSchemaUnsafe>,
|
|
565
|
+
...infer Rest extends AllowedTypesUnsafe
|
|
566
|
+
] ? InsertableTypedNodeUnsafe<TSchema> | InsertableTreeNodeFromAllowedTypesUnsafe<Rest> : never;
|
|
486
567
|
|
|
487
568
|
// @public
|
|
488
|
-
export type
|
|
569
|
+
export type InsertableTreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes> = [
|
|
570
|
+
TSchema
|
|
571
|
+
] extends [TreeNodeSchema] ? InsertableTypedNode<TSchema> : [TSchema] extends [AllowedTypes] ? InsertableTreeNodeFromAllowedTypes<TSchema> : never;
|
|
489
572
|
|
|
490
573
|
// @public
|
|
491
|
-
export type
|
|
492
|
-
implicitlyConstructable: true;
|
|
493
|
-
} ? NodeBuilderData<T> : never) | Unhydrated<NodeFromSchema<T>>;
|
|
574
|
+
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
|
|
494
575
|
|
|
495
576
|
// @public
|
|
496
|
-
type
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
][_InlineTrick];
|
|
577
|
+
export type InsertableTypedNode<TSchema extends TreeNodeSchema, T = UnionToIntersection<TSchema>> = (T extends TreeNodeSchema<string, NodeKind, TreeNode | TreeLeafValue, never, true> ? NodeBuilderData<T> : never) | (T extends TreeNodeSchema ? Unhydrated<TreeNode extends NodeFromSchema<T> ? never : NodeFromSchema<T>> : never);
|
|
578
|
+
|
|
579
|
+
// @public
|
|
580
|
+
type InsertableTypedNodeUnsafe<TSchema extends Unenforced<TreeNodeSchemaUnsafe>, T = UnionToIntersection<TSchema>> = (T extends TreeNodeSchemaUnsafe<string, NodeKind, TreeNode | TreeLeafValue, never, true> ? NodeBuilderDataUnsafe<T> : never) | (T extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<T> : never);
|
|
501
581
|
|
|
502
582
|
// @public @sealed
|
|
503
583
|
export interface InternalTreeNode extends ErasedType<"@fluidframework/tree.InternalTreeNode"> {
|
|
@@ -508,6 +588,7 @@ declare namespace InternalTypes {
|
|
|
508
588
|
_InlineTrick,
|
|
509
589
|
FlattenKeys,
|
|
510
590
|
ApplyKind,
|
|
591
|
+
ApplyKindInput,
|
|
511
592
|
NodeBuilderData,
|
|
512
593
|
FieldHasDefault,
|
|
513
594
|
TreeArrayNodeBase,
|
|
@@ -530,6 +611,9 @@ declare namespace InternalTypes {
|
|
|
530
611
|
NodeBuilderDataUnsafe,
|
|
531
612
|
NodeFromSchemaUnsafe,
|
|
532
613
|
ReadonlyMapInlined,
|
|
614
|
+
TreeNodeSchemaUnsafe,
|
|
615
|
+
AllowedTypesUnsafe,
|
|
616
|
+
TreeNodeSchemaNonClassUnsafe,
|
|
533
617
|
FlexList,
|
|
534
618
|
FlexListToUnion,
|
|
535
619
|
ExtractItemType,
|
|
@@ -566,6 +650,9 @@ export function isFluidHandle(value: unknown): value is IFluidHandle;
|
|
|
566
650
|
// @public
|
|
567
651
|
export type IsListener<TListener> = TListener extends (...args: any[]) => void ? true : false;
|
|
568
652
|
|
|
653
|
+
// @alpha
|
|
654
|
+
export type IsUnion<T, T2 = T> = T extends unknown ? [T2] extends [T] ? false : true : "error";
|
|
655
|
+
|
|
569
656
|
// @public
|
|
570
657
|
export interface ITelemetryBaseProperties {
|
|
571
658
|
[index: string]: TelemetryBaseEventPropertyType | Tagged<TelemetryBaseEventPropertyType>;
|
|
@@ -597,11 +684,11 @@ export interface JsonArrayNodeSchema extends JsonNodeSchemaBase<NodeKind.Array,
|
|
|
597
684
|
}
|
|
598
685
|
|
|
599
686
|
// @alpha
|
|
600
|
-
export type JsonCompatible = string | number | boolean | null | JsonCompatible[] | JsonCompatibleObject;
|
|
687
|
+
export type JsonCompatible<TExtra = never> = string | number | boolean | null | JsonCompatible<TExtra>[] | JsonCompatibleObject<TExtra> | TExtra;
|
|
601
688
|
|
|
602
689
|
// @alpha
|
|
603
|
-
export type JsonCompatibleObject = {
|
|
604
|
-
[P in string]?: JsonCompatible
|
|
690
|
+
export type JsonCompatibleObject<TExtra = never> = {
|
|
691
|
+
[P in string]?: JsonCompatible<TExtra>;
|
|
605
692
|
};
|
|
606
693
|
|
|
607
694
|
// @alpha @sealed
|
|
@@ -695,10 +782,10 @@ export type Myself<M extends IMember = IMember> = M & {
|
|
|
695
782
|
};
|
|
696
783
|
|
|
697
784
|
// @public
|
|
698
|
-
type NodeBuilderData<T extends
|
|
785
|
+
type NodeBuilderData<T extends TreeNodeSchemaCore<string, NodeKind, boolean>> = T extends TreeNodeSchemaCore<string, NodeKind, boolean, unknown, infer TBuild> ? TBuild : never;
|
|
699
786
|
|
|
700
787
|
// @public
|
|
701
|
-
type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends
|
|
788
|
+
type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchemaUnsafe<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
|
|
702
789
|
|
|
703
790
|
// @beta @sealed
|
|
704
791
|
export interface NodeChangedData<TNode extends TreeNode = TreeNode> {
|
|
@@ -709,7 +796,7 @@ export interface NodeChangedData<TNode extends TreeNode = TreeNode> {
|
|
|
709
796
|
export type NodeFromSchema<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;
|
|
710
797
|
|
|
711
798
|
// @public
|
|
712
|
-
type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends
|
|
799
|
+
type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchemaUnsafe<string, NodeKind, infer TNode> ? TNode : never;
|
|
713
800
|
|
|
714
801
|
// @public
|
|
715
802
|
export interface NodeInDocumentConstraint {
|
|
@@ -743,6 +830,22 @@ type ObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveStringRecord<I
|
|
|
743
830
|
// @public
|
|
744
831
|
export type Off = () => void;
|
|
745
832
|
|
|
833
|
+
// @alpha
|
|
834
|
+
export interface ParseOptions<TCustom> {
|
|
835
|
+
readonly useStoredKeys?: boolean;
|
|
836
|
+
valueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
// @alpha
|
|
840
|
+
export type PopUnion<Union, AsOverloadedFunction = UnionToIntersection<Union extends unknown ? (f: Union) => void : never>> = AsOverloadedFunction extends (a: infer First) => void ? First : never;
|
|
841
|
+
|
|
842
|
+
// @alpha
|
|
843
|
+
export type ReadableField<TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> = TreeFieldFromImplicitField<ReadSchema<TSchema>>;
|
|
844
|
+
|
|
845
|
+
// @public @sealed
|
|
846
|
+
export interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue> extends ReadonlyArray<T>, Awaited<TreeNode & WithType<string, NodeKind.Array>> {
|
|
847
|
+
}
|
|
848
|
+
|
|
746
849
|
// @public @sealed
|
|
747
850
|
interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes>> {
|
|
748
851
|
[Symbol.iterator](): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;
|
|
@@ -759,6 +862,11 @@ interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes>> {
|
|
|
759
862
|
values(): IterableIterator<TreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
760
863
|
}
|
|
761
864
|
|
|
865
|
+
// @alpha
|
|
866
|
+
export type ReadSchema<TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> = [
|
|
867
|
+
TSchema
|
|
868
|
+
] extends [ImplicitFieldSchema] ? TSchema : ImplicitFieldSchema;
|
|
869
|
+
|
|
762
870
|
// @public
|
|
763
871
|
export type ReplaceIEventThisPlaceHolder<L extends any[], TThis> = L extends any[] ? {
|
|
764
872
|
[K in keyof L]: L[K] extends IEventThisPlaceHolder ? TThis : L[K];
|
|
@@ -799,17 +907,17 @@ export const rollback: unique symbol;
|
|
|
799
907
|
// @public @sealed
|
|
800
908
|
export interface RunTransaction {
|
|
801
909
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult): TResult;
|
|
802
|
-
<TView extends TreeView<
|
|
910
|
+
<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult): TResult;
|
|
803
911
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback): TResult | typeof rollback;
|
|
804
|
-
<TView extends TreeView<
|
|
912
|
+
<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback): TResult | typeof rollback;
|
|
805
913
|
<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void): void;
|
|
806
|
-
<TView extends TreeView<
|
|
914
|
+
<TView extends TreeView<any>>(tree: TView, transaction: (root: TView["root"]) => void): void;
|
|
807
915
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
|
|
808
|
-
<TView extends TreeView<
|
|
916
|
+
<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
|
|
809
917
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
|
|
810
|
-
<TView extends TreeView<
|
|
918
|
+
<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
|
|
811
919
|
<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void, preconditions?: readonly TransactionConstraint[]): void;
|
|
812
|
-
<TView extends TreeView<
|
|
920
|
+
<TView extends TreeView<any>>(tree: TView, transaction: (root: TView["root"]) => void, preconditions?: readonly TransactionConstraint[]): void;
|
|
813
921
|
readonly rollback: typeof rollback;
|
|
814
922
|
}
|
|
815
923
|
|
|
@@ -824,33 +932,33 @@ export interface SchemaCompatibilityStatus {
|
|
|
824
932
|
// @public @sealed
|
|
825
933
|
export class SchemaFactory<out TScope extends string | undefined = string | undefined, TName extends number | string = string> {
|
|
826
934
|
constructor(scope: TScope);
|
|
827
|
-
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>;
|
|
828
|
-
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>;
|
|
935
|
+
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, undefined>;
|
|
936
|
+
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, undefined>;
|
|
829
937
|
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>, {
|
|
830
938
|
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
831
|
-
}, false, T>;
|
|
832
|
-
readonly boolean:
|
|
833
|
-
readonly handle:
|
|
939
|
+
}, false, T, undefined>;
|
|
940
|
+
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never>;
|
|
941
|
+
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>, true, unknown, never>;
|
|
834
942
|
get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
|
|
835
|
-
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>;
|
|
836
|
-
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>;
|
|
943
|
+
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, undefined>;
|
|
944
|
+
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, undefined>;
|
|
837
945
|
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>, {
|
|
838
946
|
[Symbol.iterator](): Iterator<[
|
|
839
947
|
string,
|
|
840
948
|
InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>
|
|
841
949
|
]>;
|
|
842
|
-
}, false, T>;
|
|
843
|
-
readonly null:
|
|
844
|
-
readonly number:
|
|
950
|
+
}, false, T, undefined>;
|
|
951
|
+
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never>;
|
|
952
|
+
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never>;
|
|
845
953
|
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>;
|
|
846
|
-
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]
|
|
954
|
+
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], UnionToIntersection_2<T[Property]>>; } & { readonly [Property_1 in keyof T as FieldHasDefaultUnsafe<T[Property_1]> extends true ? Property_1 : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property_1], UnionToIntersection_2<T[Property_1]>> | undefined; }, false, T>;
|
|
847
955
|
optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
848
956
|
optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Optional, T>;
|
|
849
957
|
required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
850
958
|
requiredRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Required, T>;
|
|
851
959
|
// (undocumented)
|
|
852
960
|
readonly scope: TScope;
|
|
853
|
-
readonly string:
|
|
961
|
+
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never>;
|
|
854
962
|
}
|
|
855
963
|
|
|
856
964
|
// @alpha
|
|
@@ -891,9 +999,7 @@ export type SharedTreeOptions = Partial<ICodecOptions> & Partial<SharedTreeForma
|
|
|
891
999
|
// @alpha
|
|
892
1000
|
export function singletonSchema<TScope extends string, TName extends string | number>(factory: SchemaFactory<TScope, TName>, name: TName): TreeNodeSchemaClass<ScopedSchemaName<TScope, TName>, NodeKind.Object, TreeNode & {
|
|
893
1001
|
readonly value: TName;
|
|
894
|
-
},
|
|
895
|
-
readonly value: TName;
|
|
896
|
-
});
|
|
1002
|
+
}, Record<string, never>, true, Record<string, never>, undefined>;
|
|
897
1003
|
|
|
898
1004
|
// @public
|
|
899
1005
|
export interface Tagged<V, T extends string = string> {
|
|
@@ -915,6 +1021,26 @@ export type TransformedEvent<TThis, E, A extends any[]> = (event: E, listener: (
|
|
|
915
1021
|
// @public
|
|
916
1022
|
export const Tree: TreeApi;
|
|
917
1023
|
|
|
1024
|
+
// @alpha @sealed
|
|
1025
|
+
export const TreeAlpha: {
|
|
1026
|
+
branch(node: TreeNode): TreeBranch | undefined;
|
|
1027
|
+
create<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(schema: UnsafeUnknownSchema extends TSchema ? ImplicitFieldSchema : TSchema & ImplicitFieldSchema, data: InsertableField<TSchema>): Unhydrated<TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeNode | TreeLeafValue | undefined>;
|
|
1028
|
+
importConcise<const TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema>(schema: UnsafeUnknownSchema extends TSchema ? ImplicitFieldSchema : TSchema & ImplicitFieldSchema, data: ConciseTree | undefined): Unhydrated<TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeNode | TreeLeafValue | undefined>;
|
|
1029
|
+
importVerbose<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: VerboseTree | undefined, options?: Partial<ParseOptions<IFluidHandle>>): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
1030
|
+
importVerbose<const TSchema extends ImplicitFieldSchema, THandle>(schema: TSchema, data: VerboseTree<THandle> | undefined, options: ParseOptions<THandle>): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
1031
|
+
exportConcise(node: TreeNode | TreeLeafValue, options?: Partial<EncodeOptions<IFluidHandle>>): ConciseTree;
|
|
1032
|
+
exportConcise<THandle>(node: TreeNode | TreeLeafValue, options: EncodeOptions<THandle>): ConciseTree<THandle>;
|
|
1033
|
+
exportVerbose(node: TreeNode | TreeLeafValue, options?: Partial<EncodeOptions<IFluidHandle>>): VerboseTree;
|
|
1034
|
+
exportVerbose<T>(node: TreeNode | TreeLeafValue, options: EncodeOptions<T>): VerboseTree<T>;
|
|
1035
|
+
exportCompressed(tree: TreeNode | TreeLeafValue, options: {
|
|
1036
|
+
oldestCompatibleClient: FluidClientVersion;
|
|
1037
|
+
idCompressor?: IIdCompressor;
|
|
1038
|
+
}): JsonCompatible<IFluidHandle>;
|
|
1039
|
+
importCompressed<const TSchema extends ImplicitFieldSchema>(schema: TSchema, compressedData: JsonCompatible<IFluidHandle>, options: {
|
|
1040
|
+
idCompressor?: IIdCompressor;
|
|
1041
|
+
} & ICodecOptions): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
1042
|
+
};
|
|
1043
|
+
|
|
918
1044
|
// @public @sealed
|
|
919
1045
|
interface TreeApi extends TreeNodeApi {
|
|
920
1046
|
contains(node: TreeNode, other: TreeNode): boolean;
|
|
@@ -922,7 +1048,7 @@ interface TreeApi extends TreeNodeApi {
|
|
|
922
1048
|
}
|
|
923
1049
|
|
|
924
1050
|
// @public @sealed
|
|
925
|
-
export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes
|
|
1051
|
+
export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {
|
|
926
1052
|
}
|
|
927
1053
|
|
|
928
1054
|
// @public
|
|
@@ -931,7 +1057,7 @@ export const TreeArrayNode: {
|
|
|
931
1057
|
};
|
|
932
1058
|
|
|
933
1059
|
// @public @sealed
|
|
934
|
-
interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends
|
|
1060
|
+
interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom = ReadonlyArrayNode> extends ReadonlyArrayNode<T> {
|
|
935
1061
|
insertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
936
1062
|
insertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
937
1063
|
insertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
@@ -953,26 +1079,34 @@ interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<
|
|
|
953
1079
|
}
|
|
954
1080
|
|
|
955
1081
|
// @public @sealed
|
|
956
|
-
export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes
|
|
1082
|
+
export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>> {
|
|
957
1083
|
}
|
|
958
1084
|
|
|
959
1085
|
// @beta @sealed
|
|
960
1086
|
export const TreeBeta: {
|
|
961
1087
|
on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
|
|
962
|
-
clone<TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
|
|
1088
|
+
clone<const TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
|
|
963
1089
|
};
|
|
964
1090
|
|
|
965
1091
|
// @alpha @sealed
|
|
966
|
-
export interface TreeBranch extends
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1092
|
+
export interface TreeBranch extends IDisposable {
|
|
1093
|
+
dispose(error?: Error): void;
|
|
1094
|
+
readonly events: Listenable<TreeBranchEvents>;
|
|
1095
|
+
fork(): TreeBranch;
|
|
1096
|
+
hasRootSchema<TSchema extends ImplicitFieldSchema>(schema: TSchema): this is TreeViewAlpha<TSchema>;
|
|
1097
|
+
merge(branch: TreeBranch, disposeMerged?: boolean): void;
|
|
1098
|
+
rebaseOnto(branch: TreeBranch): void;
|
|
971
1099
|
}
|
|
972
1100
|
|
|
973
1101
|
// @alpha @sealed
|
|
974
|
-
export interface
|
|
975
|
-
|
|
1102
|
+
export interface TreeBranchEvents {
|
|
1103
|
+
commitApplied(data: CommitMetadata, getRevertible?: RevertibleFactory): void;
|
|
1104
|
+
schemaChanged(): void;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
// @alpha @sealed
|
|
1108
|
+
export interface TreeBranchFork extends BranchableTree, IDisposable {
|
|
1109
|
+
rebaseOnto(branch: BranchableTree): void;
|
|
976
1110
|
}
|
|
977
1111
|
|
|
978
1112
|
// @public @sealed
|
|
@@ -993,10 +1127,10 @@ export enum TreeCompressionStrategy {
|
|
|
993
1127
|
}
|
|
994
1128
|
|
|
995
1129
|
// @public
|
|
996
|
-
export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind
|
|
1130
|
+
export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> : TreeNode | TreeLeafValue | undefined;
|
|
997
1131
|
|
|
998
1132
|
// @public
|
|
999
|
-
type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind
|
|
1133
|
+
type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : unknown;
|
|
1000
1134
|
|
|
1001
1135
|
// @public
|
|
1002
1136
|
export type TreeLeafValue = number | string | boolean | IFluidHandle | null;
|
|
@@ -1042,20 +1176,29 @@ export interface TreeNodeApi {
|
|
|
1042
1176
|
export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
|
|
1043
1177
|
|
|
1044
1178
|
// @public
|
|
1045
|
-
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends
|
|
1179
|
+
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<TSchema> : TSchema extends AllowedTypesUnsafe ? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>> : unknown;
|
|
1046
1180
|
|
|
1047
1181
|
// @public @sealed
|
|
1048
|
-
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode =
|
|
1182
|
+
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
1049
1183
|
|
|
1050
1184
|
// @public @sealed
|
|
1051
|
-
export
|
|
1185
|
+
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
1186
|
+
new (data?: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;
|
|
1187
|
+
} : {
|
|
1188
|
+
new (data: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;
|
|
1189
|
+
});
|
|
1190
|
+
|
|
1191
|
+
// @public
|
|
1192
|
+
export interface TreeNodeSchemaClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode>, in TInsertable, out ImplicitlyConstructable extends boolean, out Info> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
1052
1193
|
// @sealed
|
|
1053
1194
|
new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
|
|
1054
1195
|
}
|
|
1055
1196
|
|
|
1056
1197
|
// @public @sealed
|
|
1057
|
-
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown> {
|
|
1198
|
+
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never> {
|
|
1058
1199
|
readonly childTypes: ReadonlySet<TreeNodeSchema>;
|
|
1200
|
+
// @sealed
|
|
1201
|
+
createFromInsertable(data: TInsertable): Unhydrated<TreeNode | TreeLeafValue>;
|
|
1059
1202
|
readonly identifier: Name;
|
|
1060
1203
|
readonly implicitlyConstructable: ImplicitlyConstructable;
|
|
1061
1204
|
readonly info: Info;
|
|
@@ -1064,11 +1207,21 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
1064
1207
|
}
|
|
1065
1208
|
|
|
1066
1209
|
// @public @sealed
|
|
1067
|
-
export
|
|
1210
|
+
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
1211
|
+
create(data?: TInsertable | TConstructorExtra): TNode;
|
|
1212
|
+
} : {
|
|
1213
|
+
create(data: TInsertable | TConstructorExtra): TNode;
|
|
1214
|
+
});
|
|
1215
|
+
|
|
1216
|
+
// @public
|
|
1217
|
+
interface TreeNodeSchemaNonClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode | TreeLeafValue>, in TInsertable, out ImplicitlyConstructable extends boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
1068
1218
|
// (undocumented)
|
|
1069
1219
|
create(data: TInsertable): TNode;
|
|
1070
1220
|
}
|
|
1071
1221
|
|
|
1222
|
+
// @public
|
|
1223
|
+
type TreeNodeSchemaUnsafe<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends Unenforced<TreeNode | TreeLeafValue> = unknown, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown> = TreeNodeSchemaClassUnsafe<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> | TreeNodeSchemaNonClassUnsafe<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
1224
|
+
|
|
1072
1225
|
// @public
|
|
1073
1226
|
export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
|
|
1074
1227
|
|
|
@@ -1084,7 +1237,7 @@ export enum TreeStatus {
|
|
|
1084
1237
|
}
|
|
1085
1238
|
|
|
1086
1239
|
// @public @sealed
|
|
1087
|
-
export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposable {
|
|
1240
|
+
export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends IDisposable {
|
|
1088
1241
|
readonly compatibility: SchemaCompatibilityStatus;
|
|
1089
1242
|
readonly events: Listenable<TreeViewEvents>;
|
|
1090
1243
|
initialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;
|
|
@@ -1094,8 +1247,19 @@ export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposab
|
|
|
1094
1247
|
upgradeSchema(): void;
|
|
1095
1248
|
}
|
|
1096
1249
|
|
|
1250
|
+
// @alpha @sealed
|
|
1251
|
+
export interface TreeViewAlpha<in out TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> extends Omit<TreeView<ReadSchema<TSchema>>, "root" | "initialize">, Omit<TreeBranch, "events"> {
|
|
1252
|
+
// (undocumented)
|
|
1253
|
+
fork(): ReturnType<TreeBranch["fork"]> & TreeViewAlpha<TSchema>;
|
|
1254
|
+
// (undocumented)
|
|
1255
|
+
initialize(content: InsertableField<TSchema>): void;
|
|
1256
|
+
// (undocumented)
|
|
1257
|
+
get root(): ReadableField<TSchema>;
|
|
1258
|
+
set root(newRoot: InsertableField<TSchema>);
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1097
1261
|
// @public @sealed
|
|
1098
|
-
export class TreeViewConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
|
|
1262
|
+
export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
|
|
1099
1263
|
constructor(props: ITreeViewConfiguration<TSchema>);
|
|
1100
1264
|
readonly enableSchemaValidation: boolean;
|
|
1101
1265
|
readonly preventAmbiguity: boolean;
|
|
@@ -1114,9 +1278,6 @@ export interface TreeViewEvents {
|
|
|
1114
1278
|
// @alpha
|
|
1115
1279
|
export const typeboxValidator: JsonValidator;
|
|
1116
1280
|
|
|
1117
|
-
// @alpha
|
|
1118
|
-
export function typedObjectValues<TKey extends string, TValues>(object: Record<TKey, TValues>): TValues[];
|
|
1119
|
-
|
|
1120
1281
|
// @public @deprecated
|
|
1121
1282
|
const typeNameSymbol: unique symbol;
|
|
1122
1283
|
|
|
@@ -1129,6 +1290,18 @@ export type Unenforced<_DesiredExtendsConstraint> = unknown;
|
|
|
1129
1290
|
// @public
|
|
1130
1291
|
export type Unhydrated<T> = T;
|
|
1131
1292
|
|
|
1293
|
+
// @public
|
|
1294
|
+
export type UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) extends (k: infer U) => unknown ? U : never;
|
|
1295
|
+
|
|
1296
|
+
// @alpha
|
|
1297
|
+
export type UnionToTuple<Union, A extends unknown[] = [], First = PopUnion<Union>> = IsUnion<Union> extends true ? UnionToTuple<Exclude<Union, First>, [First, ...A]> : [Union, ...A];
|
|
1298
|
+
|
|
1299
|
+
// @alpha
|
|
1300
|
+
export const UnsafeUnknownSchema: unique symbol;
|
|
1301
|
+
|
|
1302
|
+
// @alpha
|
|
1303
|
+
export type UnsafeUnknownSchema = typeof UnsafeUnknownSchema;
|
|
1304
|
+
|
|
1132
1305
|
// @public
|
|
1133
1306
|
export type ValidateRecursiveSchema<T extends TreeNodeSchemaClass<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
|
|
1134
1307
|
[NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
|
|
@@ -1140,16 +1313,34 @@ export type ValidateRecursiveSchema<T extends TreeNodeSchemaClass<string, NodeKi
|
|
|
1140
1313
|
[NodeKind.Map]: ImplicitAllowedTypes;
|
|
1141
1314
|
}[T["kind"]]>> = true;
|
|
1142
1315
|
|
|
1316
|
+
// @alpha
|
|
1317
|
+
export type VerboseTree<THandle = IFluidHandle> = VerboseTreeNode<THandle> | Exclude<TreeLeafValue, IFluidHandle> | THandle;
|
|
1318
|
+
|
|
1319
|
+
// @alpha
|
|
1320
|
+
export interface VerboseTreeNode<THandle = IFluidHandle> {
|
|
1321
|
+
fields: VerboseTree<THandle>[] | {
|
|
1322
|
+
[key: string]: VerboseTree<THandle>;
|
|
1323
|
+
};
|
|
1324
|
+
type: string;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1143
1327
|
// @public @sealed
|
|
1144
1328
|
export interface ViewableTree {
|
|
1145
1329
|
viewWith<TRoot extends ImplicitFieldSchema>(config: TreeViewConfiguration<TRoot>): TreeView<TRoot>;
|
|
1146
1330
|
}
|
|
1147
1331
|
|
|
1332
|
+
// @alpha
|
|
1333
|
+
export interface ViewContent {
|
|
1334
|
+
readonly idCompressor: IIdCompressor_2;
|
|
1335
|
+
readonly schema: JsonCompatible;
|
|
1336
|
+
readonly tree: JsonCompatible<IFluidHandle>;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1148
1339
|
// @public @sealed
|
|
1149
1340
|
export interface WithType<out TName extends string = string, out TKind extends NodeKind = NodeKind, out TInfo = unknown> {
|
|
1150
1341
|
// @deprecated
|
|
1151
1342
|
get [typeNameSymbol](): TName;
|
|
1152
|
-
get [typeSchemaSymbol](): TreeNodeSchemaClass<TName, TKind,
|
|
1343
|
+
get [typeSchemaSymbol](): TreeNodeSchemaClass<TName, TKind, TreeNode, never, boolean, TInfo>;
|
|
1153
1344
|
}
|
|
1154
1345
|
|
|
1155
1346
|
```
|