@@ -81,8 +81,8 @@ export default class NotionDocumentService implements DocumentService {
81
81
const result : Array < NotionRepository [ ] > = await Promise . all (
82
82
Object . keys ( spaces ) . map ( async ( p ) => {
83
83
const space = spaces [ p ] ;
84
- const recentPages = await this . getRecentPageVisits ( space . value . id , userId ) ;
85
- return this . loadSpace ( p , space . value . name , recentPages ) ;
84
+ const recentPages = await this . getRecentPageVisits ( space . spaceId , userId ) ;
85
+ return this . loadSpace ( space . spaceId , space . table , recentPages ) ;
86
86
} )
87
87
) ;
88
88
@@ -94,11 +94,24 @@ export default class NotionDocumentService implements DocumentService {
94
94
const response = await this . requestWithCookie . post < {
95
95
users : {
96
96
[ id : string ] : {
97
+ user_root : {
98
+ [ id : string ] : {
99
+ value : {
100
+ space_view_pointers : [
101
+ {
102
+ id : string ;
103
+ table : string ;
104
+ spaceId : string ;
105
+ }
106
+ ]
107
+ }
108
+ } ;
109
+ }
97
110
space : any ;
98
111
} ;
99
112
} ;
100
113
} > ( '/api/v3/getSpacesInitial' ) ;
101
- return response . data . users [ userId ] . space ;
114
+ return response . data . users [ userId ] . user_root [ userId ] . value . space_view_pointers ;
102
115
} ;
103
116
104
117
createDocument = async ( {
@@ -152,7 +165,7 @@ export default class NotionDocumentService implements DocumentService {
152
165
153
166
const userId = Object . keys ( this . userContent . recordMap . notion_user ) [ 0 ] as string ;
154
167
const spaces = ( await this . getSpaces ( userId ) ) as any ;
155
- return Object . keys ( spaces ) [ 0 ] ;
168
+ return spaces [ 0 ] . spaceId ;
156
169
} ;
157
170
158
171
createEmptyFile = async ( repository : NotionRepository , title : string ) => {
@@ -161,6 +174,8 @@ export default class NotionDocumentService implements DocumentService {
161
174
}
162
175
const spaceId = await this . getSpaceId ( ) ;
163
176
const documentId = generateUuid ( ) ;
177
+ const requestId = generateUuid ( ) ;
178
+ const inner_requestId = generateUuid ( ) ;
164
179
const parentId = repository . id ;
165
180
const userId = Object . values ( this . userContent . recordMap . notion_user ) [ 0 ] . value . id ;
166
181
const time = new Date ( ) . getDate ( ) ;
@@ -271,8 +286,15 @@ export default class NotionDocumentService implements DocumentService {
271
286
] ;
272
287
}
273
288
274
- await this . requestWithCookie . post ( 'api/v3/submitTransaction' , {
275
- operations,
289
+ await this . requestWithCookie . post ( 'api/v3/saveTransactionsFanout' , {
290
+ requestId : requestId ,
291
+ transactions : [
292
+ {
293
+ id : inner_requestId ,
294
+ operations : operations ,
295
+ spaceId : spaceId ,
296
+ }
297
+ ]
276
298
} ) ;
277
299
return documentId ;
278
300
} ;
0 commit comments