@@ -153,11 +153,16 @@ async function batchInsertAll(
153153 context ?: ServerToolContext
154154) : Promise < number > {
155155 let inserted = 0
156+ const userId = context ?. userId
156157 for ( let i = 0 ; i < rows . length ; i += MAX_BATCH_SIZE ) {
157158 assertServerToolNotAborted ( context , 'Request aborted before table mutation could be applied.' )
158159 const batch = rows . slice ( i , i + MAX_BATCH_SIZE )
159160 const requestId = generateId ( ) . slice ( 0 , 8 )
160- const result = await batchInsertRows ( { tableId, rows : batch , workspaceId } , table , requestId )
161+ const result = await batchInsertRows (
162+ { tableId, rows : batch , workspaceId, userId } ,
163+ table ,
164+ requestId
165+ )
161166 inserted += result . length
162167 }
163168 return inserted
@@ -297,7 +302,7 @@ export const userTableServerTool: BaseServerTool<UserTableArgs, UserTableResult>
297302 const requestId = generateId ( ) . slice ( 0 , 8 )
298303 assertNotAborted ( )
299304 const row = await insertRow (
300- { tableId : args . tableId , data : args . data , workspaceId } ,
305+ { tableId : args . tableId , data : args . data , workspaceId, userId : context . userId } ,
301306 table ,
302307 requestId
303308 )
@@ -328,7 +333,7 @@ export const userTableServerTool: BaseServerTool<UserTableArgs, UserTableResult>
328333 const requestId = generateId ( ) . slice ( 0 , 8 )
329334 assertNotAborted ( )
330335 const rows = await batchInsertRows (
331- { tableId : args . tableId , rows : args . rows , workspaceId } ,
336+ { tableId : args . tableId , rows : args . rows , workspaceId, userId : context . userId } ,
332337 table ,
333338 requestId
334339 )
@@ -749,7 +754,7 @@ export const userTableServerTool: BaseServerTool<UserTableArgs, UserTableResult>
749754 assertNotAborted ( )
750755 const requestId = generateId ( ) . slice ( 0 , 8 )
751756 const result = await replaceTableRows (
752- { tableId : table . id , rows : coerced , workspaceId } ,
757+ { tableId : table . id , rows : coerced , workspaceId, userId : context . userId } ,
753758 table ,
754759 requestId
755760 )
0 commit comments