phlex-reactive 0.15.4 → 0.16.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 +116 -0
- data/README.md +26 -2
- data/app/controllers/phlex/reactive/fragments_controller.rb +4 -3
- data/app/javascript/phlex/reactive/core.min.js +6 -6
- data/app/javascript/phlex/reactive/core.min.js.map +3 -3
- data/app/javascript/phlex/reactive/reactive_controller.min.js +4 -4
- data/app/javascript/phlex/reactive/reactive_controller.min.js.map +3 -3
- data/app/javascript/phlex/reactive/runtime.js +83 -1
- data/lib/generators/phlex/reactive/install/templates/phlex_reactive.rb.erb +2 -1
- data/lib/phlex/reactive/apm/subscriber.rb +5 -0
- data/lib/phlex/reactive/apm.rb +5 -6
- data/lib/phlex/reactive/authorization.rb +31 -5
- data/lib/phlex/reactive/client_bindings.rb +19 -0
- data/lib/phlex/reactive/component/dsl.rb +15 -1
- data/lib/phlex/reactive/component/helpers.rb +4 -0
- data/lib/phlex/reactive/component/identity.rb +17 -6
- data/lib/phlex/reactive/component/lazy.rb +4 -0
- data/lib/phlex/reactive/component/presence_declaration.rb +4 -0
- data/lib/phlex/reactive/component/registry.rb +76 -6
- data/lib/phlex/reactive/component/sortable.rb +3 -0
- data/lib/phlex/reactive/component.rb +4 -0
- data/lib/phlex/reactive/defer.rb +4 -4
- data/lib/phlex/reactive/doctor/ractor_readiness.rb +65 -0
- data/lib/phlex/reactive/doctor.rb +2 -0
- data/lib/phlex/reactive/engine.rb +25 -0
- data/lib/phlex/reactive/fragment.rb +5 -4
- data/lib/phlex/reactive/param_schema.rb +3 -2
- data/lib/phlex/reactive/pending/markup.rb +27 -9
- data/lib/phlex/reactive/pending.rb +4 -4
- data/lib/phlex/reactive/response.rb +3 -4
- data/lib/phlex/reactive/shareable.rb +87 -0
- data/lib/phlex/reactive/store.rb +73 -0
- data/lib/phlex/reactive/streamable.rb +49 -20
- data/lib/phlex/reactive/version.rb +1 -1
- data/lib/phlex/reactive.rb +293 -122
- data/sig/phlex/reactive/component.rbs +108 -0
- data/sig/phlex/reactive/param_schema.rbs +23 -0
- data/sig/phlex/reactive/response.rbs +70 -0
- data/sig/phlex/reactive/streamable.rbs +62 -0
- data/sig/phlex/reactive.rbs +231 -0
- metadata +9 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
module Phlex
|
|
2
|
+
module Reactive
|
|
3
|
+
# include Phlex::Reactive::Component: actions, signed identity, the DSL.
|
|
4
|
+
module Component
|
|
5
|
+
class ActionDefinition < ::Data
|
|
6
|
+
attr_reader name: Symbol
|
|
7
|
+
attr_reader params: Hash[Symbol | String, untyped]
|
|
8
|
+
attr_reader schema: ParamSchema
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class ComputeDefinition < ::Data
|
|
12
|
+
attr_reader name: Symbol
|
|
13
|
+
attr_reader inputs: Array[Symbol]
|
|
14
|
+
attr_reader outputs: Array[Symbol]
|
|
15
|
+
attr_reader reducer: String
|
|
16
|
+
attr_reader input_types: Hash[Symbol, Symbol]?
|
|
17
|
+
attr_reader mirror: Hash[Symbol, Array[String]]?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class OnCompleteDefinition < ::Data
|
|
21
|
+
attr_reader name: Symbol
|
|
22
|
+
attr_reader conditions: untyped
|
|
23
|
+
attr_reader ops: Array[untyped]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class CollectionDefinition < ::Data
|
|
27
|
+
attr_reader name: Symbol
|
|
28
|
+
attr_reader item: Class
|
|
29
|
+
attr_reader container: String
|
|
30
|
+
attr_reader count: String?
|
|
31
|
+
attr_reader empty: Class?
|
|
32
|
+
attr_reader size: Proc?
|
|
33
|
+
|
|
34
|
+
def size_for: (untyped component) -> Integer?
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# The class-level declaration macros and registry readers.
|
|
38
|
+
module DSL
|
|
39
|
+
module ClassMethods
|
|
40
|
+
# --- identity ---
|
|
41
|
+
def reactive_record: (Symbol | String name) -> Symbol
|
|
42
|
+
def reactive_record_key: () -> Symbol?
|
|
43
|
+
def reactive_state: (*Symbol | String names) -> untyped
|
|
44
|
+
def reactive_state_keys: () -> Array[Symbol]
|
|
45
|
+
def from_identity: (Hash[String, untyped] payload) -> untyped
|
|
46
|
+
|
|
47
|
+
# --- actions ---
|
|
48
|
+
def action: (Symbol | String name, ?params: Hash[Symbol | String, untyped] | Symbol) -> ActionDefinition
|
|
49
|
+
def reactive_actions: () -> Hash[Symbol, ActionDefinition]
|
|
50
|
+
def reactive_action: (untyped name) -> bot
|
|
51
|
+
def reactive_action?: (untyped name) -> bot
|
|
52
|
+
def skip_verify_authorized: (*Symbol | String names) -> untyped
|
|
53
|
+
def skip_verify_authorized?: (Symbol | String action_name) -> bool
|
|
54
|
+
def reactive_skip_all_authorization?: () -> bool
|
|
55
|
+
def reactive_skip_authorization_actions: () -> Array[Symbol]
|
|
56
|
+
def require_server_actions!: (Symbol macro) -> void
|
|
57
|
+
def assert_no_scope_double_nesting!: (untyped scope, untyped params, Symbol action_name) -> void
|
|
58
|
+
|
|
59
|
+
# --- form scope and dirty tracking ---
|
|
60
|
+
def reactive_scope: (?(Symbol | String)? name) -> untyped
|
|
61
|
+
def reactive_dirty: (?warn_unsaved: bool, ?only: (Array[Symbol | String] | Symbol | String)?) -> untyped
|
|
62
|
+
def reactive_dirty_config: () -> Hash[Symbol, untyped]?
|
|
63
|
+
def ensure_draft_default!: () -> void
|
|
64
|
+
|
|
65
|
+
# --- collections ---
|
|
66
|
+
def reactive_collection: (Symbol | String name, item: Class, container: String, ?count: String?, ?empty: Class?,
|
|
67
|
+
?size: Proc?) -> CollectionDefinition
|
|
68
|
+
def reactive_collection?: (untyped name) -> bot
|
|
69
|
+
def reactive_collections: () -> Hash[Symbol, CollectionDefinition]
|
|
70
|
+
def reactive_collection_def: (untyped name) -> bot
|
|
71
|
+
|
|
72
|
+
# --- client-side computes and completion bindings ---
|
|
73
|
+
# A setter only: without inputs: or outputs: it raises (the removed getter).
|
|
74
|
+
def reactive_compute: (Symbol | String name, inputs: untyped, ?outputs: untyped, ?reducer: String | Symbol | nil,
|
|
75
|
+
?mirror: Hash[untyped, untyped]?) -> ComputeDefinition
|
|
76
|
+
| (Symbol | String name, outputs: untyped, ?reducer: String | Symbol | nil,
|
|
77
|
+
?mirror: Hash[untyped, untyped]?) -> ComputeDefinition
|
|
78
|
+
def reactive_compute?: (untyped name) -> bot
|
|
79
|
+
def reactive_compute_def: (untyped name) -> bot
|
|
80
|
+
def reactive_computes: () -> Hash[Symbol, ComputeDefinition]
|
|
81
|
+
def normalize_compute_inputs: (untyped inputs) -> untyped
|
|
82
|
+
def normalize_typed_compute_inputs: (untyped inputs) -> untyped
|
|
83
|
+
def normalize_compute_mirror: (untyped mirror) -> untyped
|
|
84
|
+
def reactive_on_complete: (?(Symbol | String) name, run: untyped, **untyped conditions) -> OnCompleteDefinition
|
|
85
|
+
def reactive_on_completes: () -> Hash[Symbol, OnCompleteDefinition]
|
|
86
|
+
def reactive_on_complete_attr: () -> String?
|
|
87
|
+
def normalize_on_complete_ops: (Symbol name, untyped run) -> Array[untyped]
|
|
88
|
+
|
|
89
|
+
# --- lazy mount, dormancy, effects ---
|
|
90
|
+
def reactive_lazy: (?tag: Symbol | String, ?on: untyped, ?cache: Hash[Symbol, untyped]?) -> untyped
|
|
91
|
+
def reactive_lazy?: () -> bool
|
|
92
|
+
def reactive_lazy_declaration: () -> untyped
|
|
93
|
+
def reactive_lazy_tag: () -> Symbol
|
|
94
|
+
def reactive_lazy_trigger: () -> untyped
|
|
95
|
+
def reactive_lazy_cache: () -> Hash[Symbol, untyped]?
|
|
96
|
+
def reactive_dormant: (?bool dormant) -> untyped
|
|
97
|
+
def reactive_dormant?: () -> bool
|
|
98
|
+
def reactive_effects: (?false opt_out, **untyped hooks) -> untyped
|
|
99
|
+
def reactive_effects_config: () -> (Hash[Symbol, String | false] | false)?
|
|
100
|
+
def reactive_effect_attrs: () -> Hash[Symbol, String]?
|
|
101
|
+
|
|
102
|
+
# The client-op builder (Phlex::Reactive::JS).
|
|
103
|
+
def js: () -> untyped
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Phlex
|
|
2
|
+
module Reactive
|
|
3
|
+
# A compiled param schema: the coercion every action's params go through.
|
|
4
|
+
class ParamSchema
|
|
5
|
+
# The sentinel a caster returns to drop a value (the keyword default applies).
|
|
6
|
+
DROP: Object
|
|
7
|
+
|
|
8
|
+
type schema = Hash[Symbol | String, untyped]
|
|
9
|
+
|
|
10
|
+
def self.compile: (schema? schema) -> ParamSchema
|
|
11
|
+
def self.built_in_types: () -> Hash[Symbol, (^(untyped) -> untyped)?]
|
|
12
|
+
def self.expand: (untyped value) -> Hash[String, untyped]
|
|
13
|
+
|
|
14
|
+
attr_reader schema: schema
|
|
15
|
+
|
|
16
|
+
def initialize: (schema schema) -> void
|
|
17
|
+
|
|
18
|
+
# `dropped` collects [bracketed path, :undeclared | :uncoercible] pairs (verbose_errors).
|
|
19
|
+
def coerce: (untyped params, ?Array[[String, Symbol]]? dropped) -> Hash[Symbol, untyped]
|
|
20
|
+
def array_param: (String | Symbol name) -> (String | Symbol)?
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
module Phlex
|
|
2
|
+
module Reactive
|
|
3
|
+
# What an action returns to govern its reply (`reply`): immutable, every
|
|
4
|
+
# builder returns a new Response.
|
|
5
|
+
class Response
|
|
6
|
+
attr_reader streams: Array[String]
|
|
7
|
+
attr_reader redirect_url: String?
|
|
8
|
+
attr_reader token_component: untyped
|
|
9
|
+
attr_reader subject_component: untyped
|
|
10
|
+
attr_reader deferred_segments: Array[untyped]
|
|
11
|
+
attr_reader pending_segments: Array[untyped]
|
|
12
|
+
|
|
13
|
+
# --- chaining ---
|
|
14
|
+
def stream: (*String more) -> Response
|
|
15
|
+
def flash: (Symbol | String level, untyped content, ?target: String, ?dismiss_after: Integer?) -> Response
|
|
16
|
+
def js: (untyped ops, ?target: untyped) -> Response
|
|
17
|
+
def also: (?untyped companion, ?morph: bool, **untyped targets) -> Response
|
|
18
|
+
def defer: (untyped component, ?placeholder: untyped, ?morph: bool) -> Response
|
|
19
|
+
def pending: (untyped records, ?peers: bool, ?job: untyped, ?args: untyped, **untyped opts) ?{ (?) -> untyped } -> Response
|
|
20
|
+
|
|
21
|
+
# Removed: each raises a guided error naming its replacement.
|
|
22
|
+
def also_update: (untyped target, **untyped) -> bot
|
|
23
|
+
def also_replace: (*untyped, **untyped) -> bot
|
|
24
|
+
|
|
25
|
+
# --- what the endpoint reads ---
|
|
26
|
+
def redirect?: () -> bool
|
|
27
|
+
def render_self?: () -> bool
|
|
28
|
+
def refresh_token?: () -> bool
|
|
29
|
+
def deferred?: () -> bool
|
|
30
|
+
def pending?: () -> bool
|
|
31
|
+
|
|
32
|
+
# --- the builders `reply` delegates to ---
|
|
33
|
+
def self.build_replace: (untyped component, ?morph: bool, ?effect: untyped) -> Response
|
|
34
|
+
def self.build_update: (untyped component, ?morph: bool, ?effect: untyped) -> Response
|
|
35
|
+
def self.build_morph: (untyped component, ?effect: untyped) -> Response
|
|
36
|
+
def self.build_remove: (untyped component, ?effect: untyped) -> Response
|
|
37
|
+
def self.build_redirect: (String url) -> Response
|
|
38
|
+
def self.build_with: (*untyped strings) -> Response
|
|
39
|
+
def self.build_streams: (untyped component, *untyped strings) -> Response
|
|
40
|
+
def self.build_collection_append: (untyped component, Symbol | String name, untyped model, ?effect: untyped,
|
|
41
|
+
**untyped row_kwargs) -> Response
|
|
42
|
+
def self.build_collection_prepend: (untyped component, Symbol | String name, untyped model, ?effect: untyped,
|
|
43
|
+
**untyped row_kwargs) -> Response
|
|
44
|
+
def self.build_collection_remove: (untyped component, Symbol | String name, untyped model, ?effect: untyped) -> Response
|
|
45
|
+
def self.build_pending: (untyped component, untyped records, collection: untyped, peers: untyped, job: untyped,
|
|
46
|
+
args: untyped, enqueue: untyped) -> Response
|
|
47
|
+
def self.pending_collection!: (Hash[Symbol, untyped] opts) -> untyped
|
|
48
|
+
|
|
49
|
+
# --- stream helpers ---
|
|
50
|
+
def self.render_html: (untyped content) -> String
|
|
51
|
+
def self.update_stream: (String target, untyped content) -> String
|
|
52
|
+
def self.js_stream: (untyped ops, ?target: untyped) -> String
|
|
53
|
+
def self.js_ops_json: (untyped ops) -> String
|
|
54
|
+
def self.dismiss_attr: (Integer? dismiss_after) -> String
|
|
55
|
+
def self.wrap_dismiss: (String html, Integer? dismiss_after) -> String
|
|
56
|
+
|
|
57
|
+
# Removed in issue #182: each raises a guided error naming its `reply` form.
|
|
58
|
+
def self.replace: (*untyped, **untyped) -> bot
|
|
59
|
+
def self.update: (*untyped, **untyped) -> bot
|
|
60
|
+
def self.morph: (*untyped, **untyped) -> bot
|
|
61
|
+
def self.remove: (*untyped, **untyped) -> bot
|
|
62
|
+
def self.redirect: (*untyped, **untyped) -> bot
|
|
63
|
+
def self.with: (*untyped, **untyped) -> bot
|
|
64
|
+
def self.streams: (*untyped, **untyped) -> bot
|
|
65
|
+
def self.collection_append: (*untyped, **untyped) -> bot
|
|
66
|
+
def self.collection_prepend: (*untyped, **untyped) -> bot
|
|
67
|
+
def self.collection_remove: (*untyped, **untyped) -> bot
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
module Phlex
|
|
2
|
+
module Reactive
|
|
3
|
+
# include Phlex::Reactive::Streamable: a stable #id, Turbo Stream builders
|
|
4
|
+
# and broadcasts. Components and models are `untyped` (Phlex and Rails
|
|
5
|
+
# ship no RBS).
|
|
6
|
+
module Streamable
|
|
7
|
+
# The stable DOM id Turbo Streams target (dom_id(record) for a
|
|
8
|
+
# record-backed component; raises NotImplementedError otherwise).
|
|
9
|
+
def id: () -> String
|
|
10
|
+
def dom_id: (untyped record, ?(Symbol | String)? prefix) -> String
|
|
11
|
+
|
|
12
|
+
# --- this instance as a Turbo Stream ---
|
|
13
|
+
def to_stream_replace: (?morph: bool, ?effect: untyped) -> String
|
|
14
|
+
def to_stream_update: (?morph: bool, ?effect: untyped) -> String
|
|
15
|
+
def to_stream_remove: (?effect: untyped) -> String
|
|
16
|
+
def to_stream_token: () -> String
|
|
17
|
+
# Removed in issue #185: raises, naming to_stream_replace(morph: true).
|
|
18
|
+
def to_stream_morph: () -> bot
|
|
19
|
+
|
|
20
|
+
module ClassMethods
|
|
21
|
+
# --- Turbo Streams targeting the component's own id ---
|
|
22
|
+
def replace: (?untyped model, ?morph: bool, ?effect: untyped, **untyped options) -> String
|
|
23
|
+
def update: (?untyped model, ?morph: bool, ?effect: untyped, **untyped options) -> String
|
|
24
|
+
def remove: (?untyped model, ?effect: untyped, **untyped options) -> String
|
|
25
|
+
def append: (target: String, ?model: untyped, ?effect: untyped, **untyped options) -> String
|
|
26
|
+
def prepend: (target: String, ?model: untyped, ?effect: untyped, **untyped options) -> String
|
|
27
|
+
|
|
28
|
+
# --- broadcasts ---
|
|
29
|
+
def broadcast_to: (*untyped streamables, ?morph: bool, ?target: String?, ?exclude: untyped, ?visible_to: untyped,
|
|
30
|
+
?each: untyped, ?effect: untyped, **untyped verb) -> untyped
|
|
31
|
+
def broadcast_collection_to: (*untyped streamables, container: untyped, ?exclude: untyped, ?visible_to: untyped,
|
|
32
|
+
?coalesce: untyped, ?effect: untyped, ?row: untyped, **untyped opts) -> untyped
|
|
33
|
+
|
|
34
|
+
# Removed in issue #185: each raises a guided error naming broadcast_to.
|
|
35
|
+
def broadcast_replace_to: (*untyped, **untyped) -> bot
|
|
36
|
+
def broadcast_update_to: (*untyped, **untyped) -> bot
|
|
37
|
+
def broadcast_append_to: (*untyped, **untyped) -> bot
|
|
38
|
+
def broadcast_prepend_to: (*untyped, **untyped) -> bot
|
|
39
|
+
def broadcast_remove_to: (*untyped, **untyped) -> bot
|
|
40
|
+
def broadcast_js_to: (*untyped, **untyped) -> bot
|
|
41
|
+
def broadcast_replace_to_each: (*untyped, **untyped) -> bot
|
|
42
|
+
def broadcast_update_to_each: (*untyped, **untyped) -> bot
|
|
43
|
+
def broadcast_append_to_each: (*untyped, **untyped) -> bot
|
|
44
|
+
def broadcast_prepend_to_each: (*untyped, **untyped) -> bot
|
|
45
|
+
def broadcast_remove_to_each: (*untyped, **untyped) -> bot
|
|
46
|
+
|
|
47
|
+
# --- rendering ---
|
|
48
|
+
def render_component: (untyped component) -> String
|
|
49
|
+
def model_param_name: () -> Symbol
|
|
50
|
+
def component_args: (untyped model, Hash[Symbol, untyped] options) -> Hash[Symbol, untyped]
|
|
51
|
+
|
|
52
|
+
# --- the per-thread view context and stream builder ---
|
|
53
|
+
def turbo_view_context: () -> untyped
|
|
54
|
+
def turbo_stream_builder: () -> untyped
|
|
55
|
+
def turbo_view_context_generation: () -> Integer?
|
|
56
|
+
def reset_turbo_view_context!: () -> Integer
|
|
57
|
+
|
|
58
|
+
def inherited: (Class subclass) -> void
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# The public configuration and token surface of phlex-reactive
|
|
2
|
+
# (zoolutions/phlex-reactive#364). `bundle exec rbs -I sig validate` checks
|
|
3
|
+
# these files; spec/phlex/rbs_spec.rb fails when a public method has no
|
|
4
|
+
# signature. Rails, Turbo and Phlex objects (a controller class, a view
|
|
5
|
+
# context, an ActiveSupport::MessageVerifier, a component) are `untyped`:
|
|
6
|
+
# those gems ship no RBS of their own.
|
|
7
|
+
module Phlex
|
|
8
|
+
module Reactive
|
|
9
|
+
VERSION: String
|
|
10
|
+
|
|
11
|
+
IDENTITY_PURPOSE: String
|
|
12
|
+
DEFER_PURPOSE: String
|
|
13
|
+
DEFER_TRANSPORTS: Array[Symbol]
|
|
14
|
+
TOKEN_VERSION: Integer
|
|
15
|
+
INSTRUMENTATION_NAMESPACE: String
|
|
16
|
+
SETTING_DEFAULTS: Hash[Symbol, untyped]
|
|
17
|
+
DEFAULT_AUTHORIZATION_METHODS: Array[Symbol]
|
|
18
|
+
CONFIG_READERS: Array[Symbol]
|
|
19
|
+
|
|
20
|
+
class Error < StandardError
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class InvalidToken < Error
|
|
24
|
+
attr_reader diagnostic: Symbol?
|
|
25
|
+
|
|
26
|
+
def initialize: (?String? msg, ?diagnostic: Symbol?) -> void
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class UnknownParamType < ::ArgumentError
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class AuthorizationNotVerified < Error
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class ConfigurationError < Error
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# What a component-aware around_action wrapper sees.
|
|
39
|
+
class ActionContext < ::Data
|
|
40
|
+
attr_reader component: untyped
|
|
41
|
+
attr_reader action_name: Symbol
|
|
42
|
+
attr_reader params: Hash[Symbol, untyped]
|
|
43
|
+
attr_reader request: untyped
|
|
44
|
+
|
|
45
|
+
def self.new: (component: untyped, action_name: Symbol, params: Hash[Symbol, untyped], request: untyped) -> ActionContext
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
type payload = Hash[String, untyped]
|
|
49
|
+
type param_caster = ^(untyped) -> untyped
|
|
50
|
+
# (ctx, &action): returns action.call's value.
|
|
51
|
+
type around_wrapper = ^(ActionContext) { () -> untyped } -> untyped
|
|
52
|
+
type error_hook = ^(Exception, Hash[Symbol, untyped]) -> void
|
|
53
|
+
|
|
54
|
+
# --- settings: written at boot, Ractor-shareable after finalize! ---
|
|
55
|
+
|
|
56
|
+
def self.verifier: () -> untyped
|
|
57
|
+
def self.verifier=: (untyped value) -> void
|
|
58
|
+
|
|
59
|
+
# A controller class, or its name to follow code reloading.
|
|
60
|
+
def self.renderer: () -> Class?
|
|
61
|
+
def self.renderer=: (Class | String | nil value) -> void
|
|
62
|
+
|
|
63
|
+
def self.base_controller_name: () -> String
|
|
64
|
+
def self.base_controller_name=: (String? value) -> void
|
|
65
|
+
def self.base_controller: () -> Class
|
|
66
|
+
|
|
67
|
+
def self.authorization_errors: () -> Array[Class]
|
|
68
|
+
def self.authorization_errors=: (Array[Class] value) -> void
|
|
69
|
+
|
|
70
|
+
def self.importmaps: () -> (^() -> Hash[String, untyped])?
|
|
71
|
+
def self.importmaps=: ((^() -> Hash[String, untyped])? value) -> void
|
|
72
|
+
|
|
73
|
+
def self.action_path: () -> String
|
|
74
|
+
def self.action_path=: (String? value) -> void
|
|
75
|
+
def self.defer_path: () -> String
|
|
76
|
+
def self.defer_path=: (String? value) -> void
|
|
77
|
+
def self.fragment_path: () -> String
|
|
78
|
+
def self.fragment_path=: (String? value) -> void
|
|
79
|
+
def self.flash_target: () -> String
|
|
80
|
+
def self.flash_target=: (String? value) -> void
|
|
81
|
+
def self.defer_job_queue: () -> String
|
|
82
|
+
def self.defer_job_queue=: (String? value) -> void
|
|
83
|
+
|
|
84
|
+
def self.verbose_errors: () -> bool?
|
|
85
|
+
def self.verbose_errors=: (bool? value) -> void
|
|
86
|
+
def self.log_events: () -> bool?
|
|
87
|
+
def self.log_events=: (bool? value) -> void
|
|
88
|
+
def self.debug: () -> bool?
|
|
89
|
+
def self.debug=: (bool? value) -> void
|
|
90
|
+
def self.verify_authorized: () -> bool?
|
|
91
|
+
def self.verify_authorized=: (bool? value) -> void
|
|
92
|
+
def self.authorization_methods: () -> Array[Symbol]
|
|
93
|
+
def self.authorization_methods=: (Array[Symbol] value) -> void
|
|
94
|
+
|
|
95
|
+
# A Symbol naming a built-in adapter, a custom adapter, or nil.
|
|
96
|
+
def self.apm: () -> untyped
|
|
97
|
+
def self.apm=: (untyped value) -> void
|
|
98
|
+
def self.resolved_apm_adapter: () -> untyped
|
|
99
|
+
def self.resolved_apm_adapter=: (untyped value) -> void
|
|
100
|
+
|
|
101
|
+
def self.early_event_ttl_ms: () -> Integer
|
|
102
|
+
def self.early_event_ttl_ms=: (Integer? value) -> void
|
|
103
|
+
def self.defer_token_ttl: () -> Integer
|
|
104
|
+
def self.defer_token_ttl=: (Integer? value) -> void
|
|
105
|
+
def self.fragment_cache_max_age_limit: () -> Integer
|
|
106
|
+
def self.fragment_cache_max_age_limit=: (untyped value) -> void
|
|
107
|
+
def self.defer_transport: () -> Symbol
|
|
108
|
+
def self.defer_transport=: (Symbol | String | nil value) -> void
|
|
109
|
+
def self.settle_coalesce_window_ms: () -> Integer
|
|
110
|
+
def self.settle_coalesce_window_ms=: (Integer? value) -> void
|
|
111
|
+
|
|
112
|
+
def self.effects: () -> Hash[Symbol, String | false]?
|
|
113
|
+
def self.effects=: (bool | Hash[Symbol, untyped] | nil value) -> void
|
|
114
|
+
def self.effects_generation: () -> Integer
|
|
115
|
+
|
|
116
|
+
def self.error_flash: () -> (^(Symbol) -> String?)?
|
|
117
|
+
def self.error_flash=: ((^(Symbol) -> String?)? value) -> void
|
|
118
|
+
def self.flash_component: () -> (^(Symbol, untyped) -> untyped)?
|
|
119
|
+
def self.flash_component=: ((^(Symbol, untyped) -> untyped)? callable) -> void
|
|
120
|
+
|
|
121
|
+
# --- registries ---
|
|
122
|
+
|
|
123
|
+
def self.param_type: (Symbol | String name) { (untyped) -> untyped } -> param_caster
|
|
124
|
+
def self.param_type?: (Symbol | String name) -> bool
|
|
125
|
+
def self.param_types: () -> Hash[Symbol, param_caster?]
|
|
126
|
+
def self.freeze_param_types!: () -> true
|
|
127
|
+
def self.param_types_frozen?: () -> bool
|
|
128
|
+
def self.reset_param_types!: () -> untyped
|
|
129
|
+
|
|
130
|
+
def self.param_schema: (Symbol | String name, ?Hash[untyped, untyped]? schema) -> Hash[Symbol, untyped]
|
|
131
|
+
def self.param_schema?: (Symbol | String name) -> bool
|
|
132
|
+
def self.param_schemas: () -> Hash[Symbol, Hash[Symbol, untyped]]
|
|
133
|
+
def self.freeze_param_schemas!: () -> true
|
|
134
|
+
def self.param_schemas_frozen?: () -> bool
|
|
135
|
+
def self.reset_param_schemas!: () -> untyped
|
|
136
|
+
|
|
137
|
+
# The block also receives the continuation (&action, see around_wrapper);
|
|
138
|
+
# an RBS block type cannot declare a block of its own.
|
|
139
|
+
def self.around_action: () { (ActionContext) -> untyped } -> Array[around_wrapper]
|
|
140
|
+
def self.around_actions: () -> Array[around_wrapper]
|
|
141
|
+
def self.reset_around_actions!: () -> untyped
|
|
142
|
+
|
|
143
|
+
def self.on_action_error: () { (Exception, Hash[Symbol, untyped]) -> void } -> Array[error_hook]
|
|
144
|
+
def self.on_action_error_hooks: () -> Array[error_hook]
|
|
145
|
+
def self.reset_on_action_error!: () -> untyped
|
|
146
|
+
def self.report_error: (Exception error, Hash[Symbol, untyped] context) -> nil
|
|
147
|
+
def self.report_hook: (error_hook hook, Exception error, Hash[Symbol, untyped] context) -> untyped
|
|
148
|
+
|
|
149
|
+
def self.register_token_upgrader: (Integer from_version) { (payload) -> payload } -> ^(payload) -> payload
|
|
150
|
+
def self.token_upgraders: () -> Hash[Integer, ^(payload) -> payload]
|
|
151
|
+
def self.reset_token_upgraders!: () -> untyped
|
|
152
|
+
|
|
153
|
+
# --- boot finalization (zoolutions/phlex-reactive#364) ---
|
|
154
|
+
|
|
155
|
+
def self.finalize!: () -> self
|
|
156
|
+
def self.finalized?: () -> bool
|
|
157
|
+
def self.reset_finalization!: () -> self
|
|
158
|
+
|
|
159
|
+
# --- tokens ---
|
|
160
|
+
|
|
161
|
+
def self.sign: (payload payload) -> String
|
|
162
|
+
def self.verify: (String token) -> payload?
|
|
163
|
+
def self.upgrade_token: (payload payload) -> payload?
|
|
164
|
+
def self.sign_defer: (payload payload, ?unbound: bool) -> String
|
|
165
|
+
def self.verify_defer: (String token) -> payload?
|
|
166
|
+
def self.defer_purpose: () -> String
|
|
167
|
+
def self.sign_fragment: (payload payload) -> String
|
|
168
|
+
def self.verify_fragment: (String id) -> payload?
|
|
169
|
+
|
|
170
|
+
# --- request state (fiber-local) ---
|
|
171
|
+
|
|
172
|
+
def self.current_connection_id: () -> String?
|
|
173
|
+
def self.with_connection_id: [T] (String? connection_id) { () -> T } -> T
|
|
174
|
+
def self.current_url_options: () -> Hash[Symbol, untyped]?
|
|
175
|
+
def self.with_url_options: [T] (Hash[Symbol, untyped]? options) { () -> T } -> T
|
|
176
|
+
def self.url_options_for: (untyped request) -> Hash[Symbol, untyped]
|
|
177
|
+
def self.current_defer_binding: () -> String?
|
|
178
|
+
def self.with_defer_binding: [T] (String? binding) { () -> T } -> T
|
|
179
|
+
def self.defer_binding_for: (untyped request) -> String?
|
|
180
|
+
|
|
181
|
+
# --- rendering and broadcasting ---
|
|
182
|
+
|
|
183
|
+
def self.render: (untyped component) -> String
|
|
184
|
+
def self.request_bound_view_context: (Class controller_class) -> untyped
|
|
185
|
+
def self.off_request_view_context: () -> untyped
|
|
186
|
+
def self.off_request_view_context_generation: () -> Integer
|
|
187
|
+
def self.stream_builder: () -> untyped
|
|
188
|
+
def self.reset_stream_builder!: () -> Integer
|
|
189
|
+
def self.flash_builder: () -> bot
|
|
190
|
+
def self.reset_flash_builder!: () -> bot
|
|
191
|
+
def self.broadcast_to: (*untyped streamables, ?morph: bool, ?target: String?, ?exclude: untyped, ?visible_to: untyped,
|
|
192
|
+
?each: untyped, ?effect: untyped, **untyped verb) -> untyped
|
|
193
|
+
def self.instrument: [T] (String | Symbol event, ?Hash[Symbol, untyped] payload) { (Hash[Symbol, untyped]) -> T } -> T
|
|
194
|
+
|
|
195
|
+
# --- capability gates and route checks ---
|
|
196
|
+
|
|
197
|
+
def self.pgbus?: () -> bool
|
|
198
|
+
def self.pgbus_streams?: () -> bool
|
|
199
|
+
def self.defer_push_capable?: () -> bool
|
|
200
|
+
def self.settle_capable?: () -> bool
|
|
201
|
+
def self.action_route_ok?: (?String path) -> bool
|
|
202
|
+
def self.fragment_route_ok?: (?String path) -> bool
|
|
203
|
+
def self.warn_unless_action_route_mounted!: (?path: String, ?logger: untyped) -> void
|
|
204
|
+
|
|
205
|
+
# Per-Ractor lazy state.
|
|
206
|
+
module Store
|
|
207
|
+
class Table
|
|
208
|
+
def initialize: () -> void
|
|
209
|
+
def fetch: [T] (untyped key) { () -> T } -> T
|
|
210
|
+
def claim?: (untyped key) -> bool
|
|
211
|
+
def clear: () -> void
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
NATIVE: bool
|
|
215
|
+
FALLBACK: Table?
|
|
216
|
+
WARNINGS_KEY: Symbol
|
|
217
|
+
|
|
218
|
+
def self.fetch: [T] (Symbol key) { () -> T } -> T
|
|
219
|
+
def self.table: (Symbol key) -> Table
|
|
220
|
+
def self.first_warning?: (Symbol name) -> bool
|
|
221
|
+
def self.native?: () -> bool
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Ractor-shareable values for the gem's module and class state.
|
|
225
|
+
module Shareable
|
|
226
|
+
def self.share: [T] (T value) -> T
|
|
227
|
+
def self.shareable?: (untyped value) -> bool
|
|
228
|
+
def self.seal_concern: (Module mod) -> Module
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: phlex-reactive
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.16.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mikael Henriksson
|
|
@@ -215,6 +215,7 @@ files:
|
|
|
215
215
|
- lib/phlex/reactive/deferred_render_job.rb
|
|
216
216
|
- lib/phlex/reactive/doctor.rb
|
|
217
217
|
- lib/phlex/reactive/doctor/fiber_isolation.rb
|
|
218
|
+
- lib/phlex/reactive/doctor/ractor_readiness.rb
|
|
218
219
|
- lib/phlex/reactive/dormant.rb
|
|
219
220
|
- lib/phlex/reactive/effects.rb
|
|
220
221
|
- lib/phlex/reactive/engine.rb
|
|
@@ -245,9 +246,11 @@ files:
|
|
|
245
246
|
- lib/phlex/reactive/response.rb
|
|
246
247
|
- lib/phlex/reactive/settle.rb
|
|
247
248
|
- lib/phlex/reactive/settles.rb
|
|
249
|
+
- lib/phlex/reactive/shareable.rb
|
|
248
250
|
- lib/phlex/reactive/shortcut.rb
|
|
249
251
|
- lib/phlex/reactive/show_conditions.rb
|
|
250
252
|
- lib/phlex/reactive/show_conditions/compare_terms.rb
|
|
253
|
+
- lib/phlex/reactive/store.rb
|
|
251
254
|
- lib/phlex/reactive/stream.rb
|
|
252
255
|
- lib/phlex/reactive/streamable.rb
|
|
253
256
|
- lib/phlex/reactive/test_helpers.rb
|
|
@@ -256,6 +259,11 @@ files:
|
|
|
256
259
|
- lib/phlex/reactive/test_helpers/system/reactive_requests_matcher.rb
|
|
257
260
|
- lib/phlex/reactive/version.rb
|
|
258
261
|
- lib/tasks/phlex_reactive.rake
|
|
262
|
+
- sig/phlex/reactive.rbs
|
|
263
|
+
- sig/phlex/reactive/component.rbs
|
|
264
|
+
- sig/phlex/reactive/param_schema.rbs
|
|
265
|
+
- sig/phlex/reactive/response.rbs
|
|
266
|
+
- sig/phlex/reactive/streamable.rbs
|
|
259
267
|
homepage: https://github.com/zoolutions/phlex-reactive
|
|
260
268
|
licenses:
|
|
261
269
|
- MIT
|