solid_objects 0.3.0 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +134 -25
- data/app/controllers/solid_objects/components_controller.rb +78 -0
- data/app/helpers/solid_objects/actor_helper.rb +13 -4
- data/config/routes.rb +1 -0
- data/db/migrate/20260806000000_add_state_revision_to_solid_objects_instances.rb +12 -0
- data/docs/architecture.md +61 -15
- data/docs/authorization.md +38 -1
- data/docs/correctness.md +28 -2
- data/docs/database-schema.md +13 -5
- data/docs/realtime.md +106 -12
- data/docs/roadmap.md +6 -5
- data/examples/application/README.md +5 -4
- data/examples/application/app/views/actors/chat_room_actor/_messages.html.erb +1 -1
- data/examples/application/app/views/chat_rooms/show.html.erb +2 -2
- data/examples/application/config/initializers/solid_objects.rb +9 -3
- data/lib/generators/solid_objects/templates/solid_objects.rb +3 -0
- data/lib/solid_objects/actor.rb +11 -0
- data/lib/solid_objects/actor_channel.rb +73 -5
- data/lib/solid_objects/actor_snapshot.rb +25 -6
- data/lib/solid_objects/actor_view.rb +103 -10
- data/lib/solid_objects/component_path_resolver.rb +27 -0
- data/lib/solid_objects/component_registration.rb +117 -0
- data/lib/solid_objects/component_renderer.rb +82 -0
- data/lib/solid_objects/component_subscriptions.rb +109 -0
- data/lib/solid_objects/component_token.rb +139 -0
- data/lib/solid_objects/component_view.rb +67 -0
- data/lib/solid_objects/configuration.rb +12 -0
- data/lib/solid_objects/database_adapters/sqlite.rb +15 -3
- data/lib/solid_objects/errors.rb +12 -0
- data/lib/solid_objects/executor.rb +1 -0
- data/lib/solid_objects/stream_token.rb +32 -13
- data/lib/solid_objects/turbo_stream_renderer.rb +45 -1
- data/lib/solid_objects/version.rb +1 -1
- data/lib/solid_objects.rb +6 -0
- data/sig/generated/controllers/solid_objects/components_controller.rbs +22 -0
- data/sig/generated/lib/solid_objects/actor.rbs +3 -0
- data/sig/generated/lib/solid_objects/actor_channel.rbs +20 -0
- data/sig/generated/lib/solid_objects/actor_snapshot.rbs +17 -0
- data/sig/generated/lib/solid_objects/actor_view.rbs +31 -2
- data/sig/generated/lib/solid_objects/component_path_resolver.rbs +13 -0
- data/sig/generated/lib/solid_objects/component_registration.rbs +51 -0
- data/sig/generated/lib/solid_objects/component_renderer.rbs +39 -0
- data/sig/generated/lib/solid_objects/component_subscriptions.rbs +40 -0
- data/sig/generated/lib/solid_objects/component_token.rbs +38 -0
- data/sig/generated/lib/solid_objects/component_view.rbs +43 -0
- data/sig/generated/lib/solid_objects/configuration.rbs +10 -2
- data/sig/generated/lib/solid_objects/database_adapters/sqlite.rbs +5 -0
- data/sig/generated/lib/solid_objects/errors.rbs +12 -0
- data/sig/generated/lib/solid_objects/stream_token.rbs +9 -4
- data/sig/generated/lib/solid_objects/turbo_stream_renderer.rbs +10 -0
- metadata +16 -1
|
@@ -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(
|
|
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)
|
data/lib/solid_objects.rb
CHANGED
|
@@ -32,8 +32,14 @@ require "solid_objects/process_pruner"
|
|
|
32
32
|
require "solid_objects/stream_name"
|
|
33
33
|
require "solid_objects/dom_identity"
|
|
34
34
|
require "solid_objects/stream_token"
|
|
35
|
+
require "solid_objects/component_token"
|
|
36
|
+
require "solid_objects/component_path_resolver"
|
|
35
37
|
require "solid_objects/turbo_stream_renderer"
|
|
36
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"
|
|
37
43
|
require "solid_objects/state_snapshot"
|
|
38
44
|
require "solid_objects/actor_view"
|
|
39
45
|
require "solid_objects/action_cable_broadcast_adapter"
|
|
@@ -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
|
|
@@ -166,6 +166,9 @@ module SolidObjects
|
|
|
166
166
|
# @rbs () -> Hash[String, untyped]
|
|
167
167
|
def observable_values: () -> Hash[String, untyped]
|
|
168
168
|
|
|
169
|
+
# @rbs (Symbol | String) -> untyped
|
|
170
|
+
def observable_value: (Symbol | String) -> untyped
|
|
171
|
+
|
|
169
172
|
# @rbs () -> void
|
|
170
173
|
def activate: () -> void
|
|
171
174
|
|
|
@@ -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,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
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/component_registration.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class ComponentRegistration
|
|
5
|
+
@reference: Reference
|
|
6
|
+
|
|
7
|
+
@component_name: String
|
|
8
|
+
|
|
9
|
+
@dependencies: Array[String]
|
|
10
|
+
|
|
11
|
+
@instance_id: Integer
|
|
12
|
+
|
|
13
|
+
@revision: Integer
|
|
14
|
+
|
|
15
|
+
@refresh_path: String
|
|
16
|
+
|
|
17
|
+
@token: String
|
|
18
|
+
|
|
19
|
+
attr_reader reference: untyped
|
|
20
|
+
|
|
21
|
+
attr_reader component_name: untyped
|
|
22
|
+
|
|
23
|
+
attr_reader dependencies: untyped
|
|
24
|
+
|
|
25
|
+
attr_reader instance_id: untyped
|
|
26
|
+
|
|
27
|
+
attr_reader revision: untyped
|
|
28
|
+
|
|
29
|
+
attr_reader refresh_path: untyped
|
|
30
|
+
|
|
31
|
+
attr_reader token: untyped
|
|
32
|
+
|
|
33
|
+
# @rbs (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String, token: String) -> void
|
|
34
|
+
def initialize: (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String, token: String) -> void
|
|
35
|
+
|
|
36
|
+
# @rbs (reference: Reference, component_name: String, dependencies: Array[String], snapshot: ActorSnapshot, refresh_path: String) -> ComponentRegistration
|
|
37
|
+
def self.issue: (reference: Reference, component_name: String, dependencies: Array[String], snapshot: ActorSnapshot, refresh_path: String) -> ComponentRegistration
|
|
38
|
+
|
|
39
|
+
# @rbs (String) -> ComponentRegistration
|
|
40
|
+
def self.from_token: (String) -> ComponentRegistration
|
|
41
|
+
|
|
42
|
+
# @rbs (Reference, Array[String]) -> void
|
|
43
|
+
private def self.validate_dependencies!: (Reference, Array[String]) -> void
|
|
44
|
+
|
|
45
|
+
# @rbs () -> Array[Integer]
|
|
46
|
+
def revision_key: () -> Array[Integer]
|
|
47
|
+
|
|
48
|
+
# @rbs (Integer, Integer) -> String
|
|
49
|
+
def refresh_url: (Integer, Integer) -> String
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/component_renderer.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class ComponentRenderer
|
|
5
|
+
@snapshot: ActorSnapshot
|
|
6
|
+
|
|
7
|
+
@component_name: String
|
|
8
|
+
|
|
9
|
+
@dependencies: Array[String]
|
|
10
|
+
|
|
11
|
+
@view_context: untyped
|
|
12
|
+
|
|
13
|
+
@authorization_context: untyped
|
|
14
|
+
|
|
15
|
+
# @rbs (snapshot: ActorSnapshot, component_name: String, dependencies: Array[String], view_context: untyped, authorization_context: untyped) -> void
|
|
16
|
+
def initialize: (snapshot: ActorSnapshot, component_name: String, dependencies: Array[String], view_context: untyped, authorization_context: untyped) -> void
|
|
17
|
+
|
|
18
|
+
# @rbs () -> untyped
|
|
19
|
+
def call: () -> untyped
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
attr_reader snapshot: untyped
|
|
24
|
+
|
|
25
|
+
attr_reader component_name: untyped
|
|
26
|
+
|
|
27
|
+
attr_reader dependencies: untyped
|
|
28
|
+
|
|
29
|
+
attr_reader view_context: untyped
|
|
30
|
+
|
|
31
|
+
attr_reader authorization_context: untyped
|
|
32
|
+
|
|
33
|
+
# @rbs (String) -> void
|
|
34
|
+
def authorize_read!: (String) -> void
|
|
35
|
+
|
|
36
|
+
# @rbs () -> String
|
|
37
|
+
def default_partial: () -> String
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/component_subscriptions.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class ComponentSubscriptions
|
|
5
|
+
MAXIMUM_COMPONENTS: ::Integer
|
|
6
|
+
|
|
7
|
+
MAXIMUM_SERIALIZED_BYTES: ::Integer
|
|
8
|
+
|
|
9
|
+
@registrations: Array[ComponentRegistration]
|
|
10
|
+
|
|
11
|
+
@revisions: Hash[String, Array[Integer]]
|
|
12
|
+
|
|
13
|
+
# @rbs (String?, reference: Reference) -> ComponentSubscriptions
|
|
14
|
+
def self.parse: (String?, reference: Reference) -> ComponentSubscriptions
|
|
15
|
+
|
|
16
|
+
# @rbs (Array[ComponentRegistration]) -> void
|
|
17
|
+
def initialize: (Array[ComponentRegistration]) -> void
|
|
18
|
+
|
|
19
|
+
# @rbs (Hash[String, untyped]) -> Array[String]
|
|
20
|
+
def refreshes_for: (Hash[String, untyped]) -> Array[String]
|
|
21
|
+
|
|
22
|
+
# @rbs (ActorSnapshot) -> Array[String]
|
|
23
|
+
def reconnect_refreshes: (ActorSnapshot) -> Array[String]
|
|
24
|
+
|
|
25
|
+
# @rbs (ComponentRegistration, Reference) -> void
|
|
26
|
+
private def self.validate_identity!: (ComponentRegistration, Reference) -> void
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
attr_reader registrations: untyped
|
|
31
|
+
|
|
32
|
+
attr_reader revisions: untyped
|
|
33
|
+
|
|
34
|
+
# @rbs (ComponentRegistration, Integer, Integer) -> String
|
|
35
|
+
def refresh: (ComponentRegistration, Integer, Integer) -> String
|
|
36
|
+
|
|
37
|
+
# @rbs (String, Integer, Integer) -> bool
|
|
38
|
+
def newer_revision?: (String, Integer, Integer) -> bool
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/component_token.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
module ComponentToken
|
|
5
|
+
PURPOSE: ::String
|
|
6
|
+
|
|
7
|
+
MAXIMUM_TOKEN_BYTES: ::Integer
|
|
8
|
+
|
|
9
|
+
MAXIMUM_DEPENDENCIES: ::Integer
|
|
10
|
+
|
|
11
|
+
# @rbs (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String) -> String
|
|
12
|
+
def self?.generate: (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String) -> String
|
|
13
|
+
|
|
14
|
+
# @rbs (String) -> Hash[String, untyped]
|
|
15
|
+
def self?.verify: (String) -> Hash[String, untyped]
|
|
16
|
+
|
|
17
|
+
# @rbs (Hash[String, untyped]) -> Hash[String, untyped]
|
|
18
|
+
def self?.validate_payload!: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
19
|
+
|
|
20
|
+
# @rbs (String) -> void
|
|
21
|
+
def self?.validate_component_name!: (String) -> void
|
|
22
|
+
|
|
23
|
+
# @rbs (Array[untyped]) -> void
|
|
24
|
+
def self?.validate_dependencies!: (Array[untyped]) -> void
|
|
25
|
+
|
|
26
|
+
# @rbs (Integer, Integer) -> void
|
|
27
|
+
def self?.validate_revision!: (Integer, Integer) -> void
|
|
28
|
+
|
|
29
|
+
# @rbs (String) -> void
|
|
30
|
+
def self?.validate_refresh_path!: (String) -> void
|
|
31
|
+
|
|
32
|
+
# @rbs () -> ActiveSupport::MessageVerifier
|
|
33
|
+
def self?.verifier: () -> ActiveSupport::MessageVerifier
|
|
34
|
+
|
|
35
|
+
# @rbs () -> String
|
|
36
|
+
def self?.signing_secret: () -> String
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/component_view.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class ComponentView
|
|
5
|
+
@snapshot: ActorSnapshot
|
|
6
|
+
|
|
7
|
+
@dependencies: Array[String]
|
|
8
|
+
|
|
9
|
+
@authorization_context: untyped
|
|
10
|
+
|
|
11
|
+
attr_reader authorization_context: untyped
|
|
12
|
+
|
|
13
|
+
# @rbs (snapshot: ActorSnapshot, dependencies: Array[String], authorization_context: untyped) -> void
|
|
14
|
+
def initialize: (snapshot: ActorSnapshot, dependencies: Array[String], authorization_context: untyped) -> void
|
|
15
|
+
|
|
16
|
+
# @rbs () -> Reference
|
|
17
|
+
def reference: () -> Reference
|
|
18
|
+
|
|
19
|
+
# @rbs () -> String
|
|
20
|
+
def actor_id: () -> String
|
|
21
|
+
|
|
22
|
+
# @rbs () -> void
|
|
23
|
+
def state: () -> void
|
|
24
|
+
|
|
25
|
+
# @rbs (Symbol, *untyped, **untyped) -> untyped
|
|
26
|
+
def method_missing: (Symbol, *untyped, **untyped) -> untyped
|
|
27
|
+
|
|
28
|
+
# @rbs (Symbol, bool) -> bool
|
|
29
|
+
def respond_to_missing?: (Symbol, bool) -> bool
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
attr_reader snapshot: untyped
|
|
34
|
+
|
|
35
|
+
attr_reader dependencies: untyped
|
|
36
|
+
|
|
37
|
+
# @rbs (Symbol | String) -> bool
|
|
38
|
+
def observable?: (Symbol | String) -> bool
|
|
39
|
+
|
|
40
|
+
# @rbs (Symbol | String) -> untyped
|
|
41
|
+
def observable_value: (Symbol | String) -> untyped
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -4,8 +4,6 @@ module SolidObjects
|
|
|
4
4
|
class Configuration
|
|
5
5
|
@table_name_prefix: String
|
|
6
6
|
|
|
7
|
-
@process_alive_threshold: Float
|
|
8
|
-
|
|
9
7
|
@shutdown_timeout: Float
|
|
10
8
|
|
|
11
9
|
@message_retention: Numeric
|
|
@@ -36,6 +34,10 @@ module SolidObjects
|
|
|
36
34
|
|
|
37
35
|
@wake_up_adapter: untyped
|
|
38
36
|
|
|
37
|
+
@component_path_resolver: Proc?
|
|
38
|
+
|
|
39
|
+
@component_authorization_context: Proc
|
|
40
|
+
|
|
39
41
|
@authorize_message: Proc
|
|
40
42
|
|
|
41
43
|
@authorize_query: Proc
|
|
@@ -76,6 +78,8 @@ module SolidObjects
|
|
|
76
78
|
|
|
77
79
|
@process_heartbeat_interval: Float
|
|
78
80
|
|
|
81
|
+
@process_alive_threshold: Float
|
|
82
|
+
|
|
79
83
|
attr_accessor table_name_prefix: untyped
|
|
80
84
|
|
|
81
85
|
attr_accessor polling_interval: untyped
|
|
@@ -140,6 +144,10 @@ module SolidObjects
|
|
|
140
144
|
|
|
141
145
|
attr_accessor wake_up_adapter: untyped
|
|
142
146
|
|
|
147
|
+
attr_accessor component_path_resolver: untyped
|
|
148
|
+
|
|
149
|
+
attr_accessor component_authorization_context: untyped
|
|
150
|
+
|
|
143
151
|
attr_accessor authorize_message: untyped
|
|
144
152
|
|
|
145
153
|
attr_accessor authorize_query: untyped
|
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
module SolidObjects
|
|
4
4
|
module DatabaseAdapters
|
|
5
5
|
class Sqlite < DatabaseAdapter
|
|
6
|
+
LOCK_RETRY_INTERVAL: ::Float
|
|
7
|
+
|
|
6
8
|
# @rbs () -> String
|
|
7
9
|
def current_time_expression: () -> String
|
|
8
10
|
|
|
11
|
+
# @rbs () { () -> untyped } -> untyped
|
|
12
|
+
def transaction: () { () -> untyped } -> untyped
|
|
13
|
+
|
|
9
14
|
private
|
|
10
15
|
|
|
11
16
|
# @rbs (untyped) { () -> untyped } -> untyped
|
|
@@ -37,6 +37,18 @@ module SolidObjects
|
|
|
37
37
|
class InvalidStreamToken < Error
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
class InvalidComponentToken < Error
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class UnknownComponent < Error
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
class UnknownComponentDependency < Error
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class UnsupportedComponentRendering < Error
|
|
50
|
+
end
|
|
51
|
+
|
|
40
52
|
class LostActivation < Error
|
|
41
53
|
end
|
|
42
54
|
|
|
@@ -4,11 +4,16 @@ module SolidObjects
|
|
|
4
4
|
module StreamToken
|
|
5
5
|
PURPOSE: ::String
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
def self?.generate: (Reference) -> String
|
|
7
|
+
MAXIMUM_OBSERVABLES: ::Integer
|
|
9
8
|
|
|
10
|
-
# @rbs (String) ->
|
|
11
|
-
def self?.
|
|
9
|
+
# @rbs (Reference, ?observables: Array[String]?) -> String
|
|
10
|
+
def self?.generate: (Reference, ?observables: Array[String]?) -> String
|
|
11
|
+
|
|
12
|
+
# @rbs (String) -> Hash[String, untyped]
|
|
13
|
+
def self?.verify: (String) -> Hash[String, untyped]
|
|
14
|
+
|
|
15
|
+
# @rbs (Hash[String, untyped]) -> Hash[String, untyped]
|
|
16
|
+
def self?.validate_identity!: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
12
17
|
|
|
13
18
|
# @rbs () -> ActiveSupport::MessageVerifier
|
|
14
19
|
def self?.verifier: () -> ActiveSupport::MessageVerifier
|
|
@@ -2,12 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
module SolidObjects
|
|
4
4
|
module TurboStreamRenderer
|
|
5
|
+
INVALIDATION_MARKER: ::String
|
|
6
|
+
|
|
7
|
+
INVALIDATION_PATTERN: ::Regexp
|
|
8
|
+
|
|
5
9
|
# @rbs (Broadcast) -> String
|
|
6
10
|
def self?.observable: (Broadcast) -> String
|
|
7
11
|
|
|
8
12
|
# @rbs (Reference, Symbol | String, untyped) -> String
|
|
9
13
|
def self?.observable_value: (Reference, Symbol | String, untyped) -> String
|
|
10
14
|
|
|
15
|
+
# @rbs (ComponentRegistration, Integer, Integer) -> String
|
|
16
|
+
def self?.component_refresh: (ComponentRegistration, Integer, Integer) -> String
|
|
17
|
+
|
|
18
|
+
# @rbs (String) -> Hash[String, untyped]?
|
|
19
|
+
def self?.invalidation: (String) -> Hash[String, untyped]?
|
|
20
|
+
|
|
11
21
|
# @rbs (untyped) -> String
|
|
12
22
|
def self?.display_value: (untyped) -> String
|
|
13
23
|
end
|
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.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lucas Carlson
|
|
@@ -261,6 +261,7 @@ files:
|
|
|
261
261
|
- README.md
|
|
262
262
|
- Rakefile
|
|
263
263
|
- app/controllers/solid_objects/application_controller.rb
|
|
264
|
+
- app/controllers/solid_objects/components_controller.rb
|
|
264
265
|
- app/controllers/solid_objects/dead_letters_controller.rb
|
|
265
266
|
- app/controllers/solid_objects/instances_controller.rb
|
|
266
267
|
- app/helpers/solid_objects/actor_helper.rb
|
|
@@ -290,6 +291,7 @@ files:
|
|
|
290
291
|
- benchmark/sync_latency.rb
|
|
291
292
|
- config/routes.rb
|
|
292
293
|
- db/migrate/20260805000000_create_solid_objects_tables.rb
|
|
294
|
+
- db/migrate/20260806000000_add_state_revision_to_solid_objects_instances.rb
|
|
293
295
|
- docs/adr/0001-postgresql-backend.md
|
|
294
296
|
- docs/adr/0002-jsonb-actor-state.md
|
|
295
297
|
- docs/adr/0003-mailbox-ordering.md
|
|
@@ -348,6 +350,12 @@ files:
|
|
|
348
350
|
- lib/solid_objects/cli.rb
|
|
349
351
|
- lib/solid_objects/client.rb
|
|
350
352
|
- lib/solid_objects/commit_action_registry.rb
|
|
353
|
+
- lib/solid_objects/component_path_resolver.rb
|
|
354
|
+
- lib/solid_objects/component_registration.rb
|
|
355
|
+
- lib/solid_objects/component_renderer.rb
|
|
356
|
+
- lib/solid_objects/component_subscriptions.rb
|
|
357
|
+
- lib/solid_objects/component_token.rb
|
|
358
|
+
- lib/solid_objects/component_view.rb
|
|
351
359
|
- lib/solid_objects/configuration.rb
|
|
352
360
|
- lib/solid_objects/context.rb
|
|
353
361
|
- lib/solid_objects/database_adapter.rb
|
|
@@ -390,6 +398,7 @@ files:
|
|
|
390
398
|
- lib/solid_objects/worker.rb
|
|
391
399
|
- lib/tasks/solid_objects_tasks.rake
|
|
392
400
|
- sig/generated/controllers/solid_objects/application_controller.rbs
|
|
401
|
+
- sig/generated/controllers/solid_objects/components_controller.rbs
|
|
393
402
|
- sig/generated/controllers/solid_objects/dead_letters_controller.rbs
|
|
394
403
|
- sig/generated/controllers/solid_objects/instances_controller.rbs
|
|
395
404
|
- sig/generated/helpers/solid_objects/actor_helper.rbs
|
|
@@ -410,6 +419,12 @@ files:
|
|
|
410
419
|
- sig/generated/lib/solid_objects/cli.rbs
|
|
411
420
|
- sig/generated/lib/solid_objects/client.rbs
|
|
412
421
|
- sig/generated/lib/solid_objects/commit_action_registry.rbs
|
|
422
|
+
- sig/generated/lib/solid_objects/component_path_resolver.rbs
|
|
423
|
+
- sig/generated/lib/solid_objects/component_registration.rbs
|
|
424
|
+
- sig/generated/lib/solid_objects/component_renderer.rbs
|
|
425
|
+
- sig/generated/lib/solid_objects/component_subscriptions.rbs
|
|
426
|
+
- sig/generated/lib/solid_objects/component_token.rbs
|
|
427
|
+
- sig/generated/lib/solid_objects/component_view.rbs
|
|
413
428
|
- sig/generated/lib/solid_objects/configuration.rbs
|
|
414
429
|
- sig/generated/lib/solid_objects/context.rbs
|
|
415
430
|
- sig/generated/lib/solid_objects/database_adapter.rbs
|