solid_objects 0.2.1 → 0.4.0

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 (102) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/README.md +261 -31
  4. data/app/controllers/solid_objects/components_controller.rb +78 -0
  5. data/app/helpers/solid_objects/actor_helper.rb +13 -4
  6. data/config/routes.rb +1 -0
  7. data/db/migrate/20260806000000_add_state_revision_to_solid_objects_instances.rb +12 -0
  8. data/docs/architecture.md +116 -23
  9. data/docs/authorization.md +53 -3
  10. data/docs/benchmarks.md +6 -2
  11. data/docs/correctness.md +45 -1
  12. data/docs/database-schema.md +18 -5
  13. data/docs/development.md +40 -0
  14. data/docs/fit.md +10 -2
  15. data/docs/migrating-existing-state.md +8 -1
  16. data/docs/operations.md +74 -36
  17. data/docs/realtime.md +106 -12
  18. data/docs/roadmap.md +14 -7
  19. data/docs/security.md +25 -3
  20. data/docs/state-migrations.md +2 -0
  21. data/examples/application/README.md +5 -4
  22. data/examples/application/app/views/actors/chat_room_actor/_messages.html.erb +1 -1
  23. data/examples/application/app/views/chat_rooms/show.html.erb +2 -2
  24. data/examples/application/config/initializers/solid_objects.rb +9 -3
  25. data/lib/generators/solid_objects/templates/solid_objects.rb +33 -2
  26. data/lib/solid_objects/activation.rb +33 -4
  27. data/lib/solid_objects/actor.rb +58 -6
  28. data/lib/solid_objects/actor_channel.rb +73 -5
  29. data/lib/solid_objects/actor_definition.rb +2 -0
  30. data/lib/solid_objects/actor_snapshot.rb +35 -10
  31. data/lib/solid_objects/actor_view.rb +103 -10
  32. data/lib/solid_objects/application_write_guard.rb +24 -0
  33. data/lib/solid_objects/caller_process.rb +28 -0
  34. data/lib/solid_objects/cli.rb +44 -5
  35. data/lib/solid_objects/client.rb +98 -5
  36. data/lib/solid_objects/commit_action_registry.rb +42 -0
  37. data/lib/solid_objects/component_path_resolver.rb +27 -0
  38. data/lib/solid_objects/component_registration.rb +117 -0
  39. data/lib/solid_objects/component_renderer.rb +82 -0
  40. data/lib/solid_objects/component_subscriptions.rb +109 -0
  41. data/lib/solid_objects/component_token.rb +139 -0
  42. data/lib/solid_objects/component_view.rb +67 -0
  43. data/lib/solid_objects/configuration.rb +39 -1
  44. data/lib/solid_objects/database_adapter.rb +28 -1
  45. data/lib/solid_objects/database_adapters/mysql.rb +46 -0
  46. data/lib/solid_objects/database_adapters/postgresql.rb +29 -0
  47. data/lib/solid_objects/database_adapters/sqlite.rb +40 -0
  48. data/lib/solid_objects/errors.rb +156 -0
  49. data/lib/solid_objects/executor.rb +65 -4
  50. data/lib/solid_objects/instance_pruner.rb +97 -0
  51. data/lib/solid_objects/message_pruner.rb +97 -0
  52. data/lib/solid_objects/message_reference.rb +9 -0
  53. data/lib/solid_objects/process_pruner.rb +49 -0
  54. data/lib/solid_objects/reference.rb +5 -0
  55. data/lib/solid_objects/state_snapshot.rb +41 -0
  56. data/lib/solid_objects/stream_token.rb +32 -13
  57. data/lib/solid_objects/sync_deadline.rb +57 -0
  58. data/lib/solid_objects/sync_diagnostics.rb +133 -0
  59. data/lib/solid_objects/synchronous_invocation.rb +26 -7
  60. data/lib/solid_objects/test_helper.rb +78 -0
  61. data/lib/solid_objects/turbo_stream_renderer.rb +45 -1
  62. data/lib/solid_objects/version.rb +1 -1
  63. data/lib/solid_objects/worker.rb +1 -1
  64. data/lib/solid_objects.rb +40 -0
  65. data/sig/generated/controllers/solid_objects/components_controller.rbs +22 -0
  66. data/sig/generated/lib/solid_objects/activation.rbs +3 -0
  67. data/sig/generated/lib/solid_objects/actor.rbs +29 -0
  68. data/sig/generated/lib/solid_objects/actor_channel.rbs +20 -0
  69. data/sig/generated/lib/solid_objects/actor_snapshot.rbs +17 -0
  70. data/sig/generated/lib/solid_objects/actor_view.rbs +31 -2
  71. data/sig/generated/lib/solid_objects/application_write_guard.rbs +8 -0
  72. data/sig/generated/lib/solid_objects/caller_process.rbs +11 -0
  73. data/sig/generated/lib/solid_objects/cli.rbs +11 -2
  74. data/sig/generated/lib/solid_objects/client.rbs +15 -0
  75. data/sig/generated/lib/solid_objects/commit_action_registry.rbs +43 -0
  76. data/sig/generated/lib/solid_objects/component_path_resolver.rbs +13 -0
  77. data/sig/generated/lib/solid_objects/component_registration.rbs +51 -0
  78. data/sig/generated/lib/solid_objects/component_renderer.rbs +39 -0
  79. data/sig/generated/lib/solid_objects/component_subscriptions.rbs +40 -0
  80. data/sig/generated/lib/solid_objects/component_token.rbs +38 -0
  81. data/sig/generated/lib/solid_objects/component_view.rbs +43 -0
  82. data/sig/generated/lib/solid_objects/configuration.rbs +35 -7
  83. data/sig/generated/lib/solid_objects/database_adapter.rbs +9 -0
  84. data/sig/generated/lib/solid_objects/database_adapters/mysql.rbs +8 -0
  85. data/sig/generated/lib/solid_objects/database_adapters/postgresql.rbs +8 -0
  86. data/sig/generated/lib/solid_objects/database_adapters/sqlite.rbs +13 -0
  87. data/sig/generated/lib/solid_objects/errors.rbs +130 -0
  88. data/sig/generated/lib/solid_objects/executor.rbs +12 -0
  89. data/sig/generated/lib/solid_objects/instance_pruner.rbs +36 -0
  90. data/sig/generated/lib/solid_objects/message_pruner.rbs +42 -0
  91. data/sig/generated/lib/solid_objects/message_reference.rbs +3 -0
  92. data/sig/generated/lib/solid_objects/process_pruner.rbs +27 -0
  93. data/sig/generated/lib/solid_objects/reference.rbs +3 -0
  94. data/sig/generated/lib/solid_objects/state_snapshot.rbs +30 -0
  95. data/sig/generated/lib/solid_objects/stream_token.rbs +9 -4
  96. data/sig/generated/lib/solid_objects/sync_deadline.rbs +31 -0
  97. data/sig/generated/lib/solid_objects/sync_diagnostics.rbs +34 -0
  98. data/sig/generated/lib/solid_objects/synchronous_invocation.rbs +3 -0
  99. data/sig/generated/lib/solid_objects/test_helper.rbs +25 -0
  100. data/sig/generated/lib/solid_objects/turbo_stream_renderer.rbs +10 -0
  101. data/sig/generated/lib/solid_objects.rbs +12 -0
  102. metadata +34 -1
@@ -0,0 +1,78 @@
1
+ # rbs_inline: enabled
2
+
3
+ require "solid_objects"
4
+
5
+ module SolidObjects
6
+ module TestHelper
7
+ class << self
8
+ # @rbs (Class) -> void
9
+ def included(test_case)
10
+ test_case.use_transactional_tests = false if test_case.respond_to?(:use_transactional_tests=)
11
+ test_case.setup { reset_actors! }
12
+ test_case.teardown { reset_actors! }
13
+ end
14
+
15
+ # @rbs () -> void
16
+ def reset_actors!
17
+ SolidObjects.reset_caller_process!
18
+ Instance.delete_all
19
+ Process.delete_all
20
+ end
21
+ end
22
+
23
+ # @rbs () -> void
24
+ def reset_actors!
25
+ TestHelper.reset_actors!
26
+ end
27
+
28
+ # @rbs (?roles: Array[Symbol], ?max_passes: Integer) -> Integer
29
+ def drain_solid_objects(
30
+ roles: [ :reminders, :actors, :effects, :broadcasts ],
31
+ max_passes: 1_000
32
+ )
33
+ runners = build_solid_objects_runners(roles)
34
+ total = 0
35
+
36
+ max_passes.times do
37
+ processed = runners.sum { |runner| solid_objects_runner_result(runner) }
38
+ break if processed.zero?
39
+
40
+ total += processed
41
+ end
42
+
43
+ total
44
+ ensure
45
+ runners&.uniq&.each(&:stop)
46
+ end
47
+
48
+ private
49
+
50
+ # @rbs (Array[Symbol]) -> Array[Worker | EffectExecutor | ReminderScheduler | BroadcastExecutor]
51
+ def build_solid_objects_runners(roles)
52
+ unknown_roles = roles - [ :actors, :effects, :reminders, :broadcasts ]
53
+ raise ArgumentError, "unknown Solid Objects test roles: #{unknown_roles.join(", ")}" if unknown_roles.any?
54
+
55
+ runners = {}
56
+ runners[:actors] = Worker.new if roles.include?(:actors)
57
+ runners[:effects] = EffectExecutor.new if roles.include?(:effects)
58
+ runners[:reminders] = ReminderScheduler.new if roles.include?(:reminders)
59
+ runners[:broadcasts] = BroadcastExecutor.new if roles.include?(:broadcasts)
60
+
61
+ [
62
+ runners[:reminders],
63
+ runners[:actors],
64
+ runners[:effects],
65
+ runners[:actors],
66
+ runners[:broadcasts]
67
+ ].compact
68
+ end
69
+
70
+ # @rbs (Worker | EffectExecutor | ReminderScheduler | BroadcastExecutor) -> Integer
71
+ def solid_objects_runner_result(runner)
72
+ result = runner.run_once
73
+ return result if result.is_a?(Integer)
74
+
75
+ result ? 1 : 0
76
+ end
77
+ end
78
+ end
@@ -1,9 +1,13 @@
1
1
  # rbs_inline: enabled
2
2
 
3
3
  require "erb"
4
+ require "base64"
4
5
 
5
6
  module SolidObjects
6
7
  module TurboStreamRenderer
8
+ INVALIDATION_MARKER = "solid_objects_invalidation:"
9
+ INVALIDATION_PATTERN = /<!--solid_objects_invalidation:([A-Za-z0-9_=-]+)-->/
10
+
7
11
  module_function
8
12
 
9
13
  # @rbs (Broadcast) -> String
@@ -12,7 +16,19 @@ module SolidObjects
12
16
  actor_type: broadcast.instance.actor_type,
13
17
  actor_id: broadcast.instance.actor_id
14
18
  )
15
- observable_value(reference, broadcast.observable_name, broadcast.value)
19
+ stream = observable_value(
20
+ reference,
21
+ broadcast.observable_name,
22
+ broadcast.value
23
+ )
24
+ metadata = Base64.urlsafe_encode64(
25
+ JSON.generate(
26
+ "instance_id" => broadcast.instance_id,
27
+ "revision" => broadcast.message.sequence,
28
+ "observable_name" => broadcast.observable_name
29
+ )
30
+ )
31
+ "#{stream}<!--#{INVALIDATION_MARKER}#{metadata}-->"
16
32
  end
17
33
 
18
34
  # @rbs (Reference, Symbol | String, untyped) -> String
@@ -22,6 +38,34 @@ module SolidObjects
22
38
  %(<turbo-stream action="replace" target="#{target}"><template><span id="#{target}">#{content}</span></template></turbo-stream>)
23
39
  end
24
40
 
41
+ # @rbs (ComponentRegistration, Integer, Integer) -> String
42
+ def component_refresh(registration, instance_id, revision)
43
+ target = DomIdentity.component(
44
+ registration.reference,
45
+ registration.component_name
46
+ )
47
+ source = ERB::Util.html_escape(
48
+ registration.refresh_url(instance_id, revision)
49
+ )
50
+ revision_value = "#{instance_id}:#{revision}"
51
+ %(<turbo-stream action="replace" target="#{target}"><template><turbo-frame id="#{target}" src="#{source}" data-solid-objects-revision="#{revision_value}"></turbo-frame></template></turbo-stream>)
52
+ end
53
+
54
+ # @rbs (String) -> Hash[String, untyped]?
55
+ def invalidation(stream)
56
+ encoded = stream[INVALIDATION_PATTERN, 1]
57
+ return unless encoded
58
+
59
+ payload = JSON.parse(Base64.urlsafe_decode64(encoded))
60
+ return unless payload["instance_id"].is_a?(Integer)
61
+ return unless payload["revision"].is_a?(Integer)
62
+ return unless payload["observable_name"].is_a?(String)
63
+
64
+ payload
65
+ rescue ArgumentError, JSON::ParserError
66
+ nil
67
+ end
68
+
25
69
  # @rbs (untyped) -> String
26
70
  def display_value(value)
27
71
  return value if value.is_a?(String)
@@ -1,5 +1,5 @@
1
1
  # rbs_inline: enabled
2
2
 
3
3
  module SolidObjects
4
- VERSION = "0.2.1"
4
+ VERSION = "0.4.0"
5
5
  end
@@ -43,7 +43,7 @@ module SolidObjects
43
43
  rescue ActorDestroyed
44
44
  release_activation(activation) if activation
45
45
  0
46
- rescue StateMigrationError, LostActivation => error
46
+ rescue StateMigrationError, ApplicationWriteForbidden, LostActivation => error
47
47
  release_activation(activation) if activation
48
48
  SolidObjects.configuration.logger.error(
49
49
  event: "solid_objects.worker.error",
data/lib/solid_objects.rb CHANGED
@@ -12,6 +12,7 @@ require "securerandom"
12
12
 
13
13
  require "solid_objects/version"
14
14
  require "solid_objects/errors"
15
+ require "solid_objects/sync_deadline"
15
16
  require "solid_objects/configuration"
16
17
  require "solid_objects/instrumentation"
17
18
  require "solid_objects/log_subscriber"
@@ -20,19 +21,31 @@ require "solid_objects/context"
20
21
  require "solid_objects/actor_registry"
21
22
  require "solid_objects/state"
22
23
  require "solid_objects/actor_definition"
24
+ require "solid_objects/application_write_guard"
23
25
  require "solid_objects/actor"
24
26
  require "solid_objects/reference"
25
27
  require "solid_objects/message_reference"
26
28
  require "solid_objects/dead_letter_manager"
29
+ require "solid_objects/message_pruner"
30
+ require "solid_objects/instance_pruner"
31
+ require "solid_objects/process_pruner"
27
32
  require "solid_objects/stream_name"
28
33
  require "solid_objects/dom_identity"
29
34
  require "solid_objects/stream_token"
35
+ require "solid_objects/component_token"
36
+ require "solid_objects/component_path_resolver"
30
37
  require "solid_objects/turbo_stream_renderer"
31
38
  require "solid_objects/actor_snapshot"
39
+ require "solid_objects/component_registration"
40
+ require "solid_objects/component_subscriptions"
41
+ require "solid_objects/component_view"
42
+ require "solid_objects/component_renderer"
43
+ require "solid_objects/state_snapshot"
32
44
  require "solid_objects/actor_view"
33
45
  require "solid_objects/action_cable_broadcast_adapter"
34
46
  require "solid_objects/wake_up"
35
47
  require "solid_objects/effect_registry"
48
+ require "solid_objects/commit_action_registry"
36
49
  require "solid_objects/lease"
37
50
  require "solid_objects/lease_renewer"
38
51
  require "solid_objects/worker"
@@ -72,6 +85,16 @@ module SolidObjects
72
85
  effect_registry.register(name, handler)
73
86
  end
74
87
 
88
+ # @rbs () -> CommitActionRegistry
89
+ def commit_action_registry
90
+ @commit_action_registry ||= CommitActionRegistry.new
91
+ end
92
+
93
+ # @rbs (String | Symbol) { (Hash[String, untyped], CommitActionContext) -> untyped } -> Proc
94
+ def register_commit_action(name, &handler)
95
+ commit_action_registry.register(name, handler)
96
+ end
97
+
75
98
  # @rbs () -> Client
76
99
  def client
77
100
  require "solid_objects/client"
@@ -84,6 +107,17 @@ module SolidObjects
84
107
  @caller_process ||= CallerProcess.new
85
108
  end
86
109
 
110
+ # @rbs () -> bool
111
+ def reset_caller_process!
112
+ caller_process = @caller_process
113
+ @caller_process = nil
114
+ return false unless caller_process
115
+
116
+ caller_process.stop
117
+ rescue ActiveRecord::ActiveRecordError
118
+ false
119
+ end
120
+
87
121
  # @rbs () -> DeadLetterManager
88
122
  def dead_letters
89
123
  @dead_letters ||= DeadLetterManager.new
@@ -99,6 +133,11 @@ module SolidObjects
99
133
  registry.register(type, actor_class)
100
134
  end
101
135
 
136
+ # @rbs (untyped) -> untyped
137
+ def mutable_copy(value)
138
+ Serialization.deep_copy(value)
139
+ end
140
+
102
141
  # @rbs () -> void
103
142
  def reset!
104
143
  @configuration = Configuration.new
@@ -108,6 +147,7 @@ module SolidObjects
108
147
  @wake_up = nil
109
148
  @caller_process = nil
110
149
  @effect_registry = EffectRegistry.new
150
+ @commit_action_registry = CommitActionRegistry.new
111
151
  @dead_letters = nil
112
152
  end
113
153
 
@@ -0,0 +1,22 @@
1
+ # Generated from app/controllers/solid_objects/components_controller.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class ComponentsController < ActionController::Base
5
+ # @rbs () -> void
6
+ def show: () -> void
7
+
8
+ private
9
+
10
+ # @rbs () -> Array[Integer]
11
+ def requested_revision_key: () -> Array[Integer]
12
+
13
+ # @rbs (Array[Integer], ActorSnapshot) -> bool
14
+ def newer_than_snapshot?: (Array[Integer], ActorSnapshot) -> bool
15
+
16
+ # @rbs () -> untyped
17
+ def component_view_context: () -> untyped
18
+
19
+ # @rbs (ComponentRegistration, ActorSnapshot, untyped) -> String
20
+ def component_frame: (ComponentRegistration, ActorSnapshot, untyped) -> String
21
+ end
22
+ end
@@ -59,6 +59,9 @@ module SolidObjects
59
59
  # @rbs (Instance) -> Actor
60
60
  def build_actor: (Instance) -> Actor
61
61
 
62
+ # @rbs () -> void
63
+ def release_lease: () -> void
64
+
62
65
  # @rbs () -> Message?
63
66
  def claim_next_message: () -> Message?
64
67
 
@@ -19,6 +19,19 @@ module SolidObjects
19
19
  def members: () -> [ :name, :arguments, :success_message_name, :failure_message_name ]
20
20
  end
21
21
 
22
+ class CommitActionIntent < Data
23
+ attr_reader name(): untyped
24
+
25
+ attr_reader arguments(): untyped
26
+
27
+ def self.new: (untyped name, untyped arguments) -> instance
28
+ | (name: untyped, arguments: untyped) -> instance
29
+
30
+ def self.members: () -> [ :name, :arguments ]
31
+
32
+ def members: () -> [ :name, :arguments ]
33
+ end
34
+
22
35
  class ReminderIntent < Data
23
36
  attr_reader name(): untyped
24
37
 
@@ -114,6 +127,8 @@ module SolidObjects
114
127
 
115
128
  @reminder_intents: Array[ReminderIntent]
116
129
 
130
+ @commit_action_intents: Array[CommitActionIntent]
131
+
117
132
  @effect_intents: Array[EffectIntent]
118
133
 
119
134
  @state: State
@@ -136,6 +151,9 @@ module SolidObjects
136
151
  # @rbs (Symbol | String, ?on_success: Symbol | String?, ?on_failure: Symbol | String?, **untyped) -> nil
137
152
  def emit: (Symbol | String, ?on_success: Symbol | String?, ?on_failure: Symbol | String?, **untyped) -> nil
138
153
 
154
+ # @rbs (Symbol | String, **untyped) -> nil
155
+ def commit_action: (Symbol | String, **untyped) -> nil
156
+
139
157
  # @rbs (Symbol | String, at: Time, ?every: Numeric?, ?missed: Symbol | String, arguments: Hash[Symbol | String, untyped]) -> nil
140
158
  def schedule: (Symbol | String, at: Time, arguments: Hash[Symbol | String, untyped], ?every: Numeric?, ?missed: Symbol | String) -> nil
141
159
 
@@ -148,6 +166,9 @@ module SolidObjects
148
166
  # @rbs () -> Hash[String, untyped]
149
167
  def observable_values: () -> Hash[String, untyped]
150
168
 
169
+ # @rbs (Symbol | String) -> untyped
170
+ def observable_value: (Symbol | String) -> untyped
171
+
151
172
  # @rbs () -> void
152
173
  def activate: () -> void
153
174
 
@@ -160,6 +181,9 @@ module SolidObjects
160
181
  # @rbs () -> Array[EffectIntent]
161
182
  def drain_effect_intents: () -> Array[EffectIntent]
162
183
 
184
+ # @rbs () -> Array[CommitActionIntent]
185
+ def drain_commit_action_intents: () -> Array[CommitActionIntent]
186
+
163
187
  # @rbs () -> Array[ReminderIntent]
164
188
  def drain_reminder_intents: () -> Array[ReminderIntent]
165
189
 
@@ -173,10 +197,15 @@ module SolidObjects
173
197
 
174
198
  attr_reader effect_intents: untyped
175
199
 
200
+ attr_reader commit_action_intents: untyped
201
+
176
202
  attr_reader reminder_intents: untyped
177
203
 
178
204
  attr_reader outbound_message_intents: untyped
179
205
 
206
+ # @rbs (String) { () -> untyped } -> untyped
207
+ def guard_application_writes: (String) { () -> untyped } -> untyped
208
+
180
209
  # @rbs (Hash[String, untyped]) -> Hash[Symbol, untyped]
181
210
  def keyword_arguments: (Hash[String, untyped]) -> Hash[Symbol, untyped]
182
211
 
@@ -4,5 +4,25 @@ module SolidObjects
4
4
  class ActorChannel < ActionCable::Channel::Base
5
5
  # @rbs () -> void
6
6
  def subscribed: () -> void
7
+
8
+ private
9
+
10
+ attr_reader reference: untyped
11
+
12
+ attr_reader component_subscriptions: untyped
13
+
14
+ attr_reader scalar_observables: untyped
15
+
16
+ # @rbs (String) -> void
17
+ def receive_broadcast: (String) -> void
18
+
19
+ # @rbs (ActorSnapshot) -> void
20
+ def refresh_outdated_components: (ActorSnapshot) -> void
21
+
22
+ # @rbs () -> void
23
+ def validate_scalar_observables!: () -> void
24
+
25
+ # @rbs (ActorSnapshot) -> Array[String]
26
+ def scalar_observable_names: (ActorSnapshot) -> Array[String]
7
27
  end
8
28
  end
@@ -8,20 +8,37 @@ module SolidObjects
8
8
 
9
9
  @actor: Actor
10
10
 
11
+ @instance_id: Integer
12
+
13
+ @revision: Integer
14
+
15
+ @observable_values: Hash[String, untyped]?
16
+
17
+ @observable_value_cache: Hash[String, untyped]
18
+
11
19
  attr_reader reference: untyped
12
20
 
13
21
  attr_reader actor_class: untyped
14
22
 
15
23
  attr_reader actor: untyped
16
24
 
25
+ attr_reader instance_id: untyped
26
+
27
+ attr_reader revision: untyped
28
+
17
29
  # @rbs (Reference) -> void
18
30
  def initialize: (Reference) -> void
19
31
 
20
32
  # @rbs () -> Hash[String, untyped]
21
33
  def observable_values: () -> Hash[String, untyped]
22
34
 
35
+ # @rbs (Symbol | String) -> untyped
36
+ def observable_value: (Symbol | String) -> untyped
37
+
23
38
  private
24
39
 
40
+ attr_reader instance: untyped
41
+
25
42
  # @rbs () -> Actor
26
43
  def build_actor: () -> Actor
27
44
  end
@@ -2,6 +2,10 @@
2
2
 
3
3
  module SolidObjects
4
4
  class ActorView
5
+ @observable_names: Array[String]
6
+
7
+ @component_registrations: Array[ComponentRegistration]
8
+
5
9
  @snapshot: ActorSnapshot
6
10
 
7
11
  @authorization_context: untyped
@@ -18,8 +22,14 @@ module SolidObjects
18
22
  # @rbs (Symbol | String) -> untyped
19
23
  def value: (Symbol | String) -> untyped
20
24
 
21
- # @rbs (Symbol | String, ?partial: String?) -> untyped
22
- def component: (Symbol | String, ?partial: String?) -> untyped
25
+ # @rbs (Symbol | String, ?observes: Symbol | String | Array[Symbol | String]?, ?partial: String?) -> untyped
26
+ def component: (Symbol | String, ?observes: Symbol | String | Array[Symbol | String]?, ?partial: String?) -> untyped
27
+
28
+ # @rbs () -> Array[String]
29
+ def component_tokens: () -> Array[String]
30
+
31
+ # @rbs () -> Array[String]
32
+ def scalar_observable_names: () -> Array[String]
23
33
 
24
34
  # @rbs () -> State
25
35
  def state: () -> State
@@ -38,6 +48,13 @@ module SolidObjects
38
48
 
39
49
  attr_reader snapshot: untyped
40
50
 
51
+ attr_reader component_registrations: untyped
52
+
53
+ attr_reader observable_names: untyped
54
+
55
+ # @rbs (String, partial: String?) -> untyped
56
+ def static_component: (String, partial: String?) -> untyped
57
+
41
58
  # @rbs (Symbol | String) -> void
42
59
  def authorize_read!: (Symbol | String) -> void
43
60
 
@@ -50,6 +67,18 @@ module SolidObjects
50
67
  # @rbs (Symbol | String) -> String
51
68
  def normalized_component_name: (Symbol | String) -> String
52
69
 
70
+ # @rbs (Symbol | String | Array[Symbol | String]) -> Array[String]
71
+ def normalized_dependencies: (Symbol | String | Array[Symbol | String]) -> Array[String]
72
+
73
+ # @rbs (Array[String]) -> void
74
+ def validate_dependencies!: (Array[String]) -> void
75
+
76
+ # @rbs (String) -> void
77
+ def ensure_unique_component!: (String) -> void
78
+
79
+ # @rbs () -> Proc | ComponentPathResolver
80
+ def component_path_resolver: () -> Proc
81
+
53
82
  # @rbs (String) -> String
54
83
  def default_partial: (String) -> String
55
84
  end
@@ -0,0 +1,8 @@
1
+ # Generated from lib/solid_objects/application_write_guard.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class ApplicationWriteGuard
5
+ # @rbs (actor_type: String, actor_id: String, operation: String) { () -> untyped } -> untyped
6
+ def self.call: (actor_type: String, actor_id: String, operation: String) { () -> untyped } -> untyped
7
+ end
8
+ end
@@ -8,12 +8,17 @@ module SolidObjects
8
8
 
9
9
  @registry: ProcessRegistry?
10
10
 
11
+ @shutdown_hook_installed: bool
12
+
11
13
  # @rbs () -> void
12
14
  def initialize: () -> void
13
15
 
14
16
  # @rbs () -> ProcessRegistry
15
17
  def process_registry: () -> ProcessRegistry
16
18
 
19
+ # @rbs () -> bool
20
+ def stop: () -> bool
21
+
17
22
  private
18
23
 
19
24
  attr_reader mutex: untyped
@@ -28,5 +33,11 @@ module SolidObjects
28
33
 
29
34
  # @rbs () -> ProcessRegistry
30
35
  def register: () -> ProcessRegistry
36
+
37
+ # @rbs () -> void
38
+ def install_shutdown_hook: () -> void
39
+
40
+ # @rbs () -> bool
41
+ def stop_after_exit: () -> bool
31
42
  end
32
43
  end
@@ -11,6 +11,15 @@ module SolidObjects
11
11
  # @rbs () -> void
12
12
  def cleanup: () -> void
13
13
 
14
+ # @rbs () -> void
15
+ def prune_messages: () -> void
16
+
17
+ # @rbs () -> void
18
+ def prune_instances: () -> void
19
+
20
+ # @rbs () -> void
21
+ def prune_processes: () -> void
22
+
14
23
  # @rbs () -> void
15
24
  def dead_letters: () -> void
16
25
 
@@ -25,7 +34,7 @@ module SolidObjects
25
34
  # @rbs (Symbol, Integer) -> Integer
26
35
  def numeric_option: (Symbol, Integer) -> Integer
27
36
 
28
- # @rbs (Symbol) -> void
29
- def authorize_administration!: (Symbol) -> void
37
+ # @rbs (Symbol, resource: String) -> void
38
+ def authorize_administration!: (Symbol, resource: String) -> void
30
39
  end
31
40
  end
@@ -13,6 +13,12 @@ module SolidObjects
13
13
  # @rbs (Reference, Symbol | String, Hash[Symbol | String, untyped], timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped) -> untyped
14
14
  def sync: (Reference, Symbol | String, Hash[Symbol | String, untyped], timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped) -> untyped
15
15
 
16
+ # @rbs (MessageReference, timeout: Numeric, ?authorization_context: untyped) -> untyped
17
+ def wait: (MessageReference, timeout: Numeric, ?authorization_context: untyped) -> untyped
18
+
19
+ # @rbs (Reference, ?authorization_context: untyped) -> StateSnapshot
20
+ def snapshot: (Reference, ?authorization_context: untyped) -> StateSnapshot
21
+
16
22
  # @rbs (Reference, ?authorization_context: untyped) -> bool
17
23
  def destroy: (Reference, ?authorization_context: untyped) -> bool
18
24
 
@@ -20,6 +26,15 @@ module SolidObjects
20
26
 
21
27
  attr_reader mailbox: untyped
22
28
 
29
+ # @rbs (Reference, Symbol | String, Hash[Symbol | String, untyped], idempotency_key: String?, timeout: Numeric) -> MessageReference
30
+ def enqueue_sync: (Reference, Symbol | String, Hash[Symbol | String, untyped], idempotency_key: String?, timeout: Numeric) -> MessageReference
31
+
32
+ # @rbs (MessageReference, Message) -> void
33
+ def validate_message_reference!: (MessageReference, Message) -> void
34
+
35
+ # @rbs (Reference, Symbol | String) -> void
36
+ def reject_sync_inside_transaction!: (Reference, Symbol | String) -> void
37
+
23
38
  # @rbs (Proc, Reference, Symbol | String, Hash[Symbol | String, untyped], authorization_context: untyped) -> void
24
39
  def authorize!: (Proc, Reference, Symbol | String, Hash[Symbol | String, untyped], authorization_context: untyped) -> void
25
40
 
@@ -0,0 +1,43 @@
1
+ # Generated from lib/solid_objects/commit_action_registry.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class CommitActionContext < Data
5
+ attr_reader message_id(): untyped
6
+
7
+ attr_reader request_id(): untyped
8
+
9
+ attr_reader actor_type(): untyped
10
+
11
+ attr_reader actor_id(): untyped
12
+
13
+ attr_reader activation_generation(): untyped
14
+
15
+ def self.new: (untyped message_id, untyped request_id, untyped actor_type, untyped actor_id, untyped activation_generation) -> instance
16
+ | (message_id: untyped, request_id: untyped, actor_type: untyped, actor_id: untyped, activation_generation: untyped) -> instance
17
+
18
+ def self.members: () -> [ :message_id, :request_id, :actor_type, :actor_id, :activation_generation ]
19
+
20
+ def members: () -> [ :message_id, :request_id, :actor_type, :actor_id, :activation_generation ]
21
+ end
22
+
23
+ class CommitActionRegistry
24
+ @handlers: Hash[String, Proc]
25
+
26
+ @mutex: Mutex
27
+
28
+ # @rbs () -> void
29
+ def initialize: () -> void
30
+
31
+ # @rbs (String | Symbol, Proc) -> Proc
32
+ def register: (String | Symbol, Proc) -> Proc
33
+
34
+ # @rbs (String | Symbol) -> Proc
35
+ def fetch: (String | Symbol) -> Proc
36
+
37
+ private
38
+
39
+ attr_reader handlers: untyped
40
+
41
+ attr_reader mutex: untyped
42
+ end
43
+ end
@@ -0,0 +1,13 @@
1
+ # Generated from lib/solid_objects/component_path_resolver.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class ComponentPathResolver
5
+ # @rbs (view_context: untyped) -> String
6
+ def call: (view_context: untyped) -> String
7
+
8
+ private
9
+
10
+ # @rbs () -> bool
11
+ def mounted?: () -> bool
12
+ end
13
+ end