table_sync 6.4.0 → 6.4.2

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: e58ec3bb926b9efd5452696c0b3c2a006559cb30ee21cd48b66c0883e1cdaffd
4
- data.tar.gz: d120b0e941915d3b53a91c79d9a0d5d33b46cb01b1a2b9747470c15228bdbf8f
3
+ metadata.gz: 27daf53674269b4dbf6fdf48f461e931fce6e5e39d2cb8b194a5685cc2c2df69
4
+ data.tar.gz: 17caea3a4dcbabb976254dcb08a10d72f53d84af5dbb81e5e9e2c3895f3d5c9a
5
5
  SHA512:
6
- metadata.gz: bb0aa2b6c60faee79bd1d16cab3d16fc8e741077209abc54b7bbd7da32e075c990cb7e074a2d8ff149b502ea6900e148794f730d48fa4d646fc877c235d872d6
7
- data.tar.gz: 6c416eb72fbcf7bb5fcfe758d6ec7408fd89d0353fb9be72f7181e41bc287e6bd86e4e06a50b6fee78c69b558c3e11d1a590c451438d43bb2444079fe5c39e61
6
+ metadata.gz: 0c6e7a9b9d262c70b6cca1e3642ca9b1c03dcbe46e0787be8181311c55e0b0dd7b71ba7a0de589a9815176dc95abc1419033f5d232e8964bd077ac87be0983ff
7
+ data.tar.gz: 8108b3d7c88ed2352f379ee639a3f155fc5a9c08c314aa7e843a569c3debc969215790fcff1e3f86c8341a961d4c4f3f9850435d0269d9ba3f5e536347fa9643
data/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [6.4.2] - 2023-11-14
5
+ ### Added
6
+ - Required fields allow accepting empty collections.
7
+
8
+ ## [6.4.1] - 2023-08-15
9
+ ### Added
10
+ - Required fields validation for the Raw and Batch publishers.
11
+
12
+ ## [6.4.0] - 2023-08-15
13
+ ### Changed
14
+ - Fix sort in receiving (#79).
15
+
4
16
  ## [6.3.0] - 2023-07-24
5
17
  ### Changed
6
18
  - Send all original attributes for `delete` events instead of just PK.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- table_sync (6.4.0)
4
+ table_sync (6.4.2)
5
5
  memery
6
6
  rabbit_messaging (~> 0.13)
7
7
  rails
@@ -10,67 +10,67 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actioncable (7.0.7)
14
- actionpack (= 7.0.7)
15
- activesupport (= 7.0.7)
13
+ actioncable (7.0.7.1)
14
+ actionpack (= 7.0.7.1)
15
+ activesupport (= 7.0.7.1)
16
16
  nio4r (~> 2.0)
17
17
  websocket-driver (>= 0.6.1)
18
- actionmailbox (7.0.7)
19
- actionpack (= 7.0.7)
20
- activejob (= 7.0.7)
21
- activerecord (= 7.0.7)
22
- activestorage (= 7.0.7)
23
- activesupport (= 7.0.7)
18
+ actionmailbox (7.0.7.1)
19
+ actionpack (= 7.0.7.1)
20
+ activejob (= 7.0.7.1)
21
+ activerecord (= 7.0.7.1)
22
+ activestorage (= 7.0.7.1)
23
+ activesupport (= 7.0.7.1)
24
24
  mail (>= 2.7.1)
25
25
  net-imap
26
26
  net-pop
27
27
  net-smtp
28
- actionmailer (7.0.7)
29
- actionpack (= 7.0.7)
30
- actionview (= 7.0.7)
31
- activejob (= 7.0.7)
32
- activesupport (= 7.0.7)
28
+ actionmailer (7.0.7.1)
29
+ actionpack (= 7.0.7.1)
30
+ actionview (= 7.0.7.1)
31
+ activejob (= 7.0.7.1)
32
+ activesupport (= 7.0.7.1)
33
33
  mail (~> 2.5, >= 2.5.4)
34
34
  net-imap
35
35
  net-pop
36
36
  net-smtp
37
37
  rails-dom-testing (~> 2.0)
38
- actionpack (7.0.7)
39
- actionview (= 7.0.7)
40
- activesupport (= 7.0.7)
38
+ actionpack (7.0.7.1)
39
+ actionview (= 7.0.7.1)
40
+ activesupport (= 7.0.7.1)
41
41
  rack (~> 2.0, >= 2.2.4)
42
42
  rack-test (>= 0.6.3)
43
43
  rails-dom-testing (~> 2.0)
44
44
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
45
- actiontext (7.0.7)
46
- actionpack (= 7.0.7)
47
- activerecord (= 7.0.7)
48
- activestorage (= 7.0.7)
49
- activesupport (= 7.0.7)
45
+ actiontext (7.0.7.1)
46
+ actionpack (= 7.0.7.1)
47
+ activerecord (= 7.0.7.1)
48
+ activestorage (= 7.0.7.1)
49
+ activesupport (= 7.0.7.1)
50
50
  globalid (>= 0.6.0)
51
51
  nokogiri (>= 1.8.5)
52
- actionview (7.0.7)
53
- activesupport (= 7.0.7)
52
+ actionview (7.0.7.1)
53
+ activesupport (= 7.0.7.1)
54
54
  builder (~> 3.1)
55
55
  erubi (~> 1.4)
56
56
  rails-dom-testing (~> 2.0)
57
57
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
58
- activejob (7.0.7)
59
- activesupport (= 7.0.7)
58
+ activejob (7.0.7.1)
59
+ activesupport (= 7.0.7.1)
60
60
  globalid (>= 0.3.6)
61
- activemodel (7.0.7)
62
- activesupport (= 7.0.7)
63
- activerecord (7.0.7)
64
- activemodel (= 7.0.7)
65
- activesupport (= 7.0.7)
66
- activestorage (7.0.7)
67
- actionpack (= 7.0.7)
68
- activejob (= 7.0.7)
69
- activerecord (= 7.0.7)
70
- activesupport (= 7.0.7)
61
+ activemodel (7.0.7.1)
62
+ activesupport (= 7.0.7.1)
63
+ activerecord (7.0.7.1)
64
+ activemodel (= 7.0.7.1)
65
+ activesupport (= 7.0.7.1)
66
+ activestorage (7.0.7.1)
67
+ actionpack (= 7.0.7.1)
68
+ activejob (= 7.0.7.1)
69
+ activerecord (= 7.0.7.1)
70
+ activesupport (= 7.0.7.1)
71
71
  marcel (~> 1.0)
72
72
  mini_mime (>= 1.1.0)
73
- activesupport (7.0.7)
73
+ activesupport (7.0.7.1)
74
74
  concurrent-ruby (~> 1.0, >= 1.0.2)
75
75
  i18n (>= 1.6, < 2)
76
76
  minitest (>= 5.1)
@@ -91,8 +91,8 @@ GEM
91
91
  diff-lcs (1.5.0)
92
92
  docile (1.4.0)
93
93
  erubi (1.12.0)
94
- globalid (1.1.0)
95
- activesupport (>= 5.0)
94
+ globalid (1.2.1)
95
+ activesupport (>= 6.1)
96
96
  i18n (1.14.1)
97
97
  concurrent-ruby (~> 1.0)
98
98
  json (2.6.3)
@@ -112,7 +112,7 @@ GEM
112
112
  method_source (1.0.0)
113
113
  mini_mime (1.1.5)
114
114
  mini_portile2 (2.8.4)
115
- minitest (5.19.0)
115
+ minitest (5.20.0)
116
116
  net-imap (0.3.7)
117
117
  date
118
118
  net-protocol
@@ -144,20 +144,20 @@ GEM
144
144
  rack (2.2.8)
145
145
  rack-test (2.1.0)
146
146
  rack (>= 1.3)
147
- rails (7.0.7)
148
- actioncable (= 7.0.7)
149
- actionmailbox (= 7.0.7)
150
- actionmailer (= 7.0.7)
151
- actionpack (= 7.0.7)
152
- actiontext (= 7.0.7)
153
- actionview (= 7.0.7)
154
- activejob (= 7.0.7)
155
- activemodel (= 7.0.7)
156
- activerecord (= 7.0.7)
157
- activestorage (= 7.0.7)
158
- activesupport (= 7.0.7)
147
+ rails (7.0.7.1)
148
+ actioncable (= 7.0.7.1)
149
+ actionmailbox (= 7.0.7.1)
150
+ actionmailer (= 7.0.7.1)
151
+ actionpack (= 7.0.7.1)
152
+ actiontext (= 7.0.7.1)
153
+ actionview (= 7.0.7.1)
154
+ activejob (= 7.0.7.1)
155
+ activemodel (= 7.0.7.1)
156
+ activerecord (= 7.0.7.1)
157
+ activestorage (= 7.0.7.1)
158
+ activesupport (= 7.0.7.1)
159
159
  bundler (>= 1.15.0)
160
- railties (= 7.0.7)
160
+ railties (= 7.0.7.1)
161
161
  rails-dom-testing (2.2.0)
162
162
  activesupport (>= 5.0.0)
163
163
  minitest
@@ -165,9 +165,9 @@ GEM
165
165
  rails-html-sanitizer (1.6.0)
166
166
  loofah (~> 2.21)
167
167
  nokogiri (~> 1.14)
168
- railties (7.0.7)
169
- actionpack (= 7.0.7)
170
- activesupport (= 7.0.7)
168
+ railties (7.0.7.1)
169
+ actionpack (= 7.0.7.1)
170
+ activesupport (= 7.0.7.1)
171
171
  method_source
172
172
  rake (>= 12.2)
173
173
  thor (~> 1.0)
@@ -2,6 +2,7 @@
2
2
 
3
3
  class TableSync::Publishing::Batch
4
4
  include Tainbox
5
+ include TableSync::Utils::RequiredValidator
5
6
 
6
7
  attribute :object_class
7
8
  attribute :original_attributes
@@ -11,6 +12,8 @@ class TableSync::Publishing::Batch
11
12
 
12
13
  attribute :event, default: :update
13
14
 
15
+ require_attributes :object_class, :original_attributes
16
+
14
17
  def publish_later
15
18
  job.perform_later(job_attributes)
16
19
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  class TableSync::Publishing::Raw
4
4
  include Tainbox
5
+ include TableSync::Utils::RequiredValidator
5
6
 
6
7
  attribute :model_name
7
8
  attribute :table_name
@@ -13,6 +14,8 @@ class TableSync::Publishing::Raw
13
14
 
14
15
  attribute :event, default: :update
15
16
 
17
+ require_attributes :model_name, :original_attributes
18
+
16
19
  def publish_now
17
20
  message.publish
18
21
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TableSync::Utils::RequiredValidator
4
+ module PrependedInitialization
5
+ def initialize(*)
6
+ super
7
+
8
+ not_filled_attrs = calculate_not_filled_attributes
9
+ if not_filled_attrs.present?
10
+ raise(
11
+ ArgumentError,
12
+ "Some of required attributes is not provided: #{not_filled_attrs.inspect}",
13
+ )
14
+ end
15
+ end
16
+ end
17
+
18
+ module ClassMethods
19
+ def require_attributes(*attributes)
20
+ _required_attributes.push(*attributes)
21
+ end
22
+
23
+ def _required_attributes
24
+ @_required_attributes ||= []
25
+ end
26
+ end
27
+
28
+ module InstanceMethods
29
+ private
30
+
31
+ def calculate_not_filled_attributes
32
+ attributes
33
+ .select { |key, value| key.in?(self.class._required_attributes) && value.nil? }
34
+ .keys
35
+ end
36
+ end
37
+
38
+ def self.included(klass)
39
+ klass.prepend(PrependedInitialization)
40
+ klass.extend(ClassMethods)
41
+ klass.include(InstanceMethods)
42
+ end
43
+ end
@@ -5,5 +5,6 @@ module TableSync
5
5
  require_relative "utils/proc_array"
6
6
  require_relative "utils/proc_keywords_resolver"
7
7
  require_relative "utils/interface_checker"
8
+ require_relative "utils/required_validator"
8
9
  end
9
10
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TableSync
4
- VERSION = "6.4.0"
4
+ VERSION = "6.4.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.4.0
4
+ version: 6.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Umbrellio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-15 00:00:00.000000000 Z
11
+ date: 2023-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: memery
@@ -127,6 +127,7 @@ files:
127
127
  - lib/table_sync/utils/interface_checker.rb
128
128
  - lib/table_sync/utils/proc_array.rb
129
129
  - lib/table_sync/utils/proc_keywords_resolver.rb
130
+ - lib/table_sync/utils/required_validator.rb
130
131
  - lib/table_sync/version.rb
131
132
  - log/.keep
132
133
  - table_sync.gemspec
@@ -149,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
150
  - !ruby/object:Gem::Version
150
151
  version: '0'
151
152
  requirements: []
152
- rubygems_version: 3.4.16
153
+ rubygems_version: 3.4.21
153
154
  signing_key:
154
155
  specification_version: 4
155
156
  summary: DB Table synchronization between microservices based on Model's event system