@@ -11,64 +11,69 @@ import { logger } from "~/services/logger.server";
1111import  {  createActionApiRoute  }  from  "~/services/routeBuilders/apiBuilder.server" ; 
1212import  {  recordRunDebugLog  }  from  "~/v3/eventRepository.server" ; 
1313
14- const  {  action }  =  createActionApiRoute ( 
15-   { 
16-     params : z . object ( { 
17-       runFriendlyId : z . string ( ) , 
18-     } ) , 
19-     body : WorkerApiDebugLogBody , 
20-     method : "POST" , 
21-   } , 
22-   async  ( { 
23-     authentication, 
24-     body, 
25-     params, 
26-   } ) : Promise < TypedResponse < WorkerApiRunAttemptStartResponseBody > >  =>  { 
27-     const  {  runFriendlyId }  =  params ; 
14+ //  const { action } = createActionApiRoute(
15+ //    {
16+ //      params: z.object({
17+ //        runFriendlyId: z.string(),
18+ //      }),
19+ //      body: WorkerApiDebugLogBody,
20+ //      method: "POST",
21+ //    },
22+ //    async ({
23+ //      authentication,
24+ //      body,
25+ //      params,
26+ //    }): Promise<TypedResponse<WorkerApiRunAttemptStartResponseBody>> => {
27+ //      const { runFriendlyId } = params;
2828
29-     try  { 
30-       const  run  =  await  prisma . taskRun . findFirst ( { 
31-         where : { 
32-           friendlyId : params . runFriendlyId , 
33-           runtimeEnvironmentId : authentication . environment . id , 
34-         } , 
35-       } ) ; 
29+ //      try {
30+ //        const run = await prisma.taskRun.findFirst({
31+ //          where: {
32+ //            friendlyId: params.runFriendlyId,
33+ //            runtimeEnvironmentId: authentication.environment.id,
34+ //          },
35+ //        });
3636
37-       if  ( ! run )  { 
38-         throw  new  Response ( "You don't have permissions for this run" ,  {  status : 401  } ) ; 
39-       } 
37+ //        if (!run) {
38+ //          throw new Response("You don't have permissions for this run", { status: 401 });
39+ //        }
4040
41-       const  eventResult  =  await  recordRunDebugLog ( 
42-         RunId . fromFriendlyId ( runFriendlyId ) , 
43-         body . message , 
44-         { 
45-           attributes : { 
46-             properties : body . properties , 
47-           } , 
48-           startTime : body . time , 
49-         } 
50-       ) ; 
41+ //        const eventResult = await recordRunDebugLog(
42+ //          RunId.fromFriendlyId(runFriendlyId),
43+ //          body.message,
44+ //          {
45+ //            attributes: {
46+ //              properties: body.properties,
47+ //            },
48+ //            startTime: body.time,
49+ //          }
50+ //        );
5151
52-       if  ( eventResult . success )  { 
53-         return  new  Response ( null ,  {  status : 204  } ) ; 
54-       } 
52+ //        if (eventResult.success) {
53+ //          return new Response(null, { status: 204 });
54+ //        }
5555
56-       switch  ( eventResult . code )  { 
57-         case  "FAILED_TO_RECORD_EVENT" :
58-           return  new  Response ( null ,  {  status : 400  } ) ;  // send a 400 to prevent retries 
59-         case  "RUN_NOT_FOUND" :
60-           return  new  Response ( null ,  {  status : 404  } ) ; 
61-         default :
62-           return  assertExhaustive ( eventResult . code ) ; 
63-       } 
64-     }  catch  ( error )  { 
65-       logger . error ( "Failed to record dev log" ,  { 
66-         environmentId : authentication . environment . id , 
67-         error, 
68-       } ) ; 
69-       throw  error ; 
70-     } 
71-   } 
72- ) ; 
56+ //        switch (eventResult.code) {
57+ //          case "FAILED_TO_RECORD_EVENT":
58+ //            return new Response(null, { status: 400 }); // send a 400 to prevent retries
59+ //          case "RUN_NOT_FOUND":
60+ //            return new Response(null, { status: 404 });
61+ //          default:
62+ //            return assertExhaustive(eventResult.code);
63+ //        }
64+ //      } catch (error) {
65+ //        logger.error("Failed to record dev log", {
66+ //          environmentId: authentication.environment.id,
67+ //          error,
68+ //        });
69+ //        throw error;
70+ //      }
71+ //    }
72+ //  );
7373
74- export  {  action  } ; 
74+ // export { action }; 
75+ 
76+ // Create a generic JSON action in remix 
77+ export  function  action ( )  { 
78+   return  new  Response ( null ,  {  status : 204  } ) ; 
79+ } 
0 commit comments