File tree Expand file tree Collapse file tree 3 files changed +23
-7
lines changed
cli-v3/src/entryPoints/managed
runEngineWorker/supervisor Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change 11import {
2+ DebugLogPropertiesInput ,
23 WorkloadDebugLogRequestBody ,
34 WorkloadHttpClient ,
45} from "@trigger.dev/core/v3/runEngineWorker" ;
56import { RunnerEnv } from "./env.js" ;
7+ import { flattenAttributes } from "@trigger.dev/core/v3" ;
68
79export type SendDebugLogOptions = {
810 runId ?: string ;
911 message : string ;
1012 date ?: Date ;
11- properties ?: WorkloadDebugLogRequestBody [ "properties" ] ;
13+ properties ?: DebugLogPropertiesInput ;
1214 print ?: boolean ;
1315} ;
1416
@@ -46,10 +48,14 @@ export class RunLogger {
4648 console . log ( message , mergedProperties ) ;
4749 }
4850
51+ const flattenedProperties = flattenAttributes (
52+ mergedProperties
53+ ) satisfies WorkloadDebugLogRequestBody [ "properties" ] ;
54+
4955 this . httpClient . sendDebugLog ( runId , {
5056 message,
5157 time : date ?? new Date ( ) ,
52- properties : mergedProperties ,
58+ properties : flattenedProperties ,
5359 } ) ;
5460 }
5561}
Original file line number Diff line number Diff line change @@ -130,14 +130,24 @@ export const DebugLogPropertiesValue = z.union([
130130 z . string ( ) ,
131131 z . number ( ) ,
132132 z . boolean ( ) ,
133- z . array ( z . string ( ) . nullable ( ) ) ,
134- z . array ( z . number ( ) . nullable ( ) ) ,
135- z . array ( z . boolean ( ) . nullable ( ) ) ,
133+ z . array ( z . string ( ) . nullish ( ) ) ,
134+ z . array ( z . number ( ) . nullish ( ) ) ,
135+ z . array ( z . boolean ( ) . nullish ( ) ) ,
136136] ) ;
137137
138138export const DebugLogProperties = z . record ( z . string ( ) , DebugLogPropertiesValue . optional ( ) ) ;
139139export type DebugLogProperties = z . infer < typeof DebugLogProperties > ;
140140
141+ export const DebugLogPropertiesInput = z . record ( z . string ( ) , z . unknown ( ) ) ;
142+ export type DebugLogPropertiesInput = z . infer < typeof DebugLogPropertiesInput > ;
143+
144+ export const WorkerApiDebugLogBodyInput = z . object ( {
145+ time : z . coerce . date ( ) ,
146+ message : z . string ( ) ,
147+ properties : DebugLogPropertiesInput . optional ( ) ,
148+ } ) ;
149+ export type WorkerApiDebugLogBodyInput = z . infer < typeof WorkerApiDebugLogBodyInput > ;
150+
141151export const WorkerApiDebugLogBody = z . object ( {
142152 time : z . coerce . date ( ) ,
143153 message : z . string ( ) ,
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import {
1818 WaitReason ,
1919} from "./schemas.js" ;
2020import { CompletedWaitpoint } from "./runEngine.js" ;
21- import { DebugLogProperties } from "../runEngineWorker/index.js" ;
21+ import { DebugLogPropertiesInput } from "../runEngineWorker/index.js" ;
2222
2323export const AckCallbackResult = z . discriminatedUnion ( "success" , [
2424 z . object ( {
@@ -179,7 +179,7 @@ export const ExecutorToWorkerMessageCatalog = {
179179 message : z . object ( {
180180 version : z . literal ( "v1" ) . default ( "v1" ) ,
181181 message : z . string ( ) ,
182- properties : DebugLogProperties . optional ( ) ,
182+ properties : DebugLogPropertiesInput . optional ( ) ,
183183 } ) ,
184184 } ,
185185} ;
You can’t perform that action at this time.
0 commit comments