Skip to content

Commit

Permalink
minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Nov 26, 2024
1 parent c26423a commit fd24f14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/trailblazer/endpoint/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Runtime

# We run the Adapter here, which in turn will run your business operation, then the matcher
# or whatever you have configured.
def call(protocol, ctx, flow_options: {}, matcher_context:, default_matcher:, matcher_extension: Matcher.Extension(), &block) # TODO: test {flow_options}
def call(activity, ctx, flow_options: {}, matcher_context:, default_matcher:, matcher_extension: Matcher.Extension(), &block) # TODO: test {flow_options}
matcher = Trailblazer::Endpoint::Matcher::DSL.new.instance_exec(&block)

matcher_value = Trailblazer::Endpoint::Matcher::Value.new(default_matcher, matcher, matcher_context)
Expand All @@ -18,19 +18,19 @@ def call(protocol, ctx, flow_options: {}, matcher_context:, default_matcher:, ma

pipeline = Activity::TaskWrap::Pipeline.new(in_extension + [matcher_extension]) # DISCUSS: how and where to run the matcher, especially with an protocol.

container_activity = Activity::TaskWrap.container_activity_for(protocol, wrap_static: pipeline)
container_activity = Activity::TaskWrap.container_activity_for(activity, wrap_static: pipeline)

# Trailblazer::Activity::TaskWrap.invoke( # FIXME: run Advance using this, not its own wtf?/call invocation.
Trailblazer::Developer.wtf?( # FIXME: run Advance using this, not its own wtf?/call invocation.
protocol,
activity,
[
ctx,
flow_options.merge(matcher_value: matcher_value) # matchers will be executed in Adapter's taskWrap.
],

container_activity: container_activity,
exec_context: self,
# wrap_runtime: {protocol => ->(*) { snippet }} # TODO: use wrap_runtime once https://github.com/trailblazer/trailblazer-developer/issues/46 is fixed.
# wrap_runtime: {activity => ->(*) { snippet }} # TODO: use wrap_runtime once https://github.com/trailblazer/trailblazer-developer/issues/46 is fixed.
)
end
end # Runtime
Expand Down
4 changes: 1 addition & 3 deletions test/runtime_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Protocol < Trailblazer::Endpoint::Protocol
include T.def_steps(:authenticate, :policy)
end

it "{Runtime.call}" do
it "{Runtime.call} matcher block" do
default_matcher = {
success: ->(*) { raise },
not_found: ->(ctx, model:, **) { render "404, #{model} not found" },
Expand Down Expand Up @@ -67,8 +67,6 @@ class Protocol < Trailblazer::Endpoint::Protocol
# assert_equal @rendered, %(404, false not found)
end

#,mljnimh

# endpoint "bla", ctx: {} do
# success do |ctx, model:, **|
# render model.inspect
Expand Down

0 comments on commit fd24f14

Please sign in to comment.