mongo_trails 10.3.1 → 14.0.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/.github/workflows/test.yml +53 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +19 -0
- data/.ruby-version +1 -0
- data/Appraisals +10 -4
- data/Gemfile +8 -1
- data/README.md +28 -6
- data/Rakefile +17 -0
- data/bin/bump-version +67 -0
- data/gemfiles/rails_7.gemfile +15 -0
- data/gemfiles/rails_7.gemfile.lock +212 -0
- data/gemfiles/rails_8.gemfile +15 -0
- data/gemfiles/rails_8.gemfile.lock +213 -0
- data/gemfiles/rails_8_1.gemfile +15 -0
- data/gemfiles/rails_8_1.gemfile.lock +143 -0
- data/lib/mongo_trails/callback_propagation.rb +77 -0
- data/lib/mongo_trails/config.rb +7 -24
- data/lib/mongo_trails/events/base.rb +5 -308
- data/lib/mongo_trails/model_config.rb +1 -232
- data/lib/mongo_trails/mongo_support/config.rb +7 -1
- data/lib/mongo_trails/mongo_support/criteria.rb +7 -0
- data/lib/mongo_trails/mongo_support/version.rb +249 -19
- data/lib/mongo_trails/mongo_support/version_commit_wrap.rb +37 -0
- data/lib/mongo_trails/mongo_support/write_version_worker.rb +11 -0
- data/lib/mongo_trails/record_trail.rb +21 -262
- data/lib/mongo_trails/version.rb +5 -0
- data/lib/mongo_trails/version_concern.rb +4 -293
- data/lib/mongo_trails.rb +13 -149
- data/mongo_trails.gemspec +19 -20
- metadata +51 -85
- data/.travis.yml +0 -13
- data/Gemfile.lock +0 -62
- data/gemfiles/rails_5.gemfile +0 -9
- data/gemfiles/rails_5.gemfile.lock +0 -63
- data/gemfiles/rails_6.gemfile +0 -9
- data/gemfiles/rails_6.gemfile.lock +0 -63
- data/lib/mongo_trails/attribute_serializers/README.md +0 -10
- data/lib/mongo_trails/attribute_serializers/attribute_serializer_factory.rb +0 -27
- data/lib/mongo_trails/attribute_serializers/cast_attribute_serializer.rb +0 -51
- data/lib/mongo_trails/attribute_serializers/object_attribute.rb +0 -41
- data/lib/mongo_trails/attribute_serializers/object_changes_attribute.rb +0 -44
- data/lib/mongo_trails/cleaner.rb +0 -60
- data/lib/mongo_trails/compatibility.rb +0 -51
- data/lib/mongo_trails/events/create.rb +0 -32
- data/lib/mongo_trails/events/destroy.rb +0 -42
- data/lib/mongo_trails/events/update.rb +0 -60
- data/lib/mongo_trails/frameworks/cucumber.rb +0 -33
- data/lib/mongo_trails/frameworks/rails/controller.rb +0 -109
- data/lib/mongo_trails/frameworks/rails/engine.rb +0 -43
- data/lib/mongo_trails/frameworks/rails.rb +0 -4
- data/lib/mongo_trails/frameworks/rspec/helpers.rb +0 -29
- data/lib/mongo_trails/frameworks/rspec.rb +0 -43
- data/lib/mongo_trails/has_paper_trail.rb +0 -86
- data/lib/mongo_trails/queries/versions/where_object.rb +0 -65
- data/lib/mongo_trails/queries/versions/where_object_changes.rb +0 -75
- data/lib/mongo_trails/record_history.rb +0 -51
- data/lib/mongo_trails/reifier.rb +0 -130
- data/lib/mongo_trails/request.rb +0 -166
- data/lib/mongo_trails/serializers/json.rb +0 -46
- data/lib/mongo_trails/serializers/yaml.rb +0 -43
- data/lib/mongo_trails/type_serializers/postgres_array_serializer.rb +0 -48
- data/lib/mongo_trails/version_number.rb +0 -23
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
mongo_trails (14.0.1)
|
|
5
|
+
mongoid (>= 7, < 10)
|
|
6
|
+
ostruct
|
|
7
|
+
paper_trail (~> 16)
|
|
8
|
+
sidekiq (>= 6.5, < 9)
|
|
9
|
+
|
|
10
|
+
GEM
|
|
11
|
+
remote: https://rubygems.org/
|
|
12
|
+
specs:
|
|
13
|
+
activemodel (8.1.3.1)
|
|
14
|
+
activesupport (= 8.1.3.1)
|
|
15
|
+
activerecord (8.1.3.1)
|
|
16
|
+
activemodel (= 8.1.3.1)
|
|
17
|
+
activesupport (= 8.1.3.1)
|
|
18
|
+
timeout (>= 0.4.0)
|
|
19
|
+
activesupport (8.1.3.1)
|
|
20
|
+
base64
|
|
21
|
+
bigdecimal
|
|
22
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
23
|
+
connection_pool (>= 2.2.5)
|
|
24
|
+
drb
|
|
25
|
+
i18n (>= 1.6, < 2)
|
|
26
|
+
json
|
|
27
|
+
logger (>= 1.4.2)
|
|
28
|
+
minitest (>= 5.1)
|
|
29
|
+
securerandom (>= 0.3)
|
|
30
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
31
|
+
uri (>= 0.13.1)
|
|
32
|
+
addressable (2.8.9)
|
|
33
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
34
|
+
after_commit_everywhere (1.6.0)
|
|
35
|
+
activerecord (>= 4.2)
|
|
36
|
+
activesupport
|
|
37
|
+
appraisal (2.5.0)
|
|
38
|
+
bundler
|
|
39
|
+
rake
|
|
40
|
+
thor (>= 0.14.0)
|
|
41
|
+
ast (2.4.3)
|
|
42
|
+
base64 (0.3.0)
|
|
43
|
+
bigdecimal (4.1.2)
|
|
44
|
+
bson (5.2.0)
|
|
45
|
+
concurrent-ruby (1.3.8)
|
|
46
|
+
connection_pool (3.0.2)
|
|
47
|
+
drb (2.2.3)
|
|
48
|
+
i18n (1.15.2)
|
|
49
|
+
concurrent-ruby (~> 1.0)
|
|
50
|
+
json (2.21.2)
|
|
51
|
+
json-schema (6.2.0)
|
|
52
|
+
addressable (~> 2.8)
|
|
53
|
+
bigdecimal (>= 3.1, < 5)
|
|
54
|
+
language_server-protocol (3.17.0.5)
|
|
55
|
+
lint_roller (1.1.0)
|
|
56
|
+
logger (1.7.0)
|
|
57
|
+
mcp (0.8.0)
|
|
58
|
+
json-schema (>= 4.1)
|
|
59
|
+
minitest (5.27.0)
|
|
60
|
+
mongo (2.25.0)
|
|
61
|
+
base64
|
|
62
|
+
bson (>= 4.14.1, < 6.0.0)
|
|
63
|
+
mongoid (9.1.0)
|
|
64
|
+
activemodel (>= 5.1, < 8.2, != 7.0.0)
|
|
65
|
+
concurrent-ruby (>= 1.0.5, < 2.0)
|
|
66
|
+
mongo (>= 2.18.0, < 3.0.0)
|
|
67
|
+
ostruct
|
|
68
|
+
ostruct (0.6.3)
|
|
69
|
+
paper_trail (16.0.0)
|
|
70
|
+
activerecord (>= 6.1)
|
|
71
|
+
request_store (~> 1.4)
|
|
72
|
+
parallel (1.27.0)
|
|
73
|
+
parser (3.3.10.2)
|
|
74
|
+
ast (~> 2.4.1)
|
|
75
|
+
racc
|
|
76
|
+
prism (1.9.0)
|
|
77
|
+
public_suffix (7.0.5)
|
|
78
|
+
racc (1.8.1)
|
|
79
|
+
rack (3.2.7)
|
|
80
|
+
rainbow (3.1.1)
|
|
81
|
+
rake (13.3.1)
|
|
82
|
+
redis-client (0.30.1)
|
|
83
|
+
connection_pool
|
|
84
|
+
regexp_parser (2.11.3)
|
|
85
|
+
request_store (1.7.0)
|
|
86
|
+
rack (>= 1.4)
|
|
87
|
+
rubocop (1.85.1)
|
|
88
|
+
json (~> 2.3)
|
|
89
|
+
language_server-protocol (~> 3.17.0.2)
|
|
90
|
+
lint_roller (~> 1.1.0)
|
|
91
|
+
mcp (~> 0.6)
|
|
92
|
+
parallel (~> 1.10)
|
|
93
|
+
parser (>= 3.3.0.2)
|
|
94
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
95
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
96
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
97
|
+
ruby-progressbar (~> 1.7)
|
|
98
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
99
|
+
rubocop-ast (1.49.1)
|
|
100
|
+
parser (>= 3.3.7.2)
|
|
101
|
+
prism (~> 1.7)
|
|
102
|
+
ruby-progressbar (1.13.0)
|
|
103
|
+
securerandom (0.4.1)
|
|
104
|
+
sidekiq (8.1.7)
|
|
105
|
+
connection_pool (>= 3.0.0)
|
|
106
|
+
json (>= 2.16.0)
|
|
107
|
+
logger (>= 1.7.0)
|
|
108
|
+
rack (>= 3.2.0)
|
|
109
|
+
redis-client (>= 0.29.0)
|
|
110
|
+
sqlite3 (2.9.2-aarch64-linux-gnu)
|
|
111
|
+
sqlite3 (2.9.2-aarch64-linux-musl)
|
|
112
|
+
sqlite3 (2.9.2-arm-linux-gnu)
|
|
113
|
+
sqlite3 (2.9.2-arm-linux-musl)
|
|
114
|
+
sqlite3 (2.9.2-arm64-darwin)
|
|
115
|
+
sqlite3 (2.9.2-x86-linux-gnu)
|
|
116
|
+
sqlite3 (2.9.2-x86-linux-musl)
|
|
117
|
+
sqlite3 (2.9.2-x86_64-darwin)
|
|
118
|
+
sqlite3 (2.9.2-x86_64-linux-gnu)
|
|
119
|
+
sqlite3 (2.9.2-x86_64-linux-musl)
|
|
120
|
+
thor (1.5.0)
|
|
121
|
+
timeout (0.6.1)
|
|
122
|
+
tzinfo (2.0.6)
|
|
123
|
+
concurrent-ruby (~> 1.0)
|
|
124
|
+
unicode-display_width (3.2.0)
|
|
125
|
+
unicode-emoji (~> 4.1)
|
|
126
|
+
unicode-emoji (4.2.0)
|
|
127
|
+
uri (1.1.1)
|
|
128
|
+
|
|
129
|
+
PLATFORMS
|
|
130
|
+
aarch64-linux-gnu
|
|
131
|
+
aarch64-linux-musl
|
|
132
|
+
arm-linux-gnu
|
|
133
|
+
arm-linux-musl
|
|
134
|
+
arm64-darwin
|
|
135
|
+
x86-linux-gnu
|
|
136
|
+
x86-linux-musl
|
|
137
|
+
x86_64-darwin
|
|
138
|
+
x86_64-linux-gnu
|
|
139
|
+
x86_64-linux-musl
|
|
140
|
+
|
|
141
|
+
DEPENDENCIES
|
|
142
|
+
activerecord (~> 8.0)
|
|
143
|
+
after_commit_everywhere
|
|
144
|
+
appraisal (~> 2.3)
|
|
145
|
+
minitest (~> 5.0)
|
|
146
|
+
mongo_trails!
|
|
147
|
+
rake (~> 13.0)
|
|
148
|
+
rubocop
|
|
149
|
+
sqlite3 (~> 2.9)
|
|
150
|
+
|
|
151
|
+
CHECKSUMS
|
|
152
|
+
activemodel (8.1.3.1) sha256=99cc02ce2faec371d14440949d85787ebd23a907c9baef0a9d4bcd4d21888f88
|
|
153
|
+
activerecord (8.1.3.1) sha256=0a2fb6c28f4938f6b013a3a549bec0a7e37d535f3dc8990e804bcc3258c0403b
|
|
154
|
+
activesupport (8.1.3.1) sha256=85458765f25ea48b9019c46b6bb3fa5683197bf4280d9f06710a6e8d7a831376
|
|
155
|
+
addressable (2.8.9) sha256=cc154fcbe689711808a43601dee7b980238ce54368d23e127421753e46895485
|
|
156
|
+
after_commit_everywhere (1.6.0) sha256=c8b3409a1172e43070d2e57f4b9d7b89dce5a7f057576b748cb9fe0a0dd4d917
|
|
157
|
+
appraisal (2.5.0) sha256=36989221be127913b0dba8d114da2001e6b2dceea7bd4951200eaba764eed3ce
|
|
158
|
+
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
|
|
159
|
+
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
|
|
160
|
+
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
|
|
161
|
+
bson (5.2.0) sha256=c468c1e8a3cfa1e80531cc519a890f85586986721d8e305f83465cc36bb82608
|
|
162
|
+
bundler (4.0.19) sha256=b48056e4c77fb3853cc47775b5447ede44aaa4f53c32f168014ab4fe86587d47
|
|
163
|
+
concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1
|
|
164
|
+
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
|
|
165
|
+
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
|
|
166
|
+
i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5
|
|
167
|
+
json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a
|
|
168
|
+
json-schema (6.2.0) sha256=e8bff46ed845a22c1ab2bd0d7eccf831c01fe23bb3920caa4c74db4306813666
|
|
169
|
+
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
|
|
170
|
+
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
171
|
+
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
172
|
+
mcp (0.8.0) sha256=ae8bd146bb8e168852866fd26f805f52744f6326afb3211e073f78a95e0c34fb
|
|
173
|
+
minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5
|
|
174
|
+
mongo (2.25.0) sha256=b4663884d23523d24f50c579846956444410f939093e8c2a95fa4b76bb929053
|
|
175
|
+
mongo_trails (14.0.1)
|
|
176
|
+
mongoid (9.1.0) sha256=ef7b50f4c84e636850c3431bc3c92f98481f4e1d147ff06a1c21242d0b242a9e
|
|
177
|
+
ostruct (0.6.3) sha256=95a2ed4a4bd1d190784e666b47b2d3f078e4a9efda2fccf18f84ddc6538ed912
|
|
178
|
+
paper_trail (16.0.0) sha256=e9b9f0fb1b8b590c8231cfa931b282ba92f90e066e393930a5e1c61ae4c5019d
|
|
179
|
+
parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
|
|
180
|
+
parser (3.3.10.2) sha256=6f60c84aa4bdcedb6d1a2434b738fe8a8136807b6adc8f7f53b97da9bc4e9357
|
|
181
|
+
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
|
|
182
|
+
public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623
|
|
183
|
+
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
|
|
184
|
+
rack (3.2.7) sha256=93e13e1c24f93556671d85d2d79fa228c3485815c50d7e2f265b5330c6528fb7
|
|
185
|
+
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
|
|
186
|
+
rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
|
|
187
|
+
redis-client (0.30.1) sha256=5151bc5c7bbfe48623732cdae3b900d8a22dc691cc7cdfacfb351ac55116522d
|
|
188
|
+
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
|
|
189
|
+
request_store (1.7.0) sha256=e1b75d5346a315f452242a68c937ef8e48b215b9453a77a6c0acdca2934c88cb
|
|
190
|
+
rubocop (1.85.1) sha256=3dbcf9e961baa4c376eeeb2a03913dca5e3987033b04d38fa538aa1e7406cc77
|
|
191
|
+
rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035
|
|
192
|
+
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
193
|
+
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
|
|
194
|
+
sidekiq (8.1.7) sha256=91ad48c7e6c32e1846bf1d5b74c27948758049b93fed0cb539f8d586c7de3415
|
|
195
|
+
sqlite3 (2.9.2-aarch64-linux-gnu) sha256=eeb86db55645b85327ba75129e3614658d974bf4da8fdc87018a0d42c59f6e42
|
|
196
|
+
sqlite3 (2.9.2-aarch64-linux-musl) sha256=4feff91fb8c2b13688da34b5627c9d1ed9cedb3ee87a7114ec82209147f07a6d
|
|
197
|
+
sqlite3 (2.9.2-arm-linux-gnu) sha256=1ee2eb06b5301aaf5ce343a6e88d99ac932d95202d7b350f0e7b6d8d588580d7
|
|
198
|
+
sqlite3 (2.9.2-arm-linux-musl) sha256=8ca0de6aceede968de0394e22e95d549834c4d8e318f69a92a52f049878a0057
|
|
199
|
+
sqlite3 (2.9.2-arm64-darwin) sha256=d15bd9609a05f9d54930babe039585efc8cadd57517c15b64ec7dfa75158a5e9
|
|
200
|
+
sqlite3 (2.9.2-x86-linux-gnu) sha256=066bc904522f8a7072236a81237c03a4a1dfe070a25107e392de03d1e4ad0e6d
|
|
201
|
+
sqlite3 (2.9.2-x86-linux-musl) sha256=6503c76278f5e8629b12b6518ff43a9a4f6d9381de73f0b086c9fa1226db5ede
|
|
202
|
+
sqlite3 (2.9.2-x86_64-darwin) sha256=ed691b5021674d72582d03c5a38e89634b961902735fb6225273892805421d13
|
|
203
|
+
sqlite3 (2.9.2-x86_64-linux-gnu) sha256=dce83ffcb7e72f9f7aeb6e5404f15d277a45332fe18ccce8a8b3ed51e8d23aee
|
|
204
|
+
sqlite3 (2.9.2-x86_64-linux-musl) sha256=e8dd906a613f13b60f6d47ae9dda376384d9de1ab3f7e3f2fdf2fd18a871a2d7
|
|
205
|
+
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
|
|
206
|
+
timeout (0.6.1) sha256=78f57368a7e7bbadec56971f78a3f5ecbcfb59b7fcbb0a3ed6ddc08a5094accb
|
|
207
|
+
tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
|
|
208
|
+
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
|
|
209
|
+
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
|
|
210
|
+
uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
|
|
211
|
+
|
|
212
|
+
BUNDLED WITH
|
|
213
|
+
4.0.19
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file was generated by Appraisal
|
|
4
|
+
|
|
5
|
+
source 'https://rubygems.org'
|
|
6
|
+
|
|
7
|
+
gem 'activerecord', '~> 8.1'
|
|
8
|
+
gem 'after_commit_everywhere'
|
|
9
|
+
gem 'appraisal', '~> 2.3'
|
|
10
|
+
gem 'minitest', '~> 5.0'
|
|
11
|
+
gem 'rake', '~> 13.0'
|
|
12
|
+
gem 'rubocop', require: false
|
|
13
|
+
gem 'sqlite3', '~> 2.9'
|
|
14
|
+
|
|
15
|
+
gemspec path: '../'
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
mongo_trails (14.0.1)
|
|
5
|
+
mongoid (>= 7, < 10)
|
|
6
|
+
ostruct
|
|
7
|
+
paper_trail (~> 16)
|
|
8
|
+
sidekiq (>= 6.5, < 9)
|
|
9
|
+
|
|
10
|
+
GEM
|
|
11
|
+
remote: https://rubygems.org/
|
|
12
|
+
specs:
|
|
13
|
+
activemodel (8.1.3.1)
|
|
14
|
+
activesupport (= 8.1.3.1)
|
|
15
|
+
activerecord (8.1.3.1)
|
|
16
|
+
activemodel (= 8.1.3.1)
|
|
17
|
+
activesupport (= 8.1.3.1)
|
|
18
|
+
timeout (>= 0.4.0)
|
|
19
|
+
activesupport (8.1.3.1)
|
|
20
|
+
base64
|
|
21
|
+
bigdecimal
|
|
22
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
23
|
+
connection_pool (>= 2.2.5)
|
|
24
|
+
drb
|
|
25
|
+
i18n (>= 1.6, < 2)
|
|
26
|
+
json
|
|
27
|
+
logger (>= 1.4.2)
|
|
28
|
+
minitest (>= 5.1)
|
|
29
|
+
securerandom (>= 0.3)
|
|
30
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
31
|
+
uri (>= 0.13.1)
|
|
32
|
+
after_commit_everywhere (1.6.0)
|
|
33
|
+
activerecord (>= 4.2)
|
|
34
|
+
activesupport
|
|
35
|
+
appraisal (2.5.0)
|
|
36
|
+
bundler
|
|
37
|
+
rake
|
|
38
|
+
thor (>= 0.14.0)
|
|
39
|
+
ast (2.4.3)
|
|
40
|
+
base64 (0.3.0)
|
|
41
|
+
bigdecimal (4.1.2)
|
|
42
|
+
bson (5.2.0)
|
|
43
|
+
concurrent-ruby (1.3.8)
|
|
44
|
+
connection_pool (3.0.2)
|
|
45
|
+
drb (2.2.3)
|
|
46
|
+
i18n (1.15.2)
|
|
47
|
+
concurrent-ruby (~> 1.0)
|
|
48
|
+
json (2.21.2)
|
|
49
|
+
language_server-protocol (3.17.0.5)
|
|
50
|
+
lint_roller (1.1.0)
|
|
51
|
+
logger (1.7.0)
|
|
52
|
+
minitest (5.27.0)
|
|
53
|
+
mongo (2.25.0)
|
|
54
|
+
base64
|
|
55
|
+
bson (>= 4.14.1, < 6.0.0)
|
|
56
|
+
mongoid (9.1.0)
|
|
57
|
+
activemodel (>= 5.1, < 8.2, != 7.0.0)
|
|
58
|
+
concurrent-ruby (>= 1.0.5, < 2.0)
|
|
59
|
+
mongo (>= 2.18.0, < 3.0.0)
|
|
60
|
+
ostruct
|
|
61
|
+
ostruct (0.6.3)
|
|
62
|
+
paper_trail (16.0.0)
|
|
63
|
+
activerecord (>= 6.1)
|
|
64
|
+
request_store (~> 1.4)
|
|
65
|
+
parallel (1.28.0)
|
|
66
|
+
parser (3.3.11.1)
|
|
67
|
+
ast (~> 2.4.1)
|
|
68
|
+
racc
|
|
69
|
+
prism (1.9.0)
|
|
70
|
+
racc (1.8.1)
|
|
71
|
+
rack (3.2.7)
|
|
72
|
+
rainbow (3.1.1)
|
|
73
|
+
rake (13.3.1)
|
|
74
|
+
redis-client (0.30.1)
|
|
75
|
+
connection_pool
|
|
76
|
+
regexp_parser (2.12.0)
|
|
77
|
+
request_store (1.7.0)
|
|
78
|
+
rack (>= 1.4)
|
|
79
|
+
rubocop (1.86.1)
|
|
80
|
+
json (~> 2.3)
|
|
81
|
+
language_server-protocol (~> 3.17.0.2)
|
|
82
|
+
lint_roller (~> 1.1.0)
|
|
83
|
+
parallel (>= 1.10)
|
|
84
|
+
parser (>= 3.3.0.2)
|
|
85
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
86
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
87
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
88
|
+
ruby-progressbar (~> 1.7)
|
|
89
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
90
|
+
rubocop-ast (1.49.1)
|
|
91
|
+
parser (>= 3.3.7.2)
|
|
92
|
+
prism (~> 1.7)
|
|
93
|
+
ruby-progressbar (1.13.0)
|
|
94
|
+
securerandom (0.4.1)
|
|
95
|
+
sidekiq (8.1.7)
|
|
96
|
+
connection_pool (>= 3.0.0)
|
|
97
|
+
json (>= 2.16.0)
|
|
98
|
+
logger (>= 1.7.0)
|
|
99
|
+
rack (>= 3.2.0)
|
|
100
|
+
redis-client (>= 0.29.0)
|
|
101
|
+
sqlite3 (2.9.2-aarch64-linux-gnu)
|
|
102
|
+
sqlite3 (2.9.2-aarch64-linux-musl)
|
|
103
|
+
sqlite3 (2.9.2-arm-linux-gnu)
|
|
104
|
+
sqlite3 (2.9.2-arm-linux-musl)
|
|
105
|
+
sqlite3 (2.9.2-arm64-darwin)
|
|
106
|
+
sqlite3 (2.9.2-x86-linux-gnu)
|
|
107
|
+
sqlite3 (2.9.2-x86-linux-musl)
|
|
108
|
+
sqlite3 (2.9.2-x86_64-darwin)
|
|
109
|
+
sqlite3 (2.9.2-x86_64-linux-gnu)
|
|
110
|
+
sqlite3 (2.9.2-x86_64-linux-musl)
|
|
111
|
+
thor (1.5.0)
|
|
112
|
+
timeout (0.6.1)
|
|
113
|
+
tzinfo (2.0.6)
|
|
114
|
+
concurrent-ruby (~> 1.0)
|
|
115
|
+
unicode-display_width (3.2.0)
|
|
116
|
+
unicode-emoji (~> 4.1)
|
|
117
|
+
unicode-emoji (4.2.0)
|
|
118
|
+
uri (1.1.1)
|
|
119
|
+
|
|
120
|
+
PLATFORMS
|
|
121
|
+
aarch64-linux-gnu
|
|
122
|
+
aarch64-linux-musl
|
|
123
|
+
arm-linux-gnu
|
|
124
|
+
arm-linux-musl
|
|
125
|
+
arm64-darwin
|
|
126
|
+
x86-linux-gnu
|
|
127
|
+
x86-linux-musl
|
|
128
|
+
x86_64-darwin
|
|
129
|
+
x86_64-linux-gnu
|
|
130
|
+
x86_64-linux-musl
|
|
131
|
+
|
|
132
|
+
DEPENDENCIES
|
|
133
|
+
activerecord (~> 8.1)
|
|
134
|
+
after_commit_everywhere
|
|
135
|
+
appraisal (~> 2.3)
|
|
136
|
+
minitest (~> 5.0)
|
|
137
|
+
mongo_trails!
|
|
138
|
+
rake (~> 13.0)
|
|
139
|
+
rubocop
|
|
140
|
+
sqlite3 (~> 2.9)
|
|
141
|
+
|
|
142
|
+
BUNDLED WITH
|
|
143
|
+
4.0.19
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MongoTrails
|
|
4
|
+
class CallbackPropagation
|
|
5
|
+
PRESERVED_ATTRIBUTES = %w[_id item_type item_id event object object_changes integer_id].freeze
|
|
6
|
+
|
|
7
|
+
attr_reader :version
|
|
8
|
+
|
|
9
|
+
def initialize(source, version, bang:)
|
|
10
|
+
@source = source
|
|
11
|
+
@version = version
|
|
12
|
+
@bang = bang
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def merge!(new_version, bang:)
|
|
16
|
+
merge_changes!(new_version.object_changes)
|
|
17
|
+
copy_latest_metadata!(new_version)
|
|
18
|
+
@bang ||= bang
|
|
19
|
+
self
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def snapshot
|
|
23
|
+
{
|
|
24
|
+
object_changes: version.object_changes.to_h.deep_dup,
|
|
25
|
+
metadata: latest_metadata.deep_dup,
|
|
26
|
+
bang: @bang
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def restore!(snapshot)
|
|
31
|
+
version.object_changes = snapshot.fetch(:object_changes)
|
|
32
|
+
snapshot.fetch(:metadata).each { |attribute, value| version[attribute] = value }
|
|
33
|
+
@bang = snapshot.fetch(:bang)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def persist
|
|
37
|
+
version.send(:persist_version, version, bang: @bang)
|
|
38
|
+
ensure
|
|
39
|
+
clear
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def clear
|
|
43
|
+
propagations = @source.instance_variable_get(:@mongo_trails_callback_propagations)
|
|
44
|
+
propagations&.delete(version.event) if propagations&.fetch(version.event, nil).equal?(self)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def merge_changes!(new_changes)
|
|
50
|
+
changes = version.object_changes.to_h.deep_dup
|
|
51
|
+
|
|
52
|
+
new_changes.to_h.each do |attribute, values|
|
|
53
|
+
key = attribute.to_s
|
|
54
|
+
changes[key] = merged_values(changes[key], values)
|
|
55
|
+
changes.delete(key) if unchanged?(changes[key])
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
version.object_changes = changes
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def merged_values(previous_values, new_values)
|
|
62
|
+
previous_values ? [previous_values.first, new_values.last] : new_values
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def unchanged?(values)
|
|
66
|
+
values.first == values.last
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def copy_latest_metadata!(new_version)
|
|
70
|
+
latest_metadata(new_version).each { |attribute, value| version[attribute] = value }
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def latest_metadata(source = version)
|
|
74
|
+
source.attributes.except(*PRESERVED_ATTRIBUTES)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
data/lib/mongo_trails/config.rb
CHANGED
|
@@ -1,41 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "singleton"
|
|
4
|
-
require "mongo_trails/serializers/yaml"
|
|
5
|
-
|
|
6
3
|
module PaperTrail
|
|
7
|
-
# Global configuration affecting all threads. Some thread-specific
|
|
8
|
-
# configuration can be found in `paper_trail.rb`, others in `controller.rb`.
|
|
9
4
|
class Config
|
|
10
|
-
include Singleton
|
|
11
|
-
|
|
12
5
|
attr_accessor(
|
|
13
|
-
:association_reify_error_behaviour,
|
|
14
|
-
:object_changes_adapter,
|
|
15
|
-
:serializer,
|
|
16
|
-
:version_limit,
|
|
17
|
-
:has_paper_trail_defaults,
|
|
18
6
|
:mongo_config,
|
|
19
|
-
:mongo_prefix
|
|
7
|
+
:mongo_prefix,
|
|
8
|
+
:enable_sidekiq,
|
|
9
|
+
:sidekiq_worker,
|
|
10
|
+
:sidekiq_options,
|
|
11
|
+
:mongo_trails_config
|
|
20
12
|
)
|
|
21
13
|
|
|
22
14
|
def initialize
|
|
23
|
-
# Variables which affect all threads, whose access is synchronized.
|
|
24
15
|
@mutex = Mutex.new
|
|
25
16
|
@enabled = true
|
|
26
17
|
|
|
27
|
-
# Variables which affect all threads, whose access is *not* synchronized.
|
|
28
18
|
@serializer = PaperTrail::Serializers::YAML
|
|
29
19
|
@has_paper_trail_defaults = {}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
# Indicates whether PaperTrail is on or off. Default: true.
|
|
33
|
-
def enabled
|
|
34
|
-
@mutex.synchronize { !!@enabled }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def enabled=(enable)
|
|
38
|
-
@mutex.synchronize { @enabled = enable }
|
|
20
|
+
@enable_sidekiq = false
|
|
21
|
+
@sidekiq_options = { queue: :default, retry: true, backtrace: false }
|
|
39
22
|
end
|
|
40
23
|
end
|
|
41
24
|
end
|