@@ -48,8 +48,8 @@ import {
48
48
ForestTypeOptimized ,
49
49
ForestTypeReference ,
50
50
getBranch ,
51
+ type ISharedTree ,
51
52
type ITreePrivate ,
52
- type SharedTree ,
53
53
Tree ,
54
54
type TreeCheckout ,
55
55
} from "../../shared-tree/index.js" ;
@@ -92,23 +92,30 @@ import {
92
92
TreeFactory ,
93
93
SharedTree as SharedTreeKind ,
94
94
} from "../../treeFactory.js" ;
95
- import type { ISharedObjectKind } from "@fluidframework/shared-object-base/internal" ;
95
+ import {
96
+ SharedObjectCore ,
97
+ type ISharedObjectKind ,
98
+ } from "@fluidframework/shared-object-base/internal" ;
96
99
import { TestAnchor } from "../testAnchor.js" ;
97
100
// eslint-disable-next-line import/no-internal-modules
98
101
import { handleSchema , numberSchema , stringSchema } from "../../simple-tree/leafNodeSchema.js" ;
99
102
import { singleJsonCursor } from "../json/index.js" ;
100
103
import { AttachState } from "@fluidframework/container-definitions" ;
101
104
import { JsonAsTree } from "../../jsonDomainSchema.js" ;
102
- // eslint-disable-next-line import/no-internal-modules
103
- import { toSimpleTreeSchema } from "../../simple-tree/api/index.js" ;
105
+ import {
106
+ asTreeViewAlpha ,
107
+ toSimpleTreeSchema ,
108
+ type ITree ,
109
+ // eslint-disable-next-line import/no-internal-modules
110
+ } from "../../simple-tree/api/index.js" ;
104
111
import type { IChannel } from "@fluidframework/datastore-definitions/internal" ;
105
112
106
113
const enableSchemaValidation = true ;
107
114
108
115
const DebugSharedTree = configuredSharedTree ( {
109
116
jsonValidator : typeboxValidator ,
110
117
forest : ForestTypeReference ,
111
- } ) as ISharedObjectKind < unknown > as ISharedObjectKind < SharedTree > ;
118
+ } ) as ISharedObjectKind < unknown > as ISharedObjectKind < ISharedTree > ;
112
119
113
120
class MockSharedTreeRuntime extends MockFluidDataStoreRuntime {
114
121
public constructor ( ) {
@@ -661,6 +668,7 @@ describe("SharedTree", () => {
661
668
view . root . insertAtEnd ( "b" ) ;
662
669
663
670
const tree2 = sharedTreeFactory . create ( runtime , "tree2" ) ;
671
+ assert ( tree2 instanceof SharedObjectCore ) ;
664
672
await tree2 . load ( {
665
673
deltaConnection : runtime . createDeltaConnection ( ) ,
666
674
objectStorage : MockStorage . createFromSummary ( ( await tree . summarize ( ) ) . summary ) ,
@@ -727,7 +735,7 @@ describe("SharedTree", () => {
727
735
} ) ;
728
736
729
737
it ( "can summarize local edits in the attach summary" , async ( ) => {
730
- const onCreate = ( tree : SharedTree ) => {
738
+ const onCreate = ( tree : ITreePrivate ) => {
731
739
const view = tree . viewWith (
732
740
new TreeViewConfiguration ( { schema : StringArray , enableSchemaValidation } ) ,
733
741
) ;
@@ -764,7 +772,7 @@ describe("SharedTree", () => {
764
772
} ) ;
765
773
766
774
it ( "can tolerate local edits submitted as part of a transaction in the attach summary" , async ( ) => {
767
- const onCreate = ( tree : SharedTree ) => {
775
+ const onCreate = ( tree : ITreePrivate ) => {
768
776
// Schematize uses a transaction as well
769
777
const view = tree . viewWith (
770
778
new TreeViewConfiguration ( { schema : StringArray , enableSchemaValidation } ) ,
@@ -804,7 +812,7 @@ describe("SharedTree", () => {
804
812
// AB#5745: Enable this test once it passes.
805
813
// TODO: above mentioned task is done, but this still fails. Fix it.
806
814
it . skip ( "can tolerate incomplete transactions when attaching" , async ( ) => {
807
- const onCreate = ( tree : SharedTree ) => {
815
+ const onCreate = ( tree : ITreePrivate ) => {
808
816
const view = tree . viewWith (
809
817
new TreeViewConfiguration ( { schema : StringArray , enableSchemaValidation } ) ,
810
818
) ;
@@ -902,7 +910,7 @@ describe("SharedTree", () => {
902
910
} ) ;
903
911
904
912
it ( "can process changes while detached" , async ( ) => {
905
- const onCreate = ( t : SharedTree ) => {
913
+ const onCreate = ( t : ITree ) => {
906
914
const viewInit = t . viewWith (
907
915
new TreeViewConfiguration ( { schema : StringArray , enableSchemaValidation } ) ,
908
916
) ;
@@ -1781,7 +1789,7 @@ describe("SharedTree", () => {
1781
1789
} ) ;
1782
1790
1783
1791
it ( "process changes while detached" , async ( ) => {
1784
- const onCreate = ( parentTree : SharedTree ) => {
1792
+ const onCreate = ( parentTree : ISharedTree ) => {
1785
1793
const parentView = parentTree . viewWith (
1786
1794
new TreeViewConfiguration ( {
1787
1795
schema : StringArray ,
@@ -2209,7 +2217,9 @@ describe("SharedTree", () => {
2209
2217
const tree = sharedTreeFactory . create ( runtime , "tree" ) ;
2210
2218
const runtimeFactory = new MockContainerRuntimeFactory ( ) ;
2211
2219
runtimeFactory . createContainerRuntime ( runtime ) ;
2212
- const view = tree . viewWith ( new TreeViewConfiguration ( { schema : StringArray } ) ) ;
2220
+ const view = asTreeViewAlpha (
2221
+ tree . viewWith ( new TreeViewConfiguration ( { schema : StringArray } ) ) ,
2222
+ ) ;
2213
2223
view . initialize ( [ ] ) ;
2214
2224
assert . throws (
2215
2225
( ) => {
@@ -2230,6 +2240,7 @@ describe("SharedTree", () => {
2230
2240
const schema = sf . object ( "myObject" , { } ) ;
2231
2241
const config = new TreeViewConfiguration ( { schema, enableSchemaValidation } ) ;
2232
2242
const view = tree . viewWith ( config ) ;
2243
+ assert ( view instanceof SchematizingSimpleTreeView ) ;
2233
2244
2234
2245
view . initialize ( { } ) ;
2235
2246
assert . equal ( view . breaker , tree . kernel . breaker ) ;
0 commit comments