1- import { NamedNode , Node , st , term } from "rdflib" ;
2- import { LiveStore , SolidNamespace } from "../index" ;
1+ import { LiveStore , NamedNode , Node , st , term } from "rdflib" ;
2+ import { SolidNamespace } from "../index" ;
33import { ProfileLogic } from "../profile/ProfileLogic" ;
44import { newThing } from "../uri" ;
55import { determineChatContainer } from "./determineChatContainer" ;
@@ -38,7 +38,7 @@ export class ChatLogic {
3838 // Some servers don't present a Link http response header
3939 // if the container doesn't exist yet, so refetch the container
4040 // now that it has been created:
41- await this . store . fetcher . load ( chatContainer ) ;
41+ await this . store . fetcher ? .load ( chatContainer ) ;
4242
4343 // FIXME: check the Why value on this quad:
4444 const chatAclDoc = this . store . any (
@@ -66,7 +66,7 @@ export class ChatLogic {
6666 acl:mode
6767 acl:Read, acl:Append.
6868` ;
69- await this . store . fetcher . webOperation ( "PUT" , chatAclDoc . value , {
69+ await this . store . fetcher ? .webOperation ( "PUT" , chatAclDoc . value , {
7070 data : aclBody ,
7171 contentType : "text/turtle" ,
7272 } ) ;
@@ -81,7 +81,7 @@ export class ChatLogic {
8181 if ( ! privateTypeIndex ) {
8282 throw new Error ( "Private type index not found!" ) ;
8383 }
84- await this . store . fetcher . load ( privateTypeIndex ) ;
84+ await this . store . fetcher ? .load ( privateTypeIndex ) ;
8585 const reg = newThing ( privateTypeIndex ) ;
8686 const ins = [
8787 st (
@@ -99,7 +99,7 @@ export class ChatLogic {
9999 st ( reg , this . ns . solid ( "instance" ) , chatThing , privateTypeIndex . doc ( ) ) ,
100100 ] ;
101101 await new Promise ( ( resolve , reject ) => {
102- this . store . updater . update ( [ ] , ins , function ( _uri , ok , errm ) {
102+ this . store . updater ? .update ( [ ] , ins , function ( _uri , ok , errm ) {
103103 if ( ! ok ) {
104104 reject ( new Error ( errm ) ) ;
105105 } else {
@@ -115,7 +115,7 @@ export class ChatLogic {
115115 const chatContainer = determineChatContainer ( invitee , podRoot ) ;
116116 let exists = true ;
117117 try {
118- await this . store . fetcher . load (
118+ await this . store . fetcher ? .load (
119119 new NamedNode ( chatContainer . value + "index.ttl#this" )
120120 ) ;
121121 } catch ( e ) {
@@ -165,7 +165,7 @@ export class ChatLogic {
165165 }
166166
167167 return new Promise ( function ( resolve , reject ) {
168- updater . put (
168+ updater ? .put (
169169 newChatDoc ,
170170 kb . statementsMatching ( undefined , undefined , undefined , newChatDoc ) ,
171171 "text/turtle" ,
@@ -213,7 +213,7 @@ export class ChatLogic {
213213 }
214214
215215 private async sendInvite ( invitee : NamedNode , chatThing : NamedNode ) {
216- await this . store . fetcher . load ( invitee . doc ( ) ) ;
216+ await this . store . fetcher ? .load ( invitee . doc ( ) ) ;
217217 const inviteeInbox = this . store . any (
218218 invitee ,
219219 this . ns . ldp ( "inbox" ) ,
@@ -228,17 +228,17 @@ export class ChatLogic {
228228${ this . ns . rdf ( "seeAlso" ) } <${ chatThing . value } > .
229229 ` ;
230230
231- const inviteResponse = await this . store . fetcher . webOperation (
231+ const inviteResponse = await this . store . fetcher ? .webOperation (
232232 "POST" ,
233233 inviteeInbox . value ,
234234 {
235235 data : inviteBody ,
236236 contentType : "text/turtle" ,
237237 }
238238 ) ;
239- const locationStr = inviteResponse . headers . get ( "location" ) ;
239+ const locationStr = inviteResponse ? .headers . get ( "location" ) ;
240240 if ( ! locationStr ) {
241- throw new Error ( `Invite sending returned a ${ inviteResponse . status } ` ) ;
241+ throw new Error ( `Invite sending returned a ${ inviteResponse ? .status } ` ) ;
242242 }
243243 }
244244}
0 commit comments