graphql_devise 0.11.1 → 0.11.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 +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.md +8 -0
- data/config/routes.rb +12 -7
- data/lib/graphql_devise.rb +19 -0
- data/lib/graphql_devise/rails/routes.rb +13 -8
- data/lib/graphql_devise/version.rb +1 -1
- data/spec/dummy/config/environments/test.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1a520284d1b06d637b6a5438d34a0c1fc0a150643f7915afe7c62af88749a42
|
4
|
+
data.tar.gz: c4db3a40a6513306c51937a70a1cee0960b26ed7d25e73c9c1d4bdea8f1da4d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea8cf460d52cf99b4113faf028541b57d8f1930ece55da23e7c6e78116d08ee20e5ccd9279fe87229e550d9f8d3f316864c015499c7d648b866a500b739b01d0
|
7
|
+
data.tar.gz: ae14da2bec687cb822b05e5a78a68123e9df6b581a38f793817ec80203b8dadd3b48c2af38337ae1f0f0dd957626dc4a0b018f14b3faff7f8a6bd12da1f58239
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.11.2](https://github.com/graphql-devise/graphql_devise/tree/v0.11.2) (2020-05-06)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v0.11.1...v0.11.2)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Avoid multiple schema and type load \(Devise behavior\) [\#88](https://github.com/graphql-devise/graphql_devise/pull/88) ([mcelicalderon](https://github.com/mcelicalderon))
|
10
|
+
|
3
11
|
## [v0.11.1](https://github.com/graphql-devise/graphql_devise/tree/v0.11.1) (2020-05-05)
|
4
12
|
|
5
13
|
[Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v0.11.0...v0.11.1)
|
data/config/routes.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
GraphqlDevise::Engine.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
# Required as Devise forces routes to reload on eager_load
|
3
|
+
unless GraphqlDevise.schema_loaded?
|
4
|
+
if GraphqlDevise::Types::QueryType.fields.blank?
|
5
|
+
GraphqlDevise::Types::QueryType.field(:dummy, resolver: GraphqlDevise::Resolvers::Dummy)
|
6
|
+
end
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
if GraphqlDevise::Types::MutationType.fields.present?
|
9
|
+
GraphqlDevise::Schema.mutation(GraphqlDevise::Types::MutationType)
|
10
|
+
end
|
9
11
|
|
10
|
-
|
12
|
+
GraphqlDevise::Schema.query(GraphqlDevise::Types::QueryType)
|
13
|
+
|
14
|
+
GraphqlDevise.load_schema
|
15
|
+
end
|
11
16
|
end
|
data/lib/graphql_devise.rb
CHANGED
@@ -6,6 +6,25 @@ module GraphqlDevise
|
|
6
6
|
class Error < StandardError; end
|
7
7
|
|
8
8
|
class InvalidMountOptionsError < GraphqlDevise::Error; end
|
9
|
+
|
10
|
+
@schema_loaded = false
|
11
|
+
@mounted_resources = []
|
12
|
+
|
13
|
+
def self.schema_loaded?
|
14
|
+
@schema_loaded
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.load_schema
|
18
|
+
@schema_loaded = true
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.mount_resource(resource)
|
22
|
+
@mounted_resources << resource
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.resource_mounted?(resource)
|
26
|
+
@mounted_resources.include?(resource)
|
27
|
+
end
|
9
28
|
end
|
10
29
|
|
11
30
|
require 'graphql_devise/concerns/controller_methods'
|
@@ -25,10 +25,6 @@ module ActionDispatch::Routing
|
|
25
25
|
]
|
26
26
|
).validate!
|
27
27
|
|
28
|
-
authenticatable_type = clean_options.authenticatable_type.presence ||
|
29
|
-
"Types::#{resource}Type".safe_constantize ||
|
30
|
-
GraphqlDevise::Types::AuthenticatableType
|
31
|
-
|
32
28
|
devise_for(
|
33
29
|
resource.pluralize.underscore.tr('/', '_').to_sym,
|
34
30
|
module: :devise,
|
@@ -36,6 +32,18 @@ module ActionDispatch::Routing
|
|
36
32
|
skip: DEVISE_OPERATIONS
|
37
33
|
)
|
38
34
|
|
35
|
+
devise_scope resource.underscore.tr('/', '_').to_sym do
|
36
|
+
post clean_options.at, to: 'graphql_devise/graphql#auth'
|
37
|
+
get clean_options.at, to: 'graphql_devise/graphql#auth'
|
38
|
+
end
|
39
|
+
|
40
|
+
# Avoid routes reload done by Devise
|
41
|
+
return if GraphqlDevise.resource_mounted?(resource)
|
42
|
+
|
43
|
+
authenticatable_type = clean_options.authenticatable_type.presence ||
|
44
|
+
"Types::#{resource}Type".safe_constantize ||
|
45
|
+
GraphqlDevise::Types::AuthenticatableType
|
46
|
+
|
39
47
|
prepared_mutations = GraphqlDevise::MountMethod::OperationPreparer.new(
|
40
48
|
resource: resource,
|
41
49
|
custom: clean_options.operations,
|
@@ -66,10 +74,7 @@ module ActionDispatch::Routing
|
|
66
74
|
|
67
75
|
Devise.mailer.helper(GraphqlDevise::MailerHelper)
|
68
76
|
|
69
|
-
|
70
|
-
post clean_options.at, to: 'graphql_devise/graphql#auth'
|
71
|
-
get clean_options.at, to: 'graphql_devise/graphql#auth'
|
72
|
-
end
|
77
|
+
GraphqlDevise.mount_resource(resource)
|
73
78
|
end
|
74
79
|
end
|
75
80
|
end
|
@@ -10,7 +10,7 @@ Rails.application.configure do
|
|
10
10
|
# Do not eager load code on boot. This avoids loading your whole application
|
11
11
|
# just for the purpose of running a single test. If you are using a tool that
|
12
12
|
# preloads Rails for running tests, you may have to set it to true.
|
13
|
-
config.eager_load =
|
13
|
+
config.eager_load = ENV['EAGER_LOAD'].present?
|
14
14
|
|
15
15
|
# Configure public file server for tests with Cache-Control for performance.
|
16
16
|
if Rails::VERSION::MAJOR >= 5
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql_devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Celi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-05-
|
12
|
+
date: 2020-05-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: devise_token_auth
|