interfacets 0.9.9 → 0.9.99
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/.tmp +5 -0
- data/Rakefile +4 -0
- data/lib/interfacets/client/assets.rb +1 -0
- data/lib/interfacets/client/bus.rb +5 -1
- data/lib/interfacets/client/channels/api.rb +10 -3
- data/lib/interfacets/client/registry.rb +9 -70
- data/lib/interfacets/client/utils/mruby_patches.rb +1 -1
- data/lib/interfacets/client/utils/open_struct.rb +90 -77
- data/lib/interfacets/component_registry.rb +115 -0
- data/lib/interfacets/component_schema_parser.rb +84 -0
- data/lib/interfacets/server/api.rb +5 -25
- data/lib/interfacets/server/assets/facet.rb +5 -3
- data/lib/interfacets/server/assets.rb +13 -7
- data/lib/interfacets/server/basic_router.rb +15 -10
- data/lib/interfacets/server/bus.rb +4 -9
- data/lib/interfacets/server/config.rb +1 -1
- data/lib/interfacets/server/registry.rb +23 -184
- data/lib/interfacets/shared/basic_routable.rb +45 -0
- data/lib/interfacets/shared/entities/bus.rb +41 -29
- data/lib/interfacets/shared/entities/specs/handlers.rb +16 -0
- data/lib/interfacets/shared/entities/specs.rb +46 -9
- data/lib/interfacets/shared/entity.rb +23 -99
- data/lib/interfacets/shared/entity_dsl.rb +154 -0
- data/lib/interfacets/shared/facet.rb +200 -0
- data/lib/interfacets/shared/generated_store.rb +6 -2
- data/lib/interfacets/shared/utils.rb +1 -1
- data/lib/interfacets/shared/validations.rb +5 -1
- data/lib/interfacets/{client → shared}/view.rb +33 -6
- data/lib/interfacets/test/component_registry.rb +63 -0
- data/lib/interfacets/test/js/inline_bus.rb +21 -12
- data/lib/interfacets/test/js/nodo_bus.rb +18 -1
- data/lib/interfacets/test/js/receivers/api.rb +14 -3
- data/lib/interfacets/test/js/receivers/react/node/xml_parser.rb +75 -0
- data/lib/interfacets/test/js/receivers/react/node.rb +29 -63
- data/lib/interfacets/test/js/receivers/react.rb +4 -3
- data/lib/interfacets/test/js/receivers/timer.rb +77 -0
- data/lib/interfacets/test/js/receivers/url.rb +5 -0
- data/lib/interfacets/test/standard_elements.yml +173 -0
- data/lib/interfacets/test/{browser.rb → ui_simulator.rb} +18 -6
- data/lib/interfacets/test/validation_engine.rb +151 -0
- data/lib/interfacets/test.rb +0 -4
- data/lib/interfacets/version.rb +1 -1
- data/lib/interfacets.rb +3 -0
- metadata +29 -18
- 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/server/basic_routable.rb +0 -40
- data/lib/interfacets/server/facet.rb +0 -51
- data/lib/interfacets/shared/entity_collection.rb +0 -88
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interfacets
|
|
4
|
-
module Server
|
|
5
|
-
module BasicRoutable
|
|
6
|
-
extend ActiveSupport::Concern
|
|
7
|
-
|
|
8
|
-
included do
|
|
9
|
-
attach(self)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class_methods do
|
|
14
|
-
def attach(mod)
|
|
15
|
-
mod.shared do
|
|
16
|
-
accessor(:api_path, accepted_by: :client)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
mod.server do
|
|
20
|
-
attr_accessor :api_path
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def inherited(mod)
|
|
25
|
-
attach(mod)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
attr_accessor :bus
|
|
29
|
-
def find(&block)
|
|
30
|
-
@find = block if block_given?
|
|
31
|
-
@find
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def build(klass, store)
|
|
35
|
-
bus.registry.build(klass, store)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require "active_support/concern"
|
|
3
|
-
|
|
4
|
-
module Interfacets
|
|
5
|
-
module Server
|
|
6
|
-
module Facet
|
|
7
|
-
extend ActiveSupport::Concern
|
|
8
|
-
|
|
9
|
-
class Actor
|
|
10
|
-
def initialize(entity:, facet:)
|
|
11
|
-
@entity = entity
|
|
12
|
-
@facet = facet
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
class_methods do
|
|
17
|
-
def view(&block)
|
|
18
|
-
views << block
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def views
|
|
22
|
-
@views ||= []
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def client(&block)
|
|
26
|
-
clients << block
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def clients
|
|
30
|
-
@clients ||= []
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def shared(&block)
|
|
34
|
-
shareds << block
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def shareds
|
|
38
|
-
@shareds ||= []
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def server(&block)
|
|
42
|
-
servers << block
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def servers
|
|
46
|
-
@servers ||= []
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Interfacets
|
|
4
|
-
module Shared
|
|
5
|
-
class EntityCollection
|
|
6
|
-
include Enumerable
|
|
7
|
-
|
|
8
|
-
attr_reader :items
|
|
9
|
-
def initialize(items, &block)
|
|
10
|
-
@items = items || []
|
|
11
|
-
@wrap = block
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def each(&)
|
|
15
|
-
@items.each do |item|
|
|
16
|
-
yield(@wrap.call(item))
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def to_a
|
|
21
|
-
@items.map { @wrap.call(_1) }
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def size
|
|
25
|
-
@items.size
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def length
|
|
29
|
-
@items.length
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def empty?
|
|
33
|
-
@items.empty?
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def include?(item)
|
|
37
|
-
@items.include?(to_record(item))
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def [](index)
|
|
41
|
-
item = @items[index]
|
|
42
|
-
item ? @wrap.call(item) : nil
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def first
|
|
46
|
-
item = @items.first
|
|
47
|
-
item ? @wrap.call(item) : nil
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def last
|
|
51
|
-
item = @items.last
|
|
52
|
-
item ? @wrap.call(item) : nil
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def <<(item_to_add)
|
|
56
|
-
@items << to_record(item_to_add)
|
|
57
|
-
self
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def push(*items_to_add)
|
|
61
|
-
@items.push(*items_to_add.map { to_record(_1) })
|
|
62
|
-
self
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def delete(item)
|
|
66
|
-
@items.delete(to_record(item))
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def delete_at(index)
|
|
70
|
-
@items.delete_at(index)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def original
|
|
74
|
-
@items
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def inspect
|
|
78
|
-
"#<#{self.class.name} decorating=#{@items.inspect} with=#{@entity_class}>"
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
private
|
|
82
|
-
|
|
83
|
-
def to_record(item)
|
|
84
|
-
item.is_a?(Entity) ? item.record : item
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|