solid_objects 0.5.2 → 0.7.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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/app/assets/javascripts/solid_objects/component_batch_refresh.js +148 -0
  4. data/app/assets/javascripts/solid_objects/state_payload.js +69 -0
  5. data/app/controllers/solid_objects/components_controller.rb +84 -0
  6. data/app/helpers/solid_objects/actor_helper.rb +22 -4
  7. data/config/routes.rb +1 -0
  8. data/docs/realtime.md +161 -0
  9. data/lib/solid_objects/actor.rb +7 -0
  10. data/lib/solid_objects/actor_channel.rb +55 -4
  11. data/lib/solid_objects/actor_definition.rb +19 -0
  12. data/lib/solid_objects/actor_view.rb +14 -7
  13. data/lib/solid_objects/component_registration.rb +23 -4
  14. data/lib/solid_objects/component_subscriptions.rb +16 -10
  15. data/lib/solid_objects/component_token.rb +19 -2
  16. data/lib/solid_objects/errors.rb +6 -0
  17. data/lib/solid_objects/executor.rb +22 -7
  18. data/lib/solid_objects/payload_broadcast.rb +67 -0
  19. data/lib/solid_objects/stream_token.rb +19 -12
  20. data/lib/solid_objects/turbo_stream_renderer.rb +34 -5
  21. data/lib/solid_objects/version.rb +1 -1
  22. data/lib/solid_objects.rb +1 -0
  23. data/sig/generated/controllers/solid_objects/components_controller.rbs +11 -0
  24. data/sig/generated/helpers/solid_objects/actor_helper.rbs +2 -2
  25. data/sig/generated/lib/solid_objects/actor.rbs +3 -0
  26. data/sig/generated/lib/solid_objects/actor_channel.rbs +11 -0
  27. data/sig/generated/lib/solid_objects/actor_definition.rbs +7 -0
  28. data/sig/generated/lib/solid_objects/actor_view.rbs +7 -4
  29. data/sig/generated/lib/solid_objects/component_registration.rbs +11 -4
  30. data/sig/generated/lib/solid_objects/component_subscriptions.rbs +3 -0
  31. data/sig/generated/lib/solid_objects/component_token.rbs +7 -2
  32. data/sig/generated/lib/solid_objects/errors.rbs +6 -0
  33. data/sig/generated/lib/solid_objects/executor.rbs +7 -4
  34. data/sig/generated/lib/solid_objects/payload_broadcast.rbs +35 -0
  35. data/sig/generated/lib/solid_objects/stream_token.rbs +5 -2
  36. data/sig/generated/lib/solid_objects/turbo_stream_renderer.rbs +6 -0
  37. metadata +5 -1
@@ -22,8 +22,8 @@ module SolidObjects
22
22
  # @rbs (Symbol | String) -> untyped
23
23
  def value: (Symbol | String) -> untyped
24
24
 
25
- # @rbs (Symbol | String, ?observes: Symbol | String | Array[Symbol | String]?, ?partial: String?, ?key: untyped, ?locals: Hash[untyped, untyped], ?refresh: String | Symbol) -> untyped
26
- def component: (Symbol | String, ?observes: Symbol | String | Array[Symbol | String]?, ?partial: String?, ?key: untyped, ?locals: Hash[untyped, untyped], ?refresh: String | Symbol) -> untyped
25
+ # @rbs (Symbol | String, ?observes: Symbol | String | Array[Symbol | String]?, ?partial: String?, ?key: untyped, ?locals: Hash[untyped, untyped], ?refresh: String | Symbol, ?batch: untyped) -> untyped
26
+ def component: (Symbol | String, ?observes: Symbol | String | Array[Symbol | String]?, ?partial: String?, ?key: untyped, ?locals: Hash[untyped, untyped], ?refresh: String | Symbol, ?batch: untyped) -> untyped
27
27
 
28
28
  # @rbs () -> Array[String]
29
29
  def component_tokens: () -> Array[String]
@@ -31,6 +31,9 @@ module SolidObjects
31
31
  # @rbs () -> Array[String]
32
32
  def scalar_observable_names: () -> Array[String]
33
33
 
34
+ # @rbs () -> bool
35
+ def batched_components?: () -> bool
36
+
34
37
  # @rbs () -> bool
35
38
  def morph_components?: () -> bool
36
39
 
@@ -79,8 +82,8 @@ module SolidObjects
79
82
  # @rbs (ComponentRegistration) -> void
80
83
  def ensure_unique_component!: (ComponentRegistration) -> void
81
84
 
82
- # @rbs (key: untyped, locals: Hash[untyped, untyped], refresh: String | Symbol) -> void
83
- def validate_static_options!: (key: untyped, locals: Hash[untyped, untyped], refresh: String | Symbol) -> void
85
+ # @rbs (key: untyped, locals: Hash[untyped, untyped], refresh: String | Symbol, batch: untyped) -> void
86
+ def validate_static_options!: (key: untyped, locals: Hash[untyped, untyped], refresh: String | Symbol, batch: untyped) -> void
84
87
 
85
88
  # @rbs () -> Proc | ComponentPathResolver
86
89
  def component_path_resolver: () -> Proc
@@ -16,6 +16,8 @@ module SolidObjects
16
16
 
17
17
  @dependencies: Array[String]
18
18
 
19
+ @batch: String?
20
+
19
21
  @component_key: String | Integer?
20
22
 
21
23
  @component_name: String
@@ -28,6 +30,8 @@ module SolidObjects
28
30
 
29
31
  attr_reader component_key: untyped
30
32
 
33
+ attr_reader batch: untyped
34
+
31
35
  attr_reader dependencies: untyped
32
36
 
33
37
  attr_reader locals: untyped
@@ -42,11 +46,11 @@ module SolidObjects
42
46
 
43
47
  attr_reader token: untyped
44
48
 
45
- # @rbs (reference: Reference, component_name: String, component_key: String | Integer?, dependencies: Array[String], locals: Hash[String, untyped], refresh_method: String, instance_id: Integer, revision: Integer, refresh_path: String, token: String) -> void
46
- def initialize: (reference: Reference, component_name: String, component_key: String | Integer?, dependencies: Array[String], locals: Hash[String, untyped], refresh_method: String, instance_id: Integer, revision: Integer, refresh_path: String, token: String) -> void
49
+ # @rbs (reference: Reference, component_name: String, component_key: String | Integer?, dependencies: Array[String], locals: Hash[String, untyped], refresh_method: String, instance_id: Integer, revision: Integer, refresh_path: String, token: String, ?batch: String?) -> void
50
+ def initialize: (reference: Reference, component_name: String, component_key: String | Integer?, dependencies: Array[String], locals: Hash[String, untyped], refresh_method: String, instance_id: Integer, revision: Integer, refresh_path: String, token: String, ?batch: String?) -> void
47
51
 
48
- # @rbs (reference: Reference, component_name: String, component_key: untyped, dependencies: Array[String], locals: Hash[untyped, untyped], refresh_method: String | Symbol, snapshot: ActorSnapshot, refresh_path: String) -> ComponentRegistration
49
- def self.issue: (reference: Reference, component_name: String, component_key: untyped, dependencies: Array[String], locals: Hash[untyped, untyped], refresh_method: String | Symbol, snapshot: ActorSnapshot, refresh_path: String) -> ComponentRegistration
52
+ # @rbs (reference: Reference, component_name: String, component_key: untyped, dependencies: Array[String], locals: Hash[untyped, untyped], refresh_method: String | Symbol, snapshot: ActorSnapshot, refresh_path: String, ?batch: String?) -> ComponentRegistration
53
+ def self.issue: (reference: Reference, component_name: String, component_key: untyped, dependencies: Array[String], locals: Hash[untyped, untyped], refresh_method: String | Symbol, snapshot: ActorSnapshot, refresh_path: String, ?batch: String?) -> ComponentRegistration
50
54
 
51
55
  # @rbs (String) -> ComponentRegistration
52
56
  def self.from_token: (String) -> ComponentRegistration
@@ -69,6 +73,9 @@ module SolidObjects
69
73
  # @rbs () -> Hash[String, untyped]
70
74
  def authorization_arguments: () -> Hash[String, untyped]
71
75
 
76
+ # @rbs (Array[ComponentRegistration], Integer, Integer) -> String
77
+ def batch_refresh_url: (Array[ComponentRegistration], Integer, Integer) -> String
78
+
72
79
  # @rbs (Integer, Integer) -> String
73
80
  def refresh_url: (Integer, Integer) -> String
74
81
  end
@@ -31,6 +31,9 @@ module SolidObjects
31
31
 
32
32
  attr_reader revisions: untyped
33
33
 
34
+ # @rbs (ComponentRegistration, Integer, Integer) -> void
35
+ def record_revision: (ComponentRegistration, Integer, Integer) -> void
36
+
34
37
  # @rbs (ComponentRegistration, Integer, Integer) -> String
35
38
  def refresh: (ComponentRegistration, Integer, Integer) -> String
36
39
 
@@ -12,14 +12,16 @@ module SolidObjects
12
12
 
13
13
  MAXIMUM_COMPONENT_KEY_BYTES: ::Integer
14
14
 
15
+ MAXIMUM_BATCH_BYTES: ::Integer
16
+
15
17
  REFRESH_METHODS: untyped
16
18
 
17
19
  RESERVED_LOCALS: untyped
18
20
 
19
21
  RUBY_KEYWORDS: untyped
20
22
 
21
- # @rbs (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String, ?component_key: untyped, ?locals: Hash[untyped, untyped], ?refresh_method: String | Symbol) -> String
22
- def self?.generate: (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String, ?component_key: untyped, ?locals: Hash[untyped, untyped], ?refresh_method: String | Symbol) -> String
23
+ # @rbs (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String, ?component_key: untyped, ?locals: Hash[untyped, untyped], ?refresh_method: String | Symbol, ?batch: untyped) -> String
24
+ def self?.generate: (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String, ?component_key: untyped, ?locals: Hash[untyped, untyped], ?refresh_method: String | Symbol, ?batch: untyped) -> String
23
25
 
24
26
  # @rbs (String) -> Hash[String, untyped]
25
27
  def self?.verify: (String) -> Hash[String, untyped]
@@ -36,6 +38,9 @@ module SolidObjects
36
38
  # @rbs (untyped) -> void
37
39
  def self?.validate_component_key!: (untyped) -> void
38
40
 
41
+ # @rbs (untyped) -> void
42
+ def self?.validate_batch!: (untyped) -> void
43
+
39
44
  # @rbs (Array[untyped]) -> void
40
45
  def self?.validate_dependencies!: (Array[untyped]) -> void
41
46
 
@@ -43,6 +43,12 @@ module SolidObjects
43
43
  class UnknownComponent < Error
44
44
  end
45
45
 
46
+ class UnknownPayloadBroadcast < Error
47
+ end
48
+
49
+ class InvalidPayloadBroadcast < Error
50
+ end
51
+
46
52
  class UnknownComponentDependency < Error
47
53
  end
48
54
 
@@ -30,8 +30,8 @@ module SolidObjects
30
30
  # @rbs (Hash[String, untyped], Hash[String, untyped]) -> Hash[String, untyped]
31
31
  def changed_observables: (Hash[String, untyped], Hash[String, untyped]) -> Hash[String, untyped]
32
32
 
33
- # @rbs (untyped, Hash[String, untyped]) -> void
34
- def complete: (untyped, Hash[String, untyped]) -> void
33
+ # @rbs (untyped, Hash[String, untyped], state_changed: bool) -> void
34
+ def complete: (untyped, Hash[String, untyped], state_changed: bool) -> void
35
35
 
36
36
  # @rbs (Array[Actor::CommitActionIntent]) -> void
37
37
  def execute_commit_actions: (Array[Actor::CommitActionIntent]) -> void
@@ -51,8 +51,11 @@ module SolidObjects
51
51
  # @rbs (Message, Instance, Array[Actor::OutboundMessageIntent]) -> Array[Effect]
52
52
  def enqueue_actor_messages: (Message, Instance, Array[Actor::OutboundMessageIntent]) -> Array[Effect]
53
53
 
54
- # @rbs (Message, Instance, Hash[String, untyped]) -> void
55
- def enqueue_broadcasts: (Message, Instance, Hash[String, untyped]) -> void
54
+ # @rbs (Message, Instance, Hash[String, untyped], state_changed: bool) -> void
55
+ def enqueue_broadcasts: (Message, Instance, Hash[String, untyped], state_changed: bool) -> void
56
+
57
+ # @rbs () -> bool
58
+ def payload_broadcasts?: () -> bool
56
59
 
57
60
  # @rbs (Exception) -> void
58
61
  def fail_message: (Exception) -> void
@@ -0,0 +1,35 @@
1
+ # Generated from lib/solid_objects/payload_broadcast.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class PayloadBroadcast
5
+ MAXIMUM_PAYLOAD_BYTES: ::Integer
6
+
7
+ REVISION_OBSERVABLE: ::String
8
+
9
+ @snapshot: ActorSnapshot
10
+
11
+ @name: String
12
+
13
+ @authorization_context: untyped
14
+
15
+ attr_reader name: untyped
16
+
17
+ # @rbs (snapshot: ActorSnapshot, name: String, authorization_context: untyped) -> void
18
+ def initialize: (snapshot: ActorSnapshot, name: String, authorization_context: untyped) -> void
19
+
20
+ # @rbs () -> Hash[String, untyped]
21
+ def call: () -> Hash[String, untyped]
22
+
23
+ private
24
+
25
+ attr_reader snapshot: untyped
26
+
27
+ attr_reader authorization_context: untyped
28
+
29
+ # @rbs (ActorDefinition::Handler) -> untyped
30
+ def rendered_payload: (ActorDefinition::Handler) -> untyped
31
+
32
+ # @rbs () -> void
33
+ def authorize!: () -> void
34
+ end
35
+ end
@@ -6,8 +6,8 @@ module SolidObjects
6
6
 
7
7
  MAXIMUM_OBSERVABLES: ::Integer
8
8
 
9
- # @rbs (Reference, ?observables: Array[String]?) -> String
10
- def self?.generate: (Reference, ?observables: Array[String]?) -> String
9
+ # @rbs (Reference, ?observables: Array[String]?, ?payloads: Array[String]?) -> String
10
+ def self?.generate: (Reference, ?observables: Array[String]?, ?payloads: Array[String]?) -> String
11
11
 
12
12
  # @rbs (String) -> Hash[String, untyped]
13
13
  def self?.verify: (String) -> Hash[String, untyped]
@@ -15,6 +15,9 @@ module SolidObjects
15
15
  # @rbs (Hash[String, untyped]) -> Hash[String, untyped]
16
16
  def self?.validate_identity!: (Hash[String, untyped]) -> Hash[String, untyped]
17
17
 
18
+ # @rbs (untyped, String) -> void
19
+ def self?.validate_names!: (untyped, String) -> void
20
+
18
21
  # @rbs () -> ActiveSupport::MessageVerifier
19
22
  def self?.verifier: () -> ActiveSupport::MessageVerifier
20
23
 
@@ -15,6 +15,12 @@ module SolidObjects
15
15
  # @rbs (ComponentRegistration, Integer, Integer) -> String
16
16
  def self?.component_refresh: (ComponentRegistration, Integer, Integer) -> String
17
17
 
18
+ # @rbs (Array[ComponentRegistration], Integer, Integer) -> String
19
+ def self?.batch_refresh: (Array[ComponentRegistration], Integer, Integer) -> String
20
+
21
+ # @rbs (Hash[String, untyped]) -> String
22
+ def self?.state_payload: (Hash[String, untyped]) -> String
23
+
18
24
  # @rbs (String) -> Hash[String, untyped]?
19
25
  def self?.invalidation: (String) -> Hash[String, untyped]?
20
26
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Carlson
@@ -262,7 +262,9 @@ files:
262
262
  - MIT-LICENSE
263
263
  - README.md
264
264
  - Rakefile
265
+ - app/assets/javascripts/solid_objects/component_batch_refresh.js
265
266
  - app/assets/javascripts/solid_objects/component_refresh.js
267
+ - app/assets/javascripts/solid_objects/state_payload.js
266
268
  - app/controllers/solid_objects/application_controller.rb
267
269
  - app/controllers/solid_objects/components_controller.rb
268
270
  - app/controllers/solid_objects/dead_letters_controller.rb
@@ -382,6 +384,7 @@ files:
382
384
  - lib/solid_objects/mailbox.rb
383
385
  - lib/solid_objects/message_pruner.rb
384
386
  - lib/solid_objects/message_reference.rb
387
+ - lib/solid_objects/payload_broadcast.rb
385
388
  - lib/solid_objects/process_pruner.rb
386
389
  - lib/solid_objects/process_registry.rb
387
390
  - lib/solid_objects/reference.rb
@@ -452,6 +455,7 @@ files:
452
455
  - sig/generated/lib/solid_objects/mailbox.rbs
453
456
  - sig/generated/lib/solid_objects/message_pruner.rbs
454
457
  - sig/generated/lib/solid_objects/message_reference.rbs
458
+ - sig/generated/lib/solid_objects/payload_broadcast.rbs
455
459
  - sig/generated/lib/solid_objects/process_pruner.rbs
456
460
  - sig/generated/lib/solid_objects/process_registry.rbs
457
461
  - sig/generated/lib/solid_objects/reference.rbs