graphiti-activegraph 0.1.16 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphiti/active_graph/adapters/active_graph.rb +2 -2
- data/lib/graphiti/active_graph/resource/interface.rb +14 -0
- data/lib/graphiti/active_graph/resource.rb +6 -7
- data/lib/graphiti/active_graph/runner.rb +2 -2
- data/lib/graphiti/active_graph/version.rb +1 -1
- data/lib/graphiti-activegraph.rb +3 -0
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fec65766ac7739c8c38a65cc8ffbd071df5ff4f30bbb8ac5373c4ae1996e33a3
|
4
|
+
data.tar.gz: de51eb41133930d20523781ce94f79545d80be3f14b5afc416aeee047133a128
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd67df9255f946307f733c86cb40d0126b0938f922a3104a823079cb1449a6d07be828e0ecb006085aecc64e6af049bd54f8264c58b767699512e0ed790d439a
|
7
|
+
data.tar.gz: 73e67b1af55bbfa1ad3736b64c003ea966f730429ea441b075cb53d5f4b27bc0f085ffb3a59e52b1f0442380488ec6ac97454e5bdb0385d9c58b6fe6241903a7
|
@@ -58,8 +58,8 @@ module Graphiti::ActiveGraph
|
|
58
58
|
model_instance
|
59
59
|
end
|
60
60
|
|
61
|
-
def resolve(scope)
|
62
|
-
scope.to_a
|
61
|
+
def resolve(scope, resolve_to_rel = false)
|
62
|
+
resolve_to_rel ? scope.to_a(false, true) : scope.to_a
|
63
63
|
end
|
64
64
|
|
65
65
|
# def associate_all(parent, children, association_name, association_type)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Graphiti::ActiveGraph
|
2
|
+
module Resource
|
3
|
+
module Interface
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
class_methods do
|
6
|
+
def build(params, base_scope = nil, opts = {})
|
7
|
+
validate!(params)
|
8
|
+
runner = ::Graphiti::Runner.new(self, params)
|
9
|
+
runner.proxy(base_scope, { single: true, raise_on_missing: true }.merge(opts) )
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -14,16 +14,11 @@ module Graphiti
|
|
14
14
|
params[:filter] ||= {}
|
15
15
|
params[:filter][:id] = id if id
|
16
16
|
|
17
|
-
|
18
|
-
runner = ::Graphiti::Runner.new(self, params)
|
19
|
-
runner.proxy(nil, single: true, raise_on_missing: false, preloaded: obj, bypass_required_filters: true)
|
17
|
+
build(params, nil, raise_on_missing: false, preloaded: obj, bypass_required_filters: true)
|
20
18
|
end
|
21
19
|
|
22
20
|
def all_with_preloaded(obj_arr, params)
|
23
|
-
|
24
|
-
|
25
|
-
runner = ::Graphiti::Runner.new(self, params)
|
26
|
-
runner.proxy(nil, raise_on_missing: false, preloaded: obj_arr)
|
21
|
+
build(params, nil, single: false, raise_on_missing: false, preloaded: obj_arr)
|
27
22
|
end
|
28
23
|
|
29
24
|
def guard_nil_id!(params)
|
@@ -39,6 +34,10 @@ module Graphiti
|
|
39
34
|
query.sideloads.keys.map(&:to_sym)
|
40
35
|
end
|
41
36
|
|
37
|
+
def resolve(scope)
|
38
|
+
adapter.resolve(scope, relation_resource?)
|
39
|
+
end
|
40
|
+
|
42
41
|
def typecast(name, value, flag)
|
43
42
|
att = get_attr!(name, flag, request: true)
|
44
43
|
|
@@ -22,8 +22,8 @@ module Graphiti::ActiveGraph
|
|
22
22
|
:parent,
|
23
23
|
:params,
|
24
24
|
:preloaded).merge(unpaginated_query: params[:unpaginated_query])
|
25
|
-
scope = jsonapi_scope(base, scope_opts)
|
26
|
-
preloaded = opts[:preloaded]
|
25
|
+
scope = jsonapi_scope(base, scope_opts)
|
26
|
+
preloaded = opts[:preloaded]
|
27
27
|
options = { payload: deserialized_payload,
|
28
28
|
single: opts[:single],
|
29
29
|
raise_on_missing: opts[:raise_on_missing],
|
data/lib/graphiti-activegraph.rb
CHANGED
@@ -10,14 +10,17 @@ module Graphiti
|
|
10
10
|
end
|
11
11
|
require 'graphiti/scoping/filterable'
|
12
12
|
require 'graphiti/resource/persistence'
|
13
|
+
require 'graphiti/resource/interface'
|
13
14
|
# End workaround for jruby prepend issue
|
14
15
|
|
15
16
|
loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
|
17
|
+
loader.inflector.inflect 'version' => 'VERSION'
|
16
18
|
loader.ignore(File.expand_path('graphiti-activegraph.rb', __dir__))
|
17
19
|
loader.setup
|
18
20
|
|
19
21
|
Graphiti::Scoping::Filterable.prepend Graphiti::ActiveGraph::Scoping::Filterable
|
20
22
|
Graphiti::Resource::Persistence.prepend Graphiti::ActiveGraph::Resource::Persistence
|
23
|
+
Graphiti::Resource::Interface::ClassMethods.prepend Graphiti::ActiveGraph::Resource::Interface::ClassMethods
|
21
24
|
require 'graphiti'
|
22
25
|
Graphiti::Scoping::Filter.prepend Graphiti::ActiveGraph::Scoping::Filter
|
23
26
|
Graphiti::Util::SerializerRelationship.prepend Graphiti::ActiveGraph::Util::SerializerRelationship
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphiti-activegraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hardik Joshi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphiti
|
@@ -150,7 +150,7 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 3.9.0
|
153
|
-
description:
|
153
|
+
description:
|
154
154
|
email:
|
155
155
|
- hardikjoshi1991@gmail.com
|
156
156
|
executables: []
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- lib/graphiti/active_graph/jsonapi_ext/serializable/resource_ext.rb
|
175
175
|
- lib/graphiti/active_graph/query.rb
|
176
176
|
- lib/graphiti/active_graph/resource.rb
|
177
|
+
- lib/graphiti/active_graph/resource/interface.rb
|
177
178
|
- lib/graphiti/active_graph/resource/persistence.rb
|
178
179
|
- lib/graphiti/active_graph/resource_proxy.rb
|
179
180
|
- lib/graphiti/active_graph/runner.rb
|
@@ -188,7 +189,7 @@ homepage: https://github.com/mrhardikjoshi/graphiti-activegraph
|
|
188
189
|
licenses:
|
189
190
|
- MIT
|
190
191
|
metadata: {}
|
191
|
-
post_install_message:
|
192
|
+
post_install_message:
|
192
193
|
rdoc_options: []
|
193
194
|
require_paths:
|
194
195
|
- lib
|
@@ -203,8 +204,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
204
|
- !ruby/object:Gem::Version
|
204
205
|
version: '0'
|
205
206
|
requirements: []
|
206
|
-
rubygems_version: 3.
|
207
|
-
signing_key:
|
207
|
+
rubygems_version: 3.3.7
|
208
|
+
signing_key:
|
208
209
|
specification_version: 4
|
209
210
|
summary: Easily build jsonapi.org-compatible APIs for GraphDB
|
210
211
|
test_files: []
|