fluid-framework 2.0.0-dev-rc.1.0.0.224419 → 2.0.0-dev-rc.1.0.0.225277
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/api-extractor-esm.json +4 -0
- package/api-report/fluid-framework.api.md +13 -12
- package/dist/fluid-framework-alpha.d.ts +55 -22
- package/dist/fluid-framework-beta.d.ts +55 -22
- package/dist/fluid-framework-public.d.ts +1 -0
- package/dist/fluid-framework-untrimmed.d.ts +39 -25
- package/lib/fluid-framework-alpha.d.mts +63 -2741
- package/lib/fluid-framework-beta.d.mts +33 -2008
- package/lib/fluid-framework-public.d.mts +33 -946
- package/lib/fluid-framework-untrimmed.d.mts +57 -7370
- package/lib/index.d.mts +1 -1
- package/lib/index.d.mts.map +1 -1
- package/package.json +50 -12
|
@@ -88,6 +88,7 @@ import { SharedStringSegment } from '@fluidframework/sequence';
|
|
|
88
88
|
import { StableId } from '@fluidframework/runtime-definitions';
|
|
89
89
|
import type { Static } from '@sinclair/typebox';
|
|
90
90
|
import { SubSequence } from '@fluidframework/sequence';
|
|
91
|
+
import { TreeNode as TreeNode_2 } from '..';
|
|
91
92
|
import { TreeNodeSchema as TreeNodeSchema_2 } from './schemaTypes';
|
|
92
93
|
import { TreeNodeSchemaClass as TreeNodeSchemaClass_2 } from './schemaTypes';
|
|
93
94
|
import type { TSchema } from '@sinclair/typebox';
|
|
@@ -1840,18 +1841,18 @@ export interface SchemaEvents {
|
|
|
1840
1841
|
// @beta @sealed
|
|
1841
1842
|
export class SchemaFactory<TScope extends string = string, TName extends number | string = string> {
|
|
1842
1843
|
constructor(scope: TScope);
|
|
1843
|
-
array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<`${TScope}.
|
|
1844
|
+
array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<`${TScope}.Array<${string}>`, NodeKind.Array, TreeArrayNode<T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true>;
|
|
1844
1845
|
array<const Name extends TName, const T extends ImplicitAllowedTypes_2>(name: Name, allowedTypes: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Array, TreeArrayNode<T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true>;
|
|
1845
1846
|
readonly boolean: TreeNodeSchema<"com.fluidframework.leaf.boolean", NodeKind.Leaf, boolean, boolean>;
|
|
1846
1847
|
fixRecursiveReference<T extends AllowedTypes_2>(...types: T): void;
|
|
1847
1848
|
readonly handle: TreeNodeSchema<"com.fluidframework.leaf.handle", NodeKind.Leaf, IFluidHandle<FluidObject & IFluidLoadable>, IFluidHandle<FluidObject & IFluidLoadable>>;
|
|
1848
1849
|
map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<`${TScope}.Map<${string}>`, NodeKind.Map, TreeMapNode<T>, ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>, true>;
|
|
1849
1850
|
map<Name extends TName, const T extends ImplicitAllowedTypes_2>(name: Name, allowedTypes: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Map, TreeMapNode<T>, ReadonlyMap<string, InsertableTreeNodeFromImplicitAllowedTypes<T>>, true>;
|
|
1850
|
-
|
|
1851
|
-
|
|
1851
|
+
namedArray_internal<Name extends TName | string, const T extends ImplicitAllowedTypes_2, const ImplicitlyConstructable extends boolean>(name: Name, allowedTypes: T, customizable: boolean, implicitlyConstructable: ImplicitlyConstructable): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Array, TreeArrayNode<T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable>;
|
|
1852
|
+
namedMap_internal<Name extends TName | string, const T extends ImplicitAllowedTypes_2, const ImplicitlyConstructable extends boolean>(name: Name, allowedTypes: T, customizable: boolean, implicitlyConstructable: ImplicitlyConstructable): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Map, TreeMapNode<T>, ReadonlyMap<string, InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable>;
|
|
1852
1853
|
readonly null: TreeNodeSchema<"com.fluidframework.leaf.null", NodeKind.Leaf, null, null>;
|
|
1853
1854
|
readonly number: TreeNodeSchema<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
|
|
1854
|
-
object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>(name: Name, t: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Object, ObjectFromSchemaRecord<T>, InsertableObjectFromSchemaRecord<T>, true>;
|
|
1855
|
+
object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>(name: Name, t: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Object, object & TreeNode & ObjectFromSchemaRecord<T>, object & InsertableObjectFromSchemaRecord<T>, true>;
|
|
1855
1856
|
optional<const T extends ImplicitAllowedTypes_2>(t: T): FieldSchema<FieldKind_2.Optional, T>;
|
|
1856
1857
|
// (undocumented)
|
|
1857
1858
|
readonly scope: TScope;
|
|
@@ -2021,7 +2022,7 @@ export { SharedStringFactory }
|
|
|
2021
2022
|
|
|
2022
2023
|
export { SharedStringSegment }
|
|
2023
2024
|
|
|
2024
|
-
// @
|
|
2025
|
+
// @beta
|
|
2025
2026
|
export class SharedTree implements ITree {
|
|
2026
2027
|
// (undocumented)
|
|
2027
2028
|
get attributes(): IChannelAttributes;
|
|
@@ -2030,7 +2031,7 @@ export class SharedTree implements ITree {
|
|
|
2030
2031
|
// (undocumented)
|
|
2031
2032
|
getAttachSummary(fullTree?: boolean | undefined, trackState?: boolean | undefined, telemetryContext?: ITelemetryContext | undefined): ISummaryTreeWithStats;
|
|
2032
2033
|
// (undocumented)
|
|
2033
|
-
static getFactory():
|
|
2034
|
+
static getFactory(): IChannelFactory;
|
|
2034
2035
|
// (undocumented)
|
|
2035
2036
|
getGCData(fullGC?: boolean | undefined): IGarbageCollectionData;
|
|
2036
2037
|
// (undocumented)
|
|
@@ -2109,10 +2110,10 @@ export class test_RecursiveObject extends test_RecursiveObject_base {
|
|
|
2109
2110
|
}
|
|
2110
2111
|
|
|
2111
2112
|
// @internal
|
|
2112
|
-
export const test_RecursiveObject_base: TreeNodeSchemaClass_2<"Test Recursive Domain.testObject", NodeKind.Object, ObjectFromSchemaRecord_2< {
|
|
2113
|
+
export const test_RecursiveObject_base: TreeNodeSchemaClass_2<"Test Recursive Domain.testObject", NodeKind.Object, object & TreeNode_2 & ObjectFromSchemaRecord_2< {
|
|
2113
2114
|
readonly recursive: FieldSchema_2<FieldKind_3.Optional, readonly [() => typeof test_RecursiveObject]>;
|
|
2114
2115
|
readonly number: TreeNodeSchema_2<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
|
|
2115
|
-
}>, InsertableObjectFromSchemaRecord_2< {
|
|
2116
|
+
}>, object & InsertableObjectFromSchemaRecord_2< {
|
|
2116
2117
|
readonly recursive: FieldSchema_2<FieldKind_3.Optional, readonly [() => typeof test_RecursiveObject]>;
|
|
2117
2118
|
readonly number: TreeNodeSchema_2<"com.fluidframework.leaf.number", NodeKind.Leaf, number, number>;
|
|
2118
2119
|
}>, true>;
|
|
@@ -2145,7 +2146,7 @@ export interface TreeApi {
|
|
|
2145
2146
|
}
|
|
2146
2147
|
|
|
2147
2148
|
// @beta
|
|
2148
|
-
export interface TreeArrayNode<T extends ImplicitAllowedTypes_2 = ImplicitAllowedTypes_2> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<T>, InsertableTreeNodeFromImplicitAllowedTypes<T>, TreeArrayNode> {
|
|
2149
|
+
export interface TreeArrayNode<T extends ImplicitAllowedTypes_2 = ImplicitAllowedTypes_2> extends TreeNode, TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<T>, InsertableTreeNodeFromImplicitAllowedTypes<T>, TreeArrayNode> {
|
|
2149
2150
|
}
|
|
2150
2151
|
|
|
2151
2152
|
// @beta
|
|
@@ -2154,7 +2155,7 @@ export const TreeArrayNode: {
|
|
|
2154
2155
|
};
|
|
2155
2156
|
|
|
2156
2157
|
// @beta
|
|
2157
|
-
interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<T
|
|
2158
|
+
interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<T>, TreeNode {
|
|
2158
2159
|
insertAt(index: number, ...value: (TNew | IterableTreeListContent<TNew>)[]): void;
|
|
2159
2160
|
insertAtEnd(...value: (TNew | IterableTreeListContent<TNew>)[]): void;
|
|
2160
2161
|
insertAtStart(...value: (TNew | IterableTreeListContent<TNew>)[]): void;
|
|
@@ -2269,7 +2270,7 @@ export interface TreeMapNode<T extends ImplicitAllowedTypes_2> extends TreeMapNo
|
|
|
2269
2270
|
}
|
|
2270
2271
|
|
|
2271
2272
|
// @beta
|
|
2272
|
-
export interface TreeMapNodeBase<TOut, TIn = TOut> extends ReadonlyMap<string, TOut
|
|
2273
|
+
export interface TreeMapNodeBase<TOut, TIn = TOut> extends ReadonlyMap<string, TOut>, TreeNode {
|
|
2273
2274
|
delete(key: string): void;
|
|
2274
2275
|
set(key: string, value: TIn | undefined): void;
|
|
2275
2276
|
}
|
|
@@ -2282,7 +2283,7 @@ export const enum TreeNavigationResult {
|
|
|
2282
2283
|
}
|
|
2283
2284
|
|
|
2284
2285
|
// @beta
|
|
2285
|
-
export class TreeNode {
|
|
2286
|
+
export abstract class TreeNode {
|
|
2286
2287
|
}
|
|
2287
2288
|
|
|
2288
2289
|
// @beta
|
|
@@ -90,6 +90,7 @@ import { SharedStringSegment } from '@fluidframework/sequence';
|
|
|
90
90
|
import { StableId } from '@fluidframework/runtime-definitions';
|
|
91
91
|
import type { Static } from '@sinclair/typebox';
|
|
92
92
|
import { SubSequence } from '@fluidframework/sequence';
|
|
93
|
+
import { TreeNode as TreeNode_2 } from '..';
|
|
93
94
|
import { TreeNodeSchema as TreeNodeSchema_2 } from './schemaTypes';
|
|
94
95
|
import { TreeNodeSchemaClass as TreeNodeSchemaClass_2 } from './schemaTypes';
|
|
95
96
|
import type { TSchema } from '@sinclair/typebox';
|
|
@@ -1873,7 +1874,7 @@ export declare class SchemaFactory<TScope extends string = string, TName extends
|
|
|
1873
1874
|
*
|
|
1874
1875
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
1875
1876
|
*/
|
|
1876
|
-
object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>(name: Name, t: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Object, ObjectFromSchemaRecord<T>, InsertableObjectFromSchemaRecord<T>, true>;
|
|
1877
|
+
object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>(name: Name, t: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Object, object & TreeNode & ObjectFromSchemaRecord<T>, object & InsertableObjectFromSchemaRecord<T>, true>;
|
|
1877
1878
|
/**
|
|
1878
1879
|
* Define a structurally typed {@link TreeNodeSchema} for a {@link TreeMapNodeBase}.
|
|
1879
1880
|
*
|
|
@@ -1895,7 +1896,7 @@ export declare class SchemaFactory<TScope extends string = string, TName extends
|
|
|
1895
1896
|
* factory.object("Foo", {myMap: factory.map(factory.number)});
|
|
1896
1897
|
* ```
|
|
1897
1898
|
* @privateRemarks
|
|
1898
|
-
* See note on
|
|
1899
|
+
* See note on array.
|
|
1899
1900
|
*/
|
|
1900
1901
|
map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<`${TScope}.Map<${string}>`, NodeKind.Map, TreeMapNode<T>, ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>, true>;
|
|
1901
1902
|
/**
|
|
@@ -1914,33 +1915,33 @@ export declare class SchemaFactory<TScope extends string = string, TName extends
|
|
|
1914
1915
|
*
|
|
1915
1916
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
1916
1917
|
*
|
|
1917
|
-
* @remarks See remarks on {@link SchemaFactory.
|
|
1918
|
+
* @remarks See remarks on {@link SchemaFactory.namedArray_internal}.
|
|
1918
1919
|
*/
|
|
1919
|
-
|
|
1920
|
+
namedMap_internal<Name extends TName | string, const T extends ImplicitAllowedTypes_2, const ImplicitlyConstructable extends boolean>(name: Name, allowedTypes: T, customizable: boolean, implicitlyConstructable: ImplicitlyConstructable): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Map, TreeMapNode<T>, ReadonlyMap<string, InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable>;
|
|
1920
1921
|
/**
|
|
1921
1922
|
* Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.
|
|
1922
1923
|
*
|
|
1923
1924
|
* @remarks
|
|
1924
|
-
* The identifier for this
|
|
1925
|
+
* The identifier for this Array is defined as a function of the provided types.
|
|
1925
1926
|
* It is still scoped to this SchemaFactory, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.
|
|
1926
1927
|
* This does not support recursive types.
|
|
1927
1928
|
*
|
|
1928
|
-
* If using these structurally named
|
|
1929
|
+
* If using these structurally named arrays, other types in this schema builder should avoid names of the form `Array<${string}>`.
|
|
1929
1930
|
*
|
|
1930
1931
|
* @example
|
|
1931
1932
|
* The returned schema should be used as a schema directly:
|
|
1932
1933
|
* ```typescript
|
|
1933
|
-
* const
|
|
1934
|
-
* type
|
|
1934
|
+
* const MyArray = factory.array(factory.number);
|
|
1935
|
+
* type MyArray = NodeFromSchema<typeof MyArray>;
|
|
1935
1936
|
* ```
|
|
1936
1937
|
* Or inline:
|
|
1937
1938
|
* ```typescript
|
|
1938
|
-
* factory.object("Foo", {
|
|
1939
|
+
* factory.object("Foo", {myArray: factory.array(factory.number)});
|
|
1939
1940
|
* ```
|
|
1940
1941
|
* @privateRemarks
|
|
1941
1942
|
* The name produced at the type level here is not as specific as it could be, however doing type level sorting and escaping is a real mess.
|
|
1942
1943
|
* There are cases where not having this full type provided will be less than ideal since TypeScript's structural types.
|
|
1943
|
-
* For example attempts to narrow unions of structural
|
|
1944
|
+
* For example attempts to narrow unions of structural arrays by name won't work.
|
|
1944
1945
|
* Planned future changes to move to a class based schema system as well as factor function based node construction should mostly avoid these issues,
|
|
1945
1946
|
* though there may still be some problematic cases even after that work is done.
|
|
1946
1947
|
*
|
|
@@ -1948,7 +1949,7 @@ export declare class SchemaFactory<TScope extends string = string, TName extends
|
|
|
1948
1949
|
* This prevents callers of this from sub-classing it, which is unlikely to work well (due to the ease of accidentally giving two different calls o this different subclasses)
|
|
1949
1950
|
* when working with structural typing.
|
|
1950
1951
|
*/
|
|
1951
|
-
array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<`${TScope}.
|
|
1952
|
+
array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<`${TScope}.Array<${string}>`, NodeKind.Array, TreeArrayNode<T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true>;
|
|
1952
1953
|
/**
|
|
1953
1954
|
* Define (and add to this library) a {@link FieldNodeSchema} for a {@link (TreeArrayNode:interface)}.
|
|
1954
1955
|
*
|
|
@@ -1956,7 +1957,7 @@ export declare class SchemaFactory<TScope extends string = string, TName extends
|
|
|
1956
1957
|
*
|
|
1957
1958
|
* @example
|
|
1958
1959
|
* ```typescript
|
|
1959
|
-
* class
|
|
1960
|
+
* class NamedArray extends factory.array("name", factory.number) {}
|
|
1960
1961
|
* ```
|
|
1961
1962
|
*/
|
|
1962
1963
|
array<const Name extends TName, const T extends ImplicitAllowedTypes_2>(name: Name, allowedTypes: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Array, TreeArrayNode<T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true>;
|
|
@@ -1966,16 +1967,16 @@ export declare class SchemaFactory<TScope extends string = string, TName extends
|
|
|
1966
1967
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
1967
1968
|
*
|
|
1968
1969
|
* @remarks
|
|
1969
|
-
* This is not intended to be used directly, use the overload of `
|
|
1970
|
+
* This is not intended to be used directly, use the overload of `array` which takes a name instead.
|
|
1970
1971
|
* This is only public to work around a compiler limitation.
|
|
1971
1972
|
*
|
|
1972
1973
|
* @privateRemarks
|
|
1973
1974
|
* TODO: this should be made private or protected.
|
|
1974
1975
|
* Doing so breaks due to:
|
|
1975
|
-
* `src/class-tree/schemaFactoryRecursive.ts:42:9 - error TS2310: Type '
|
|
1976
|
+
* `src/class-tree/schemaFactoryRecursive.ts:42:9 - error TS2310: Type 'Array' recursively references itself as a base type.`
|
|
1976
1977
|
* Once recursive APIs are better sorted out and integrated into this class, switch this back to private.
|
|
1977
1978
|
*/
|
|
1978
|
-
|
|
1979
|
+
namedArray_internal<Name extends TName | string, const T extends ImplicitAllowedTypes_2, const ImplicitlyConstructable extends boolean>(name: Name, allowedTypes: T, customizable: boolean, implicitlyConstructable: ImplicitlyConstructable): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Array, TreeArrayNode<T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable>;
|
|
1979
1980
|
/**
|
|
1980
1981
|
* Make a field optional instead of the default which is required.
|
|
1981
1982
|
*/
|
|
@@ -2384,7 +2385,26 @@ export { SharedStringFactory }
|
|
|
2384
2385
|
|
|
2385
2386
|
export { SharedStringSegment }
|
|
2386
2387
|
|
|
2387
|
-
|
|
2388
|
+
/**
|
|
2389
|
+
* SharedTree is a hierarchical data structure for collaboratively editing JSON-like trees
|
|
2390
|
+
* of objects, arrays, and other data types.
|
|
2391
|
+
*
|
|
2392
|
+
* @beta
|
|
2393
|
+
*/
|
|
2394
|
+
export declare class SharedTree implements ITree {
|
|
2395
|
+
static getFactory(): IChannelFactory;
|
|
2396
|
+
schematize<TRoot extends ImplicitFieldSchema>(config: TreeConfiguration<TRoot>): TreeView<TreeFieldFromImplicitField<TRoot>>;
|
|
2397
|
+
private useFactory;
|
|
2398
|
+
get id(): string;
|
|
2399
|
+
get attributes(): IChannelAttributes;
|
|
2400
|
+
get handle(): IFluidHandle;
|
|
2401
|
+
get IFluidLoadable(): IFluidLoadable;
|
|
2402
|
+
getAttachSummary(fullTree?: boolean | undefined, trackState?: boolean | undefined, telemetryContext?: ITelemetryContext | undefined): ISummaryTreeWithStats;
|
|
2403
|
+
summarize(fullTree?: boolean | undefined, trackState?: boolean | undefined, telemetryContext?: ITelemetryContext | undefined, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined): Promise<ISummaryTreeWithStats>;
|
|
2404
|
+
isAttached(): boolean;
|
|
2405
|
+
connect(services: IChannelServices): void;
|
|
2406
|
+
getGCData(fullGC?: boolean | undefined): IGarbageCollectionData;
|
|
2407
|
+
}
|
|
2388
2408
|
|
|
2389
2409
|
/* Excluded from this release type: SharedTreeContentSnapshot */
|
|
2390
2410
|
|
|
@@ -2471,7 +2491,7 @@ export declare interface TreeApi {
|
|
|
2471
2491
|
* A {@link TreeNode} which implements 'readonly T[]' and the list mutation APIs.
|
|
2472
2492
|
* @beta
|
|
2473
2493
|
*/
|
|
2474
|
-
export declare interface TreeArrayNode<T extends ImplicitAllowedTypes_2 = ImplicitAllowedTypes_2> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<T>, InsertableTreeNodeFromImplicitAllowedTypes<T>, TreeArrayNode> {
|
|
2494
|
+
export declare interface TreeArrayNode<T extends ImplicitAllowedTypes_2 = ImplicitAllowedTypes_2> extends TreeNode, TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<T>, InsertableTreeNodeFromImplicitAllowedTypes<T>, TreeArrayNode> {
|
|
2475
2495
|
}
|
|
2476
2496
|
|
|
2477
2497
|
/**
|
|
@@ -2496,7 +2516,7 @@ export declare const TreeArrayNode: {
|
|
|
2496
2516
|
* A generic List type, used to defined types like {@link (TreeArrayNode:interface)}.
|
|
2497
2517
|
* @beta
|
|
2498
2518
|
*/
|
|
2499
|
-
declare interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<T
|
|
2519
|
+
declare interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<T>, TreeNode {
|
|
2500
2520
|
/**
|
|
2501
2521
|
* Inserts new item(s) at a specified location.
|
|
2502
2522
|
* @param index - The index at which to insert `value`.
|
|
@@ -2687,7 +2707,7 @@ export declare interface TreeMapNode<T extends ImplicitAllowedTypes_2> extends T
|
|
|
2687
2707
|
*
|
|
2688
2708
|
* @beta
|
|
2689
2709
|
*/
|
|
2690
|
-
export declare interface TreeMapNodeBase<TOut, TIn = TOut> extends ReadonlyMap<string, TOut
|
|
2710
|
+
export declare interface TreeMapNodeBase<TOut, TIn = TOut> extends ReadonlyMap<string, TOut>, TreeNode {
|
|
2691
2711
|
/**
|
|
2692
2712
|
* Adds or updates an entry in the map with a specified `key` and a `value`.
|
|
2693
2713
|
*
|
|
@@ -2721,12 +2741,25 @@ export declare interface TreeMapNodeBase<TOut, TIn = TOut> extends ReadonlyMap<s
|
|
|
2721
2741
|
* A non-{@link LeafNodeSchema|leaf} SharedTree node. Includes objects, lists, and maps.
|
|
2722
2742
|
*
|
|
2723
2743
|
* @remarks
|
|
2724
|
-
* Base type which all nodes
|
|
2744
|
+
* Base type which all nodes implement.
|
|
2745
|
+
*
|
|
2746
|
+
* This can be used as a type to indicate/document values which should be tree nodes,
|
|
2747
|
+
* but currently does not provide strong type checking for this.
|
|
2748
|
+
* Additionally runtime use of this class object (for example when used with `instanceof` or subclassed), is not supported:
|
|
2749
|
+
* it may be replaced with an interface or union in the future.
|
|
2725
2750
|
* @privateRemarks
|
|
2726
|
-
* Adding a member which all nodes have, like a type symbol, would produce much
|
|
2751
|
+
* Adding a member which all nodes have, like a type symbol, would produce much stronger typing for this.
|
|
2752
|
+
* This is only a class to enable stronger typing in a future change,
|
|
2753
|
+
* but other future changes may want to replace it with a branded interface if the runtime oddities related to this are not cleaned up.
|
|
2754
|
+
*
|
|
2755
|
+
* Currently not all node implications include this in their prototype chain (some hide it with a proxy), and thus cause `instanceof` to fail.
|
|
2756
|
+
* This results in the runtime and compile time behavior of `instanceof` differing.
|
|
2757
|
+
* TypeScript 5.3 allows altering the compile time behavior of `instanceof`.
|
|
2758
|
+
* The runtime behavior can be changed by implementing `Symbol.hasInstance`.
|
|
2759
|
+
* One of those approaches could be used to resolve this inconsistency if TreeNode is kept as a class.
|
|
2727
2760
|
* @beta
|
|
2728
2761
|
*/
|
|
2729
|
-
export declare class TreeNode {
|
|
2762
|
+
export declare abstract class TreeNode {
|
|
2730
2763
|
}
|
|
2731
2764
|
|
|
2732
2765
|
/**
|
|
@@ -90,6 +90,7 @@ import { SharedStringSegment } from '@fluidframework/sequence';
|
|
|
90
90
|
import { StableId } from '@fluidframework/runtime-definitions';
|
|
91
91
|
import type { Static } from '@sinclair/typebox';
|
|
92
92
|
import { SubSequence } from '@fluidframework/sequence';
|
|
93
|
+
import { TreeNode as TreeNode_2 } from '..';
|
|
93
94
|
import { TreeNodeSchema as TreeNodeSchema_2 } from './schemaTypes';
|
|
94
95
|
import { TreeNodeSchemaClass as TreeNodeSchemaClass_2 } from './schemaTypes';
|
|
95
96
|
import type { TSchema } from '@sinclair/typebox';
|
|
@@ -1372,7 +1373,7 @@ export declare class SchemaFactory<TScope extends string = string, TName extends
|
|
|
1372
1373
|
*
|
|
1373
1374
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
1374
1375
|
*/
|
|
1375
|
-
object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>(name: Name, t: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Object, ObjectFromSchemaRecord<T>, InsertableObjectFromSchemaRecord<T>, true>;
|
|
1376
|
+
object<const Name extends TName, const T extends RestrictiveReadonlyRecord<string, ImplicitFieldSchema>>(name: Name, t: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Object, object & TreeNode & ObjectFromSchemaRecord<T>, object & InsertableObjectFromSchemaRecord<T>, true>;
|
|
1376
1377
|
/**
|
|
1377
1378
|
* Define a structurally typed {@link TreeNodeSchema} for a {@link TreeMapNodeBase}.
|
|
1378
1379
|
*
|
|
@@ -1394,7 +1395,7 @@ export declare class SchemaFactory<TScope extends string = string, TName extends
|
|
|
1394
1395
|
* factory.object("Foo", {myMap: factory.map(factory.number)});
|
|
1395
1396
|
* ```
|
|
1396
1397
|
* @privateRemarks
|
|
1397
|
-
* See note on
|
|
1398
|
+
* See note on array.
|
|
1398
1399
|
*/
|
|
1399
1400
|
map<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<`${TScope}.Map<${string}>`, NodeKind.Map, TreeMapNode<T>, ReadonlyMap<string, TreeNodeFromImplicitAllowedTypes<T>>, true>;
|
|
1400
1401
|
/**
|
|
@@ -1413,33 +1414,33 @@ export declare class SchemaFactory<TScope extends string = string, TName extends
|
|
|
1413
1414
|
*
|
|
1414
1415
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
1415
1416
|
*
|
|
1416
|
-
* @remarks See remarks on {@link SchemaFactory.
|
|
1417
|
+
* @remarks See remarks on {@link SchemaFactory.namedArray_internal}.
|
|
1417
1418
|
*/
|
|
1418
|
-
|
|
1419
|
+
namedMap_internal<Name extends TName | string, const T extends ImplicitAllowedTypes_2, const ImplicitlyConstructable extends boolean>(name: Name, allowedTypes: T, customizable: boolean, implicitlyConstructable: ImplicitlyConstructable): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Map, TreeMapNode<T>, ReadonlyMap<string, InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable>;
|
|
1419
1420
|
/**
|
|
1420
1421
|
* Define a structurally typed {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.
|
|
1421
1422
|
*
|
|
1422
1423
|
* @remarks
|
|
1423
|
-
* The identifier for this
|
|
1424
|
+
* The identifier for this Array is defined as a function of the provided types.
|
|
1424
1425
|
* It is still scoped to this SchemaFactory, but multiple calls with the same arguments will return the same schema object, providing somewhat structural typing.
|
|
1425
1426
|
* This does not support recursive types.
|
|
1426
1427
|
*
|
|
1427
|
-
* If using these structurally named
|
|
1428
|
+
* If using these structurally named arrays, other types in this schema builder should avoid names of the form `Array<${string}>`.
|
|
1428
1429
|
*
|
|
1429
1430
|
* @example
|
|
1430
1431
|
* The returned schema should be used as a schema directly:
|
|
1431
1432
|
* ```typescript
|
|
1432
|
-
* const
|
|
1433
|
-
* type
|
|
1433
|
+
* const MyArray = factory.array(factory.number);
|
|
1434
|
+
* type MyArray = NodeFromSchema<typeof MyArray>;
|
|
1434
1435
|
* ```
|
|
1435
1436
|
* Or inline:
|
|
1436
1437
|
* ```typescript
|
|
1437
|
-
* factory.object("Foo", {
|
|
1438
|
+
* factory.object("Foo", {myArray: factory.array(factory.number)});
|
|
1438
1439
|
* ```
|
|
1439
1440
|
* @privateRemarks
|
|
1440
1441
|
* The name produced at the type level here is not as specific as it could be, however doing type level sorting and escaping is a real mess.
|
|
1441
1442
|
* There are cases where not having this full type provided will be less than ideal since TypeScript's structural types.
|
|
1442
|
-
* For example attempts to narrow unions of structural
|
|
1443
|
+
* For example attempts to narrow unions of structural arrays by name won't work.
|
|
1443
1444
|
* Planned future changes to move to a class based schema system as well as factor function based node construction should mostly avoid these issues,
|
|
1444
1445
|
* though there may still be some problematic cases even after that work is done.
|
|
1445
1446
|
*
|
|
@@ -1447,7 +1448,7 @@ export declare class SchemaFactory<TScope extends string = string, TName extends
|
|
|
1447
1448
|
* This prevents callers of this from sub-classing it, which is unlikely to work well (due to the ease of accidentally giving two different calls o this different subclasses)
|
|
1448
1449
|
* when working with structural typing.
|
|
1449
1450
|
*/
|
|
1450
|
-
array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<`${TScope}.
|
|
1451
|
+
array<const T extends TreeNodeSchema | readonly TreeNodeSchema[]>(allowedTypes: T): TreeNodeSchema<`${TScope}.Array<${string}>`, NodeKind.Array, TreeArrayNode<T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true>;
|
|
1451
1452
|
/**
|
|
1452
1453
|
* Define (and add to this library) a {@link FieldNodeSchema} for a {@link (TreeArrayNode:interface)}.
|
|
1453
1454
|
*
|
|
@@ -1455,7 +1456,7 @@ export declare class SchemaFactory<TScope extends string = string, TName extends
|
|
|
1455
1456
|
*
|
|
1456
1457
|
* @example
|
|
1457
1458
|
* ```typescript
|
|
1458
|
-
* class
|
|
1459
|
+
* class NamedArray extends factory.array("name", factory.number) {}
|
|
1459
1460
|
* ```
|
|
1460
1461
|
*/
|
|
1461
1462
|
array<const Name extends TName, const T extends ImplicitAllowedTypes_2>(name: Name, allowedTypes: T): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Array, TreeArrayNode<T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, true>;
|
|
@@ -1465,16 +1466,16 @@ export declare class SchemaFactory<TScope extends string = string, TName extends
|
|
|
1465
1466
|
* @param name - Unique identifier for this schema within this factory's scope.
|
|
1466
1467
|
*
|
|
1467
1468
|
* @remarks
|
|
1468
|
-
* This is not intended to be used directly, use the overload of `
|
|
1469
|
+
* This is not intended to be used directly, use the overload of `array` which takes a name instead.
|
|
1469
1470
|
* This is only public to work around a compiler limitation.
|
|
1470
1471
|
*
|
|
1471
1472
|
* @privateRemarks
|
|
1472
1473
|
* TODO: this should be made private or protected.
|
|
1473
1474
|
* Doing so breaks due to:
|
|
1474
|
-
* `src/class-tree/schemaFactoryRecursive.ts:42:9 - error TS2310: Type '
|
|
1475
|
+
* `src/class-tree/schemaFactoryRecursive.ts:42:9 - error TS2310: Type 'Array' recursively references itself as a base type.`
|
|
1475
1476
|
* Once recursive APIs are better sorted out and integrated into this class, switch this back to private.
|
|
1476
1477
|
*/
|
|
1477
|
-
|
|
1478
|
+
namedArray_internal<Name extends TName | string, const T extends ImplicitAllowedTypes_2, const ImplicitlyConstructable extends boolean>(name: Name, allowedTypes: T, customizable: boolean, implicitlyConstructable: ImplicitlyConstructable): TreeNodeSchemaClass<`${TScope}.${Name}`, NodeKind.Array, TreeArrayNode<T>, Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>, ImplicitlyConstructable>;
|
|
1478
1479
|
/**
|
|
1479
1480
|
* Make a field optional instead of the default which is required.
|
|
1480
1481
|
*/
|
|
@@ -1681,7 +1682,26 @@ export { SharedObjectClass }
|
|
|
1681
1682
|
|
|
1682
1683
|
/* Excluded from this release type: SharedStringSegment */
|
|
1683
1684
|
|
|
1684
|
-
|
|
1685
|
+
/**
|
|
1686
|
+
* SharedTree is a hierarchical data structure for collaboratively editing JSON-like trees
|
|
1687
|
+
* of objects, arrays, and other data types.
|
|
1688
|
+
*
|
|
1689
|
+
* @beta
|
|
1690
|
+
*/
|
|
1691
|
+
export declare class SharedTree implements ITree {
|
|
1692
|
+
static getFactory(): IChannelFactory;
|
|
1693
|
+
schematize<TRoot extends ImplicitFieldSchema>(config: TreeConfiguration<TRoot>): TreeView<TreeFieldFromImplicitField<TRoot>>;
|
|
1694
|
+
private useFactory;
|
|
1695
|
+
get id(): string;
|
|
1696
|
+
get attributes(): IChannelAttributes;
|
|
1697
|
+
get handle(): IFluidHandle;
|
|
1698
|
+
get IFluidLoadable(): IFluidLoadable;
|
|
1699
|
+
getAttachSummary(fullTree?: boolean | undefined, trackState?: boolean | undefined, telemetryContext?: ITelemetryContext | undefined): ISummaryTreeWithStats;
|
|
1700
|
+
summarize(fullTree?: boolean | undefined, trackState?: boolean | undefined, telemetryContext?: ITelemetryContext | undefined, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext | undefined): Promise<ISummaryTreeWithStats>;
|
|
1701
|
+
isAttached(): boolean;
|
|
1702
|
+
connect(services: IChannelServices): void;
|
|
1703
|
+
getGCData(fullGC?: boolean | undefined): IGarbageCollectionData;
|
|
1704
|
+
}
|
|
1685
1705
|
|
|
1686
1706
|
/* Excluded from this release type: SharedTreeContentSnapshot */
|
|
1687
1707
|
|
|
@@ -1768,7 +1788,7 @@ export declare interface TreeApi {
|
|
|
1768
1788
|
* A {@link TreeNode} which implements 'readonly T[]' and the list mutation APIs.
|
|
1769
1789
|
* @beta
|
|
1770
1790
|
*/
|
|
1771
|
-
export declare interface TreeArrayNode<T extends ImplicitAllowedTypes_2 = ImplicitAllowedTypes_2> extends TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<T>, InsertableTreeNodeFromImplicitAllowedTypes<T>, TreeArrayNode> {
|
|
1791
|
+
export declare interface TreeArrayNode<T extends ImplicitAllowedTypes_2 = ImplicitAllowedTypes_2> extends TreeNode, TreeArrayNodeBase<TreeNodeFromImplicitAllowedTypes<T>, InsertableTreeNodeFromImplicitAllowedTypes<T>, TreeArrayNode> {
|
|
1772
1792
|
}
|
|
1773
1793
|
|
|
1774
1794
|
/**
|
|
@@ -1793,7 +1813,7 @@ export declare const TreeArrayNode: {
|
|
|
1793
1813
|
* A generic List type, used to defined types like {@link (TreeArrayNode:interface)}.
|
|
1794
1814
|
* @beta
|
|
1795
1815
|
*/
|
|
1796
|
-
declare interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<T
|
|
1816
|
+
declare interface TreeArrayNodeBase<out T, in TNew, in TMoveFrom> extends ReadonlyArray<T>, TreeNode {
|
|
1797
1817
|
/**
|
|
1798
1818
|
* Inserts new item(s) at a specified location.
|
|
1799
1819
|
* @param index - The index at which to insert `value`.
|
|
@@ -1984,7 +2004,7 @@ export declare interface TreeMapNode<T extends ImplicitAllowedTypes_2> extends T
|
|
|
1984
2004
|
*
|
|
1985
2005
|
* @beta
|
|
1986
2006
|
*/
|
|
1987
|
-
export declare interface TreeMapNodeBase<TOut, TIn = TOut> extends ReadonlyMap<string, TOut
|
|
2007
|
+
export declare interface TreeMapNodeBase<TOut, TIn = TOut> extends ReadonlyMap<string, TOut>, TreeNode {
|
|
1988
2008
|
/**
|
|
1989
2009
|
* Adds or updates an entry in the map with a specified `key` and a `value`.
|
|
1990
2010
|
*
|
|
@@ -2018,12 +2038,25 @@ export declare interface TreeMapNodeBase<TOut, TIn = TOut> extends ReadonlyMap<s
|
|
|
2018
2038
|
* A non-{@link LeafNodeSchema|leaf} SharedTree node. Includes objects, lists, and maps.
|
|
2019
2039
|
*
|
|
2020
2040
|
* @remarks
|
|
2021
|
-
* Base type which all nodes
|
|
2041
|
+
* Base type which all nodes implement.
|
|
2042
|
+
*
|
|
2043
|
+
* This can be used as a type to indicate/document values which should be tree nodes,
|
|
2044
|
+
* but currently does not provide strong type checking for this.
|
|
2045
|
+
* Additionally runtime use of this class object (for example when used with `instanceof` or subclassed), is not supported:
|
|
2046
|
+
* it may be replaced with an interface or union in the future.
|
|
2022
2047
|
* @privateRemarks
|
|
2023
|
-
* Adding a member which all nodes have, like a type symbol, would produce much
|
|
2048
|
+
* Adding a member which all nodes have, like a type symbol, would produce much stronger typing for this.
|
|
2049
|
+
* This is only a class to enable stronger typing in a future change,
|
|
2050
|
+
* but other future changes may want to replace it with a branded interface if the runtime oddities related to this are not cleaned up.
|
|
2051
|
+
*
|
|
2052
|
+
* Currently not all node implications include this in their prototype chain (some hide it with a proxy), and thus cause `instanceof` to fail.
|
|
2053
|
+
* This results in the runtime and compile time behavior of `instanceof` differing.
|
|
2054
|
+
* TypeScript 5.3 allows altering the compile time behavior of `instanceof`.
|
|
2055
|
+
* The runtime behavior can be changed by implementing `Symbol.hasInstance`.
|
|
2056
|
+
* One of those approaches could be used to resolve this inconsistency if TreeNode is kept as a class.
|
|
2024
2057
|
* @beta
|
|
2025
2058
|
*/
|
|
2026
|
-
export declare class TreeNode {
|
|
2059
|
+
export declare abstract class TreeNode {
|
|
2027
2060
|
}
|
|
2028
2061
|
|
|
2029
2062
|
/**
|
|
@@ -90,6 +90,7 @@ import { SharedStringSegment } from '@fluidframework/sequence';
|
|
|
90
90
|
import { StableId } from '@fluidframework/runtime-definitions';
|
|
91
91
|
import type { Static } from '@sinclair/typebox';
|
|
92
92
|
import { SubSequence } from '@fluidframework/sequence';
|
|
93
|
+
import { TreeNode as TreeNode_2 } from '..';
|
|
93
94
|
import { TreeNodeSchema as TreeNodeSchema_2 } from './schemaTypes';
|
|
94
95
|
import { TreeNodeSchemaClass as TreeNodeSchemaClass_2 } from './schemaTypes';
|
|
95
96
|
import type { TSchema } from '@sinclair/typebox';
|