active_outbox 0.1.4 → 0.2.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 +4 -4
- data/README.md +3 -1
- data/lib/active_outbox/outboxable.rb +9 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bedb54017b2c61e07e141bf5d232694a1b27cdaa7a07bdad89e266a5f6f42e8c
|
4
|
+
data.tar.gz: 5bdda5254741aa6ce091da6557a17f5a9dc65abdb8cd7b8cf29c6653d2798f9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 828f4f6dd6aa3f48c5365be6b5fd378c3086c97adcecb5d87d8fbaeeb872623d481f385dff0f23cb45fba72dad289a06732d6a04289d0f7cbac71bdf5ec920c7
|
7
|
+
data.tar.gz: 905bc052f21285ea79724e6d552b26d714ff2fa03c00b39015c2048a5d2189af567e7910ac4ff755d9fe3122ffc811b734b16c53c01e46b72e8d44065daee605
|
data/README.md
CHANGED
@@ -63,6 +63,8 @@ Using the User model as an example, the default event names provided are:
|
|
63
63
|
- USER_UPDATED
|
64
64
|
- USER_DESTROYED
|
65
65
|
|
66
|
+
This will live under `ActiveOutbox::Events` wherever you include the `Outboxable` concern. The intent is to define it under `Object` for non-namespaced models, as well as under each model namespace that is encountered.
|
67
|
+
|
66
68
|
### Custom Events
|
67
69
|
If you want to persist a custom event other than the provided base events, you can do so.
|
68
70
|
```ruby
|
@@ -75,7 +77,7 @@ By default our Outbox migration has an `aggregate_identifier` field which serves
|
|
75
77
|
rails g active_outbox:model <optional model_name> --uuid
|
76
78
|
```
|
77
79
|
### Modularized Outbox Mappings
|
78
|
-
If more granularity is desired multiple outbox classes can be configured. Using the provided generators we can specify namespaces and the folder structure.
|
80
|
+
If more granularity is desired multiple outbox classes can be configured. Using the provided generators we can specify namespaces and the folder structure.
|
79
81
|
```bash
|
80
82
|
rails g active_outbox:model user_access/ --component-path packs/user_access
|
81
83
|
|
@@ -10,16 +10,21 @@ module ActiveOutbox
|
|
10
10
|
*namespace, klass = name.underscore.upcase.split('/')
|
11
11
|
namespace = namespace.reverse.join('.')
|
12
12
|
|
13
|
-
module_parent.const_set('
|
13
|
+
module_parent.const_set('ActiveOutbox', Module.new) unless module_parent.const_defined?('ActiveOutbox', false)
|
14
|
+
|
15
|
+
unless module_parent::ActiveOutbox.const_defined?('Events', false)
|
16
|
+
module_parent::ActiveOutbox.const_set('Events', Module.new)
|
17
|
+
end
|
14
18
|
|
15
19
|
{ create: 'CREATED', update: 'UPDATED', destroy: 'DESTROYED' }.each do |key, value|
|
16
20
|
const_name = "#{klass}_#{value}"
|
17
21
|
|
18
|
-
unless module_parent::Events.const_defined?(const_name)
|
19
|
-
module_parent::Events.const_set(const_name,
|
22
|
+
unless module_parent::ActiveOutbox::Events.const_defined?(const_name)
|
23
|
+
module_parent::ActiveOutbox::Events.const_set(const_name,
|
24
|
+
"#{const_name}#{namespace.blank? ? '' : '.'}#{namespace}")
|
20
25
|
end
|
21
26
|
|
22
|
-
event_name = module_parent::Events.const_get(const_name)
|
27
|
+
event_name = module_parent::ActiveOutbox::Events.const_get(const_name)
|
23
28
|
|
24
29
|
send("after_#{key}") { create_outbox!(key, event_name) }
|
25
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_outbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillermo Aguirre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-configurable
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
|
-
rubygems_version: 3.
|
79
|
+
rubygems_version: 3.5.9
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: A Transactional Outbox implementation for ActiveRecord
|