stardust_rails 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bbe149e010f7ea906ef2931a7b4d54ce6b2617a98148e86a1bc2a448f21d296
4
- data.tar.gz: 119e01c47e8cee378d93ba7d93b2dea97680aa643506d74ff658230f3b3ef2af
3
+ metadata.gz: 1f9ed3ccdac95798e18abee0c7600b0c189188a5b291705cc907e4f05af4a33b
4
+ data.tar.gz: '08964765b051cdf70d4350b8e4058bfe53e4424a77776bd4dd18ae76260940aa'
5
5
  SHA512:
6
- metadata.gz: bb299aa1d30927a1364ef8b233f88ccd96141885375430b6ee9e9a415f25404434e09a17bd59805fb1fe0890ba7c869901f6dc9de101a0a5ebf3674b55d6ffb5
7
- data.tar.gz: 6337f5244a51e946793b89b02920ab617ccfe7fe5e7b54167702f74c6d3d67a035246d81ce34994dacb9b89ca550089918f0181ad58e9bce2faf792e9b2576c5
6
+ metadata.gz: 67e99d6712a56b22f803a2b7a6e1b29e700b025dd340f70ad3c3caaf828b5497ce7a5bad2b363c6e297de9f29d95c519d44b15334068b131cc14a7f438eb85b7
7
+ data.tar.gz: 84fd071401395195e31a304553bddf5c3400b05d0a2a30b7631333d69c8e33bfd01bca9e86c1f72ad04011151c94e046ebda91f5965f2312eecf1222a79db99c
data/lib/stardust.rb CHANGED
@@ -1,5 +1,3 @@
1
- require "rails"
2
- require "stardust/engine"
3
1
  require "stardust/instance"
4
2
  require "stardust/configuration"
5
3
 
@@ -24,3 +22,4 @@ end
24
22
 
25
23
  require "stardust/graphql"
26
24
  require "stardust/generators"
25
+ require "stardust/engine"
@@ -1,13 +1,7 @@
1
1
  require "graphql/rails_logger"
2
2
  require 'apollo_upload_server/middleware'
3
3
 
4
- module Stardust
5
- class Engine < ::Rails::Engine
6
-
7
- config.autoload_paths += Dir[
8
- "#{config.root}/app/**/",
9
- "#{config.root}/lib/**/"
10
- ]
4
+ class Stardust::Engine < ::Rails::Engine
11
5
 
12
6
  DIRS = [
13
7
  "app/graph/types",
@@ -47,5 +41,4 @@ module Stardust
47
41
  }
48
42
  end
49
43
  end
50
- end
51
44
  end
@@ -4,7 +4,6 @@ require "graphql/rails_logger"
4
4
  require "graphql/batch"
5
5
 
6
6
  require "stardust/graphql/types"
7
- require "stardust/graphql/schema"
8
7
 
9
8
  require "stardust/graphql/dsl"
10
9
  require "stardust/graphql/types/dsl"
@@ -17,9 +16,14 @@ module Stardust
17
16
  end
18
17
  end
19
18
 
19
+ require "stardust/graphql/collector"
20
+ require "stardust/graphql/configuration"
20
21
  require "stardust/graphql/field"
22
+ require "stardust/graphql/input_object"
23
+ require "stardust/graphql/mutation"
21
24
  require "stardust/graphql/object"
22
- require "stardust/graphql/union"
25
+ require "stardust/graphql/query"
23
26
  require "stardust/graphql/scalar"
24
- require "stardust/graphql/collector"
27
+ require "stardust/graphql/union"
28
+ require "stardust/graphql/extensions/authorize"
25
29
  require "stardust/graphql/input_object"
@@ -34,21 +34,21 @@ module Stardust
34
34
  rescue NotImplementedError
35
35
  klass.graphql_name(type.to_s.camelize)
36
36
  end
37
-
37
+
38
38
  ::Stardust::GraphQL::Types.const_set("#{type.to_s.camelize}", klass)
39
39
  @@__types__[type] = "Stardust::GraphQL::Types::#{type.to_s.camelize}".constantize
40
40
  end
41
41
 
42
42
  def self.clear_definitions!
43
+
44
+ @@__defined_types__.each do |type|
45
+ Stardust::GraphQL::Types.send(:remove_const, type)
46
+ end
47
+
43
48
  @@__defined_types__ = []
44
49
  @@__types__ = {}.merge(FIXED_TYPES)
45
50
  @@__queries__ = {}
46
51
  @@__mutations__ = {}
47
-
48
- ::Stardust::GraphQL.send(:remove_const, "Types")
49
- ::Stardust::GraphQL.send(:remove_const, "Schema")
50
- load 'stardust/graphql/types'
51
- load 'stardust/graphql/schema'
52
52
  end
53
53
 
54
54
  def add_query(name, query:)
@@ -102,6 +102,15 @@ module Stardust
102
102
  end
103
103
  end
104
104
 
105
+ ## Here we define a new graphql type
106
+ if Stardust::GraphQL.const_defined?("Schema")
107
+ Stardust::GraphQL.send(:remove_const, "Schema")
108
+ end
109
+ klass = Class.new(::GraphQL::Schema) do
110
+ use ::GraphQL::Batch
111
+ end
112
+ Stardust::GraphQL.const_set("Schema", klass)
113
+
105
114
  query_class = Class.new(::Stardust::GraphQL::Object)
106
115
  query_class.graphql_name("QueryRoot")
107
116
  @@__queries__.each do |name, query|
@@ -136,7 +145,7 @@ module Stardust
136
145
 
137
146
  TEXT
138
147
  end
139
- Schema.query(query_class)
148
+ Stardust::GraphQL::Schema.query(query_class)
140
149
 
141
150
 
142
151
  mutation_class = Class.new(::GraphQL::Schema::Object)
@@ -154,7 +163,7 @@ module Stardust
154
163
  TEXT
155
164
  end
156
165
  end
157
- Schema.mutation(mutation_class)
166
+ Stardust::GraphQL::Schema.mutation(mutation_class)
158
167
  end
159
168
  end
160
169
  end
@@ -1,6 +1,6 @@
1
1
  module Stardust
2
2
  module GraphQL
3
- class Scalar < GraphQL::Schema::Scalar
3
+ class Scalar < ::GraphQL::Schema::Scalar
4
4
 
5
5
  def self.coerce_input(input_value = nil, context = nil, &block)
6
6
  if block_given?
@@ -1,6 +1,6 @@
1
1
  module Stardust
2
2
  module GraphQL
3
- class Union < GraphQL::Schema::Union
3
+ class Union < ::GraphQL::Schema::Union
4
4
 
5
5
 
6
6
  def self.possible_type(type, klass)
@@ -1,3 +1,3 @@
1
1
  module Stardust
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stardust_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bradley Wittenbrook
@@ -132,7 +132,6 @@ files:
132
132
  - lib/stardust/graphql/object.rb
133
133
  - lib/stardust/graphql/query.rb
134
134
  - lib/stardust/graphql/scalar.rb
135
- - lib/stardust/graphql/schema.rb
136
135
  - lib/stardust/graphql/types.rb
137
136
  - lib/stardust/graphql/types/dsl.rb
138
137
  - lib/stardust/graphql/union.rb
@@ -1,8 +0,0 @@
1
-
2
- module Stardust
3
- module GraphQL
4
- class Schema < ::GraphQL::Schema
5
- use ::GraphQL::Batch
6
- end
7
- end
8
- end