diff --git a/src/api.ts b/src/api.ts index 0e3bfa35..43445777 100644 --- a/src/api.ts +++ b/src/api.ts @@ -72,13 +72,13 @@ const makeKey = (client: FluenceClient, serviceId: string, fnName: string) => { * @param { FluenceClient } client - The Fluence Client instance. * @param { string } serviceId - The identifier of service which would be used to make calls from Aquamarine * @param { string } fnName - The identifier of function which would be used to make calls from Aquamarine - * @param { (args: any[], tetraplets: SecurityTetraplet[][]) => any } handler - The handler which would be called by Aquamarine infrastructure. The result is any object passed back to Aquamarine + * @param { (args: any[], tetraplets: SecurityTetraplet[][]) => object | boolean | number | string } handler - The handler which would be called by Aquamarine infrastructure. The result is any object passed back to Aquamarine */ export const registerServiceFunction = ( client: FluenceClient, serviceId: string, fnName: string, - handler: (args: any[], tetraplets: SecurityTetraplet[][]) => any, + handler: (args: any[], tetraplets: SecurityTetraplet[][]) => object | boolean | number | string, ) => { const unregister = client.aquaCallHandler.on(serviceId, fnName, handler); handlersUnregistratorsMap.set(makeKey(client, serviceId, fnName), unregister); diff --git a/src/internal/RequestFlowBuilder.ts b/src/internal/RequestFlowBuilder.ts index bce64d09..acb34de2 100644 --- a/src/internal/RequestFlowBuilder.ts +++ b/src/internal/RequestFlowBuilder.ts @@ -161,7 +161,11 @@ export class RequestFlowBuilder { this.configHandler((h) => { h.on(loadVariablesService, loadVariablesFn, (args, _) => { - return this.variables.get(args[0]) || {}; + if (this.variables.has(args[0])) { + return this.variables.get(args[0]); + } + + throw new Error(`failed to inject variable: ${args[0]}`); }); });