@@ -8,11 +8,44 @@ export type CurrentWorkerDeployment = Prettify<
8
8
NonNullable < Awaited < ReturnType < typeof findCurrentWorkerDeployment > > >
9
9
> ;
10
10
11
+ export type BackgroundWorkerTaskSlim = Prisma . BackgroundWorkerTaskGetPayload < {
12
+ select : {
13
+ id : true ;
14
+ friendlyId : true ;
15
+ slug : true ;
16
+ filePath : true ;
17
+ exportName : true ;
18
+ triggerSource : true ;
19
+ machineConfig : true ;
20
+ maxDurationInSeconds : true ;
21
+ } ;
22
+ } > ;
23
+
11
24
type WorkerDeploymentWithWorkerTasks = Prisma . WorkerDeploymentGetPayload < {
12
- include : {
25
+ select : {
26
+ id : true ;
27
+ imageReference : true ;
28
+ version : true ;
13
29
worker : {
14
- include : {
15
- tasks : true ;
30
+ select : {
31
+ id : true ;
32
+ friendlyId : true ;
33
+ version : true ;
34
+ sdkVersion : true ;
35
+ cliVersion : true ;
36
+ supportsLazyAttempts : true ;
37
+ tasks : {
38
+ select : {
39
+ id : true ;
40
+ friendlyId : true ;
41
+ slug : true ;
42
+ filePath : true ;
43
+ exportName : true ;
44
+ triggerSource : true ;
45
+ machineConfig : true ;
46
+ maxDurationInSeconds : true ;
47
+ } ;
48
+ } ;
16
49
} ;
17
50
} ;
18
51
} ;
@@ -21,18 +54,25 @@ type WorkerDeploymentWithWorkerTasks = Prisma.WorkerDeploymentGetPayload<{
21
54
export async function findCurrentWorkerDeployment (
22
55
environmentId : string
23
56
) : Promise < WorkerDeploymentWithWorkerTasks | undefined > {
24
- const promotion = await prisma . workerDeploymentPromotion . findUnique ( {
57
+ const promotion = await prisma . workerDeploymentPromotion . findFirst ( {
25
58
where : {
26
- environmentId_label : {
27
- environmentId,
28
- label : CURRENT_DEPLOYMENT_LABEL ,
29
- } ,
59
+ environmentId,
60
+ label : CURRENT_DEPLOYMENT_LABEL ,
30
61
} ,
31
- include : {
62
+ select : {
32
63
deployment : {
33
- include : {
64
+ select : {
65
+ id : true ,
66
+ imageReference : true ,
67
+ version : true ,
34
68
worker : {
35
- include : {
69
+ select : {
70
+ id : true ,
71
+ friendlyId : true ,
72
+ version : true ,
73
+ sdkVersion : true ,
74
+ cliVersion : true ,
75
+ supportsLazyAttempts : true ,
36
76
tasks : true ,
37
77
} ,
38
78
} ,
@@ -46,7 +86,10 @@ export async function findCurrentWorkerDeployment(
46
86
47
87
export async function findCurrentWorkerFromEnvironment (
48
88
environment : Pick < AuthenticatedEnvironment , "id" | "type" >
49
- ) : Promise < BackgroundWorker | null > {
89
+ ) : Promise < Pick <
90
+ BackgroundWorker ,
91
+ "id" | "friendlyId" | "version" | "sdkVersion" | "cliVersion" | "supportsLazyAttempts"
92
+ > | null > {
50
93
if ( environment . type === "DEVELOPMENT" ) {
51
94
const latestDevWorker = await prisma . backgroundWorker . findFirst ( {
52
95
where : {
@@ -66,7 +109,7 @@ export async function findCurrentWorkerFromEnvironment(
66
109
export async function getWorkerDeploymentFromWorker (
67
110
workerId : string
68
111
) : Promise < WorkerDeploymentWithWorkerTasks | undefined > {
69
- const worker = await prisma . backgroundWorker . findUnique ( {
112
+ const worker = await prisma . backgroundWorker . findFirst ( {
70
113
where : {
71
114
id : workerId ,
72
115
} ,
@@ -91,7 +134,7 @@ export async function getWorkerDeploymentFromWorker(
91
134
export async function getWorkerDeploymentFromWorkerTask (
92
135
workerTaskId : string
93
136
) : Promise < WorkerDeploymentWithWorkerTasks | undefined > {
94
- const workerTask = await prisma . backgroundWorkerTask . findUnique ( {
137
+ const workerTask = await prisma . backgroundWorkerTask . findFirst ( {
95
138
where : {
96
139
id : workerTaskId ,
97
140
} ,
0 commit comments