@@ -11,12 +11,10 @@ export const ACL_LINK = sym(
1111export class UtilityLogic {
1212 store : LiveStore ;
1313 ns : SolidNamespace ;
14- underlyingFetch : { fetch : ( url : string , options ?: any ) => any } ;
1514
16- constructor ( store : LiveStore , ns : SolidNamespace , underlyingFetch : { fetch : ( url : string , options ?: any ) => any } ) {
15+ constructor ( store : LiveStore , ns : SolidNamespace ) {
1716 this . store = store ;
1817 this . ns = ns ;
19- this . underlyingFetch = underlyingFetch ;
2018 }
2119
2220 async findAclDocUrl ( url : string ) {
@@ -65,7 +63,7 @@ export class UtilityLogic {
6563 ] . join ( '\n' )
6664 }
6765 const aclDocUrl = await this . findAclDocUrl ( options . target ) ;
68- return this . underlyingFetch . fetch ( aclDocUrl , {
66+ return this . store . fetcher . _fetch ( aclDocUrl , {
6967 method : 'PUT' ,
7068 body : str ,
7169 headers : [
@@ -74,21 +72,6 @@ export class UtilityLogic {
7472 } ) ;
7573 }
7674
77- async loadDoc ( doc : NamedNode ) : Promise < void > {
78- // Load a document into the knowledge base (fetcher.store)
79- // withCredentials: Web arch should let us just load by turning off creds helps CORS
80- // reload: Gets around a specific old Chrome bug caching/origin/cors
81- // console.log('loading', profileDocument)
82- if ( ! this . store . fetcher ) {
83- throw new Error ( "Cannot load doc, have no fetcher" ) ;
84- }
85- await this . store . fetcher . load ( doc , {
86- withCredentials : false , // @@ BUT this won't work when logged in an accessing private stuff!
87- cache : "reload" ,
88- } ) ;
89- // console.log('loaded', profileDocument, this.store)
90- }
91-
9275 isContainer ( url : string ) {
9376 return url . charAt ( url . length - 1 ) === "/" ;
9477 }
@@ -98,7 +81,7 @@ export class UtilityLogic {
9881 throw new Error ( `Not a container URL ${ url } ` ) ;
9982 }
10083 // Copied from https://github.com/solidos/solid-crud-tests/blob/v3.1.0/test/surface/create-container.test.ts#L56-L64
101- const result = await this . underlyingFetch . fetch ( url , {
84+ const result = await this . store . fetcher . _fetch ( url , {
10285 method : "PUT" ,
10386 headers : {
10487 "Content-Type" : "text/turtle" ,
@@ -134,13 +117,13 @@ export class UtilityLogic {
134117 try {
135118 if ( this . isContainer ( url ) ) {
136119 const aclDocUrl = await this . findAclDocUrl ( url ) ;
137- await this . underlyingFetch . fetch ( aclDocUrl , { method : "DELETE" } ) ;
120+ await this . store . fetcher . _fetch ( aclDocUrl , { method : "DELETE" } ) ;
138121 const containerMembers = await this . getContainerMembers ( url ) ;
139122 await Promise . all (
140123 containerMembers . map ( ( url ) => this . recursiveDelete ( url ) )
141124 ) ;
142125 }
143- return this . underlyingFetch . fetch ( url , { method : "DELETE" } ) ;
126+ return this . store . fetcher . _fetch ( url , { method : "DELETE" } ) ;
144127 } catch ( e ) {
145128 // console.log(`Please manually remove ${url} from your system under test.`, e);
146129 }
0 commit comments