We are writing a nodejs application which should execute some set of actions against SF org triggered by incoming http request coming from that org. Such request will contain base url and session id in a payload.
In order not to reinvent the wheel, we are thinking about calling standard SFDX utilities/commands (e.g. executing apex, deploying code etc.) right from inside that nodejs web app.
The challenge with such approach is how to authenticate a user in sfdx toolset having session id and base url. Typicall sfdx requires web browser based authentication, also can be configured using jwt tokens and connected app for e.g. ci purposes. There are also some dx plugins which let us log in by username/password combination. But we've found next to nothing so far in regards to triggering dx actions by session id. Are there any plugins available or other tricks to achieve this?
Any help would be appreciated.