graphql_devise 0.7.0 → 0.8.0

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: e14199edb2f13b7bc5998a9b56895559f24a823e0764b81fa6e3d9f30baabe63
4
- data.tar.gz: bb649528f0e55edac087bb29badd8a849a17c4904fdd3804509cdbdcdc803ea8
3
+ metadata.gz: 0b6f3ff9d48c3f0aead4020e78b67b67d4a4f006d0567e46c9d25e2d4ec75027
4
+ data.tar.gz: c8b9e08819e1b67ee96728190a3a99063ad6370fb2764c14f5d7ab170ee8dbbc
5
5
  SHA512:
6
- metadata.gz: 9446b37c593b01f806e426d6b23d596a3c043daafecc5410876db20369831484c734c9916bd2df124409e6081d7d2a3c28adbe4feed456541558d2ac8260f3b1
7
- data.tar.gz: 0dc4c8c206fd10d5de9c3247f72cac7d40f9374e085e641c3d8e57259fa1d7fb587dd4d1e5f8c36045d7fb10954cbc538f9ef80b0b45becaa56adafd2e184903
6
+ metadata.gz: 1492eb845e6ad50959eee321dbd0feb7efa2ebd8ff37784080715305e2d072109dd0575e2ecbb7ac584f868156a7c4d646101edc4962bc88a86d0005acbfc085
7
+ data.tar.gz: 811254816bf9d2ca63d9064339c0d85bf7073ec7266953f2b8caa42e0be3924277a4a483c05bd7ff60326aeb284fb3632bd53fad2cf2912481c16d3d5d550368
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.8.0](https://github.com/graphql-devise/graphql_devise/tree/v0.8.0) (2019-11-26)
4
+
5
+ [Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v0.7.0...v0.8.0)
6
+
7
+ **Breaking changes:**
8
+
9
+ - Set standard to use authenticatable per Devise's coding standard. [\#46](https://github.com/graphql-devise/graphql_devise/pull/46) ([aarona](https://github.com/aarona))
10
+
3
11
  ## [v0.7.0](https://github.com/graphql-devise/graphql_devise/tree/v0.7.0) (2019-11-25)
4
12
 
5
13
  [Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v0.6.0...v0.7.0)
data/README.md CHANGED
@@ -61,7 +61,7 @@ Rails.application.routes.draw do
61
61
  mount_graphql_devise_for(
62
62
  'User',
63
63
  at: 'api/v1',
64
- authenticable_type: Types::MyCustomUserType,
64
+ authenticatable_type: Types::MyCustomUserType,
65
65
  operations: {
66
66
  login: Mutations::Login
67
67
  },
@@ -81,8 +81,8 @@ and [queries](https://github.com/graphql-devise/graphql_devise/blob/b5985036e01e
81
81
  All mutations and queries are built so you can extend default behavior just by extending
82
82
  our default classes and yielding your customized code after calling `super`, example
83
83
  [here](https://github.com/graphql-devise/graphql_devise/blob/b5985036e01ea064e43e457b4f0c8516f172471c/spec/dummy/app/graphql/mutations/login.rb#L6).
84
- 1. `authenticable_type`: By default, the gem will add an `authenticable` field to every mutation
85
- and an `authenticable` type to every query. Gem will try to use `Types::<model>Type` by
84
+ 1. `authenticatable_type`: By default, the gem will add an `authenticatable` field to every mutation
85
+ and an `authenticatable` type to every query. Gem will try to use `Types::<model>Type` by
86
86
  default, so in our example you could define `Types::UserType` and every query and mutation
87
87
  will use it. But, you can override this type with this option like in the example.
88
88
  1. `skip`: An array of the operations that should not be available in the authentication schema. All these operations are
@@ -170,7 +170,7 @@ Here is a list of the available mutations and queries assuming your mounted mode
170
170
  1. `userSendResetPassword(email: String!, redirectUrl: String!): UserSendReserPasswordPayload`
171
171
  1. `userResendConfirmation(email: String!, redirectUrl: String!): UserResendConfirmationPayload`
172
172
 
173
- The `UserResendConfirmationPayload` will return the `authenticable` resource that was sent the confirmation instructions but also has a `message: String!` that can be used to notify a user what to do after the instructions were sent to them
173
+ The `UserResendConfirmationPayload` will return the `authenticatable` resource that was sent the confirmation instructions but also has a `message: String!` that can be used to notify a user what to do after the instructions were sent to them
174
174
 
175
175
  #### Queries
176
176
  1. `userConfirmAccount(confirmationToken: String!, redirectUrl: String!): User`
@@ -17,7 +17,7 @@ module GraphqlDevise
17
17
 
18
18
  yield resource if block_given?
19
19
 
20
- { authenticable: resource}
20
+ { authenticatable: resource}
21
21
  elsif resource && !active_for_authentication?(resource)
22
22
  if locked?(resource)
23
23
  raise_user_error(I18n.t('graphql_devise.mailer.unlock_instructions.account_lock_msg'))
@@ -10,7 +10,7 @@ module GraphqlDevise
10
10
 
11
11
  yield current_resource if block_given?
12
12
 
13
- { authenticable: current_resource }
13
+ { authenticatable: current_resource }
14
14
  else
15
15
  raise_user_error(I18n.t('graphql_devise.user_not_found'))
16
16
  end
@@ -20,7 +20,7 @@ module GraphqlDevise
20
20
  )
21
21
 
22
22
  {
23
- authenticable: resource,
23
+ authenticatable: resource,
24
24
  message: I18n.t('graphql_devise.confirmations.send_instructions', email: email)
25
25
  }
26
26
  else
@@ -17,7 +17,7 @@ module GraphqlDevise
17
17
  )
18
18
 
19
19
  if resource.errors.empty?
20
- { authenticable: resource }
20
+ { authenticatable: resource }
21
21
  else
22
22
  raise_user_error_list(I18n.t('graphql_devise.invalid_resource'), errors: resource.errors.full_messages)
23
23
  end
@@ -33,7 +33,7 @@ module GraphqlDevise
33
33
 
34
34
  set_auth_headers(resource) if resource.active_for_authentication?
35
35
 
36
- { authenticable: resource }
36
+ { authenticatable: resource }
37
37
  else
38
38
  clean_up_passwords(resource)
39
39
  raise_user_error_list(
@@ -20,7 +20,7 @@ module GraphqlDevise
20
20
 
21
21
  yield current_resource if block_given?
22
22
 
23
- { authenticable: current_resource }
23
+ { authenticatable: current_resource }
24
24
  else
25
25
  raise_user_error_list(
26
26
  I18n.t('graphql_devise.passwords.update_password_error'),
@@ -25,7 +25,7 @@ module GraphqlDevise
25
25
  end
26
26
 
27
27
  controller.redirect_to(redirect_to_link)
28
- { authenticable: resource }
28
+ { authenticatable: resource }
29
29
  else
30
30
  raise_user_error(I18n.t('graphql_devise.confirmations.invalid_token'))
31
31
  end
@@ -1,6 +1,6 @@
1
1
  module GraphqlDevise
2
2
  module Types
3
- class AuthenticableType < GraphQL::Schema::Object
3
+ class AuthenticatableType < GraphQL::Schema::Object
4
4
  field :email, String, null: false
5
5
  end
6
6
  end
@@ -39,9 +39,9 @@ module ActionDispatch::Routing
39
39
  skip: [:sessions, :registrations, :passwords, :confirmations, :omniauth_callbacks, :unlocks]
40
40
  )
41
41
 
42
- authenticable_type = opts[:authenticable_type] ||
43
- "Types::#{resource}Type".safe_constantize ||
44
- GraphqlDevise::Types::AuthenticableType
42
+ authenticatable_type = opts[:authenticatable_type] ||
43
+ "Types::#{resource}Type".safe_constantize ||
44
+ GraphqlDevise::Types::AuthenticatableType
45
45
 
46
46
  used_mutations = if only_operations.present?
47
47
  default_mutations.slice(*only_operations)
@@ -54,7 +54,7 @@ module ActionDispatch::Routing
54
54
  else
55
55
  new_mutation = Class.new(mutation)
56
56
  new_mutation.graphql_name("#{resource}#{action.to_s.camelize(:upper)}")
57
- new_mutation.field(:authenticable, authenticable_type, null: true)
57
+ new_mutation.field(:authenticatable, authenticatable_type, null: true)
58
58
 
59
59
  new_mutation
60
60
  end
@@ -74,7 +74,7 @@ module ActionDispatch::Routing
74
74
  else
75
75
  new_query = Class.new(query)
76
76
  new_query.graphql_name("#{resource}#{action.to_s.camelize(:upper)}")
77
- new_query.type(authenticable_type, null: true)
77
+ new_query.type(authenticatable_type, null: true)
78
78
 
79
79
  new_query
80
80
  end
@@ -1,3 +1,3 @@
1
1
  module GraphqlDevise
2
- VERSION = '0.7.0'.freeze
2
+ VERSION = '0.8.0'.freeze
3
3
  end
@@ -8,7 +8,7 @@ module Mutations
8
8
  user.reload
9
9
  end
10
10
 
11
- original_payload.merge(user: original_payload[:authenticable])
11
+ original_payload.merge(user: original_payload[:authenticatable])
12
12
  end
13
13
  end
14
14
  end
@@ -6,7 +6,7 @@ module Mutations
6
6
 
7
7
  def resolve(email:, **attrs)
8
8
  original_payload = super
9
- original_payload.merge(user: original_payload[:authenticable])
9
+ original_payload.merge(user: original_payload[:authenticatable])
10
10
  end
11
11
  end
12
12
  end
@@ -6,9 +6,9 @@ Rails.application.routes.draw do
6
6
 
7
7
  mount_graphql_devise_for(
8
8
  'Admin',
9
- authenticable_type: Types::CustomAdminType,
10
- skip: [:sign_up, :check_password_token],
11
- at: '/api/v1/admin/graphql_auth'
9
+ authenticatable_type: Types::CustomAdminType,
10
+ skip: [:sign_up, :check_password_token],
11
+ at: '/api/v1/admin/graphql_auth'
12
12
  )
13
13
 
14
14
  mount_graphql_devise_for(
@@ -100,7 +100,7 @@ RSpec.describe 'Login Requests' do
100
100
  email: "#{admin.email}",
101
101
  password: "#{password}"
102
102
  ) {
103
- authenticable { email customField }
103
+ authenticatable { email customField }
104
104
  }
105
105
  }
106
106
  GRAPHQL
@@ -110,7 +110,7 @@ RSpec.describe 'Login Requests' do
110
110
 
111
111
  it 'works alongside the user mount point' do
112
112
  expect(json_response[:data][:adminLogin]).to include(
113
- authenticable: { email: admin.email, customField: "email: #{admin.email}" }
113
+ authenticatable: { email: admin.email, customField: "email: #{admin.email}" }
114
114
  )
115
115
  end
116
116
  end
@@ -124,7 +124,7 @@ RSpec.describe 'Login Requests' do
124
124
  email: "#{guest.email}",
125
125
  password: "#{password}"
126
126
  ) {
127
- authenticable { email }
127
+ authenticatable { email }
128
128
  }
129
129
  }
130
130
  GRAPHQL
@@ -134,7 +134,7 @@ RSpec.describe 'Login Requests' do
134
134
 
135
135
  it 'works alongside the user mount point' do
136
136
  expect(json_response[:data][:guestLogin]).to include(
137
- authenticable: { email: guest.email }
137
+ authenticatable: { email: guest.email }
138
138
  )
139
139
  end
140
140
  end
@@ -8,7 +8,7 @@ RSpec.describe 'Logout Requests' do
8
8
  <<-GRAPHQL
9
9
  mutation {
10
10
  userLogout {
11
- authenticable { email }
11
+ authenticatable { email }
12
12
  }
13
13
  }
14
14
  GRAPHQL
@@ -23,7 +23,7 @@ RSpec.describe 'Logout Requests' do
23
23
  expect(response).not_to include_auth_headers
24
24
  expect(user.reload.tokens.keys).to be_empty
25
25
  expect(json_response[:data][:userLogout]).to match(
26
- authenticable: { email: user.email }
26
+ authenticatable: { email: user.email }
27
27
  )
28
28
  expect(json_response[:errors]).to be_nil
29
29
  end
@@ -45,7 +45,7 @@ RSpec.describe 'Logout Requests' do
45
45
  <<-GRAPHQL
46
46
  mutation {
47
47
  adminLogout {
48
- authenticable { email }
48
+ authenticatable { email }
49
49
  }
50
50
  }
51
51
  GRAPHQL
@@ -57,7 +57,7 @@ RSpec.describe 'Logout Requests' do
57
57
  expect(response).not_to include_auth_headers
58
58
  expect(admin.reload.tokens.keys).to be_empty
59
59
  expect(json_response[:data][:adminLogout]).to match(
60
- authenticable: { email: admin.email }
60
+ authenticatable: { email: admin.email }
61
61
  )
62
62
  expect(json_response[:errors]).to be_nil
63
63
  end
@@ -15,7 +15,7 @@ RSpec.describe 'Resend confirmation' do
15
15
  redirectUrl:"#{redirect}"
16
16
  ) {
17
17
  message
18
- authenticable {
18
+ authenticatable {
19
19
  id
20
20
  email
21
21
  }
@@ -28,7 +28,7 @@ RSpec.describe 'Resend confirmation' do
28
28
  it 'sends an email to the user with confirmation url and returns a success message' do
29
29
  expect { post_request }.to change(ActionMailer::Base.deliveries, :count).by(1)
30
30
  expect(json_response[:data][:userResendConfirmation]).to include(
31
- authenticable: {
31
+ authenticatable: {
32
32
  id: id,
33
33
  email: email
34
34
  },
@@ -13,7 +13,7 @@ RSpec.describe 'Send Password Reset Requests' do
13
13
  email: "#{email}",
14
14
  redirectUrl: "#{redirect_url}"
15
15
  ) {
16
- authenticable {
16
+ authenticatable {
17
17
  email
18
18
  }
19
19
  }
@@ -87,7 +87,7 @@ RSpec.describe 'Sign Up process' do
87
87
  passwordConfirmation: "#{password}"
88
88
  confirmSuccessUrl: "#{redirect}"
89
89
  ) {
90
- authenticable {
90
+ authenticatable {
91
91
  email
92
92
  }
93
93
  }
@@ -114,7 +114,7 @@ RSpec.describe 'Sign Up process' do
114
114
  passwordConfirmation: "#{password}"
115
115
  confirmSuccessUrl: "#{redirect}"
116
116
  ) {
117
- authenticable {
117
+ authenticatable {
118
118
  email
119
119
  }
120
120
  }
@@ -10,7 +10,7 @@ RSpec.describe 'Update Password Requests' do
10
10
 
11
11
  expect(response).to include_auth_headers
12
12
  expect(json_response[:data][:userUpdatePassword]).to match(
13
- authenticable: { email: user.email }
13
+ authenticatable: { email: user.email }
14
14
  )
15
15
  expect(json_response[:errors]).to be_nil
16
16
  expect(user).to be_valid_password(password)
@@ -33,7 +33,7 @@ RSpec.describe 'Update Password Requests' do
33
33
  passwordConfirmation: "#{password_confirmation}",
34
34
  currentPassword: "#{current_password}"
35
35
  ) {
36
- authenticable { email }
36
+ authenticatable { email }
37
37
  }
38
38
  }
39
39
  GRAPHQL
@@ -26,7 +26,7 @@ RSpec.describe 'Check Password Token Requests' do
26
26
  context 'when redirect_url is not provided' do
27
27
  let(:redirect_url) { nil }
28
28
 
29
- it 'returns authenticable and credentials in the headers' do
29
+ it 'returns authenticatable and credentials in the headers' do
30
30
  get_request
31
31
 
32
32
  expect(response).to include_auth_headers
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.7.0
4
+ version: 0.8.0
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: 2019-11-25 00:00:00.000000000 Z
12
+ date: 2019-11-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: devise_token_auth
@@ -270,7 +270,7 @@ files:
270
270
  - app/graphql/graphql_devise/resolvers/check_password_token.rb
271
271
  - app/graphql/graphql_devise/resolvers/confirm_account.rb
272
272
  - app/graphql/graphql_devise/schema.rb
273
- - app/graphql/graphql_devise/types/authenticable_type.rb
273
+ - app/graphql/graphql_devise/types/authenticatable_type.rb
274
274
  - app/graphql/graphql_devise/types/mutation_type.rb
275
275
  - app/graphql/graphql_devise/types/query_type.rb
276
276
  - app/helpers/graphql_devise/application_helper.rb