Skip to content

Commit

Permalink
feat(funnel): add optional parameter to request to trigger pipes
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinRousselet committed Jul 15, 2024
1 parent 87be8bd commit 508ac72
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/api/funnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,9 @@ class Funnel {
*/
async executePluginRequest(request) {
try {
if (request.input.allowTriggerEvents) {
return await this.processRequest(request);
}
return await doAction(this.getController(request), request);
} catch (e) {
this.handleErrorDump(e);
Expand Down
10 changes: 9 additions & 1 deletion lib/api/request/requestInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const _body = "body\u200b";
const _headers = "headers\u200b";
const _controller = "controller\u200b";
const _action = "action\u200b";
const _allowTriggerEvents = "allowTriggerEvents\u200b";

// any property not listed here will be copied into
// RequestInput.args
Expand Down Expand Up @@ -155,6 +156,7 @@ export class RequestInput {
this[_body] = null;
this[_controller] = null;
this[_action] = null;
this[_allowTriggerEvents] = null;

// default value to null for former "resources" to avoid breaking
this.args = {};
Expand All @@ -181,6 +183,7 @@ export class RequestInput {
this.body = data.body;
this.controller = data.controller;
this.action = data.action;
this.allowTriggerEvents = data.allowTriggerEvents;
}

/**
Expand Down Expand Up @@ -263,7 +266,12 @@ export class RequestInput {
this[_action] = assert.assertString("action", str);
}
}

get allowTriggerEvents(): boolean | undefined {
return this[_allowTriggerEvents];
}
set allowTriggerEvents(bool: boolean) {
this[_allowTriggerEvents] = bool === true ? true : undefined;
}
/**
* Request body.
* In Http it's the request body parsed.
Expand Down

0 comments on commit 508ac72

Please sign in to comment.