File tree Expand file tree Collapse file tree 4 files changed +21
-2
lines changed
references/v3-catalog/src/trigger Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @trigger.dev/core " : patch
3+ ---
4+
5+ fix: run metadata not working when using npx/pnpm dlx
Original file line number Diff line number Diff line change 11import { DeserializedJson } from "../../schemas/json.js" ;
22import { apiClientManager } from "../apiClientManager-api.js" ;
33import { taskContext } from "../task-context-api.js" ;
4+ import { getGlobal , registerGlobal } from "../utils/globals.js" ;
45import { ApiRequestOptions } from "../zodfetch.js" ;
56
7+ const API_NAME = "run-metadata" ;
8+
69export class RunMetadataAPI {
710 private static _instance ?: RunMetadataAPI ;
8- private store : Record < string , DeserializedJson > | undefined ;
911
1012 private constructor ( ) { }
1113
@@ -17,8 +19,16 @@ export class RunMetadataAPI {
1719 return this . _instance ;
1820 }
1921
22+ get store ( ) : Record < string , DeserializedJson > | undefined {
23+ return getGlobal ( API_NAME ) ;
24+ }
25+
26+ set store ( value : Record < string , DeserializedJson > | undefined ) {
27+ registerGlobal ( API_NAME , value , true ) ;
28+ }
29+
2030 public enterWithMetadata ( metadata : Record < string , DeserializedJson > ) : void {
21- this . store = metadata ;
31+ registerGlobal ( API_NAME , metadata ) ;
2232 }
2333
2434 public current ( ) : Record < string , DeserializedJson > | undefined {
Original file line number Diff line number Diff line change 1+ import { DeserializedJson } from "../../schemas/json.js" ;
12import { ApiClientConfiguration } from "../apiClientManager/types.js" ;
23import { Clock } from "../clock/clock.js" ;
34import type { RuntimeManager } from "../runtime/manager.js" ;
@@ -54,4 +55,5 @@ type TriggerDotDevGlobalAPI = {
5455 [ "task-catalog" ] ?: TaskCatalog ;
5556 [ "task-context" ] ?: TaskContext ;
5657 [ "api-client" ] ?: ApiClientConfiguration ;
58+ [ "run-metadata" ] ?: Record < string , DeserializedJson > ;
5759} ;
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ export const runMetadataTask = task({
1919export const runMetadataChildTask = task ( {
2020 id : "run-metadata-child-task" ,
2121 run : async ( payload : any , { ctx } ) => {
22+ logger . info ( "metadata" , { metadata : metadata . current ( ) } ) ;
23+
2224 await metadata . set ( "child" , "task" ) ;
2325
2426 logger . info ( "metadata" , { metadata : metadata . current ( ) } ) ;
You can’t perform that action at this time.
0 commit comments