@@ -24,9 +24,9 @@ export class SessionConnection {
2424 #lock
2525 #readOnly
2626 #hasOwner
27- #options
27+ connection
2828
29- constructor ( response , options ) {
29+ constructor ( response , connection ) {
3030 const {
3131 document,
3232 session,
@@ -43,8 +43,8 @@ export class SessionConnection {
4343 this . #content = content
4444 this . #documentState = documentState
4545 this . #hasOwner = hasOwner
46- this . #options = options
47- this . isPublic = ! ! options . shareToken
46+ this . connection = connection
47+ this . isPublic = ! ! connection . shareToken
4848 this . closed = false
4949 }
5050
@@ -82,14 +82,14 @@ export class SessionConnection {
8282 documentId : this . #document. id ,
8383 sessionId : this . #session. id ,
8484 sessionToken : this . #session. token ,
85- token : this . #options . shareToken ,
85+ token : this . connection . shareToken ,
8686 }
8787 }
8888
8989 sync ( { version } ) {
9090 return this . #post( this . #url( `session/${ this . #document. id } /sync` ) , {
9191 ...this . #defaultParams,
92- filePath : this . #options . filePath ,
92+ filePath : this . connection . filePath ,
9393 baseVersionEtag : this . #document. baseVersionEtag ,
9494 version,
9595 } )
@@ -99,7 +99,7 @@ export class SessionConnection {
9999 const url = this . #url( `session/${ this . #document. id } /save` )
100100 const postData = {
101101 ...this . #defaultParams,
102- filePath : this . #options . filePath ,
102+ filePath : this . connection . filePath ,
103103 baseVersionEtag : this . #document. baseVersionEtag ,
104104 ...data ,
105105 }
@@ -111,7 +111,7 @@ export class SessionConnection {
111111 const url = this . #url( `session/${ this . #document. id } /save` )
112112 const postData = {
113113 ...this . #defaultParams,
114- filePath : this . #options . filePath ,
114+ filePath : this . connection . filePath ,
115115 baseVersionEtag : this . #document. baseVersionEtag ,
116116 ...data ,
117117 requestToken : getRequestToken ( ) ?? '' ,
@@ -123,17 +123,6 @@ export class SessionConnection {
123123 return navigator . sendBeacon ( url , blob )
124124 }
125125
126- push ( { steps, version, awareness } ) {
127- return this . #post( this . #url( `session/${ this . #document. id } /push` ) , {
128- ...this . #defaultParams,
129- filePath : this . #options. filePath ,
130- baseVersionEtag : this . #document. baseVersionEtag ,
131- steps,
132- version,
133- awareness,
134- } )
135- }
136-
137126 // TODO: maybe return a new connection here so connections have immutable state
138127 update ( guestName ) {
139128 return this . #post( this . #url( `session/${ this . #document. id } /session` ) , {
@@ -156,7 +145,7 @@ export class SessionConnection {
156145 + '&sessionToken='
157146 + encodeURIComponent ( this . #session. token )
158147 + '&token='
159- + encodeURIComponent ( this . #options . shareToken || '' )
148+ + encodeURIComponent ( this . connection . shareToken || '' )
160149 return this . #post( url , formData , {
161150 headers : {
162151 'Content-Type' : 'multipart/form-data' ,
0 commit comments