@@ -8,11 +8,44 @@ export type CurrentWorkerDeployment = Prettify<
88 NonNullable < Awaited < ReturnType < typeof findCurrentWorkerDeployment > > >
99> ;
1010
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+
1124type WorkerDeploymentWithWorkerTasks = Prisma . WorkerDeploymentGetPayload < {
12- include : {
25+ select : {
26+ id : true ;
27+ imageReference : true ;
28+ version : true ;
1329 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+ } ;
1649 } ;
1750 } ;
1851 } ;
@@ -21,18 +54,25 @@ type WorkerDeploymentWithWorkerTasks = Prisma.WorkerDeploymentGetPayload<{
2154export async function findCurrentWorkerDeployment (
2255 environmentId : string
2356) : Promise < WorkerDeploymentWithWorkerTasks | undefined > {
24- const promotion = await prisma . workerDeploymentPromotion . findUnique ( {
57+ const promotion = await prisma . workerDeploymentPromotion . findFirst ( {
2558 where : {
26- environmentId_label : {
27- environmentId,
28- label : CURRENT_DEPLOYMENT_LABEL ,
29- } ,
59+ environmentId,
60+ label : CURRENT_DEPLOYMENT_LABEL ,
3061 } ,
31- include : {
62+ select : {
3263 deployment : {
33- include : {
64+ select : {
65+ id : true ,
66+ imageReference : true ,
67+ version : true ,
3468 worker : {
35- include : {
69+ select : {
70+ id : true ,
71+ friendlyId : true ,
72+ version : true ,
73+ sdkVersion : true ,
74+ cliVersion : true ,
75+ supportsLazyAttempts : true ,
3676 tasks : true ,
3777 } ,
3878 } ,
@@ -46,7 +86,10 @@ export async function findCurrentWorkerDeployment(
4686
4787export async function findCurrentWorkerFromEnvironment (
4888 environment : Pick < AuthenticatedEnvironment , "id" | "type" >
49- ) : Promise < BackgroundWorker | null > {
89+ ) : Promise < Pick <
90+ BackgroundWorker ,
91+ "id" | "friendlyId" | "version" | "sdkVersion" | "cliVersion" | "supportsLazyAttempts"
92+ > | null > {
5093 if ( environment . type === "DEVELOPMENT" ) {
5194 const latestDevWorker = await prisma . backgroundWorker . findFirst ( {
5295 where : {
@@ -66,7 +109,7 @@ export async function findCurrentWorkerFromEnvironment(
66109export async function getWorkerDeploymentFromWorker (
67110 workerId : string
68111) : Promise < WorkerDeploymentWithWorkerTasks | undefined > {
69- const worker = await prisma . backgroundWorker . findUnique ( {
112+ const worker = await prisma . backgroundWorker . findFirst ( {
70113 where : {
71114 id : workerId ,
72115 } ,
@@ -91,7 +134,7 @@ export async function getWorkerDeploymentFromWorker(
91134export async function getWorkerDeploymentFromWorkerTask (
92135 workerTaskId : string
93136) : Promise < WorkerDeploymentWithWorkerTasks | undefined > {
94- const workerTask = await prisma . backgroundWorkerTask . findUnique ( {
137+ const workerTask = await prisma . backgroundWorkerTask . findFirst ( {
95138 where : {
96139 id : workerTaskId ,
97140 } ,
0 commit comments