Skip to content

Commit f14baeb

Browse files
authored
Fix variable injection (#39)
1 parent de0516f commit f14baeb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ const makeKey = (client: FluenceClient, serviceId: string, fnName: string) => {
7272
* @param { FluenceClient } client - The Fluence Client instance.
7373
* @param { string } serviceId - The identifier of service which would be used to make calls from Aquamarine
7474
* @param { string } fnName - The identifier of function which would be used to make calls from Aquamarine
75-
* @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
75+
* @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
7676
*/
7777
export const registerServiceFunction = (
7878
client: FluenceClient,
7979
serviceId: string,
8080
fnName: string,
81-
handler: (args: any[], tetraplets: SecurityTetraplet[][]) => any,
81+
handler: (args: any[], tetraplets: SecurityTetraplet[][]) => object | boolean | number | string,
8282
) => {
8383
const unregister = client.aquaCallHandler.on(serviceId, fnName, handler);
8484
handlersUnregistratorsMap.set(makeKey(client, serviceId, fnName), unregister);

src/internal/RequestFlowBuilder.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@ export class RequestFlowBuilder {
161161

162162
this.configHandler((h) => {
163163
h.on(loadVariablesService, loadVariablesFn, (args, _) => {
164-
return this.variables.get(args[0]) || {};
164+
if (this.variables.has(args[0])) {
165+
return this.variables.get(args[0]);
166+
}
167+
168+
throw new Error(`failed to inject variable: ${args[0]}`);
165169
});
166170
});
167171

0 commit comments

Comments
 (0)