Open ghost opened 9 months ago
Shouldn't mappings always be loaded and evaluated at load time? Instead of at run time?
Let me give an example of my use case:
In my prisma schema, I have two tables user
and user_type
where user
has a relation with user_type
.
Request body is fixed e.g.
"name": "abc",
"user_type": "admin"
If we want to get user
then in the workflow we need to provide the filters like where
, select
, etc.,
But to provide related records information we need to give where
clause something like this:
where:
name: <% inputs.body.name %>
user_type:
select:
name: <% inputs.body.user_type %>
We have two options here.
where
filter in the workflow for each entitymappings
to keep the workflow unchanges (in case of multiple clients using the same workflow) and mappings
can be kept separately for different clients. This will keep the main workflow same for all the clients, the variable part would be there in mappings
.So, the option 2 is only feasible if mappings
can take inputs
and outputs
.
Version Information
@godspeedsystems/core: 2.3.2
Current Behavior
We can't use inputs and outputs in mappings as placeholders. Currently, what is happening, inputs and outputs are getting evaluated loadtime, but at that time, inputs and outputs will be blank. So
id
is coming as blank. For example, sample mapping yaml:Expected Behavior
inputs and outputs should go as it is like a placeholder and should get evaluated at the runtime whenever any event is triggered and any workflow is executing.
So what should happen as per the above example, in mappings.sample and config.bname should be evaluated during loadtime because these are the constants but inputs and outputs should go as they are. These should get evaluated during the workflow execution.