File tree Expand file tree Collapse file tree 2 files changed +16
-20
lines changed
packages/core/src/v3/schemas Expand file tree Collapse file tree 2 files changed +16
-20
lines changed Original file line number Diff line number Diff line change 11import { z } from "zod" ;
22import { 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
47export const RunMetadataUpdateOperation = z . object ( {
58 type : z . literal ( "update" ) ,
@@ -411,11 +414,16 @@ export const SerializedError = z.object({
411414
412415export 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+ ) ;
Original file line number Diff line number Diff line change 11import { z } from "zod" ;
2- import { MachinePreset , TaskRunExecution } from "./common.js" ;
2+ import { Enum , MachinePreset , RuntimeEnvironmentType , TaskRunExecution } from "./common.js" ;
33import { EnvironmentType } from "./schemas.js" ;
44import type * as DB_TYPES from "@trigger.dev/database" ;
55
6- type Enum < T extends string > = { [ K in T ] : K } ;
7-
86export const TaskRunExecutionStatus = {
97 RUN_CREATED : "RUN_CREATED" ,
108 QUEUED : "QUEUED" ,
@@ -57,16 +55,6 @@ export const WaitpointStatus = z.enum(
5755) ;
5856export 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-
7058export type TaskEventEnvironment = {
7159 id : string ;
7260 type : RuntimeEnvironmentType ;
You can’t perform that action at this time.
0 commit comments