wal 0.0.0 → 0.0.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.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/README.md +49 -0
  4. data/Rakefile +9 -1
  5. data/exe/wal +64 -0
  6. data/lib/wal/active_record_context_extension.rb +15 -0
  7. data/lib/wal/noop_watcher.rb +12 -0
  8. data/lib/wal/record_watcher.rb +389 -0
  9. data/lib/wal/replicator.rb +205 -0
  10. data/lib/wal/streaming_watcher.rb +74 -0
  11. data/lib/wal/version.rb +2 -1
  12. data/lib/wal/watcher.rb +95 -0
  13. data/lib/wal.rb +128 -1
  14. data/rbi/wal.rbi +295 -0
  15. data/sig/wal.rbs +184 -2
  16. data/sorbet/config +7 -0
  17. data/sorbet/rbi/annotations/.gitattributes +1 -0
  18. data/sorbet/rbi/annotations/activemodel.rbi +89 -0
  19. data/sorbet/rbi/annotations/activerecord.rbi +98 -0
  20. data/sorbet/rbi/annotations/activesupport.rbi +463 -0
  21. data/sorbet/rbi/annotations/minitest.rbi +119 -0
  22. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  23. data/sorbet/rbi/gems/.gitattributes +1 -0
  24. data/sorbet/rbi/gems/actioncable@8.0.2.rbi +9 -0
  25. data/sorbet/rbi/gems/actionmailbox@8.0.2.rbi +9 -0
  26. data/sorbet/rbi/gems/actionmailer@8.0.2.rbi +9 -0
  27. data/sorbet/rbi/gems/actionpack@8.0.2.rbi +21122 -0
  28. data/sorbet/rbi/gems/actiontext@8.0.2.rbi +9 -0
  29. data/sorbet/rbi/gems/actionview@8.0.2.rbi +16423 -0
  30. data/sorbet/rbi/gems/activejob@8.0.2.rbi +9 -0
  31. data/sorbet/rbi/gems/activemodel@8.0.2.rbi +6866 -0
  32. data/sorbet/rbi/gems/activerecord@8.0.2.rbi +43227 -0
  33. data/sorbet/rbi/gems/activestorage@8.0.2.rbi +9 -0
  34. data/sorbet/rbi/gems/activesupport@8.0.2.rbi +21110 -0
  35. data/sorbet/rbi/gems/ast@2.4.3.rbi +585 -0
  36. data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
  37. data/sorbet/rbi/gems/benchmark@0.4.1.rbi +619 -0
  38. data/sorbet/rbi/gems/bigdecimal@3.2.2.rbi +78 -0
  39. data/sorbet/rbi/gems/builder@3.3.0.rbi +9 -0
  40. data/sorbet/rbi/gems/commander@5.0.0.rbi +9 -0
  41. data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +11657 -0
  42. data/sorbet/rbi/gems/connection_pool@2.5.3.rbi +9 -0
  43. data/sorbet/rbi/gems/crass@1.0.6.rbi +623 -0
  44. data/sorbet/rbi/gems/date@3.4.1.rbi +75 -0
  45. data/sorbet/rbi/gems/diff-lcs@1.6.2.rbi +1134 -0
  46. data/sorbet/rbi/gems/docker-api@2.4.0.rbi +1719 -0
  47. data/sorbet/rbi/gems/docopt@0.6.1.rbi +9 -0
  48. data/sorbet/rbi/gems/drb@2.2.3.rbi +1661 -0
  49. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  50. data/sorbet/rbi/gems/excon@1.2.7.rbi +1514 -0
  51. data/sorbet/rbi/gems/globalid@1.2.1.rbi +9 -0
  52. data/sorbet/rbi/gems/highline@3.0.1.rbi +9 -0
  53. data/sorbet/rbi/gems/i18n@1.14.7.rbi +2359 -0
  54. data/sorbet/rbi/gems/io-console@0.8.0.rbi +9 -0
  55. data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
  56. data/sorbet/rbi/gems/loofah@2.24.1.rbi +1105 -0
  57. data/sorbet/rbi/gems/mail@2.8.1.rbi +9 -0
  58. data/sorbet/rbi/gems/marcel@1.0.4.rbi +9 -0
  59. data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +9 -0
  60. data/sorbet/rbi/gems/minitest@5.25.5.rbi +1704 -0
  61. data/sorbet/rbi/gems/multi_json@1.15.0.rbi +268 -0
  62. data/sorbet/rbi/gems/net-imap@0.5.9.rbi +9 -0
  63. data/sorbet/rbi/gems/net-pop@0.1.2.rbi +9 -0
  64. data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +292 -0
  65. data/sorbet/rbi/gems/net-smtp@0.5.1.rbi +9 -0
  66. data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
  67. data/sorbet/rbi/gems/nio4r@2.7.4.rbi +9 -0
  68. data/sorbet/rbi/gems/nokogiri@1.18.8.rbi +8206 -0
  69. data/sorbet/rbi/gems/ostruct@0.6.2.rbi +354 -0
  70. data/sorbet/rbi/gems/parallel@1.27.0.rbi +291 -0
  71. data/sorbet/rbi/gems/parlour@9.1.1.rbi +3071 -0
  72. data/sorbet/rbi/gems/parser@3.3.8.0.rbi +7338 -0
  73. data/sorbet/rbi/gems/pg-replication-protocol@0.0.7.rbi +633 -0
  74. data/sorbet/rbi/gems/pg@1.5.9.rbi +2806 -0
  75. data/sorbet/rbi/gems/pp@0.6.2.rbi +368 -0
  76. data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +477 -0
  77. data/sorbet/rbi/gems/prism@1.4.0.rbi +41732 -0
  78. data/sorbet/rbi/gems/psych@5.2.3.rbi +2435 -0
  79. data/sorbet/rbi/gems/racc@1.8.1.rbi +160 -0
  80. data/sorbet/rbi/gems/rack-session@2.1.1.rbi +727 -0
  81. data/sorbet/rbi/gems/rack-test@2.2.0.rbi +734 -0
  82. data/sorbet/rbi/gems/rack@3.1.16.rbi +4940 -0
  83. data/sorbet/rbi/gems/rackup@2.2.1.rbi +230 -0
  84. data/sorbet/rbi/gems/rails-dom-testing@2.3.0.rbi +858 -0
  85. data/sorbet/rbi/gems/rails-html-sanitizer@1.6.2.rbi +785 -0
  86. data/sorbet/rbi/gems/rails@8.0.2.rbi +9 -0
  87. data/sorbet/rbi/gems/railties@8.0.2.rbi +3865 -0
  88. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
  89. data/sorbet/rbi/gems/rake@13.2.1.rbi +3120 -0
  90. data/sorbet/rbi/gems/rbi@0.3.6.rbi +6893 -0
  91. data/sorbet/rbi/gems/rbs@3.9.4.rbi +6978 -0
  92. data/sorbet/rbi/gems/rdoc@6.12.0.rbi +12760 -0
  93. data/sorbet/rbi/gems/reline@0.6.0.rbi +2451 -0
  94. data/sorbet/rbi/gems/rexml@3.4.1.rbi +5240 -0
  95. data/sorbet/rbi/gems/rspec-core@3.13.4.rbi +11348 -0
  96. data/sorbet/rbi/gems/rspec-expectations@3.13.5.rbi +8189 -0
  97. data/sorbet/rbi/gems/rspec-mocks@3.13.5.rbi +5350 -0
  98. data/sorbet/rbi/gems/rspec-sorbet@1.9.2.rbi +164 -0
  99. data/sorbet/rbi/gems/rspec-support@3.13.4.rbi +1630 -0
  100. data/sorbet/rbi/gems/rspec@3.13.1.rbi +83 -0
  101. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
  102. data/sorbet/rbi/gems/spoom@1.6.3.rbi +6985 -0
  103. data/sorbet/rbi/gems/stringio@3.1.5.rbi +9 -0
  104. data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3628 -0
  105. data/sorbet/rbi/gems/testcontainers-core@0.2.0.rbi +1005 -0
  106. data/sorbet/rbi/gems/testcontainers-postgres@0.2.0.rbi +145 -0
  107. data/sorbet/rbi/gems/thor@1.3.2.rbi +4378 -0
  108. data/sorbet/rbi/gems/timeout@0.4.3.rbi +157 -0
  109. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5918 -0
  110. data/sorbet/rbi/gems/uri@1.0.3.rbi +2349 -0
  111. data/sorbet/rbi/gems/useragent@0.16.11.rbi +9 -0
  112. data/sorbet/rbi/gems/websocket-driver@0.8.0.rbi +9 -0
  113. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +9 -0
  114. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
  115. data/sorbet/rbi/gems/yard@0.9.37.rbi +18379 -0
  116. data/sorbet/rbi/gems/zeitwerk@2.7.3.rbi +9 -0
  117. data/sorbet/tapioca/config.yml +5 -0
  118. data/sorbet/tapioca/require.rb +12 -0
  119. metadata +231 -6
data/rbi/wal.rbi ADDED
@@ -0,0 +1,295 @@
1
+ # typed: strong
2
+ module Wal
3
+ Event = T.type_alias { T.any(
4
+ BeginTransactionEvent,
5
+ CommitTransactionEvent,
6
+ InsertEvent,
7
+ UpdateEvent,
8
+ DeleteEvent,
9
+ ) }
10
+ VERSION = "0.0.2"
11
+
12
+ class BeginTransactionEvent < T::Struct
13
+ prop :transaction_id, Integer, immutable: true
14
+ prop :lsn, Integer, immutable: true
15
+ prop :final_lsn, Integer, immutable: true
16
+ prop :timestamp, Time, immutable: true
17
+
18
+ extend T::Sig
19
+
20
+ sig { returns(Integer) }
21
+ def estimated_size; end
22
+ end
23
+
24
+ class CommitTransactionEvent < T::Struct
25
+ prop :transaction_id, Integer, immutable: true
26
+ prop :lsn, Integer, immutable: true
27
+ prop :context, T::Hash[String, T.untyped], immutable: true
28
+ prop :timestamp, Time, immutable: true
29
+
30
+ end
31
+
32
+ module ChangeEvent
33
+ extend T::Sig
34
+
35
+ sig { returns(T::Hash[String, [T.untyped, T.untyped]]) }
36
+ def diff; end
37
+
38
+ sig { params(attribute: T.any(Symbol, String)).returns(T::Boolean) }
39
+ def changed_attribute?(attribute); end
40
+
41
+ sig { params(attribute: T.any(Symbol, String)).returns(T.untyped) }
42
+ def attribute(attribute); end
43
+
44
+ sig { params(attribute: T.any(Symbol, String)).returns(T.nilable([T.untyped, T.untyped])) }
45
+ def attribute_changes(attribute); end
46
+
47
+ sig { params(attribute: T.any(Symbol, String)).returns(T.untyped) }
48
+ def attribute_was(attribute); end
49
+ end
50
+
51
+ class InsertEvent < T::Struct
52
+ prop :transaction_id, Integer, immutable: true
53
+ prop :lsn, Integer, immutable: true
54
+ prop :context, T::Hash[String, T.untyped], immutable: true
55
+ prop :table, String, immutable: true
56
+ prop :primary_key, T.untyped, immutable: true
57
+ prop :new, T::Hash[String, T.untyped], immutable: true
58
+
59
+ include ::Wal::ChangeEvent
60
+ extend T::Sig
61
+
62
+ sig { returns(T::Hash[String, [T.untyped, T.untyped]]) }
63
+ def diff; end
64
+ end
65
+
66
+ class UpdateEvent < T::Struct
67
+ prop :transaction_id, Integer, immutable: true
68
+ prop :lsn, Integer, immutable: true
69
+ prop :context, T::Hash[String, T.untyped], immutable: true
70
+ prop :table, String, immutable: true
71
+ prop :primary_key, T.untyped, immutable: true
72
+ prop :old, T::Hash[String, T.untyped], immutable: true
73
+ prop :new, T::Hash[String, T.untyped], immutable: true
74
+
75
+ include ::Wal::ChangeEvent
76
+ extend T::Sig
77
+
78
+ sig { returns(T::Hash[String, [T.untyped, T.untyped]]) }
79
+ def diff; end
80
+ end
81
+
82
+ class DeleteEvent < T::Struct
83
+ prop :transaction_id, Integer, immutable: true
84
+ prop :lsn, Integer, immutable: true
85
+ prop :context, T::Hash[String, T.untyped], immutable: true
86
+ prop :table, String, immutable: true
87
+ prop :primary_key, T.untyped, immutable: true
88
+ prop :old, T::Hash[String, T.untyped], immutable: true
89
+
90
+ include ::Wal::ChangeEvent
91
+ extend T::Sig
92
+
93
+ sig { returns(T::Hash[String, [T.untyped, T.untyped]]) }
94
+ def diff; end
95
+ end
96
+
97
+ module ActiveRecordContextExtension
98
+ sig { params(context: T.untyped, prefix: T.untyped).returns(T.untyped) }
99
+ def set_wal_watcher_context(context, prefix: ""); end
100
+ end
101
+
102
+ class NoopWatcher
103
+ include Wal::Watcher
104
+ extend T::Sig
105
+
106
+ sig { override.params(event: Event).void }
107
+ def on_event(event); end
108
+ end
109
+
110
+ class RecordWatcher
111
+ abstract!
112
+
113
+ include Wal::Watcher
114
+ extend T::Sig
115
+ extend T::Helpers
116
+ RecordEvent = T.type_alias { T.any(InsertEvent, UpdateEvent, DeleteEvent) }
117
+
118
+ sig { params(subclass: T.untyped).returns(T.untyped) }
119
+ def self.inherited(subclass); end
120
+
121
+ sig { params(table: T.any(String, T.class_of(::ActiveRecord::Base)), block: T.proc.bind(T.attached_class).params(event: InsertEvent).void).void }
122
+ def self.on_insert(table, &block); end
123
+
124
+ sig { params(table: T.any(String, T.class_of(::ActiveRecord::Base)), changed: T.nilable(T::Array[T.any(String, Symbol)]), block: T.proc.bind(T.attached_class).params(event: UpdateEvent).void).void }
125
+ def self.on_update(table, changed: nil, &block); end
126
+
127
+ sig { params(table: T.any(String, T.class_of(::ActiveRecord::Base)), changed: T.nilable(T::Array[T.any(String, Symbol)]), block: T.proc.bind(T.attached_class).params(event: T.any(InsertEvent, UpdateEvent)).void).void }
128
+ def self.on_save(table, changed: nil, &block); end
129
+
130
+ sig { params(table: T.any(String, T.class_of(::ActiveRecord::Base)), block: T.proc.bind(T.attached_class).params(event: DeleteEvent).void).void }
131
+ def self.on_destroy(table, &block); end
132
+
133
+ sig { params(event: RecordEvent).void }
134
+ def on_record_changed(event); end
135
+
136
+ sig { params(table: String).returns(T::Boolean) }
137
+ def should_watch_table?(table); end
138
+
139
+ sig { params(event: BeginTransactionEvent).returns(Symbol) }
140
+ def aggregation_strategy(event); end
141
+
142
+ sig { override.params(event: Event).void }
143
+ def on_event(event); end
144
+
145
+ class MemoryRecordWatcher
146
+ include Wal::Watcher
147
+ include Wal::Watcher::SeparatedEvents
148
+ extend T::Sig
149
+ extend T::Helpers
150
+ RecordsStorage = T.type_alias { T::Hash[[String, Integer], T.nilable(RecordEvent)] }
151
+
152
+ sig { params(watcher: T.untyped).void }
153
+ def initialize(watcher); end
154
+
155
+ sig { params(event: BeginTransactionEvent).void }
156
+ def on_begin(event); end
157
+
158
+ sig { params(_event: T.untyped).returns(T.untyped) }
159
+ def on_commit(_event); end
160
+
161
+ sig { params(event: InsertEvent).void }
162
+ def on_insert(event); end
163
+
164
+ sig { params(event: UpdateEvent).void }
165
+ def on_update(event); end
166
+
167
+ sig { params(event: DeleteEvent).void }
168
+ def on_delete(event); end
169
+ end
170
+
171
+ class TemporaryTableRecordWatcher
172
+ include Wal::Watcher
173
+ include Wal::Watcher::SeparatedEvents
174
+ extend T::Sig
175
+ extend T::Helpers
176
+
177
+ sig { params(watcher: T.untyped, batch_size: T.untyped).void }
178
+ def initialize(watcher, batch_size: 5_000); end
179
+
180
+ sig { params(event: BeginTransactionEvent).void }
181
+ def on_begin(event); end
182
+
183
+ sig { params(_event: T.untyped).returns(T.untyped) }
184
+ def on_commit(_event); end
185
+
186
+ sig { params(event: InsertEvent).void }
187
+ def on_insert(event); end
188
+
189
+ sig { params(event: UpdateEvent).void }
190
+ def on_update(event); end
191
+
192
+ sig { params(event: DeleteEvent).void }
193
+ def on_delete(event); end
194
+
195
+ sig { returns(T.class_of(::ActiveRecord::Base)) }
196
+ def base_class; end
197
+
198
+ sig { params(event: T.untyped).returns(T.untyped) }
199
+ def serialize(event); end
200
+
201
+ sig { params(persisted_event: T.untyped).returns(T.untyped) }
202
+ def deserialize(persisted_event); end
203
+ end
204
+ end
205
+
206
+ class Replicator
207
+ include PG::Replication::Protocol
208
+ extend T::Sig
209
+
210
+ sig { params(replication_slot: String, use_temporary_slot: T::Boolean, db_config: T::Hash[Symbol, T.untyped]).void }
211
+ def initialize(replication_slot:, use_temporary_slot: false, db_config: ActiveRecord::Base.configurations.configs_for(name: "primary").configuration_hash); end
212
+
213
+ sig { params(watcher: Watcher, publications: T::Array[String]).void }
214
+ def replicate_forever(watcher, publications:); end
215
+
216
+ sig { params(watcher: Watcher, publications: T::Array[String]).returns(T::Enumerator::Lazy[Event]) }
217
+ def replicate(watcher, publications:); end
218
+
219
+ class Column < T::Struct
220
+ prop :name, String, immutable: true
221
+ prop :decoder, T.untyped, immutable: true
222
+
223
+ sig { params(value: T.untyped).returns(T.untyped) }
224
+ def decode(value); end
225
+ end
226
+
227
+ class Table < T::Struct
228
+ prop :name, String, immutable: true
229
+ prop :primary_key_colums, T::Array[String], immutable: true
230
+ prop :columns, T::Array[Column], immutable: true
231
+
232
+ sig { params(decoded_row: T.untyped).returns(T.untyped) }
233
+ def primary_key(decoded_row); end
234
+
235
+ sig { params(values: T.untyped).returns(T.untyped) }
236
+ def decode_row(values); end
237
+ end
238
+ end
239
+
240
+ class StreamingWatcher
241
+ abstract!
242
+
243
+ include Wal::Watcher
244
+ extend T::Sig
245
+ extend T::Helpers
246
+
247
+ sig { abstract.params(events: T::Enumerator[Event]).void }
248
+ def on_transaction_events(events); end
249
+
250
+ sig { params(event: BeginTransactionEvent).returns(Integer) }
251
+ def queue_size(event); end
252
+
253
+ sig { override.params(event: Event).void }
254
+ def on_event(event); end
255
+ end
256
+
257
+ module Watcher
258
+ abstract!
259
+
260
+ include Wal
261
+ extend T::Sig
262
+ extend T::Helpers
263
+
264
+ sig { abstract.params(event: Event).void }
265
+ def on_event(event); end
266
+
267
+ sig { params(table: String).returns(T::Boolean) }
268
+ def should_watch_table?(table); end
269
+
270
+ sig { params(prefix: String).returns(T::Boolean) }
271
+ def valid_context_prefix?(prefix); end
272
+
273
+ module SeparatedEvents
274
+ extend T::Sig
275
+
276
+ sig { params(event: Event).void }
277
+ def on_event(event); end
278
+
279
+ sig { params(event: BeginTransactionEvent).void }
280
+ def on_begin(event); end
281
+
282
+ sig { params(event: InsertEvent).void }
283
+ def on_insert(event); end
284
+
285
+ sig { params(event: UpdateEvent).void }
286
+ def on_update(event); end
287
+
288
+ sig { params(event: DeleteEvent).void }
289
+ def on_delete(event); end
290
+
291
+ sig { params(event: CommitTransactionEvent).void }
292
+ def on_commit(event); end
293
+ end
294
+ end
295
+ end
data/sig/wal.rbs CHANGED
@@ -1,4 +1,186 @@
1
+ # typed: strong
1
2
  module Wal
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
3
+ end
4
+
5
+ Wal::Event: untyped
6
+
7
+ Wal::VERSION: untyped
8
+
9
+ class Wal::BeginTransactionEvent < T::Struct
10
+ def estimated_size: () -> Integer
11
+ end
12
+
13
+ class Wal::CommitTransactionEvent < T::Struct
14
+ end
15
+
16
+ module Wal::ChangeEvent
17
+ def diff: () -> ::Hash[String, [ untyped, untyped ]]
18
+
19
+ def changed_attribute?: (Symbol | String attribute) -> bool
20
+
21
+ def attribute: (Symbol | String attribute) -> untyped
22
+
23
+ def attribute_changes: (Symbol | String attribute) -> [ untyped, untyped ]?
24
+
25
+ def attribute_was: (Symbol | String attribute) -> untyped
26
+ end
27
+
28
+ class Wal::InsertEvent < T::Struct
29
+ include ::Wal::ChangeEvent
30
+
31
+ def diff: () -> ::Hash[String, [ untyped, untyped ]]
32
+ end
33
+
34
+ class Wal::UpdateEvent < T::Struct
35
+ include ::Wal::ChangeEvent
36
+
37
+ def diff: () -> ::Hash[String, [ untyped, untyped ]]
38
+ end
39
+
40
+ class Wal::DeleteEvent < T::Struct
41
+ include ::Wal::ChangeEvent
42
+
43
+ def diff: () -> ::Hash[String, [ untyped, untyped ]]
44
+ end
45
+
46
+ module Wal::ActiveRecordContextExtension
47
+ def set_wal_watcher_context: (untyped context, ?prefix: untyped prefix) -> untyped
48
+ end
49
+
50
+ class Wal::NoopWatcher
51
+ include Wal::Watcher
52
+
53
+ def on_event: (Event event) -> void
54
+ end
55
+
56
+ class Wal::RecordWatcher
57
+ include Wal::Watcher
58
+
59
+ extend T::Helpers
60
+
61
+ def self.inherited: (untyped subclass) -> untyped
62
+
63
+ def self.on_insert: (String | singleton(::ActiveRecord::Base) table) { (InsertEvent event) -> void } -> void
64
+
65
+ def self.on_update: (String | singleton(::ActiveRecord::Base) table, ?changed: ::Array[String | Symbol]? changed) { (UpdateEvent event) -> void } -> void
66
+
67
+ def self.on_save: (String | singleton(::ActiveRecord::Base) table, ?changed: ::Array[String | Symbol]? changed) { (InsertEvent | UpdateEvent event) -> void } -> void
68
+
69
+ def self.on_destroy: (String | singleton(::ActiveRecord::Base) table) { (DeleteEvent event) -> void } -> void
70
+
71
+ def on_record_changed: (RecordEvent event) -> void
72
+
73
+ def should_watch_table?: (String table) -> bool
74
+
75
+ def aggregation_strategy: (BeginTransactionEvent event) -> Symbol
76
+
77
+ def on_event: (Event event) -> void
78
+ end
79
+
80
+ Wal::Wal::RecordWatcher::RecordEvent: untyped
81
+
82
+ class Wal::Wal::RecordWatcher::MemoryRecordWatcher
83
+ include Wal::Watcher
84
+
85
+ include Wal::Watcher::SeparatedEvents
86
+
87
+ extend T::Helpers
88
+
89
+ def initialize: (untyped watcher) -> void
90
+
91
+ def on_begin: (BeginTransactionEvent event) -> void
92
+
93
+ def on_commit: (untyped _event) -> untyped
94
+
95
+ def on_insert: (InsertEvent event) -> void
96
+
97
+ def on_update: (UpdateEvent event) -> void
98
+
99
+ def on_delete: (DeleteEvent event) -> void
100
+ end
101
+
102
+ Wal::Wal::RecordWatcher::Wal::Wal::RecordWatcher::MemoryRecordWatcher::RecordsStorage: untyped
103
+
104
+ class Wal::Wal::RecordWatcher::TemporaryTableRecordWatcher
105
+ include Wal::Watcher
106
+
107
+ include Wal::Watcher::SeparatedEvents
108
+
109
+ extend T::Helpers
110
+
111
+ def initialize: (untyped watcher, ?batch_size: untyped batch_size) -> void
112
+
113
+ def on_begin: (BeginTransactionEvent event) -> void
114
+
115
+ def on_commit: (untyped _event) -> untyped
116
+
117
+ def on_insert: (InsertEvent event) -> void
118
+
119
+ def on_update: (UpdateEvent event) -> void
120
+
121
+ def on_delete: (DeleteEvent event) -> void
122
+
123
+ def base_class: () -> singleton(::ActiveRecord::Base)
124
+
125
+ def serialize: (untyped event) -> untyped
126
+
127
+ def deserialize: (untyped persisted_event) -> untyped
128
+ end
129
+
130
+ class Wal::Replicator
131
+ include PG::Replication::Protocol
132
+
133
+ def initialize: (?replication_slot: String replication_slot, ?use_temporary_slot: bool use_temporary_slot, ?db_config: ::Hash[Symbol, untyped] db_config) -> void
134
+
135
+ def replicate_forever: (Watcher watcher, ?publications: ::Array[String] publications) -> void
136
+
137
+ def replicate: (Watcher watcher, ?publications: ::Array[String] publications) -> ::Enumerator::Lazy[Event]
138
+ end
139
+
140
+ class Wal::Wal::Replicator::Column < T::Struct
141
+ def decode: (untyped value) -> untyped
142
+ end
143
+
144
+ class Wal::Wal::Replicator::Table < T::Struct
145
+ def primary_key: (untyped decoded_row) -> untyped
146
+
147
+ def decode_row: (untyped values) -> untyped
148
+ end
149
+
150
+ class Wal::StreamingWatcher
151
+ include Wal::Watcher
152
+
153
+ extend T::Helpers
154
+
155
+ def on_transaction_events: (::Enumerator[Event] events) -> void
156
+
157
+ def queue_size: (BeginTransactionEvent event) -> Integer
158
+
159
+ def on_event: (Event event) -> void
160
+ end
161
+
162
+ module Wal::Watcher
163
+ include Wal
164
+
165
+ extend T::Helpers
166
+
167
+ def on_event: (Event event) -> void
168
+
169
+ def should_watch_table?: (String table) -> bool
170
+
171
+ def valid_context_prefix?: (String prefix) -> bool
172
+ end
173
+
174
+ module Wal::Wal::Watcher::SeparatedEvents
175
+ def on_event: (Event event) -> void
176
+
177
+ def on_begin: (BeginTransactionEvent event) -> void
178
+
179
+ def on_insert: (InsertEvent event) -> void
180
+
181
+ def on_update: (UpdateEvent event) -> void
182
+
183
+ def on_delete: (DeleteEvent event) -> void
184
+
185
+ def on_commit: (CommitTransactionEvent event) -> void
4
186
  end
data/sorbet/config ADDED
@@ -0,0 +1,7 @@
1
+ --dir
2
+ .
3
+ --ignore=tmp/
4
+ --ignore=sig/
5
+ --ignore=vendor/
6
+ --suppress-payload-superclass-redefinition-for=Psych::Parser::Mark
7
+ --suppress-payload-superclass-redefinition-for=IRB::ReadlineInputMethod
@@ -0,0 +1 @@
1
+ **/*.rbi linguist-vendored=true
@@ -0,0 +1,89 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This file was pulled from a central RBI files repository.
5
+ # Please run `bin/tapioca annotations` to update it.
6
+
7
+ class ActiveModel::Errors
8
+ Elem = type_member { { fixed: ActiveModel::Error } }
9
+
10
+ sig { params(attribute: T.any(Symbol, String)).returns(T::Array[String]) }
11
+ def [](attribute); end
12
+
13
+ sig { params(attribute: T.any(Symbol, String), type: T.untyped, options: T.untyped).returns(ActiveModel::Error) }
14
+ def add(attribute, type = :invalid, **options); end
15
+
16
+ sig { params(attribute: T.any(Symbol, String), type: T.untyped, options: T.untyped).returns(T::Boolean) }
17
+ def added?(attribute, type = :invalid, options = {}); end
18
+
19
+ sig { params(options: T.untyped).returns(T::Hash[T.untyped, T.untyped]) }
20
+ def as_json(options = nil); end
21
+
22
+ sig { returns(T::Array[Symbol]) }
23
+ def attribute_names; end
24
+
25
+ sig { params(attribute: T.any(Symbol, String), type: T.untyped, options: T.untyped).returns(T.nilable(T::Array[String])) }
26
+ def delete(attribute, type = nil, **options); end
27
+
28
+ sig { returns(T::Hash[Symbol, T::Array[T::Hash[Symbol, T.untyped]]]) }
29
+ def details; end
30
+
31
+ sig { returns(T::Array[Elem]) }
32
+ def errors; end
33
+
34
+ sig { params(attribute: T.any(Symbol, String), message: String).returns(String) }
35
+ def full_message(attribute, message); end
36
+
37
+ sig { returns(T::Array[String]) }
38
+ def full_messages; end
39
+
40
+ sig { params(attribute: T.any(Symbol, String)).returns(T::Array[String]) }
41
+ def full_messages_for(attribute); end
42
+
43
+ sig { params(attribute: T.any(Symbol, String), type: T.untyped, options: T.untyped).returns(String) }
44
+ def generate_message(attribute, type = :invalid, options = {}); end
45
+
46
+ sig { returns(T::Hash[Symbol, T::Array[ActiveModel::Error]]) }
47
+ def group_by_attribute; end
48
+
49
+ sig { params(attribute: T.any(Symbol, String)).returns(T::Boolean) }
50
+ def has_key?(attribute); end
51
+
52
+ sig { params(error: ActiveModel::Error, override_options: T.untyped).returns(T::Array[ActiveModel::Error]) }
53
+ def import(error, override_options = {}); end
54
+
55
+ sig { params(attribute: T.any(Symbol, String)).returns(T::Boolean) }
56
+ def include?(attribute); end
57
+
58
+ sig { params(attribute: T.any(Symbol, String)).returns(T::Boolean) }
59
+ def key?(attribute); end
60
+
61
+ sig { params(other: T.untyped).returns(T::Array[ActiveModel::Error]) }
62
+ def merge!(other); end
63
+
64
+ sig { returns(T::Hash[Symbol, T::Array[String]]) }
65
+ def messages; end
66
+
67
+ sig { params(attribute: T.any(Symbol, String)).returns(T::Array[String]) }
68
+ def messages_for(attribute); end
69
+
70
+ sig { returns(T::Array[Elem]) }
71
+ def objects; end
72
+
73
+ sig { params(attribute: T.any(Symbol, String), type: T.untyped).returns(T::Boolean) }
74
+ def of_kind?(attribute, type = :invalid); end
75
+
76
+ sig { returns(T::Array[String]) }
77
+ def to_a; end
78
+
79
+ sig { params(full_messages: T.untyped).returns(T::Hash[Symbol, T::Array[String]]) }
80
+ def to_hash(full_messages = false); end
81
+
82
+ sig { params(attribute: T.any(Symbol, String), type: T.untyped, options: T.untyped).returns(T::Array[ActiveModel::Error]) }
83
+ def where(attribute, type = nil, **options); end
84
+ end
85
+
86
+ module ActiveModel::Validations
87
+ sig { returns(ActiveModel::Errors) }
88
+ def errors; end
89
+ end
@@ -0,0 +1,98 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This file was pulled from a central RBI files repository.
5
+ # Please run `bin/tapioca annotations` to update it.
6
+
7
+ class ActiveRecord::Schema
8
+ sig { params(info: T::Hash[T.untyped, T.untyped], blk: T.proc.bind(ActiveRecord::Schema).void).void }
9
+ def self.define(info = nil, &blk); end
10
+ end
11
+
12
+ class ActiveRecord::Migration
13
+ # @shim: Methods on migration are delegated to `SchemaStatements` using `method_missing`
14
+ include ActiveRecord::ConnectionAdapters::SchemaStatements
15
+
16
+ # @shim: Methods on migration are delegated to `DatabaseStatements` using `method_missing`
17
+ include ActiveRecord::ConnectionAdapters::DatabaseStatements
18
+ end
19
+
20
+ class ActiveRecord::Base
21
+ sig { returns(FalseClass) }
22
+ def blank?; end
23
+
24
+ # @shim: since `present?` is always true, `presence` always returns `self`
25
+ sig { returns(T.self_type) }
26
+ def presence; end
27
+
28
+ sig { returns(TrueClass) }
29
+ def present?; end
30
+
31
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
32
+ def self.after_initialize(*args, **options, &block); end
33
+
34
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
35
+ def self.after_find(*args, **options, &block); end
36
+
37
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
38
+ def self.after_touch(*args, **options, &block); end
39
+
40
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
41
+ def self.before_validation(*args, **options, &block); end
42
+
43
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
44
+ def self.after_validation(*args, **options, &block); end
45
+
46
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
47
+ def self.before_save(*args, **options, &block); end
48
+
49
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
50
+ def self.around_save(*args, **options, &block); end
51
+
52
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
53
+ def self.after_save(*args, **options, &block); end
54
+
55
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
56
+ def self.before_create(*args, **options, &block); end
57
+
58
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
59
+ def self.around_create(*args, **options, &block); end
60
+
61
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
62
+ def self.after_create(*args, **options, &block); end
63
+
64
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
65
+ def self.before_update(*args, **options, &block); end
66
+
67
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
68
+ def self.around_update(*args, **options, &block); end
69
+
70
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
71
+ def self.after_update(*args, **options, &block); end
72
+
73
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
74
+ def self.before_destroy(*args, **options, &block); end
75
+
76
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
77
+ def self.around_destroy(*args, **options, &block); end
78
+
79
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
80
+ def self.after_destroy(*args, **options, &block); end
81
+
82
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
83
+ def self.after_commit(*args, **options, &block); end
84
+
85
+ sig { params(args: T.untyped, options: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).params(record: T.attached_class).void)).void }
86
+ def self.after_rollback(*args, **options, &block); end
87
+ end
88
+
89
+ class ActiveRecord::Relation
90
+ Elem = type_member(:out) { { fixed: T.untyped } }
91
+
92
+ sig { returns(T::Boolean) }
93
+ def blank?; end
94
+
95
+ sig { abstract.params(blk: T.proc.params(arg0: Elem).returns(BasicObject)).returns(T.untyped) }
96
+ sig { abstract.returns(T::Enumerator[Elem]) }
97
+ def each(&blk); end
98
+ end