|
1 | | -import { TypedResponse } from "@remix-run/server-runtime"; |
2 | | -import { assertExhaustive } from "@trigger.dev/core/utils"; |
3 | | -import { RunId } from "@trigger.dev/core/v3/isomorphic"; |
4 | | -import { |
5 | | - WorkerApiDebugLogBody, |
6 | | - WorkerApiRunAttemptStartResponseBody, |
7 | | -} from "@trigger.dev/core/v3/workers"; |
8 | | -import { z } from "zod"; |
9 | | -import { prisma } from "~/db.server"; |
10 | | -import { logger } from "~/services/logger.server"; |
11 | | -import { createActionApiRoute } from "~/services/routeBuilders/apiBuilder.server"; |
12 | | -import { recordRunDebugLog } from "~/v3/eventRepository/eventRepository.server"; |
13 | | - |
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; |
28 | | - |
29 | | -// try { |
30 | | -// const run = await prisma.taskRun.findFirst({ |
31 | | -// where: { |
32 | | -// friendlyId: params.runFriendlyId, |
33 | | -// runtimeEnvironmentId: authentication.environment.id, |
34 | | -// }, |
35 | | -// }); |
36 | | - |
37 | | -// if (!run) { |
38 | | -// throw new Response("You don't have permissions for this run", { status: 401 }); |
39 | | -// } |
40 | | - |
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 | | -// ); |
51 | | - |
52 | | -// if (eventResult.success) { |
53 | | -// return new Response(null, { status: 204 }); |
54 | | -// } |
55 | | - |
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 | | -// ); |
73 | | - |
74 | | -// export { action }; |
75 | | - |
76 | | -// Create a generic JSON action in remix |
77 | 1 | export function action() { |
78 | 2 | return new Response(null, { status: 204 }); |
79 | 3 | } |
0 commit comments