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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d241ba658c264d5ec48e241c59abe89811646109f07a1f900231d7963245bcad
4
- data.tar.gz: '0682d8ad85197f3049c481f3868ae87982991c913ffd8e5f3ae8185b2554a274'
3
+ metadata.gz: be47945174c82b64947b1f14951b66c9395b65caf4bcb221792f50cae38bf25a
4
+ data.tar.gz: 67b8254e1c2775f6909f29cb7779635d38412a3ec972c350ad49cb0e287d1131
5
5
  SHA512:
6
- metadata.gz: 0c7b9c72993a46d19c81307a94423e732b7eb0d433526cb9d32e9f7e70e54fa4eb36e3cf062eb3d77eebc9372955c8853ddbbb2b13ef9a22e711c0c7b09a9cad
7
- data.tar.gz: ac107aae848481b55309b9c4fc607dd42c505fc16c1a267657cba4852660ecd72c8de4dcc9036b8a09bcf99d0d7d4c75d6fca9a956ba53562b8769f2913801a3
6
+ metadata.gz: eddf0ed3f16dd28c3fbebe2d9170e763ddc40f785f2ecd752cecd56ef2b9c3bc96c3dd4d8361cf170a9f997025dfd52316b2b9b799fe09dcf2720955903c5240
7
+ data.tar.gz: 2fe89f93da8356a1f13e7b229f1a1137ddd0ee8c453c10858254097a42c1213e3e1dcdd23994eb2f4f16568e66ee696e3c0dfaeec0777f321931da98eca8691c
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.0.8
2
+
3
+ * Add `Protocol.insert_copy_from_domain_ctx!` to copy from `domain_ctx` to the `endpoint_ctx`.
4
+
1
5
  # 0.0.7
2
6
 
3
7
  * BREAKING: Remove `:domain_ctx_filter` in favor of `Controller.insert_copy_to_domain_ctx!`.
@@ -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: :domain_activity
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
@@ -1,5 +1,5 @@
1
1
  module Trailblazer
2
2
  class Endpoint
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
@@ -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.10)
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.2)
20
- actionpack (= 6.0.3.2)
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.2)
24
- actionpack (= 6.0.3.2)
25
- activejob (= 6.0.3.2)
26
- activerecord (= 6.0.3.2)
27
- activestorage (= 6.0.3.2)
28
- activesupport (= 6.0.3.2)
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.2)
31
- actionpack (= 6.0.3.2)
32
- actionview (= 6.0.3.2)
33
- activejob (= 6.0.3.2)
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.2)
37
- actionview (= 6.0.3.2)
38
- activesupport (= 6.0.3.2)
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.2)
44
- actionpack (= 6.0.3.2)
45
- activerecord (= 6.0.3.2)
46
- activestorage (= 6.0.3.2)
47
- activesupport (= 6.0.3.2)
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.2)
50
- activesupport (= 6.0.3.2)
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.2)
56
- activesupport (= 6.0.3.2)
55
+ activejob (6.0.3.4)
56
+ activesupport (= 6.0.3.4)
57
57
  globalid (>= 0.3.6)
58
- activemodel (6.0.3.2)
59
- activesupport (= 6.0.3.2)
60
- activerecord (6.0.3.2)
61
- activemodel (= 6.0.3.2)
62
- activesupport (= 6.0.3.2)
63
- activestorage (6.0.3.2)
64
- actionpack (= 6.0.3.2)
65
- activejob (= 6.0.3.2)
66
- activerecord (= 6.0.3.2)
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.2)
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.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.9.0)
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.5)
99
+ i18n (1.8.7)
100
100
  concurrent-ruby (~> 1.0)
101
101
  jwt (2.2.2)
102
- loofah (2.7.0)
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
- mini_portile2 (2.4.0)
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.2)
118
- nokogiri (1.10.10)
119
- mini_portile2 (~> 2.4.0)
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.2)
124
- actioncable (= 6.0.3.2)
125
- actionmailbox (= 6.0.3.2)
126
- actionmailer (= 6.0.3.2)
127
- actionpack (= 6.0.3.2)
128
- actiontext (= 6.0.3.2)
129
- actionview (= 6.0.3.2)
130
- activejob (= 6.0.3.2)
131
- activemodel (= 6.0.3.2)
132
- activerecord (= 6.0.3.2)
133
- activestorage (= 6.0.3.2)
134
- activesupport (= 6.0.3.2)
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.2)
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.2)
144
- actionpack (= 6.0.3.2)
145
- activesupport (= 6.0.3.2)
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.1)
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.1)
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.3)
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.3)
171
- trailblazer-activity (>= 0.8.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.16)
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.7)
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.0)
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.4
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/nil/", response.body
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.7
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: 2020-12-14 00:00:00.000000000 Z
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
- rubyforge_project:
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