fluid-framework 2.12.0 → 2.13.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 +136 -0
- package/api-report/fluid-framework.alpha.api.md +86 -10
- package/api-report/fluid-framework.beta.api.md +22 -10
- package/api-report/fluid-framework.legacy.alpha.api.md +22 -10
- package/api-report/fluid-framework.legacy.public.api.md +22 -10
- package/api-report/fluid-framework.public.api.md +22 -10
- package/dist/alpha.d.ts +11 -0
- package/dist/beta.d.ts +2 -0
- package/dist/legacy.d.ts +2 -0
- package/dist/public.d.ts +2 -0
- package/lib/alpha.d.ts +11 -0
- package/lib/beta.d.ts +2 -0
- package/lib/legacy.d.ts +2 -0
- package/lib/public.d.ts +2 -0
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,141 @@
|
|
|
1
1
|
# fluid-framework
|
|
2
2
|
|
|
3
|
+
## 2.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Metadata can be associated with Node Schema ([#23321](https://github.com/microsoft/FluidFramework/pull/23321)) [58619c3c4e](https://github.com/microsoft/FluidFramework/commit/58619c3c4ee55ca1497a117321ae0b364e6084e6)
|
|
8
|
+
|
|
9
|
+
Users of TreeView can now specify metadata when creating Node Schema, via `SchemaFactoryAlpha`.
|
|
10
|
+
This metadata may include system-understood properties like `description`.
|
|
11
|
+
|
|
12
|
+
Example:
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
const schemaFactory = new SchemaFactoryAlpha(...);
|
|
16
|
+
class Point extends schemaFactory.object("Point", {
|
|
17
|
+
x: schemaFactory.required(schemaFactory.number),
|
|
18
|
+
y: schemaFactory.required(schemaFactory.number),
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
metadata: {
|
|
22
|
+
description: "A point in 2D space",
|
|
23
|
+
},
|
|
24
|
+
}) {}
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Functionality like the experimental conversion of Tree Schema to [JSON Schema](https://json-schema.org/) ([getJsonSchema](https://github.com/microsoft/FluidFramework/releases/tag/client_v2.4.0#user-content-metadata-can-now-be-associated-with-field-schema-22564)) leverages such system-understood metadata to generate useful information.
|
|
29
|
+
In the case of the `description` property, it is mapped directly to the `description` property supported by JSON Schema.
|
|
30
|
+
|
|
31
|
+
Custom, user-defined properties can also be specified.
|
|
32
|
+
These properties will not be used by the system by default, but can be used to associate common application-specific properties with Node Schema.
|
|
33
|
+
|
|
34
|
+
#### `SchemaFactoryAlpha` Updates
|
|
35
|
+
|
|
36
|
+
- `object` and `objectRecursive`, `arrayRecursive`, and `mapRecursive` now support `metadata` in their `options` parameter.
|
|
37
|
+
- (new) `arrayAlpha` - Variant of `array` that accepts an options parameter which supports `metadata`
|
|
38
|
+
- (new) `mapAlpha` - Variant of `map` that accepts an options parameter which supports `metadata`
|
|
39
|
+
|
|
40
|
+
#### Example
|
|
41
|
+
|
|
42
|
+
An application is implementing search functionality.
|
|
43
|
+
By default, the app author wishes for all app content to be potentially indexable by search, unless otherwise specified.
|
|
44
|
+
They can leverage schema metadata to decorate types of nodes that should be ignored by search, and leverage that information when walking the tree during a search.
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
|
|
48
|
+
interface AppMetadata {
|
|
49
|
+
/**
|
|
50
|
+
* Whether or not nodes of this type should be ignored by search.
|
|
51
|
+
* @defaultValue `false`
|
|
52
|
+
*/
|
|
53
|
+
searchIgnore?: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const schemaFactory = new SchemaFactoryAlpha(...);
|
|
57
|
+
class Point extends schemaFactory.object("Point", {
|
|
58
|
+
x: schemaFactory.required(schemaFactory.number),
|
|
59
|
+
y: schemaFactory.required(schemaFactory.number),
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
metadata: {
|
|
63
|
+
description: "A point in 2D space",
|
|
64
|
+
custom: {
|
|
65
|
+
searchIgnore: true,
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
}) {}
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Search can then be implemented to look for the appropriate metadata, and leverage it to omit the unwanted position data from search.
|
|
73
|
+
|
|
74
|
+
#### Potential for breaking existing code
|
|
75
|
+
|
|
76
|
+
These changes add the new property "metadata" to the base type from which all node schema derive.
|
|
77
|
+
If you have existing node schema subclasses that include a property of this name, there is a chance for potential conflict here that could be breaking.
|
|
78
|
+
If you encounter issues here, consider renaming your property or leveraging the new metadata support.
|
|
79
|
+
|
|
80
|
+
- New alpha APIs for schema evolution ([#23362](https://github.com/microsoft/FluidFramework/pull/23362)) [2406e00efe](https://github.com/microsoft/FluidFramework/commit/2406e00efed282be58a9e09cb3478c9a9d170ef0)
|
|
81
|
+
|
|
82
|
+
There are now `@alpha` APIs for schema evolution which support adding optional fields to object node types without a staged rollout.
|
|
83
|
+
|
|
84
|
+
SharedTree has many safety checks in place to ensure applications understand the format of documents they must support.
|
|
85
|
+
One of these checks verifies that the view schema (defined in application's code) aligns with the document schema (determined by the document data at rest).
|
|
86
|
+
This helps to ensure that clients running incompatible versions of the application's code don't collaborate at the same time on some document, which could cause data loss or disrupt application invariants.
|
|
87
|
+
One general solution application authors can perform is to stage the rollout of a feature which changes document schema into multiple phases:
|
|
88
|
+
|
|
89
|
+
1. Release an application version which understands documents written with the new format but doesn't attempt to upgrade any documents
|
|
90
|
+
2. Wait for this application version to saturate in the app's ecosystem
|
|
91
|
+
3. Release an application version which upgrades documents to start leveraging the new format.
|
|
92
|
+
|
|
93
|
+
However, this process can be cumbersome for application authors: for many types of changes, an app author doesn't particularly care if older application code collaborates with newer code, as the only downside is that the older application version might not present a fully faithful experience.
|
|
94
|
+
As an example, consider an application which renders circles on a canvas (similar to what is presented [here](https://github.com/microsoft/FluidFramework/blob/main/packages/dds/tree/docs/user-facing/schema-evolution.md)).
|
|
95
|
+
The application author might anticipate adding support to render the circle with various different other properties (border style, border width, background color, varying radius, etc.).
|
|
96
|
+
Therefore, they should declare their schema using `SchemaFactoryObjectOptions.allowUnknownOptionalFields` like so:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { SchemaFactoryAlpha } from "@fluidframework/tree/alpha";
|
|
100
|
+
// "Old" application code/schema
|
|
101
|
+
const factory = new SchemaFactoryAlpha("Geometry");
|
|
102
|
+
class Circle extends factory.object(
|
|
103
|
+
"Circle",
|
|
104
|
+
{
|
|
105
|
+
x: factory.number,
|
|
106
|
+
y: factory.number,
|
|
107
|
+
},
|
|
108
|
+
{ allowUnknownOptionalFields: true },
|
|
109
|
+
) {}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Later, they add some of these features to their application:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
import { SchemaFactoryAlpha } from "@fluidframework/tree/alpha";
|
|
116
|
+
// "New" application code/schema
|
|
117
|
+
const factory = new SchemaFactoryAlpha("Geometry");
|
|
118
|
+
class Circle extends factory.object(
|
|
119
|
+
"Circle",
|
|
120
|
+
{
|
|
121
|
+
x: factory.number,
|
|
122
|
+
y: factory.number,
|
|
123
|
+
// Note that radius and color must both be declared as optional fields since this application must
|
|
124
|
+
// support opening up existing documents that didn't have this information.
|
|
125
|
+
radius: factory.optional(factory.number),
|
|
126
|
+
color: factory.optional(factory.string), // ex: #00FF00
|
|
127
|
+
},
|
|
128
|
+
{ allowUnknownOptionalFields: true },
|
|
129
|
+
) {}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
When they go to deploy this newer version of the application, they could opt to start upgrading documents as soon as the newer code is rolled out, and the older code would still be able to open up (and collaborate on) documents using the newer schema version.
|
|
133
|
+
Note that it's only important that the old _application code_ elected to allow opening documents with unknown optional fields.
|
|
134
|
+
This policy is not persisted into documents in any form, so applications are free to modify it at any point.
|
|
135
|
+
|
|
136
|
+
For specific API details, see documentation on `SchemaFactoryObjectOptions.allowUnknownOptionalFields`.
|
|
137
|
+
For a more thorough discussion of this topic, see [Schema Evolvability](https://github.com/microsoft/FluidFramework/tree/main/packages/dds/tree#schema-evolvability) in the SharedTree README.
|
|
138
|
+
|
|
3
139
|
## 2.12.0
|
|
4
140
|
|
|
5
141
|
Dependency updates only.
|
|
@@ -735,6 +735,7 @@ export type JsonNodeSchema = JsonLeafNodeSchema | JsonMapNodeSchema | JsonArrayN
|
|
|
735
735
|
|
|
736
736
|
// @alpha @sealed
|
|
737
737
|
export interface JsonNodeSchemaBase<TNodeKind extends NodeKind, TJsonSchemaType extends JsonSchemaType> {
|
|
738
|
+
readonly description?: string | undefined;
|
|
738
739
|
readonly _treeNodeSchemaKind: TNodeKind;
|
|
739
740
|
readonly type: TJsonSchemaType;
|
|
740
741
|
}
|
|
@@ -832,6 +833,17 @@ export enum NodeKind {
|
|
|
832
833
|
Object = 2
|
|
833
834
|
}
|
|
834
835
|
|
|
836
|
+
// @public @sealed
|
|
837
|
+
export interface NodeSchemaMetadata<out TCustomMetadata = unknown> {
|
|
838
|
+
readonly custom?: TCustomMetadata | undefined;
|
|
839
|
+
readonly description?: string | undefined;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
// @public @sealed
|
|
843
|
+
export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
|
|
844
|
+
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
845
|
+
}
|
|
846
|
+
|
|
835
847
|
// @alpha
|
|
836
848
|
export const noopValidator: JsonValidator;
|
|
837
849
|
|
|
@@ -947,6 +959,11 @@ export interface RunTransaction {
|
|
|
947
959
|
readonly rollback: typeof rollback;
|
|
948
960
|
}
|
|
949
961
|
|
|
962
|
+
// @alpha
|
|
963
|
+
export interface RunTransactionParams {
|
|
964
|
+
readonly preconditions?: readonly TransactionConstraint[];
|
|
965
|
+
}
|
|
966
|
+
|
|
950
967
|
// @public @sealed
|
|
951
968
|
export interface SchemaCompatibilityStatus {
|
|
952
969
|
readonly canInitialize: boolean;
|
|
@@ -964,8 +981,8 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
964
981
|
arrayRecursive<const Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array, unknown>, {
|
|
965
982
|
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
966
983
|
}, false, T, undefined>;
|
|
967
|
-
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never>;
|
|
968
|
-
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>, true, unknown, never>;
|
|
984
|
+
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>;
|
|
985
|
+
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>, true, unknown, never, unknown>;
|
|
969
986
|
get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
|
|
970
987
|
map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map>, MapNodeInsertableData<T>, true, T, undefined>;
|
|
971
988
|
map<Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>, MapNodeInsertableData<T>, true, T, undefined>;
|
|
@@ -977,16 +994,40 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
977
994
|
} | {
|
|
978
995
|
readonly [x: string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
979
996
|
}, false, T, undefined>;
|
|
980
|
-
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never>;
|
|
981
|
-
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never>;
|
|
997
|
+
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>;
|
|
998
|
+
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>;
|
|
982
999
|
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>;
|
|
983
|
-
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 &
|
|
1000
|
+
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 & InsertableObjectFromSchemaRecordUnsafe<T>, false, T>;
|
|
984
1001
|
optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
985
1002
|
optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Optional, T>;
|
|
986
1003
|
required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
987
1004
|
requiredRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Required, T>;
|
|
988
1005
|
readonly scope: TScope;
|
|
989
|
-
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never>;
|
|
1006
|
+
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
// @alpha
|
|
1010
|
+
export class SchemaFactoryAlpha<out TScope extends string | undefined = string | undefined, TName extends number | string = string> extends SchemaFactory<TScope, TName> {
|
|
1011
|
+
arrayAlpha<const Name extends TName, const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true, T, undefined, TCustomMetadata>;
|
|
1012
|
+
arrayRecursive<const Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array, unknown>, {
|
|
1013
|
+
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
1014
|
+
}, false, T, undefined, TCustomMetadata>;
|
|
1015
|
+
mapAlpha<Name extends TName, const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>, MapNodeInsertableData<T>, true, T, undefined, TCustomMetadata>;
|
|
1016
|
+
mapRecursive<Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>, const TCustomMetadata = unknown>(name: Name, allowedTypes: T, options?: NodeSchemaOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map, unknown>, {
|
|
1017
|
+
[Symbol.iterator](): Iterator<[
|
|
1018
|
+
string,
|
|
1019
|
+
InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>
|
|
1020
|
+
]>;
|
|
1021
|
+
} | {
|
|
1022
|
+
readonly [x: string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
1023
|
+
}, false, T, undefined, TCustomMetadata>;
|
|
1024
|
+
object<const Name extends TName, const T extends RestrictiveStringRecord<ImplicitFieldSchema>, const TCustomMetadata = unknown>(name: Name, fields: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNode<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecord<T>, true, T, never, TCustomMetadata>;
|
|
1025
|
+
objectRecursive<const Name extends TName, const T extends Unenforced<RestrictiveStringRecord<ImplicitFieldSchema>>, const TCustomMetadata = unknown>(name: Name, t: T, options?: SchemaFactoryObjectOptions<TCustomMetadata>): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Object, TreeObjectNodeUnsafe<T, ScopedSchemaName<TScope, Name>>, object & InsertableObjectFromSchemaRecordUnsafe<T>, false, T, never, TCustomMetadata>;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
// @alpha
|
|
1029
|
+
export interface SchemaFactoryObjectOptions<TCustomMetadata = unknown> extends NodeSchemaOptions<TCustomMetadata> {
|
|
1030
|
+
allowUnknownOptionalFields?: boolean;
|
|
990
1031
|
}
|
|
991
1032
|
|
|
992
1033
|
// @alpha
|
|
@@ -1043,9 +1084,38 @@ export interface Tagged<V, T extends string = string> {
|
|
|
1043
1084
|
// @public
|
|
1044
1085
|
export type TelemetryBaseEventPropertyType = string | number | boolean | undefined;
|
|
1045
1086
|
|
|
1087
|
+
// @alpha
|
|
1088
|
+
export type TransactionCallbackStatus<TSuccessValue, TFailureValue> = ({
|
|
1089
|
+
rollback?: false;
|
|
1090
|
+
value: TSuccessValue;
|
|
1091
|
+
} | {
|
|
1092
|
+
rollback: true;
|
|
1093
|
+
value: TFailureValue;
|
|
1094
|
+
}) & {
|
|
1095
|
+
preconditionsOnRevert?: readonly TransactionConstraint[];
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1046
1098
|
// @public
|
|
1047
1099
|
export type TransactionConstraint = NodeInDocumentConstraint;
|
|
1048
1100
|
|
|
1101
|
+
// @alpha
|
|
1102
|
+
export type TransactionResult = Omit<TransactionResultSuccess<unknown>, "value"> | Omit<TransactionResultFailed<unknown>, "value">;
|
|
1103
|
+
|
|
1104
|
+
// @alpha
|
|
1105
|
+
export type TransactionResultExt<TSuccessValue, TFailureValue> = TransactionResultSuccess<TSuccessValue> | TransactionResultFailed<TFailureValue>;
|
|
1106
|
+
|
|
1107
|
+
// @alpha
|
|
1108
|
+
export interface TransactionResultFailed<TFailureValue> {
|
|
1109
|
+
success: false;
|
|
1110
|
+
value: TFailureValue;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
// @alpha
|
|
1114
|
+
export interface TransactionResultSuccess<TSuccessValue> {
|
|
1115
|
+
success: true;
|
|
1116
|
+
value: TSuccessValue;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1049
1119
|
// @public
|
|
1050
1120
|
export type TransformedEvent<TThis, E, A extends any[]> = (event: E, listener: (...args: ReplaceIEventThisPlaceHolder<A, TThis>) => void) => TThis;
|
|
1051
1121
|
|
|
@@ -1218,10 +1288,10 @@ export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedType
|
|
|
1218
1288
|
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<TSchema> : TSchema extends AllowedTypesUnsafe ? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>> : unknown;
|
|
1219
1289
|
|
|
1220
1290
|
// @public @sealed
|
|
1221
|
-
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> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
1291
|
+
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TCustomMetadata = unknown> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata>;
|
|
1222
1292
|
|
|
1223
1293
|
// @public @sealed
|
|
1224
|
-
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
1294
|
+
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable, TCustomMetadata> & (undefined extends TConstructorExtra ? {
|
|
1225
1295
|
new (data?: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;
|
|
1226
1296
|
} : {
|
|
1227
1297
|
new (data: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;
|
|
@@ -1234,7 +1304,7 @@ export interface TreeNodeSchemaClassUnsafe<out Name extends string, out Kind ext
|
|
|
1234
1304
|
}
|
|
1235
1305
|
|
|
1236
1306
|
// @public @sealed
|
|
1237
|
-
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never> {
|
|
1307
|
+
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never, out TCustomMetadata = unknown> {
|
|
1238
1308
|
readonly childTypes: ReadonlySet<TreeNodeSchema>;
|
|
1239
1309
|
// @sealed
|
|
1240
1310
|
createFromInsertable(data: TInsertable): Unhydrated<TreeNode | TreeLeafValue>;
|
|
@@ -1243,10 +1313,11 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
1243
1313
|
readonly info: Info;
|
|
1244
1314
|
// (undocumented)
|
|
1245
1315
|
readonly kind: Kind;
|
|
1316
|
+
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
1246
1317
|
}
|
|
1247
1318
|
|
|
1248
1319
|
// @public @sealed
|
|
1249
|
-
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
1320
|
+
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable, TCustomMetadata> & (undefined extends TConstructorExtra ? {
|
|
1250
1321
|
create(data?: TInsertable | TConstructorExtra): TNode;
|
|
1251
1322
|
} : {
|
|
1252
1323
|
create(data: TInsertable | TConstructorExtra): TNode;
|
|
@@ -1297,6 +1368,8 @@ export interface TreeViewAlpha<in out TSchema extends ImplicitFieldSchema | Unsa
|
|
|
1297
1368
|
// (undocumented)
|
|
1298
1369
|
get root(): ReadableField<TSchema>;
|
|
1299
1370
|
set root(newRoot: InsertableField<TSchema>);
|
|
1371
|
+
runTransaction<TSuccessValue, TFailureValue>(transaction: () => TransactionCallbackStatus<TSuccessValue, TFailureValue>, params?: RunTransactionParams): TransactionResultExt<TSuccessValue, TFailureValue>;
|
|
1372
|
+
runTransaction(transaction: () => VoidTransactionCallbackStatus | void, params?: RunTransactionParams): TransactionResult;
|
|
1300
1373
|
}
|
|
1301
1374
|
|
|
1302
1375
|
// @public @sealed
|
|
@@ -1377,6 +1450,9 @@ export interface ViewContent {
|
|
|
1377
1450
|
readonly tree: JsonCompatible<IFluidHandle>;
|
|
1378
1451
|
}
|
|
1379
1452
|
|
|
1453
|
+
// @alpha
|
|
1454
|
+
export type VoidTransactionCallbackStatus = Omit<TransactionCallbackStatus<unknown, unknown>, "value">;
|
|
1455
|
+
|
|
1380
1456
|
// @public @sealed
|
|
1381
1457
|
export interface WithType<out TName extends string = string, out TKind extends NodeKind = NodeKind, out TInfo = unknown> {
|
|
1382
1458
|
// @deprecated
|
|
@@ -619,6 +619,17 @@ export enum NodeKind {
|
|
|
619
619
|
Object = 2
|
|
620
620
|
}
|
|
621
621
|
|
|
622
|
+
// @public @sealed
|
|
623
|
+
export interface NodeSchemaMetadata<out TCustomMetadata = unknown> {
|
|
624
|
+
readonly custom?: TCustomMetadata | undefined;
|
|
625
|
+
readonly description?: string | undefined;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// @public @sealed
|
|
629
|
+
export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
|
|
630
|
+
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
631
|
+
}
|
|
632
|
+
|
|
622
633
|
// @public
|
|
623
634
|
type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = {
|
|
624
635
|
-readonly [Property in keyof T]: Property extends string ? TreeFieldFromImplicitField<T[Property]> : unknown;
|
|
@@ -723,8 +734,8 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
723
734
|
arrayRecursive<const Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array, unknown>, {
|
|
724
735
|
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
725
736
|
}, false, T, undefined>;
|
|
726
|
-
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never>;
|
|
727
|
-
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>, true, unknown, never>;
|
|
737
|
+
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>;
|
|
738
|
+
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>, true, unknown, never, unknown>;
|
|
728
739
|
get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
|
|
729
740
|
map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map>, MapNodeInsertableData<T>, true, T, undefined>;
|
|
730
741
|
map<Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>, MapNodeInsertableData<T>, true, T, undefined>;
|
|
@@ -736,16 +747,16 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
736
747
|
} | {
|
|
737
748
|
readonly [x: string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
738
749
|
}, false, T, undefined>;
|
|
739
|
-
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never>;
|
|
740
|
-
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never>;
|
|
750
|
+
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>;
|
|
751
|
+
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>;
|
|
741
752
|
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>;
|
|
742
|
-
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 &
|
|
753
|
+
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 & InsertableObjectFromSchemaRecordUnsafe<T>, false, T>;
|
|
743
754
|
optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
744
755
|
optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Optional, T>;
|
|
745
756
|
required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
746
757
|
requiredRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Required, T>;
|
|
747
758
|
readonly scope: TScope;
|
|
748
|
-
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never>;
|
|
759
|
+
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>;
|
|
749
760
|
}
|
|
750
761
|
|
|
751
762
|
// @public
|
|
@@ -886,10 +897,10 @@ export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedType
|
|
|
886
897
|
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<TSchema> : TSchema extends AllowedTypesUnsafe ? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>> : unknown;
|
|
887
898
|
|
|
888
899
|
// @public @sealed
|
|
889
|
-
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> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
900
|
+
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TCustomMetadata = unknown> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata>;
|
|
890
901
|
|
|
891
902
|
// @public @sealed
|
|
892
|
-
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
903
|
+
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable, TCustomMetadata> & (undefined extends TConstructorExtra ? {
|
|
893
904
|
new (data?: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;
|
|
894
905
|
} : {
|
|
895
906
|
new (data: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;
|
|
@@ -902,7 +913,7 @@ export interface TreeNodeSchemaClassUnsafe<out Name extends string, out Kind ext
|
|
|
902
913
|
}
|
|
903
914
|
|
|
904
915
|
// @public @sealed
|
|
905
|
-
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never> {
|
|
916
|
+
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never, out TCustomMetadata = unknown> {
|
|
906
917
|
readonly childTypes: ReadonlySet<TreeNodeSchema>;
|
|
907
918
|
// @sealed
|
|
908
919
|
createFromInsertable(data: TInsertable): Unhydrated<TreeNode | TreeLeafValue>;
|
|
@@ -911,10 +922,11 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
911
922
|
readonly info: Info;
|
|
912
923
|
// (undocumented)
|
|
913
924
|
readonly kind: Kind;
|
|
925
|
+
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
914
926
|
}
|
|
915
927
|
|
|
916
928
|
// @public @sealed
|
|
917
|
-
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
929
|
+
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable, TCustomMetadata> & (undefined extends TConstructorExtra ? {
|
|
918
930
|
create(data?: TInsertable | TConstructorExtra): TNode;
|
|
919
931
|
} : {
|
|
920
932
|
create(data: TInsertable | TConstructorExtra): TNode;
|
|
@@ -917,6 +917,17 @@ export enum NodeKind {
|
|
|
917
917
|
Object = 2
|
|
918
918
|
}
|
|
919
919
|
|
|
920
|
+
// @public @sealed
|
|
921
|
+
export interface NodeSchemaMetadata<out TCustomMetadata = unknown> {
|
|
922
|
+
readonly custom?: TCustomMetadata | undefined;
|
|
923
|
+
readonly description?: string | undefined;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// @public @sealed
|
|
927
|
+
export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
|
|
928
|
+
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
929
|
+
}
|
|
930
|
+
|
|
920
931
|
// @public
|
|
921
932
|
type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = {
|
|
922
933
|
-readonly [Property in keyof T]: Property extends string ? TreeFieldFromImplicitField<T[Property]> : unknown;
|
|
@@ -1021,8 +1032,8 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
1021
1032
|
arrayRecursive<const Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array, unknown>, {
|
|
1022
1033
|
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
1023
1034
|
}, false, T, undefined>;
|
|
1024
|
-
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never>;
|
|
1025
|
-
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>, true, unknown, never>;
|
|
1035
|
+
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>;
|
|
1036
|
+
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>, true, unknown, never, unknown>;
|
|
1026
1037
|
get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
|
|
1027
1038
|
map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map>, MapNodeInsertableData<T>, true, T, undefined>;
|
|
1028
1039
|
map<Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>, MapNodeInsertableData<T>, true, T, undefined>;
|
|
@@ -1034,16 +1045,16 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
1034
1045
|
} | {
|
|
1035
1046
|
readonly [x: string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
1036
1047
|
}, false, T, undefined>;
|
|
1037
|
-
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never>;
|
|
1038
|
-
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never>;
|
|
1048
|
+
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>;
|
|
1049
|
+
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>;
|
|
1039
1050
|
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>;
|
|
1040
|
-
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 &
|
|
1051
|
+
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 & InsertableObjectFromSchemaRecordUnsafe<T>, false, T>;
|
|
1041
1052
|
optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
1042
1053
|
optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Optional, T>;
|
|
1043
1054
|
required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
1044
1055
|
requiredRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Required, T>;
|
|
1045
1056
|
readonly scope: TScope;
|
|
1046
|
-
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never>;
|
|
1057
|
+
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>;
|
|
1047
1058
|
}
|
|
1048
1059
|
|
|
1049
1060
|
// @public
|
|
@@ -1251,10 +1262,10 @@ export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedType
|
|
|
1251
1262
|
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<TSchema> : TSchema extends AllowedTypesUnsafe ? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>> : unknown;
|
|
1252
1263
|
|
|
1253
1264
|
// @public @sealed
|
|
1254
|
-
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> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
1265
|
+
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TCustomMetadata = unknown> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata>;
|
|
1255
1266
|
|
|
1256
1267
|
// @public @sealed
|
|
1257
|
-
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
1268
|
+
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable, TCustomMetadata> & (undefined extends TConstructorExtra ? {
|
|
1258
1269
|
new (data?: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;
|
|
1259
1270
|
} : {
|
|
1260
1271
|
new (data: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;
|
|
@@ -1267,7 +1278,7 @@ export interface TreeNodeSchemaClassUnsafe<out Name extends string, out Kind ext
|
|
|
1267
1278
|
}
|
|
1268
1279
|
|
|
1269
1280
|
// @public @sealed
|
|
1270
|
-
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never> {
|
|
1281
|
+
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never, out TCustomMetadata = unknown> {
|
|
1271
1282
|
readonly childTypes: ReadonlySet<TreeNodeSchema>;
|
|
1272
1283
|
// @sealed
|
|
1273
1284
|
createFromInsertable(data: TInsertable): Unhydrated<TreeNode | TreeLeafValue>;
|
|
@@ -1276,10 +1287,11 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
1276
1287
|
readonly info: Info;
|
|
1277
1288
|
// (undocumented)
|
|
1278
1289
|
readonly kind: Kind;
|
|
1290
|
+
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
1279
1291
|
}
|
|
1280
1292
|
|
|
1281
1293
|
// @public @sealed
|
|
1282
|
-
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
1294
|
+
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable, TCustomMetadata> & (undefined extends TConstructorExtra ? {
|
|
1283
1295
|
create(data?: TInsertable | TConstructorExtra): TNode;
|
|
1284
1296
|
} : {
|
|
1285
1297
|
create(data: TInsertable | TConstructorExtra): TNode;
|
|
@@ -650,6 +650,17 @@ export enum NodeKind {
|
|
|
650
650
|
Object = 2
|
|
651
651
|
}
|
|
652
652
|
|
|
653
|
+
// @public @sealed
|
|
654
|
+
export interface NodeSchemaMetadata<out TCustomMetadata = unknown> {
|
|
655
|
+
readonly custom?: TCustomMetadata | undefined;
|
|
656
|
+
readonly description?: string | undefined;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
// @public @sealed
|
|
660
|
+
export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
|
|
661
|
+
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
662
|
+
}
|
|
663
|
+
|
|
653
664
|
// @public
|
|
654
665
|
type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = {
|
|
655
666
|
-readonly [Property in keyof T]: Property extends string ? TreeFieldFromImplicitField<T[Property]> : unknown;
|
|
@@ -754,8 +765,8 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
754
765
|
arrayRecursive<const Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array, unknown>, {
|
|
755
766
|
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
756
767
|
}, false, T, undefined>;
|
|
757
|
-
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never>;
|
|
758
|
-
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>, true, unknown, never>;
|
|
768
|
+
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>;
|
|
769
|
+
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>, true, unknown, never, unknown>;
|
|
759
770
|
get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
|
|
760
771
|
map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map>, MapNodeInsertableData<T>, true, T, undefined>;
|
|
761
772
|
map<Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>, MapNodeInsertableData<T>, true, T, undefined>;
|
|
@@ -767,16 +778,16 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
767
778
|
} | {
|
|
768
779
|
readonly [x: string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
769
780
|
}, false, T, undefined>;
|
|
770
|
-
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never>;
|
|
771
|
-
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never>;
|
|
781
|
+
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>;
|
|
782
|
+
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>;
|
|
772
783
|
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>;
|
|
773
|
-
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 &
|
|
784
|
+
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 & InsertableObjectFromSchemaRecordUnsafe<T>, false, T>;
|
|
774
785
|
optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
775
786
|
optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Optional, T>;
|
|
776
787
|
required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
777
788
|
requiredRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Required, T>;
|
|
778
789
|
readonly scope: TScope;
|
|
779
|
-
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never>;
|
|
790
|
+
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>;
|
|
780
791
|
}
|
|
781
792
|
|
|
782
793
|
// @public
|
|
@@ -910,10 +921,10 @@ export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedType
|
|
|
910
921
|
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<TSchema> : TSchema extends AllowedTypesUnsafe ? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>> : unknown;
|
|
911
922
|
|
|
912
923
|
// @public @sealed
|
|
913
|
-
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> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
924
|
+
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TCustomMetadata = unknown> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata>;
|
|
914
925
|
|
|
915
926
|
// @public @sealed
|
|
916
|
-
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
927
|
+
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable, TCustomMetadata> & (undefined extends TConstructorExtra ? {
|
|
917
928
|
new (data?: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;
|
|
918
929
|
} : {
|
|
919
930
|
new (data: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;
|
|
@@ -926,7 +937,7 @@ export interface TreeNodeSchemaClassUnsafe<out Name extends string, out Kind ext
|
|
|
926
937
|
}
|
|
927
938
|
|
|
928
939
|
// @public @sealed
|
|
929
|
-
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never> {
|
|
940
|
+
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never, out TCustomMetadata = unknown> {
|
|
930
941
|
readonly childTypes: ReadonlySet<TreeNodeSchema>;
|
|
931
942
|
// @sealed
|
|
932
943
|
createFromInsertable(data: TInsertable): Unhydrated<TreeNode | TreeLeafValue>;
|
|
@@ -935,10 +946,11 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
935
946
|
readonly info: Info;
|
|
936
947
|
// (undocumented)
|
|
937
948
|
readonly kind: Kind;
|
|
949
|
+
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
938
950
|
}
|
|
939
951
|
|
|
940
952
|
// @public @sealed
|
|
941
|
-
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
953
|
+
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable, TCustomMetadata> & (undefined extends TConstructorExtra ? {
|
|
942
954
|
create(data?: TInsertable | TConstructorExtra): TNode;
|
|
943
955
|
} : {
|
|
944
956
|
create(data: TInsertable | TConstructorExtra): TNode;
|
|
@@ -614,6 +614,17 @@ export enum NodeKind {
|
|
|
614
614
|
Object = 2
|
|
615
615
|
}
|
|
616
616
|
|
|
617
|
+
// @public @sealed
|
|
618
|
+
export interface NodeSchemaMetadata<out TCustomMetadata = unknown> {
|
|
619
|
+
readonly custom?: TCustomMetadata | undefined;
|
|
620
|
+
readonly description?: string | undefined;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// @public @sealed
|
|
624
|
+
export interface NodeSchemaOptions<out TCustomMetadata = unknown> {
|
|
625
|
+
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
626
|
+
}
|
|
627
|
+
|
|
617
628
|
// @public
|
|
618
629
|
type ObjectFromSchemaRecord<T extends RestrictiveStringRecord<ImplicitFieldSchema>> = {
|
|
619
630
|
-readonly [Property in keyof T]: Property extends string ? TreeFieldFromImplicitField<T[Property]> : unknown;
|
|
@@ -718,8 +729,8 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
718
729
|
arrayRecursive<const Name extends TName, const T extends Unenforced<ImplicitAllowedTypes>>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Array, TreeArrayNodeUnsafe<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Array, unknown>, {
|
|
719
730
|
[Symbol.iterator](): Iterator<InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>>;
|
|
720
731
|
}, false, T, undefined>;
|
|
721
|
-
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never>;
|
|
722
|
-
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>, true, unknown, never>;
|
|
732
|
+
readonly boolean: TreeNodeSchemaNonClass<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean, true, unknown, never, unknown>;
|
|
733
|
+
readonly handle: TreeNodeSchemaNonClass<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<unknown>, IFluidHandle<unknown>, true, unknown, never, unknown>;
|
|
723
734
|
get identifier(): FieldSchema<FieldKind.Identifier, typeof SchemaFactory.string>;
|
|
724
735
|
map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchemaNonClass<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, `Map<${string}>`>, NodeKind.Map>, MapNodeInsertableData<T>, true, T, undefined>;
|
|
725
736
|
map<Name extends TName, const T extends ImplicitAllowedTypes>(name: Name, allowedTypes: T): TreeNodeSchemaClass<ScopedSchemaName<TScope, Name>, NodeKind.Map, TreeMapNode<T> & WithType<ScopedSchemaName<TScope, Name>, NodeKind.Map>, MapNodeInsertableData<T>, true, T, undefined>;
|
|
@@ -731,16 +742,16 @@ export class SchemaFactory<out TScope extends string | undefined = string | unde
|
|
|
731
742
|
} | {
|
|
732
743
|
readonly [x: string]: InsertableTreeNodeFromImplicitAllowedTypesUnsafe<T>;
|
|
733
744
|
}, false, T, undefined>;
|
|
734
|
-
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never>;
|
|
735
|
-
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never>;
|
|
745
|
+
readonly null: TreeNodeSchemaNonClass<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null, true, unknown, never, unknown>;
|
|
746
|
+
readonly number: TreeNodeSchemaNonClass<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number, true, unknown, never, unknown>;
|
|
736
747
|
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>;
|
|
737
|
-
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 &
|
|
748
|
+
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 & InsertableObjectFromSchemaRecordUnsafe<T>, false, T>;
|
|
738
749
|
optional<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Optional, T, TCustomMetadata>;
|
|
739
750
|
optionalRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Optional, T>;
|
|
740
751
|
required<const T extends ImplicitAllowedTypes, const TCustomMetadata = unknown>(t: T, props?: Omit<FieldProps<TCustomMetadata>, "defaultProvider">): FieldSchema<FieldKind.Required, T, TCustomMetadata>;
|
|
741
752
|
requiredRecursive<const T extends Unenforced<ImplicitAllowedTypes>>(t: T, props?: Omit<FieldProps, "defaultProvider">): FieldSchemaUnsafe<FieldKind.Required, T>;
|
|
742
753
|
readonly scope: TScope;
|
|
743
|
-
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never>;
|
|
754
|
+
readonly string: TreeNodeSchemaNonClass<"com.fluidframework.leaf.string", NodeKind.Leaf, string, string, true, unknown, never, unknown>;
|
|
744
755
|
}
|
|
745
756
|
|
|
746
757
|
// @public
|
|
@@ -870,10 +881,10 @@ export type TreeNodeFromImplicitAllowedTypes<TSchema extends ImplicitAllowedType
|
|
|
870
881
|
type TreeNodeFromImplicitAllowedTypesUnsafe<TSchema extends Unenforced<ImplicitAllowedTypes>> = TSchema extends TreeNodeSchemaUnsafe ? NodeFromSchemaUnsafe<TSchema> : TSchema extends AllowedTypesUnsafe ? NodeFromSchemaUnsafe<FlexListToUnion<TSchema>> : unknown;
|
|
871
882
|
|
|
872
883
|
// @public @sealed
|
|
873
|
-
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> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info>;
|
|
884
|
+
export type TreeNodeSchema<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TBuild = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TCustomMetadata = unknown> = (TNode extends TreeNode ? TreeNodeSchemaClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata> : never) | TreeNodeSchemaNonClass<Name, Kind, TNode, TBuild, ImplicitlyConstructable, Info, never, TCustomMetadata>;
|
|
874
885
|
|
|
875
886
|
// @public @sealed
|
|
876
|
-
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
887
|
+
export type TreeNodeSchemaClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode = TreeNode, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable, TCustomMetadata> & (undefined extends TConstructorExtra ? {
|
|
877
888
|
new (data?: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;
|
|
878
889
|
} : {
|
|
879
890
|
new (data: TInsertable | InternalTreeNode | TConstructorExtra): Unhydrated<TNode>;
|
|
@@ -886,7 +897,7 @@ export interface TreeNodeSchemaClassUnsafe<out Name extends string, out Kind ext
|
|
|
886
897
|
}
|
|
887
898
|
|
|
888
899
|
// @public @sealed
|
|
889
|
-
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never> {
|
|
900
|
+
export interface TreeNodeSchemaCore<out Name extends string, out Kind extends NodeKind, out ImplicitlyConstructable extends boolean, out Info = unknown, out TInsertable = never, out TCustomMetadata = unknown> {
|
|
890
901
|
readonly childTypes: ReadonlySet<TreeNodeSchema>;
|
|
891
902
|
// @sealed
|
|
892
903
|
createFromInsertable(data: TInsertable): Unhydrated<TreeNode | TreeLeafValue>;
|
|
@@ -895,10 +906,11 @@ export interface TreeNodeSchemaCore<out Name extends string, out Kind extends No
|
|
|
895
906
|
readonly info: Info;
|
|
896
907
|
// (undocumented)
|
|
897
908
|
readonly kind: Kind;
|
|
909
|
+
readonly metadata?: NodeSchemaMetadata<TCustomMetadata> | undefined;
|
|
898
910
|
}
|
|
899
911
|
|
|
900
912
|
// @public @sealed
|
|
901
|
-
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable> & (undefined extends TConstructorExtra ? {
|
|
913
|
+
export type TreeNodeSchemaNonClass<Name extends string = string, Kind extends NodeKind = NodeKind, TNode extends TreeNode | TreeLeafValue = TreeNode | TreeLeafValue, TInsertable = never, ImplicitlyConstructable extends boolean = boolean, Info = unknown, TConstructorExtra = never, TCustomMetadata = unknown> = TreeNodeSchemaCore<Name, Kind, ImplicitlyConstructable, Info, TInsertable, TCustomMetadata> & (undefined extends TConstructorExtra ? {
|
|
902
914
|
create(data?: TInsertable | TConstructorExtra): TNode;
|
|
903
915
|
} : {
|
|
904
916
|
create(data: TInsertable | TConstructorExtra): TNode;
|
package/dist/alpha.d.ts
CHANGED
|
@@ -83,6 +83,8 @@ export {
|
|
|
83
83
|
NodeFromSchema,
|
|
84
84
|
NodeInDocumentConstraint,
|
|
85
85
|
NodeKind,
|
|
86
|
+
NodeSchemaMetadata,
|
|
87
|
+
NodeSchemaOptions,
|
|
86
88
|
Off,
|
|
87
89
|
ReadonlyArrayNode,
|
|
88
90
|
ReplaceIEventThisPlaceHolder,
|
|
@@ -175,11 +177,19 @@ export {
|
|
|
175
177
|
ReadableField,
|
|
176
178
|
RevertibleAlpha,
|
|
177
179
|
RevertibleAlphaFactory,
|
|
180
|
+
RunTransactionParams,
|
|
181
|
+
SchemaFactoryAlpha,
|
|
182
|
+
SchemaFactoryObjectOptions,
|
|
178
183
|
SchemaValidationFunction,
|
|
179
184
|
SharedTreeFormatOptions,
|
|
180
185
|
SharedTreeFormatVersion,
|
|
181
186
|
SharedTreeOptions,
|
|
182
187
|
SimpleTreeIndex,
|
|
188
|
+
TransactionCallbackStatus,
|
|
189
|
+
TransactionResult,
|
|
190
|
+
TransactionResultExt,
|
|
191
|
+
TransactionResultFailed,
|
|
192
|
+
TransactionResultSuccess,
|
|
183
193
|
TreeAlpha,
|
|
184
194
|
TreeBranch,
|
|
185
195
|
TreeBranchEvents,
|
|
@@ -194,6 +204,7 @@ export {
|
|
|
194
204
|
VerboseTree,
|
|
195
205
|
VerboseTreeNode,
|
|
196
206
|
ViewContent,
|
|
207
|
+
VoidTransactionCallbackStatus,
|
|
197
208
|
adaptEnum,
|
|
198
209
|
asTreeViewAlpha,
|
|
199
210
|
comparePersistedSchema,
|
package/dist/beta.d.ts
CHANGED
package/dist/legacy.d.ts
CHANGED
package/dist/public.d.ts
CHANGED
package/lib/alpha.d.ts
CHANGED
|
@@ -83,6 +83,8 @@ export {
|
|
|
83
83
|
NodeFromSchema,
|
|
84
84
|
NodeInDocumentConstraint,
|
|
85
85
|
NodeKind,
|
|
86
|
+
NodeSchemaMetadata,
|
|
87
|
+
NodeSchemaOptions,
|
|
86
88
|
Off,
|
|
87
89
|
ReadonlyArrayNode,
|
|
88
90
|
ReplaceIEventThisPlaceHolder,
|
|
@@ -175,11 +177,19 @@ export {
|
|
|
175
177
|
ReadableField,
|
|
176
178
|
RevertibleAlpha,
|
|
177
179
|
RevertibleAlphaFactory,
|
|
180
|
+
RunTransactionParams,
|
|
181
|
+
SchemaFactoryAlpha,
|
|
182
|
+
SchemaFactoryObjectOptions,
|
|
178
183
|
SchemaValidationFunction,
|
|
179
184
|
SharedTreeFormatOptions,
|
|
180
185
|
SharedTreeFormatVersion,
|
|
181
186
|
SharedTreeOptions,
|
|
182
187
|
SimpleTreeIndex,
|
|
188
|
+
TransactionCallbackStatus,
|
|
189
|
+
TransactionResult,
|
|
190
|
+
TransactionResultExt,
|
|
191
|
+
TransactionResultFailed,
|
|
192
|
+
TransactionResultSuccess,
|
|
183
193
|
TreeAlpha,
|
|
184
194
|
TreeBranch,
|
|
185
195
|
TreeBranchEvents,
|
|
@@ -194,6 +204,7 @@ export {
|
|
|
194
204
|
VerboseTree,
|
|
195
205
|
VerboseTreeNode,
|
|
196
206
|
ViewContent,
|
|
207
|
+
VoidTransactionCallbackStatus,
|
|
197
208
|
adaptEnum,
|
|
198
209
|
asTreeViewAlpha,
|
|
199
210
|
comparePersistedSchema,
|
package/lib/beta.d.ts
CHANGED
package/lib/legacy.d.ts
CHANGED
package/lib/public.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fluid-framework",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "The main entry point into Fluid Framework public packages",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -57,16 +57,16 @@
|
|
|
57
57
|
"main": "lib/index.js",
|
|
58
58
|
"types": "lib/public.d.ts",
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@fluidframework/container-definitions": "~2.
|
|
61
|
-
"@fluidframework/container-loader": "~2.
|
|
62
|
-
"@fluidframework/core-interfaces": "~2.
|
|
63
|
-
"@fluidframework/driver-definitions": "~2.
|
|
64
|
-
"@fluidframework/fluid-static": "~2.
|
|
65
|
-
"@fluidframework/map": "~2.
|
|
66
|
-
"@fluidframework/runtime-utils": "~2.
|
|
67
|
-
"@fluidframework/sequence": "~2.
|
|
68
|
-
"@fluidframework/shared-object-base": "~2.
|
|
69
|
-
"@fluidframework/tree": "~2.
|
|
60
|
+
"@fluidframework/container-definitions": "~2.13.0",
|
|
61
|
+
"@fluidframework/container-loader": "~2.13.0",
|
|
62
|
+
"@fluidframework/core-interfaces": "~2.13.0",
|
|
63
|
+
"@fluidframework/driver-definitions": "~2.13.0",
|
|
64
|
+
"@fluidframework/fluid-static": "~2.13.0",
|
|
65
|
+
"@fluidframework/map": "~2.13.0",
|
|
66
|
+
"@fluidframework/runtime-utils": "~2.13.0",
|
|
67
|
+
"@fluidframework/sequence": "~2.13.0",
|
|
68
|
+
"@fluidframework/shared-object-base": "~2.13.0",
|
|
69
|
+
"@fluidframework/tree": "~2.13.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@arethetypeswrong/cli": "^0.17.1",
|