File tree Expand file tree Collapse file tree 7 files changed +26
-12
lines changed Expand file tree Collapse file tree 7 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ export const chunk: LifecycleExecutor = async (
8181
8282 await callbacks . onResult ( pack , result ) ;
8383 logger . debug (
84- `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } completed`
84+ `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } completed (captured: ${ Object . keys ( result . capture ?? { } ) . length } ) `
8585 ) ;
8686 } else {
8787 logger . debug (
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export const post: LifecycleExecutor = async (
5151
5252 await callbacks . onResult ( pack , result ) ;
5353 logger . debug (
54- `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } completed`
54+ `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } completed (captured: ${ Object . keys ( result . capture ?? { } ) . length } ) `
5555 ) ;
5656 } else {
5757 logger . debug (
Original file line number Diff line number Diff line change @@ -41,14 +41,17 @@ export const pre: LifecycleExecutor = async (
4141
4242 if ( output ) {
4343 const result = output ?. json ( ) as PluginOutput ;
44+ logger . debug (
45+ `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } DATA: ${ JSON . stringify ( result ) } `
46+ ) ;
4447
4548 if ( result . context ) {
4649 context [ `${ index } ` ] = result . context ;
4750 }
4851
4952 await callbacks . onResult ( pack , result ) ;
5053 logger . debug (
51- `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } completed`
54+ `[${ requestId } ] (${ LIFECYCLE_ID } ) pack ${ pack . name } completed (captured: ${ Object . keys ( result . capture ?? { } ) . length } ) `
5255 ) ;
5356 } else {
5457 logger . debug (
Original file line number Diff line number Diff line change @@ -41,9 +41,11 @@ export const run = async (
4141 logger . debug ( `[${ requestId } ] making request` ) ;
4242 const finalizedRequest = request . clone ( ) ;
4343 finalizedRequest . headers . set ( "x-tskl-bypass" , "1" ) ;
44- const rawResponse = await fetch ( finalizedRequest ) ;
4544 await pre ;
4645
46+ // resolve the pre hooks as late as possible
47+ const [ rawResponse ] = await Promise . all ( [ fetch ( finalizedRequest ) , pre ] ) ;
48+
4749 // GZIP headers are being handled by undici and must be stripped
4850 const newHeaders : Array < [ string , string ] > = [ ...rawResponse . headers . entries ( ) ]
4951 . map ( ( [ key , value ] ) => {
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ describe("Loading packs", () => {
6060 } ) ;
6161
6262 const t = taskless ( "test" , {
63- // logLevel: "debug",
63+ logLevel : "debug" ,
6464 logging : true ,
6565 log : {
6666 data : logData ,
@@ -113,18 +113,18 @@ describe("Loading packs", () => {
113113 await t . flush ( ) ;
114114
115115 const log = logs [ 0 ] ;
116- // console.log(JSON.stringify(logs, null, 2));
116+ console . log ( JSON . stringify ( logs , null , 2 ) ) ;
117117
118118 expect (
119119 log . dimensions . some (
120- ( d ) => d . name === "testpack/testPre" && d . value === "preTest "
120+ ( d ) => d . name === "testpack/testPre" && d . value === "test_pre_value "
121121 ) ,
122122 "Logs pre test capture"
123123 ) . toBe ( true ) ;
124124
125125 expect (
126126 log . dimensions . some (
127- ( d ) => d . name === "testpack/testPost" && d . value === "postTest "
127+ ( d ) => d . name === "testpack/testPost" && d . value === "test_post_value "
128128 ) ,
129129 "Logs post test capture"
130130 ) . toBe ( true ) ;
Original file line number Diff line number Diff line change 11{
22 "schema" : " pre2" ,
33 "name" : " testpack" ,
4- "version" : " 0.0.1" ,
5- "description" : " Test pack, never published to prod" ,
6- "permissions" : {},
7- "fields" : [],
4+ "version" : " 0.0.4" ,
5+ "description" : " Test / example pack, never published to prod" ,
6+ "permissions" : {
7+ "body" : true
8+ },
9+ "fields" : [
10+ {
11+ "name" : " testField" ,
12+ "type" : " string" ,
13+ "description" : " Test field that should exist in the lifecycle" ,
14+ "default" : " test_field_value"
15+ }
16+ ],
817 "charts" : []
918}
You can’t perform that action at this time.
0 commit comments