@@ -33,20 +33,20 @@ sdk.registerRuntimeFunctionDefinitionsAndFunctionDefinitions({
3333 ] ,
3434 runtimeName : "fib" ,
3535 } ,
36- //This param is optional and can be omitted
36+ //This param is optional and can be omitted
3737 handler : ( context : HerculesFunctionContext , number : bigint ) : bigint => {
38- console . log ( context )
39- console . log ( "Project id:" , context . projectId ) ;
40- console . log ( "Execution id:" , context . executionId ) ;
41- console . log ( "Matched configs:" , context . matchedConfig ) ; // matched configs for the current execution
38+ console . log ( context )
39+ console . log ( "Project id:" , context . projectId ) ;
40+ console . log ( "Execution id:" , context . executionId ) ;
41+ console . log ( "Matched configs:" , context . matchedConfig ) ; // matched configs for the current execution
4242
43- function fibonacci ( num : bigint ) : bigint {
44- if ( num <= 1 ) return num ;
45- return fibonacci ( num - 1n ) + fibonacci ( num - 2n ) ;
46- }
47-
48- return fibonacci ( number )
43+ function fibonacci ( num : bigint ) : bigint {
44+ if ( num <= 1 ) return num ;
45+ return fibonacci ( num - 1n ) + fibonacci ( num - 2n ) ;
4946 }
47+
48+ return fibonacci ( number )
49+ }
5050 }
5151)
5252
@@ -64,11 +64,13 @@ connectToSdk();
6464function connectToSdk ( ) {
6565 sdk . connect ( ) . then ( ( configs : HerculesActionProjectConfiguration [ ] ) => {
6666 console . log ( "SDK connected successfully" ) ;
67+
6768 sdk . dispatchEvent ( "test_flow" , configs [ 0 ] . projectId , "Hello, World! Configs loaded: " + configs . length ) . then ( ( ) => {
6869 console . log ( "Event dispatched successfully" ) ;
6970 } )
70- } ) . catch ( ( error ) => {
71- console . error ( "Error connecting SDK:" , error ) ;
71+ } ) . catch ( ( ) => {
72+ // will be handled by logger internally
73+ process . exit ( 1 )
7274 } )
7375
7476 sdk . onError ( ( error ) => {
0 commit comments