hecks 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fad5f64ba40ddec2720f013efc33d54e7ce5ebaf0926bc0670b642f91e53416
4
- data.tar.gz: a714cad37a3a9c02f2ece530fc2c417e019f3ac47e0f0b76fd2c336416c2d55d
3
+ metadata.gz: 07b56eefa1dd5cd2cc6308fa35aab4b8aba8af59da9418283d98a1235268e3c4
4
+ data.tar.gz: cc996a57a43dc3652a062c6af748545ec5846d50c08a43d372224e402c60fbf7
5
5
  SHA512:
6
- metadata.gz: 3ed37d25061346166c25415b92be46409ecefa3eb762fef81941c4758ecc3a2681241f29a4c819a28ad360ee0267919612f9fedb9c56c1be00d0a9a70d512e6e
7
- data.tar.gz: 7b6b0df13da60ef2a40a002d2a847b284164518c51363227c01f1d00e548e3d544b25a27d28053ff1af2469c6f802f4a5bd94103b6d2a9a9ed491710b9152217
6
+ metadata.gz: aab93180168cb073c8f65b05697cfe8c94f68d43a0516e2f8540d0c457d2ff238173fc223006f72e1681b870dcdd86b1ae65d1883d7d5375f62207b2b4a08b6d
7
+ data.tar.gz: 941f1214a2f1f7a144c57e8c0fc780d5444133973170afbc1d5dd6e646c0456feaaf73ac58da9382fc0b229af37a929e15eb8b77dd0dc36216187fd2341d8e04
@@ -32,6 +32,13 @@ module Hecks
32
32
  # "Newsletter". rust/host's newsletter routes dispatch these verbs
33
33
  # and read the subscribing aggregate's instances off `subscribe`.
34
34
  NEWSLETTER = "newsletter".freeze
35
+ # Sending an issue to the confirmed subscribers: the decision to send
36
+ # and the record of each email handed to the mail provider. A separate
37
+ # capability from `NEWSLETTER` so a chapter that only takes signups
38
+ # declares nothing more; rust/host serves the send route only when a
39
+ # chapter declares this one as well.
40
+ NEWSLETTER_ISSUES = "newsletter_issues".freeze
41
+
35
42
  # Taking a payment through an external processor: start one, then
36
43
  # hear the processor's verdict — recognised by declaration, not the
37
44
  # literal chapter name "Payments". rust/host's checkout and webhook
@@ -42,7 +49,7 @@ module Hecks
42
49
  PAYMENTS = "payments".freeze
43
50
 
44
51
  CONTRACTS = {
45
- AUTHORIZATION => {
52
+ AUTHORIZATION => {
46
53
  # every assignment an actor holds, current or historical
47
54
  assignments: :query,
48
55
  # the command that grants an actor a role
@@ -50,7 +57,7 @@ module Hecks
50
57
  # every grant of one role acting as another
51
58
  transitions: :query
52
59
  }.freeze,
53
- MEMBERSHIP => {
60
+ MEMBERSHIP => {
54
61
  # recognize a person who may eventually sign in
55
62
  admit: :command,
56
63
  # grant an admitted person a role (the access-grant half)
@@ -58,7 +65,7 @@ module Hecks
58
65
  # every admitted person, for the admin listing
59
66
  people: :query
60
67
  }.freeze,
61
- IDENTITY => {
68
+ IDENTITY => {
62
69
  # mint a stable identity, independent of how it authenticated
63
70
  register: :command,
64
71
  # associate an (issuer, subject) pair with that identity
@@ -66,7 +73,7 @@ module Hecks
66
73
  # look up the identity an authenticated pair resolves to
67
74
  resolve: :query
68
75
  }.freeze,
69
- NEWSLETTER => {
76
+ NEWSLETTER => {
70
77
  # a guest signs up; the aggregate it names is the subscriber
71
78
  subscribe: :command,
72
79
  # attach a display name to an existing subscriber
@@ -76,7 +83,14 @@ module Hecks
76
83
  # a subscriber leaves from the emailed link
77
84
  unsubscribe: :command
78
85
  }.freeze,
79
- PAYMENTS => {
86
+ NEWSLETTER_ISSUES => {
87
+ # mark an issue sent; the issue aggregate is the one it names
88
+ send_issue: :command,
89
+ # record one email handed to the mail provider; the delivery
90
+ # aggregate is the one it names
91
+ record_delivery: :command
92
+ }.freeze,
93
+ PAYMENTS => {
80
94
  # start a payment; the aggregate it names is the payment
81
95
  initiate: :command,
82
96
  # the processor reports the money arrived
@@ -303,6 +303,8 @@ Hecks.bluebook "Bluebook", version: "1" do
303
303
  member keyword: "provides", context: "Bluebook", at: "", named: "initiate", kind: "text", required: "false", fills: "provides"
304
304
  member keyword: "provides", context: "Bluebook", at: "", named: "succeeded", kind: "text", required: "false", fills: "provides"
305
305
  member keyword: "provides", context: "Bluebook", at: "", named: "failed", kind: "text", required: "false", fills: "provides"
306
+ member keyword: "provides", context: "Bluebook", at: "", named: "send_issue", kind: "text", required: "false", fills: "provides"
307
+ member keyword: "provides", context: "Bluebook", at: "", named: "record_delivery", kind: "text", required: "false", fills: "provides"
306
308
  member keyword: "aggregate", context: "Bluebook", at: "1", named: "", kind: "text", required: "true", fills: "name"
307
309
  member keyword: "read_model", context: "Bluebook", at: "1", named: "", kind: "text", required: "true", fills: "name"
308
310
  member keyword: "policy", context: "Bluebook", at: "1", named: "", kind: "text", required: "true", fills: "name"
@@ -202,6 +202,34 @@ module Hecks
202
202
  }
203
203
  end
204
204
 
205
+ # Which chapter answers sending a newsletter issue
206
+ # (`Registry#newsletter_issues_provider_for`), with its declared verbs
207
+ # qualified and the issue and delivery aggregates named off them.
208
+ # rust/host's send route reads this instead of naming
209
+ # Newsletter::Issue.Send and Newsletter::Delivery.Record. `{}` when
210
+ # nothing this domain attaches provides newsletter_issues.
211
+ # @param registry [Runtime::Registry] the booted registry `domain_name` is loaded in
212
+ # @param domain_name [String] the domain to export the issue-sending binding for
213
+ # @return [Hash{Symbol => String, nil}] `:provider` (name), `:send_issue`,
214
+ # `:record_delivery` (qualified verbs), `:issue_aggregate` and `:delivery_aggregate`
215
+ # (each verb's own leading qualified aggregate name); `{}` if nothing this domain
216
+ # attaches provides newsletter_issues
217
+ def newsletter_issues(registry, domain_name)
218
+ provider = registry.newsletter_issues_provider_for(domain_name)
219
+ return {} unless provider
220
+
221
+ capability = Bluebook::Capabilities::NEWSLETTER_ISSUES
222
+ send_issue = provider.provided_verb(capability, :send_issue)
223
+ record_delivery = provider.provided_verb(capability, :record_delivery)
224
+ {
225
+ provider: provider.name,
226
+ send_issue: send_issue,
227
+ record_delivery: record_delivery,
228
+ issue_aggregate: send_issue&.split(".")&.first,
229
+ delivery_aggregate: record_delivery&.split(".")&.first
230
+ }
231
+ end
232
+
205
233
  # Same seam as `newsletter` — which chapter takes payments
206
234
  # (`Registry#payments_provider_for`), with its declared verbs
207
235
  # qualified and the paying aggregate named off `initiate`. rust/host
@@ -392,6 +392,17 @@ module Hecks
392
392
  vendored_provider_for(domain, Bluebook::Capabilities::NEWSLETTER)
393
393
  end
394
394
 
395
+ # The chapter that answers sending a newsletter issue for `domain` —
396
+ # resolved the same way as `newsletter_provider_for`, by what it
397
+ # declares (`provides "newsletter_issues"`). Nil when none does.
398
+ #
399
+ # @param domain [String, Symbol] the domain whose issue-sending chapter is being resolved
400
+ # @return [Bluebook::Chapter, nil] the chapter that answers `domain`'s issue sending,
401
+ # or nil if none does
402
+ def newsletter_issues_provider_for(domain)
403
+ vendored_provider_for(domain, Bluebook::Capabilities::NEWSLETTER_ISSUES)
404
+ end
405
+
395
406
  # The chapter that takes payments for `domain` — the domain's own
396
407
  # chapter, a framework member, or a vendored embryonaut bluebook it
397
408
  # attaches, that declares `provides "payments"`. Nil when none does.
data/lib/hecks/version.rb CHANGED
@@ -12,5 +12,5 @@ module Hecks
12
12
  # it there, or even in the consuming Gemfile, never closed the gap,
13
13
  # because gemspec evaluation happens before anything Bundler
14
14
  # resolves is actually loadable yet.
15
- VERSION = "2.2.0".freeze
15
+ VERSION = "2.3.0".freeze
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hecks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Young