interfacets 0.9.9 → 0.99999
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/LICENSE +9 -17
- data/lib/interfacets/client/actor.rb +2 -1
- data/lib/interfacets/client/assets.rb +77 -63
- data/lib/interfacets/client/bus.rb +31 -8
- data/lib/interfacets/client/channels/api.rb +141 -35
- data/lib/interfacets/client/channels/audio.rb +13 -10
- data/lib/interfacets/client/channels/base.rb +2 -2
- data/lib/interfacets/client/channels/pubsub.rb +69 -0
- data/lib/interfacets/client/channels/react/builder.rb +42 -72
- data/lib/interfacets/client/channels/react/channel.rb +7 -5
- data/lib/interfacets/client/channels/react/evaluator.rb +6 -4
- data/lib/interfacets/client/channels/timer.rb +8 -7
- data/lib/interfacets/client/channels/url.rb +39 -6
- data/lib/interfacets/client/registry.rb +10 -70
- data/lib/interfacets/client/slots.rb +45 -0
- data/lib/interfacets/client/system.rb +20 -15
- data/lib/interfacets/client/template.rb +90 -0
- data/lib/interfacets/client/utils/mruby_patches.rb +8 -4
- data/lib/interfacets/client/utils/open_struct.rb +88 -77
- data/lib/interfacets/component_registry.rb +120 -0
- data/lib/interfacets/component_schema_parser.rb +88 -0
- data/lib/interfacets/mruby/build_config.rb +8 -4
- data/lib/interfacets/mruby/entrypoint.rb +2 -2
- data/lib/interfacets/server/api.rb +44 -27
- data/lib/interfacets/server/assets.rb +69 -28
- data/lib/interfacets/server/basic_router.rb +38 -23
- data/lib/interfacets/server/bus.rb +8 -14
- data/lib/interfacets/server/registry.rb +31 -185
- data/lib/interfacets/shared/basic_routable.rb +48 -0
- data/lib/interfacets/shared/entities/bus.rb +623 -177
- data/lib/interfacets/shared/entities/changeset.rb +432 -0
- data/lib/interfacets/shared/entities/collection_proxy.rb +132 -72
- data/lib/interfacets/shared/entities/specs/handlers.rb +74 -37
- data/lib/interfacets/shared/entities/specs.rb +223 -20
- data/lib/interfacets/shared/entity.rb +124 -110
- data/lib/interfacets/shared/entity_dsl.rb +272 -0
- data/lib/interfacets/shared/facet.rb +260 -0
- data/lib/interfacets/shared/generated_store.rb +74 -35
- data/lib/interfacets/shared/refreshable.rb +85 -0
- data/lib/interfacets/shared/utils.rb +36 -32
- data/lib/interfacets/shared/validations.rb +749 -25
- data/lib/interfacets/shared/view.rb +120 -0
- data/lib/interfacets/test/component_registry.rb +82 -0
- data/lib/interfacets/test/js/inline_bus.rb +68 -33
- data/lib/interfacets/test/js/nodo_bus.rb +37 -9
- data/lib/interfacets/test/js/receivers/api.rb +17 -4
- data/lib/interfacets/test/js/receivers/audio.rb +61 -0
- data/lib/interfacets/test/js/receivers/pubsub.rb +50 -0
- data/lib/interfacets/test/js/receivers/react/node/xml_parser.rb +103 -0
- data/lib/interfacets/test/js/receivers/react/node.rb +91 -71
- data/lib/interfacets/test/js/receivers/react.rb +15 -5
- data/lib/interfacets/test/js/receivers/timer.rb +81 -0
- data/lib/interfacets/test/js/receivers/url.rb +51 -10
- data/lib/interfacets/test/standard_elements.yml +173 -0
- data/lib/interfacets/test/ui_simulator.rb +145 -0
- data/lib/interfacets/test/validation_engine.rb +184 -0
- data/lib/interfacets/test.rb +1 -7
- data/lib/interfacets/version.rb +1 -1
- data/lib/interfacets.rb +13 -2
- metadata +51 -37
- data/.rubocop.yml +0 -180
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -10
- data/lib/interfacets/client/channels/page_visibility.rb +0 -21
- data/lib/interfacets/client/channels/react/dom.rb +0 -91
- data/lib/interfacets/client/channels/speech_to_text.rb +0 -100
- data/lib/interfacets/client/config.rb +0 -22
- data/lib/interfacets/client/delegator.rb +0 -37
- data/lib/interfacets/client/facet.rb +0 -26
- data/lib/interfacets/client/facet2.rb +0 -15
- data/lib/interfacets/client/facets/attributes/accessor.rb +0 -28
- data/lib/interfacets/client/facets/attributes/association.rb +0 -50
- data/lib/interfacets/client/facets/attributes/bind.rb +0 -25
- data/lib/interfacets/client/facets/attributes/collection.rb +0 -47
- data/lib/interfacets/client/facets/attributes/readonly.rb +0 -19
- data/lib/interfacets/client/facets/deserializer.rb +0 -30
- data/lib/interfacets/client/facets/schema/deserializer.rb +0 -63
- data/lib/interfacets/client/facets/schema.rb +0 -63
- data/lib/interfacets/client/facets/serializer.rb +0 -18
- data/lib/interfacets/client/view.rb +0 -47
- data/lib/interfacets/server/assets/facet.rb +0 -61
- data/lib/interfacets/server/basic_routable.rb +0 -40
- data/lib/interfacets/server/config.rb +0 -87
- data/lib/interfacets/server/facet.rb +0 -51
- data/lib/interfacets/server/facets/deserializer.rb +0 -25
- data/lib/interfacets/server/facets/schema/serializer.rb +0 -54
- data/lib/interfacets/server/facets/serializer.rb +0 -50
- data/lib/interfacets/shared/entity_collection.rb +0 -88
- data/lib/interfacets/test/browser.rb +0 -63
data/.rubocop.yml
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
AllCops:
|
|
2
|
-
NewCops: enable
|
|
3
|
-
Exclude: [ "bin/*" ]
|
|
4
|
-
|
|
5
|
-
Layout/EmptyLinesAroundAttributeAccessor:
|
|
6
|
-
Enabled: false
|
|
7
|
-
|
|
8
|
-
Layout/MultilineMethodCallBraceLayout:
|
|
9
|
-
Enabled: true
|
|
10
|
-
EnforcedStyle: new_line
|
|
11
|
-
|
|
12
|
-
Layout/MultilineMethodCallIndentation:
|
|
13
|
-
Enabled: true
|
|
14
|
-
EnforcedStyle: indented
|
|
15
|
-
|
|
16
|
-
Layout/MultilineMethodArgumentLineBreaks:
|
|
17
|
-
Enabled: true
|
|
18
|
-
|
|
19
|
-
Layout/MultilineMethodParameterLineBreaks:
|
|
20
|
-
Enabled: true
|
|
21
|
-
|
|
22
|
-
Layout/FirstMethodArgumentLineBreak:
|
|
23
|
-
Enabled: true
|
|
24
|
-
|
|
25
|
-
Layout/FirstMethodParameterLineBreak:
|
|
26
|
-
Enabled: true
|
|
27
|
-
|
|
28
|
-
Style/MethodCallWithArgsParentheses:
|
|
29
|
-
Enabled: true
|
|
30
|
-
|
|
31
|
-
Layout/ArgumentAlignment:
|
|
32
|
-
Enabled: true
|
|
33
|
-
EnforcedStyle: with_fixed_indentation
|
|
34
|
-
|
|
35
|
-
Lint/UnusedMethodArgument:
|
|
36
|
-
Enabled: false
|
|
37
|
-
|
|
38
|
-
Style/NumberedParameters:
|
|
39
|
-
Enabled: false
|
|
40
|
-
|
|
41
|
-
Style/OpenStructUse:
|
|
42
|
-
Enabled: false
|
|
43
|
-
|
|
44
|
-
Lint/EmptyBlock:
|
|
45
|
-
Enabled: false
|
|
46
|
-
|
|
47
|
-
Style/ExponentialNotation:
|
|
48
|
-
Enabled: false
|
|
49
|
-
|
|
50
|
-
Layout/MultilineAssignmentLayout:
|
|
51
|
-
Enabled: true
|
|
52
|
-
EnforcedStyle: new_line
|
|
53
|
-
|
|
54
|
-
Layout/ExtraSpacing:
|
|
55
|
-
Enabled: true
|
|
56
|
-
AllowForAlignment: false
|
|
57
|
-
|
|
58
|
-
Metrics/AbcSize:
|
|
59
|
-
Enabled: false
|
|
60
|
-
|
|
61
|
-
Metrics/BlockLength:
|
|
62
|
-
Enabled: false
|
|
63
|
-
|
|
64
|
-
Metrics/ClassLength:
|
|
65
|
-
Enabled: false
|
|
66
|
-
|
|
67
|
-
Metrics/CyclomaticComplexity:
|
|
68
|
-
Enabled: false
|
|
69
|
-
|
|
70
|
-
Metrics/MethodLength:
|
|
71
|
-
Enabled: false
|
|
72
|
-
|
|
73
|
-
Metrics/ModuleLength:
|
|
74
|
-
Enabled: false
|
|
75
|
-
|
|
76
|
-
Metrics/PerceivedComplexity:
|
|
77
|
-
Enabled: false
|
|
78
|
-
|
|
79
|
-
Naming/MethodParameterName:
|
|
80
|
-
Enabled: false
|
|
81
|
-
|
|
82
|
-
Naming/PredicateName:
|
|
83
|
-
Enabled: false
|
|
84
|
-
|
|
85
|
-
Naming/VariableNumber:
|
|
86
|
-
EnforcedStyle: snake_case
|
|
87
|
-
|
|
88
|
-
Security/Eval:
|
|
89
|
-
Enabled: false
|
|
90
|
-
|
|
91
|
-
Style/Alias:
|
|
92
|
-
Enabled: false
|
|
93
|
-
|
|
94
|
-
Style/BlockDelimiters:
|
|
95
|
-
Enabled: false
|
|
96
|
-
EnforcedStyle: semantic
|
|
97
|
-
|
|
98
|
-
Style/CaseLikeIf:
|
|
99
|
-
Enabled: false
|
|
100
|
-
|
|
101
|
-
Style/CombinableLoops:
|
|
102
|
-
Enabled: false
|
|
103
|
-
|
|
104
|
-
Style/Documentation:
|
|
105
|
-
Enabled: false
|
|
106
|
-
|
|
107
|
-
Style/EmptyLambdaParameter:
|
|
108
|
-
Enabled: false
|
|
109
|
-
|
|
110
|
-
Style/EvenOdd:
|
|
111
|
-
Enabled: false
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
Style/GuardClause:
|
|
115
|
-
Enabled: false
|
|
116
|
-
|
|
117
|
-
Style/IfUnlessModifier:
|
|
118
|
-
Enabled: false
|
|
119
|
-
|
|
120
|
-
Style/Lambda:
|
|
121
|
-
Enabled: false
|
|
122
|
-
|
|
123
|
-
Style/ModuleFunction:
|
|
124
|
-
Enabled: false
|
|
125
|
-
|
|
126
|
-
Style/MultilineBlockChain:
|
|
127
|
-
Enabled: false
|
|
128
|
-
|
|
129
|
-
Style/MultilineMemoization:
|
|
130
|
-
Enabled: true
|
|
131
|
-
EnforcedStyle: braces
|
|
132
|
-
|
|
133
|
-
Style/ParenthesesAroundCondition:
|
|
134
|
-
Enabled: true
|
|
135
|
-
AllowInMultilineConditions: true
|
|
136
|
-
|
|
137
|
-
Style/RaiseArgs:
|
|
138
|
-
Enabled: true
|
|
139
|
-
EnforcedStyle: compact
|
|
140
|
-
|
|
141
|
-
Style/RedundantParentheses:
|
|
142
|
-
Enabled: false
|
|
143
|
-
|
|
144
|
-
Style/RedundantSelf:
|
|
145
|
-
Enabled: false
|
|
146
|
-
|
|
147
|
-
Style/StringLiterals:
|
|
148
|
-
Enabled: true
|
|
149
|
-
EnforcedStyle: double_quotes
|
|
150
|
-
|
|
151
|
-
Style/StringLiteralsInInterpolation:
|
|
152
|
-
Enabled: true
|
|
153
|
-
EnforcedStyle: double_quotes
|
|
154
|
-
|
|
155
|
-
Style/SymbolArray:
|
|
156
|
-
Enabled: true
|
|
157
|
-
EnforcedStyle: brackets
|
|
158
|
-
|
|
159
|
-
Style/TrailingCommaInArguments:
|
|
160
|
-
Enabled: true
|
|
161
|
-
EnforcedStyleForMultiline: consistent_comma
|
|
162
|
-
|
|
163
|
-
Style/TrailingCommaInArrayLiteral:
|
|
164
|
-
Enabled: true
|
|
165
|
-
EnforcedStyleForMultiline: consistent_comma
|
|
166
|
-
|
|
167
|
-
Style/TrailingCommaInHashLiteral:
|
|
168
|
-
Enabled: true
|
|
169
|
-
EnforcedStyleForMultiline: consistent_comma
|
|
170
|
-
|
|
171
|
-
Style/WordArray:
|
|
172
|
-
Enabled: true
|
|
173
|
-
EnforcedStyle: brackets
|
|
174
|
-
|
|
175
|
-
Layout/LineLength:
|
|
176
|
-
Max: 100
|
|
177
|
-
AllowedPatterns: ['^(\s*#)']
|
|
178
|
-
|
|
179
|
-
Style/DocumentDynamicEvalDefinition:
|
|
180
|
-
Enabled: false
|
data/LICENSE.txt
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Pete Kinnecom
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interfacets
|
|
4
|
-
module Client
|
|
5
|
-
module Channels
|
|
6
|
-
class PageVisibility
|
|
7
|
-
include Channels::Base
|
|
8
|
-
|
|
9
|
-
type("interfacets:page-visibility")
|
|
10
|
-
|
|
11
|
-
def configure(facet:); end
|
|
12
|
-
|
|
13
|
-
def handle(facet:, event:)
|
|
14
|
-
facet.visibility_change(event.dig("payload", "state"))
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def render(_facet); end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interfacets
|
|
4
|
-
module Client
|
|
5
|
-
module Channels
|
|
6
|
-
module React
|
|
7
|
-
class Dom
|
|
8
|
-
attr_accessor :children, :handlers, :facet
|
|
9
|
-
|
|
10
|
-
def initialize(facet:)
|
|
11
|
-
@children = []
|
|
12
|
-
@portals = []
|
|
13
|
-
@handlers = {}
|
|
14
|
-
@facet = facet
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def reset
|
|
18
|
-
@children = []
|
|
19
|
-
@portals = []
|
|
20
|
-
@handlers = {}
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def handle(facet:, payload:)
|
|
24
|
-
handler_id = payload.fetch("id")
|
|
25
|
-
handler = handlers.fetch(handler_id)
|
|
26
|
-
callback = handler.fetch(:callback)
|
|
27
|
-
og_facet = handler.fetch(:facet)
|
|
28
|
-
|
|
29
|
-
Evaluator.call(og_facet, callback, payload["event"])
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def register_handler(id:, callback:, facet:)
|
|
33
|
-
@handlers[id] = { facet:, callback: }
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
type: "interfacets:react-dom:memoized-action",
|
|
37
|
-
payload: { id: },
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def string_node(str)
|
|
43
|
-
@children << {
|
|
44
|
-
type: "interfacets:string-node",
|
|
45
|
-
attributes: { value: str },
|
|
46
|
-
}
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def call(type, str = nil, **attrs)
|
|
50
|
-
raise("cannot pass both a block and a string") if str && block_given?
|
|
51
|
-
raise if type == :facet
|
|
52
|
-
|
|
53
|
-
new_element = {
|
|
54
|
-
type:,
|
|
55
|
-
children: [],
|
|
56
|
-
attributes: (
|
|
57
|
-
attrs.transform_values { |value|
|
|
58
|
-
if value.is_a?(Proc)
|
|
59
|
-
register_handler(
|
|
60
|
-
id: value.object_id.to_s,
|
|
61
|
-
callback: value,
|
|
62
|
-
facet:,
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
{
|
|
66
|
-
type: "interfacets:react-dom:action",
|
|
67
|
-
payload: { id: value.object_id.to_s },
|
|
68
|
-
}
|
|
69
|
-
else
|
|
70
|
-
value
|
|
71
|
-
end
|
|
72
|
-
}
|
|
73
|
-
),
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if block_given? || str
|
|
77
|
-
# recurse
|
|
78
|
-
original_children = @children
|
|
79
|
-
@children = new_element[:children]
|
|
80
|
-
yield if block_given?
|
|
81
|
-
string_node(str) if str
|
|
82
|
-
@children = original_children
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
@children << new_element
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
end
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interfacets
|
|
4
|
-
module Client
|
|
5
|
-
module Channels
|
|
6
|
-
class SpeechToText
|
|
7
|
-
include Channels::Base
|
|
8
|
-
|
|
9
|
-
type("speechToText")
|
|
10
|
-
|
|
11
|
-
class Builder
|
|
12
|
-
attr_accessor :facet
|
|
13
|
-
attr_accessor :entity
|
|
14
|
-
|
|
15
|
-
def initialize
|
|
16
|
-
@event = {}
|
|
17
|
-
@callbacks = {}
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def flush_event
|
|
21
|
-
@event.tap { @event = {} }
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def record(
|
|
25
|
-
on_done: ->(*, **) {},
|
|
26
|
-
on_progress: ->(*,**) {},
|
|
27
|
-
on_submit: ->(*, **) {}
|
|
28
|
-
)
|
|
29
|
-
id = SecureRandom.uuid
|
|
30
|
-
@event = {
|
|
31
|
-
id:,
|
|
32
|
-
type: "record",
|
|
33
|
-
}
|
|
34
|
-
@callbacks[id] = {
|
|
35
|
-
on_progress:,
|
|
36
|
-
on_done:,
|
|
37
|
-
on_submit:,
|
|
38
|
-
}
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def callbacks
|
|
42
|
-
@callbacks ||= {}
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def event
|
|
46
|
-
@event ||= {}
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
attr_reader :helper
|
|
51
|
-
|
|
52
|
-
def prepare(entity)
|
|
53
|
-
@builder ||= Builder.new
|
|
54
|
-
@builder.entity = entity
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def builder(stream = "default")
|
|
58
|
-
@builder
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def handle(event:, entity:, **)
|
|
62
|
-
callback_id = event.dig("payload", "id")
|
|
63
|
-
|
|
64
|
-
case event.fetch("type")
|
|
65
|
-
when "text-result"
|
|
66
|
-
builder
|
|
67
|
-
.callbacks
|
|
68
|
-
.delete(callback_id)
|
|
69
|
-
.fetch(:on_done)
|
|
70
|
-
.then do
|
|
71
|
-
entity.instance_exec(event.dig("payload", "text"), &_1)
|
|
72
|
-
end
|
|
73
|
-
when "text-progress"
|
|
74
|
-
builder
|
|
75
|
-
.callbacks
|
|
76
|
-
.fetch(callback_id)
|
|
77
|
-
.fetch(:on_progress)
|
|
78
|
-
.then do
|
|
79
|
-
entity.instance_exec(event.dig("payload", "text"), &_1)
|
|
80
|
-
end
|
|
81
|
-
when "text-submit"
|
|
82
|
-
builder
|
|
83
|
-
.callbacks
|
|
84
|
-
.fetch(callback_id)
|
|
85
|
-
.fetch(:on_submit)
|
|
86
|
-
.then do
|
|
87
|
-
entity.instance_exec(event.dig("payload", "text"), &_1)
|
|
88
|
-
end
|
|
89
|
-
else
|
|
90
|
-
raise "unknown event type: #{event.inspect}"
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def result
|
|
95
|
-
{ streams: { default: @builder.flush_event } }
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interfacets
|
|
4
|
-
module Client
|
|
5
|
-
class Config
|
|
6
|
-
attr_accessor(
|
|
7
|
-
:mount_point,
|
|
8
|
-
:root_url
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
def url_for(path:)
|
|
12
|
-
[
|
|
13
|
-
root_url,
|
|
14
|
-
mount_point,
|
|
15
|
-
path,
|
|
16
|
-
]
|
|
17
|
-
.map { _1.sub(%r{/$}, "").sub(%r{^/}, "") }
|
|
18
|
-
.join("/")
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interfacets
|
|
4
|
-
module Client
|
|
5
|
-
# alias: CrappyDelegator
|
|
6
|
-
class Delegator
|
|
7
|
-
def initialize(obj)
|
|
8
|
-
@__obj__ = obj
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def __getobj__
|
|
12
|
-
@__obj__
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def respond_to_missing?(...)
|
|
16
|
-
@__obj__.send(:respond_to_missing?, ...)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def method_missing(method, *a, **p, &)
|
|
20
|
-
@__obj__.send(method, *a, **p, &)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# delegation helpers
|
|
24
|
-
def inspect
|
|
25
|
-
[self.class.name, __getobj__.inspect].join(" -> ")
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def to_s
|
|
29
|
-
inspect
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def presence
|
|
33
|
-
self
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interfacets
|
|
4
|
-
module Client
|
|
5
|
-
class Facet
|
|
6
|
-
class << self
|
|
7
|
-
attr_accessor(
|
|
8
|
-
:shared,
|
|
9
|
-
:entity,
|
|
10
|
-
:view,
|
|
11
|
-
:store,
|
|
12
|
-
)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
attr_reader :entity, :view
|
|
16
|
-
def initialize(entity)
|
|
17
|
-
@entity = entity
|
|
18
|
-
@view = self.class.view.new
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def render(channels)
|
|
22
|
-
view.render(entity:, channels:)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interfacets
|
|
4
|
-
module Client
|
|
5
|
-
module Facets
|
|
6
|
-
module Attributes
|
|
7
|
-
class Accessor
|
|
8
|
-
attr_reader :send_if
|
|
9
|
-
def initialize(send_if:)
|
|
10
|
-
@send_if = send_if
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def coerce(val, **)
|
|
14
|
-
val
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def serialize(val)
|
|
18
|
-
val
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def should_send?(facet)
|
|
22
|
-
facet.instance_exec(&send_if)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interfacets
|
|
4
|
-
module Client
|
|
5
|
-
module Facets
|
|
6
|
-
module Attributes
|
|
7
|
-
class Association
|
|
8
|
-
attr_reader :nested, :anonymous, :config, :bind_map
|
|
9
|
-
|
|
10
|
-
def initialize(nested:, anonymous:, config:, bind_map:)
|
|
11
|
-
@nested = nested
|
|
12
|
-
@anonymous = anonymous
|
|
13
|
-
@config = config
|
|
14
|
-
@bind_map = bind_map
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def coerce(val, parent:)
|
|
18
|
-
return if val.nil?
|
|
19
|
-
|
|
20
|
-
facet.build(
|
|
21
|
-
attrs: val,
|
|
22
|
-
binds: bind_map.transform_values { |v| Bind.new(name: v, facet: parent) },
|
|
23
|
-
)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def build(attrs:, parent:)
|
|
27
|
-
facet.build(
|
|
28
|
-
attrs:,
|
|
29
|
-
binds: bind_map.transform_values { |v| Bind.new(name: v, facet: parent) },
|
|
30
|
-
)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def serialize(val)
|
|
34
|
-
val&.serialize
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def facet
|
|
38
|
-
@facet ||= (
|
|
39
|
-
if anonymous
|
|
40
|
-
@nested
|
|
41
|
-
else
|
|
42
|
-
config.schema(@nested.fetch("name"))
|
|
43
|
-
end
|
|
44
|
-
)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interfacets
|
|
4
|
-
module Client
|
|
5
|
-
module Facets
|
|
6
|
-
module Attributes
|
|
7
|
-
class Bind
|
|
8
|
-
attr_reader :name, :facet
|
|
9
|
-
def initialize(name:, facet:)
|
|
10
|
-
@name = name
|
|
11
|
-
@facet = facet
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def get
|
|
15
|
-
facet.public_send(name)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def set(v)
|
|
19
|
-
facet.public_send("#{name}=", v)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interfacets
|
|
4
|
-
module Client
|
|
5
|
-
module Facets
|
|
6
|
-
module Attributes
|
|
7
|
-
class Collection
|
|
8
|
-
attr_reader :nested, :anonymous, :config, :bind_map
|
|
9
|
-
|
|
10
|
-
def initialize(nested:, anonymous:, config:, bind_map:)
|
|
11
|
-
@nested = nested
|
|
12
|
-
@anonymous = anonymous
|
|
13
|
-
@config = config
|
|
14
|
-
@bind_map = bind_map
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def coerce(val, parent:)
|
|
18
|
-
return [] if val.nil?
|
|
19
|
-
|
|
20
|
-
val.map { build(attrs: _1, parent:) }
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def build(attrs:, parent:)
|
|
24
|
-
facet.build(
|
|
25
|
-
attrs:,
|
|
26
|
-
binds: bind_map.transform_values { |v| Bind.new(name: v, facet: parent) },
|
|
27
|
-
)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def serialize(val)
|
|
31
|
-
val.map(&:serialize)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def facet
|
|
35
|
-
@facet ||= (
|
|
36
|
-
if anonymous
|
|
37
|
-
@nested
|
|
38
|
-
else
|
|
39
|
-
config.schema(@nested.fetch("name"))
|
|
40
|
-
end
|
|
41
|
-
)
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|