trailblazer-endpoint 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/lib/trailblazer/endpoint/protocol/controller.rb +12 -3
- data/lib/trailblazer/endpoint/version.rb +1 -1
- data/test/rails-app/Gemfile.lock +71 -70
- data/test/rails-app/app/controllers/application_controller/web.rb +1 -0
- data/test/rails-app/app/controllers/songs_controller.rb +9 -0
- data/test/rails-app/config/routes.rb +1 -0
- data/test/rails-app/test/controllers/songs_controller_test.rb +6 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be47945174c82b64947b1f14951b66c9395b65caf4bcb221792f50cae38bf25a
|
4
|
+
data.tar.gz: 67b8254e1c2775f6909f29cb7779635d38412a3ec972c350ad49cb0e287d1131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eddf0ed3f16dd28c3fbebe2d9170e763ddc40f785f2ecd752cecd56ef2b9c3bc96c3dd4d8361cf170a9f997025dfd52316b2b9b799fe09dcf2720955903c5240
|
7
|
+
data.tar.gz: 2fe89f93da8356a1f13e7b229f1a1137ddd0ee8c453c10858254097a42c1213e3e1dcdd23994eb2f4f16568e66ee696e3c0dfaeec0777f321931da98eca8691c
|
data/CHANGES.md
CHANGED
@@ -31,7 +31,7 @@ module Trailblazer
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def copy_suspend_data_to_endpoint_ctx(ctx, domain_ctx:, **)
|
34
|
-
ctx[:suspend_data] = domain_ctx[:suspend_data]
|
34
|
+
ctx[:suspend_data] = domain_ctx[:suspend_data] # FIXME: use {#insert_copy_from_domain_ctx!}
|
35
35
|
end
|
36
36
|
|
37
37
|
# FIXME: use Model() mechanics.
|
@@ -80,11 +80,20 @@ module Trailblazer
|
|
80
80
|
insert_copy_to_domain_ctx!(protocol, :process_model => :model)
|
81
81
|
end
|
82
82
|
|
83
|
-
def insert_copy_to_domain_ctx!(protocol, variables)
|
83
|
+
def insert_copy_to_domain_ctx!(protocol, variables, before: :domain_activity) # FIXME: `:before` untested!
|
84
84
|
variables.each do |original_name, domain_name|
|
85
85
|
protocol.module_eval do
|
86
86
|
pass ->(ctx, domain_ctx:, **) { domain_ctx[domain_name] = ctx[original_name] if ctx.key?(original_name) },
|
87
|
-
id: :"copy_[#{original_name.inspect}]_to_domain_ctx[#{domain_name.inspect}]", before:
|
87
|
+
id: :"copy_[#{original_name.inspect}]_to_domain_ctx[#{domain_name.inspect}]", before: before
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def insert_copy_from_domain_ctx!(protocol, variables, after: :domain_activity) # FIXME: `:after` untested!
|
93
|
+
variables.each do |domain_name, endpoint_name|
|
94
|
+
protocol.module_eval do
|
95
|
+
pass ->(ctx, domain_ctx:, **) { ctx[endpoint_name] = domain_ctx[domain_name] if domain_ctx.key?(domain_name) },
|
96
|
+
id: :"copy_[#{endpoint_name.inspect}]_from_domain_ctx[#{domain_name.inspect}]", after: after
|
88
97
|
end
|
89
98
|
end
|
90
99
|
end
|
data/test/rails-app/Gemfile.lock
CHANGED
@@ -3,8 +3,8 @@ PATH
|
|
3
3
|
specs:
|
4
4
|
trailblazer-workflow (0.0.8)
|
5
5
|
trailblazer-activity
|
6
|
-
trailblazer-activity-implementation
|
7
|
-
trailblazer-developer (>= 0.0.
|
6
|
+
trailblazer-activity-implementation (>= 0.0.4)
|
7
|
+
trailblazer-developer (>= 0.0.17)
|
8
8
|
trailblazer-endpoint
|
9
9
|
|
10
10
|
PATH
|
@@ -16,56 +16,56 @@ PATH
|
|
16
16
|
GEM
|
17
17
|
remote: https://rubygems.org/
|
18
18
|
specs:
|
19
|
-
actioncable (6.0.3.
|
20
|
-
actionpack (= 6.0.3.
|
19
|
+
actioncable (6.0.3.4)
|
20
|
+
actionpack (= 6.0.3.4)
|
21
21
|
nio4r (~> 2.0)
|
22
22
|
websocket-driver (>= 0.6.1)
|
23
|
-
actionmailbox (6.0.3.
|
24
|
-
actionpack (= 6.0.3.
|
25
|
-
activejob (= 6.0.3.
|
26
|
-
activerecord (= 6.0.3.
|
27
|
-
activestorage (= 6.0.3.
|
28
|
-
activesupport (= 6.0.3.
|
23
|
+
actionmailbox (6.0.3.4)
|
24
|
+
actionpack (= 6.0.3.4)
|
25
|
+
activejob (= 6.0.3.4)
|
26
|
+
activerecord (= 6.0.3.4)
|
27
|
+
activestorage (= 6.0.3.4)
|
28
|
+
activesupport (= 6.0.3.4)
|
29
29
|
mail (>= 2.7.1)
|
30
|
-
actionmailer (6.0.3.
|
31
|
-
actionpack (= 6.0.3.
|
32
|
-
actionview (= 6.0.3.
|
33
|
-
activejob (= 6.0.3.
|
30
|
+
actionmailer (6.0.3.4)
|
31
|
+
actionpack (= 6.0.3.4)
|
32
|
+
actionview (= 6.0.3.4)
|
33
|
+
activejob (= 6.0.3.4)
|
34
34
|
mail (~> 2.5, >= 2.5.4)
|
35
35
|
rails-dom-testing (~> 2.0)
|
36
|
-
actionpack (6.0.3.
|
37
|
-
actionview (= 6.0.3.
|
38
|
-
activesupport (= 6.0.3.
|
36
|
+
actionpack (6.0.3.4)
|
37
|
+
actionview (= 6.0.3.4)
|
38
|
+
activesupport (= 6.0.3.4)
|
39
39
|
rack (~> 2.0, >= 2.0.8)
|
40
40
|
rack-test (>= 0.6.3)
|
41
41
|
rails-dom-testing (~> 2.0)
|
42
42
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
43
|
-
actiontext (6.0.3.
|
44
|
-
actionpack (= 6.0.3.
|
45
|
-
activerecord (= 6.0.3.
|
46
|
-
activestorage (= 6.0.3.
|
47
|
-
activesupport (= 6.0.3.
|
43
|
+
actiontext (6.0.3.4)
|
44
|
+
actionpack (= 6.0.3.4)
|
45
|
+
activerecord (= 6.0.3.4)
|
46
|
+
activestorage (= 6.0.3.4)
|
47
|
+
activesupport (= 6.0.3.4)
|
48
48
|
nokogiri (>= 1.8.5)
|
49
|
-
actionview (6.0.3.
|
50
|
-
activesupport (= 6.0.3.
|
49
|
+
actionview (6.0.3.4)
|
50
|
+
activesupport (= 6.0.3.4)
|
51
51
|
builder (~> 3.1)
|
52
52
|
erubi (~> 1.4)
|
53
53
|
rails-dom-testing (~> 2.0)
|
54
54
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
55
|
-
activejob (6.0.3.
|
56
|
-
activesupport (= 6.0.3.
|
55
|
+
activejob (6.0.3.4)
|
56
|
+
activesupport (= 6.0.3.4)
|
57
57
|
globalid (>= 0.3.6)
|
58
|
-
activemodel (6.0.3.
|
59
|
-
activesupport (= 6.0.3.
|
60
|
-
activerecord (6.0.3.
|
61
|
-
activemodel (= 6.0.3.
|
62
|
-
activesupport (= 6.0.3.
|
63
|
-
activestorage (6.0.3.
|
64
|
-
actionpack (= 6.0.3.
|
65
|
-
activejob (= 6.0.3.
|
66
|
-
activerecord (= 6.0.3.
|
58
|
+
activemodel (6.0.3.4)
|
59
|
+
activesupport (= 6.0.3.4)
|
60
|
+
activerecord (6.0.3.4)
|
61
|
+
activemodel (= 6.0.3.4)
|
62
|
+
activesupport (= 6.0.3.4)
|
63
|
+
activestorage (6.0.3.4)
|
64
|
+
actionpack (= 6.0.3.4)
|
65
|
+
activejob (= 6.0.3.4)
|
66
|
+
activerecord (= 6.0.3.4)
|
67
67
|
marcel (~> 0.3.1)
|
68
|
-
activesupport (6.0.3.
|
68
|
+
activesupport (6.0.3.4)
|
69
69
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
70
70
|
i18n (>= 0.7, < 2)
|
71
71
|
minitest (~> 5.1)
|
@@ -80,7 +80,7 @@ GEM
|
|
80
80
|
cells-erb (0.1.0)
|
81
81
|
cells (~> 4.0)
|
82
82
|
erbse (>= 0.1.1)
|
83
|
-
cells-rails (0.1.
|
83
|
+
cells-rails (0.1.3)
|
84
84
|
actionpack (>= 5.0)
|
85
85
|
cells (>= 4.1.6, < 5.0.0)
|
86
86
|
concurrent-ruby (1.1.7)
|
@@ -91,15 +91,15 @@ GEM
|
|
91
91
|
declarative-option (0.1.0)
|
92
92
|
erbse (0.1.4)
|
93
93
|
temple
|
94
|
-
erubi (1.
|
94
|
+
erubi (1.10.0)
|
95
95
|
globalid (0.4.2)
|
96
96
|
activesupport (>= 4.2.0)
|
97
97
|
hashie (4.1.0)
|
98
98
|
hirb (0.7.3)
|
99
|
-
i18n (1.8.
|
99
|
+
i18n (1.8.7)
|
100
100
|
concurrent-ruby (~> 1.0)
|
101
101
|
jwt (2.2.2)
|
102
|
-
loofah (2.
|
102
|
+
loofah (2.8.0)
|
103
103
|
crass (~> 1.0.2)
|
104
104
|
nokogiri (>= 1.5.9)
|
105
105
|
mail (2.7.1)
|
@@ -109,44 +109,44 @@ GEM
|
|
109
109
|
method_source (1.0.0)
|
110
110
|
mimemagic (0.3.5)
|
111
111
|
mini_mime (1.0.2)
|
112
|
-
|
113
|
-
minitest (5.14.2)
|
112
|
+
minitest (5.14.3)
|
114
113
|
minitest-line (0.6.5)
|
115
114
|
minitest (~> 5.0)
|
116
115
|
multi_json (1.15.0)
|
117
|
-
nio4r (2.5.
|
118
|
-
nokogiri (1.
|
119
|
-
|
116
|
+
nio4r (2.5.4)
|
117
|
+
nokogiri (1.11.1-x86_64-linux)
|
118
|
+
racc (~> 1.4)
|
119
|
+
racc (1.5.2)
|
120
120
|
rack (2.2.3)
|
121
121
|
rack-test (1.1.0)
|
122
122
|
rack (>= 1.0, < 3)
|
123
|
-
rails (6.0.3.
|
124
|
-
actioncable (= 6.0.3.
|
125
|
-
actionmailbox (= 6.0.3.
|
126
|
-
actionmailer (= 6.0.3.
|
127
|
-
actionpack (= 6.0.3.
|
128
|
-
actiontext (= 6.0.3.
|
129
|
-
actionview (= 6.0.3.
|
130
|
-
activejob (= 6.0.3.
|
131
|
-
activemodel (= 6.0.3.
|
132
|
-
activerecord (= 6.0.3.
|
133
|
-
activestorage (= 6.0.3.
|
134
|
-
activesupport (= 6.0.3.
|
123
|
+
rails (6.0.3.4)
|
124
|
+
actioncable (= 6.0.3.4)
|
125
|
+
actionmailbox (= 6.0.3.4)
|
126
|
+
actionmailer (= 6.0.3.4)
|
127
|
+
actionpack (= 6.0.3.4)
|
128
|
+
actiontext (= 6.0.3.4)
|
129
|
+
actionview (= 6.0.3.4)
|
130
|
+
activejob (= 6.0.3.4)
|
131
|
+
activemodel (= 6.0.3.4)
|
132
|
+
activerecord (= 6.0.3.4)
|
133
|
+
activestorage (= 6.0.3.4)
|
134
|
+
activesupport (= 6.0.3.4)
|
135
135
|
bundler (>= 1.3.0)
|
136
|
-
railties (= 6.0.3.
|
136
|
+
railties (= 6.0.3.4)
|
137
137
|
sprockets-rails (>= 2.0.0)
|
138
138
|
rails-dom-testing (2.0.3)
|
139
139
|
activesupport (>= 4.2.0)
|
140
140
|
nokogiri (>= 1.6)
|
141
141
|
rails-html-sanitizer (1.3.0)
|
142
142
|
loofah (~> 2.3)
|
143
|
-
railties (6.0.3.
|
144
|
-
actionpack (= 6.0.3.
|
145
|
-
activesupport (= 6.0.3.
|
143
|
+
railties (6.0.3.4)
|
144
|
+
actionpack (= 6.0.3.4)
|
145
|
+
activesupport (= 6.0.3.4)
|
146
146
|
method_source
|
147
147
|
rake (>= 0.8.7)
|
148
148
|
thor (>= 0.20.3, < 2.0)
|
149
|
-
rake (13.0.
|
149
|
+
rake (13.0.3)
|
150
150
|
representable (3.0.4)
|
151
151
|
declarative (< 0.1.0)
|
152
152
|
declarative-option (< 0.2.0)
|
@@ -154,7 +154,7 @@ GEM
|
|
154
154
|
sprockets (4.0.2)
|
155
155
|
concurrent-ruby (~> 1.0)
|
156
156
|
rack (> 1, < 3)
|
157
|
-
sprockets-rails (3.2.
|
157
|
+
sprockets-rails (3.2.2)
|
158
158
|
actionpack (>= 4.0)
|
159
159
|
activesupport (>= 4.0)
|
160
160
|
sprockets (>= 3.0.0)
|
@@ -163,18 +163,18 @@ GEM
|
|
163
163
|
thor (1.0.1)
|
164
164
|
thread_safe (0.3.6)
|
165
165
|
tilt (2.0.10)
|
166
|
-
trailblazer-activity (0.11.
|
166
|
+
trailblazer-activity (0.11.4)
|
167
167
|
trailblazer-context (>= 0.3.1, < 0.4.0)
|
168
168
|
trailblazer-activity-dsl-linear (0.3.4)
|
169
169
|
trailblazer-activity (>= 0.11.3, < 1.0.0)
|
170
|
-
trailblazer-activity-implementation (0.0.
|
171
|
-
trailblazer-activity (>= 0.
|
170
|
+
trailblazer-activity-implementation (0.0.4)
|
171
|
+
trailblazer-activity (>= 0.11.4)
|
172
172
|
trailblazer-activity-dsl-linear
|
173
173
|
trailblazer-cells (0.0.3)
|
174
174
|
cells (>= 4.1.0.rc1, < 5.0.0)
|
175
175
|
trailblazer-context (0.3.1)
|
176
176
|
hashie (~> 4.1)
|
177
|
-
trailblazer-developer (0.0.
|
177
|
+
trailblazer-developer (0.0.17)
|
178
178
|
hirb
|
179
179
|
representable
|
180
180
|
trailblazer-activity (>= 0.11.0, < 1.0.0)
|
@@ -183,16 +183,17 @@ GEM
|
|
183
183
|
trailblazer-activity (>= 0.11.2, < 1.0.0)
|
184
184
|
trailblazer-activity-dsl-linear (>= 0.3.2, < 1.0.0)
|
185
185
|
trailblazer-developer (>= 0.0.8)
|
186
|
-
tzinfo (1.2.
|
186
|
+
tzinfo (1.2.9)
|
187
187
|
thread_safe (~> 0.1)
|
188
188
|
uber (0.1.0)
|
189
189
|
websocket-driver (0.7.3)
|
190
190
|
websocket-extensions (>= 0.1.0)
|
191
191
|
websocket-extensions (0.1.5)
|
192
|
-
zeitwerk (2.4.
|
192
|
+
zeitwerk (2.4.2)
|
193
193
|
|
194
194
|
PLATFORMS
|
195
195
|
ruby
|
196
|
+
x86_64-linux
|
196
197
|
|
197
198
|
DEPENDENCIES
|
198
199
|
cells-erb
|
@@ -209,4 +210,4 @@ DEPENDENCIES
|
|
209
210
|
trailblazer-workflow!
|
210
211
|
|
211
212
|
BUNDLED WITH
|
212
|
-
2.1
|
213
|
+
2.2.1
|
@@ -32,6 +32,7 @@ class ApplicationController::Web < ApplicationController
|
|
32
32
|
end
|
33
33
|
|
34
34
|
Trailblazer::Endpoint::Protocol::Controller.insert_copy_to_domain_ctx!(self, :current_user => :current_user)
|
35
|
+
Trailblazer::Endpoint::Protocol::Controller.insert_copy_from_domain_ctx!(self, :model => :process_model)
|
35
36
|
end
|
36
37
|
#:protocol end
|
37
38
|
Policy = ->(domain_ctx) { domain_ctx[:params][:policy] == "false" ? false : true }
|
@@ -82,6 +82,15 @@ end
|
|
82
82
|
#:protocol_failure end
|
83
83
|
end
|
84
84
|
|
85
|
+
# {:process_model} is copied from {domain_ctx[:model]} via {#insert_copy_from_domain_ctx!}.
|
86
|
+
class Create1Controller < SongsController
|
87
|
+
def create
|
88
|
+
endpoint Song::Operation::Create do |ctx, endpoint_ctx:, **|
|
89
|
+
render html: endpoint_ctx[:process_model].inspect.html_safe
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
85
94
|
|
86
95
|
# endpoint_ctx
|
87
96
|
# :resume_data
|
@@ -17,6 +17,7 @@ Rails.application.routes.draw do
|
|
17
17
|
get "/", to: "home#dashboard"
|
18
18
|
|
19
19
|
post "/songs/serialize", to: "songs_controller/serialize#create"
|
20
|
+
post "/songs/copy_from_domain_ctx", to: "songs_controller/create1#create"
|
20
21
|
post "/songs/serialize1", to: "songs_controller/serialize1#create"
|
21
22
|
post "/songs/serialize2", to: "songs_controller/serialize2#create"
|
22
23
|
post "/songs/serialize3", to: "songs_controller/serialize3#create"
|
@@ -135,8 +135,13 @@ class SongsControllerTest < ActionDispatch::IntegrationTest
|
|
135
135
|
# {find_process_model: false} overrides controller setting
|
136
136
|
post "/songs/serialize72/", params: {id: 1}
|
137
137
|
assert_response 200
|
138
|
-
assert_equal "false/
|
138
|
+
assert_equal "false/false/", response.body
|
139
139
|
|
140
|
+
|
141
|
+
# {#insert_copy_from_domain_ctx!} provides {:process_model}
|
142
|
+
post "/songs/copy_from_domain_ctx", params: {id: 1}
|
143
|
+
assert_response 200
|
144
|
+
assert_equal %{#<struct Song id="1">}, response.body
|
140
145
|
end
|
141
146
|
|
142
147
|
test "sign_in" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-endpoint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trailblazer-activity-dsl-linear
|
@@ -206,8 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
- !ruby/object:Gem::Version
|
207
207
|
version: '0'
|
208
208
|
requirements: []
|
209
|
-
|
210
|
-
rubygems_version: 2.7.3
|
209
|
+
rubygems_version: 3.0.3
|
211
210
|
signing_key:
|
212
211
|
specification_version: 4
|
213
212
|
summary: Endpoints handle authentication, policies, run your domain operation and
|