eventsimple 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +153 -113
- data/README.md +18 -0
- data/app/views/eventsimple/entities/show.html.erb +2 -2
- data/eventsimple.gemspec +1 -0
- data/lib/eventsimple/entity.rb +11 -0
- data/lib/eventsimple/event.rb +3 -1
- data/lib/eventsimple/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 638006c0e2d430bc3ef8e945b770495fecdfdf4eb96c2d7555c6f2b01d916884
|
4
|
+
data.tar.gz: b116ebfbc7fad79107f23236d249fcb1ece6a599cdd95b6489c9ca8c8dc4cf22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cf51f1c191bd05e022bd105f056082c1b70b76b51435d74a8e241c9b2b8519a6ae874f0dd206c76101742466120415cade893695304fe5e086d7048a33f07d3
|
7
|
+
data.tar.gz: 6a37c35600d9cec4e4507a3fffecf42789e9a1108ffb5b6fcbaa1dfa6ea08554f7004a8abe5db0ae4786c2cb563e21be24de3f0e78ce14c2d2f686e63a4c006d
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## Unreleased
|
8
8
|
|
9
|
+
## 1.3.0 - 2024-01-14
|
10
|
+
### Changed
|
11
|
+
- Prevent manual write access to the entity table by default. This is to prevent
|
12
|
+
accidental writes to the entity table. Use entity.enable_writes! to enable writes.
|
13
|
+
|
14
|
+
## 1.2.3 - 2024-01-11
|
15
|
+
### Changed
|
16
|
+
- Fix rendering of deleted events
|
17
|
+
|
9
18
|
## 1.2.2 - 2023-11-29
|
10
19
|
### Changed
|
11
20
|
- Add support for filtering events by aggregate model attributes.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eventsimple (1.
|
4
|
+
eventsimple (1.3.0)
|
5
5
|
dry-struct (~> 1.6)
|
6
6
|
dry-types (~> 1.7)
|
7
7
|
pg (~> 1.4)
|
@@ -11,75 +11,85 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
actioncable (7.
|
15
|
-
actionpack (= 7.
|
16
|
-
activesupport (= 7.
|
14
|
+
actioncable (7.1.2)
|
15
|
+
actionpack (= 7.1.2)
|
16
|
+
activesupport (= 7.1.2)
|
17
17
|
nio4r (~> 2.0)
|
18
18
|
websocket-driver (>= 0.6.1)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
zeitwerk (~> 2.6)
|
20
|
+
actionmailbox (7.1.2)
|
21
|
+
actionpack (= 7.1.2)
|
22
|
+
activejob (= 7.1.2)
|
23
|
+
activerecord (= 7.1.2)
|
24
|
+
activestorage (= 7.1.2)
|
25
|
+
activesupport (= 7.1.2)
|
25
26
|
mail (>= 2.7.1)
|
26
27
|
net-imap
|
27
28
|
net-pop
|
28
29
|
net-smtp
|
29
|
-
actionmailer (7.
|
30
|
-
actionpack (= 7.
|
31
|
-
actionview (= 7.
|
32
|
-
activejob (= 7.
|
33
|
-
activesupport (= 7.
|
30
|
+
actionmailer (7.1.2)
|
31
|
+
actionpack (= 7.1.2)
|
32
|
+
actionview (= 7.1.2)
|
33
|
+
activejob (= 7.1.2)
|
34
|
+
activesupport (= 7.1.2)
|
34
35
|
mail (~> 2.5, >= 2.5.4)
|
35
36
|
net-imap
|
36
37
|
net-pop
|
37
38
|
net-smtp
|
38
|
-
rails-dom-testing (~> 2.
|
39
|
-
actionpack (7.
|
40
|
-
actionview (= 7.
|
41
|
-
activesupport (= 7.
|
42
|
-
|
39
|
+
rails-dom-testing (~> 2.2)
|
40
|
+
actionpack (7.1.2)
|
41
|
+
actionview (= 7.1.2)
|
42
|
+
activesupport (= 7.1.2)
|
43
|
+
nokogiri (>= 1.8.5)
|
44
|
+
racc
|
45
|
+
rack (>= 2.2.4)
|
46
|
+
rack-session (>= 1.0.1)
|
43
47
|
rack-test (>= 0.6.3)
|
44
|
-
rails-dom-testing (~> 2.
|
45
|
-
rails-html-sanitizer (~> 1.
|
46
|
-
actiontext (7.
|
47
|
-
actionpack (= 7.
|
48
|
-
activerecord (= 7.
|
49
|
-
activestorage (= 7.
|
50
|
-
activesupport (= 7.
|
48
|
+
rails-dom-testing (~> 2.2)
|
49
|
+
rails-html-sanitizer (~> 1.6)
|
50
|
+
actiontext (7.1.2)
|
51
|
+
actionpack (= 7.1.2)
|
52
|
+
activerecord (= 7.1.2)
|
53
|
+
activestorage (= 7.1.2)
|
54
|
+
activesupport (= 7.1.2)
|
51
55
|
globalid (>= 0.6.0)
|
52
56
|
nokogiri (>= 1.8.5)
|
53
|
-
actionview (7.
|
54
|
-
activesupport (= 7.
|
57
|
+
actionview (7.1.2)
|
58
|
+
activesupport (= 7.1.2)
|
55
59
|
builder (~> 3.1)
|
56
|
-
erubi (~> 1.
|
57
|
-
rails-dom-testing (~> 2.
|
58
|
-
rails-html-sanitizer (~> 1.
|
59
|
-
activejob (7.
|
60
|
-
activesupport (= 7.
|
60
|
+
erubi (~> 1.11)
|
61
|
+
rails-dom-testing (~> 2.2)
|
62
|
+
rails-html-sanitizer (~> 1.6)
|
63
|
+
activejob (7.1.2)
|
64
|
+
activesupport (= 7.1.2)
|
61
65
|
globalid (>= 0.3.6)
|
62
|
-
activemodel (7.
|
63
|
-
activesupport (= 7.
|
64
|
-
activerecord (7.
|
65
|
-
activemodel (= 7.
|
66
|
-
activesupport (= 7.
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
66
|
+
activemodel (7.1.2)
|
67
|
+
activesupport (= 7.1.2)
|
68
|
+
activerecord (7.1.2)
|
69
|
+
activemodel (= 7.1.2)
|
70
|
+
activesupport (= 7.1.2)
|
71
|
+
timeout (>= 0.4.0)
|
72
|
+
activestorage (7.1.2)
|
73
|
+
actionpack (= 7.1.2)
|
74
|
+
activejob (= 7.1.2)
|
75
|
+
activerecord (= 7.1.2)
|
76
|
+
activesupport (= 7.1.2)
|
72
77
|
marcel (~> 1.0)
|
73
|
-
|
74
|
-
|
78
|
+
activesupport (7.1.2)
|
79
|
+
base64
|
80
|
+
bigdecimal
|
75
81
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
82
|
+
connection_pool (>= 2.2.5)
|
83
|
+
drb
|
76
84
|
i18n (>= 1.6, < 2)
|
77
85
|
minitest (>= 5.1)
|
86
|
+
mutex_m
|
78
87
|
tzinfo (~> 2.0)
|
79
|
-
addressable (2.8.
|
88
|
+
addressable (2.8.6)
|
80
89
|
public_suffix (>= 2.0.2, < 6.0)
|
81
90
|
ast (2.4.2)
|
82
|
-
base64 (0.
|
91
|
+
base64 (0.2.0)
|
92
|
+
bigdecimal (3.1.5)
|
83
93
|
builder (3.2.4)
|
84
94
|
bundle-audit (0.1.0)
|
85
95
|
bundler-audit
|
@@ -88,9 +98,12 @@ GEM
|
|
88
98
|
thor (~> 1.0)
|
89
99
|
coderay (1.1.3)
|
90
100
|
concurrent-ruby (1.2.2)
|
101
|
+
connection_pool (2.4.1)
|
91
102
|
crass (1.0.6)
|
92
103
|
date (3.3.4)
|
93
104
|
diff-lcs (1.5.0)
|
105
|
+
drb (2.2.0)
|
106
|
+
ruby2_keywords
|
94
107
|
dry-core (1.0.1)
|
95
108
|
concurrent-ruby (~> 1.0)
|
96
109
|
zeitwerk (~> 2.6)
|
@@ -104,19 +117,25 @@ GEM
|
|
104
117
|
dry-types (>= 1.7, < 2)
|
105
118
|
ice_nine (~> 0.11)
|
106
119
|
zeitwerk (~> 2.6)
|
107
|
-
dry-types (1.7.
|
120
|
+
dry-types (1.7.2)
|
121
|
+
bigdecimal (~> 3.0)
|
108
122
|
concurrent-ruby (~> 1.0)
|
109
123
|
dry-core (~> 1.0)
|
110
124
|
dry-inflector (~> 1.0)
|
111
125
|
dry-logic (~> 1.4)
|
112
126
|
zeitwerk (~> 2.6)
|
113
127
|
erubi (1.12.0)
|
114
|
-
|
128
|
+
factory_bot (6.4.5)
|
129
|
+
activesupport (>= 5.0.0)
|
130
|
+
factory_bot_rails (6.4.3)
|
131
|
+
factory_bot (~> 6.4)
|
132
|
+
railties (>= 5.0.0)
|
133
|
+
ffi (1.16.3)
|
115
134
|
formatador (1.1.0)
|
116
135
|
fuubar (2.5.1)
|
117
136
|
rspec-core (~> 3.0)
|
118
137
|
ruby-progressbar (~> 1.4)
|
119
|
-
git (1.
|
138
|
+
git (1.19.1)
|
120
139
|
addressable (~> 2.8)
|
121
140
|
rchardet (~> 1.8)
|
122
141
|
globalid (1.2.1)
|
@@ -138,16 +157,20 @@ GEM
|
|
138
157
|
i18n (1.14.1)
|
139
158
|
concurrent-ruby (~> 1.0)
|
140
159
|
ice_nine (0.11.2)
|
141
|
-
|
160
|
+
io-console (0.7.1)
|
161
|
+
irb (1.11.1)
|
162
|
+
rdoc
|
163
|
+
reline (>= 0.4.2)
|
164
|
+
json (2.7.1)
|
142
165
|
language_server-protocol (3.17.0.3)
|
143
166
|
lint_roller (1.1.0)
|
144
167
|
listen (3.8.0)
|
145
168
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
146
169
|
rb-inotify (~> 0.9, >= 0.9.10)
|
147
|
-
loofah (2.
|
170
|
+
loofah (2.22.0)
|
148
171
|
crass (~> 1.0.2)
|
149
172
|
nokogiri (>= 1.12.0)
|
150
|
-
lumberjack (1.2.
|
173
|
+
lumberjack (1.2.10)
|
151
174
|
mail (2.8.1)
|
152
175
|
mini_mime (>= 0.1.1)
|
153
176
|
net-imap
|
@@ -156,29 +179,30 @@ GEM
|
|
156
179
|
marcel (1.0.2)
|
157
180
|
method_source (1.0.0)
|
158
181
|
mini_mime (1.1.5)
|
159
|
-
minitest (5.
|
182
|
+
minitest (5.21.1)
|
183
|
+
mutex_m (0.2.0)
|
160
184
|
nenv (0.3.0)
|
161
|
-
net-imap (0.4.
|
185
|
+
net-imap (0.4.9.1)
|
162
186
|
date
|
163
187
|
net-protocol
|
164
188
|
net-pop (0.1.2)
|
165
189
|
net-protocol
|
166
190
|
net-protocol (0.2.2)
|
167
191
|
timeout
|
168
|
-
net-smtp (0.4.0)
|
192
|
+
net-smtp (0.4.0.1)
|
169
193
|
net-protocol
|
170
|
-
nio4r (2.
|
171
|
-
nokogiri (1.
|
194
|
+
nio4r (2.7.0)
|
195
|
+
nokogiri (1.16.0-arm64-darwin)
|
172
196
|
racc (~> 1.4)
|
173
|
-
nokogiri (1.
|
197
|
+
nokogiri (1.16.0-x86_64-linux)
|
174
198
|
racc (~> 1.4)
|
175
199
|
notiffany (0.1.3)
|
176
200
|
nenv (~> 0.1)
|
177
201
|
shellany (~> 0.0)
|
178
|
-
parallel (1.
|
202
|
+
parallel (1.24.0)
|
179
203
|
parse_a_changelog (1.3.0)
|
180
204
|
treetop (~> 1.6)
|
181
|
-
parser (3.
|
205
|
+
parser (3.3.0.3)
|
182
206
|
ast (~> 2.4.1)
|
183
207
|
racc
|
184
208
|
pg (1.5.4)
|
@@ -186,27 +210,34 @@ GEM
|
|
186
210
|
pry (0.14.2)
|
187
211
|
coderay (~> 1.1)
|
188
212
|
method_source (~> 1.0)
|
189
|
-
|
190
|
-
|
213
|
+
psych (5.1.2)
|
214
|
+
stringio
|
215
|
+
public_suffix (5.0.4)
|
216
|
+
puma (6.4.2)
|
191
217
|
nio4r (~> 2.0)
|
192
|
-
racc (1.7.
|
193
|
-
rack (
|
218
|
+
racc (1.7.3)
|
219
|
+
rack (3.0.8)
|
220
|
+
rack-session (2.0.0)
|
221
|
+
rack (>= 3.0.0)
|
194
222
|
rack-test (2.1.0)
|
195
223
|
rack (>= 1.3)
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
224
|
+
rackup (2.1.0)
|
225
|
+
rack (>= 3)
|
226
|
+
webrick (~> 1.8)
|
227
|
+
rails (7.1.2)
|
228
|
+
actioncable (= 7.1.2)
|
229
|
+
actionmailbox (= 7.1.2)
|
230
|
+
actionmailer (= 7.1.2)
|
231
|
+
actionpack (= 7.1.2)
|
232
|
+
actiontext (= 7.1.2)
|
233
|
+
actionview (= 7.1.2)
|
234
|
+
activejob (= 7.1.2)
|
235
|
+
activemodel (= 7.1.2)
|
236
|
+
activerecord (= 7.1.2)
|
237
|
+
activestorage (= 7.1.2)
|
238
|
+
activesupport (= 7.1.2)
|
208
239
|
bundler (>= 1.15.0)
|
209
|
-
railties (= 7.
|
240
|
+
railties (= 7.1.2)
|
210
241
|
rails-dom-testing (2.2.0)
|
211
242
|
activesupport (>= 5.0.0)
|
212
243
|
minitest
|
@@ -214,20 +245,25 @@ GEM
|
|
214
245
|
rails-html-sanitizer (1.6.0)
|
215
246
|
loofah (~> 2.21)
|
216
247
|
nokogiri (~> 1.14)
|
217
|
-
railties (7.
|
218
|
-
actionpack (= 7.
|
219
|
-
activesupport (= 7.
|
220
|
-
|
248
|
+
railties (7.1.2)
|
249
|
+
actionpack (= 7.1.2)
|
250
|
+
activesupport (= 7.1.2)
|
251
|
+
irb
|
252
|
+
rackup (>= 1.0.0)
|
221
253
|
rake (>= 12.2)
|
222
|
-
thor (~> 1.0)
|
223
|
-
zeitwerk (~> 2.
|
254
|
+
thor (~> 1.0, >= 1.2.2)
|
255
|
+
zeitwerk (~> 2.6)
|
224
256
|
rainbow (3.1.1)
|
225
|
-
rake (13.0
|
257
|
+
rake (13.1.0)
|
226
258
|
rb-fsevent (0.11.2)
|
227
259
|
rb-inotify (0.10.1)
|
228
260
|
ffi (~> 1.0)
|
229
261
|
rchardet (1.8.0)
|
230
|
-
|
262
|
+
rdoc (6.6.2)
|
263
|
+
psych (>= 4.0.0)
|
264
|
+
regexp_parser (2.9.0)
|
265
|
+
reline (0.4.2)
|
266
|
+
io-console (~> 0.5)
|
231
267
|
retriable (3.1.2)
|
232
268
|
rexml (3.2.6)
|
233
269
|
rspec (3.12.0)
|
@@ -242,7 +278,7 @@ GEM
|
|
242
278
|
rspec-mocks (3.12.6)
|
243
279
|
diff-lcs (>= 1.2.0, < 2.0)
|
244
280
|
rspec-support (~> 3.12.0)
|
245
|
-
rspec-rails (6.0
|
281
|
+
rspec-rails (6.1.0)
|
246
282
|
actionpack (>= 6.1)
|
247
283
|
activesupport (>= 6.1)
|
248
284
|
railties (>= 6.1)
|
@@ -251,65 +287,68 @@ GEM
|
|
251
287
|
rspec-mocks (~> 3.12)
|
252
288
|
rspec-support (~> 3.12)
|
253
289
|
rspec-support (3.12.1)
|
254
|
-
rubocop (1.
|
255
|
-
base64 (~> 0.1.1)
|
290
|
+
rubocop (1.59.0)
|
256
291
|
json (~> 2.3)
|
257
292
|
language_server-protocol (>= 3.17.0)
|
258
293
|
parallel (~> 1.10)
|
259
|
-
parser (>= 3.2.2.
|
294
|
+
parser (>= 3.2.2.4)
|
260
295
|
rainbow (>= 2.2.2, < 4.0)
|
261
296
|
regexp_parser (>= 1.8, < 3.0)
|
262
297
|
rexml (>= 3.2.5, < 4.0)
|
263
|
-
rubocop-ast (>= 1.
|
298
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
264
299
|
ruby-progressbar (~> 1.7)
|
265
300
|
unicode-display_width (>= 2.4.0, < 3.0)
|
266
|
-
rubocop-ast (1.
|
301
|
+
rubocop-ast (1.30.0)
|
267
302
|
parser (>= 3.2.1.0)
|
268
|
-
rubocop-capybara (2.
|
303
|
+
rubocop-capybara (2.20.0)
|
304
|
+
rubocop (~> 1.41)
|
305
|
+
rubocop-factory_bot (2.25.1)
|
269
306
|
rubocop (~> 1.41)
|
270
|
-
rubocop-
|
271
|
-
rubocop (
|
272
|
-
|
273
|
-
|
274
|
-
rubocop-ast (>= 0.4.0)
|
275
|
-
rubocop-rails (2.20.2)
|
307
|
+
rubocop-performance (1.20.2)
|
308
|
+
rubocop (>= 1.48.1, < 2.0)
|
309
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
310
|
+
rubocop-rails (2.23.1)
|
276
311
|
activesupport (>= 4.2.0)
|
277
312
|
rack (>= 1.1)
|
278
313
|
rubocop (>= 1.33.0, < 2.0)
|
279
|
-
|
280
|
-
|
314
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
315
|
+
rubocop-rspec (2.26.1)
|
316
|
+
rubocop (~> 1.40)
|
281
317
|
rubocop-capybara (~> 2.17)
|
282
318
|
rubocop-factory_bot (~> 2.22)
|
283
|
-
rubocop-vendor (0.
|
319
|
+
rubocop-vendor (0.13.0)
|
284
320
|
rubocop
|
285
321
|
ruby-progressbar (1.13.0)
|
322
|
+
ruby2_keywords (0.0.5)
|
286
323
|
shellany (0.0.1)
|
287
|
-
standard (1.
|
324
|
+
standard (1.33.0)
|
288
325
|
language_server-protocol (~> 3.17.0.2)
|
289
326
|
lint_roller (~> 1.0)
|
290
|
-
rubocop (~> 1.
|
327
|
+
rubocop (~> 1.59.0)
|
291
328
|
standard-custom (~> 1.0.0)
|
292
|
-
standard-performance (~> 1.
|
329
|
+
standard-performance (~> 1.3)
|
293
330
|
standard-custom (1.0.2)
|
294
331
|
lint_roller (~> 1.0)
|
295
332
|
rubocop (~> 1.50)
|
296
|
-
standard-performance (1.
|
333
|
+
standard-performance (1.3.1)
|
297
334
|
lint_roller (~> 1.1)
|
298
|
-
rubocop-performance (~> 1.
|
299
|
-
standard-rails (0.2
|
335
|
+
rubocop-performance (~> 1.20.2)
|
336
|
+
standard-rails (1.0.2)
|
300
337
|
lint_roller (~> 1.0)
|
301
|
-
rubocop-rails (~> 2.
|
302
|
-
|
338
|
+
rubocop-rails (~> 2.23.1)
|
339
|
+
stringio (3.1.0)
|
340
|
+
thor (1.3.0)
|
303
341
|
timeout (0.4.1)
|
304
342
|
treetop (1.6.12)
|
305
343
|
polyglot (~> 0.3)
|
306
344
|
tzinfo (2.0.6)
|
307
345
|
concurrent-ruby (~> 1.0)
|
308
|
-
unicode-display_width (2.
|
346
|
+
unicode-display_width (2.5.0)
|
347
|
+
webrick (1.8.1)
|
309
348
|
websocket-driver (0.7.6)
|
310
349
|
websocket-extensions (>= 0.1.0)
|
311
350
|
websocket-extensions (0.1.5)
|
312
|
-
ws-style (7.
|
351
|
+
ws-style (7.3.0)
|
313
352
|
rubocop-rspec (>= 2.2.0)
|
314
353
|
rubocop-vendor (>= 0.11)
|
315
354
|
standard (>= 1.30.1)
|
@@ -324,6 +363,7 @@ PLATFORMS
|
|
324
363
|
DEPENDENCIES
|
325
364
|
bundle-audit
|
326
365
|
eventsimple!
|
366
|
+
factory_bot_rails
|
327
367
|
fuubar
|
328
368
|
git
|
329
369
|
guard-rspec
|
data/README.md
CHANGED
@@ -342,6 +342,24 @@ Create a rake task to run the consumer
|
|
342
342
|
## Helper methods
|
343
343
|
Some convenience methods are provided to help with common use cases.
|
344
344
|
|
345
|
+
**`#enable_writes!`**
|
346
|
+
Write access on entities is disabled by default outside of writes via events. Use this method to enable writes on an entity.
|
347
|
+
|
348
|
+
```ruby
|
349
|
+
user = User.find_by(canonical_id: 'user-123')
|
350
|
+
user.enable_writes! do
|
351
|
+
user.reproject
|
352
|
+
user.save!
|
353
|
+
end
|
354
|
+
```
|
355
|
+
|
356
|
+
If you are using FactoryBot, you can add the following in your rails_helper.rb to enable writes on the entity:
|
357
|
+
```ruby
|
358
|
+
FactoryBot.define do
|
359
|
+
after(:build) { |model| model.enable_writes! if model.class.ancestors.include?(Eventsimple::Entity::InstanceMethods) }
|
360
|
+
end
|
361
|
+
``
|
362
|
+
|
345
363
|
**`#reproject(at: nil)`**
|
346
364
|
|
347
365
|
Reproject an entity from events (rebuilds in memory but does not persist the entity).
|
@@ -61,7 +61,7 @@
|
|
61
61
|
<th scope="row" colspan="2">Data</th>
|
62
62
|
</tr>
|
63
63
|
<% if @selected_event.data.present? %>
|
64
|
-
<% @selected_event.data.
|
64
|
+
<% @selected_event.data.to_hash.each do |attr_name, attr_value| %>
|
65
65
|
<tr>
|
66
66
|
<td> <%= attr_name %></td>
|
67
67
|
<td><code class="entity-property"><%= attr_value %></code></td>
|
@@ -72,7 +72,7 @@
|
|
72
72
|
<tr>
|
73
73
|
<th scope="row" colspan="2">Metadata</th>
|
74
74
|
</tr>
|
75
|
-
<% @selected_event.metadata.
|
75
|
+
<% @selected_event.metadata.to_hash.each do |attr_name, attr_value| %>
|
76
76
|
<tr>
|
77
77
|
<td> <%= attr_name %></td>
|
78
78
|
<td><code class="entity-property">: <%= attr_value %></code></td>
|
data/eventsimple.gemspec
CHANGED
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_runtime_dependency 'retriable', '~> 3.1'
|
31
31
|
|
32
32
|
spec.add_development_dependency 'bundle-audit'
|
33
|
+
spec.add_development_dependency 'factory_bot_rails'
|
33
34
|
spec.add_development_dependency 'fuubar'
|
34
35
|
spec.add_development_dependency 'git'
|
35
36
|
spec.add_development_dependency 'guard-rspec'
|
data/lib/eventsimple/entity.rb
CHANGED
@@ -11,6 +11,8 @@ module Eventsimple
|
|
11
11
|
autosave: false,
|
12
12
|
validate: false
|
13
13
|
|
14
|
+
after_initialize :readonly!
|
15
|
+
|
14
16
|
class_attribute :ignored_for_projection, default: []
|
15
17
|
|
16
18
|
class_attribute :_filter_attributes
|
@@ -32,6 +34,15 @@ module Eventsimple
|
|
32
34
|
attributes == reprojected.attributes
|
33
35
|
end
|
34
36
|
|
37
|
+
def enable_writes!(&block)
|
38
|
+
@readonly = false
|
39
|
+
|
40
|
+
if block
|
41
|
+
yield
|
42
|
+
@readonly = true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
35
46
|
def reproject(at: nil)
|
36
47
|
event_history = at ? events.where('created_at <= ?', at).load : events.load
|
37
48
|
ignore_props = (DEFAULT_IGNORE_PROPS + ignored_for_projection).map(&:to_s)
|
data/lib/eventsimple/event.rb
CHANGED
@@ -90,7 +90,9 @@ module Eventsimple
|
|
90
90
|
apply(aggregate)
|
91
91
|
|
92
92
|
# Persist!
|
93
|
+
aggregate.enable_writes!
|
93
94
|
aggregate.save!
|
95
|
+
aggregate.readonly!
|
94
96
|
|
95
97
|
self.aggregate = aggregate
|
96
98
|
end
|
@@ -104,7 +106,7 @@ module Eventsimple
|
|
104
106
|
end
|
105
107
|
|
106
108
|
def aggregate=(aggregate)
|
107
|
-
public_send("#{_aggregate_klass.model_name.element}=", aggregate)
|
109
|
+
public_send(:"#{_aggregate_klass.model_name.element}=", aggregate)
|
108
110
|
end
|
109
111
|
end
|
110
112
|
|
data/lib/eventsimple/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventsimple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zulfiqar Ali
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-struct
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: factory_bot_rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: fuubar
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|