fluid-framework 2.23.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 +1311 -1158
- package/api-extractor/api-extractor.current.json +0 -3
- package/api-report/fluid-framework.alpha.api.md +264 -100
- 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 +33 -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 +33 -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
|
|
|
@@ -51,6 +73,12 @@ export interface BranchableTree extends ViewableTree {
|
|
|
51
73
|
rebase(branch: TreeBranchFork): void;
|
|
52
74
|
}
|
|
53
75
|
|
|
76
|
+
// @alpha
|
|
77
|
+
export function cloneWithReplacements(root: unknown, rootKey: string, replacer: (key: string, value: unknown) => {
|
|
78
|
+
clone: boolean;
|
|
79
|
+
value: unknown;
|
|
80
|
+
}): unknown;
|
|
81
|
+
|
|
54
82
|
// @public
|
|
55
83
|
export enum CommitKind {
|
|
56
84
|
Default = 0,
|
|
@@ -123,9 +151,8 @@ interface DefaultProvider extends ErasedType<"@fluidframework/tree.FieldProvider
|
|
|
123
151
|
}
|
|
124
152
|
|
|
125
153
|
// @alpha
|
|
126
|
-
export interface EncodeOptions
|
|
154
|
+
export interface EncodeOptions {
|
|
127
155
|
readonly useStoredKeys?: boolean;
|
|
128
|
-
valueConverter(data: IFluidHandle): TCustom;
|
|
129
156
|
}
|
|
130
157
|
|
|
131
158
|
// @alpha
|
|
@@ -145,6 +172,9 @@ export abstract class ErasedType<out Name = unknown> {
|
|
|
145
172
|
protected abstract brand(dummy: never): Name;
|
|
146
173
|
}
|
|
147
174
|
|
|
175
|
+
// @alpha
|
|
176
|
+
export function evaluateLazySchema<T extends TreeNodeSchema>(value: LazyItem<T>): T;
|
|
177
|
+
|
|
148
178
|
// @public
|
|
149
179
|
type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result ? Result : Item;
|
|
150
180
|
|
|
@@ -163,7 +193,7 @@ export type FactoryContentObject = {
|
|
|
163
193
|
type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<FieldKind.Optional | FieldKind.Identifier> ? true : false;
|
|
164
194
|
|
|
165
195
|
// @public @sealed
|
|
166
|
-
type FieldHasDefaultUnsafe<T extends
|
|
196
|
+
type FieldHasDefaultUnsafe<T extends ImplicitFieldSchemaUnsafe> = T extends FieldSchemaUnsafe<FieldKind.Optional | FieldKind.Identifier, ImplicitAllowedTypesUnsafe> ? true : false;
|
|
167
197
|
|
|
168
198
|
// @public
|
|
169
199
|
export enum FieldKind {
|
|
@@ -181,23 +211,39 @@ export interface FieldProps<TCustomMetadata = unknown> {
|
|
|
181
211
|
|
|
182
212
|
// @public @sealed
|
|
183
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);
|
|
184
218
|
readonly allowedTypes: Types;
|
|
185
219
|
get allowedTypeSet(): ReadonlySet<TreeNodeSchema>;
|
|
186
220
|
readonly kind: Kind;
|
|
187
|
-
get metadata(): FieldSchemaMetadata<TCustomMetadata
|
|
221
|
+
get metadata(): FieldSchemaMetadata<TCustomMetadata>;
|
|
188
222
|
readonly props?: FieldProps<TCustomMetadata> | undefined;
|
|
189
223
|
readonly requiresValue: boolean;
|
|
190
224
|
protected _typeCheck: MakeNominal;
|
|
191
225
|
}
|
|
192
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
|
+
|
|
193
239
|
// @public @sealed
|
|
194
240
|
export interface FieldSchemaMetadata<TCustomMetadata = unknown> {
|
|
195
241
|
readonly custom?: TCustomMetadata;
|
|
196
242
|
readonly description?: string | undefined;
|
|
197
243
|
}
|
|
198
244
|
|
|
199
|
-
// @public
|
|
200
|
-
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> {
|
|
201
247
|
readonly allowedTypes: Types;
|
|
202
248
|
readonly allowedTypeSet: ReadonlySet<TreeNodeSchema>;
|
|
203
249
|
readonly kind: Kind;
|
|
@@ -251,6 +297,9 @@ export const ForestTypeOptimized: ForestType;
|
|
|
251
297
|
// @alpha
|
|
252
298
|
export const ForestTypeReference: ForestType;
|
|
253
299
|
|
|
300
|
+
// @alpha
|
|
301
|
+
export function generateSchemaFromSimpleSchema(simple: SimpleTreeSchema): FieldSchemaAlpha;
|
|
302
|
+
|
|
254
303
|
// @alpha @deprecated
|
|
255
304
|
export function getBranch(tree: ITree): BranchableTree;
|
|
256
305
|
|
|
@@ -260,6 +309,9 @@ export function getBranch<T extends ImplicitFieldSchema | UnsafeUnknownSchema>(v
|
|
|
260
309
|
// @alpha
|
|
261
310
|
export function getJsonSchema(schema: ImplicitFieldSchema): JsonTreeSchema;
|
|
262
311
|
|
|
312
|
+
// @alpha
|
|
313
|
+
export type HandleConverter<TCustom> = (data: IFluidHandle) => TCustom;
|
|
314
|
+
|
|
263
315
|
// @alpha
|
|
264
316
|
export interface ICodecOptions {
|
|
265
317
|
readonly jsonValidator: JsonValidator;
|
|
@@ -524,9 +576,15 @@ export interface IMember {
|
|
|
524
576
|
// @public
|
|
525
577
|
export type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;
|
|
526
578
|
|
|
579
|
+
// @public
|
|
580
|
+
export type ImplicitAllowedTypesUnsafe = TreeNodeSchemaUnsafe | readonly LazyItem<Unenforced<TreeNodeSchema>>[];
|
|
581
|
+
|
|
527
582
|
// @public
|
|
528
583
|
export type ImplicitFieldSchema = FieldSchema | ImplicitAllowedTypes;
|
|
529
584
|
|
|
585
|
+
// @public
|
|
586
|
+
export type ImplicitFieldSchemaUnsafe = FieldSchemaUnsafe<FieldKind, ImplicitAllowedTypesUnsafe> | ImplicitAllowedTypesUnsafe;
|
|
587
|
+
|
|
530
588
|
// @alpha
|
|
531
589
|
export function independentInitializedView<const TSchema extends ImplicitFieldSchema>(config: TreeViewConfiguration<TSchema>, options: ForestOptions & ICodecOptions, content: ViewContent): TreeViewAlpha<TSchema>;
|
|
532
590
|
|
|
@@ -558,24 +616,26 @@ TSchema
|
|
|
558
616
|
] extends [ImplicitFieldSchema] ? InsertableTreeFieldFromImplicitField<TSchema> : [TSchema] extends [UnsafeUnknownSchema] ? InsertableContent | undefined : never;
|
|
559
617
|
|
|
560
618
|
// @public
|
|
561
|
-
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<{
|
|
562
622
|
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property & string]>;
|
|
563
623
|
} & {
|
|
564
624
|
readonly [Property in keyof T as FieldHasDefault<T[Property & string]> extends false ? Property : never]: InsertableTreeFieldFromImplicitField<T[Property & string]>;
|
|
565
625
|
}>;
|
|
566
626
|
|
|
567
627
|
// @public
|
|
568
|
-
export type InsertableObjectFromSchemaRecordUnsafe<T extends
|
|
569
|
-
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]>;
|
|
570
630
|
} & {
|
|
571
|
-
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]>;
|
|
572
632
|
};
|
|
573
633
|
|
|
574
634
|
// @public
|
|
575
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;
|
|
576
636
|
|
|
577
637
|
// @public
|
|
578
|
-
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;
|
|
579
639
|
|
|
580
640
|
// @public
|
|
581
641
|
export type InsertableTreeNodeFromAllowedTypes<TList extends AllowedTypes> = TList extends readonly [
|
|
@@ -584,7 +644,7 @@ LazyItem<infer TSchema extends TreeNodeSchema>,
|
|
|
584
644
|
] ? InsertableTypedNode<TSchema> | InsertableTreeNodeFromAllowedTypes<Rest> : never;
|
|
585
645
|
|
|
586
646
|
// @public
|
|
587
|
-
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends
|
|
647
|
+
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends AllowedTypesUnsafe> = TList extends readonly [
|
|
588
648
|
LazyItem<infer TSchema extends TreeNodeSchemaUnsafe>,
|
|
589
649
|
...infer Rest extends AllowedTypesUnsafe
|
|
590
650
|
] ? InsertableTypedNodeUnsafe<TSchema> | InsertableTreeNodeFromAllowedTypesUnsafe<Rest> : never;
|
|
@@ -595,13 +655,13 @@ TSchema
|
|
|
595
655
|
] extends [TreeNodeSchema] ? InsertableTypedNode<TSchema> : [TSchema] extends [AllowedTypes] ? InsertableTreeNodeFromAllowedTypes<TSchema> : never;
|
|
596
656
|
|
|
597
657
|
// @public
|
|
598
|
-
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends
|
|
658
|
+
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends ImplicitAllowedTypesUnsafe> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
|
|
599
659
|
|
|
600
660
|
// @public
|
|
601
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);
|
|
602
662
|
|
|
603
663
|
// @public
|
|
604
|
-
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);
|
|
605
665
|
|
|
606
666
|
// @public @sealed
|
|
607
667
|
export interface InternalTreeNode extends ErasedType<"@fluidframework/tree.InternalTreeNode"> {
|
|
@@ -708,31 +768,25 @@ export interface JsonArrayNodeSchema extends JsonNodeSchemaBase<NodeKind.Array,
|
|
|
708
768
|
|
|
709
769
|
// @alpha
|
|
710
770
|
export namespace JsonAsTree {
|
|
711
|
-
const Primitive: readonly [
|
|
771
|
+
const Primitive: readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>];
|
|
712
772
|
// @sealed
|
|
713
773
|
export class Array extends _APIExtractorWorkaroundArrayBase {
|
|
714
774
|
}
|
|
715
|
-
const Tree: readonly [
|
|
775
|
+
const Tree: readonly [LeafSchema<"null", null>, LeafSchema<"number", number>, LeafSchema<"string", string>, LeafSchema<"boolean", boolean>, () => typeof JsonObject, () => typeof Array];
|
|
716
776
|
// @sealed
|
|
717
777
|
export class JsonObject extends _APIExtractorWorkaroundObjectBase {
|
|
718
778
|
}
|
|
719
|
-
const _APIExtractorWorkaroundObjectBase:
|
|
720
|
-
|
|
721
|
-
create(data: boolean): boolean;
|
|
722
|
-
}> | 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>;
|
|
723
781
|
} | {
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
}> | null;
|
|
727
|
-
}, 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>;
|
|
728
784
|
// (undocumented)
|
|
729
785
|
export type Primitive = TreeNodeFromImplicitAllowedTypes<typeof Primitive>;
|
|
730
786
|
export type _RecursiveArrayWorkaroundJsonArray = FixRecursiveArraySchema<typeof Array>;
|
|
731
|
-
const _APIExtractorWorkaroundArrayBase:
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
}> | null, any, undefined>;
|
|
735
|
-
}, 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>;
|
|
736
790
|
// (undocumented)
|
|
737
791
|
export type Tree = TreeNodeFromImplicitAllowedTypes<typeof Tree>;
|
|
738
792
|
}
|
|
@@ -811,6 +865,10 @@ export interface JsonValidator {
|
|
|
811
865
|
// @public
|
|
812
866
|
export type LazyItem<Item = unknown> = Item | (() => Item);
|
|
813
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
|
+
|
|
814
872
|
// @public @sealed
|
|
815
873
|
export interface Listenable<TListeners extends object> {
|
|
816
874
|
off<K extends keyof Listeners<TListeners>>(eventName: K, listener: TListeners[K]): void;
|
|
@@ -826,9 +884,36 @@ export type Listeners<T extends object> = {
|
|
|
826
884
|
export interface MakeNominal {
|
|
827
885
|
}
|
|
828
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
|
+
|
|
829
902
|
// @public
|
|
830
903
|
export type MapNodeInsertableData<T extends ImplicitAllowedTypes> = Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]> | RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;
|
|
831
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
|
+
|
|
832
917
|
// @public
|
|
833
918
|
export type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;
|
|
834
919
|
|
|
@@ -885,22 +970,34 @@ export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
|
|
|
885
970
|
export const noopValidator: JsonValidator;
|
|
886
971
|
|
|
887
972
|
// @public
|
|
888
|
-
type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = {
|
|
973
|
+
type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = RestrictiveStringRecord<ImplicitFieldSchema> extends T ? {} : {
|
|
889
974
|
-readonly [Property in keyof T]: Property extends string ? TreeFieldFromImplicitField<T[Property]> : unknown;
|
|
890
975
|
};
|
|
891
976
|
|
|
892
977
|
// @public
|
|
893
|
-
type ObjectFromSchemaRecordUnsafe<T extends
|
|
894
|
-
-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>;
|
|
895
990
|
};
|
|
896
991
|
|
|
897
992
|
// @public
|
|
898
993
|
export type Off = () => void;
|
|
899
994
|
|
|
900
995
|
// @alpha
|
|
901
|
-
export
|
|
996
|
+
export function onAssertionFailure(handler: (error: Error) => void): () => void;
|
|
997
|
+
|
|
998
|
+
// @alpha
|
|
999
|
+
export interface ParseOptions {
|
|
902
1000
|
readonly useStoredKeys?: boolean;
|
|
903
|
-
valueConverter(data: VerboseTree<TCustom>): TreeLeafValue | VerboseTreeNode<TCustom>;
|
|
904
1001
|
}
|
|
905
1002
|
|
|
906
1003
|
// @alpha
|
|
@@ -914,7 +1011,7 @@ export interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue> extends Rea
|
|
|
914
1011
|
}
|
|
915
1012
|
|
|
916
1013
|
// @public @sealed
|
|
917
|
-
interface ReadonlyMapInlined<K, T extends
|
|
1014
|
+
interface ReadonlyMapInlined<K, T extends ImplicitAllowedTypesUnsafe> {
|
|
918
1015
|
[Symbol.iterator](): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;
|
|
919
1016
|
entries(): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;
|
|
920
1017
|
// (undocumented)
|
|
@@ -934,11 +1031,20 @@ export type ReadSchema<TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema
|
|
|
934
1031
|
TSchema
|
|
935
1032
|
] extends [ImplicitFieldSchema] ? TSchema : ImplicitFieldSchema;
|
|
936
1033
|
|
|
1034
|
+
// @alpha
|
|
1035
|
+
export function replaceConciseTreeHandles<T>(tree: ConciseTree, replacer: HandleConverter<T>): ConciseTree<T>;
|
|
1036
|
+
|
|
1037
|
+
// @alpha
|
|
1038
|
+
export function replaceHandles<T>(tree: unknown, replacer: HandleConverter<T>): unknown;
|
|
1039
|
+
|
|
937
1040
|
// @public
|
|
938
1041
|
export type ReplaceIEventThisPlaceHolder<L extends any[], TThis> = L extends any[] ? {
|
|
939
1042
|
[K in keyof L]: L[K] extends IEventThisPlaceHolder ? TThis : L[K];
|
|
940
1043
|
} : L;
|
|
941
1044
|
|
|
1045
|
+
// @alpha
|
|
1046
|
+
export function replaceVerboseTreeHandles<T>(tree: VerboseTree, replacer: HandleConverter<T>): VerboseTree<T>;
|
|
1047
|
+
|
|
942
1048
|
// @public @deprecated
|
|
943
1049
|
export type RestrictiveReadonlyRecord<K extends symbol | string, T> = {
|
|
944
1050
|
readonly [P in symbol | string]: P extends K ? T : never;
|
|
@@ -1010,24 +1116,24 @@ export interface SchemaCompatibilityStatus {
|
|
|
1010
1116
|
}
|
|
1011
1117
|
|
|
1012
1118
|
// @public @sealed
|
|
1013
|
-
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 {
|
|
1014
1120
|
constructor(
|
|
1015
1121
|
scope: TScope);
|
|
1016
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>;
|
|
1017
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>;
|
|
1018
|
-
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>, {
|
|
1019
1125
|
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
1020
1126
|
}, false, T, undefined>;
|
|
1021
|
-
readonly boolean:
|
|
1022
|
-
static readonly boolean:
|
|
1023
|
-
readonly handle:
|
|
1024
|
-
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>>;
|
|
1025
1131
|
get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
|
|
1026
|
-
readonly leaves: readonly [
|
|
1027
|
-
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>>];
|
|
1028
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>;
|
|
1029
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>;
|
|
1030
|
-
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>, {
|
|
1031
1137
|
[Symbol.iterator](): Iterator<[
|
|
1032
1138
|
string,
|
|
1033
1139
|
InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>
|
|
@@ -1035,42 +1141,38 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
1035
1141
|
} | {
|
|
1036
1142
|
readonly [x: string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
1037
1143
|
}, false, T, undefined>;
|
|
1038
|
-
readonly null:
|
|
1039
|
-
static readonly null:
|
|
1040
|
-
readonly number:
|
|
1041
|
-
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>;
|
|
1042
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>;
|
|
1043
|
-
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>;
|
|
1044
1150
|
readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
1045
1151
|
static readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
1046
|
-
readonly optionalRecursive: <const T extends unknown>(t: T, props?: Omit<FieldProps<
|
|
1047
|
-
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>;
|
|
1048
1154
|
readonly required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
1049
1155
|
static readonly required: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
1050
|
-
readonly requiredRecursive: <const T extends unknown>(t: T, props?: Omit<FieldProps<
|
|
1051
|
-
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>;
|
|
1052
1158
|
readonly scope: TScope;
|
|
1053
|
-
readonly string:
|
|
1054
|
-
static readonly string:
|
|
1159
|
+
readonly string: LeafSchema<"string", string>;
|
|
1160
|
+
static readonly string: LeafSchema<"string", string>;
|
|
1055
1161
|
}
|
|
1056
1162
|
|
|
1057
1163
|
// @alpha
|
|
1058
1164
|
export class SchemaFactoryAlpha<out TScope extends string | undefined = string | undefined, TName extends number | string = string> extends SchemaFactory<TScope, TName> {
|
|
1059
|
-
arrayAlpha<const Name extends TName, const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>):
|
|
1060
|
-
arrayRecursive<const Name extends TName, const T extends
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
readonly [x: string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
1071
|
-
}, false, T, undefined, TCustomMetadata>;
|
|
1072
|
-
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>;
|
|
1073
|
-
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>;
|
|
1175
|
+
scopedFactory<const T extends TName, TNameInner extends number | string = string>(name: T): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner>;
|
|
1074
1176
|
}
|
|
1075
1177
|
|
|
1076
1178
|
// @alpha
|
|
@@ -1079,18 +1181,24 @@ export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown> extends N
|
|
|
1079
1181
|
}
|
|
1080
1182
|
|
|
1081
1183
|
// @public @sealed
|
|
1082
|
-
export
|
|
1083
|
-
readonly
|
|
1084
|
-
readonly
|
|
1085
|
-
readonly
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
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>;
|
|
1089
1196
|
readonly optional: <const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">) => FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
1090
|
-
readonly
|
|
1091
|
-
readonly
|
|
1092
|
-
readonly requiredRecursive: <const
|
|
1093
|
-
|
|
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
|
+
}
|
|
1094
1202
|
|
|
1095
1203
|
// @alpha
|
|
1096
1204
|
export interface SchemaValidationFunction<Schema extends TSchema> {
|
|
@@ -1127,9 +1235,57 @@ export type SharedTreeFormatVersion = typeof SharedTreeFormatVersion;
|
|
|
1127
1235
|
// @alpha
|
|
1128
1236
|
export type SharedTreeOptions = Partial<ICodecOptions> & Partial<SharedTreeFormatOptions> & ForestOptions;
|
|
1129
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
|
+
|
|
1130
1279
|
// @alpha
|
|
1131
1280
|
export type SimpleTreeIndex<TKey extends TreeIndexKey, TValue> = TreeIndex<TKey, TValue>;
|
|
1132
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
|
+
|
|
1133
1289
|
// @alpha
|
|
1134
1290
|
export function singletonSchema<TScope extends string, TName extends string | number>(factory: SchemaFactory<TScope, TName>, name: TName): TreeNodeSchemaClass<ScopedSchemaName<TScope, TName>, NodeKind.Object, TreeNode & {
|
|
1135
1291
|
readonly value: TName;
|
|
@@ -1189,12 +1345,10 @@ export const TreeAlpha: {
|
|
|
1189
1345
|
branch(node: TreeNode): TreeBranch | undefined;
|
|
1190
1346
|
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>;
|
|
1191
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>;
|
|
1192
|
-
importVerbose<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: VerboseTree | undefined, options?: Partial<ParseOptions
|
|
1193
|
-
|
|
1194
|
-
exportConcise(node: TreeNode | TreeLeafValue, options?:
|
|
1195
|
-
|
|
1196
|
-
exportVerbose(node: TreeNode | TreeLeafValue, options?: Partial<EncodeOptions<IFluidHandle>>): VerboseTree;
|
|
1197
|
-
exportVerbose<T>(node: TreeNode | TreeLeafValue, options: EncodeOptions<T>): VerboseTree<T>;
|
|
1348
|
+
importVerbose<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: VerboseTree | undefined, options?: Partial<ParseOptions>): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
1349
|
+
exportConcise(node: TreeNode | TreeLeafValue, options?: EncodeOptions): ConciseTree;
|
|
1350
|
+
exportConcise(node: TreeNode | TreeLeafValue | undefined, options?: EncodeOptions): ConciseTree | undefined;
|
|
1351
|
+
exportVerbose(node: TreeNode | TreeLeafValue, options?: EncodeOptions): VerboseTree;
|
|
1198
1352
|
exportCompressed(tree: TreeNode | TreeLeafValue, options: {
|
|
1199
1353
|
oldestCompatibleClient: FluidClientVersion;
|
|
1200
1354
|
idCompressor?: IIdCompressor;
|
|
@@ -1211,7 +1365,7 @@ interface TreeApi extends TreeNodeApi {
|
|
|
1211
1365
|
}
|
|
1212
1366
|
|
|
1213
1367
|
// @public @sealed
|
|
1214
|
-
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> {
|
|
1215
1369
|
insertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
1216
1370
|
insertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
1217
1371
|
insertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
@@ -1238,7 +1392,7 @@ export const TreeArrayNode: {
|
|
|
1238
1392
|
};
|
|
1239
1393
|
|
|
1240
1394
|
// @public @sealed
|
|
1241
|
-
export interface TreeArrayNodeUnsafe<TAllowedTypes extends
|
|
1395
|
+
export interface TreeArrayNodeUnsafe<TAllowedTypes extends ImplicitAllowedTypesUnsafe> extends TreeArrayNode<TAllowedTypes, TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>> {
|
|
1242
1396
|
}
|
|
1243
1397
|
|
|
1244
1398
|
// @beta @sealed
|
|
@@ -1258,10 +1412,9 @@ export interface TreeBranch extends IDisposable {
|
|
|
1258
1412
|
}
|
|
1259
1413
|
|
|
1260
1414
|
// @alpha @sealed
|
|
1261
|
-
export interface TreeBranchEvents {
|
|
1415
|
+
export interface TreeBranchEvents extends Omit<TreeViewEvents, "commitApplied"> {
|
|
1262
1416
|
changed(data: CommitMetadata, getRevertible?: RevertibleAlphaFactory): void;
|
|
1263
1417
|
commitApplied(data: CommitMetadata, getRevertible?: RevertibleAlphaFactory): void;
|
|
1264
|
-
schemaChanged(): void;
|
|
1265
1418
|
}
|
|
1266
1419
|
|
|
1267
1420
|
// @alpha @sealed
|
|
@@ -1290,7 +1443,7 @@ export enum TreeCompressionStrategy {
|
|
|
1290
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;
|
|
1291
1444
|
|
|
1292
1445
|
// @public
|
|
1293
|
-
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;
|
|
1294
1447
|
|
|
1295
1448
|
// @alpha
|
|
1296
1449
|
export interface TreeIndex<TKey extends TreeIndexKey, TValue> extends ReadonlyMap<TKey, TValue> {
|
|
@@ -1317,7 +1470,7 @@ export interface TreeMapNode<T extends ImplicitAllowedTypes = ImplicitAllowedTyp
|
|
|
1317
1470
|
}
|
|
1318
1471
|
|
|
1319
1472
|
// @public @sealed
|
|
1320
|
-
export interface TreeMapNodeUnsafe<T extends
|
|
1473
|
+
export interface TreeMapNodeUnsafe<T extends ImplicitAllowedTypesUnsafe> extends ReadonlyMapInlined<string, T>, TreeNode {
|
|
1321
1474
|
delete(key: string): void;
|
|
1322
1475
|
set(key: string, value: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T> | undefined): void;
|
|
1323
1476
|
}
|
|
@@ -1347,7 +1500,7 @@ export interface TreeNodeApi {
|
|
|
1347
1500
|
export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
|
|
1348
1501
|
|
|
1349
1502
|
// @public
|
|
1350
|
-
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends
|
|
1503
|
+
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends ImplicitAllowedTypesUnsafe> = TSchema extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<TSchema> : TSchema extends AllowedTypesUnsafe ? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>> : unknown;
|
|
1351
1504
|
|
|
1352
1505
|
// @public @sealed
|
|
1353
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>;
|
|
@@ -1360,22 +1513,19 @@ export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeK
|
|
|
1360
1513
|
});
|
|
1361
1514
|
|
|
1362
1515
|
// @public
|
|
1363
|
-
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> {
|
|
1364
1517
|
// @sealed
|
|
1365
1518
|
new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
|
|
1366
1519
|
}
|
|
1367
1520
|
|
|
1368
1521
|
// @public @sealed
|
|
1369
|
-
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> {
|
|
1370
1523
|
readonly childTypes: ReadonlySet<TreeNodeSchema>;
|
|
1371
1524
|
// @sealed
|
|
1372
1525
|
createFromInsertable(data: TInsertable): Unhydrated<TreeNode | TreeLeafValue>;
|
|
1373
1526
|
readonly identifier: Name;
|
|
1374
1527
|
readonly implicitlyConstructable: ImplicitlyConstructable;
|
|
1375
1528
|
readonly info: Info;
|
|
1376
|
-
// (undocumented)
|
|
1377
|
-
readonly kind: Kind;
|
|
1378
|
-
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
1379
1529
|
}
|
|
1380
1530
|
|
|
1381
1531
|
// @public @sealed
|
|
@@ -1398,7 +1548,7 @@ type TreeNodeSchemaUnsafe<Name extends string = string, Kind extends NodeKind =
|
|
|
1398
1548
|
export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
|
|
1399
1549
|
|
|
1400
1550
|
// @public
|
|
1401
|
-
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>;
|
|
1402
1552
|
|
|
1403
1553
|
// @public
|
|
1404
1554
|
export enum TreeStatus {
|
|
@@ -1489,6 +1639,20 @@ export type ValidateRecursiveSchema<T extends TreeNodeSchemaClass<string, NodeKi
|
|
|
1489
1639
|
[NodeKind.Map]: ImplicitAllowedTypes;
|
|
1490
1640
|
}[T["kind"]]>> = true;
|
|
1491
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
|
+
|
|
1492
1656
|
// @alpha
|
|
1493
1657
|
export type VerboseTree<THandle = IFluidHandle> = VerboseTreeNode<THandle> | Exclude<TreeLeafValue, IFluidHandle> | THandle;
|
|
1494
1658
|
|