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 1
1
import { DeserializedJson } from "../../schemas/json.js" ;
2
2
import { apiClientManager } from "../apiClientManager-api.js" ;
3
3
import { taskContext } from "../task-context-api.js" ;
4
+ import { getGlobal , registerGlobal } from "../utils/globals.js" ;
4
5
import { ApiRequestOptions } from "../zodfetch.js" ;
5
6
7
+ const API_NAME = "run-metadata" ;
8
+
6
9
export class RunMetadataAPI {
7
10
private static _instance ?: RunMetadataAPI ;
8
- private store : Record < string , DeserializedJson > | undefined ;
9
11
10
12
private constructor ( ) { }
11
13
@@ -17,8 +19,16 @@ export class RunMetadataAPI {
17
19
return this . _instance ;
18
20
}
19
21
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
+
20
30
public enterWithMetadata ( metadata : Record < string , DeserializedJson > ) : void {
21
- this . store = metadata ;
31
+ registerGlobal ( API_NAME , metadata ) ;
22
32
}
23
33
24
34
public current ( ) : Record < string , DeserializedJson > | undefined {
Original file line number Diff line number Diff line change
1
+ import { DeserializedJson } from "../../schemas/json.js" ;
1
2
import { ApiClientConfiguration } from "../apiClientManager/types.js" ;
2
3
import { Clock } from "../clock/clock.js" ;
3
4
import type { RuntimeManager } from "../runtime/manager.js" ;
@@ -54,4 +55,5 @@ type TriggerDotDevGlobalAPI = {
54
55
[ "task-catalog" ] ?: TaskCatalog ;
55
56
[ "task-context" ] ?: TaskContext ;
56
57
[ "api-client" ] ?: ApiClientConfiguration ;
58
+ [ "run-metadata" ] ?: Record < string , DeserializedJson > ;
57
59
} ;
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ export const runMetadataTask = task({
19
19
export const runMetadataChildTask = task ( {
20
20
id : "run-metadata-child-task" ,
21
21
run : async ( payload : any , { ctx } ) => {
22
+ logger . info ( "metadata" , { metadata : metadata . current ( ) } ) ;
23
+
22
24
await metadata . set ( "child" , "task" ) ;
23
25
24
26
logger . info ( "metadata" , { metadata : metadata . current ( ) } ) ;
You can’t perform that action at this time.
0 commit comments