eventsimple 2.0.6 → 2.1.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: 90658d4182be4644e8885e2988333d4fdd6d7954bce1327087d3746c620a9d1e
4
- data.tar.gz: ace638b47a463155a8adaa9a8713bd793e2be400466685ba777b74b928b02a4d
3
+ metadata.gz: ce3a9fdc9bc28dc44f15a82db4859f59c0ba7cb6ba8de9f0b30d95ecf09d1ae1
4
+ data.tar.gz: 7c06c9e67147427a631100a04493ca03054ad372a3081f270594aa08c866b2d5
5
5
  SHA512:
6
- metadata.gz: 2eb305aa101f86076f12634f2d46b75f67f7acdade90bcf7ac79feae8babfcaa795a7406ccd4999f08745b6db23de62efd56e6017c27544811bd5d1fc8a1dbb0
7
- data.tar.gz: b2bf21fdfc3ab8df167276148b69c933d2df87d44bb803bdc6620b011062428ea61c1e20920531bc056c19efb55cf1323114df71c3010f4943bb4ae4b8a0ff4d
6
+ metadata.gz: 1c9866afcb4d06c090397d82f9e92b18a100685a007d023be8a138b98d45c271429acaeeb1b9680fa07b96346737b4b34df4abe0ebbefb1a83b1aa0a1795a2cf
7
+ data.tar.gz: 57c22889f55be53f6505ca5e61abca658bf61d373ef1e95b1f70f1d8e75cd98607d8995fd5658ec2850e07ace24bdb673f0d048c33269e2c440ed1d57af4534c
data/CHANGELOG.md CHANGED
@@ -6,9 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## Unreleased
8
8
 
9
- ## 2.0.6 - 2026-01-29
10
- ### Fixed
11
- - Fix `projection_matches_events?` returning false due to timestamp precision differences between Ruby (nanoseconds) and PostgreSQL (microseconds). Time attributes are now normalized to microsecond precision before comparison.
9
+ ## 2.1.1 - 2026-02-03
10
+ ### Changed
11
+ - Ensure `ActiveSupport::JSON::Encoding.time_precision` is at least 6 (microseconds) for consistent JSON timestamp serialization.
12
+
13
+ ## 2.1.0 - 2026-01-15
14
+ ### Added
15
+ - Extended encryption support to all Eventsimple types: Integer, Decimal, Date, DateTime, Time, Array, and Hash.
16
+ - Added support for nested Message structs with encrypted properties - encryption now recursively handles nested types.
17
+
18
+ ### Changed
19
+ - Encryption now leverages Dry::Types coercion for JSON types (Date, DateTime, Time, Decimal) with fallback to manual deserialization for strict types.
20
+ - Bool type explicitly does not support encryption and will raise `ArgumentError` if attempted.
12
21
 
13
22
  ## 2.0.5 - 2026-01-14
14
23
  ### Changed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eventsimple (2.0.6)
4
+ eventsimple (2.1.1)
5
5
  concurrent-ruby (>= 1.2.3)
6
6
  dry-struct (>= 1.8.0)
7
7
  dry-types (>= 1.7.0)
@@ -13,31 +13,31 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- action_text-trix (2.1.15)
16
+ action_text-trix (2.1.16)
17
17
  railties
18
- actioncable (8.1.1)
19
- actionpack (= 8.1.1)
20
- activesupport (= 8.1.1)
18
+ actioncable (8.1.2)
19
+ actionpack (= 8.1.2)
20
+ activesupport (= 8.1.2)
21
21
  nio4r (~> 2.0)
22
22
  websocket-driver (>= 0.6.1)
23
23
  zeitwerk (~> 2.6)
24
- actionmailbox (8.1.1)
25
- actionpack (= 8.1.1)
26
- activejob (= 8.1.1)
27
- activerecord (= 8.1.1)
28
- activestorage (= 8.1.1)
29
- activesupport (= 8.1.1)
24
+ actionmailbox (8.1.2)
25
+ actionpack (= 8.1.2)
26
+ activejob (= 8.1.2)
27
+ activerecord (= 8.1.2)
28
+ activestorage (= 8.1.2)
29
+ activesupport (= 8.1.2)
30
30
  mail (>= 2.8.0)
31
- actionmailer (8.1.1)
32
- actionpack (= 8.1.1)
33
- actionview (= 8.1.1)
34
- activejob (= 8.1.1)
35
- activesupport (= 8.1.1)
31
+ actionmailer (8.1.2)
32
+ actionpack (= 8.1.2)
33
+ actionview (= 8.1.2)
34
+ activejob (= 8.1.2)
35
+ activesupport (= 8.1.2)
36
36
  mail (>= 2.8.0)
37
37
  rails-dom-testing (~> 2.2)
38
- actionpack (8.1.1)
39
- actionview (= 8.1.1)
40
- activesupport (= 8.1.1)
38
+ actionpack (8.1.2)
39
+ actionview (= 8.1.2)
40
+ activesupport (= 8.1.2)
41
41
  nokogiri (>= 1.8.5)
42
42
  rack (>= 2.2.4)
43
43
  rack-session (>= 1.0.1)
@@ -45,36 +45,36 @@ GEM
45
45
  rails-dom-testing (~> 2.2)
46
46
  rails-html-sanitizer (~> 1.6)
47
47
  useragent (~> 0.16)
48
- actiontext (8.1.1)
48
+ actiontext (8.1.2)
49
49
  action_text-trix (~> 2.1.15)
50
- actionpack (= 8.1.1)
51
- activerecord (= 8.1.1)
52
- activestorage (= 8.1.1)
53
- activesupport (= 8.1.1)
50
+ actionpack (= 8.1.2)
51
+ activerecord (= 8.1.2)
52
+ activestorage (= 8.1.2)
53
+ activesupport (= 8.1.2)
54
54
  globalid (>= 0.6.0)
55
55
  nokogiri (>= 1.8.5)
56
- actionview (8.1.1)
57
- activesupport (= 8.1.1)
56
+ actionview (8.1.2)
57
+ activesupport (= 8.1.2)
58
58
  builder (~> 3.1)
59
59
  erubi (~> 1.11)
60
60
  rails-dom-testing (~> 2.2)
61
61
  rails-html-sanitizer (~> 1.6)
62
- activejob (8.1.1)
63
- activesupport (= 8.1.1)
62
+ activejob (8.1.2)
63
+ activesupport (= 8.1.2)
64
64
  globalid (>= 0.3.6)
65
- activemodel (8.1.1)
66
- activesupport (= 8.1.1)
67
- activerecord (8.1.1)
68
- activemodel (= 8.1.1)
69
- activesupport (= 8.1.1)
65
+ activemodel (8.1.2)
66
+ activesupport (= 8.1.2)
67
+ activerecord (8.1.2)
68
+ activemodel (= 8.1.2)
69
+ activesupport (= 8.1.2)
70
70
  timeout (>= 0.4.0)
71
- activestorage (8.1.1)
72
- actionpack (= 8.1.1)
73
- activejob (= 8.1.1)
74
- activerecord (= 8.1.1)
75
- activesupport (= 8.1.1)
71
+ activestorage (8.1.2)
72
+ actionpack (= 8.1.2)
73
+ activejob (= 8.1.2)
74
+ activerecord (= 8.1.2)
75
+ activesupport (= 8.1.2)
76
76
  marcel (~> 1.0)
77
- activesupport (8.1.1)
77
+ activesupport (8.1.2)
78
78
  base64
79
79
  bigdecimal
80
80
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -91,7 +91,7 @@ GEM
91
91
  public_suffix (>= 2.0.2, < 8.0)
92
92
  ast (2.4.3)
93
93
  base64 (0.3.0)
94
- bigdecimal (3.3.1)
94
+ bigdecimal (4.0.1)
95
95
  builder (3.3.0)
96
96
  bundle-audit (0.2.0)
97
97
  bundler-audit
@@ -99,17 +99,17 @@ GEM
99
99
  bundler (>= 1.2.0)
100
100
  thor (~> 1.0)
101
101
  coderay (1.1.3)
102
- concurrent-ruby (1.3.5)
102
+ concurrent-ruby (1.3.6)
103
103
  connection_pool (3.0.2)
104
104
  crass (1.0.6)
105
- date (3.5.0)
105
+ date (3.5.1)
106
106
  diff-lcs (1.6.2)
107
107
  drb (2.2.3)
108
- dry-core (1.1.0)
108
+ dry-core (1.2.0)
109
109
  concurrent-ruby (~> 1.0)
110
110
  logger
111
111
  zeitwerk (~> 2.6)
112
- dry-inflector (1.2.0)
112
+ dry-inflector (1.3.1)
113
113
  dry-logic (1.6.0)
114
114
  bigdecimal
115
115
  concurrent-ruby (~> 1.0)
@@ -120,42 +120,47 @@ GEM
120
120
  dry-types (~> 1.8, >= 1.8.2)
121
121
  ice_nine (~> 0.11)
122
122
  zeitwerk (~> 2.6)
123
- dry-types (1.8.3)
124
- bigdecimal (~> 3.0)
123
+ dry-types (1.9.0)
124
+ bigdecimal (>= 3.0)
125
125
  concurrent-ruby (~> 1.0)
126
126
  dry-core (~> 1.0)
127
127
  dry-inflector (~> 1.0)
128
128
  dry-logic (~> 1.4)
129
129
  zeitwerk (~> 2.6)
130
- erb (6.0.0)
130
+ erb (6.0.1)
131
131
  erubi (1.13.1)
132
132
  factory_bot (6.5.6)
133
133
  activesupport (>= 6.1.0)
134
134
  factory_bot_rails (6.5.1)
135
135
  factory_bot (~> 6.5)
136
136
  railties (>= 6.1.0)
137
- ffi (1.17.2-arm64-darwin)
138
- ffi (1.17.2-x86_64-linux-gnu)
137
+ ffi (1.17.3-aarch64-linux-gnu)
138
+ ffi (1.17.3-aarch64-linux-musl)
139
+ ffi (1.17.3-arm-linux-gnu)
140
+ ffi (1.17.3-arm-linux-musl)
141
+ ffi (1.17.3-arm64-darwin)
142
+ ffi (1.17.3-x86_64-darwin)
143
+ ffi (1.17.3-x86_64-linux-gnu)
144
+ ffi (1.17.3-x86_64-linux-musl)
139
145
  formatador (1.2.3)
140
146
  reline
141
147
  fuubar (2.5.1)
142
148
  rspec-core (~> 3.0)
143
149
  ruby-progressbar (~> 1.4)
144
- git (4.0.6)
150
+ git (4.3.0)
145
151
  activesupport (>= 5.0)
146
152
  addressable (~> 2.8)
147
153
  process_executer (~> 4.0)
148
154
  rchardet (~> 1.9)
149
155
  globalid (1.3.0)
150
156
  activesupport (>= 6.1)
151
- guard (2.19.1)
157
+ guard (2.20.1)
152
158
  formatador (>= 0.2.4)
153
159
  listen (>= 2.7, < 4.0)
154
160
  logger (~> 1.6)
155
161
  lumberjack (>= 1.0.12, < 2.0)
156
162
  nenv (~> 0.1)
157
163
  notiffany (~> 0.0)
158
- ostruct (~> 0.6)
159
164
  pry (>= 0.13.0)
160
165
  shellany (~> 0.0)
161
166
  thor (>= 0.18.1)
@@ -164,22 +169,23 @@ GEM
164
169
  guard (~> 2.1)
165
170
  guard-compat (~> 1.1)
166
171
  rspec (>= 2.99.0, < 4.0)
167
- i18n (1.14.7)
172
+ i18n (1.14.8)
168
173
  concurrent-ruby (~> 1.0)
169
174
  ice_nine (0.11.2)
170
- io-console (0.8.1)
171
- irb (1.15.3)
175
+ io-console (0.8.2)
176
+ irb (1.16.0)
172
177
  pp (>= 0.6.0)
173
178
  rdoc (>= 4.0.0)
174
179
  reline (>= 0.4.2)
175
- json (2.17.1)
180
+ json (2.18.0)
176
181
  language_server-protocol (3.17.0.5)
177
182
  lint_roller (1.1.0)
178
- listen (3.9.0)
183
+ listen (3.10.0)
184
+ logger
179
185
  rb-fsevent (~> 0.10, >= 0.10.3)
180
186
  rb-inotify (~> 0.9, >= 0.9.10)
181
187
  logger (1.7.0)
182
- loofah (2.24.1)
188
+ loofah (2.25.0)
183
189
  crass (~> 1.0.2)
184
190
  nokogiri (>= 1.12.0)
185
191
  lumberjack (1.4.2)
@@ -192,9 +198,10 @@ GEM
192
198
  marcel (1.1.0)
193
199
  method_source (1.1.0)
194
200
  mini_mime (1.1.5)
195
- minitest (5.26.2)
201
+ minitest (6.0.1)
202
+ prism (~> 1.5)
196
203
  nenv (0.3.0)
197
- net-imap (0.5.12)
204
+ net-imap (0.6.2)
198
205
  date
199
206
  net-protocol
200
207
  net-pop (0.1.2)
@@ -204,37 +211,54 @@ GEM
204
211
  net-smtp (0.5.1)
205
212
  net-protocol
206
213
  nio4r (2.7.5)
207
- nokogiri (1.18.10-arm64-darwin)
214
+ nokogiri (1.19.0-aarch64-linux-gnu)
215
+ racc (~> 1.4)
216
+ nokogiri (1.19.0-aarch64-linux-musl)
217
+ racc (~> 1.4)
218
+ nokogiri (1.19.0-arm-linux-gnu)
219
+ racc (~> 1.4)
220
+ nokogiri (1.19.0-arm-linux-musl)
221
+ racc (~> 1.4)
222
+ nokogiri (1.19.0-arm64-darwin)
208
223
  racc (~> 1.4)
209
- nokogiri (1.18.10-x86_64-linux-gnu)
224
+ nokogiri (1.19.0-x86_64-darwin)
225
+ racc (~> 1.4)
226
+ nokogiri (1.19.0-x86_64-linux-gnu)
227
+ racc (~> 1.4)
228
+ nokogiri (1.19.0-x86_64-linux-musl)
210
229
  racc (~> 1.4)
211
230
  notiffany (0.1.3)
212
231
  nenv (~> 0.1)
213
232
  shellany (~> 0.0)
214
- ostruct (0.6.3)
215
233
  parallel (1.27.0)
216
234
  parse_a_changelog (1.3.4)
217
235
  treetop (~> 1.6)
218
- parser (3.3.10.0)
236
+ parser (3.3.10.1)
219
237
  ast (~> 2.4.1)
220
238
  racc
221
- pg (1.6.2-arm64-darwin)
222
- pg (1.6.2-x86_64-linux)
239
+ pg (1.6.3)
240
+ pg (1.6.3-aarch64-linux)
241
+ pg (1.6.3-aarch64-linux-musl)
242
+ pg (1.6.3-arm64-darwin)
243
+ pg (1.6.3-x86_64-darwin)
244
+ pg (1.6.3-x86_64-linux)
245
+ pg (1.6.3-x86_64-linux-musl)
223
246
  polyglot (0.3.5)
224
247
  pp (0.6.3)
225
248
  prettyprint
226
249
  prettyprint (0.2.0)
227
- prism (1.6.0)
228
- process_executer (4.0.0)
250
+ prism (1.9.0)
251
+ process_executer (4.0.2)
229
252
  track_open_instances (~> 0.1)
230
- pry (0.15.2)
253
+ pry (0.16.0)
231
254
  coderay (~> 1.1)
232
255
  method_source (~> 1.0)
233
- psych (5.2.6)
256
+ reline (>= 0.6.0)
257
+ psych (5.3.1)
234
258
  date
235
259
  stringio
236
- public_suffix (7.0.0)
237
- puma (7.1.0)
260
+ public_suffix (7.0.2)
261
+ puma (7.2.0)
238
262
  nio4r (~> 2.0)
239
263
  racc (1.8.1)
240
264
  rack (3.2.4)
@@ -245,20 +269,20 @@ GEM
245
269
  rack (>= 1.3)
246
270
  rackup (2.3.1)
247
271
  rack (>= 3)
248
- rails (8.1.1)
249
- actioncable (= 8.1.1)
250
- actionmailbox (= 8.1.1)
251
- actionmailer (= 8.1.1)
252
- actionpack (= 8.1.1)
253
- actiontext (= 8.1.1)
254
- actionview (= 8.1.1)
255
- activejob (= 8.1.1)
256
- activemodel (= 8.1.1)
257
- activerecord (= 8.1.1)
258
- activestorage (= 8.1.1)
259
- activesupport (= 8.1.1)
272
+ rails (8.1.2)
273
+ actioncable (= 8.1.2)
274
+ actionmailbox (= 8.1.2)
275
+ actionmailer (= 8.1.2)
276
+ actionpack (= 8.1.2)
277
+ actiontext (= 8.1.2)
278
+ actionview (= 8.1.2)
279
+ activejob (= 8.1.2)
280
+ activemodel (= 8.1.2)
281
+ activerecord (= 8.1.2)
282
+ activestorage (= 8.1.2)
283
+ activesupport (= 8.1.2)
260
284
  bundler (>= 1.15.0)
261
- railties (= 8.1.1)
285
+ railties (= 8.1.2)
262
286
  rails-dom-testing (2.3.0)
263
287
  activesupport (>= 5.0.0)
264
288
  minitest
@@ -266,9 +290,9 @@ GEM
266
290
  rails-html-sanitizer (1.6.2)
267
291
  loofah (~> 2.21)
268
292
  nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
269
- railties (8.1.1)
270
- actionpack (= 8.1.1)
271
- activesupport (= 8.1.1)
293
+ railties (8.1.2)
294
+ actionpack (= 8.1.2)
295
+ activesupport (= 8.1.2)
272
296
  irb (~> 1.13)
273
297
  rackup (>= 1.0.0)
274
298
  rake (>= 12.2)
@@ -281,7 +305,7 @@ GEM
281
305
  rb-inotify (0.11.1)
282
306
  ffi (~> 1.0)
283
307
  rchardet (1.10.0)
284
- rdoc (6.17.0)
308
+ rdoc (7.1.0)
285
309
  erb
286
310
  psych (>= 4.0.0)
287
311
  tsort
@@ -309,8 +333,8 @@ GEM
309
333
  rspec-expectations (~> 3.13)
310
334
  rspec-mocks (~> 3.13)
311
335
  rspec-support (~> 3.13)
312
- rspec-support (3.13.6)
313
- rubocop (1.81.7)
336
+ rspec-support (3.13.7)
337
+ rubocop (1.84.1)
314
338
  json (~> 2.3)
315
339
  language_server-protocol (~> 3.17.0.2)
316
340
  lint_roller (~> 1.1.0)
@@ -318,12 +342,12 @@ GEM
318
342
  parser (>= 3.3.0.2)
319
343
  rainbow (>= 2.2.2, < 4.0)
320
344
  regexp_parser (>= 2.9.3, < 3.0)
321
- rubocop-ast (>= 1.47.1, < 2.0)
345
+ rubocop-ast (>= 1.49.0, < 2.0)
322
346
  ruby-progressbar (~> 1.7)
323
347
  unicode-display_width (>= 2.4.0, < 4.0)
324
- rubocop-ast (1.48.0)
348
+ rubocop-ast (1.49.0)
325
349
  parser (>= 3.3.7.2)
326
- prism (~> 1.4)
350
+ prism (~> 1.7)
327
351
  rubocop-factory_bot (2.28.0)
328
352
  lint_roller (~> 1.1)
329
353
  rubocop (~> 1.72, >= 1.72.1)
@@ -331,13 +355,13 @@ GEM
331
355
  lint_roller (~> 1.1)
332
356
  rubocop (>= 1.75.0, < 2.0)
333
357
  rubocop-ast (>= 1.47.1, < 2.0)
334
- rubocop-rails (2.34.2)
358
+ rubocop-rails (2.34.3)
335
359
  activesupport (>= 4.2.0)
336
360
  lint_roller (~> 1.1)
337
361
  rack (>= 1.1)
338
362
  rubocop (>= 1.75.0, < 2.0)
339
363
  rubocop-ast (>= 1.44.0, < 2.0)
340
- rubocop-rspec (3.8.0)
364
+ rubocop-rspec (3.9.0)
341
365
  lint_roller (~> 1.1)
342
366
  rubocop (~> 1.81)
343
367
  rubocop-rspec_rails (2.32.0)
@@ -347,9 +371,9 @@ GEM
347
371
  ruby-progressbar (1.13.0)
348
372
  securerandom (0.4.1)
349
373
  shellany (0.0.1)
350
- stringio (3.1.9)
351
- thor (1.4.0)
352
- timeout (0.5.0)
374
+ stringio (3.2.0)
375
+ thor (1.5.0)
376
+ timeout (0.6.0)
353
377
  track_open_instances (0.1.15)
354
378
  treetop (1.6.18)
355
379
  polyglot (~> 0.3)
@@ -358,21 +382,29 @@ GEM
358
382
  concurrent-ruby (~> 1.0)
359
383
  unicode-display_width (3.2.0)
360
384
  unicode-emoji (~> 4.1)
361
- unicode-emoji (4.1.0)
385
+ unicode-emoji (4.2.0)
362
386
  uri (1.1.1)
363
387
  useragent (0.16.11)
364
388
  websocket-driver (0.8.0)
365
389
  base64
366
390
  websocket-extensions (>= 0.1.0)
367
391
  websocket-extensions (0.1.5)
368
- with_advisory_lock (7.0.2)
392
+ with_advisory_lock (7.5.0)
369
393
  activerecord (>= 7.2)
370
394
  zeitwerk (>= 2.7)
371
- zeitwerk (2.7.3)
395
+ zeitwerk (2.7.4)
372
396
 
373
397
  PLATFORMS
398
+ aarch64-linux
399
+ aarch64-linux-gnu
400
+ aarch64-linux-musl
401
+ arm-linux-gnu
402
+ arm-linux-musl
374
403
  arm64-darwin
404
+ x86_64-darwin
375
405
  x86_64-linux
406
+ x86_64-linux-gnu
407
+ x86_64-linux-musl
376
408
 
377
409
  DEPENDENCIES
378
410
  bundle-audit
@@ -392,5 +424,157 @@ DEPENDENCIES
392
424
  rubocop-rspec
393
425
  rubocop-rspec_rails
394
426
 
427
+ CHECKSUMS
428
+ action_text-trix (2.1.16) sha256=f645a2c21821b8449fd1d6770708f4031c91a2eedf9ef476e9be93c64e703a8a
429
+ actioncable (8.1.2) sha256=dc31efc34cca9cdefc5c691ddb8b4b214c0ea5cd1372108cbc1377767fb91969
430
+ actionmailbox (8.1.2) sha256=058b2fb1980e5d5a894f675475fcfa45c62631103d5a2596d9610ec81581889b
431
+ actionmailer (8.1.2) sha256=f4c1d2060f653bfe908aa7fdc5a61c0e5279670de992146582f2e36f8b9175e9
432
+ actionpack (8.1.2) sha256=ced74147a1f0daafaa4bab7f677513fd4d3add574c7839958f7b4f1de44f8423
433
+ actiontext (8.1.2) sha256=0bf57da22a9c19d970779c3ce24a56be31b51c7640f2763ec64aa72e358d2d2d
434
+ actionview (8.1.2) sha256=80455b2588911c9b72cec22d240edacb7c150e800ef2234821269b2b2c3e2e5b
435
+ activejob (8.1.2) sha256=908dab3713b101859536375819f4156b07bdf4c232cc645e7538adb9e302f825
436
+ activemodel (8.1.2) sha256=e21358c11ce68aed3f9838b7e464977bc007b4446c6e4059781e1d5c03bcf33e
437
+ activerecord (8.1.2) sha256=acfbe0cadfcc50fa208011fe6f4eb01cae682ebae0ef57145ba45380c74bcc44
438
+ activestorage (8.1.2) sha256=8a63a48c3999caeee26a59441f813f94681fc35cc41aba7ce1f836add04fba76
439
+ activesupport (8.1.2) sha256=88842578ccd0d40f658289b0e8c842acfe9af751afee2e0744a7873f50b6fdae
440
+ addressable (2.8.8) sha256=7c13b8f9536cf6364c03b9d417c19986019e28f7c00ac8132da4eb0fe393b057
441
+ ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
442
+ base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
443
+ bigdecimal (4.0.1) sha256=8b07d3d065a9f921c80ceaea7c9d4ae596697295b584c296fe599dd0ad01c4a7
444
+ builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f
445
+ bundle-audit (0.2.0) sha256=cb499708f7fbc56d2d2e8bab09a1184f8f5b548bdbd628b757e5a1856874ca12
446
+ bundler-audit (0.9.3) sha256=81c8766c71e47d0d28a0f98c7eed028539f21a6ea3cd8f685eb6f42333c9b4e9
447
+ coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b
448
+ concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
449
+ connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
450
+ crass (1.0.6) sha256=dc516022a56e7b3b156099abc81b6d2b08ea1ed12676ac7a5657617f012bd45d
451
+ date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0
452
+ diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
453
+ drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
454
+ dry-core (1.2.0) sha256=0cc5a7da88df397f153947eeeae42e876e999c1e30900f3c536fb173854e96a1
455
+ dry-inflector (1.3.1) sha256=7fb0c2bb04f67638f25c52e7ba39ab435d922a3a5c3cd196120f63accb682dcc
456
+ dry-logic (1.6.0) sha256=da6fedbc0f90fc41f9b0cc7e6f05f5d529d1efaef6c8dcc8e0733f685745cea2
457
+ dry-struct (1.8.0) sha256=74c38b559924fb6462ac43ec780c4533a082d7b1d238a8d7857b773b3b8e2966
458
+ dry-types (1.9.0) sha256=7b656fe0a78d2432500ae1f29fefd6762f5a032ca7000e4f36bc111453d45d4d
459
+ erb (6.0.1) sha256=28ecdd99c5472aebd5674d6061e3c6b0a45c049578b071e5a52c2a7f13c197e5
460
+ erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9
461
+ eventsimple (2.1.1)
462
+ factory_bot (6.5.6) sha256=12beb373214dccc086a7a63763d6718c49769d5606f0501e0a4442676917e077
463
+ factory_bot_rails (6.5.1) sha256=d3cc4851eae4dea8a665ec4a4516895045e710554d2b5ac9e68b94d351bc6d68
464
+ ffi (1.17.3-aarch64-linux-gnu) sha256=28ad573df26560f0aedd8a90c3371279a0b2bd0b4e834b16a2baa10bd7a97068
465
+ ffi (1.17.3-aarch64-linux-musl) sha256=020b33b76775b1abacc3b7d86b287cef3251f66d747092deec592c7f5df764b2
466
+ ffi (1.17.3-arm-linux-gnu) sha256=5bd4cea83b68b5ec0037f99c57d5ce2dd5aa438f35decc5ef68a7d085c785668
467
+ ffi (1.17.3-arm-linux-musl) sha256=0d7626bb96265f9af78afa33e267d71cfef9d9a8eb8f5525344f8da6c7d76053
468
+ ffi (1.17.3-arm64-darwin) sha256=0c690555d4cee17a7f07c04d59df39b2fba74ec440b19da1f685c6579bb0717f
469
+ ffi (1.17.3-x86_64-darwin) sha256=1f211811eb5cfaa25998322cdd92ab104bfbd26d1c4c08471599c511f2c00bb5
470
+ ffi (1.17.3-x86_64-linux-gnu) sha256=3746b01f677aae7b16dc1acb7cb3cc17b3e35bdae7676a3f568153fb0e2c887f
471
+ ffi (1.17.3-x86_64-linux-musl) sha256=086b221c3a68320b7564066f46fed23449a44f7a1935f1fe5a245bd89d9aea56
472
+ formatador (1.2.3) sha256=19fa898133c2c26cdbb5d09f6998c1e137ad9427a046663e55adfe18b950d894
473
+ fuubar (2.5.1) sha256=b272a7804b282661c7fab583a3764f92543cb482c365ae39c685cd218fdd4880
474
+ git (4.3.0) sha256=5e8200521400d6695e6c0e20e0741a0a8e43a18e2fed2188ee12d958ad06d243
475
+ globalid (1.3.0) sha256=05c639ad6eb4594522a0b07983022f04aa7254626ab69445a0e493aa3786ff11
476
+ guard (2.20.1) sha256=ab9cd7873854e6b76080c0589f781ff3e390e441bdda20165804df54f977015a
477
+ guard-compat (1.2.1) sha256=3ad21ab0070107f92edfd82610b5cdc2fb8e368851e72362ada9703443d646fe
478
+ guard-rspec (4.7.3) sha256=a47ba03cbd1e3c71e6ae8645cea97e203098a248aede507461a43e906e2f75ca
479
+ i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5
480
+ ice_nine (0.11.2) sha256=5d506a7d2723d5592dc121b9928e4931742730131f22a1a37649df1c1e2e63db
481
+ io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
482
+ irb (1.16.0) sha256=2abe56c9ac947cdcb2f150572904ba798c1e93c890c256f8429981a7675b0806
483
+ json (2.18.0) sha256=b10506aee4183f5cf49e0efc48073d7b75843ce3782c68dbeb763351c08fd505
484
+ language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
485
+ lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
486
+ listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2
487
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
488
+ loofah (2.25.0) sha256=df5ed7ac3bac6a4ec802df3877ee5cc86d027299f8952e6243b3dac446b060e6
489
+ lumberjack (1.4.2) sha256=40de5ae46321380c835031bcc1370f13bba304d29f2b5f5bb152061a5a191b95
490
+ mail (2.9.0) sha256=6fa6673ecd71c60c2d996260f9ee3dd387d4673b8169b502134659ece6d34941
491
+ marcel (1.1.0) sha256=fdcfcfa33cc52e93c4308d40e4090a5d4ea279e160a7f6af988260fa970e0bee
492
+ method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5
493
+ mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef
494
+ minitest (6.0.1) sha256=7854c74f48e2e975969062833adc4013f249a4b212f5e7b9d5c040bf838d54bb
495
+ nenv (0.3.0) sha256=d9de6d8fb7072228463bf61843159419c969edb34b3cef51832b516ae7972765
496
+ net-imap (0.6.2) sha256=08caacad486853c61676cca0c0c47df93db02abc4a8239a8b67eb0981428acc6
497
+ net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3
498
+ net-protocol (0.2.2) sha256=aa73e0cba6a125369de9837b8d8ef82a61849360eba0521900e2c3713aa162a8
499
+ net-smtp (0.5.1) sha256=ed96a0af63c524fceb4b29b0d352195c30d82dd916a42f03c62a3a70e5b70736
500
+ nio4r (2.7.5) sha256=6c90168e48fb5f8e768419c93abb94ba2b892a1d0602cb06eef16d8b7df1dca1
501
+ nokogiri (1.19.0-aarch64-linux-gnu) sha256=11a97ecc3c0e7e5edcf395720b10860ef493b768f6aa80c539573530bc933767
502
+ nokogiri (1.19.0-aarch64-linux-musl) sha256=eb70507f5e01bc23dad9b8dbec2b36ad0e61d227b42d292835020ff754fb7ba9
503
+ nokogiri (1.19.0-arm-linux-gnu) sha256=572a259026b2c8b7c161fdb6469fa2d0edd2b61cd599db4bbda93289abefbfe5
504
+ nokogiri (1.19.0-arm-linux-musl) sha256=23ed90922f1a38aed555d3de4d058e90850c731c5b756d191b3dc8055948e73c
505
+ nokogiri (1.19.0-arm64-darwin) sha256=0811dfd936d5f6dd3f6d32ef790568bf29b2b7bead9ba68866847b33c9cf5810
506
+ nokogiri (1.19.0-x86_64-darwin) sha256=1dad56220b603a8edb9750cd95798bffa2b8dd9dd9aa47f664009ee5b43e3067
507
+ nokogiri (1.19.0-x86_64-linux-gnu) sha256=f482b95c713d60031d48c44ce14562f8d2ce31e3a9e8dd0ccb131e9e5a68b58c
508
+ nokogiri (1.19.0-x86_64-linux-musl) sha256=1c4ca6b381622420073ce6043443af1d321e8ed93cc18b08e2666e5bd02ffae4
509
+ notiffany (0.1.3) sha256=d37669605b7f8dcb04e004e6373e2a780b98c776f8eb503ac9578557d7808738
510
+ parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
511
+ parse_a_changelog (1.3.4) sha256=dfb65a69afc2e547ea49ee905c2657a270913c674c0048ba2815a03623518bde
512
+ parser (3.3.10.1) sha256=06f6a725d2cd91e5e7f2b7c32ba143631e1f7c8ae2fb918fc4cebec187e6a688
513
+ pg (1.6.3) sha256=1388d0563e13d2758c1089e35e973a3249e955c659592d10e5b77c468f628a99
514
+ pg (1.6.3-aarch64-linux) sha256=0698ad563e02383c27510b76bf7d4cd2de19cd1d16a5013f375dd473e4be72ea
515
+ pg (1.6.3-aarch64-linux-musl) sha256=06a75f4ea04b05140146f2a10550b8e0d9f006a79cdaf8b5b130cde40e3ecc2c
516
+ pg (1.6.3-arm64-darwin) sha256=7240330b572e6355d7c75a7de535edb5dfcbd6295d9c7777df4d9dddfb8c0e5f
517
+ pg (1.6.3-x86_64-darwin) sha256=ee2e04a17c0627225054ffeb43e31a95be9d7e93abda2737ea3ce4a62f2729d6
518
+ pg (1.6.3-x86_64-linux) sha256=5d9e188c8f7a0295d162b7b88a768d8452a899977d44f3274d1946d67920ae8d
519
+ pg (1.6.3-x86_64-linux-musl) sha256=9c9c90d98c72f78eb04c0f55e9618fe55d1512128e411035fe229ff427864009
520
+ polyglot (0.3.5) sha256=59d66ef5e3c166431c39cb8b7c1d02af419051352f27912f6a43981b3def16af
521
+ pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6
522
+ prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
523
+ prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
524
+ process_executer (4.0.2) sha256=c73eb646d450044241c973a8360f6326e33ec5ad933f7acf503f6f3579873a71
525
+ pry (0.16.0) sha256=d76c69065698ed1f85e717bd33d7942c38a50868f6b0673c636192b3d1b6054e
526
+ psych (5.3.1) sha256=eb7a57cef10c9d70173ff74e739d843ac3b2c019a003de48447b2963d81b1974
527
+ public_suffix (7.0.2) sha256=9114090c8e4e7135c1fd0e7acfea33afaab38101884320c65aaa0ffb8e26a857
528
+ puma (7.2.0) sha256=bf8ef4ab514a4e6d4554cb4326b2004eba5036ae05cf765cfe51aba9706a72a8
529
+ racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
530
+ rack (3.2.4) sha256=5d74b6f75082a643f43c1e76b419c40f0e5527fcfee1e669ac1e6b73c0ccb6f6
531
+ rack-session (2.1.1) sha256=0b6dc07dea7e4b583f58a48e8b806d4c9f1c6c9214ebc202ec94562cbea2e4e9
532
+ rack-test (2.2.0) sha256=005a36692c306ac0b4a9350355ee080fd09ddef1148a5f8b2ac636c720f5c463
533
+ rackup (2.3.1) sha256=6c79c26753778e90983761d677a48937ee3192b3ffef6bc963c0950f94688868
534
+ rails (8.1.2) sha256=5069061b23dfa8706b9f0159ae8b9d35727359103178a26962b868a680ba7d95
535
+ rails-dom-testing (2.3.0) sha256=8acc7953a7b911ca44588bf08737bc16719f431a1cc3091a292bca7317925c1d
536
+ rails-html-sanitizer (1.6.2) sha256=35fce2ca8242da8775c83b6ba9c1bcaad6751d9eb73c1abaa8403475ab89a560
537
+ railties (8.1.2) sha256=1289ece76b4f7668fc46d07e55cc992b5b8751f2ad85548b7da351b8c59f8055
538
+ rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
539
+ rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
540
+ rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe
541
+ rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e
542
+ rchardet (1.10.0) sha256=d5ea2ed61a720a220f1914778208e718a0c7ed2a484b6d357ba695aa7001390f
543
+ rdoc (7.1.0) sha256=494899df0706c178596ca6e1d50f1b7eb285a9b2aae715be5abd742734f17363
544
+ regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
545
+ reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
546
+ retriable (3.1.2) sha256=0a5a5d0ca4ba61a76fb31a17ab8f7f80281beb040c329d34dfc137a1398688e0
547
+ rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
548
+ rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
549
+ rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
550
+ rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c
551
+ rspec-rails (8.0.2) sha256=113139a53f5d068d4f48d1c29ad5f982013ed9b0daa69d7f7b266eda5d433ace
552
+ rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
553
+ rubocop (1.84.1) sha256=14cc626f355141f5a2ef53c10a68d66b13bb30639b26370a76559096cc6bcc1a
554
+ rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
555
+ rubocop-factory_bot (2.28.0) sha256=4b17fc02124444173317e131759d195b0d762844a71a29fe8139c1105d92f0cb
556
+ rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
557
+ rubocop-rails (2.34.3) sha256=10d37989024865ecda8199f311f3faca990143fbac967de943f88aca11eb9ad2
558
+ rubocop-rspec (3.9.0) sha256=8fa70a3619408237d789aeecfb9beef40576acc855173e60939d63332fdb55e2
559
+ rubocop-rspec_rails (2.32.0) sha256=4a0d641c72f6ebb957534f539d9d0a62c47abd8ce0d0aeee1ef4701e892a9100
560
+ ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
561
+ securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
562
+ shellany (0.0.1) sha256=0e127a9132698766d7e752e82cdac8250b6adbd09e6c0a7fbbb6f61964fedee7
563
+ stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
564
+ thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
565
+ timeout (0.6.0) sha256=6d722ad619f96ee383a0c557ec6eb8c4ecb08af3af62098a0be5057bf00de1af
566
+ track_open_instances (0.1.15) sha256=7f0e48821e6b4c881daaa40fb1583e308937c22a9c84883c150b399c3b5c3029
567
+ treetop (1.6.18) sha256=a3043f32f1c652aa2abdf3a3848edb2d2f69897257af2675516ac61355c183da
568
+ tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
569
+ tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
570
+ unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
571
+ unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
572
+ uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
573
+ useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844
574
+ websocket-driver (0.8.0) sha256=ed0dba4b943c22f17f9a734817e808bc84cdce6a7e22045f5315aa57676d4962
575
+ websocket-extensions (0.1.5) sha256=1c6ba63092cda343eb53fc657110c71c754c56484aad42578495227d717a8241
576
+ with_advisory_lock (7.5.0) sha256=dadb2f1ed35a10ed7b9649a6769e6848bc64f735a85eb8a6e162a81d383a15bf
577
+ zeitwerk (2.7.4) sha256=2bef90f356bdafe9a6c2bd32bcd804f83a4f9b8bc27f3600fff051eb3edcec8b
578
+
395
579
  BUNDLED WITH
396
- 4.0.0
580
+ 4.0.2
@@ -72,20 +72,28 @@ module Eventsimple
72
72
  transform_message_data(data_hash, :decrypt)
73
73
  end
74
74
 
75
- def transform_message_data(data_hash, operation)
76
- return data_hash unless message_class
75
+ def transform_message_data(data_hash, operation, klass = message_class)
76
+ return data_hash unless klass
77
77
 
78
- schema = message_class.schema
78
+ schema = klass.schema
79
79
  result = data_hash.transform_keys(&:to_sym).dup
80
80
 
81
81
  schema.keys.each do |key| # rubocop:disable Style/HashEachMethods
82
82
  attr_name = key.name
83
- type = find_type_with_operation(key.type, operation)
84
83
  value = result[attr_name]
85
84
 
86
- next if value.nil? || type.nil?
85
+ next if value.nil?
87
86
 
88
- result[attr_name] = type.public_send(operation, value.to_s)
87
+ nested_class = find_nested_message_class(key.type)
88
+ if nested_class && value.is_a?(Hash)
89
+ # Recursively transform nested Message types
90
+ result[attr_name] = transform_message_data(value, operation, nested_class)
91
+ else
92
+ type = find_type_with_operation(key.type, operation)
93
+ next if type.nil?
94
+
95
+ result[attr_name] = type.public_send(operation, value)
96
+ end
89
97
  end
90
98
 
91
99
  result
@@ -97,5 +105,18 @@ module Eventsimple
97
105
  # For Sum types (optional), check if the right side has the operation
98
106
  type.respond_to?(:right) && type.right.respond_to?(operation) ? type.right : nil
99
107
  end
108
+
109
+ def find_nested_message_class(type)
110
+ # Direct Message class
111
+ return type if type.is_a?(Class) && type < Eventsimple::Message
112
+
113
+ # For Sum types (optional), check if the right side is a Message class
114
+ if type.respond_to?(:right)
115
+ right_type = type.right
116
+ return right_type if right_type.is_a?(Class) && right_type < Eventsimple::Message
117
+ end
118
+
119
+ nil
120
+ end
100
121
  end
101
122
  end
@@ -12,6 +12,12 @@ module Eventsimple
12
12
  g.view_specs false
13
13
  end
14
14
 
15
+ initializer 'eventsimple.time_precision' do
16
+ if ActiveSupport::JSON::Encoding.time_precision < 6
17
+ ActiveSupport::JSON::Encoding.time_precision = 6
18
+ end
19
+ end
20
+
15
21
  config.after_initialize do
16
22
  require 'eventsimple/reactor'
17
23
  require 'eventsimple/outbox/models/cursor'
@@ -53,21 +53,9 @@ module Eventsimple
53
53
  def projection_matches_events?
54
54
  reprojected = self.class.unscoped.find(id).reproject
55
55
 
56
- normalize_times(attributes) == normalize_times(reprojected.attributes)
56
+ attributes == reprojected.attributes
57
57
  end
58
58
 
59
- private
60
-
61
- # Normalize time values to microsecond precision to match PostgreSQL storage.
62
- # This prevents false mismatches due to Ruby's nanosecond vs PostgreSQL's microsecond precision.
63
- def normalize_times(attrs)
64
- attrs.transform_values do |value|
65
- value.is_a?(Time) ? value.change(nsec: value.usec * 1000) : value
66
- end
67
- end
68
-
69
- public
70
-
71
59
  def enable_writes!(&block)
72
60
  was_readonly = @readonly
73
61
  @readonly = false
@@ -1,10 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # require 'active_support/core_ext/object/blank'
3
+ require 'json'
4
4
 
5
5
  module Eventsimple
6
6
  module Types
7
- # Encrypted decorator type that wraps any type and adds encryption methods
8
7
  class EncryptedType
9
8
  include Dry::Types::Type
10
9
  include Dry::Types::Decorator
@@ -23,19 +22,68 @@ module Eventsimple
23
22
  end
24
23
 
25
24
  def encrypt(value)
26
- return value if value.blank?
25
+ return value if value.nil?
26
+ return value if value == '' || (value.is_a?(::String) && value.blank?)
27
27
 
28
- return value if ActiveRecord::Encryption::Encryptor.new.encrypted?(value)
28
+ string_value = serialize_value(value)
29
+ return string_value if ActiveRecord::Encryption::Encryptor.new.encrypted?(string_value)
29
30
 
30
- ActiveRecord::Encryption::Encryptor.new.encrypt(value)
31
+ ActiveRecord::Encryption::Encryptor.new.encrypt(string_value)
31
32
  end
32
33
 
33
34
  def decrypt(value)
34
- return value if value.blank?
35
+ return value if value.nil?
36
+ return value if value == '' || (value.is_a?(::String) && value.blank?)
35
37
 
36
- ActiveRecord::Encryption::Encryptor.new.decrypt(value)
37
- rescue StandardError
38
- value
38
+ decrypted = begin
39
+ ActiveRecord::Encryption::Encryptor.new.decrypt(value)
40
+ rescue StandardError
41
+ return value # Return original if decryption fails
42
+ end
43
+
44
+ deserialize_value(decrypted)
45
+ end
46
+
47
+ private
48
+
49
+ def serialize_value(value)
50
+ case value
51
+ when Array, Hash
52
+ value.to_json
53
+ else
54
+ value.to_s
55
+ end
56
+ end
57
+
58
+ def deserialize_value(string_value)
59
+ # Try using Dry::Types coercion first (works for JSON types like Date, DateTime, Time, Decimal)
60
+ @type.call(string_value)
61
+ rescue Dry::Types::CoercionError, Dry::Types::ConstraintError
62
+ # Fall back to manual deserialization for strict types that don't accept strings
63
+ manual_deserialize(string_value)
64
+ end
65
+
66
+ def manual_deserialize(string_value)
67
+ primitive = primitive_class
68
+
69
+ case primitive&.to_s
70
+ when 'Integer'
71
+ string_value.to_i
72
+ when 'Float'
73
+ string_value.to_f
74
+ when 'Array', 'Hash'
75
+ JSON.parse(string_value)
76
+ else
77
+ string_value
78
+ end
79
+ end
80
+
81
+ def primitive_class
82
+ return nil unless @type.respond_to?(:primitive)
83
+
84
+ @type.primitive
85
+ rescue Dry::Types::PrimitiveInferenceError
86
+ nil
39
87
  end
40
88
  end
41
89
  end
@@ -27,8 +27,9 @@ module Eventsimple
27
27
  end
28
28
 
29
29
  def encrypted
30
- is_string_type = respond_to?(:primitive) && primitive == ::String
31
- raise ArgumentError, "encrypted is only supported for String types" unless is_string_type
30
+ if respond_to?(:name) && name.to_s.include?('TrueClass') && name.to_s.include?('FalseClass')
31
+ raise ArgumentError, 'Bool type does not support encryption'
32
+ end
32
33
 
33
34
  EncryptedType.new(self)
34
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Eventsimple
4
- VERSION = '2.0.6'
4
+ VERSION = '2.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventsimple
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zulfiqar Ali