fluid-framework 2.30.0 → 2.31.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 +1307 -1192
- package/api-extractor/api-extractor.current.json +0 -3
- package/api-report/fluid-framework.alpha.api.md +236 -88
- package/api-report/fluid-framework.beta.api.md +83 -58
- package/api-report/fluid-framework.legacy.alpha.api.md +141 -61
- package/api-report/fluid-framework.legacy.public.api.md +83 -58
- package/api-report/fluid-framework.public.api.md +83 -58
- package/dist/alpha.d.ts +27 -1
- package/dist/beta.d.ts +5 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +8 -1
- package/dist/public.d.ts +5 -1
- package/lib/alpha.d.ts +27 -1
- package/lib/beta.d.ts +5 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +8 -1
- package/lib/public.d.ts +5 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +13 -15
- package/src/index.ts +5 -0
- package/prettier.config.cjs +0 -8
|
@@ -33,6 +33,28 @@ type ApplyKindInput<T, Kind extends FieldKind, DefaultsAreOptional extends boole
|
|
|
33
33
|
Kind
|
|
34
34
|
] extends [FieldKind.Required] ? T : [Kind] extends [FieldKind.Optional] ? T | undefined : [Kind] extends [FieldKind.Identifier] ? DefaultsAreOptional extends true ? T | undefined : T : never;
|
|
35
35
|
|
|
36
|
+
// @alpha @sealed
|
|
37
|
+
export interface ArrayNodeCustomizableSchema<out TName extends string = string, in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Array, TreeArrayNode<T> & WithType<TName, NodeKind.Array, T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleArrayNodeSchema<TCustomMetadata> {
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// @alpha @sealed
|
|
41
|
+
export interface ArrayNodeCustomizableSchemaUnsafe<out TName extends string, in out T extends ImplicitAllowedTypesUnsafe, out TCustomMetadata> extends TreeNodeSchemaClass<TName, NodeKind.Array, TreeArrayNodeUnsafe<T> & WithType<TName, NodeKind.Array, T>, {
|
|
42
|
+
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
43
|
+
}, false, T, undefined, TCustomMetadata>, SimpleArrayNodeSchema<TCustomMetadata> {
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// @alpha @sealed
|
|
47
|
+
export interface ArrayNodePojoEmulationSchema<out TName extends string = string, in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaNonClass<TName, NodeKind.Array, TreeArrayNode<T> & WithType<TName, NodeKind.Array, T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleArrayNodeSchema<TCustomMetadata> {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// @alpha
|
|
51
|
+
export type ArrayNodeSchema = ArrayNodeCustomizableSchema | ArrayNodePojoEmulationSchema;
|
|
52
|
+
|
|
53
|
+
// @alpha (undocumented)
|
|
54
|
+
export const ArrayNodeSchema: {
|
|
55
|
+
readonly [Symbol.hasInstance]: (value: TreeNodeSchema) => value is ArrayNodeSchema;
|
|
56
|
+
};
|
|
57
|
+
|
|
36
58
|
// @alpha
|
|
37
59
|
export function asTreeViewAlpha<TSchema extends ImplicitFieldSchema>(view: TreeView<TSchema>): TreeViewAlpha<TSchema>;
|
|
38
60
|
|
|
@@ -171,7 +193,7 @@ export type FactoryContentObject = {
|
|
|
171
193
|
type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<FieldKind.Optional | FieldKind.Identifier> ? true : false;
|
|
172
194
|
|
|
173
195
|
// @public @sealed
|
|
174
|
-
type FieldHasDefaultUnsafe<T extends
|
|
196
|
+
type FieldHasDefaultUnsafe<T extends ImplicitFieldSchemaUnsafe> = T extends FieldSchemaUnsafe<FieldKind.Optional | FieldKind.Identifier, ImplicitAllowedTypesUnsafe> ? true : false;
|
|
175
197
|
|
|
176
198
|
// @public
|
|
177
199
|
export enum FieldKind {
|
|
@@ -189,23 +211,39 @@ export interface FieldProps<TCustomMetadata = unknown> {
|
|
|
189
211
|
|
|
190
212
|
// @public @sealed
|
|
191
213
|
export class FieldSchema<out Kind extends FieldKind = FieldKind, out Types extends ImplicitAllowedTypes = ImplicitAllowedTypes, out TCustomMetadata = unknown> {
|
|
214
|
+
protected constructor(
|
|
215
|
+
kind: Kind,
|
|
216
|
+
allowedTypes: Types,
|
|
217
|
+
props?: FieldProps<TCustomMetadata> | undefined);
|
|
192
218
|
readonly allowedTypes: Types;
|
|
193
219
|
get allowedTypeSet(): ReadonlySet<TreeNodeSchema>;
|
|
194
220
|
readonly kind: Kind;
|
|
195
|
-
get metadata(): FieldSchemaMetadata<TCustomMetadata
|
|
221
|
+
get metadata(): FieldSchemaMetadata<TCustomMetadata>;
|
|
196
222
|
readonly props?: FieldProps<TCustomMetadata> | undefined;
|
|
197
223
|
readonly requiresValue: boolean;
|
|
198
224
|
protected _typeCheck: MakeNominal;
|
|
199
225
|
}
|
|
200
226
|
|
|
227
|
+
// @alpha @sealed
|
|
228
|
+
export class FieldSchemaAlpha<Kind extends FieldKind = FieldKind, Types extends ImplicitAllowedTypes = ImplicitAllowedTypes, TCustomMetadata = unknown> extends FieldSchema<Kind, Types, TCustomMetadata> implements SimpleFieldSchema {
|
|
229
|
+
protected constructor(kind: Kind, allowedTypes: Types, props?: FieldProps<TCustomMetadata>);
|
|
230
|
+
// (undocumented)
|
|
231
|
+
get allowedTypesIdentifiers(): ReadonlySet<string>;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// @alpha @sealed
|
|
235
|
+
export interface FieldSchemaAlphaUnsafe<out Kind extends FieldKind, out Types extends ImplicitAllowedTypesUnsafe, out TCustomMetadata = unknown> extends FieldSchemaAlpha<Kind, any, TCustomMetadata>, FieldSchemaUnsafe<Kind, Types, TCustomMetadata> {
|
|
236
|
+
readonly allowedTypes: Types;
|
|
237
|
+
}
|
|
238
|
+
|
|
201
239
|
// @public @sealed
|
|
202
240
|
export interface FieldSchemaMetadata<TCustomMetadata = unknown> {
|
|
203
241
|
readonly custom?: TCustomMetadata;
|
|
204
242
|
readonly description?: string | undefined;
|
|
205
243
|
}
|
|
206
244
|
|
|
207
|
-
// @public
|
|
208
|
-
export interface FieldSchemaUnsafe<out Kind extends FieldKind, out Types extends
|
|
245
|
+
// @public @sealed
|
|
246
|
+
export interface FieldSchemaUnsafe<out Kind extends FieldKind, out Types extends ImplicitAllowedTypesUnsafe, out TCustomMetadata = unknown> extends FieldSchema<Kind, any, TCustomMetadata> {
|
|
209
247
|
readonly allowedTypes: Types;
|
|
210
248
|
readonly allowedTypeSet: ReadonlySet<TreeNodeSchema>;
|
|
211
249
|
readonly kind: Kind;
|
|
@@ -259,6 +297,9 @@ export const ForestTypeOptimized: ForestType;
|
|
|
259
297
|
// @alpha
|
|
260
298
|
export const ForestTypeReference: ForestType;
|
|
261
299
|
|
|
300
|
+
// @alpha
|
|
301
|
+
export function generateSchemaFromSimpleSchema(simple: SimpleTreeSchema): FieldSchemaAlpha;
|
|
302
|
+
|
|
262
303
|
// @alpha @deprecated
|
|
263
304
|
export function getBranch(tree: ITree): BranchableTree;
|
|
264
305
|
|
|
@@ -535,9 +576,15 @@ export interface IMember {
|
|
|
535
576
|
// @public
|
|
536
577
|
export type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;
|
|
537
578
|
|
|
579
|
+
// @public
|
|
580
|
+
export type ImplicitAllowedTypesUnsafe = TreeNodeSchemaUnsafe | readonly LazyItem<Unenforced<TreeNodeSchema>>[];
|
|
581
|
+
|
|
538
582
|
// @public
|
|
539
583
|
export type ImplicitFieldSchema = FieldSchema | ImplicitAllowedTypes;
|
|
540
584
|
|
|
585
|
+
// @public
|
|
586
|
+
export type ImplicitFieldSchemaUnsafe = FieldSchemaUnsafe<FieldKind, ImplicitAllowedTypesUnsafe> | ImplicitAllowedTypesUnsafe;
|
|
587
|
+
|
|
541
588
|
// @alpha
|
|
542
589
|
export function independentInitializedView<const TSchema extends ImplicitFieldSchema>(config: TreeViewConfiguration<TSchema>, options: ForestOptions & ICodecOptions, content: ViewContent): TreeViewAlpha<TSchema>;
|
|
543
590
|
|
|
@@ -569,24 +616,26 @@ TSchema
|
|
|
569
616
|
] extends [ImplicitFieldSchema] ? InsertableTreeFieldFromImplicitField<TSchema> : [TSchema] extends [UnsafeUnknownSchema] ? InsertableContent | undefined : never;
|
|
570
617
|
|
|
571
618
|
// @public
|
|
572
|
-
type InsertableObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> =
|
|
619
|
+
type InsertableObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = RestrictiveStringRecord<ImplicitFieldSchema> extends T ? {
|
|
620
|
+
arbitraryKey: "arbitraryValue";
|
|
621
|
+
} extends T ? Record<string, never> : never : FlattenKeys<{
|
|
573
622
|
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property & string]>;
|
|
574
623
|
} & {
|
|
575
624
|
readonly [Property in keyof T as FieldHasDefault<T[Property & string]> extends false ? Property : never]: InsertableTreeFieldFromImplicitField<T[Property & string]>;
|
|
576
625
|
}>;
|
|
577
626
|
|
|
578
627
|
// @public
|
|
579
|
-
export type InsertableObjectFromSchemaRecordUnsafe<T extends
|
|
580
|
-
readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
|
|
628
|
+
export type InsertableObjectFromSchemaRecordUnsafe<T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>> = {
|
|
629
|
+
readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property & string]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property & string]>;
|
|
581
630
|
} & {
|
|
582
|
-
readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends true ? Property : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]>;
|
|
631
|
+
readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property & string]> extends true ? Property : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property & string]>;
|
|
583
632
|
};
|
|
584
633
|
|
|
585
634
|
// @public
|
|
586
635
|
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;
|
|
587
636
|
|
|
588
637
|
// @public
|
|
589
|
-
export type InsertableTreeFieldFromImplicitFieldUnsafe<TSchemaInput extends
|
|
638
|
+
export type InsertableTreeFieldFromImplicitFieldUnsafe<TSchemaInput extends ImplicitFieldSchemaUnsafe, TSchema = UnionToIntersection<TSchemaInput>> = [TSchema] extends [FieldSchemaUnsafe<infer Kind, infer Types>] ? ApplyKindInput<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true> : [TSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : never;
|
|
590
639
|
|
|
591
640
|
// @public
|
|
592
641
|
export type InsertableTreeNodeFromAllowedTypes<TList extends AllowedTypes> = TList extends readonly [
|
|
@@ -595,7 +644,7 @@ LazyItem<infer TSchema extends TreeNodeSchema>,
|
|
|
595
644
|
] ? InsertableTypedNode<TSchema> | InsertableTreeNodeFromAllowedTypes<Rest> : never;
|
|
596
645
|
|
|
597
646
|
// @public
|
|
598
|
-
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends
|
|
647
|
+
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends AllowedTypesUnsafe> = TList extends readonly [
|
|
599
648
|
LazyItem<infer TSchema extends TreeNodeSchemaUnsafe>,
|
|
600
649
|
...infer Rest extends AllowedTypesUnsafe
|
|
601
650
|
] ? InsertableTypedNodeUnsafe<TSchema> | InsertableTreeNodeFromAllowedTypesUnsafe<Rest> : never;
|
|
@@ -606,13 +655,13 @@ TSchema
|
|
|
606
655
|
] extends [TreeNodeSchema] ? InsertableTypedNode<TSchema> : [TSchema] extends [AllowedTypes] ? InsertableTreeNodeFromAllowedTypes<TSchema> : never;
|
|
607
656
|
|
|
608
657
|
// @public
|
|
609
|
-
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends
|
|
658
|
+
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends ImplicitAllowedTypesUnsafe> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
|
|
610
659
|
|
|
611
660
|
// @public
|
|
612
661
|
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);
|
|
613
662
|
|
|
614
663
|
// @public
|
|
615
|
-
type InsertableTypedNodeUnsafe<TSchema extends
|
|
664
|
+
type InsertableTypedNodeUnsafe<TSchema extends TreeNodeSchemaUnsafe, T = UnionToIntersection<TSchema>> = (T extends TreeNodeSchemaUnsafe<string, NodeKind, TreeNode | TreeLeafValue, never, true> ? NodeBuilderDataUnsafe<T> : never) | (T extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<T> : never);
|
|
616
665
|
|
|
617
666
|
// @public @sealed
|
|
618
667
|
export interface InternalTreeNode extends ErasedType<"@fluidframework/tree.InternalTreeNode"> {
|
|
@@ -719,31 +768,25 @@ export interface JsonArrayNodeSchema extends JsonNodeSchemaBase<NodeKind.Array,
|
|
|
719
768
|
|
|
720
769
|
// @alpha
|
|
721
770
|
export namespace JsonAsTree {
|
|
722
|
-
const Primitive: readonly [
|
|
771
|
+
const Primitive: readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>];
|
|
723
772
|
// @sealed
|
|
724
773
|
export class Array extends _APIExtractorWorkaroundArrayBase {
|
|
725
774
|
}
|
|
726
|
-
const Tree: readonly [
|
|
775
|
+
const Tree: readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>, () => typeof JsonObject, () => typeof Array];
|
|
727
776
|
// @sealed
|
|
728
777
|
export class JsonObject extends _APIExtractorWorkaroundObjectBase {
|
|
729
778
|
}
|
|
730
|
-
const _APIExtractorWorkaroundObjectBase:
|
|
731
|
-
|
|
732
|
-
create(data: boolean): boolean;
|
|
733
|
-
}> | null], any, undefined>;
|
|
779
|
+
const _APIExtractorWorkaroundObjectBase: TreeNodeSchemaClass<"com.fluidframework.json.object", NodeKind.Map, TreeMapNodeUnsafe<readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>, () => typeof JsonObject, () => typeof Array]> & WithType<"com.fluidframework.json.object", NodeKind.Map, unknown>, {
|
|
780
|
+
[Symbol.iterator](): Iterator<[string, string | number | JsonObject | Array | InsertableTypedNodeUnsafe<LeafSchema<"boolean", boolean>, LeafSchema<"boolean", boolean>> | null], any, undefined>;
|
|
734
781
|
} | {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
}> | null;
|
|
738
|
-
}, false, readonly [() => typeof JsonObject, () => typeof Array, TreeNodeSchemaNonClass_2<"com.fluidframework.leaf.null", NodeKind_2.Leaf, null, null, true, unknown, never, unknown>, TreeNodeSchemaNonClass_2<"com.fluidframework.leaf.boolean", NodeKind_2.Leaf, boolean, boolean, true, unknown, never, unknown>, TreeNodeSchemaNonClass_2<"com.fluidframework.leaf.number", NodeKind_2.Leaf, number, number, true, unknown, never, unknown>, TreeNodeSchemaNonClass_2<"com.fluidframework.leaf.string", NodeKind_2.Leaf, string, string, true, unknown, never, unknown>], undefined>;
|
|
782
|
+
readonly [x: string]: string | number | JsonObject | Array | InsertableTypedNodeUnsafe<LeafSchema<"boolean", boolean>, LeafSchema<"boolean", boolean>> | null;
|
|
783
|
+
}, false, readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>, () => typeof JsonObject, () => typeof Array], undefined>;
|
|
739
784
|
// (undocumented)
|
|
740
785
|
export type Primitive = TreeNodeFromImplicitAllowedTypes<typeof Primitive>;
|
|
741
786
|
export type _RecursiveArrayWorkaroundJsonArray = FixRecursiveArraySchema<typeof Array>;
|
|
742
|
-
const _APIExtractorWorkaroundArrayBase:
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
}> | null, any, undefined>;
|
|
746
|
-
}, false, readonly [() => typeof JsonObject, () => typeof Array, TreeNodeSchemaNonClass_2<"com.fluidframework.leaf.null", NodeKind_2.Leaf, null, null, true, unknown, never, unknown>, TreeNodeSchemaNonClass_2<"com.fluidframework.leaf.boolean", NodeKind_2.Leaf, boolean, boolean, true, unknown, never, unknown>, TreeNodeSchemaNonClass_2<"com.fluidframework.leaf.number", NodeKind_2.Leaf, number, number, true, unknown, never, unknown>, TreeNodeSchemaNonClass_2<"com.fluidframework.leaf.string", NodeKind_2.Leaf, string, string, true, unknown, never, unknown>], undefined>;
|
|
787
|
+
const _APIExtractorWorkaroundArrayBase: TreeNodeSchemaClass<"com.fluidframework.json.array", NodeKind.Array, TreeArrayNodeUnsafe<readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>, () => typeof JsonObject, () => typeof Array]> & WithType<"com.fluidframework.json.array", NodeKind.Array, unknown>, {
|
|
788
|
+
[Symbol.iterator](): Iterator<string | number | JsonObject | Array | InsertableTypedNodeUnsafe<LeafSchema<"boolean", boolean>, LeafSchema<"boolean", boolean>> | null, any, undefined>;
|
|
789
|
+
}, false, readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>, () => typeof JsonObject, () => typeof Array], undefined>;
|
|
747
790
|
// (undocumented)
|
|
748
791
|
export type Tree = TreeNodeFromImplicitAllowedTypes<typeof Tree>;
|
|
749
792
|
}
|
|
@@ -822,6 +865,10 @@ export interface JsonValidator {
|
|
|
822
865
|
// @public
|
|
823
866
|
export type LazyItem<Item = unknown> = Item | (() => Item);
|
|
824
867
|
|
|
868
|
+
// @public @sealed
|
|
869
|
+
export interface LeafSchema<Name extends string, T extends TreeLeafValue> extends TreeNodeSchemaNonClass<`com.fluidframework.leaf.${Name}`, NodeKind.Leaf, T, T, true> {
|
|
870
|
+
}
|
|
871
|
+
|
|
825
872
|
// @public @sealed
|
|
826
873
|
export interface Listenable<TListeners extends object> {
|
|
827
874
|
off<K extends keyof Listeners<TListeners>>(eventName: K, listener: TListeners[K]): void;
|
|
@@ -837,9 +884,36 @@ export type Listeners<T extends object> = {
|
|
|
837
884
|
export interface MakeNominal {
|
|
838
885
|
}
|
|
839
886
|
|
|
887
|
+
// @alpha @sealed
|
|
888
|
+
export interface MapNodeCustomizableSchema<out TName extends string = string, in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Map, TreeMapNode<T> & WithType<TName, NodeKind.Map, T>, MapNodeInsertableData<T>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleMapNodeSchema<TCustomMetadata> {
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
// @alpha @sealed
|
|
892
|
+
export interface MapNodeCustomizableSchemaUnsafe<out TName extends string, in out T extends ImplicitAllowedTypesUnsafe, out TCustomMetadata> extends TreeNodeSchemaClass<TName, NodeKind.Map, TreeMapNodeUnsafe<T> & WithType<TName, NodeKind.Map, T>, {
|
|
893
|
+
[Symbol.iterator](): Iterator<[
|
|
894
|
+
string,
|
|
895
|
+
InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>
|
|
896
|
+
]>;
|
|
897
|
+
} | {
|
|
898
|
+
readonly [P in string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
899
|
+
}, false, T, undefined, TCustomMetadata>, SimpleMapNodeSchema<TCustomMetadata> {
|
|
900
|
+
}
|
|
901
|
+
|
|
840
902
|
// @public
|
|
841
903
|
export type MapNodeInsertableData<T extends ImplicitAllowedTypes> = Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]> | RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;
|
|
842
904
|
|
|
905
|
+
// @alpha @sealed
|
|
906
|
+
export interface MapNodePojoEmulationSchema<out TName extends string = string, in out T extends ImplicitAllowedTypes = ImplicitAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaNonClass<TName, NodeKind.Map, TreeMapNode<T> & WithType<TName, NodeKind.Map, T>, MapNodeInsertableData<T>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleMapNodeSchema<TCustomMetadata> {
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
// @alpha
|
|
910
|
+
export type MapNodeSchema = MapNodeCustomizableSchema | MapNodePojoEmulationSchema;
|
|
911
|
+
|
|
912
|
+
// @alpha (undocumented)
|
|
913
|
+
export const MapNodeSchema: {
|
|
914
|
+
readonly [Symbol.hasInstance]: (value: TreeNodeSchema) => value is MapNodeSchema;
|
|
915
|
+
};
|
|
916
|
+
|
|
843
917
|
// @public
|
|
844
918
|
export type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
|
|
845
919
|
|
|
@@ -896,18 +970,31 @@ export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
|
|
|
896
970
|
export const noopValidator: JsonValidator;
|
|
897
971
|
|
|
898
972
|
// @public
|
|
899
|
-
type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = {
|
|
973
|
+
type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = RestrictiveStringRecord<ImplicitFieldSchema> extends T ? {} : {
|
|
900
974
|
-readonly [Property in keyof T]: Property extends string ? TreeFieldFromImplicitField<T[Property]> : unknown;
|
|
901
975
|
};
|
|
902
976
|
|
|
903
977
|
// @public
|
|
904
|
-
type ObjectFromSchemaRecordUnsafe<T extends
|
|
905
|
-
-readonly [Property in keyof T]: TreeFieldFromImplicitFieldUnsafe<T[Property]
|
|
978
|
+
type ObjectFromSchemaRecordUnsafe<T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>> = {
|
|
979
|
+
-readonly [Property in keyof T]: Property extends string ? TreeFieldFromImplicitFieldUnsafe<T[Property]> : unknown;
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
// @alpha @sealed
|
|
983
|
+
export interface ObjectNodeSchema<out TName extends string = string, in out T extends RestrictiveStringRecord<ImplicitFieldSchema> = RestrictiveStringRecord<ImplicitFieldSchema>, ImplicitlyConstructable extends boolean = boolean, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Object, TreeObjectNode<T, TName>, InsertableObjectFromSchemaRecord<T>, ImplicitlyConstructable, T, never, TCustomMetadata>, SimpleObjectNodeSchema<TCustomMetadata> {
|
|
984
|
+
readonly fields: ReadonlyMap<string, FieldSchemaAlpha & SimpleObjectFieldSchema>;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
// @alpha (undocumented)
|
|
988
|
+
export const ObjectNodeSchema: {
|
|
989
|
+
readonly [Symbol.hasInstance]: (value: TreeNodeSchema) => value is ObjectNodeSchema<string, RestrictiveStringRecord<ImplicitFieldSchema>, boolean, unknown>;
|
|
906
990
|
};
|
|
907
991
|
|
|
908
992
|
// @public
|
|
909
993
|
export type Off = () => void;
|
|
910
994
|
|
|
995
|
+
// @alpha
|
|
996
|
+
export function onAssertionFailure(handler: (error: Error) => void): () => void;
|
|
997
|
+
|
|
911
998
|
// @alpha
|
|
912
999
|
export interface ParseOptions {
|
|
913
1000
|
readonly useStoredKeys?: boolean;
|
|
@@ -924,7 +1011,7 @@ export interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue> extends Rea
|
|
|
924
1011
|
}
|
|
925
1012
|
|
|
926
1013
|
// @public @sealed
|
|
927
|
-
interface ReadonlyMapInlined<K, T extends
|
|
1014
|
+
interface ReadonlyMapInlined<K, T extends ImplicitAllowedTypesUnsafe> {
|
|
928
1015
|
[Symbol.iterator](): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;
|
|
929
1016
|
entries(): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;
|
|
930
1017
|
// (undocumented)
|
|
@@ -1029,24 +1116,24 @@ export interface SchemaCompatibilityStatus {
|
|
|
1029
1116
|
}
|
|
1030
1117
|
|
|
1031
1118
|
// @public @sealed
|
|
1032
|
-
export class SchemaFactory<out TScope extends string | undefined = string | undefined, TName extends number | string = string> {
|
|
1119
|
+
export class SchemaFactory<out TScope extends string | undefined = string | undefined, TName extends number | string = string> implements SchemaStatics {
|
|
1033
1120
|
constructor(
|
|
1034
1121
|
scope: TScope);
|
|
1035
1122
|
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>;
|
|
1036
1123
|
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>;
|
|
1037
|
-
arrayRecursive<const Name extends TName, const T extends
|
|
1124
|
+
arrayRecursive<const Name extends TName, const T extends ImplicitAllowedTypesUnsafe>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array, unknown>, {
|
|
1038
1125
|
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
1039
1126
|
}, false, T, undefined>;
|
|
1040
|
-
readonly boolean:
|
|
1041
|
-
static readonly boolean:
|
|
1042
|
-
readonly handle:
|
|
1043
|
-
static readonly handle:
|
|
1127
|
+
readonly boolean: LeafSchema<"boolean", boolean>;
|
|
1128
|
+
static readonly boolean: LeafSchema<"boolean", boolean>;
|
|
1129
|
+
readonly handle: LeafSchema<"handle", IFluidHandle<unknown>>;
|
|
1130
|
+
static readonly handle: LeafSchema<"handle", IFluidHandle<unknown>>;
|
|
1044
1131
|
get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
|
|
1045
|
-
readonly leaves: readonly [
|
|
1046
|
-
static readonly leaves: readonly [
|
|
1132
|
+
readonly leaves: readonly [LeafSchema<"string", string>, LeafSchema<"number", number>, LeafSchema<"boolean", boolean>, LeafSchema<"null", null>, LeafSchema<"handle", IFluidHandle<unknown>>];
|
|
1133
|
+
static readonly leaves: readonly [LeafSchema<"string", string>, LeafSchema<"number", number>, LeafSchema<"boolean", boolean>, LeafSchema<"null", null>, LeafSchema<"handle", IFluidHandle<unknown>>];
|
|
1047
1134
|
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>;
|
|
1048
1135
|
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>;
|
|
1049
|
-
mapRecursive<Name extends TName, const T extends
|
|
1136
|
+
mapRecursive<Name extends TName, const T extends ImplicitAllowedTypesUnsafe>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map, unknown>, {
|
|
1050
1137
|
[Symbol.iterator](): Iterator<[
|
|
1051
1138
|
string,
|
|
1052
1139
|
InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>
|
|
@@ -1054,42 +1141,37 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
1054
1141
|
} | {
|
|
1055
1142
|
readonly [x: string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
1056
1143
|
}, false, T, undefined>;
|
|
1057
|
-
readonly null:
|
|
1058
|
-
static readonly null:
|
|
1059
|
-
readonly number:
|
|
1060
|
-
static readonly number:
|
|
1144
|
+
readonly null: LeafSchema<"null", null>;
|
|
1145
|
+
static readonly null: LeafSchema<"null", null>;
|
|
1146
|
+
readonly number: LeafSchema<"number", number>;
|
|
1147
|
+
static readonly number: LeafSchema<"number", number>;
|
|
1061
1148
|
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>;
|
|
1062
|
-
objectRecursive<const Name extends TName, const T extends
|
|
1149
|
+
objectRecursive<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecordUnsafe<T>, false, T>;
|
|
1063
1150
|
readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
1064
1151
|
static readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
1065
|
-
readonly optionalRecursive: <const T extends unknown>(t: T, props?: Omit<FieldProps<
|
|
1066
|
-
static readonly optionalRecursive: <const T extends unknown>(t: T, props?: Omit<FieldProps<
|
|
1152
|
+
readonly optionalRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
|
|
1153
|
+
static readonly optionalRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
|
|
1067
1154
|
readonly required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
1068
1155
|
static readonly required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
1069
|
-
readonly requiredRecursive: <const T extends unknown>(t: T, props?: Omit<FieldProps<
|
|
1070
|
-
static readonly requiredRecursive: <const T extends unknown>(t: T, props?: Omit<FieldProps<
|
|
1156
|
+
readonly requiredRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;
|
|
1157
|
+
static readonly requiredRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;
|
|
1071
1158
|
readonly scope: TScope;
|
|
1072
|
-
readonly string:
|
|
1073
|
-
static readonly string:
|
|
1159
|
+
readonly string: LeafSchema<"string", string>;
|
|
1160
|
+
static readonly string: LeafSchema<"string", string>;
|
|
1074
1161
|
}
|
|
1075
1162
|
|
|
1076
1163
|
// @alpha
|
|
1077
1164
|
export class SchemaFactoryAlpha<out TScope extends string | undefined = string | undefined, TName extends number | string = string> extends SchemaFactory<TScope, TName> {
|
|
1078
|
-
arrayAlpha<const Name extends TName, const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>):
|
|
1079
|
-
arrayRecursive<const Name extends TName, const T extends
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
} | {
|
|
1089
|
-
readonly [x: string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
1090
|
-
}, false, T, undefined, TCustomMetadata>;
|
|
1091
|
-
object<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchema>, const TCustomMetadata = unknown>(name: Name, fields: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNode<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecord<T>, true, T, never, TCustomMetadata>;
|
|
1092
|
-
objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>, const TCustomMetadata = unknown>(name: Name, t: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecordUnsafe<T>, false, T, never, TCustomMetadata>;
|
|
1165
|
+
arrayAlpha<const Name extends TName, const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
|
|
1166
|
+
arrayRecursive<const Name extends TName, const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): ArrayNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
|
|
1167
|
+
static readonly identifier: <const TCustomMetadata = unknown>(props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlpha_2<FieldKind_2.Identifier, LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, TCustomMetadata>;
|
|
1168
|
+
mapAlpha<Name extends TName, const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
|
|
1169
|
+
mapRecursive<Name extends TName, const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): MapNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
|
|
1170
|
+
object<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchema>, const TCustomMetadata = unknown>(name: Name, fields: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
|
|
1171
|
+
objectRecursive<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>, const TCustomMetadata = unknown>(name: Name, t: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecordUnsafe<T>, false, T, never, TCustomMetadata> & SimpleObjectNodeSchema<TCustomMetadata> & Pick<ObjectNodeSchema, "fields">;
|
|
1172
|
+
static readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlpha_2<FieldKind_2.Optional, T, TCustomMetadata>;
|
|
1173
|
+
static readonly optionalRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2<FieldKind_2.Optional, T, TCustomMetadata>;
|
|
1174
|
+
static readonly required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlpha_2<FieldKind_2.Required, T, TCustomMetadata>;
|
|
1093
1175
|
scopedFactory<const T extends TName, TNameInner extends number | string = string>(name: T): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner>;
|
|
1094
1176
|
}
|
|
1095
1177
|
|
|
@@ -1099,18 +1181,24 @@ export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown> extends N
|
|
|
1099
1181
|
}
|
|
1100
1182
|
|
|
1101
1183
|
// @public @sealed
|
|
1102
|
-
export
|
|
1103
|
-
readonly
|
|
1104
|
-
readonly
|
|
1105
|
-
readonly
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1184
|
+
export interface SchemaStatics {
|
|
1185
|
+
readonly boolean: LeafSchema<"boolean", boolean>;
|
|
1186
|
+
readonly handle: LeafSchema<"handle", IFluidHandle>;
|
|
1187
|
+
readonly leaves: readonly [
|
|
1188
|
+
SchemaStatics["string"],
|
|
1189
|
+
SchemaStatics["number"],
|
|
1190
|
+
SchemaStatics["boolean"],
|
|
1191
|
+
SchemaStatics["null"],
|
|
1192
|
+
SchemaStatics["handle"]
|
|
1193
|
+
];
|
|
1194
|
+
readonly null: LeafSchema<"null", null>;
|
|
1195
|
+
readonly number: LeafSchema<"number", number>;
|
|
1109
1196
|
readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">) => FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
1110
|
-
readonly
|
|
1111
|
-
readonly
|
|
1112
|
-
readonly requiredRecursive: <const
|
|
1113
|
-
|
|
1197
|
+
readonly optionalRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">) => FieldSchemaUnsafe<FieldKind.Optional, T, TCustomMetadata>;
|
|
1198
|
+
readonly required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">) => FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
1199
|
+
readonly requiredRecursive: <const T extends ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">) => FieldSchemaUnsafe<FieldKind.Required, T, TCustomMetadata>;
|
|
1200
|
+
readonly string: LeafSchema<"string", string>;
|
|
1201
|
+
}
|
|
1114
1202
|
|
|
1115
1203
|
// @alpha
|
|
1116
1204
|
export interface SchemaValidationFunction<Schema extends TSchema> {
|
|
@@ -1147,9 +1235,57 @@ export type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;
|
|
|
1147
1235
|
// @alpha
|
|
1148
1236
|
export type SharedTreeOptions = Partial<ICodecOptions> & Partial<SharedTreeFormatOptions> & ForestOptions;
|
|
1149
1237
|
|
|
1238
|
+
// @alpha @sealed
|
|
1239
|
+
export interface SimpleArrayNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBase<NodeKind.Array, TCustomMetadata> {
|
|
1240
|
+
readonly allowedTypesIdentifiers: ReadonlySet<string>;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
// @alpha @sealed
|
|
1244
|
+
export interface SimpleFieldSchema {
|
|
1245
|
+
readonly allowedTypesIdentifiers: ReadonlySet<string>;
|
|
1246
|
+
readonly kind: FieldKind;
|
|
1247
|
+
readonly metadata: FieldSchemaMetadata;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
// @alpha @sealed
|
|
1251
|
+
export interface SimpleLeafNodeSchema extends SimpleNodeSchemaBase<NodeKind.Leaf> {
|
|
1252
|
+
readonly leafKind: ValueSchema;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
// @alpha @sealed
|
|
1256
|
+
export interface SimpleMapNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBase<NodeKind.Map, TCustomMetadata> {
|
|
1257
|
+
readonly allowedTypesIdentifiers: ReadonlySet<string>;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
// @alpha
|
|
1261
|
+
export type SimpleNodeSchema = SimpleLeafNodeSchema | SimpleMapNodeSchema | SimpleArrayNodeSchema | SimpleObjectNodeSchema;
|
|
1262
|
+
|
|
1263
|
+
// @public @sealed
|
|
1264
|
+
export interface SimpleNodeSchemaBase<out TNodeKind extends NodeKind, out TCustomMetadata = unknown> {
|
|
1265
|
+
readonly kind: TNodeKind;
|
|
1266
|
+
readonly metadata: NodeSchemaMetadata<TCustomMetadata>;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
// @alpha @sealed
|
|
1270
|
+
export interface SimpleObjectFieldSchema extends SimpleFieldSchema {
|
|
1271
|
+
readonly storedKey: string;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
// @alpha @sealed
|
|
1275
|
+
export interface SimpleObjectNodeSchema<out TCustomMetadata = unknown> extends SimpleNodeSchemaBase<NodeKind.Object, TCustomMetadata> {
|
|
1276
|
+
readonly fields: ReadonlyMap<string, SimpleObjectFieldSchema>;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1150
1279
|
// @alpha
|
|
1151
1280
|
export type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey, TValue>;
|
|
1152
1281
|
|
|
1282
|
+
// @alpha @sealed
|
|
1283
|
+
export interface SimpleTreeSchema extends SimpleFieldSchema {
|
|
1284
|
+
readonly allowedTypesIdentifiers: ReadonlySet<string>;
|
|
1285
|
+
readonly definitions: ReadonlyMap<string, SimpleNodeSchema>;
|
|
1286
|
+
readonly kind: FieldKind;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1153
1289
|
// @alpha
|
|
1154
1290
|
export function singletonSchema<TScope extends string, TName extends string | number>(factory: SchemaFactory<TScope, TName>, name: TName): TreeNodeSchemaClass<ScopedSchemaName<TScope, TName>, NodeKind.Object, TreeNode & {
|
|
1155
1291
|
readonly value: TName;
|
|
@@ -1211,6 +1347,7 @@ export const TreeAlpha: {
|
|
|
1211
1347
|
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>;
|
|
1212
1348
|
importVerbose<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: VerboseTree | undefined, options?: Partial<ParseOptions>): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
1213
1349
|
exportConcise(node: TreeNode | TreeLeafValue, options?: EncodeOptions): ConciseTree;
|
|
1350
|
+
exportConcise(node: TreeNode | TreeLeafValue | undefined, options?: EncodeOptions): ConciseTree | undefined;
|
|
1214
1351
|
exportVerbose(node: TreeNode | TreeLeafValue, options?: EncodeOptions): VerboseTree;
|
|
1215
1352
|
exportCompressed(tree: TreeNode | TreeLeafValue, options: {
|
|
1216
1353
|
oldestCompatibleClient: FluidClientVersion;
|
|
@@ -1228,7 +1365,7 @@ interface TreeApi extends TreeNodeApi {
|
|
|
1228
1365
|
}
|
|
1229
1366
|
|
|
1230
1367
|
// @public @sealed
|
|
1231
|
-
export interface TreeArrayNode<TAllowedTypes extends
|
|
1368
|
+
export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypesUnsafe = ImplicitAllowedTypes, out T = [TAllowedTypes] extends [ImplicitAllowedTypes] ? TreeNodeFromImplicitAllowedTypes<TAllowedTypes> : TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, in TNew = [TAllowedTypes] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes> : InsertableTreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>, in TMoveFrom = ReadonlyArrayNode> extends ReadonlyArrayNode<T> {
|
|
1232
1369
|
insertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
1233
1370
|
insertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
1234
1371
|
insertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
@@ -1255,7 +1392,7 @@ export const TreeArrayNode: {
|
|
|
1255
1392
|
};
|
|
1256
1393
|
|
|
1257
1394
|
// @public @sealed
|
|
1258
|
-
export interface TreeArrayNodeUnsafe<TAllowedTypes extends
|
|
1395
|
+
export interface TreeArrayNodeUnsafe<TAllowedTypes extends ImplicitAllowedTypesUnsafe> extends TreeArrayNode<TAllowedTypes, TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>> {
|
|
1259
1396
|
}
|
|
1260
1397
|
|
|
1261
1398
|
// @beta @sealed
|
|
@@ -1306,7 +1443,7 @@ export enum TreeCompressionStrategy {
|
|
|
1306
1443
|
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;
|
|
1307
1444
|
|
|
1308
1445
|
// @public
|
|
1309
|
-
type TreeFieldFromImplicitFieldUnsafe<TSchema extends
|
|
1446
|
+
type TreeFieldFromImplicitFieldUnsafe<TSchema extends ImplicitFieldSchemaUnsafe> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind> : TSchema extends ImplicitAllowedTypesUnsafe ? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : unknown;
|
|
1310
1447
|
|
|
1311
1448
|
// @alpha
|
|
1312
1449
|
export interface TreeIndex<TKey extends TreeIndexKey, TValue> extends ReadonlyMap<TKey, TValue> {
|
|
@@ -1333,7 +1470,7 @@ export interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTyp
|
|
|
1333
1470
|
}
|
|
1334
1471
|
|
|
1335
1472
|
// @public @sealed
|
|
1336
|
-
export interface TreeMapNodeUnsafe<T extends
|
|
1473
|
+
export interface TreeMapNodeUnsafe<T extends ImplicitAllowedTypesUnsafe> extends ReadonlyMapInlined<string, T>, TreeNode {
|
|
1337
1474
|
delete(key: string): void;
|
|
1338
1475
|
set(key: string, value: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T> | undefined): void;
|
|
1339
1476
|
}
|
|
@@ -1363,7 +1500,7 @@ export interface TreeNodeApi {
|
|
|
1363
1500
|
export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
|
|
1364
1501
|
|
|
1365
1502
|
// @public
|
|
1366
|
-
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends
|
|
1503
|
+
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends ImplicitAllowedTypesUnsafe> = TSchema extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<TSchema> : TSchema extends AllowedTypesUnsafe ? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>> : unknown;
|
|
1367
1504
|
|
|
1368
1505
|
// @public @sealed
|
|
1369
1506
|
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, TCustomMetadata = unknown> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata>;
|
|
@@ -1376,22 +1513,19 @@ export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeK
|
|
|
1376
1513
|
});
|
|
1377
1514
|
|
|
1378
1515
|
// @public
|
|
1379
|
-
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> {
|
|
1516
|
+
export interface TreeNodeSchemaClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode>, in TInsertable, out ImplicitlyConstructable extends boolean, out Info, out TCustomMetadata = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, never, TCustomMetadata> {
|
|
1380
1517
|
// @sealed
|
|
1381
1518
|
new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
|
|
1382
1519
|
}
|
|
1383
1520
|
|
|
1384
1521
|
// @public @sealed
|
|
1385
|
-
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never, out TCustomMetadata = unknown> {
|
|
1522
|
+
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never, out TCustomMetadata = unknown> extends SimpleNodeSchemaBase<Kind, TCustomMetadata> {
|
|
1386
1523
|
readonly childTypes: ReadonlySet<TreeNodeSchema>;
|
|
1387
1524
|
// @sealed
|
|
1388
1525
|
createFromInsertable(data: TInsertable): Unhydrated<TreeNode | TreeLeafValue>;
|
|
1389
1526
|
readonly identifier: Name;
|
|
1390
1527
|
readonly implicitlyConstructable: ImplicitlyConstructable;
|
|
1391
1528
|
readonly info: Info;
|
|
1392
|
-
// (undocumented)
|
|
1393
|
-
readonly kind: Kind;
|
|
1394
|
-
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
1395
1529
|
}
|
|
1396
1530
|
|
|
1397
1531
|
// @public @sealed
|
|
@@ -1414,7 +1548,7 @@ type TreeNodeSchemaUnsafe<Name extends string = string, Kind extends NodeKind =
|
|
|
1414
1548
|
export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
|
|
1415
1549
|
|
|
1416
1550
|
// @public
|
|
1417
|
-
export type TreeObjectNodeUnsafe<T extends
|
|
1551
|
+
export type TreeObjectNodeUnsafe<T extends RestrictiveStringRecord<ImplicitFieldSchemaUnsafe>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecordUnsafe<T> & WithType<TypeName, NodeKind.Object, T>;
|
|
1418
1552
|
|
|
1419
1553
|
// @public
|
|
1420
1554
|
export enum TreeStatus {
|
|
@@ -1505,6 +1639,20 @@ export type ValidateRecursiveSchema<T extends TreeNodeSchemaClass<string, NodeKi
|
|
|
1505
1639
|
[NodeKind.Map]: ImplicitAllowedTypes;
|
|
1506
1640
|
}[T["kind"]]>> = true;
|
|
1507
1641
|
|
|
1642
|
+
// @alpha
|
|
1643
|
+
export enum ValueSchema {
|
|
1644
|
+
// (undocumented)
|
|
1645
|
+
Boolean = 2,
|
|
1646
|
+
// (undocumented)
|
|
1647
|
+
FluidHandle = 3,
|
|
1648
|
+
// (undocumented)
|
|
1649
|
+
Null = 4,
|
|
1650
|
+
// (undocumented)
|
|
1651
|
+
Number = 0,
|
|
1652
|
+
// (undocumented)
|
|
1653
|
+
String = 1
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1508
1656
|
// @alpha
|
|
1509
1657
|
export type VerboseTree<THandle = IFluidHandle> = VerboseTreeNode<THandle> | Exclude<TreeLeafValue, IFluidHandle> | THandle;
|
|
1510
1658
|
|