Skip to content

Commit d6a44bc

Browse files
fix(core): inline @trigger.dev/database types to fix pruned monorepo build
The supervisor Docker build (turbo prune --scope=supervisor) fails because @trigger.dev/database Prisma types don't resolve in the pruned context. Replace type-only imports with inline string literal types derived from the Prisma schema, decoupling core from database at build time. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8326b9c commit d6a44bc

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

packages/core/src/v3/schemas/common.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { z } from "zod";
22
import { DeserializedJsonSchema } from "../../schemas/json.js";
3-
import type { RuntimeEnvironmentType as DBRuntimeEnvironmentType } from "@trigger.dev/database";
3+
4+
// Inline Prisma enum type — kept in sync with internal-packages/database/prisma/schema.prisma
5+
type DBRuntimeEnvironmentType = "PRODUCTION" | "STAGING" | "DEVELOPMENT" | "PREVIEW";
46

57
export type Enum<T extends string> = { [K in T]: K };
68

packages/core/src/v3/schemas/runEngine.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import { z } from "zod";
22
import { Enum, MachinePreset, RuntimeEnvironmentType, TaskRunExecution } from "./common.js";
33
import { EnvironmentType } from "./schemas.js";
4-
import type * as DB_TYPES from "@trigger.dev/database";
4+
5+
// Inline Prisma enum types — kept in sync with internal-packages/database/prisma/schema.prisma
6+
type DBTaskRunExecutionStatus = "RUN_CREATED" | "DELAYED" | "QUEUED" | "QUEUED_EXECUTING" | "PENDING_EXECUTING" | "EXECUTING" | "EXECUTING_WITH_WAITPOINTS" | "SUSPENDED" | "PENDING_CANCEL" | "FINISHED";
7+
type DBTaskRunStatus = "DELAYED" | "PENDING" | "PENDING_VERSION" | "WAITING_FOR_DEPLOY" | "DEQUEUED" | "EXECUTING" | "WAITING_TO_RESUME" | "RETRYING_AFTER_FAILURE" | "PAUSED" | "CANCELED" | "INTERRUPTED" | "COMPLETED_SUCCESSFULLY" | "COMPLETED_WITH_ERRORS" | "SYSTEM_FAILURE" | "CRASHED" | "EXPIRED" | "TIMED_OUT";
8+
type DBWaitpointType = "RUN" | "DATETIME" | "MANUAL" | "BATCH";
9+
type DBWaitpointStatus = "PENDING" | "COMPLETED";
10+
type DBCheckpointType = "DOCKER" | "KUBERNETES";
511

612
const anyString = z.custom<string & {}>((v) => typeof v === "string");
713

@@ -35,7 +41,7 @@ export const TaskRunExecutionStatus = {
3541
PENDING_CANCEL: "PENDING_CANCEL",
3642
FINISHED: "FINISHED",
3743
DELAYED: "DELAYED",
38-
} satisfies Enum<DB_TYPES.TaskRunExecutionStatus>;
44+
} satisfies Enum<DBTaskRunExecutionStatus>;
3945

4046
export type TaskRunExecutionStatus =
4147
(typeof TaskRunExecutionStatus)[keyof typeof TaskRunExecutionStatus];
@@ -58,7 +64,7 @@ export const TaskRunStatus = {
5864
CRASHED: "CRASHED",
5965
EXPIRED: "EXPIRED",
6066
TIMED_OUT: "TIMED_OUT",
61-
} satisfies Enum<DB_TYPES.TaskRunStatus>;
67+
} satisfies Enum<DBTaskRunStatus>;
6268

6369
export type TaskRunStatus = (typeof TaskRunStatus)[keyof typeof TaskRunStatus];
6470

@@ -67,16 +73,16 @@ export const WaitpointType = {
6773
DATETIME: "DATETIME",
6874
MANUAL: "MANUAL",
6975
BATCH: "BATCH",
70-
} satisfies Enum<DB_TYPES.WaitpointType>;
76+
} satisfies Enum<DBWaitpointType>;
7177

7278
export type WaitpointType = (typeof WaitpointType)[keyof typeof WaitpointType];
7379

7480
const WaitpointStatusValues = {
7581
PENDING: "PENDING",
7682
COMPLETED: "COMPLETED",
77-
} satisfies Enum<DB_TYPES.WaitpointStatus>;
83+
} satisfies Enum<DBWaitpointStatus>;
7884
export const WaitpointStatus = z.enum(
79-
Object.values(WaitpointStatusValues) as [DB_TYPES.WaitpointStatus]
85+
Object.values(WaitpointStatusValues) as [DBWaitpointStatus]
8086
);
8187
export type WaitpointStatus = z.infer<typeof WaitpointStatus>;
8288

@@ -177,7 +183,7 @@ export type CompleteRunAttemptResult = z.infer<typeof CompleteRunAttemptResult>;
177183
export const CheckpointTypeEnum = {
178184
DOCKER: "DOCKER",
179185
KUBERNETES: "KUBERNETES",
180-
} satisfies Enum<DB_TYPES.CheckpointType>;
186+
} satisfies Enum<DBCheckpointType>;
181187
export type CheckpointTypeEnum = (typeof CheckpointTypeEnum)[keyof typeof CheckpointTypeEnum];
182188

183189
export const CheckpointType = z.enum(Object.values(CheckpointTypeEnum) as [CheckpointTypeEnum]);

0 commit comments

Comments
 (0)