fluid-framework 2.33.2 → 2.40.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 +70 -0
- package/api-report/fluid-framework.alpha.api.md +124 -52
- package/api-report/fluid-framework.beta.api.md +31 -28
- package/api-report/fluid-framework.legacy.alpha.api.md +24 -85
- package/api-report/fluid-framework.legacy.public.api.md +24 -24
- package/api-report/fluid-framework.public.api.md +24 -24
- package/dist/alpha.d.ts +17 -1
- package/dist/beta.d.ts +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +2 -4
- package/dist/public.d.ts +2 -0
- package/lib/alpha.d.ts +17 -1
- package/lib/beta.d.ts +2 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +2 -4
- package/lib/public.d.ts +2 -0
- package/package.json +12 -12
- package/src/index.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# fluid-framework
|
|
2
2
|
|
|
3
|
+
## 2.40.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- SchemaFactoryAlpha.object has been renamed to SchemaFactoryAlpha.objectAlpha ([#24478](https://github.com/microsoft/FluidFramework/pull/24478)) [12e5ab3b33](https://github.com/microsoft/FluidFramework/commit/12e5ab3b335a8af263e1cc84f8951cf02db79b8b)
|
|
8
|
+
|
|
9
|
+
This rename was done so that changes can be made to the signature of the class.
|
|
10
|
+
This is a breaking change and uses of `SchemaFactoryAlpha.object` may need to be changed to `SchemaFactoryAlpha.objectAlpha`.
|
|
11
|
+
|
|
12
|
+
- AllowedTypes array handling has been updated ([#24484](https://github.com/microsoft/FluidFramework/pull/24484)) [f0a71ccce7](https://github.com/microsoft/FluidFramework/commit/f0a71ccce7a055e99ce9f4ba15e1cede529bbc9c)
|
|
13
|
+
|
|
14
|
+
As an optimization, how [AllowedTypes](https://fluidframework.com/docs/api/fluid-framework/allowedtypes-typealias) arrays are processed has changed.
|
|
15
|
+
Now much larger arrays can be provided without hitting:
|
|
16
|
+
|
|
17
|
+
> "Type instantiation is excessively deep and possibly infinite.ts"
|
|
18
|
+
|
|
19
|
+
Previously, arrays of around 43 schema would start having this issue, but now arrays of hundreds work correctly.
|
|
20
|
+
|
|
21
|
+
This optimization has resulted in a small change in behavior for how [input types](https://fluidframework.com/docs/api/fluid-framework/input-typealias) are computed.
|
|
22
|
+
When the `AllowedTypes` array has a type that is a union of two arrays, and the two arrays start with the same subsequence of types,
|
|
23
|
+
previously this would allow the types from the common prefix of the arrays.
|
|
24
|
+
For example `[typeof A] | [typeof A, typeof B]` would permit inserting content compatible with `A`.
|
|
25
|
+
Now all such unions produce `never` for their insertable node types (just like this example would if the order of the second array were reversed).
|
|
26
|
+
This case was not intentionally supported, and as documented in [input types](https://fluidframework.com/docs/api/fluid-framework/input-typealias), non-exact types, like these unions,
|
|
27
|
+
are not guaranteed to produce anything other than `never`.
|
|
28
|
+
|
|
29
|
+
If providing exact schema is impractical and the previous behavior is required, convert the union of arrays to an array of unions.
|
|
30
|
+
The above example can be turned into `[typeof A, typeof B | typeof A]`.
|
|
31
|
+
|
|
32
|
+
This is also fix for a case where
|
|
33
|
+
[AllowedTypes](https://fluidframework.com/docs/api/fluid-framework/allowedtypes-typealias)
|
|
34
|
+
was order dependent, which violates its documented order independence.
|
|
35
|
+
|
|
36
|
+
- A SharedTree document corruption bug has been fixed ([#24565](https://github.com/microsoft/FluidFramework/pull/24565)) [6b3e150395](https://github.com/microsoft/FluidFramework/commit/6b3e15039543a2bab4de5b2e969301f0e7f1f3db)
|
|
37
|
+
|
|
38
|
+
There was a bug where local changes were not correctly sent to peers.
|
|
39
|
+
This could lead to a permanent loss of consistency and ultimately document corruption.
|
|
40
|
+
See [PR24561](https://github.com/microsoft/FluidFramework/pull/24561) for details.
|
|
41
|
+
|
|
42
|
+
- IContainer.getContainerPackageInfo has been removed ([#24525](https://github.com/microsoft/FluidFramework/pull/24525)) [15a541265b](https://github.com/microsoft/FluidFramework/commit/15a541265ba6293bf24e95308a5e667d5f7e9794)
|
|
43
|
+
|
|
44
|
+
`IContainer.getContainerPackageInfo()` was set to be removed in release 2.40.0. To access the package name `getContainerPackageInfo()` provided, use `IFluidCodeDetails.package` returned by `IContainer.getLoadedCodeDetails()`.
|
|
45
|
+
|
|
46
|
+
See [issue #23898](https://github.com/microsoft/FluidFramework/issues/23898) for more information.
|
|
47
|
+
|
|
48
|
+
- The extractPersistedSchema (alpha) API has had its arguments adjusted ([#24562](https://github.com/microsoft/FluidFramework/pull/24562)) [2e6b0cfd74](https://github.com/microsoft/FluidFramework/commit/2e6b0cfd74f3c3db5ce3b6b3f8ff8decbfc24ab6)
|
|
49
|
+
|
|
50
|
+
The [extractPersistedSchema](https://fluidframework.com/docs/api/tree/#extractpersistedschema-function) function has been updated to take in [SimpleTreeSchema](https://fluidframework.com/docs/api/fluid-framework/simpletreeschema-interface).
|
|
51
|
+
This makes it possible to use with simple schema derived from stored schema, like those returned from [ITreeAlpha.exportSimpleSchema](https://fluidframework.com/docs/api/fluid-framework/itreealpha-interface#exportsimpleschema-methodsignature).
|
|
52
|
+
Like [TreeAlpha.exportCompressed](https://fluidframework.com/docs/api/tree#treealpha-variable), `extractPersistedSchema` now takes in [FluidClientVersion](https://fluidframework.com/docs/api/fluid-framework/fluidclientversion-enum) to make it possible to opt into newer formats when they become available.
|
|
53
|
+
|
|
54
|
+
Additionally, `persistedToSimpleSchema` has been added to fill in a gap in the API.
|
|
55
|
+
Without `persistedToSimpleSchema` it would be impossible to parse the persisted format without a valid compressed tree to provide to [independentInitializedView](https://fluidframework.com/docs/api/tree/#independentinitializedview-functionc).
|
|
56
|
+
|
|
57
|
+
- SchemaFactoryAlpha supports adding metadata to AllowedTypes ([#24478](https://github.com/microsoft/FluidFramework/pull/24478)) [12e5ab3b33](https://github.com/microsoft/FluidFramework/commit/12e5ab3b335a8af263e1cc84f8951cf02db79b8b)
|
|
58
|
+
|
|
59
|
+
This change allows metadata to be added to [`AllowedTypes`](https://fluidframework.com/docs/api/fluid-framework/allowedtypes-typealias) as well as individual types in a set of `AllowedTypes`.
|
|
60
|
+
Users can define custom metadata by putting their `AllowedTypes` in an object with `metadata` and `types` properties:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
schemaFactoryAlpha.arrayAlpha({
|
|
64
|
+
metadata: {
|
|
65
|
+
custom: "these allowed types are annotated",
|
|
66
|
+
},
|
|
67
|
+
types: [SchemaFactory.string, SchemaFactory.number],
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This annotation system will also be used to implement future schema features.
|
|
72
|
+
|
|
3
73
|
## 2.33.0
|
|
4
74
|
|
|
5
75
|
### Minor Changes
|
|
@@ -15,12 +15,34 @@ export function adaptEnum<TScope extends string, const TEnum extends Record<stri
|
|
|
15
15
|
}, Record<string, never>, true, Record<string, never>, undefined>; }[keyof TEnum]>;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
// @alpha
|
|
19
|
+
export interface AllowedTypeMetadata {
|
|
20
|
+
readonly custom?: unknown;
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
// @public @system
|
|
19
24
|
export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
|
|
20
25
|
|
|
26
|
+
// @alpha
|
|
27
|
+
export interface AllowedTypesMetadata {
|
|
28
|
+
readonly custom?: unknown;
|
|
29
|
+
}
|
|
30
|
+
|
|
21
31
|
// @alpha
|
|
22
32
|
export function allowUnused<T>(t?: T): void;
|
|
23
33
|
|
|
34
|
+
// @alpha
|
|
35
|
+
export interface AnnotatedAllowedType<T extends TreeNodeSchema = TreeNodeSchema> {
|
|
36
|
+
readonly metadata: AllowedTypeMetadata;
|
|
37
|
+
readonly type: LazyItem<T>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// @alpha
|
|
41
|
+
export interface AnnotatedAllowedTypes {
|
|
42
|
+
readonly metadata: AllowedTypesMetadata;
|
|
43
|
+
readonly types: readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[];
|
|
44
|
+
}
|
|
45
|
+
|
|
24
46
|
// @public @system
|
|
25
47
|
type ApplyKind<T, Kind extends FieldKind> = {
|
|
26
48
|
[FieldKind.Required]: T;
|
|
@@ -34,7 +56,7 @@ Kind
|
|
|
34
56
|
] extends [FieldKind.Required] ? T : [Kind] extends [FieldKind.Optional] ? T | undefined : [Kind] extends [FieldKind.Identifier] ? DefaultsAreOptional extends true ? T | undefined : T : never;
|
|
35
57
|
|
|
36
58
|
// @alpha @sealed @system
|
|
37
|
-
export interface ArrayNodeCustomizableSchema<out TName extends string = string, in out T extends
|
|
59
|
+
export interface ArrayNodeCustomizableSchema<out TName extends string = string, in out T extends ImplicitAnnotatedAllowedTypes = ImplicitAnnotatedAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Array, TreeArrayNode<UnannotateImplicitAllowedTypes<T>> & WithType<TName, NodeKind.Array, T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<UnannotateImplicitAllowedTypes<T>>>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleArrayNodeSchema<TCustomMetadata> {
|
|
38
60
|
}
|
|
39
61
|
|
|
40
62
|
// @alpha @sealed @system
|
|
@@ -44,7 +66,7 @@ export interface ArrayNodeCustomizableSchemaUnsafe<out TName extends string, in
|
|
|
44
66
|
}
|
|
45
67
|
|
|
46
68
|
// @alpha @sealed @system
|
|
47
|
-
export interface ArrayNodePojoEmulationSchema<out TName extends string = string, in out T extends
|
|
69
|
+
export interface ArrayNodePojoEmulationSchema<out TName extends string = string, in out T extends ImplicitAnnotatedAllowedTypes = ImplicitAnnotatedAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaNonClass<TName, NodeKind.Array, TreeArrayNode<UnannotateImplicitAllowedTypes<T>> & WithType<TName, NodeKind.Array, T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<UnannotateImplicitAllowedTypes<T>>>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleArrayNodeSchema<TCustomMetadata> {
|
|
48
70
|
}
|
|
49
71
|
|
|
50
72
|
// @alpha
|
|
@@ -174,7 +196,7 @@ export function evaluateLazySchema<T extends TreeNodeSchema>(value: LazyItem<T>)
|
|
|
174
196
|
type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result ? Result : Item;
|
|
175
197
|
|
|
176
198
|
// @alpha
|
|
177
|
-
export function extractPersistedSchema(schema:
|
|
199
|
+
export function extractPersistedSchema(schema: SimpleTreeSchema, oldestCompatibleClient: FluidClientVersion): JsonCompatible;
|
|
178
200
|
|
|
179
201
|
// @alpha @system
|
|
180
202
|
export type FactoryContent = IFluidHandle | string | number | boolean | null | Iterable<readonly [string, InsertableContent]> | readonly InsertableContent[] | FactoryContentObject;
|
|
@@ -185,7 +207,9 @@ export type FactoryContentObject = {
|
|
|
185
207
|
};
|
|
186
208
|
|
|
187
209
|
// @public @system
|
|
188
|
-
type FieldHasDefault<T extends ImplicitFieldSchema> = T extends
|
|
210
|
+
type FieldHasDefault<T extends ImplicitFieldSchema> = [T] extends [
|
|
211
|
+
FieldSchema<FieldKind.Optional | FieldKind.Identifier>
|
|
212
|
+
] ? true : false;
|
|
189
213
|
|
|
190
214
|
// @public
|
|
191
215
|
export enum FieldKind {
|
|
@@ -218,9 +242,13 @@ export class FieldSchema<out Kind extends FieldKind = FieldKind, out Types exten
|
|
|
218
242
|
|
|
219
243
|
// @alpha @sealed
|
|
220
244
|
export class FieldSchemaAlpha<Kind extends FieldKind = FieldKind, Types extends ImplicitAllowedTypes = ImplicitAllowedTypes, TCustomMetadata = unknown> extends FieldSchema<Kind, Types, TCustomMetadata> implements SimpleFieldSchema {
|
|
221
|
-
protected constructor(kind: Kind,
|
|
245
|
+
protected constructor(kind: Kind, types: Types, annotatedAllowedTypes: ImplicitAnnotatedAllowedTypes, props?: FieldProps<TCustomMetadata>);
|
|
222
246
|
// (undocumented)
|
|
223
247
|
get allowedTypesIdentifiers(): ReadonlySet<string>;
|
|
248
|
+
readonly allowedTypesMetadata: AllowedTypesMetadata;
|
|
249
|
+
// (undocumented)
|
|
250
|
+
readonly annotatedAllowedTypes: ImplicitAnnotatedAllowedTypes;
|
|
251
|
+
get annotatedAllowedTypeSet(): ReadonlyMap<TreeNodeSchema, AllowedTypeMetadata>;
|
|
224
252
|
}
|
|
225
253
|
|
|
226
254
|
// @alpha @sealed @system
|
|
@@ -551,7 +579,6 @@ export const IFluidLoadable: keyof IProvideFluidLoadable;
|
|
|
551
579
|
|
|
552
580
|
// @public @sealed
|
|
553
581
|
export interface IFluidLoadable extends IProvideFluidLoadable {
|
|
554
|
-
// (undocumented)
|
|
555
582
|
readonly handle: IFluidHandle;
|
|
556
583
|
}
|
|
557
584
|
|
|
@@ -564,6 +591,12 @@ export interface IMember {
|
|
|
564
591
|
// @public
|
|
565
592
|
export type ImplicitAllowedTypes = AllowedTypes | TreeNodeSchema;
|
|
566
593
|
|
|
594
|
+
// @alpha
|
|
595
|
+
export type ImplicitAnnotatedAllowedTypes = TreeNodeSchema | AnnotatedAllowedType | AnnotatedAllowedTypes | readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[];
|
|
596
|
+
|
|
597
|
+
// @alpha
|
|
598
|
+
export type ImplicitAnnotatedFieldSchema = FieldSchema | ImplicitAnnotatedAllowedTypes;
|
|
599
|
+
|
|
567
600
|
// @public
|
|
568
601
|
export type ImplicitFieldSchema = FieldSchema | ImplicitAllowedTypes;
|
|
569
602
|
|
|
@@ -597,6 +630,9 @@ export type InsertableField<TSchema extends ImplicitFieldSchema | UnsafeUnknownS
|
|
|
597
630
|
TSchema
|
|
598
631
|
] extends [ImplicitFieldSchema] ? InsertableTreeFieldFromImplicitField<TSchema> : [TSchema] extends [UnsafeUnknownSchema] ? InsertableContent | undefined : never;
|
|
599
632
|
|
|
633
|
+
// @alpha @system
|
|
634
|
+
export type InsertableObjectFromAnnotatedSchemaRecord<T extends RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>> = InsertableObjectFromSchemaRecord<UnannotateSchemaRecord<T>>;
|
|
635
|
+
|
|
600
636
|
// @public @system
|
|
601
637
|
type InsertableObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = RestrictiveStringRecord<ImplicitFieldSchema> extends T ? {
|
|
602
638
|
arbitraryKey: "arbitraryValue";
|
|
@@ -610,12 +646,9 @@ type InsertableObjectFromSchemaRecord<T extends RestrictiveStringRecord<Implicit
|
|
|
610
646
|
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;
|
|
611
647
|
|
|
612
648
|
// @public @system
|
|
613
|
-
export type InsertableTreeNodeFromAllowedTypes<TList extends AllowedTypes> =
|
|
614
|
-
readonly [
|
|
615
|
-
|
|
616
|
-
...infer Rest extends AllowedTypes
|
|
617
|
-
]
|
|
618
|
-
] ? InsertableTypedNode<TSchema> | InsertableTreeNodeFromAllowedTypes<Rest> : never;
|
|
649
|
+
export type InsertableTreeNodeFromAllowedTypes<TList extends AllowedTypes> = IsUnion<TList> extends true ? never : {
|
|
650
|
+
readonly [Property in keyof TList]: TList[Property] extends LazyItem<infer TSchema extends TreeNodeSchema> ? InsertableTypedNode<TSchema> : never;
|
|
651
|
+
}[number];
|
|
619
652
|
|
|
620
653
|
// @public
|
|
621
654
|
export type InsertableTreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes> = [
|
|
@@ -643,8 +676,7 @@ declare namespace InternalTypes {
|
|
|
643
676
|
InsertableObjectFromSchemaRecord,
|
|
644
677
|
FlexList,
|
|
645
678
|
FlexListToUnion,
|
|
646
|
-
ExtractItemType
|
|
647
|
-
TreeApi
|
|
679
|
+
ExtractItemType
|
|
648
680
|
}
|
|
649
681
|
}
|
|
650
682
|
export { InternalTypes }
|
|
@@ -677,7 +709,7 @@ export function isFluidHandle(value: unknown): value is IFluidHandle;
|
|
|
677
709
|
// @public
|
|
678
710
|
export type IsListener<TListener> = TListener extends (...args: any[]) => void ? true : false;
|
|
679
711
|
|
|
680
|
-
// @
|
|
712
|
+
// @public @system
|
|
681
713
|
export type IsUnion<T, T2 = T> = T extends unknown ? [T2] extends [T] ? false : true : "error";
|
|
682
714
|
|
|
683
715
|
// @public
|
|
@@ -838,7 +870,7 @@ export interface MakeNominal {
|
|
|
838
870
|
}
|
|
839
871
|
|
|
840
872
|
// @alpha @sealed @system
|
|
841
|
-
export interface MapNodeCustomizableSchema<out TName extends string = string, in out T extends
|
|
873
|
+
export interface MapNodeCustomizableSchema<out TName extends string = string, in out T extends ImplicitAnnotatedAllowedTypes = ImplicitAnnotatedAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Map, TreeMapNode<UnannotateImplicitAllowedTypes<T>> & WithType<TName, NodeKind.Map, T>, MapNodeInsertableData<UnannotateImplicitAllowedTypes<T>>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleMapNodeSchema<TCustomMetadata> {
|
|
842
874
|
}
|
|
843
875
|
|
|
844
876
|
// @alpha @sealed @system
|
|
@@ -856,7 +888,7 @@ export interface MapNodeCustomizableSchemaUnsafe<out TName extends string, in ou
|
|
|
856
888
|
export type MapNodeInsertableData<T extends ImplicitAllowedTypes> = Iterable<readonly [string, InsertableTreeNodeFromImplicitAllowedTypes<T>]> | RestrictiveStringRecord<InsertableTreeNodeFromImplicitAllowedTypes<T>>;
|
|
857
889
|
|
|
858
890
|
// @alpha @sealed @system
|
|
859
|
-
export interface MapNodePojoEmulationSchema<out TName extends string = string, in out T extends
|
|
891
|
+
export interface MapNodePojoEmulationSchema<out TName extends string = string, in out T extends ImplicitAnnotatedAllowedTypes = ImplicitAnnotatedAllowedTypes, out ImplicitlyConstructable extends boolean = true, out TCustomMetadata = unknown> extends TreeNodeSchemaNonClass<TName, NodeKind.Map, TreeMapNode<UnannotateImplicitAllowedTypes<T>> & WithType<TName, NodeKind.Map, T>, MapNodeInsertableData<UnannotateImplicitAllowedTypes<T>>, ImplicitlyConstructable, T, undefined, TCustomMetadata>, SimpleMapNodeSchema<TCustomMetadata> {
|
|
860
892
|
}
|
|
861
893
|
|
|
862
894
|
// @alpha
|
|
@@ -922,13 +954,13 @@ export type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFie
|
|
|
922
954
|
};
|
|
923
955
|
|
|
924
956
|
// @alpha @sealed
|
|
925
|
-
export interface ObjectNodeSchema<out TName extends string = string, in out T extends RestrictiveStringRecord<
|
|
957
|
+
export interface ObjectNodeSchema<out TName extends string = string, in out T extends RestrictiveStringRecord<ImplicitAnnotatedFieldSchema> = RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>, ImplicitlyConstructable extends boolean = boolean, out TCustomMetadata = unknown> extends TreeNodeSchemaClass<TName, NodeKind.Object, TreeObjectNode<UnannotateSchemaRecord<T>, TName>, InsertableObjectFromAnnotatedSchemaRecord<T>, ImplicitlyConstructable, T, never, TCustomMetadata>, SimpleObjectNodeSchema<TCustomMetadata> {
|
|
926
958
|
readonly fields: ReadonlyMap<string, FieldSchemaAlpha & SimpleObjectFieldSchema>;
|
|
927
959
|
}
|
|
928
960
|
|
|
929
961
|
// @alpha (undocumented)
|
|
930
962
|
export const ObjectNodeSchema: {
|
|
931
|
-
readonly [Symbol.hasInstance]: (value: TreeNodeSchema) => value is ObjectNodeSchema<string, RestrictiveStringRecord<
|
|
963
|
+
readonly [Symbol.hasInstance]: (value: TreeNodeSchema) => value is ObjectNodeSchema<string, RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>, boolean, unknown>;
|
|
932
964
|
};
|
|
933
965
|
|
|
934
966
|
// @public
|
|
@@ -937,6 +969,9 @@ export type Off = () => void;
|
|
|
937
969
|
// @alpha
|
|
938
970
|
export function onAssertionFailure(handler: (error: Error) => void): () => void;
|
|
939
971
|
|
|
972
|
+
// @alpha
|
|
973
|
+
export function persistedToSimpleSchema(persisted: JsonCompatible, options: ICodecOptions): SimpleTreeSchema;
|
|
974
|
+
|
|
940
975
|
// @alpha @system
|
|
941
976
|
export type PopUnion<Union, AsOverloadedFunction = UnionToIntersection<Union extends unknown ? (f: Union) => void : never>> = AsOverloadedFunction extends (a: infer First) => void ? First : never;
|
|
942
977
|
|
|
@@ -1083,19 +1118,25 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
1083
1118
|
|
|
1084
1119
|
// @alpha
|
|
1085
1120
|
export class SchemaFactoryAlpha<out TScope extends string | undefined = string | undefined, TName extends number | string = string> extends SchemaFactory<TScope, TName> {
|
|
1086
|
-
arrayAlpha<const Name extends TName, const T extends
|
|
1121
|
+
arrayAlpha<const Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): ArrayNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
|
|
1087
1122
|
arrayRecursive<const Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): ArrayNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
|
|
1088
1123
|
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>;
|
|
1089
1124
|
static readonly leaves: readonly [LeafSchema_2<"string", string> & SimpleLeafNodeSchema_2, LeafSchema_2<"number", number> & SimpleLeafNodeSchema_2, LeafSchema_2<"boolean", boolean> & SimpleLeafNodeSchema_2, LeafSchema_2<"null", null> & SimpleLeafNodeSchema_2, LeafSchema_2<"handle", IFluidHandle_2<unknown>> & SimpleLeafNodeSchema_2];
|
|
1090
|
-
mapAlpha<Name extends TName, const T extends
|
|
1125
|
+
mapAlpha<Name extends TName, const T extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): MapNodeCustomizableSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata>;
|
|
1091
1126
|
mapRecursive<Name extends TName, const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): MapNodeCustomizableSchemaUnsafe<ScopedSchemaName<TScope, Name>, T, TCustomMetadata>;
|
|
1092
|
-
|
|
1127
|
+
objectAlpha<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>, const TCustomMetadata = unknown>(name: Name, fields: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): ObjectNodeSchema<ScopedSchemaName<TScope, Name>, T, true, TCustomMetadata> & {
|
|
1093
1128
|
readonly createFromInsertable: unknown;
|
|
1094
1129
|
};
|
|
1095
1130
|
objectRecursive<const Name extends TName, const T extends RestrictiveStringRecord<System_Unsafe.ImplicitFieldSchemaUnsafe>, const TCustomMetadata = unknown>(name: Name, t: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, System_Unsafe.TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & System_Unsafe.InsertableObjectFromSchemaRecordUnsafe<T>, false, T, never, TCustomMetadata> & SimpleObjectNodeSchema<TCustomMetadata> & Pick<ObjectNodeSchema, "fields">;
|
|
1096
|
-
static readonly optional:
|
|
1131
|
+
static readonly optional: {
|
|
1132
|
+
<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Optional, T, TCustomMetadata>;
|
|
1133
|
+
<const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldProps_2<TCustomMetadata_1>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Optional, UnannotateImplicitAllowedTypes_2<T_1>, TCustomMetadata_1>;
|
|
1134
|
+
};
|
|
1097
1135
|
static readonly optionalRecursive: <const T extends System_Unsafe.ImplicitAllowedTypesUnsafe, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined) => FieldSchemaAlphaUnsafe_2<FieldKind_2.Optional, T, TCustomMetadata>;
|
|
1098
|
-
static readonly required:
|
|
1136
|
+
static readonly required: {
|
|
1137
|
+
<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps_2<TCustomMetadata>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Required, T, TCustomMetadata>;
|
|
1138
|
+
<const T_1 extends ImplicitAnnotatedAllowedTypes, const TCustomMetadata_1 = unknown>(t: T_1, props?: Omit<FieldProps_2<TCustomMetadata_1>, "defaultProvider"> | undefined): FieldSchemaAlpha_2<FieldKind_2.Required, UnannotateImplicitAllowedTypes_2<T_1>, TCustomMetadata_1>;
|
|
1139
|
+
};
|
|
1099
1140
|
scopedFactory<const T extends TName, TNameInner extends number | string = string>(name: T): SchemaFactoryAlpha<ScopedSchemaName<TScope, T>, TNameInner>;
|
|
1100
1141
|
}
|
|
1101
1142
|
|
|
@@ -1239,14 +1280,9 @@ export namespace System_Unsafe {
|
|
|
1239
1280
|
// @system
|
|
1240
1281
|
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;
|
|
1241
1282
|
// @system
|
|
1242
|
-
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends AllowedTypesUnsafe> =
|
|
1243
|
-
|
|
1244
|
-
]
|
|
1245
|
-
readonly [
|
|
1246
|
-
LazyItem<infer TSchema extends TreeNodeSchemaUnsafe>,
|
|
1247
|
-
...infer Rest extends AllowedTypesUnsafe
|
|
1248
|
-
]
|
|
1249
|
-
] ? InsertableTypedNodeUnsafe<TSchema> | InsertableTreeNodeFromAllowedTypesUnsafe<Rest> : never;
|
|
1283
|
+
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends AllowedTypesUnsafe> = IsUnion<TList> extends true ? never : {
|
|
1284
|
+
readonly [Property in keyof TList]: TList[Property] extends LazyItem<infer TSchema extends TreeNodeSchemaUnsafe> ? InsertableTypedNodeUnsafe<TSchema> : never;
|
|
1285
|
+
}[number];
|
|
1250
1286
|
// @system
|
|
1251
1287
|
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends ImplicitAllowedTypesUnsafe> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
|
|
1252
1288
|
// @system
|
|
@@ -1348,33 +1384,36 @@ export interface TransactionResultSuccess<TSuccessValue> {
|
|
|
1348
1384
|
// @public
|
|
1349
1385
|
export type TransformedEvent<TThis, E, A extends any[]> = (event: E, listener: (...args: ReplaceIEventThisPlaceHolder<A, TThis>) => void) => TThis;
|
|
1350
1386
|
|
|
1387
|
+
// @public @sealed @system
|
|
1388
|
+
export interface Tree extends TreeNodeApi {
|
|
1389
|
+
contains(node: TreeNode, other: TreeNode): boolean;
|
|
1390
|
+
readonly runTransaction: RunTransaction;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1351
1393
|
// @public
|
|
1352
|
-
export const Tree:
|
|
1394
|
+
export const Tree: Tree;
|
|
1353
1395
|
|
|
1354
|
-
// @alpha @sealed
|
|
1355
|
-
export
|
|
1396
|
+
// @alpha @sealed @system
|
|
1397
|
+
export interface TreeAlpha {
|
|
1356
1398
|
branch(node: TreeNode): TreeBranch | undefined;
|
|
1357
1399
|
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>;
|
|
1358
|
-
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>;
|
|
1359
|
-
importVerbose<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: VerboseTree | undefined, options?: Partial<TreeEncodingOptions>): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
1360
|
-
exportConcise(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): ConciseTree;
|
|
1361
|
-
exportConcise(node: TreeNode | TreeLeafValue | undefined, options?: TreeEncodingOptions): ConciseTree | undefined;
|
|
1362
|
-
exportVerbose(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): VerboseTree;
|
|
1363
1400
|
exportCompressed(tree: TreeNode | TreeLeafValue, options: {
|
|
1364
1401
|
oldestCompatibleClient: FluidClientVersion;
|
|
1365
1402
|
idCompressor?: IIdCompressor;
|
|
1366
1403
|
}): JsonCompatible<IFluidHandle>;
|
|
1404
|
+
exportConcise(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): ConciseTree;
|
|
1405
|
+
exportConcise(node: TreeNode | TreeLeafValue | undefined, options?: TreeEncodingOptions): ConciseTree | undefined;
|
|
1406
|
+
exportVerbose(node: TreeNode | TreeLeafValue, options?: TreeEncodingOptions): VerboseTree;
|
|
1367
1407
|
importCompressed<const TSchema extends ImplicitFieldSchema>(schema: TSchema, compressedData: JsonCompatible<IFluidHandle>, options: {
|
|
1368
1408
|
idCompressor?: IIdCompressor;
|
|
1369
1409
|
} & ICodecOptions): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
// @public @sealed @system
|
|
1373
|
-
interface TreeApi extends TreeNodeApi {
|
|
1374
|
-
contains(node: TreeNode, other: TreeNode): boolean;
|
|
1375
|
-
readonly runTransaction: RunTransaction;
|
|
1410
|
+
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>;
|
|
1411
|
+
importVerbose<const TSchema extends ImplicitFieldSchema>(schema: TSchema, data: VerboseTree | undefined, options?: Partial<TreeEncodingOptions>): Unhydrated<TreeFieldFromImplicitField<TSchema>>;
|
|
1376
1412
|
}
|
|
1377
1413
|
|
|
1414
|
+
// @alpha
|
|
1415
|
+
export const TreeAlpha: TreeAlpha;
|
|
1416
|
+
|
|
1378
1417
|
// @public @sealed
|
|
1379
1418
|
export interface TreeArrayNode<TAllowedTypes extends System_Unsafe.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> {
|
|
1380
1419
|
insertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
@@ -1402,11 +1441,14 @@ export const TreeArrayNode: {
|
|
|
1402
1441
|
readonly spread: <T>(content: Iterable<T>) => IterableTreeArrayContent<T>;
|
|
1403
1442
|
};
|
|
1404
1443
|
|
|
1405
|
-
// @beta @sealed
|
|
1406
|
-
export
|
|
1407
|
-
on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
|
|
1444
|
+
// @beta @sealed @system
|
|
1445
|
+
export interface TreeBeta {
|
|
1408
1446
|
clone<const TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
|
|
1409
|
-
|
|
1447
|
+
on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
// @beta
|
|
1451
|
+
export const TreeBeta: TreeBeta;
|
|
1410
1452
|
|
|
1411
1453
|
// @alpha @sealed
|
|
1412
1454
|
export interface TreeBranch extends IDisposable {
|
|
@@ -1611,6 +1653,31 @@ const typeNameSymbol: unique symbol;
|
|
|
1611
1653
|
// @public @system
|
|
1612
1654
|
export const typeSchemaSymbol: unique symbol;
|
|
1613
1655
|
|
|
1656
|
+
// @alpha @system
|
|
1657
|
+
export type UnannotateAllowedType<T extends AnnotatedAllowedType> = T extends AnnotatedAllowedType<infer X> ? [X] : T;
|
|
1658
|
+
|
|
1659
|
+
// @alpha @system
|
|
1660
|
+
export type UnannotateAllowedTypeOrLazyItem<T extends AnnotatedAllowedType | LazyItem<TreeNodeSchema>> = T extends AnnotatedAllowedType<infer X> ? X : T;
|
|
1661
|
+
|
|
1662
|
+
// @alpha @system
|
|
1663
|
+
export type UnannotateAllowedTypes<T extends AnnotatedAllowedTypes> = UnannotateAllowedTypesList<T["types"]>;
|
|
1664
|
+
|
|
1665
|
+
// @alpha @system
|
|
1666
|
+
export type UnannotateAllowedTypesList<T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[]> = {
|
|
1667
|
+
[I in keyof T]: UnannotateAllowedTypeOrLazyItem<T[I]>;
|
|
1668
|
+
};
|
|
1669
|
+
|
|
1670
|
+
// @alpha @system
|
|
1671
|
+
export type UnannotateImplicitAllowedTypes<T extends ImplicitAnnotatedAllowedTypes> = T extends AnnotatedAllowedTypes ? UnannotateAllowedTypes<T> : T extends AnnotatedAllowedType ? UnannotateAllowedType<T> : T extends readonly (AnnotatedAllowedType | LazyItem<TreeNodeSchema>)[] ? UnannotateAllowedTypesList<T> : T extends TreeNodeSchema ? T : never;
|
|
1672
|
+
|
|
1673
|
+
// @alpha @system
|
|
1674
|
+
export type UnannotateImplicitFieldSchema<T extends ImplicitAnnotatedFieldSchema> = T extends ImplicitAnnotatedAllowedTypes ? UnannotateImplicitAllowedTypes<T> : T;
|
|
1675
|
+
|
|
1676
|
+
// @alpha @system
|
|
1677
|
+
export type UnannotateSchemaRecord<T extends RestrictiveStringRecord<ImplicitAnnotatedFieldSchema>> = {
|
|
1678
|
+
readonly [P in Extract<keyof T, string>]: UnannotateImplicitFieldSchema<T[P]>;
|
|
1679
|
+
};
|
|
1680
|
+
|
|
1614
1681
|
// @public
|
|
1615
1682
|
export type Unenforced<_DesiredExtendsConstraint> = unknown;
|
|
1616
1683
|
|
|
@@ -1630,15 +1697,20 @@ export const UnsafeUnknownSchema: unique symbol;
|
|
|
1630
1697
|
export type UnsafeUnknownSchema = typeof UnsafeUnknownSchema;
|
|
1631
1698
|
|
|
1632
1699
|
// @public
|
|
1633
|
-
export type ValidateRecursiveSchema<T extends
|
|
1700
|
+
export type ValidateRecursiveSchema<T extends ValidateRecursiveSchemaTemplate<T>> = true;
|
|
1701
|
+
|
|
1702
|
+
// @public @system
|
|
1703
|
+
export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
|
|
1634
1704
|
[NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
|
|
1635
1705
|
[NodeKind.Array]: T["info"] extends ImplicitAllowedTypes ? Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>> : unknown;
|
|
1636
1706
|
[NodeKind.Map]: T["info"] extends ImplicitAllowedTypes ? Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>]> : unknown;
|
|
1707
|
+
[NodeKind.Leaf]: unknown;
|
|
1637
1708
|
}[T["kind"]], false, {
|
|
1638
1709
|
[NodeKind.Object]: RestrictiveStringRecord<ImplicitFieldSchema>;
|
|
1639
1710
|
[NodeKind.Array]: ImplicitAllowedTypes;
|
|
1640
1711
|
[NodeKind.Map]: ImplicitAllowedTypes;
|
|
1641
|
-
|
|
1712
|
+
[NodeKind.Leaf]: unknown;
|
|
1713
|
+
}[T["kind"]]>;
|
|
1642
1714
|
|
|
1643
1715
|
// @alpha
|
|
1644
1716
|
export enum ValueSchema {
|
|
@@ -81,7 +81,9 @@ export abstract class ErasedType<out Name = unknown> {
|
|
|
81
81
|
type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result ? Result : Item;
|
|
82
82
|
|
|
83
83
|
// @public @system
|
|
84
|
-
type FieldHasDefault<T extends ImplicitFieldSchema> = T extends
|
|
84
|
+
type FieldHasDefault<T extends ImplicitFieldSchema> = [T] extends [
|
|
85
|
+
FieldSchema<FieldKind.Optional | FieldKind.Identifier>
|
|
86
|
+
] ? true : false;
|
|
85
87
|
|
|
86
88
|
// @public
|
|
87
89
|
export enum FieldKind {
|
|
@@ -380,7 +382,6 @@ export const IFluidLoadable: keyof IProvideFluidLoadable;
|
|
|
380
382
|
|
|
381
383
|
// @public @sealed
|
|
382
384
|
export interface IFluidLoadable extends IProvideFluidLoadable {
|
|
383
|
-
// (undocumented)
|
|
384
385
|
readonly handle: IFluidHandle;
|
|
385
386
|
}
|
|
386
387
|
|
|
@@ -420,12 +421,9 @@ type InsertableObjectFromSchemaRecord<T extends RestrictiveStringRecord<Implicit
|
|
|
420
421
|
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;
|
|
421
422
|
|
|
422
423
|
// @public @system
|
|
423
|
-
export type InsertableTreeNodeFromAllowedTypes<TList extends AllowedTypes> =
|
|
424
|
-
readonly [
|
|
425
|
-
|
|
426
|
-
...infer Rest extends AllowedTypes
|
|
427
|
-
]
|
|
428
|
-
] ? InsertableTypedNode<TSchema> | InsertableTreeNodeFromAllowedTypes<Rest> : never;
|
|
424
|
+
export type InsertableTreeNodeFromAllowedTypes<TList extends AllowedTypes> = IsUnion<TList> extends true ? never : {
|
|
425
|
+
readonly [Property in keyof TList]: TList[Property] extends LazyItem<infer TSchema extends TreeNodeSchema> ? InsertableTypedNode<TSchema> : never;
|
|
426
|
+
}[number];
|
|
429
427
|
|
|
430
428
|
// @public
|
|
431
429
|
export type InsertableTreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes> = [
|
|
@@ -453,8 +451,7 @@ declare namespace InternalTypes {
|
|
|
453
451
|
InsertableObjectFromSchemaRecord,
|
|
454
452
|
FlexList,
|
|
455
453
|
FlexListToUnion,
|
|
456
|
-
ExtractItemType
|
|
457
|
-
TreeApi
|
|
454
|
+
ExtractItemType
|
|
458
455
|
}
|
|
459
456
|
}
|
|
460
457
|
export { InternalTypes }
|
|
@@ -487,6 +484,9 @@ export function isFluidHandle(value: unknown): value is IFluidHandle;
|
|
|
487
484
|
// @public
|
|
488
485
|
export type IsListener<TListener> = TListener extends (...args: any[]) => void ? true : false;
|
|
489
486
|
|
|
487
|
+
// @public @system
|
|
488
|
+
export type IsUnion<T, T2 = T> = T extends unknown ? [T2] extends [T] ? false : true : "error";
|
|
489
|
+
|
|
490
490
|
// @public
|
|
491
491
|
export interface ITelemetryBaseProperties {
|
|
492
492
|
[index: string]: TelemetryBaseEventPropertyType | Tagged<TelemetryBaseEventPropertyType>;
|
|
@@ -764,14 +764,9 @@ export namespace System_Unsafe {
|
|
|
764
764
|
// @system
|
|
765
765
|
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;
|
|
766
766
|
// @system
|
|
767
|
-
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends AllowedTypesUnsafe> =
|
|
768
|
-
|
|
769
|
-
]
|
|
770
|
-
readonly [
|
|
771
|
-
LazyItem<infer TSchema extends TreeNodeSchemaUnsafe>,
|
|
772
|
-
...infer Rest extends AllowedTypesUnsafe
|
|
773
|
-
]
|
|
774
|
-
] ? InsertableTypedNodeUnsafe<TSchema> | InsertableTreeNodeFromAllowedTypesUnsafe<Rest> : never;
|
|
767
|
+
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends AllowedTypesUnsafe> = IsUnion<TList> extends true ? never : {
|
|
768
|
+
readonly [Property in keyof TList]: TList[Property] extends LazyItem<infer TSchema extends TreeNodeSchemaUnsafe> ? InsertableTypedNodeUnsafe<TSchema> : never;
|
|
769
|
+
}[number];
|
|
775
770
|
// @system
|
|
776
771
|
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends ImplicitAllowedTypesUnsafe> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
|
|
777
772
|
// @system
|
|
@@ -844,15 +839,15 @@ export type TransactionConstraint = NodeInDocumentConstraint;
|
|
|
844
839
|
// @public
|
|
845
840
|
export type TransformedEvent<TThis, E, A extends any[]> = (event: E, listener: (...args: ReplaceIEventThisPlaceHolder<A, TThis>) => void) => TThis;
|
|
846
841
|
|
|
847
|
-
// @public
|
|
848
|
-
export const Tree: TreeApi;
|
|
849
|
-
|
|
850
842
|
// @public @sealed @system
|
|
851
|
-
interface
|
|
843
|
+
export interface Tree extends TreeNodeApi {
|
|
852
844
|
contains(node: TreeNode, other: TreeNode): boolean;
|
|
853
845
|
readonly runTransaction: RunTransaction;
|
|
854
846
|
}
|
|
855
847
|
|
|
848
|
+
// @public
|
|
849
|
+
export const Tree: Tree;
|
|
850
|
+
|
|
856
851
|
// @public @sealed
|
|
857
852
|
export interface TreeArrayNode<TAllowedTypes extends System_Unsafe.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> {
|
|
858
853
|
insertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
@@ -880,11 +875,14 @@ export const TreeArrayNode: {
|
|
|
880
875
|
readonly spread: <T>(content: Iterable<T>) => IterableTreeArrayContent<T>;
|
|
881
876
|
};
|
|
882
877
|
|
|
883
|
-
// @beta @sealed
|
|
884
|
-
export
|
|
885
|
-
on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
|
|
878
|
+
// @beta @sealed @system
|
|
879
|
+
export interface TreeBeta {
|
|
886
880
|
clone<const TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
|
|
887
|
-
|
|
881
|
+
on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
// @beta
|
|
885
|
+
export const TreeBeta: TreeBeta;
|
|
888
886
|
|
|
889
887
|
// @public @sealed
|
|
890
888
|
export interface TreeChangeEvents {
|
|
@@ -1020,15 +1018,20 @@ export type Unhydrated<T> = T;
|
|
|
1020
1018
|
export type UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) extends (k: infer U) => unknown ? U : never;
|
|
1021
1019
|
|
|
1022
1020
|
// @public
|
|
1023
|
-
export type ValidateRecursiveSchema<T extends
|
|
1021
|
+
export type ValidateRecursiveSchema<T extends ValidateRecursiveSchemaTemplate<T>> = true;
|
|
1022
|
+
|
|
1023
|
+
// @public @system
|
|
1024
|
+
export type ValidateRecursiveSchemaTemplate<T extends TreeNodeSchema> = TreeNodeSchema<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
|
|
1024
1025
|
[NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
|
|
1025
1026
|
[NodeKind.Array]: T["info"] extends ImplicitAllowedTypes ? Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>> : unknown;
|
|
1026
1027
|
[NodeKind.Map]: T["info"] extends ImplicitAllowedTypes ? Iterable<[string, InsertableTreeNodeFromImplicitAllowedTypes<T["info"]>]> : unknown;
|
|
1028
|
+
[NodeKind.Leaf]: unknown;
|
|
1027
1029
|
}[T["kind"]], false, {
|
|
1028
1030
|
[NodeKind.Object]: RestrictiveStringRecord<ImplicitFieldSchema>;
|
|
1029
1031
|
[NodeKind.Array]: ImplicitAllowedTypes;
|
|
1030
1032
|
[NodeKind.Map]: ImplicitAllowedTypes;
|
|
1031
|
-
|
|
1033
|
+
[NodeKind.Leaf]: unknown;
|
|
1034
|
+
}[T["kind"]]>;
|
|
1032
1035
|
|
|
1033
1036
|
// @public @sealed @system
|
|
1034
1037
|
export interface ViewableTree {
|