eventsimple 1.1.3 → 1.2.1

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: 80288a15a3b05c634212479375312858866bdc7371cc74633c3ca59e23d97b1f
4
- data.tar.gz: d3a9129566b5080b8dd62bc25b1e44cd93e97d919c2e3e844a7519c31ebcfbff
3
+ metadata.gz: 985c47a587ea7f6476248e8c5b6257d51482f41832bb6055e6da514e4dbd8914
4
+ data.tar.gz: 809b1c8d0b3f21b4d4765cd06530e4dedea076ebd3c07b5a027d7822f5bb226f
5
5
  SHA512:
6
- metadata.gz: 6d66922352e0cc3f3115ec7dd648a84b7d2c739faf25ed871b634a3165ea67c459677e2958657f0469ee23dfa44ddfbabf447cb270ce93521d818d063357a075
7
- data.tar.gz: 32379b97f433cd15e6fb2e1cdb0eb85ec9a07ba09a2edefe303b785723d38d8b91788628055afa7ab1b3b6ee0d69c51b574afdd5f74875d2d96eb653635a518d
6
+ metadata.gz: 86d4bb8d7a529d14f287ad54242b2e3c7b305fb6092981e84412b9854bc8c76566d781e122147f9522a7a40da77d57d82a60757e441bedf307a8b72697f36727
7
+ data.tar.gz: 0e18b342e6ad42462e35101ff10a9890962cd540a3142c8d7cd8d9f87e2ee862d89fb8d9e52a01695728099f526caf14331a2ab4d9b1dd87bc517cb77af42821
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.2.1 - 2023-11-18
10
+ ### Changed
11
+ - Allow timestamp data in events to override default timestamps update.
12
+ - This allows us to create temporal events for example in the case of snapshots.
13
+
14
+ ## 1.2.0 - 2023-09-26
15
+ ### Changed
16
+ - Fix issue where the reactor worker might not work correctly for models not inheriting from ApplicationRecord.
17
+
9
18
  ## 1.1.3 - 2023-07-07
10
19
  ### Changed
11
20
  - Sidekiq is no longer a required dependency.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eventsimple (1.1.3)
4
+ eventsimple (1.2.1)
5
5
  dry-struct (~> 1.6)
6
6
  dry-types (~> 1.7)
7
7
  pg (~> 1.4)
@@ -11,74 +11,75 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actioncable (7.0.6)
15
- actionpack (= 7.0.6)
16
- activesupport (= 7.0.6)
14
+ actioncable (7.0.8)
15
+ actionpack (= 7.0.8)
16
+ activesupport (= 7.0.8)
17
17
  nio4r (~> 2.0)
18
18
  websocket-driver (>= 0.6.1)
19
- actionmailbox (7.0.6)
20
- actionpack (= 7.0.6)
21
- activejob (= 7.0.6)
22
- activerecord (= 7.0.6)
23
- activestorage (= 7.0.6)
24
- activesupport (= 7.0.6)
19
+ actionmailbox (7.0.8)
20
+ actionpack (= 7.0.8)
21
+ activejob (= 7.0.8)
22
+ activerecord (= 7.0.8)
23
+ activestorage (= 7.0.8)
24
+ activesupport (= 7.0.8)
25
25
  mail (>= 2.7.1)
26
26
  net-imap
27
27
  net-pop
28
28
  net-smtp
29
- actionmailer (7.0.6)
30
- actionpack (= 7.0.6)
31
- actionview (= 7.0.6)
32
- activejob (= 7.0.6)
33
- activesupport (= 7.0.6)
29
+ actionmailer (7.0.8)
30
+ actionpack (= 7.0.8)
31
+ actionview (= 7.0.8)
32
+ activejob (= 7.0.8)
33
+ activesupport (= 7.0.8)
34
34
  mail (~> 2.5, >= 2.5.4)
35
35
  net-imap
36
36
  net-pop
37
37
  net-smtp
38
38
  rails-dom-testing (~> 2.0)
39
- actionpack (7.0.6)
40
- actionview (= 7.0.6)
41
- activesupport (= 7.0.6)
39
+ actionpack (7.0.8)
40
+ actionview (= 7.0.8)
41
+ activesupport (= 7.0.8)
42
42
  rack (~> 2.0, >= 2.2.4)
43
43
  rack-test (>= 0.6.3)
44
44
  rails-dom-testing (~> 2.0)
45
45
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
46
- actiontext (7.0.6)
47
- actionpack (= 7.0.6)
48
- activerecord (= 7.0.6)
49
- activestorage (= 7.0.6)
50
- activesupport (= 7.0.6)
46
+ actiontext (7.0.8)
47
+ actionpack (= 7.0.8)
48
+ activerecord (= 7.0.8)
49
+ activestorage (= 7.0.8)
50
+ activesupport (= 7.0.8)
51
51
  globalid (>= 0.6.0)
52
52
  nokogiri (>= 1.8.5)
53
- actionview (7.0.6)
54
- activesupport (= 7.0.6)
53
+ actionview (7.0.8)
54
+ activesupport (= 7.0.8)
55
55
  builder (~> 3.1)
56
56
  erubi (~> 1.4)
57
57
  rails-dom-testing (~> 2.0)
58
58
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
59
- activejob (7.0.6)
60
- activesupport (= 7.0.6)
59
+ activejob (7.0.8)
60
+ activesupport (= 7.0.8)
61
61
  globalid (>= 0.3.6)
62
- activemodel (7.0.6)
63
- activesupport (= 7.0.6)
64
- activerecord (7.0.6)
65
- activemodel (= 7.0.6)
66
- activesupport (= 7.0.6)
67
- activestorage (7.0.6)
68
- actionpack (= 7.0.6)
69
- activejob (= 7.0.6)
70
- activerecord (= 7.0.6)
71
- activesupport (= 7.0.6)
62
+ activemodel (7.0.8)
63
+ activesupport (= 7.0.8)
64
+ activerecord (7.0.8)
65
+ activemodel (= 7.0.8)
66
+ activesupport (= 7.0.8)
67
+ activestorage (7.0.8)
68
+ actionpack (= 7.0.8)
69
+ activejob (= 7.0.8)
70
+ activerecord (= 7.0.8)
71
+ activesupport (= 7.0.8)
72
72
  marcel (~> 1.0)
73
73
  mini_mime (>= 1.1.0)
74
- activesupport (7.0.6)
74
+ activesupport (7.0.8)
75
75
  concurrent-ruby (~> 1.0, >= 1.0.2)
76
76
  i18n (>= 1.6, < 2)
77
77
  minitest (>= 5.1)
78
78
  tzinfo (~> 2.0)
79
- addressable (2.8.4)
79
+ addressable (2.8.5)
80
80
  public_suffix (>= 2.0.2, < 6.0)
81
81
  ast (2.4.2)
82
+ base64 (0.1.1)
82
83
  builder (3.2.4)
83
84
  bundle-audit (0.1.0)
84
85
  bundler-audit
@@ -88,9 +89,9 @@ GEM
88
89
  coderay (1.1.3)
89
90
  concurrent-ruby (1.2.2)
90
91
  crass (1.0.6)
91
- date (3.3.3)
92
+ date (3.3.4)
92
93
  diff-lcs (1.5.0)
93
- dry-core (1.0.0)
94
+ dry-core (1.0.1)
94
95
  concurrent-ruby (~> 1.0)
95
96
  zeitwerk (~> 2.6)
96
97
  dry-inflector (1.0.0)
@@ -110,7 +111,7 @@ GEM
110
111
  dry-logic (~> 1.4)
111
112
  zeitwerk (~> 2.6)
112
113
  erubi (1.12.0)
113
- ffi (1.15.5)
114
+ ffi (1.16.2)
114
115
  formatador (1.1.0)
115
116
  fuubar (2.5.1)
116
117
  rspec-core (~> 3.0)
@@ -118,9 +119,9 @@ GEM
118
119
  git (1.18.0)
119
120
  addressable (~> 2.8)
120
121
  rchardet (~> 1.8)
121
- globalid (1.1.0)
122
- activesupport (>= 5.0)
123
- guard (2.18.0)
122
+ globalid (1.2.1)
123
+ activesupport (>= 6.1)
124
+ guard (2.18.1)
124
125
  formatador (>= 0.2.4)
125
126
  listen (>= 2.7, < 4.0)
126
127
  lumberjack (>= 1.0.12, < 2.0)
@@ -146,7 +147,7 @@ GEM
146
147
  loofah (2.21.3)
147
148
  crass (~> 1.0.2)
148
149
  nokogiri (>= 1.12.0)
149
- lumberjack (1.2.8)
150
+ lumberjack (1.2.9)
150
151
  mail (2.8.1)
151
152
  mini_mime (>= 0.1.1)
152
153
  net-imap
@@ -154,68 +155,68 @@ GEM
154
155
  net-smtp
155
156
  marcel (1.0.2)
156
157
  method_source (1.0.0)
157
- mini_mime (1.1.2)
158
- minitest (5.18.1)
158
+ mini_mime (1.1.5)
159
+ minitest (5.20.0)
159
160
  nenv (0.3.0)
160
- net-imap (0.3.6)
161
+ net-imap (0.4.5)
161
162
  date
162
163
  net-protocol
163
164
  net-pop (0.1.2)
164
165
  net-protocol
165
- net-protocol (0.2.1)
166
+ net-protocol (0.2.2)
166
167
  timeout
167
- net-smtp (0.3.3)
168
+ net-smtp (0.4.0)
168
169
  net-protocol
169
170
  nio4r (2.5.9)
170
- nokogiri (1.15.3-arm64-darwin)
171
+ nokogiri (1.15.4-arm64-darwin)
171
172
  racc (~> 1.4)
172
- nokogiri (1.15.3-x86_64-linux)
173
+ nokogiri (1.15.4-x86_64-linux)
173
174
  racc (~> 1.4)
174
175
  notiffany (0.1.3)
175
176
  nenv (~> 0.1)
176
177
  shellany (~> 0.0)
177
178
  parallel (1.23.0)
178
- parse_a_changelog (1.2.0)
179
+ parse_a_changelog (1.3.0)
179
180
  treetop (~> 1.6)
180
181
  parser (3.2.2.3)
181
182
  ast (~> 2.4.1)
182
183
  racc
183
- pg (1.5.3)
184
+ pg (1.5.4)
184
185
  polyglot (0.3.5)
185
186
  pry (0.14.2)
186
187
  coderay (~> 1.1)
187
188
  method_source (~> 1.0)
188
- public_suffix (5.0.1)
189
- puma (6.3.0)
189
+ public_suffix (5.0.3)
190
+ puma (6.4.0)
190
191
  nio4r (~> 2.0)
191
192
  racc (1.7.1)
192
- rack (2.2.7)
193
+ rack (2.2.8)
193
194
  rack-test (2.1.0)
194
195
  rack (>= 1.3)
195
- rails (7.0.6)
196
- actioncable (= 7.0.6)
197
- actionmailbox (= 7.0.6)
198
- actionmailer (= 7.0.6)
199
- actionpack (= 7.0.6)
200
- actiontext (= 7.0.6)
201
- actionview (= 7.0.6)
202
- activejob (= 7.0.6)
203
- activemodel (= 7.0.6)
204
- activerecord (= 7.0.6)
205
- activestorage (= 7.0.6)
206
- activesupport (= 7.0.6)
196
+ rails (7.0.8)
197
+ actioncable (= 7.0.8)
198
+ actionmailbox (= 7.0.8)
199
+ actionmailer (= 7.0.8)
200
+ actionpack (= 7.0.8)
201
+ actiontext (= 7.0.8)
202
+ actionview (= 7.0.8)
203
+ activejob (= 7.0.8)
204
+ activemodel (= 7.0.8)
205
+ activerecord (= 7.0.8)
206
+ activestorage (= 7.0.8)
207
+ activesupport (= 7.0.8)
207
208
  bundler (>= 1.15.0)
208
- railties (= 7.0.6)
209
- rails-dom-testing (2.1.1)
209
+ railties (= 7.0.8)
210
+ rails-dom-testing (2.2.0)
210
211
  activesupport (>= 5.0.0)
211
212
  minitest
212
213
  nokogiri (>= 1.6)
213
214
  rails-html-sanitizer (1.6.0)
214
215
  loofah (~> 2.21)
215
216
  nokogiri (~> 1.14)
216
- railties (7.0.6)
217
- actionpack (= 7.0.6)
218
- activesupport (= 7.0.6)
217
+ railties (7.0.8)
218
+ actionpack (= 7.0.8)
219
+ activesupport (= 7.0.8)
219
220
  method_source
220
221
  rake (>= 12.2)
221
222
  thor (~> 1.0)
@@ -228,7 +229,7 @@ GEM
228
229
  rchardet (1.8.0)
229
230
  regexp_parser (2.8.1)
230
231
  retriable (3.1.2)
231
- rexml (3.2.5)
232
+ rexml (3.2.6)
232
233
  rspec (3.12.0)
233
234
  rspec-core (~> 3.12.0)
234
235
  rspec-expectations (~> 3.12.0)
@@ -238,7 +239,7 @@ GEM
238
239
  rspec-expectations (3.12.3)
239
240
  diff-lcs (>= 1.2.0, < 2.0)
240
241
  rspec-support (~> 3.12.0)
241
- rspec-mocks (3.12.5)
242
+ rspec-mocks (3.12.6)
242
243
  diff-lcs (>= 1.2.0, < 2.0)
243
244
  rspec-support (~> 3.12.0)
244
245
  rspec-rails (6.0.3)
@@ -250,67 +251,71 @@ GEM
250
251
  rspec-mocks (~> 3.12)
251
252
  rspec-support (~> 3.12)
252
253
  rspec-support (3.12.1)
253
- rubocop (1.52.1)
254
+ rubocop (1.56.3)
255
+ base64 (~> 0.1.1)
254
256
  json (~> 2.3)
257
+ language_server-protocol (>= 3.17.0)
255
258
  parallel (~> 1.10)
256
259
  parser (>= 3.2.2.3)
257
260
  rainbow (>= 2.2.2, < 4.0)
258
261
  regexp_parser (>= 1.8, < 3.0)
259
262
  rexml (>= 3.2.5, < 4.0)
260
- rubocop-ast (>= 1.28.0, < 2.0)
263
+ rubocop-ast (>= 1.28.1, < 2.0)
261
264
  ruby-progressbar (~> 1.7)
262
265
  unicode-display_width (>= 2.4.0, < 3.0)
263
266
  rubocop-ast (1.29.0)
264
267
  parser (>= 3.2.1.0)
265
- rubocop-capybara (2.18.0)
268
+ rubocop-capybara (2.19.0)
266
269
  rubocop (~> 1.41)
267
- rubocop-factory_bot (2.23.1)
270
+ rubocop-factory_bot (2.24.0)
268
271
  rubocop (~> 1.33)
269
- rubocop-performance (1.18.0)
272
+ rubocop-performance (1.19.1)
270
273
  rubocop (>= 1.7.0, < 2.0)
271
274
  rubocop-ast (>= 0.4.0)
272
- rubocop-rails (2.19.1)
275
+ rubocop-rails (2.20.2)
273
276
  activesupport (>= 4.2.0)
274
277
  rack (>= 1.1)
275
278
  rubocop (>= 1.33.0, < 2.0)
276
- rubocop-rspec (2.22.0)
279
+ rubocop-rspec (2.24.1)
277
280
  rubocop (~> 1.33)
278
281
  rubocop-capybara (~> 2.17)
279
282
  rubocop-factory_bot (~> 2.22)
280
- rubocop-vendor (0.11.0)
281
- rubocop (>= 0.53.0)
283
+ rubocop-vendor (0.12.1)
284
+ rubocop
282
285
  ruby-progressbar (1.13.0)
283
286
  shellany (0.0.1)
284
- standard (1.29.0)
287
+ standard (1.31.1)
285
288
  language_server-protocol (~> 3.17.0.2)
286
289
  lint_roller (~> 1.0)
287
- rubocop (~> 1.52.0)
290
+ rubocop (~> 1.56.2)
288
291
  standard-custom (~> 1.0.0)
289
- standard-performance (~> 1.1.0)
290
- standard-custom (1.0.1)
292
+ standard-performance (~> 1.2)
293
+ standard-custom (1.0.2)
291
294
  lint_roller (~> 1.0)
292
- standard-performance (1.1.1)
295
+ rubocop (~> 1.50)
296
+ standard-performance (1.2.0)
293
297
  lint_roller (~> 1.1)
294
- rubocop-performance (~> 1.18.0)
295
- standard-rails (0.1.0)
298
+ rubocop-performance (~> 1.19.0)
299
+ standard-rails (0.2.0)
296
300
  lint_roller (~> 1.0)
297
- rubocop-rails (~> 2.19.0)
301
+ rubocop-rails (~> 2.20.2)
298
302
  thor (1.2.2)
299
- timeout (0.4.0)
303
+ timeout (0.4.1)
300
304
  treetop (1.6.12)
301
305
  polyglot (~> 0.3)
302
306
  tzinfo (2.0.6)
303
307
  concurrent-ruby (~> 1.0)
304
308
  unicode-display_width (2.4.2)
305
- websocket-driver (0.7.5)
309
+ websocket-driver (0.7.6)
306
310
  websocket-extensions (>= 0.1.0)
307
311
  websocket-extensions (0.1.5)
308
- ws-style (7.1.1)
312
+ ws-style (7.2.0)
309
313
  rubocop-rspec (>= 2.2.0)
310
314
  rubocop-vendor (>= 0.11)
311
- standard (>= 1.28.2)
315
+ standard (>= 1.30.1)
316
+ standard-custom (>= 1.0.2)
312
317
  standard-rails (>= 0.1.0)
313
- zeitwerk (2.6.8)
318
+ zeitwerk (2.6.12)
314
319
 
315
320
  PLATFORMS
316
321
  arm64-darwin-22
data/README.md CHANGED
@@ -176,8 +176,6 @@ module UserComponent
176
176
  def apply(user)
177
177
  user.canonical_id = data.canonical_id
178
178
  user.email = data.email
179
-
180
- user
181
179
  end
182
180
  end
183
181
  end
@@ -5,12 +5,13 @@ module ActiveJob
5
5
  extend self
6
6
 
7
7
  def deserialize_global_id(hash)
8
+ gid = GlobalID.parse(hash[GLOBALID_KEY])
8
9
  # For non database based processors like sidekiq, the reactor may trigger before the
9
10
  # transaction is committed. Attempt to wait for the transaction to be commited before
10
11
  # running the reactor. This is not a perfect solution, but it's better than nothing.
11
12
  if Eventsimple.configuration.retry_reactor_on_record_not_found
12
13
  Retriable.with_context(:reactor) do
13
- ApplicationRecord.uncached { GlobalID::Locator.locate hash[GLOBALID_KEY] }
14
+ gid.model_class.uncached { GlobalID::Locator.locate hash[GLOBALID_KEY] }
14
15
  end
15
16
  else
16
17
  GlobalID::Locator.locate hash[GLOBALID_KEY]
@@ -35,8 +35,8 @@ module Eventsimple
35
35
  assign_attributes(self.class.column_defaults.except(*ignore_props))
36
36
 
37
37
  event_history.each do |event|
38
- event.apply(self)
39
38
  event.apply_timestamps(self)
39
+ event.apply(self)
40
40
  end
41
41
 
42
42
  self
@@ -86,8 +86,8 @@ module Eventsimple
86
86
 
87
87
  # Apply the transformation to the aggregate and save it.
88
88
  def apply_and_persist
89
- apply(aggregate)
90
89
  apply_timestamps(aggregate)
90
+ apply(aggregate)
91
91
 
92
92
  # Persist!
93
93
  aggregate.save!
@@ -6,8 +6,10 @@ module Eventsimple
6
6
  include Sidekiq::Worker
7
7
 
8
8
  def perform(event_global_id, reactor_class)
9
+ gid = GlobalID.parse(event_global_id)
10
+
9
11
  event = Retriable.with_context(:reactor) do
10
- ApplicationRecord.uncached { GlobalID::Locator.locate event_global_id }
12
+ gid.model_class.uncached { GlobalID::Locator.locate event_global_id }
11
13
  end
12
14
  rescue ActiveRecord::RecordNotFound
13
15
  Rails.logger.error("Event #{event_global_id} not found for reactor: #{reactor_class}")
@@ -45,3 +45,5 @@ RSpec.shared_examples 'an event in invalid state that is rescued' do
45
45
  end
46
46
  end
47
47
  end
48
+
49
+ RSpec::Matchers.define_negated_matcher(:not_change, :change)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Eventsimple
4
- VERSION = '1.1.3'
4
+ VERSION = '1.2.1'
5
5
  end
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.1.3
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zulfiqar Ali
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-07 00:00:00.000000000 Z
11
+ date: 2023-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct