@@ -199,14 +199,15 @@ export interface ServerActionResult<T = any> {
199199 */
200200export function createServerActions ( options : NextAdapterOptions ) {
201201 const dispatcher = new HttpDispatcher ( options . kernel ) ;
202+ const emptyContext = { request : undefined } ;
202203
203204 return {
204205 /**
205206 * Query records from an object
206207 */
207208 async query ( objectName : string , params ?: Record < string , any > ) : Promise < ServerActionResult > {
208209 try {
209- const result = await dispatcher . handleData ( `/${ objectName } ` , 'GET' , { } , params || { } , { } ) ;
210+ const result = await dispatcher . handleData ( `/${ objectName } ` , 'GET' , { } , params || { } , emptyContext ) ;
210211 if ( result . handled && result . response ) {
211212 return { success : true , data : result . response . body } ;
212213 }
@@ -221,7 +222,7 @@ export function createServerActions(options: NextAdapterOptions) {
221222 */
222223 async getById ( objectName : string , id : string ) : Promise < ServerActionResult > {
223224 try {
224- const result = await dispatcher . handleData ( `/${ objectName } /${ id } ` , 'GET' , { } , { } , { } ) ;
225+ const result = await dispatcher . handleData ( `/${ objectName } /${ id } ` , 'GET' , { } , { } , emptyContext ) ;
225226 if ( result . handled && result . response ) {
226227 return { success : true , data : result . response . body } ;
227228 }
@@ -236,7 +237,7 @@ export function createServerActions(options: NextAdapterOptions) {
236237 */
237238 async create ( objectName : string , data : Record < string , any > ) : Promise < ServerActionResult > {
238239 try {
239- const result = await dispatcher . handleData ( `/${ objectName } ` , 'POST' , data , { } , { } ) ;
240+ const result = await dispatcher . handleData ( `/${ objectName } ` , 'POST' , data , { } , emptyContext ) ;
240241 if ( result . handled && result . response ) {
241242 return { success : true , data : result . response . body } ;
242243 }
@@ -251,7 +252,7 @@ export function createServerActions(options: NextAdapterOptions) {
251252 */
252253 async update ( objectName : string , id : string , data : Record < string , any > ) : Promise < ServerActionResult > {
253254 try {
254- const result = await dispatcher . handleData ( `/${ objectName } /${ id } ` , 'PATCH' , data , { } , { } ) ;
255+ const result = await dispatcher . handleData ( `/${ objectName } /${ id } ` , 'PATCH' , data , { } , emptyContext ) ;
255256 if ( result . handled && result . response ) {
256257 return { success : true , data : result . response . body } ;
257258 }
@@ -266,7 +267,7 @@ export function createServerActions(options: NextAdapterOptions) {
266267 */
267268 async remove ( objectName : string , id : string ) : Promise < ServerActionResult > {
268269 try {
269- const result = await dispatcher . handleData ( `/${ objectName } /${ id } ` , 'DELETE' , { } , { } , { } ) ;
270+ const result = await dispatcher . handleData ( `/${ objectName } /${ id } ` , 'DELETE' , { } , { } , emptyContext ) ;
270271 if ( result . handled && result . response ) {
271272 return { success : true , data : result . response . body } ;
272273 }
@@ -281,7 +282,7 @@ export function createServerActions(options: NextAdapterOptions) {
281282 */
282283 async getMetadata ( path ?: string ) : Promise < ServerActionResult > {
283284 try {
284- const result = await dispatcher . handleMetadata ( path || '' , { } , 'GET' ) ;
285+ const result = await dispatcher . handleMetadata ( path || '' , emptyContext , 'GET' ) ;
285286 if ( result . handled && result . response ) {
286287 return { success : true , data : result . response . body } ;
287288 }
0 commit comments