isomorfeus-data 1.0.0.zeta11 → 1.0.0.zeta12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd049fd338445d10e197978101c5a05f02a30640666e4096bebbe75fc18d28df
4
- data.tar.gz: d34b607a5f86824905a11b9283102db0698091eb8ecf028e57d9e0fcee78dac0
3
+ metadata.gz: 6e5ee58b1f8f38aef39dbcdf8a8d19449a6dc2935355568f5e09bd2cc8e667be
4
+ data.tar.gz: 3eaa2d3558298f3b82e0dec47076a0662353e8fb679f6fd56979f6db91ff24c2
5
5
  SHA512:
6
- metadata.gz: 45ca03236e53607fb90bc7ddef14f614a01db6bc43afae81a25da3f5283cdbfa182d7400608ca7a80267cb648ec461776a2104b882af86b8c14a21f77711bcd5
7
- data.tar.gz: 9120881d8116d9ded40da8228fd3da9d8f28c552282f509ef9a8fd934ea9c6cf3addb4acffc046823f323e7cb8a071be14d045fbf5a27ccd8f3d97821d851075
6
+ metadata.gz: bc4f6bcce18fcaf860603bdc6d1e454883a681d8db6b1a543ec36de56b797a6c658ab42c607e06ae67643b4b6544abc226488de56cdd1f42ac6ee6b68ea0af4a
7
+ data.tar.gz: d295afbea8c6223cd4c38a62f3f19630a869e02165eb6e1ee26dee38b3535609db3e938b4d5d036bad7eded951e47a9d59c9c57175ee37803d546f5793115231
data/README.md CHANGED
@@ -20,20 +20,20 @@ Data must then be shaped (usually in to a Hash or Array) to fit the Isomorfeus D
20
20
 
21
21
  ### Core Concepts and Common API
22
22
 
23
- - [Core Concepts](https://github.com/isomorfeus/isomorfeus-framework/blob/master/ruby/isomorfeus-data/docs/concepts.md)
24
- - [Common API](https://github.com/isomorfeus/isomorfeus-framework/blob/master/ruby/isomorfeus-data/docs/common_api.md)
23
+ - [Core Concepts](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-data/docs/concepts.md)
24
+ - [Common API](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-data/docs/common_api.md)
25
25
 
26
26
  ### Available Classes
27
27
 
28
28
  All classes follow the common principles and the common API above.
29
29
 
30
- - [LucidData::Array](https://github.com/isomorfeus/isomorfeus-framework/blob/master/ruby/isomorfeus-data/docs/data_array.md) - A array, easily accessible on client and server
31
- - [LucidData::Collections](https://github.com/isomorfeus/isomorfeus-framework/blob/master/ruby/isomorfeus-data/docs/data_collection.md) - A collection of LucidData::Node or LucidData::Vertex or LucidData::Document objects
32
- - [LucidData::Composition](https://github.com/isomorfeus/isomorfeus-framework/blob/master/ruby/isomorfeus-data/docs/data_composition.md) - A composition of any of those other classes, even graphs, for easy, one request access to arbitrary data
33
- - [LucidData::Document, LucidData::Node, LucidData::Vertex](https://github.com/isomorfeus/isomorfeus-framework/blob/master/ruby/isomorfeus-data/docs/data_node.md) - A node/document/vertex, can be used stand alone, in a collection or in a graph
34
- - [LucidData::Edge, LucidData::Link](https://github.com/isomorfeus/isomorfeus-framework/blob/master/ruby/isomorfeus-data/docs/data_edge.md) - A edge/link, can be used standalone, in a collection or in a graph
35
- - [LucidData::EdgeCollection, LucidData::LinkCollection](https://github.com/isomorfeus/isomorfeus-framework/blob/master/ruby/isomorfeus-data/docs/data_edge_collection.md) - A collection of LucidData::Edge or LucidData::Link objects
36
- - [LucidData::Graph](https://github.com/isomorfeus/isomorfeus-framework/blob/master/ruby/isomorfeus-data/docs/data_graph.md) - A graph, which can be build from several LucidData::Collection objects and LucidData::EdgeCollection objects
37
- - [LucidData::Hash](https://github.com/isomorfeus/isomorfeus-framework/blob/master/ruby/isomorfeus-data/docs/data_hash.md) - A hash, easily accessible on client and server
30
+ - [LucidData::Array](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-data/docs/data_array.md) - A array, easily accessible on client and server
31
+ - [LucidData::Collections](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-data/docs/data_collection.md) - A collection of LucidData::Node or LucidData::Vertex or LucidData::Document objects
32
+ - [LucidData::Composition](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-data/docs/data_composition.md) - A composition of any of those other classes, even graphs, for easy, one request access to arbitrary data
33
+ - [LucidData::Document, LucidData::Node, LucidData::Vertex](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-data/docs/data_node.md) - A node/document/vertex, can be used stand alone, in a collection or in a graph
34
+ - [LucidData::Edge, LucidData::Link](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-data/docs/data_edge.md) - A edge/link, can be used standalone, in a collection or in a graph
35
+ - [LucidData::EdgeCollection, LucidData::LinkCollection](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-data/docs/data_edge_collection.md) - A collection of LucidData::Edge or LucidData::Link objects
36
+ - [LucidData::Graph](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-data/docs/data_graph.md) - A graph, which can be build from several LucidData::Collection objects and LucidData::EdgeCollection objects
37
+ - [LucidData::Hash](https://github.com/isomorfeus/isomorfeus-project/blob/master/ruby/isomorfeus-data/docs/data_hash.md) - A hash, easily accessible on client and server
38
38
 
39
39
  (more to come soon)
@@ -45,11 +45,16 @@ else
45
45
  require 'isomorfeus_data/lucid_data/composition/mixin'
46
46
  require 'isomorfeus_data/lucid_data/composition/base'
47
47
 
48
+ require 'isomorfeus_data/lucid_data/generic_collection'
49
+ require 'isomorfeus_data/lucid_data/generic_edge'
50
+ require 'isomorfeus_data/lucid_data/generic_edge_collection'
51
+ require 'isomorfeus_data/lucid_data/generic_node'
52
+
48
53
  require 'isomorfeus/data/handler/generic'
49
54
 
50
55
  Opal.append_path(__dir__.untaint) unless Opal.paths.include?(__dir__.untaint)
51
56
 
52
- path = File.expand_path(File.join('isomorfeus', 'data'))
57
+ path = File.expand_path(File.join('app', 'data'))
53
58
 
54
59
  Isomorfeus.zeitwerk.push_dir(path)
55
60
  end
@@ -65,6 +65,31 @@ module Isomorfeus
65
65
  end
66
66
  end
67
67
 
68
+ def validate_attributes_function
69
+ %x{
70
+ if (typeof self.validate_attributes_function === 'undefined') {
71
+ self.validate_attributes_function = function(attributes_object) {
72
+ try { self.$_validate_attributes(Opal.Hash.$new(attributes_object)) }
73
+ catch (e) { return e.message; }
74
+ }
75
+ }
76
+ return self.validate_attributes_function;
77
+ }
78
+ end
79
+
80
+ def validate_attribute_function(attr)
81
+ function_name = "validate_attribute_#{attr}_function"
82
+ %x{
83
+ if (typeof self[function_name] === 'undefined') {
84
+ self[function_name] = function(value) {
85
+ try { self.$_validate_attribute(attribute, value); }
86
+ catch (e) { return e.message; }
87
+ }
88
+ }
89
+ return self[function_name];
90
+ }
91
+ end
92
+
68
93
  def _get_attribute(name)
69
94
  return @_changed_attributes[name] if @_changed_attributes.key?(name)
70
95
  path = @_store_path + [name]
@@ -95,7 +95,7 @@ module Isomorfeus
95
95
  end
96
96
 
97
97
  def arango_configured?
98
- !!(Isomorfeus.arango_production && Isomorfeus.arango_development && Isomorfeus.arango_test)
98
+ (defined? ::Arango) && !!(Isomorfeus.arango_production && Isomorfeus.arango_development && Isomorfeus.arango_test)
99
99
  end
100
100
 
101
101
  attr_accessor :arango_production
@@ -32,11 +32,7 @@ module Isomorfeus
32
32
  response_agent.error = { error: 'Access denied!' }
33
33
  end
34
34
  rescue Exception => e
35
- response_agent.error = if Isomorfeus.production?
36
- { error: { type_class_name => 'No such thing!' }}
37
- else
38
- { error: { type_class_name => "Isomorfeus::Data::Handler::Generic: #{e.message}" }}
39
- end
35
+ response_agent.error = { error: { type_class_name => "Isomorfeus::Data::Handler::Arango: #{e.message}" }}
40
36
  end
41
37
  else
42
38
  response_agent.error = { error: { type_class_name => 'No such thing!' }}
@@ -35,9 +35,7 @@ module Isomorfeus
35
35
  end
36
36
  end
37
37
  rescue Exception => e
38
- response_agent.error = if Isomorfeus.production? then { error: 'No such thing!' }
39
- else { error: "Isomorfeus::Data::Handler::Generic: #{e.message}\n#{e.backtrace.join("\n")}" }
40
- end
38
+ response_agent.error = { error: "Isomorfeus::Data::Handler::Generic: #{e.message}\n#{e.backtrace.join("\n")}" }
41
39
  end
42
40
 
43
41
  def process_load(pub_sub_client, current_user, response_agent, type_class, type_class_name)
@@ -25,11 +25,7 @@ module Isomorfeus
25
25
  response_agent.error = { error: 'Access denied!' }
26
26
  end
27
27
  rescue Exception => e
28
- response_agent.error = if Isomorfeus.production?
29
- { error: { array_class_name => 'No such thing!' }}
30
- else
31
- { error: { array_class_name => "Isomorfeus::Data::Handler::ArrayLoadHandler: #{e.message}" }}
32
- end
28
+ response_agent.error = { error: { array_class_name => "Isomorfeus::Data::Handler::ObjectCall: #{e.message}" }}
33
29
  end
34
30
  else
35
31
  response_agent.error = { error: { array_class_name => 'No such thing!' }}
@@ -25,11 +25,7 @@ module Isomorfeus
25
25
  response_agent.error = { error: 'Access denied!' }
26
26
  end
27
27
  rescue Exception => e
28
- response_agent.error = if Isomorfeus.production?
29
- { error: { array_class_name => 'No such thing!' }}
30
- else
31
- { error: { array_class_name => "Isomorfeus::Data::Handler::ArrayLoadHandler: #{e.message}" }}
32
- end
28
+ response_agent.error = { error: { array_class_name => "Isomorfeus::Data::Handler::Object: #{e.message}" }}
33
29
  end
34
30
  else
35
31
  response_agent.error = { error: { array_class_name => 'No such thing!' }}
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Data
3
- VERSION = '1.0.0.zeta11'
3
+ VERSION = '1.0.0.zeta12'
4
4
  end
5
5
  end
@@ -73,7 +73,7 @@ module LucidData
73
73
  hash = { 'attributes' => _get_selected_attributes, 'parts' => {} }
74
74
  hash.merge!('revision' => revision) if revision
75
75
  parts.each do |name, instance|
76
- hash['parts'][name.to_s] = instance.to_sid
76
+ hash['parts'][name.to_s] = instance.to_sid if instance
77
77
  end
78
78
  { @class_name => { @key => hash }}
79
79
  end
@@ -81,8 +81,10 @@ module LucidData
81
81
  def included_items_to_transport
82
82
  hash = {}
83
83
  parts.each_value do |instance|
84
- hash.deep_merge!(instance.to_transport)
85
- hash.deep_merge!(instance.included_items_to_transport) if instance.respond_to?(:included_items_to_transport)
84
+ if instance
85
+ hash.deep_merge!(instance.to_transport)
86
+ hash.deep_merge!(instance.included_items_to_transport) if instance.respond_to?(:included_items_to_transport)
87
+ end
86
88
  end
87
89
  hash
88
90
  end
@@ -0,0 +1,4 @@
1
+ module LucidData
2
+ class GenericCollection < LucidData::Collection::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LucidData
2
+ class GenericEdge < LucidData::Edge::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LucidData
2
+ class GenericEdgeCollection < LucidData::EdgeCollection::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LucidData
2
+ class GenericNode < LucidData::Node::Base
3
+ end
4
+ end
@@ -216,8 +216,12 @@ module LucidData
216
216
 
217
217
  def to_transport
218
218
  hash = { 'attributes' => _get_selected_attributes, 'nodes' => {}, 'edges' => {} }
219
- node_collections.each { |name, collection| hash['nodes'][name.to_s] = collection.to_sid }
220
- edge_collections.each { |name, collection| hash['edges'][name.to_s] = collection.to_sid }
219
+ node_collections.each do |name, collection|
220
+ hash['nodes'][name.to_s] = collection.to_sid if collection
221
+ end
222
+ edge_collections.each do |name, collection|
223
+ hash['edges'][name.to_s] = collection.to_sid if collection
224
+ end
221
225
  hash.merge!('revision' => revision) if revision
222
226
  { @class_name => { @key => hash }}
223
227
  end
@@ -225,12 +229,16 @@ module LucidData
225
229
  def included_items_to_transport
226
230
  hash = {}
227
231
  node_collections.each_value do |collection|
228
- hash.deep_merge!(collection.to_transport)
229
- hash.deep_merge!(collection.included_items_to_transport)
232
+ if collection
233
+ hash.deep_merge!(collection.to_transport)
234
+ hash.deep_merge!(collection.included_items_to_transport)
235
+ end
230
236
  end
231
237
  edge_collections.each_value do |collection|
232
- hash.deep_merge!(collection.to_transport)
233
- hash.deep_merge!(collection.included_items_to_transport)
238
+ if collection
239
+ hash.deep_merge!(collection.to_transport)
240
+ hash.deep_merge!(collection.included_items_to_transport)
241
+ end
234
242
  end
235
243
  hash
236
244
  end
@@ -437,7 +445,7 @@ module LucidData
437
445
  end
438
446
  else
439
447
  _validate_nodes(nodes) if nodes
440
- @_node_collections[:nodes] = nodes ? nodes : []
448
+ @_node_collections[:nodes] = nodes
441
449
  @_node_collections[:nodes].graph = self if @_node_collections[:nodes].respond_to?(:graph=)
442
450
  end
443
451
 
@@ -454,7 +462,7 @@ module LucidData
454
462
  end
455
463
  else
456
464
  _validate_edges(edges) if edges
457
- @_edge_collections[:edges] = edges ? edges : []
465
+ @_edge_collections[:edges] = edges
458
466
  @_edge_collections[:edges].graph = self if @_edge_collections[:edges].respond_to?(:graph=)
459
467
  end
460
468
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.zeta11
4
+ version: 1.0.0.zeta12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-27 00:00:00.000000000 Z
11
+ date: 2020-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -86,56 +86,56 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 16.12.6
89
+ version: 16.12.9
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 16.12.6
96
+ version: 16.12.9
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: isomorfeus-redux
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 4.0.16
103
+ version: 4.0.17
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 4.0.16
110
+ version: 4.0.17
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: isomorfeus-transport
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 1.0.0.zeta11
117
+ version: 1.0.0.zeta12
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 1.0.0.zeta11
124
+ version: 1.0.0.zeta12
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: isomorfeus
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 1.0.0.zeta11
131
+ version: 1.0.0.zeta12
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 1.0.0.zeta11
138
+ version: 1.0.0.zeta12
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: opal-webpack-loader
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -213,6 +213,10 @@ files:
213
213
  - lib/isomorfeus_data/lucid_data/edge_collection/base.rb
214
214
  - lib/isomorfeus_data/lucid_data/edge_collection/finders.rb
215
215
  - lib/isomorfeus_data/lucid_data/edge_collection/mixin.rb
216
+ - lib/isomorfeus_data/lucid_data/generic_collection.rb
217
+ - lib/isomorfeus_data/lucid_data/generic_edge.rb
218
+ - lib/isomorfeus_data/lucid_data/generic_edge_collection.rb
219
+ - lib/isomorfeus_data/lucid_data/generic_node.rb
216
220
  - lib/isomorfeus_data/lucid_data/graph/base.rb
217
221
  - lib/isomorfeus_data/lucid_data/graph/finders.rb
218
222
  - lib/isomorfeus_data/lucid_data/graph/mixin.rb