fluid-framework 2.4.0-299707 → 2.5.0-302463
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 +111 -0
- package/api-report/fluid-framework.alpha.api.md +150 -52
- package/api-report/fluid-framework.beta.api.md +85 -39
- package/api-report/fluid-framework.legacy.alpha.api.md +83 -38
- package/api-report/fluid-framework.legacy.public.api.md +83 -38
- package/api-report/fluid-framework.public.api.md +83 -38
- package/dist/alpha.d.ts +17 -2
- package/dist/beta.d.ts +6 -0
- package/dist/legacy.d.ts +6 -0
- package/dist/public.d.ts +6 -0
- package/lib/alpha.d.ts +17 -2
- package/lib/beta.d.ts +6 -0
- package/lib/legacy.d.ts +6 -0
- package/lib/public.d.ts +6 -0
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,116 @@
|
|
|
1
1
|
# fluid-framework
|
|
2
2
|
|
|
3
|
+
## 2.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ✨ New! Alpha API for providing SharedTree configuration options ([#22701](https://github.com/microsoft/FluidFramework/pull/22701)) [40d3648ddf](https://github.com/microsoft/FluidFramework/commit/40d3648ddfb5223ef6daef49a4f5cab1cfa52b71)
|
|
8
|
+
|
|
9
|
+
A new alpha `configuredSharedTree` had been added.
|
|
10
|
+
This allows providing configuration options, primarily for debugging, testing and evaluation of upcoming features.
|
|
11
|
+
The resulting configured `SharedTree` object can then be used in-place of the regular `SharedTree` imported from `fluid-framework`.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import {
|
|
15
|
+
ForestType,
|
|
16
|
+
TreeCompressionStrategy,
|
|
17
|
+
configuredSharedTree,
|
|
18
|
+
typeboxValidator,
|
|
19
|
+
} from "@fluid-framework/alpha";
|
|
20
|
+
// Maximum debuggability and validation enabled:
|
|
21
|
+
const SharedTree = configuredSharedTree({
|
|
22
|
+
forest: ForestType.Expensive,
|
|
23
|
+
jsonValidator: typeboxValidator,
|
|
24
|
+
treeEncodeType: TreeCompressionStrategy.Uncompressed,
|
|
25
|
+
});
|
|
26
|
+
// Opts into the under development optimized tree storage planned to be the eventual default implementation:
|
|
27
|
+
const SharedTree = configuredSharedTree({
|
|
28
|
+
forest: ForestType.Optimized,
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- ✨ New! Alpha API for snapshotting Schema ([#22733](https://github.com/microsoft/FluidFramework/pull/22733)) [920a65f66e](https://github.com/microsoft/FluidFramework/commit/920a65f66e0caad7e1b5e3df1e0afd3475a87c4a)
|
|
33
|
+
|
|
34
|
+
`extractPersistedSchema` can now be used to extra a JSON-compatible representation of the subset of a schema that gets stored in documents.
|
|
35
|
+
This can be used write tests which snapshot an applications schema.
|
|
36
|
+
Such tests can be used to detect schema changes which could would impact document compatibility,
|
|
37
|
+
and can be combined with the new `comparePersistedSchema` to measure what kind of compatibility impact the schema change has.
|
|
38
|
+
|
|
39
|
+
- Fix reading of `null` from unhydrated trees ([#22748](https://github.com/microsoft/FluidFramework/pull/22748)) [6a75bd0616](https://github.com/microsoft/FluidFramework/commit/6a75bd0616ecd315ae0e9458d88ba1c755dfd785)
|
|
40
|
+
|
|
41
|
+
Unhydrated trees containing object nodes with required fields set to `null` used to throw an error.
|
|
42
|
+
This was a bug: `null` is a valid value in tree's whose schema allow it, and this specific case now correctly returns `null` values when appropriate without erroring.
|
|
43
|
+
|
|
44
|
+
- ✨ New! Alpha SharedTree branching APIs ([#22550](https://github.com/microsoft/FluidFramework/pull/22550)) [8f4587c912](https://github.com/microsoft/FluidFramework/commit/8f4587c912f955c405d7bbbc5b42f3ffc3b497d7)
|
|
45
|
+
|
|
46
|
+
Several APIs have been added to allow for creating and coordinating "version-control"-style branches of the SharedTree.
|
|
47
|
+
Use the `getBranch` entry point function to acquire a branch.
|
|
48
|
+
For example:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
function makeEditOnBranch(mainView: TreeView<typeof MySchema>) {
|
|
52
|
+
mainView.root.myData = 3;
|
|
53
|
+
const mainBranch = getBranch(mainView); // This function accepts either a view of a SharedTree (acquired e.g. via `sharedTree.viewWith(...)`) or a `SharedTree` directly.
|
|
54
|
+
const forkBranch = mainBranch.branch(); // This creates a new branch based on the existing branch.
|
|
55
|
+
const forkView = forkBranch.viewWith(new TreeViewConfiguration({ schema: MySchema })); // Acquire a view of the forked branch in order to read or edit its tree.
|
|
56
|
+
forkView.root.myData = 4; // Set the value on the fork branch to be 4. The main branch still has a value of 3.
|
|
57
|
+
mainBranch.merge(forkBranch); // Merging the fork changes into the main branch causes the main branch to have a value of 4.
|
|
58
|
+
|
|
59
|
+
// Note: The main branch (and therefore, also the `forkView`) is automatically disposed by the merge.
|
|
60
|
+
// To prevent this, use `mainBranch.merge(forkBranch, false)`.
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Merging any number of commits into a target branch (via the `TreeBranch.merge` method) generates a revertible for each
|
|
65
|
+
commit on the target branch. See [#22644](https://github.com/microsoft/FluidFramework/pull/22644) for more information
|
|
66
|
+
about revertible support in the branching APIs.
|
|
67
|
+
|
|
68
|
+
- SharedTree's `RestrictiveReadonlyRecord` is deprecated ([#22479](https://github.com/microsoft/FluidFramework/pull/22479)) [8be73d374d](https://github.com/microsoft/FluidFramework/commit/8be73d374de04ff6226c531ba8b562561572640f)
|
|
69
|
+
|
|
70
|
+
`RestrictiveReadonlyRecord` was an attempt to implement a version of TypeScript's built-in `Record<TKey, TValue>` type that would prohibit (instead of leaving unrestricted like Record does) values under keys that do not extend `TKey`.
|
|
71
|
+
|
|
72
|
+
The implementation of `RestrictiveReadonlyRecord` failed to accomplish this except for the edge cases where `TKey` was exactly `string` or exactly `symbol`.
|
|
73
|
+
Fixing this bug appears to be impossible within the current limitation of TypeScript, however this library does not require any case other than `TKey` being exactly `string`.
|
|
74
|
+
|
|
75
|
+
To reduce the risk of users of the tree library using the problematic `RestrictiveReadonlyRecord` type, it has been deprecated and replaced with a more specific type that avoids the bug, `RestrictiveStringRecord<TValue>`.
|
|
76
|
+
|
|
77
|
+
To highlight that this new type is not intended for direct use by users of tree, and instead is just used as part of the typing of its public API, `RestrictiveStringRecord` has been tagged with `@system`.
|
|
78
|
+
See [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels) for more details.
|
|
79
|
+
|
|
80
|
+
- Fix `.create` on structurally named MapNode and ArrayNode schema ([#22522](https://github.com/microsoft/FluidFramework/pull/22522)) [b3f91ae91c](https://github.com/microsoft/FluidFramework/commit/b3f91ae91cb750a6a7696ab5ea17c00895bb6d92)
|
|
81
|
+
|
|
82
|
+
Constructing a structurally named MapNode or ArrayNode schema (using the overload of `SchemaFactory.map` or `SchemaFactory.array` which does not take an explicit name), returned a `TreeNodeSchema` instead of a `TreeNodeSchemaNonClass`, which resulted in the `create` static method not being exposed.
|
|
83
|
+
This has been fixed, and can now be used as follows:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
const MyMap = schemaFactory.map(schemaFactory.number);
|
|
87
|
+
type MyMap = NodeFromSchema<typeof MyMap>;
|
|
88
|
+
const _fromMap: MyMap = MyMap.create(new MyMap());
|
|
89
|
+
const _fromIterable: MyMap = MyMap.create([]);
|
|
90
|
+
const _fromObject: MyMap = MyMap.create({});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This change causes some types to reference `TreeNodeSchemaNonClass` which did not reference it before.
|
|
94
|
+
While `TreeNodeSchemaNonClass` is `@system` (See [Fluid Releases and API Support Levels
|
|
95
|
+
](https://fluidframework.com/docs/build/releases-and-apitags/) for details) and thus not intended to be referred to by users of Fluid,
|
|
96
|
+
this change caused the TypeScript compiler to generate references to it in more cases when compiling `d.ts` files.
|
|
97
|
+
Since the TypeScript compiler is unable to generate references to `TreeNodeSchemaNonClass` with how it was nested in `internalTypes.js`,
|
|
98
|
+
this change could break the build of packages exporting types referencing structurally named map and array schema.
|
|
99
|
+
This has been mitigated by moving `TreeNodeSchemaNonClass` out of `internalTypes.js`:
|
|
100
|
+
any code importing `TreeNodeSchemaNonClass` (and thus disregarding the `@system` restriction) can be fixed by importing it from the top level instead of the `internalTypes.js`
|
|
101
|
+
|
|
102
|
+
- Non-leaf field access has been optimized ([#22717](https://github.com/microsoft/FluidFramework/pull/22717)) [6a2b68103c](https://github.com/microsoft/FluidFramework/commit/6a2b68103cc3ad56a9ac0dfcaaa8546978ec29ac)
|
|
103
|
+
|
|
104
|
+
When reading non-leaf children which have been read previously, they are retrieved from cache faster.
|
|
105
|
+
Several operations on subtrees under arrays have been optimized, including reading of non-leaf nodes for the first time.
|
|
106
|
+
Overall this showed a roughly 5% speed up in a read heavy test application (the BubbleBench example) but gains are expected to vary a lot based on use-case.
|
|
107
|
+
|
|
108
|
+
- ✨ New! Alpha APIs for producing SharedTree schema from enums ([#20035](https://github.com/microsoft/FluidFramework/pull/20035)) [5f9bbe011a](https://github.com/microsoft/FluidFramework/commit/5f9bbe011a18ccac08a70340f6d20e60ce30c4a4)
|
|
109
|
+
|
|
110
|
+
`adaptEnum` and `enumFromStrings` have been added to `@fluidframework/tree/alpha` and `fluid-framework/alpha`.
|
|
111
|
+
These unstable alpha APIs are relatively simple helpers on-top of public APIs (source: [schemaCreationUtilities.ts](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/src/simple-tree/schemaCreationUtilities.ts)):
|
|
112
|
+
thus if these change or stable alternatives are needed, an application can replicate this functionality using these implementations as an example.
|
|
113
|
+
|
|
3
114
|
## 2.3.0
|
|
4
115
|
|
|
5
116
|
### Minor Changes
|
|
@@ -9,20 +9,34 @@ export function adaptEnum<TScope extends string, const TEnum extends Record<stri
|
|
|
9
9
|
readonly value: TValue;
|
|
10
10
|
}) & { readonly [Property in keyof TEnum]: TreeNodeSchemaClass<ScopedSchemaName<TScope, TEnum[Property]>, NodeKind.Object, TreeNode & {
|
|
11
11
|
readonly value: TEnum[Property];
|
|
12
|
-
},
|
|
12
|
+
}, Record<string, never>, true, unknown> & (new (data?: InternalTreeNode | Record<string, never> | undefined) => TreeNode & {
|
|
13
13
|
readonly value: TEnum[Property];
|
|
14
|
-
}); }
|
|
14
|
+
}); } & {
|
|
15
|
+
readonly schema: UnionToTuple<{ readonly [Property in keyof TEnum]: TreeNodeSchemaClass<ScopedSchemaName<TScope, TEnum[Property]>, NodeKind.Object, TreeNode & {
|
|
16
|
+
readonly value: TEnum[Property];
|
|
17
|
+
}, Record<string, never>, true, unknown> & (new (data?: InternalTreeNode | Record<string, never> | undefined) => TreeNode & {
|
|
18
|
+
readonly value: TEnum[Property];
|
|
19
|
+
}); }[keyof TEnum]>;
|
|
20
|
+
};
|
|
15
21
|
|
|
16
22
|
// @public
|
|
17
23
|
export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
|
|
18
24
|
|
|
19
25
|
// @public
|
|
20
|
-
type
|
|
26
|
+
type AllowedTypesUnsafe = readonly LazyItem<TreeNodeSchemaUnsafe>[];
|
|
27
|
+
|
|
28
|
+
// @public
|
|
29
|
+
type ApplyKind<T, Kind extends FieldKind> = {
|
|
21
30
|
[FieldKind.Required]: T;
|
|
22
31
|
[FieldKind.Optional]: T | undefined;
|
|
23
|
-
[FieldKind.Identifier]:
|
|
32
|
+
[FieldKind.Identifier]: T;
|
|
24
33
|
}[Kind];
|
|
25
34
|
|
|
35
|
+
// @public
|
|
36
|
+
type ApplyKindInput<T, Kind extends FieldKind, DefaultsAreOptional extends boolean> = [
|
|
37
|
+
Kind
|
|
38
|
+
] extends [FieldKind.Required] ? T : [Kind] extends [FieldKind.Optional] ? T | undefined : [Kind] extends [FieldKind.Identifier] ? DefaultsAreOptional extends true ? T | undefined : T : never;
|
|
39
|
+
|
|
26
40
|
// @public
|
|
27
41
|
export enum AttachState {
|
|
28
42
|
Attached = "Attached",
|
|
@@ -82,13 +96,19 @@ interface DefaultProvider extends ErasedType<"@fluidframework/tree.FieldProvider
|
|
|
82
96
|
}
|
|
83
97
|
|
|
84
98
|
// @alpha
|
|
85
|
-
export function enumFromStrings<TScope extends string, const Members extends string>(factory: SchemaFactory<TScope>, members:
|
|
99
|
+
export function enumFromStrings<TScope extends string, const Members extends readonly string[]>(factory: SchemaFactory<TScope>, members: Members): (<TValue extends Members[number]>(value: TValue) => TreeNode & {
|
|
86
100
|
readonly value: TValue;
|
|
87
|
-
}) & Record<Members, TreeNodeSchemaClass<ScopedSchemaName<TScope, Members>, NodeKind.Object, TreeNode & {
|
|
88
|
-
readonly value: Members;
|
|
89
|
-
},
|
|
90
|
-
readonly value: Members;
|
|
91
|
-
})
|
|
101
|
+
}) & Record<Members[number], TreeNodeSchemaClass<ScopedSchemaName<TScope, Members[number]>, NodeKind.Object, TreeNode & {
|
|
102
|
+
readonly value: Members[number];
|
|
103
|
+
}, Record<string, never>, true, unknown> & (new (data?: InternalTreeNode | Record<string, never> | undefined) => TreeNode & {
|
|
104
|
+
readonly value: Members[number];
|
|
105
|
+
})> & {
|
|
106
|
+
readonly schema: UnionToTuple<Record<Members[number], TreeNodeSchemaClass<ScopedSchemaName<TScope, Members[number]>, NodeKind.Object, TreeNode & {
|
|
107
|
+
readonly value: Members[number];
|
|
108
|
+
}, Record<string, never>, true, unknown> & (new (data?: InternalTreeNode | Record<string, never> | undefined) => TreeNode & {
|
|
109
|
+
readonly value: Members[number];
|
|
110
|
+
})>[Members[number]]>;
|
|
111
|
+
};
|
|
92
112
|
|
|
93
113
|
// @public @sealed
|
|
94
114
|
export abstract class ErasedType<out Name = unknown> {
|
|
@@ -102,6 +122,14 @@ type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result ?
|
|
|
102
122
|
// @alpha
|
|
103
123
|
export function extractPersistedSchema(schema: ImplicitFieldSchema): JsonCompatible;
|
|
104
124
|
|
|
125
|
+
// @alpha
|
|
126
|
+
export type FactoryContent = IFluidHandle | string | number | boolean | null | Iterable<readonly [string, InsertableContent]> | readonly InsertableContent[] | FactoryContentObject;
|
|
127
|
+
|
|
128
|
+
// @alpha
|
|
129
|
+
export type FactoryContentObject = {
|
|
130
|
+
readonly [P in string]?: InsertableContent;
|
|
131
|
+
};
|
|
132
|
+
|
|
105
133
|
// @public
|
|
106
134
|
type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<FieldKind.Optional | FieldKind.Identifier> ? true : false;
|
|
107
135
|
|
|
@@ -184,7 +212,7 @@ export enum ForestType {
|
|
|
184
212
|
export function getBranch(tree: ITree): TreeBranch;
|
|
185
213
|
|
|
186
214
|
// @alpha
|
|
187
|
-
export function getBranch(view: TreeView<
|
|
215
|
+
export function getBranch<T extends ImplicitFieldSchema>(view: TreeView<T>): TreeBranch;
|
|
188
216
|
|
|
189
217
|
// @alpha
|
|
190
218
|
export function getJsonSchema(schema: ImplicitFieldSchema): JsonTreeSchema;
|
|
@@ -461,11 +489,25 @@ export type InitialObjects<T extends ContainerSchema> = {
|
|
|
461
489
|
// @public
|
|
462
490
|
type _InlineTrick = 0;
|
|
463
491
|
|
|
492
|
+
// @public
|
|
493
|
+
export type Input<T extends never> = T;
|
|
494
|
+
|
|
495
|
+
// @alpha
|
|
496
|
+
export type Insertable<TSchema extends ImplicitAllowedTypes | UnsafeUnknownSchema> = TSchema extends ImplicitAllowedTypes ? InsertableTreeNodeFromImplicitAllowedTypes<TSchema> : InsertableContent;
|
|
497
|
+
|
|
498
|
+
// @alpha
|
|
499
|
+
export type InsertableContent = Unhydrated<TreeNode> | FactoryContent;
|
|
500
|
+
|
|
501
|
+
// @alpha
|
|
502
|
+
export type InsertableField<TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> = [
|
|
503
|
+
TSchema
|
|
504
|
+
] extends [ImplicitFieldSchema] ? InsertableTreeFieldFromImplicitField<TSchema> : [TSchema] extends [UnsafeUnknownSchema] ? InsertableContent | undefined : never;
|
|
505
|
+
|
|
464
506
|
// @public
|
|
465
507
|
type InsertableObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = FlattenKeys<{
|
|
466
|
-
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property
|
|
508
|
+
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property & string]>;
|
|
467
509
|
} & {
|
|
468
|
-
readonly [Property in keyof T as FieldHasDefault<T[Property
|
|
510
|
+
readonly [Property in keyof T as FieldHasDefault<T[Property & string]> extends false ? Property : never]: InsertableTreeFieldFromImplicitField<T[Property & string]>;
|
|
469
511
|
}>;
|
|
470
512
|
|
|
471
513
|
// @public
|
|
@@ -476,28 +518,36 @@ export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<Restrict
|
|
|
476
518
|
};
|
|
477
519
|
|
|
478
520
|
// @public
|
|
479
|
-
export type InsertableTreeFieldFromImplicitField<
|
|
521
|
+
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;
|
|
522
|
+
|
|
523
|
+
// @public
|
|
524
|
+
export type InsertableTreeFieldFromImplicitFieldUnsafe<TSchemaInput extends Unenforced<ImplicitFieldSchema>, TSchema = UnionToIntersection<TSchemaInput>> = [TSchema] extends [FieldSchemaUnsafe<infer Kind, infer Types>] ? ApplyKindInput<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true> : [TSchema] extends [ImplicitAllowedTypes] ? InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : never;
|
|
525
|
+
|
|
526
|
+
// @public
|
|
527
|
+
export type InsertableTreeNodeFromAllowedTypes<TList extends AllowedTypes> = TList extends readonly [
|
|
528
|
+
LazyItem<infer TSchema extends TreeNodeSchema>,
|
|
529
|
+
...infer Rest extends AllowedTypes
|
|
530
|
+
] ? InsertableTypedNode<TSchema> | InsertableTreeNodeFromAllowedTypes<Rest> : never;
|
|
480
531
|
|
|
481
532
|
// @public
|
|
482
|
-
export type
|
|
533
|
+
export type InsertableTreeNodeFromAllowedTypesUnsafe<TList extends Unenforced<AllowedTypesUnsafe>> = TList extends readonly [
|
|
534
|
+
LazyItem<infer TSchema extends TreeNodeSchemaUnsafe>,
|
|
535
|
+
...infer Rest extends AllowedTypesUnsafe
|
|
536
|
+
] ? InsertableTypedNodeUnsafe<TSchema> | InsertableTreeNodeFromAllowedTypesUnsafe<Rest> : never;
|
|
483
537
|
|
|
484
538
|
// @public
|
|
485
|
-
export type InsertableTreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes
|
|
539
|
+
export type InsertableTreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes> = [
|
|
540
|
+
TSchema
|
|
541
|
+
] extends [TreeNodeSchema] ? InsertableTypedNode<TSchema> : [TSchema] extends [AllowedTypes] ? InsertableTreeNodeFromAllowedTypes<TSchema> : never;
|
|
486
542
|
|
|
487
543
|
// @public
|
|
488
|
-
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends
|
|
544
|
+
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = [TSchema] extends [TreeNodeSchemaUnsafe] ? InsertableTypedNodeUnsafe<TSchema> : [TSchema] extends [AllowedTypesUnsafe] ? InsertableTreeNodeFromAllowedTypesUnsafe<TSchema> : never;
|
|
489
545
|
|
|
490
546
|
// @public
|
|
491
|
-
export type InsertableTypedNode<T extends TreeNodeSchema>
|
|
492
|
-
implicitlyConstructable: true;
|
|
493
|
-
} ? NodeBuilderData<T> : never) | Unhydrated<NodeFromSchema<T>>;
|
|
547
|
+
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);
|
|
494
548
|
|
|
495
549
|
// @public
|
|
496
|
-
type InsertableTypedNodeUnsafe<
|
|
497
|
-
Unhydrated<NodeFromSchemaUnsafe<T>> | (T extends {
|
|
498
|
-
implicitlyConstructable: true;
|
|
499
|
-
} ? NodeBuilderDataUnsafe<T> : never)
|
|
500
|
-
][_InlineTrick];
|
|
550
|
+
type InsertableTypedNodeUnsafe<TSchema extends Unenforced<TreeNodeSchemaUnsafe>, T = UnionToIntersection<TSchema>> = (T extends TreeNodeSchemaUnsafe<string, NodeKind, TreeNode | TreeLeafValue, never, true> ? NodeBuilderDataUnsafe<T> : never) | (T extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<T> : never);
|
|
501
551
|
|
|
502
552
|
// @public @sealed
|
|
503
553
|
export interface InternalTreeNode extends ErasedType<"@fluidframework/tree.InternalTreeNode"> {
|
|
@@ -508,6 +558,7 @@ declare namespace InternalTypes {
|
|
|
508
558
|
_InlineTrick,
|
|
509
559
|
FlattenKeys,
|
|
510
560
|
ApplyKind,
|
|
561
|
+
ApplyKindInput,
|
|
511
562
|
NodeBuilderData,
|
|
512
563
|
FieldHasDefault,
|
|
513
564
|
TreeArrayNodeBase,
|
|
@@ -530,6 +581,9 @@ declare namespace InternalTypes {
|
|
|
530
581
|
NodeBuilderDataUnsafe,
|
|
531
582
|
NodeFromSchemaUnsafe,
|
|
532
583
|
ReadonlyMapInlined,
|
|
584
|
+
TreeNodeSchemaUnsafe,
|
|
585
|
+
AllowedTypesUnsafe,
|
|
586
|
+
TreeNodeSchemaNonClassUnsafe,
|
|
533
587
|
FlexList,
|
|
534
588
|
FlexListToUnion,
|
|
535
589
|
ExtractItemType,
|
|
@@ -566,6 +620,9 @@ export function isFluidHandle(value: unknown): value is IFluidHandle;
|
|
|
566
620
|
// @public
|
|
567
621
|
export type IsListener<TListener> = TListener extends (...args: any[]) => void ? true : false;
|
|
568
622
|
|
|
623
|
+
// @alpha
|
|
624
|
+
export type IsUnion<T, T2 = T> = T extends unknown ? [T2] extends [T] ? false : true : "error";
|
|
625
|
+
|
|
569
626
|
// @public
|
|
570
627
|
export interface ITelemetryBaseProperties {
|
|
571
628
|
[index: string]: TelemetryBaseEventPropertyType | Tagged<TelemetryBaseEventPropertyType>;
|
|
@@ -695,10 +752,10 @@ export type Myself<M extends IMember = IMember> = M & {
|
|
|
695
752
|
};
|
|
696
753
|
|
|
697
754
|
// @public
|
|
698
|
-
type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind,
|
|
755
|
+
type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind, TreeNode | TreeLeafValue, infer TBuild> ? TBuild : never;
|
|
699
756
|
|
|
700
757
|
// @public
|
|
701
|
-
type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends
|
|
758
|
+
type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchemaUnsafe<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
|
|
702
759
|
|
|
703
760
|
// @beta @sealed
|
|
704
761
|
export interface NodeChangedData<TNode extends TreeNode = TreeNode> {
|
|
@@ -709,7 +766,7 @@ export interface NodeChangedData<TNode extends TreeNode = TreeNode> {
|
|
|
709
766
|
export type NodeFromSchema<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;
|
|
710
767
|
|
|
711
768
|
// @public
|
|
712
|
-
type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends
|
|
769
|
+
type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchemaUnsafe<string, NodeKind, infer TNode> ? TNode : never;
|
|
713
770
|
|
|
714
771
|
// @public
|
|
715
772
|
export interface NodeInDocumentConstraint {
|
|
@@ -743,6 +800,13 @@ type ObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveStringRecord<I
|
|
|
743
800
|
// @public
|
|
744
801
|
export type Off = () => void;
|
|
745
802
|
|
|
803
|
+
// @alpha
|
|
804
|
+
export type PopUnion<Union, AsOverloadedFunction = UnionToIntersection<Union extends unknown ? (f: Union) => void : never>> = AsOverloadedFunction extends (a: infer First) => void ? First : never;
|
|
805
|
+
|
|
806
|
+
// @public @sealed
|
|
807
|
+
export interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue> extends ReadonlyArray<T>, Awaited<TreeNode & WithType<string, NodeKind.Array>> {
|
|
808
|
+
}
|
|
809
|
+
|
|
746
810
|
// @public @sealed
|
|
747
811
|
interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes>> {
|
|
748
812
|
[Symbol.iterator](): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;
|
|
@@ -799,17 +863,17 @@ export const rollback: unique symbol;
|
|
|
799
863
|
// @public @sealed
|
|
800
864
|
export interface RunTransaction {
|
|
801
865
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult): TResult;
|
|
802
|
-
<TView extends TreeView<
|
|
866
|
+
<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult): TResult;
|
|
803
867
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback): TResult | typeof rollback;
|
|
804
|
-
<TView extends TreeView<
|
|
868
|
+
<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback): TResult | typeof rollback;
|
|
805
869
|
<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void): void;
|
|
806
|
-
<TView extends TreeView<
|
|
870
|
+
<TView extends TreeView<any>>(tree: TView, transaction: (root: TView["root"]) => void): void;
|
|
807
871
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
|
|
808
|
-
<TView extends TreeView<
|
|
872
|
+
<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
|
|
809
873
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
|
|
810
|
-
<TView extends TreeView<
|
|
874
|
+
<TView extends TreeView<any>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
|
|
811
875
|
<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void, preconditions?: readonly TransactionConstraint[]): void;
|
|
812
|
-
<TView extends TreeView<
|
|
876
|
+
<TView extends TreeView<any>>(tree: TView, transaction: (root: TView["root"]) => void, preconditions?: readonly TransactionConstraint[]): void;
|
|
813
877
|
readonly rollback: typeof rollback;
|
|
814
878
|
}
|
|
815
879
|
|
|
@@ -843,7 +907,7 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
843
907
|
readonly null: TreeNodeSchema<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null>;
|
|
844
908
|
readonly number: TreeNodeSchema<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
|
|
845
909
|
object<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchema>>(name: Name, fields: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNode<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecord<T>, true, T>;
|
|
846
|
-
objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & { readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property]
|
|
910
|
+
objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>>(name: Name, t: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & { readonly [Property in keyof T as FieldHasDefaultUnsafe<T[Property]> extends false ? Property : never]: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property], UnionToIntersection_2<T[Property]>>; } & { readonly [Property_1 in keyof T as FieldHasDefaultUnsafe<T[Property_1]> extends true ? Property_1 : never]?: InsertableTreeFieldFromImplicitFieldUnsafe<T[Property_1], UnionToIntersection_2<T[Property_1]>> | undefined; }, false, T>;
|
|
847
911
|
optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
848
912
|
optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Optional, T>;
|
|
849
913
|
required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
@@ -891,7 +955,7 @@ export type SharedTreeOptions = Partial<ICodecOptions> & Partial<SharedTreeForma
|
|
|
891
955
|
// @alpha
|
|
892
956
|
export function singletonSchema<TScope extends string, TName extends string | number>(factory: SchemaFactory<TScope, TName>, name: TName): TreeNodeSchemaClass<ScopedSchemaName<TScope, TName>, NodeKind.Object, TreeNode & {
|
|
893
957
|
readonly value: TName;
|
|
894
|
-
},
|
|
958
|
+
}, Record<string, never>, true, unknown> & (new (data?: InternalTreeNode | Record<string, never>) => TreeNode & {
|
|
895
959
|
readonly value: TName;
|
|
896
960
|
});
|
|
897
961
|
|
|
@@ -922,7 +986,7 @@ interface TreeApi extends TreeNodeApi {
|
|
|
922
986
|
}
|
|
923
987
|
|
|
924
988
|
// @public @sealed
|
|
925
|
-
export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes
|
|
989
|
+
export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>> {
|
|
926
990
|
}
|
|
927
991
|
|
|
928
992
|
// @public
|
|
@@ -931,7 +995,7 @@ export const TreeArrayNode: {
|
|
|
931
995
|
};
|
|
932
996
|
|
|
933
997
|
// @public @sealed
|
|
934
|
-
interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends
|
|
998
|
+
interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom = ReadonlyArrayNode> extends ReadonlyArrayNode<T> {
|
|
935
999
|
insertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
936
1000
|
insertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
937
1001
|
insertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
@@ -953,12 +1017,13 @@ interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<
|
|
|
953
1017
|
}
|
|
954
1018
|
|
|
955
1019
|
// @public @sealed
|
|
956
|
-
export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes
|
|
1020
|
+
export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>> {
|
|
957
1021
|
}
|
|
958
1022
|
|
|
959
1023
|
// @beta @sealed
|
|
960
1024
|
export const TreeBeta: {
|
|
961
|
-
|
|
1025
|
+
on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
|
|
1026
|
+
clone<TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
|
|
962
1027
|
};
|
|
963
1028
|
|
|
964
1029
|
// @alpha @sealed
|
|
@@ -992,10 +1057,10 @@ export enum TreeCompressionStrategy {
|
|
|
992
1057
|
}
|
|
993
1058
|
|
|
994
1059
|
// @public
|
|
995
|
-
export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind
|
|
1060
|
+
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;
|
|
996
1061
|
|
|
997
1062
|
// @public
|
|
998
|
-
type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind
|
|
1063
|
+
type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : unknown;
|
|
999
1064
|
|
|
1000
1065
|
// @public
|
|
1001
1066
|
export type TreeLeafValue = number | string | boolean | IFluidHandle | null;
|
|
@@ -1041,13 +1106,19 @@ export interface TreeNodeApi {
|
|
|
1041
1106
|
export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
|
|
1042
1107
|
|
|
1043
1108
|
// @public
|
|
1044
|
-
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends
|
|
1109
|
+
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<TSchema> : TSchema extends AllowedTypesUnsafe ? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>> : unknown;
|
|
1045
1110
|
|
|
1046
1111
|
// @public @sealed
|
|
1047
|
-
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode =
|
|
1112
|
+
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> = TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
1048
1113
|
|
|
1049
1114
|
// @public @sealed
|
|
1050
|
-
export interface TreeNodeSchemaClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode =
|
|
1115
|
+
export interface TreeNodeSchemaClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
1116
|
+
// @sealed
|
|
1117
|
+
new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
// @public
|
|
1121
|
+
export interface TreeNodeSchemaClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode | TreeLeafValue>, in TInsertable, out ImplicitlyConstructable extends boolean, out Info> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
1051
1122
|
// @sealed
|
|
1052
1123
|
new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
|
|
1053
1124
|
}
|
|
@@ -1063,11 +1134,20 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
1063
1134
|
}
|
|
1064
1135
|
|
|
1065
1136
|
// @public @sealed
|
|
1066
|
-
export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode =
|
|
1137
|
+
export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
1138
|
+
// (undocumented)
|
|
1139
|
+
create(data: TInsertable): TNode;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
// @public
|
|
1143
|
+
interface TreeNodeSchemaNonClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode | TreeLeafValue>, in TInsertable, out ImplicitlyConstructable extends boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
1067
1144
|
// (undocumented)
|
|
1068
1145
|
create(data: TInsertable): TNode;
|
|
1069
1146
|
}
|
|
1070
1147
|
|
|
1148
|
+
// @public
|
|
1149
|
+
type TreeNodeSchemaUnsafe<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends Unenforced<TreeNode | TreeLeafValue> = unknown, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown> = TreeNodeSchemaClassUnsafe<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> | TreeNodeSchemaNonClassUnsafe<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
1150
|
+
|
|
1071
1151
|
// @public
|
|
1072
1152
|
export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
|
|
1073
1153
|
|
|
@@ -1083,7 +1163,7 @@ export enum TreeStatus {
|
|
|
1083
1163
|
}
|
|
1084
1164
|
|
|
1085
1165
|
// @public @sealed
|
|
1086
|
-
export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposable {
|
|
1166
|
+
export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends IDisposable {
|
|
1087
1167
|
readonly compatibility: SchemaCompatibilityStatus;
|
|
1088
1168
|
readonly events: Listenable<TreeViewEvents>;
|
|
1089
1169
|
initialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;
|
|
@@ -1093,8 +1173,17 @@ export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposab
|
|
|
1093
1173
|
upgradeSchema(): void;
|
|
1094
1174
|
}
|
|
1095
1175
|
|
|
1176
|
+
// @alpha
|
|
1177
|
+
export interface TreeViewAlpha<in out TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> extends Omit<TreeView<TSchema extends ImplicitFieldSchema ? TSchema : ImplicitFieldSchema>, "root" | "initialize"> {
|
|
1178
|
+
// (undocumented)
|
|
1179
|
+
initialize(content: InsertableField<TSchema>): void;
|
|
1180
|
+
// (undocumented)
|
|
1181
|
+
get root(): TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeLeafValue | TreeNode;
|
|
1182
|
+
set root(newRoot: InsertableField<TSchema>);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1096
1185
|
// @public @sealed
|
|
1097
|
-
export class TreeViewConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
|
|
1186
|
+
export class TreeViewConfiguration<const TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
|
|
1098
1187
|
constructor(props: ITreeViewConfiguration<TSchema>);
|
|
1099
1188
|
readonly enableSchemaValidation: boolean;
|
|
1100
1189
|
readonly preventAmbiguity: boolean;
|
|
@@ -1113,9 +1202,6 @@ export interface TreeViewEvents {
|
|
|
1113
1202
|
// @alpha
|
|
1114
1203
|
export const typeboxValidator: JsonValidator;
|
|
1115
1204
|
|
|
1116
|
-
// @alpha
|
|
1117
|
-
export function typedObjectValues<TKey extends string, TValues>(object: Record<TKey, TValues>): TValues[];
|
|
1118
|
-
|
|
1119
1205
|
// @public @deprecated
|
|
1120
1206
|
const typeNameSymbol: unique symbol;
|
|
1121
1207
|
|
|
@@ -1128,6 +1214,18 @@ export type Unenforced<_DesiredExtendsConstraint> = unknown;
|
|
|
1128
1214
|
// @public
|
|
1129
1215
|
export type Unhydrated<T> = T;
|
|
1130
1216
|
|
|
1217
|
+
// @public
|
|
1218
|
+
export type UnionToIntersection<T> = (T extends T ? (k: T) => unknown : never) extends (k: infer U) => unknown ? U : never;
|
|
1219
|
+
|
|
1220
|
+
// @alpha
|
|
1221
|
+
export type UnionToTuple<Union, A extends unknown[] = [], First = PopUnion<Union>> = IsUnion<Union> extends true ? UnionToTuple<Exclude<Union, First>, [First, ...A]> : [Union, ...A];
|
|
1222
|
+
|
|
1223
|
+
// @alpha
|
|
1224
|
+
export const UnsafeUnknownSchema: unique symbol;
|
|
1225
|
+
|
|
1226
|
+
// @alpha
|
|
1227
|
+
export type UnsafeUnknownSchema = typeof UnsafeUnknownSchema;
|
|
1228
|
+
|
|
1131
1229
|
// @public
|
|
1132
1230
|
export type ValidateRecursiveSchema<T extends TreeNodeSchemaClass<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
|
|
1133
1231
|
[NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
|
|
@@ -1148,7 +1246,7 @@ export interface ViewableTree {
|
|
|
1148
1246
|
export interface WithType<out TName extends string = string, out TKind extends NodeKind = NodeKind, out TInfo = unknown> {
|
|
1149
1247
|
// @deprecated
|
|
1150
1248
|
get [typeNameSymbol](): TName;
|
|
1151
|
-
get [typeSchemaSymbol](): TreeNodeSchemaClass<TName, TKind,
|
|
1249
|
+
get [typeSchemaSymbol](): TreeNodeSchemaClass<TName, TKind, TreeNode | TreeLeafValue, never, boolean, TInfo>;
|
|
1152
1250
|
}
|
|
1153
1251
|
|
|
1154
1252
|
```
|