hecks 2.4.0 → 2.5.1

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: 97edfb74e99fd94bc3ffa0d9b4b9d9a6b1fafb257431fbe1bb128fdecb4bbf33
4
- data.tar.gz: 2e4741a23695049fd2639d484f9ca6476c6a89195f0c1be0c8cb5e2434a50f6f
3
+ metadata.gz: 8b63cae5fd3cc67091185210b80a7fa73e42977f28db96563ad46c50d37dc462
4
+ data.tar.gz: 0b5ec871c1ba7bf000bc2a65fdd308c9618a14ae07977fe76a2ed06a7e434399
5
5
  SHA512:
6
- metadata.gz: 2c016c201f4217462adc98d860308cce1ed47485abae6012d3a7220e4604bc83533ad8e2c302d94aeff9b476da59eb0f9bce431a9ca36ad9be259fe6a753690c
7
- data.tar.gz: a85c4aac72e327792fd65b7027fe0e07a8440ac952031351caece519952b25bd25d256722c415a3552e41869eed4eb807e9827d4a28e78de1112bb63b39d4af1
6
+ metadata.gz: 47a19c9674469250e49357f8ea57087721274c0a749a4006d3674e5c8d19babe8d57a692cc4750c7de34960a863ddad0596e7587abe8f9da2c6392e6488d5b52
7
+ data.tar.gz: 320fbf1791da47bb4247d56ab7f3943dd38ec08dff630eda886955ac24b80b4bf69f59040305f231735e96e586b6f6ca3b6c0068fc44d08995163834dc305dd3
@@ -48,8 +48,22 @@ module Hecks
48
48
  # vocabulary), not commands.
49
49
  PAYMENTS = "payments".freeze
50
50
 
51
+ # Scheduling sessions and taking registrations for them — recognised
52
+ # by declaration, not the literal aggregate names "Event" and
53
+ # "Registration". rust/host's event and registration routes dispatch
54
+ # these verbs; the aggregates they name are the event and the
55
+ # registration.
56
+ REGISTRATIONS = "registrations".freeze
57
+
58
+ # A business's connection to its payment processor: connect it, drop
59
+ # it, pause it, and switch taking payments on or off — recognised by
60
+ # declaration, not the literal name "PaymentConnection". rust/host's
61
+ # payments routes dispatch these verbs; the connection aggregate is
62
+ # the one `connect` names.
63
+ PAYMENT_CONNECTION = "payment_connection".freeze
64
+
51
65
  CONTRACTS = {
52
- AUTHORIZATION => {
66
+ AUTHORIZATION => {
53
67
  # every assignment an actor holds, current or historical
54
68
  assignments: :query,
55
69
  # the command that grants an actor a role
@@ -57,7 +71,7 @@ module Hecks
57
71
  # every grant of one role acting as another
58
72
  transitions: :query
59
73
  }.freeze,
60
- MEMBERSHIP => {
74
+ MEMBERSHIP => {
61
75
  # recognize a person who may eventually sign in
62
76
  admit: :command,
63
77
  # grant an admitted person a role (the access-grant half)
@@ -65,7 +79,7 @@ module Hecks
65
79
  # every admitted person, for the admin listing
66
80
  people: :query
67
81
  }.freeze,
68
- IDENTITY => {
82
+ IDENTITY => {
69
83
  # mint a stable identity, independent of how it authenticated
70
84
  register: :command,
71
85
  # associate an (issuer, subject) pair with that identity
@@ -73,7 +87,7 @@ module Hecks
73
87
  # look up the identity an authenticated pair resolves to
74
88
  resolve: :query
75
89
  }.freeze,
76
- NEWSLETTER => {
90
+ NEWSLETTER => {
77
91
  # a guest signs up; the aggregate it names is the subscriber
78
92
  subscribe: :command,
79
93
  # attach a display name to an existing subscriber
@@ -83,20 +97,42 @@ module Hecks
83
97
  # a subscriber leaves from the emailed link
84
98
  unsubscribe: :command
85
99
  }.freeze,
86
- NEWSLETTER_ISSUES => {
100
+ NEWSLETTER_ISSUES => {
87
101
  # mark an issue sent; the issue aggregate is the one it names
88
102
  send_issue: :command,
89
103
  # record one email handed to the mail provider; the delivery
90
104
  # aggregate is the one it names
91
105
  record_delivery: :command
92
106
  }.freeze,
93
- PAYMENTS => {
107
+ PAYMENTS => {
94
108
  # start a payment; the aggregate it names is the payment
95
109
  initiate: :command,
96
110
  # the processor reports the money arrived
97
111
  succeeded: :port_operation,
98
112
  # the processor reports the payment failed or expired
99
113
  failed: :port_operation
114
+ }.freeze,
115
+ REGISTRATIONS => {
116
+ # schedule a session; the aggregate it names is the event
117
+ schedule: :command,
118
+ # a guest asks for a place; the aggregate it names is the registration
119
+ request: :command
120
+ }.freeze,
121
+ PAYMENT_CONNECTION => {
122
+ # link the processor account; the aggregate it names is the connection
123
+ connect: :command,
124
+ # link a different processor account after a disconnect
125
+ reconnect: :command,
126
+ # drop the link
127
+ disconnect: :command,
128
+ # pause the connection without dropping it
129
+ suspend: :command,
130
+ # lift a pause
131
+ resume: :command,
132
+ # switch taking payments on
133
+ enable: :command,
134
+ # switch taking payments off
135
+ disable: :command
100
136
  }.freeze
101
137
  }.freeze
102
138
  end
@@ -305,6 +305,15 @@ Hecks.bluebook "Bluebook", version: "1" do
305
305
  member keyword: "provides", context: "Bluebook", at: "", named: "failed", kind: "text", required: "false", fills: "provides"
306
306
  member keyword: "provides", context: "Bluebook", at: "", named: "send_issue", kind: "text", required: "false", fills: "provides"
307
307
  member keyword: "provides", context: "Bluebook", at: "", named: "record_delivery", kind: "text", required: "false", fills: "provides"
308
+ member keyword: "provides", context: "Bluebook", at: "", named: "schedule", kind: "text", required: "false", fills: "provides"
309
+ member keyword: "provides", context: "Bluebook", at: "", named: "request", kind: "text", required: "false", fills: "provides"
310
+ member keyword: "provides", context: "Bluebook", at: "", named: "connect", kind: "text", required: "false", fills: "provides"
311
+ member keyword: "provides", context: "Bluebook", at: "", named: "reconnect", kind: "text", required: "false", fills: "provides"
312
+ member keyword: "provides", context: "Bluebook", at: "", named: "disconnect", kind: "text", required: "false", fills: "provides"
313
+ member keyword: "provides", context: "Bluebook", at: "", named: "suspend", kind: "text", required: "false", fills: "provides"
314
+ member keyword: "provides", context: "Bluebook", at: "", named: "resume", kind: "text", required: "false", fills: "provides"
315
+ member keyword: "provides", context: "Bluebook", at: "", named: "enable", kind: "text", required: "false", fills: "provides"
316
+ member keyword: "provides", context: "Bluebook", at: "", named: "disable", kind: "text", required: "false", fills: "provides"
308
317
  member keyword: "aggregate", context: "Bluebook", at: "1", named: "", kind: "text", required: "true", fills: "name"
309
318
  member keyword: "read_model", context: "Bluebook", at: "1", named: "", kind: "text", required: "true", fills: "name"
310
319
  member keyword: "policy", context: "Bluebook", at: "1", named: "", kind: "text", required: "true", fills: "name"
@@ -230,6 +230,52 @@ module Hecks
230
230
  }
231
231
  end
232
232
 
233
+ # Same seam as `newsletter` — which chapter answers scheduling sessions
234
+ # and taking registrations (`Registry#registrations_provider_for`), with
235
+ # its declared verbs qualified and the event and registration aggregates
236
+ # named off them. `{}` when nothing this domain attaches provides
237
+ # registrations.
238
+ # @param registry [Runtime::Registry] the booted registry `domain_name` is loaded in
239
+ # @param domain_name [String] the domain to export the registrations binding for
240
+ # @return [Hash{Symbol => String, nil}] `:provider` (name), `:schedule`, `:request`
241
+ # (qualified verbs), `:event_aggregate` and `:registration_aggregate` (each verb's own
242
+ # leading qualified aggregate name); `{}` if nothing this domain attaches provides
243
+ # registrations
244
+ def registrations(registry, domain_name)
245
+ provider = registry.registrations_provider_for(domain_name)
246
+ return {} unless provider
247
+
248
+ capability = Bluebook::Capabilities::REGISTRATIONS
249
+ schedule = provider.provided_verb(capability, :schedule)
250
+ request = provider.provided_verb(capability, :request)
251
+ {
252
+ provider: provider.name,
253
+ schedule: schedule,
254
+ request: request,
255
+ event_aggregate: schedule&.split(".")&.first,
256
+ registration_aggregate: request&.split(".")&.first
257
+ }
258
+ end
259
+
260
+ # Which chapter owns the payment-processor connection
261
+ # (`Registry#payment_connection_provider_for`), with its declared verbs
262
+ # qualified and the connection aggregate named off `connect`. `{}` when
263
+ # nothing this domain attaches provides payment_connection.
264
+ # @param registry [Runtime::Registry] the booted registry `domain_name` is loaded in
265
+ # @param domain_name [String] the domain to export the payment-connection binding for
266
+ # @return [Hash{Symbol => String, nil}] `:provider` (name), one qualified verb per contract key
267
+ # (`:connect`, `:reconnect`, `:disconnect`, `:suspend`, `:resume`, `:enable`, `:disable`) and
268
+ # `:aggregate` (`:connect`'s own leading qualified aggregate name); `{}` if nothing this
269
+ # domain attaches provides payment_connection
270
+ def payment_connection(registry, domain_name)
271
+ provider = registry.payment_connection_provider_for(domain_name)
272
+ return {} unless provider
273
+
274
+ capability = Bluebook::Capabilities::PAYMENT_CONNECTION
275
+ verbs = Bluebook::Capabilities::CONTRACTS.fetch(capability).keys.to_h { |key| [key, provider.provided_verb(capability, key)] }
276
+ { provider: provider.name, **verbs, aggregate: verbs[:connect]&.split(".")&.first }
277
+ end
278
+
233
279
  # Same seam as `newsletter` — which chapter takes payments
234
280
  # (`Registry#payments_provider_for`), with its declared verbs
235
281
  # qualified and the paying aggregate named off `initiate`. rust/host
@@ -403,6 +403,28 @@ module Hecks
403
403
  vendored_provider_for(domain, Bluebook::Capabilities::NEWSLETTER_ISSUES)
404
404
  end
405
405
 
406
+ # The chapter that answers scheduling sessions and taking registrations
407
+ # for `domain` — resolved the same way as `payments_provider_for`, by what
408
+ # it declares (`provides "registrations"`). Nil when none does.
409
+ #
410
+ # @param domain [String, Symbol] the domain whose registrations chapter is being resolved
411
+ # @return [Bluebook::Chapter, nil] the chapter that answers `domain`'s registrations,
412
+ # or nil if none does
413
+ def registrations_provider_for(domain)
414
+ vendored_provider_for(domain, Bluebook::Capabilities::REGISTRATIONS)
415
+ end
416
+
417
+ # The chapter that owns the business's payment-processor connection for
418
+ # `domain` — resolved by what it declares (`provides "payment_connection"`).
419
+ # Nil when none does.
420
+ #
421
+ # @param domain [String, Symbol] the domain whose payment-connection chapter is being resolved
422
+ # @return [Bluebook::Chapter, nil] the chapter that owns `domain`'s payment connection,
423
+ # or nil if none does
424
+ def payment_connection_provider_for(domain)
425
+ vendored_provider_for(domain, Bluebook::Capabilities::PAYMENT_CONNECTION)
426
+ end
427
+
406
428
  # The chapter that takes payments for `domain` — the domain's own
407
429
  # chapter, a framework member, or a vendored embryonaut bluebook it
408
430
  # 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.4.0".freeze
15
+ VERSION = "2.5.1".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.4.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Young