Skip to content

Commit ea78788

Browse files
committed
Fix schema issue
1 parent b085a41 commit ea78788

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

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

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -540,24 +540,8 @@ export const DeploymentTriggeredVia = z
540540

541541
export type DeploymentTriggeredVia = z.infer<typeof DeploymentTriggeredVia>;
542542

543-
export const TriggerSource = z
544-
.enum(["sdk", "api", "dashboard", "cli", "mcp", "schedule"])
545-
.or(anyString);
546-
547-
export type TriggerSource = z.infer<typeof TriggerSource>;
548-
549-
export const TriggerAction = z.enum(["trigger", "replay", "test"]).or(anyString);
550-
551-
export type TriggerAction = z.infer<typeof TriggerAction>;
552-
553-
export const RunAnnotations = z.object({
554-
triggerSource: TriggerSource,
555-
triggerAction: TriggerAction,
556-
rootTriggerSource: TriggerSource,
557-
rootScheduleId: z.string().optional(),
558-
});
559-
560-
export type RunAnnotations = z.infer<typeof RunAnnotations>;
543+
// TriggerSource, TriggerAction, and RunAnnotations are defined in runEngine.ts
544+
// They are re-exported through the schemas barrel (index.ts)
561545

562546
export const UpsertBranchRequestBody = z.object({
563547
git: GitMeta.optional(),

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
import { z } from "zod";
22
import { Enum, MachinePreset, RuntimeEnvironmentType, TaskRunExecution } from "./common.js";
33
import { EnvironmentType } from "./schemas.js";
4-
import { RunAnnotations } from "./api.js";
54
import type * as DB_TYPES from "@trigger.dev/database";
65

6+
const anyString = z.custom<string & {}>((v) => typeof v === "string");
7+
8+
export const TriggerSource = z
9+
.enum(["sdk", "api", "dashboard", "cli", "mcp", "schedule"])
10+
.or(anyString);
11+
12+
export type TriggerSource = z.infer<typeof TriggerSource>;
13+
14+
export const TriggerAction = z.enum(["trigger", "replay", "test"]).or(anyString);
15+
16+
export type TriggerAction = z.infer<typeof TriggerAction>;
17+
18+
export const RunAnnotations = z.object({
19+
triggerSource: TriggerSource,
20+
triggerAction: TriggerAction,
21+
rootTriggerSource: TriggerSource,
22+
rootScheduleId: z.string().optional(),
23+
});
24+
25+
export type RunAnnotations = z.infer<typeof RunAnnotations>;
26+
727
export const TaskRunExecutionStatus = {
828
RUN_CREATED: "RUN_CREATED",
929
QUEUED: "QUEUED",

0 commit comments

Comments
 (0)