fluid-framework 2.4.0-299374 → 2.4.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 +111 -0
- package/api-report/fluid-framework.alpha.api.md +23 -79
- package/api-report/fluid-framework.beta.api.md +23 -47
- package/api-report/fluid-framework.legacy.alpha.api.md +21 -46
- package/api-report/fluid-framework.legacy.public.api.md +21 -46
- package/api-report/fluid-framework.public.api.md +21 -46
- package/dist/alpha.d.ts +0 -9
- package/dist/beta.d.ts +0 -2
- package/dist/legacy.d.ts +0 -2
- package/dist/public.d.ts +0 -2
- package/lib/alpha.d.ts +0 -9
- package/lib/beta.d.ts +0 -2
- package/lib/legacy.d.ts +0 -2
- package/lib/public.d.ts +0 -2
- package/package.json +12 -12
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
|
|
@@ -16,9 +16,6 @@ export function adaptEnum<TScope extends string, const TEnum extends Record<stri
|
|
|
16
16
|
// @public
|
|
17
17
|
export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
|
|
18
18
|
|
|
19
|
-
// @public
|
|
20
|
-
type AllowedTypesUnsafe = readonly LazyItem<TreeNodeSchemaUnsafe>[];
|
|
21
|
-
|
|
22
19
|
// @public
|
|
23
20
|
type ApplyKind<T, Kind extends FieldKind, DefaultsAreOptional extends boolean> = {
|
|
24
21
|
[FieldKind.Required]: T;
|
|
@@ -105,14 +102,6 @@ type ExtractItemType<Item extends LazyItem> = Item extends () => infer Result ?
|
|
|
105
102
|
// @alpha
|
|
106
103
|
export function extractPersistedSchema(schema: ImplicitFieldSchema): JsonCompatible;
|
|
107
104
|
|
|
108
|
-
// @alpha
|
|
109
|
-
export type FactoryContent = IFluidHandle | string | number | boolean | null | Iterable<readonly [string, InsertableContent]> | readonly InsertableContent[] | FactoryContentObject;
|
|
110
|
-
|
|
111
|
-
// @alpha
|
|
112
|
-
export type FactoryContentObject = {
|
|
113
|
-
readonly [P in string]?: InsertableContent;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
105
|
// @public
|
|
117
106
|
type FieldHasDefault<T extends ImplicitFieldSchema> = T extends FieldSchema<FieldKind.Optional | FieldKind.Identifier> ? true : false;
|
|
118
107
|
|
|
@@ -472,15 +461,6 @@ export type InitialObjects<T extends ContainerSchema> = {
|
|
|
472
461
|
// @public
|
|
473
462
|
type _InlineTrick = 0;
|
|
474
463
|
|
|
475
|
-
// @alpha
|
|
476
|
-
export type Insertable<TSchema extends ImplicitAllowedTypes | UnsafeUnknownSchema> = TSchema extends ImplicitAllowedTypes ? InsertableTreeNodeFromImplicitAllowedTypes<TSchema> : InsertableContent;
|
|
477
|
-
|
|
478
|
-
// @alpha
|
|
479
|
-
export type InsertableContent = Unhydrated<TreeNode> | FactoryContent;
|
|
480
|
-
|
|
481
|
-
// @alpha
|
|
482
|
-
export type InsertableField<TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> = TSchema extends ImplicitFieldSchema ? InsertableTreeFieldFromImplicitField<TSchema> : InsertableContent | undefined;
|
|
483
|
-
|
|
484
464
|
// @public
|
|
485
465
|
type InsertableObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = FlattenKeys<{
|
|
486
466
|
readonly [Property in keyof T]?: InsertableTreeFieldFromImplicitField<T[Property] & string>;
|
|
@@ -496,7 +476,7 @@ export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<Restrict
|
|
|
496
476
|
};
|
|
497
477
|
|
|
498
478
|
// @public
|
|
499
|
-
export type InsertableTreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypes<Types>, Kind, true> : TSchema extends ImplicitAllowedTypes ? InsertableTreeNodeFromImplicitAllowedTypes<TSchema> :
|
|
479
|
+
export type InsertableTreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypes<Types>, Kind, true> : TSchema extends ImplicitAllowedTypes ? InsertableTreeNodeFromImplicitAllowedTypes<TSchema> : unknown;
|
|
500
480
|
|
|
501
481
|
// @public
|
|
502
482
|
export type InsertableTreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true> : InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>;
|
|
@@ -505,7 +485,7 @@ export type InsertableTreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforce
|
|
|
505
485
|
export type InsertableTreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? InsertableTypedNode<TSchema> : TSchema extends AllowedTypes ? InsertableTypedNode<FlexListToUnion<TSchema>> : never;
|
|
506
486
|
|
|
507
487
|
// @public
|
|
508
|
-
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends
|
|
488
|
+
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends AllowedTypes ? InsertableTypedNodeUnsafe<FlexListToUnion<TSchema>> : InsertableTypedNodeUnsafe<TSchema>;
|
|
509
489
|
|
|
510
490
|
// @public
|
|
511
491
|
export type InsertableTypedNode<T extends TreeNodeSchema> = (T extends {
|
|
@@ -550,9 +530,6 @@ declare namespace InternalTypes {
|
|
|
550
530
|
NodeBuilderDataUnsafe,
|
|
551
531
|
NodeFromSchemaUnsafe,
|
|
552
532
|
ReadonlyMapInlined,
|
|
553
|
-
TreeNodeSchemaUnsafe,
|
|
554
|
-
AllowedTypesUnsafe,
|
|
555
|
-
TreeNodeSchemaNonClassUnsafe,
|
|
556
533
|
FlexList,
|
|
557
534
|
FlexListToUnion,
|
|
558
535
|
ExtractItemType,
|
|
@@ -718,10 +695,10 @@ export type Myself<M extends IMember = IMember> = M & {
|
|
|
718
695
|
};
|
|
719
696
|
|
|
720
697
|
// @public
|
|
721
|
-
type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind,
|
|
698
|
+
type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
|
|
722
699
|
|
|
723
700
|
// @public
|
|
724
|
-
type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends
|
|
701
|
+
type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
|
|
725
702
|
|
|
726
703
|
// @beta @sealed
|
|
727
704
|
export interface NodeChangedData<TNode extends TreeNode = TreeNode> {
|
|
@@ -732,7 +709,7 @@ export interface NodeChangedData<TNode extends TreeNode = TreeNode> {
|
|
|
732
709
|
export type NodeFromSchema<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;
|
|
733
710
|
|
|
734
711
|
// @public
|
|
735
|
-
type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends
|
|
712
|
+
type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;
|
|
736
713
|
|
|
737
714
|
// @public
|
|
738
715
|
export interface NodeInDocumentConstraint {
|
|
@@ -766,10 +743,6 @@ type ObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveStringRecord<I
|
|
|
766
743
|
// @public
|
|
767
744
|
export type Off = () => void;
|
|
768
745
|
|
|
769
|
-
// @public @sealed
|
|
770
|
-
export interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue> extends ReadonlyArray<T>, Awaited<TreeNode & WithType<string, NodeKind.Array>> {
|
|
771
|
-
}
|
|
772
|
-
|
|
773
746
|
// @public @sealed
|
|
774
747
|
interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes>> {
|
|
775
748
|
[Symbol.iterator](): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;
|
|
@@ -826,17 +799,17 @@ export const rollback: unique symbol;
|
|
|
826
799
|
// @public @sealed
|
|
827
800
|
export interface RunTransaction {
|
|
828
801
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult): TResult;
|
|
829
|
-
<TView extends TreeView<
|
|
802
|
+
<TView extends TreeView<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult): TResult;
|
|
830
803
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback): TResult | typeof rollback;
|
|
831
|
-
<TView extends TreeView<
|
|
804
|
+
<TView extends TreeView<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback): TResult | typeof rollback;
|
|
832
805
|
<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void): void;
|
|
833
|
-
<TView extends TreeView<
|
|
806
|
+
<TView extends TreeView<ImplicitFieldSchema>>(tree: TView, transaction: (root: TView["root"]) => void): void;
|
|
834
807
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
|
|
835
|
-
<TView extends TreeView<
|
|
808
|
+
<TView extends TreeView<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
|
|
836
809
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
|
|
837
|
-
<TView extends TreeView<
|
|
810
|
+
<TView extends TreeView<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
|
|
838
811
|
<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void, preconditions?: readonly TransactionConstraint[]): void;
|
|
839
|
-
<TView extends TreeView<
|
|
812
|
+
<TView extends TreeView<ImplicitFieldSchema>>(tree: TView, transaction: (root: TView["root"]) => void, preconditions?: readonly TransactionConstraint[]): void;
|
|
840
813
|
readonly rollback: typeof rollback;
|
|
841
814
|
}
|
|
842
815
|
|
|
@@ -949,7 +922,7 @@ interface TreeApi extends TreeNodeApi {
|
|
|
949
922
|
}
|
|
950
923
|
|
|
951
924
|
// @public @sealed
|
|
952
|
-
export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes
|
|
925
|
+
export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>, TreeArrayNode> {
|
|
953
926
|
}
|
|
954
927
|
|
|
955
928
|
// @public
|
|
@@ -958,7 +931,7 @@ export const TreeArrayNode: {
|
|
|
958
931
|
};
|
|
959
932
|
|
|
960
933
|
// @public @sealed
|
|
961
|
-
interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom
|
|
934
|
+
interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<T>, TreeNode {
|
|
962
935
|
insertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
963
936
|
insertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
964
937
|
insertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
@@ -980,12 +953,13 @@ interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom = ReadonlyArrayNode> ex
|
|
|
980
953
|
}
|
|
981
954
|
|
|
982
955
|
// @public @sealed
|
|
983
|
-
export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes
|
|
956
|
+
export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, TreeArrayNode> {
|
|
984
957
|
}
|
|
985
958
|
|
|
986
959
|
// @beta @sealed
|
|
987
960
|
export const TreeBeta: {
|
|
988
|
-
|
|
961
|
+
on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
|
|
962
|
+
clone<TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
|
|
989
963
|
};
|
|
990
964
|
|
|
991
965
|
// @alpha @sealed
|
|
@@ -1019,7 +993,7 @@ export enum TreeCompressionStrategy {
|
|
|
1019
993
|
}
|
|
1020
994
|
|
|
1021
995
|
// @public
|
|
1022
|
-
export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> :
|
|
996
|
+
export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> : unknown;
|
|
1023
997
|
|
|
1024
998
|
// @public
|
|
1025
999
|
type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : unknown;
|
|
@@ -1068,19 +1042,13 @@ export interface TreeNodeApi {
|
|
|
1068
1042
|
export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
|
|
1069
1043
|
|
|
1070
1044
|
// @public
|
|
1071
|
-
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends
|
|
1045
|
+
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> : TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
|
|
1072
1046
|
|
|
1073
1047
|
// @public @sealed
|
|
1074
|
-
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode
|
|
1048
|
+
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode = unknown, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown> = TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
1075
1049
|
|
|
1076
1050
|
// @public @sealed
|
|
1077
|
-
export interface TreeNodeSchemaClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode
|
|
1078
|
-
// @sealed
|
|
1079
|
-
new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
// @public
|
|
1083
|
-
export interface TreeNodeSchemaClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode | TreeLeafValue>, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
1051
|
+
export interface TreeNodeSchemaClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
1084
1052
|
// @sealed
|
|
1085
1053
|
new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
|
|
1086
1054
|
}
|
|
@@ -1096,20 +1064,11 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
1096
1064
|
}
|
|
1097
1065
|
|
|
1098
1066
|
// @public @sealed
|
|
1099
|
-
export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode
|
|
1067
|
+
export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
1100
1068
|
// (undocumented)
|
|
1101
1069
|
create(data: TInsertable): TNode;
|
|
1102
1070
|
}
|
|
1103
1071
|
|
|
1104
|
-
// @public
|
|
1105
|
-
interface TreeNodeSchemaNonClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode | TreeLeafValue>, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
1106
|
-
// (undocumented)
|
|
1107
|
-
create(data: TInsertable): TNode;
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
// @public
|
|
1111
|
-
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>;
|
|
1112
|
-
|
|
1113
1072
|
// @public
|
|
1114
1073
|
export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
|
|
1115
1074
|
|
|
@@ -1125,7 +1084,7 @@ export enum TreeStatus {
|
|
|
1125
1084
|
}
|
|
1126
1085
|
|
|
1127
1086
|
// @public @sealed
|
|
1128
|
-
export interface TreeView<
|
|
1087
|
+
export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposable {
|
|
1129
1088
|
readonly compatibility: SchemaCompatibilityStatus;
|
|
1130
1089
|
readonly events: Listenable<TreeViewEvents>;
|
|
1131
1090
|
initialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;
|
|
@@ -1135,15 +1094,6 @@ export interface TreeView<in out TSchema extends ImplicitFieldSchema> extends ID
|
|
|
1135
1094
|
upgradeSchema(): void;
|
|
1136
1095
|
}
|
|
1137
1096
|
|
|
1138
|
-
// @alpha
|
|
1139
|
-
export interface TreeViewAlpha<in out TSchema extends ImplicitFieldSchema | UnsafeUnknownSchema> extends Omit<TreeView<TSchema extends ImplicitFieldSchema ? TSchema : ImplicitFieldSchema>, "root" | "initialize"> {
|
|
1140
|
-
// (undocumented)
|
|
1141
|
-
initialize(content: InsertableField<TSchema>): void;
|
|
1142
|
-
// (undocumented)
|
|
1143
|
-
get root(): TSchema extends ImplicitFieldSchema ? TreeFieldFromImplicitField<TSchema> : TreeLeafValue | TreeNode;
|
|
1144
|
-
set root(newRoot: InsertableField<TSchema>);
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
1097
|
// @public @sealed
|
|
1148
1098
|
export class TreeViewConfiguration<TSchema extends ImplicitFieldSchema = ImplicitFieldSchema> implements Required<ITreeViewConfiguration<TSchema>> {
|
|
1149
1099
|
constructor(props: ITreeViewConfiguration<TSchema>);
|
|
@@ -1179,12 +1129,6 @@ export type Unenforced<_DesiredExtendsConstraint> = unknown;
|
|
|
1179
1129
|
// @public
|
|
1180
1130
|
export type Unhydrated<T> = T;
|
|
1181
1131
|
|
|
1182
|
-
// @alpha
|
|
1183
|
-
export const UnsafeUnknownSchema: unique symbol;
|
|
1184
|
-
|
|
1185
|
-
// @alpha
|
|
1186
|
-
export type UnsafeUnknownSchema = typeof UnsafeUnknownSchema;
|
|
1187
|
-
|
|
1188
1132
|
// @public
|
|
1189
1133
|
export type ValidateRecursiveSchema<T extends TreeNodeSchemaClass<string, NodeKind.Array | NodeKind.Map | NodeKind.Object, TreeNode & WithType<T["identifier"], T["kind"]>, {
|
|
1190
1134
|
[NodeKind.Object]: T["info"] extends RestrictiveStringRecord<ImplicitFieldSchema> ? InsertableObjectFromSchemaRecord<T["info"]> : unknown;
|
|
@@ -1205,7 +1149,7 @@ export interface ViewableTree {
|
|
|
1205
1149
|
export interface WithType<out TName extends string = string, out TKind extends NodeKind = NodeKind, out TInfo = unknown> {
|
|
1206
1150
|
// @deprecated
|
|
1207
1151
|
get [typeNameSymbol](): TName;
|
|
1208
|
-
get [typeSchemaSymbol](): TreeNodeSchemaClass<TName, TKind,
|
|
1152
|
+
get [typeSchemaSymbol](): TreeNodeSchemaClass<TName, TKind, unknown, never, boolean, TInfo>;
|
|
1209
1153
|
}
|
|
1210
1154
|
|
|
1211
1155
|
```
|
|
@@ -7,9 +7,6 @@
|
|
|
7
7
|
// @public
|
|
8
8
|
export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
|
|
9
9
|
|
|
10
|
-
// @public
|
|
11
|
-
type AllowedTypesUnsafe = readonly LazyItem<TreeNodeSchemaUnsafe>[];
|
|
12
|
-
|
|
13
10
|
// @public
|
|
14
11
|
type ApplyKind<T, Kind extends FieldKind, DefaultsAreOptional extends boolean> = {
|
|
15
12
|
[FieldKind.Required]: T;
|
|
@@ -423,7 +420,7 @@ export type InsertableObjectFromSchemaRecordUnsafe<T extends Unenforced<Restrict
|
|
|
423
420
|
};
|
|
424
421
|
|
|
425
422
|
// @public
|
|
426
|
-
export type InsertableTreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypes<Types>, Kind, true> : TSchema extends ImplicitAllowedTypes ? InsertableTreeNodeFromImplicitAllowedTypes<TSchema> :
|
|
423
|
+
export type InsertableTreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypes<Types>, Kind, true> : TSchema extends ImplicitAllowedTypes ? InsertableTreeNodeFromImplicitAllowedTypes<TSchema> : unknown;
|
|
427
424
|
|
|
428
425
|
// @public
|
|
429
426
|
export type InsertableTreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, true> : InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema>;
|
|
@@ -432,7 +429,7 @@ export type InsertableTreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforce
|
|
|
432
429
|
export type InsertableTreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? InsertableTypedNode<TSchema> : TSchema extends AllowedTypes ? InsertableTypedNode<FlexListToUnion<TSchema>> : never;
|
|
433
430
|
|
|
434
431
|
// @public
|
|
435
|
-
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends
|
|
432
|
+
export type InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends AllowedTypes ? InsertableTypedNodeUnsafe<FlexListToUnion<TSchema>> : InsertableTypedNodeUnsafe<TSchema>;
|
|
436
433
|
|
|
437
434
|
// @public
|
|
438
435
|
export type InsertableTypedNode<T extends TreeNodeSchema> = (T extends {
|
|
@@ -477,9 +474,6 @@ declare namespace InternalTypes {
|
|
|
477
474
|
NodeBuilderDataUnsafe,
|
|
478
475
|
NodeFromSchemaUnsafe,
|
|
479
476
|
ReadonlyMapInlined,
|
|
480
|
-
TreeNodeSchemaUnsafe,
|
|
481
|
-
AllowedTypesUnsafe,
|
|
482
|
-
TreeNodeSchemaNonClassUnsafe,
|
|
483
477
|
FlexList,
|
|
484
478
|
FlexListToUnion,
|
|
485
479
|
ExtractItemType,
|
|
@@ -570,10 +564,10 @@ export type Myself<M extends IMember = IMember> = M & {
|
|
|
570
564
|
};
|
|
571
565
|
|
|
572
566
|
// @public
|
|
573
|
-
type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind,
|
|
567
|
+
type NodeBuilderData<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
|
|
574
568
|
|
|
575
569
|
// @public
|
|
576
|
-
type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends
|
|
570
|
+
type NodeBuilderDataUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchema<string, NodeKind, unknown, infer TBuild> ? TBuild : never;
|
|
577
571
|
|
|
578
572
|
// @beta @sealed
|
|
579
573
|
export interface NodeChangedData<TNode extends TreeNode = TreeNode> {
|
|
@@ -584,7 +578,7 @@ export interface NodeChangedData<TNode extends TreeNode = TreeNode> {
|
|
|
584
578
|
export type NodeFromSchema<T extends TreeNodeSchema> = T extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;
|
|
585
579
|
|
|
586
580
|
// @public
|
|
587
|
-
type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends
|
|
581
|
+
type NodeFromSchemaUnsafe<T extends Unenforced<TreeNodeSchema>> = T extends TreeNodeSchema<string, NodeKind, infer TNode> ? TNode : never;
|
|
588
582
|
|
|
589
583
|
// @public
|
|
590
584
|
export interface NodeInDocumentConstraint {
|
|
@@ -615,10 +609,6 @@ type ObjectFromSchemaRecordUnsafe<T extends Unenforced<RestrictiveStringRecord<I
|
|
|
615
609
|
// @public
|
|
616
610
|
export type Off = () => void;
|
|
617
611
|
|
|
618
|
-
// @public @sealed
|
|
619
|
-
export interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue> extends ReadonlyArray<T>, Awaited<TreeNode & WithType<string, NodeKind.Array>> {
|
|
620
|
-
}
|
|
621
|
-
|
|
622
612
|
// @public @sealed
|
|
623
613
|
interface ReadonlyMapInlined<K, T extends Unenforced<ImplicitAllowedTypes>> {
|
|
624
614
|
[Symbol.iterator](): IterableIterator<[K, TreeNodeFromImplicitAllowedTypesUnsafe<T>]>;
|
|
@@ -675,17 +665,17 @@ export const rollback: unique symbol;
|
|
|
675
665
|
// @public @sealed
|
|
676
666
|
export interface RunTransaction {
|
|
677
667
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult): TResult;
|
|
678
|
-
<TView extends TreeView<
|
|
668
|
+
<TView extends TreeView<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult): TResult;
|
|
679
669
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback): TResult | typeof rollback;
|
|
680
|
-
<TView extends TreeView<
|
|
670
|
+
<TView extends TreeView<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback): TResult | typeof rollback;
|
|
681
671
|
<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void): void;
|
|
682
|
-
<TView extends TreeView<
|
|
672
|
+
<TView extends TreeView<ImplicitFieldSchema>>(tree: TView, transaction: (root: TView["root"]) => void): void;
|
|
683
673
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
|
|
684
|
-
<TView extends TreeView<
|
|
674
|
+
<TView extends TreeView<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult, preconditions?: readonly TransactionConstraint[]): TResult;
|
|
685
675
|
<TNode extends TreeNode, TResult>(node: TNode, transaction: (node: TNode) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
|
|
686
|
-
<TView extends TreeView<
|
|
676
|
+
<TView extends TreeView<ImplicitFieldSchema>, TResult>(tree: TView, transaction: (root: TView["root"]) => TResult | typeof rollback, preconditions?: readonly TransactionConstraint[]): TResult | typeof rollback;
|
|
687
677
|
<TNode extends TreeNode>(node: TNode, transaction: (node: TNode) => void, preconditions?: readonly TransactionConstraint[]): void;
|
|
688
|
-
<TView extends TreeView<
|
|
678
|
+
<TView extends TreeView<ImplicitFieldSchema>>(tree: TView, transaction: (root: TView["root"]) => void, preconditions?: readonly TransactionConstraint[]): void;
|
|
689
679
|
readonly rollback: typeof rollback;
|
|
690
680
|
}
|
|
691
681
|
|
|
@@ -767,7 +757,7 @@ interface TreeApi extends TreeNodeApi {
|
|
|
767
757
|
}
|
|
768
758
|
|
|
769
759
|
// @public @sealed
|
|
770
|
-
export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes
|
|
760
|
+
export interface TreeArrayNode<TAllowedTypes extends ImplicitAllowedTypes = ImplicitAllowedTypes> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>, TreeArrayNode> {
|
|
771
761
|
}
|
|
772
762
|
|
|
773
763
|
// @public
|
|
@@ -776,7 +766,7 @@ export const TreeArrayNode: {
|
|
|
776
766
|
};
|
|
777
767
|
|
|
778
768
|
// @public @sealed
|
|
779
|
-
interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom
|
|
769
|
+
interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<T>, TreeNode {
|
|
780
770
|
insertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
781
771
|
insertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
782
772
|
insertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;
|
|
@@ -798,12 +788,13 @@ interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom = ReadonlyArrayNode> ex
|
|
|
798
788
|
}
|
|
799
789
|
|
|
800
790
|
// @public @sealed
|
|
801
|
-
export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes
|
|
791
|
+
export interface TreeArrayNodeUnsafe<TAllowedTypes extends Unenforced<ImplicitAllowedTypes>> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, InsertableTreeNodeFromImplicitAllowedTypesUnsafe<TAllowedTypes>, TreeArrayNode> {
|
|
802
792
|
}
|
|
803
793
|
|
|
804
794
|
// @beta @sealed
|
|
805
795
|
export const TreeBeta: {
|
|
806
|
-
|
|
796
|
+
on<K extends keyof TreeChangeEventsBeta<TNode>, TNode extends TreeNode>(node: TNode, eventName: K, listener: NoInfer<TreeChangeEventsBeta<TNode>[K]>): () => void;
|
|
797
|
+
clone<TSchema extends ImplicitFieldSchema>(node: TreeFieldFromImplicitField<TSchema>): TreeFieldFromImplicitField<TSchema>;
|
|
807
798
|
};
|
|
808
799
|
|
|
809
800
|
// @public @sealed
|
|
@@ -818,7 +809,7 @@ export interface TreeChangeEventsBeta<TNode extends TreeNode = TreeNode> extends
|
|
|
818
809
|
}
|
|
819
810
|
|
|
820
811
|
// @public
|
|
821
|
-
export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> :
|
|
812
|
+
export type TreeFieldFromImplicitField<TSchema extends ImplicitFieldSchema = FieldSchema> = TSchema extends FieldSchema<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypes<Types>, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> : unknown;
|
|
822
813
|
|
|
823
814
|
// @public
|
|
824
815
|
type TreeFieldFromImplicitFieldUnsafe<TSchema extends Unenforced<ImplicitFieldSchema>> = TSchema extends FieldSchemaUnsafe<infer Kind, infer Types> ? ApplyKind<TreeNodeFromImplicitAllowedTypesUnsafe<Types>, Kind, false> : TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypesUnsafe<TSchema> : unknown;
|
|
@@ -867,19 +858,13 @@ export interface TreeNodeApi {
|
|
|
867
858
|
export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedTypes = TreeNodeSchema> = TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
|
|
868
859
|
|
|
869
860
|
// @public
|
|
870
|
-
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends
|
|
861
|
+
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends ImplicitAllowedTypes ? TreeNodeFromImplicitAllowedTypes<TSchema> : TSchema extends TreeNodeSchema ? NodeFromSchema<TSchema> : TSchema extends AllowedTypes ? NodeFromSchema<FlexListToUnion<TSchema>> : unknown;
|
|
871
862
|
|
|
872
863
|
// @public @sealed
|
|
873
|
-
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode
|
|
864
|
+
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode = unknown, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown> = TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
874
865
|
|
|
875
866
|
// @public @sealed
|
|
876
|
-
export interface TreeNodeSchemaClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode
|
|
877
|
-
// @sealed
|
|
878
|
-
new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
// @public
|
|
882
|
-
export interface TreeNodeSchemaClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode | TreeLeafValue>, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
867
|
+
export interface TreeNodeSchemaClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
883
868
|
// @sealed
|
|
884
869
|
new (data: TInsertable | InternalTreeNode): Unhydrated<TNode>;
|
|
885
870
|
}
|
|
@@ -895,20 +880,11 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
895
880
|
}
|
|
896
881
|
|
|
897
882
|
// @public @sealed
|
|
898
|
-
export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode
|
|
899
|
-
// (undocumented)
|
|
900
|
-
create(data: TInsertable): TNode;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
// @public
|
|
904
|
-
interface TreeNodeSchemaNonClassUnsafe<out Name extends string, out Kind extends NodeKind, out TNode extends Unenforced<TreeNode | TreeLeafValue>, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
883
|
+
export interface TreeNodeSchemaNonClass<out Name extends string = string, out Kind extends NodeKind = NodeKind, out TNode = unknown, in TInsertable = never, out ImplicitlyConstructable extends boolean = boolean, out Info = unknown> extends TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info> {
|
|
905
884
|
// (undocumented)
|
|
906
885
|
create(data: TInsertable): TNode;
|
|
907
886
|
}
|
|
908
887
|
|
|
909
|
-
// @public
|
|
910
|
-
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>;
|
|
911
|
-
|
|
912
888
|
// @public
|
|
913
889
|
export type TreeObjectNode<T extends RestrictiveStringRecord<ImplicitFieldSchema>, TypeName extends string = string> = TreeNode & ObjectFromSchemaRecord<T> & WithType<TypeName, NodeKind.Object, T>;
|
|
914
890
|
|
|
@@ -924,7 +900,7 @@ export enum TreeStatus {
|
|
|
924
900
|
}
|
|
925
901
|
|
|
926
902
|
// @public @sealed
|
|
927
|
-
export interface TreeView<
|
|
903
|
+
export interface TreeView<TSchema extends ImplicitFieldSchema> extends IDisposable {
|
|
928
904
|
readonly compatibility: SchemaCompatibilityStatus;
|
|
929
905
|
readonly events: Listenable<TreeViewEvents>;
|
|
930
906
|
initialize(content: InsertableTreeFieldFromImplicitField<TSchema>): void;
|
|
@@ -983,7 +959,7 @@ export interface ViewableTree {
|
|
|
983
959
|
export interface WithType<out TName extends string = string, out TKind extends NodeKind = NodeKind, out TInfo = unknown> {
|
|
984
960
|
// @deprecated
|
|
985
961
|
get [typeNameSymbol](): TName;
|
|
986
|
-
get [typeSchemaSymbol](): TreeNodeSchemaClass<TName, TKind,
|
|
962
|
+
get [typeSchemaSymbol](): TreeNodeSchemaClass<TName, TKind, unknown, never, boolean, TInfo>;
|
|
987
963
|
}
|
|
988
964
|
|
|
989
965
|
```
|