Skip to content

Commit 9ea38eb

Browse files
committed
Don’t export RuntimeEnvironmentType from two core files. Was causing TS issue
1 parent bdb20a6 commit 9ea38eb

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { z } from "zod";
22
import { DeserializedJsonSchema } from "../../schemas/json.js";
3+
import type { RuntimeEnvironmentType as DBRuntimeEnvironmentType } from "@trigger.dev/database";
4+
5+
export type Enum<T extends string> = { [K in T]: K };
36

47
export const RunMetadataUpdateOperation = z.object({
58
type: z.literal("update"),
@@ -411,11 +414,16 @@ export const SerializedError = z.object({
411414

412415
export type SerializedError = z.infer<typeof SerializedError>;
413416

414-
export const RuntimeEnvironmentTypeSchema = z.enum([
415-
"PRODUCTION",
416-
"STAGING",
417-
"DEVELOPMENT",
418-
"PREVIEW",
419-
]);
417+
export const RuntimeEnvironmentType = {
418+
PRODUCTION: "PRODUCTION",
419+
STAGING: "STAGING",
420+
DEVELOPMENT: "DEVELOPMENT",
421+
PREVIEW: "PREVIEW",
422+
} satisfies Enum<DBRuntimeEnvironmentType>;
423+
424+
export type RuntimeEnvironmentType =
425+
(typeof RuntimeEnvironmentType)[keyof typeof RuntimeEnvironmentType];
420426

421-
export type RuntimeEnvironmentType = z.infer<typeof RuntimeEnvironmentTypeSchema>;
427+
export const RuntimeEnvironmentTypeSchema = z.enum(
428+
Object.values(RuntimeEnvironmentType) as [DBRuntimeEnvironmentType]
429+
);

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { z } from "zod";
2-
import { MachinePreset, TaskRunExecution } from "./common.js";
2+
import { Enum, MachinePreset, RuntimeEnvironmentType, TaskRunExecution } from "./common.js";
33
import { EnvironmentType } from "./schemas.js";
44
import type * as DB_TYPES from "@trigger.dev/database";
55

6-
type Enum<T extends string> = { [K in T]: K };
7-
86
export const TaskRunExecutionStatus = {
97
RUN_CREATED: "RUN_CREATED",
108
QUEUED: "QUEUED",
@@ -57,16 +55,6 @@ export const WaitpointStatus = z.enum(
5755
);
5856
export type WaitpointStatus = z.infer<typeof WaitpointStatus>;
5957

60-
export const RuntimeEnvironmentType = {
61-
PRODUCTION: "PRODUCTION",
62-
STAGING: "STAGING",
63-
DEVELOPMENT: "DEVELOPMENT",
64-
PREVIEW: "PREVIEW",
65-
} satisfies Enum<DB_TYPES.RuntimeEnvironmentType>;
66-
67-
export type RuntimeEnvironmentType =
68-
(typeof RuntimeEnvironmentType)[keyof typeof RuntimeEnvironmentType];
69-
7058
export type TaskEventEnvironment = {
7159
id: string;
7260
type: RuntimeEnvironmentType;

0 commit comments

Comments
 (0)