graphql_devise 0.17.0 → 0.17.1

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: 2a20dcb1834cc319028e86a024014875122d1b6351fed8dcd27c3a82acff8969
4
- data.tar.gz: 92d6109d57ef77cced08a1a6a0a946441be37ddd14b9d27c672b6203ad260a76
3
+ metadata.gz: 0a627bf05673e2c42f24eeb15db1101c060caade6270485146676c6e30840e5d
4
+ data.tar.gz: 9e97f20e1c073225d884e4d2e4fd9e0c9bddbf4eab52fc214c7c1cd5a113411f
5
5
  SHA512:
6
- metadata.gz: f1f28dd471b8e533d1f918101790c6f95734c54050b7e80e00e2832e77a9ab51f72b5f51c1805f94aa8983c39900d8c94e7b3ad41134b9801c39ac3fde403a66
7
- data.tar.gz: ac53e7a59a66bad7e34eae6587f6d31b47ecee4cf26b2fe5280bb2e10e2b3e343f3b1efc8f034aeaf17d4a9e5b73c2e77032ec3fd1d3d2f2efc7e39ce28e186a
6
+ metadata.gz: 2b4026ea6635fdb87856a57eb50ae58cd5406605ffc46347957e1839da04586e2015792905a8214aa24b4ba0b991102ea0edc4e4713e510e42fa23bc13569a9f
7
+ data.tar.gz: 9b24ea5c67644952818cb0dce4119696aa552e1cc9aeda5c67fbe045d15a64312be4c868eed5b9780f2114e4d6e50a73edf6ca13513fda0c5745213a10a9586f
data/Appraisals CHANGED
@@ -3,6 +3,7 @@ appraise 'rails4.2-graphql1.8' do
3
3
  gem 'bundler', '~> 1.17'
4
4
  gem 'rails', github: 'rails/rails', branch: '4-2-stable'
5
5
  gem 'graphql', '~> 1.8.0'
6
+ gem 'devise_token_auth', '< 1.2'
6
7
  gem 'rspec-rails', '< 4.0'
7
8
  end
8
9
 
@@ -19,6 +20,7 @@ appraise 'rails5.0-graphql1.9' do
19
20
  gem 'sqlite3', '~> 1.3.6'
20
21
  gem 'rails', github: 'rails/rails', branch: '5-0-stable'
21
22
  gem 'graphql', '~> 1.9.0'
23
+ gem 'devise_token_auth', '< 1.2'
22
24
  gem 'rspec-rails', '< 4.0'
23
25
  end
24
26
 
@@ -35,6 +37,7 @@ appraise 'rails5.1-graphql1.9' do
35
37
  gem 'sqlite3', '~> 1.3.6'
36
38
  gem 'rails', github: 'rails/rails', branch: '5-1-stable'
37
39
  gem 'graphql', '~> 1.9.0'
40
+ gem 'devise_token_auth', '< 1.2'
38
41
  gem 'rspec-rails', '< 4.0'
39
42
  end
40
43
 
@@ -51,6 +54,7 @@ appraise 'rails5.2-graphql1.9' do
51
54
  gem 'sqlite3', '~> 1.3.6'
52
55
  gem 'rails', github: 'rails/rails', branch: '5-2-stable'
53
56
  gem 'graphql', '~> 1.9.0'
57
+ gem 'devise_token_auth', '< 1.2'
54
58
  gem 'rspec-rails', '< 4.0'
55
59
  end
56
60
 
@@ -58,6 +62,7 @@ appraise 'rails5.2-graphql1.10' do
58
62
  gem 'sqlite3', '~> 1.3.6'
59
63
  gem 'rails', github: 'rails/rails', branch: '5-2-stable'
60
64
  gem 'graphql', '~> 1.10.0'
65
+ gem 'devise_token_auth', '< 1.2'
61
66
  gem 'rspec-rails', '< 4.0'
62
67
  end
63
68
 
@@ -65,6 +70,7 @@ appraise 'rails5.2-graphql1.11' do
65
70
  gem 'sqlite3', '~> 1.3.6'
66
71
  gem 'rails', github: 'rails/rails', branch: '5-2-stable'
67
72
  gem 'graphql', '~> 1.11.0'
73
+ gem 'devise_token_auth', '< 1.2'
68
74
  gem 'rspec-rails', '< 4.0'
69
75
  end
70
76
 
@@ -72,6 +78,7 @@ appraise 'rails5.2-graphql1.12' do
72
78
  gem 'sqlite3', '~> 1.3.6'
73
79
  gem 'rails', github: 'rails/rails', branch: '5-2-stable'
74
80
  gem 'graphql', '~> 1.12.0'
81
+ gem 'devise_token_auth', '< 1.2'
75
82
  gem 'rspec-rails', '< 4.0'
76
83
  end
77
84
 
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.17.1](https://github.com/graphql-devise/graphql_devise/tree/v0.17.1) (2021-08-02)
4
+
5
+ [Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v0.17.0...v0.17.1)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Set context\[:current\_resource\] upon login [\#193](https://github.com/graphql-devise/graphql_devise/pull/193) ([TomasBarry](https://github.com/TomasBarry))
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Improve README [\#190](https://github.com/graphql-devise/graphql_devise/pull/190) ([00dav00](https://github.com/00dav00))
14
+
3
15
  ## [v0.17.0](https://github.com/graphql-devise/graphql_devise/tree/v0.17.0) (2021-06-09)
4
16
 
5
17
  [Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v0.16.0...v0.17.0)
data/README.md CHANGED
@@ -14,16 +14,15 @@ GraphQL interface on top of the [Devise Token Auth](https://github.com/lynndylan
14
14
  * [Installation](#installation)
15
15
  * [Running the Generator](#running-the-generator)
16
16
  * [Mounting the Schema in a Separate Route](#mounting-the-schema-in-a-separate-route)
17
- * [Important](#important)
18
- * [Mounting Operations in Your Own Schema (&gt; v0.12.0)](#mounting-operations-in-your-own-schema--v0120)
19
- * [Important](#important-1)
17
+ * [Mounting Operations in an Existing Schema (&gt; v0.12.0)](#mounting-operations-in-an-existing-schema--v0120)
20
18
  * [Usage](#usage)
21
19
  * [Mounting Auth Schema on a Separate Route](#mounting-auth-schema-on-a-separate-route)
22
- * [Mounting Operations Into Your Own Schema](#mounting-operations-into-your-own-schema)
20
+ * [Mounting Operations In an Existing Schema](#mounting-operations-in-an-existing-schema)
23
21
  * [Available Mount Options](#available-mount-options)
24
22
  * [Available Operations](#available-operations)
25
23
  * [Configuring Model](#configuring-model)
26
24
  * [Email Reconfirmation](#email-reconfirmation)
25
+ * [Current flow](#current-flow)
27
26
  * [Deprecated flow - Do Not Use](#deprecated-flow---do-not-use)
28
27
  * [Customizing Email Templates](#customizing-email-templates)
29
28
  * [I18n](#i18n)
@@ -31,9 +30,9 @@ GraphQL interface on top of the [Devise Token Auth](https://github.com/lynndylan
31
30
  * [Authenticate Resource in the Controller (&gt;= v0.15.0)](#authenticate-resource-in-the-controller--v0150)
32
31
  * [Authentication Options](#authentication-options)
33
32
  * [Authenticate Before Reaching Your GQL Schema (Deprecated)](#authenticate-before-reaching-your-gql-schema-deprecated)
34
- * [Authenticate in Your GQL Schema (Deprecated)](#authenticate-in-your-gql-schema-deprecated)
33
+ * [Authenticate in an Existing Schema (Deprecated)](#authenticate-in-an-existing-schema-deprecated)
35
34
  * [Authentication Options](#authentication-options-1)
36
- * [Important](#important-2)
35
+ * [Important](#important)
37
36
  * [Making Requests](#making-requests)
38
37
  * [Introspection query](#introspection-query)
39
38
  * [Mutations](#mutations)
@@ -48,7 +47,7 @@ GraphQL interface on top of the [Devise Token Auth](https://github.com/lynndylan
48
47
  * [Contributing](#contributing)
49
48
  * [License](#license)
50
49
 
51
- <!-- Added by: mcelicalderon, at: Tue Jun 8 22:47:12 -05 2021 -->
50
+ <!-- Added by: david, at: jue jun 24 18:32:27 -05 2021 -->
52
51
 
53
52
  <!--te-->
54
53
 
@@ -82,11 +81,10 @@ Graphql Devise generator will execute `Devise` and `Devise Token Auth` generator
82
81
  ```bash
83
82
  $ bundle exec rails generate graphql_devise:install
84
83
  ```
85
- The generator accepts 2 params:
84
+ The generator accepts 2 params and 1 option:
86
85
  - `user_class`: Model name in which `Devise` modules will be included. This uses a `find or create` strategy. Defaults to `User`.
87
86
  - `mount_path`: Path in which the dedicated graphql schema for devise will be mounted. Defaults to `/graphql_auth`.
88
-
89
- The option `mount` is available starting from `v0.12.0`. This option will allow you to mount the operations in your own schema instead of a dedicated one. When this option is provided `mount_path` param is not used.
87
+ - `--mount`: This options is available starting from `v0.12.0`, it allows you to mount the operations in your own schema instead of a dedicated one. When provided `mount_path` param is ignored.
90
88
 
91
89
  #### Mounting the Schema in a Separate Route
92
90
 
@@ -109,12 +107,12 @@ Will do the following:
109
107
  `Admin` could be any model name you are going to be using for authentication,
110
108
  and `api/auth` could be any mount path you would like to use for auth.
111
109
 
112
- ##### Important
110
+ **Important**
113
111
  - Remember that by default this gem mounts a completely separate GraphQL schema on a separate controller in the route provided by the `at` option in the `mount_graphql_devise_for` method in the `config/routes.rb` file. If no `at` option is provided, the route will be `/graphql_auth`.
114
- - Avoid passing the `--mount` option or the gem will try to use an existing schema.
112
+ - Avoid passing the `--mount` option if you want to use a separate route and schema.
115
113
 
116
- #### Mounting Operations in Your Own Schema (> v0.12.0)
117
- To configure the gem to use your own GQL schema use the `--mount` option.
114
+ #### Mounting Operations in an Existing Schema (> v0.12.0)
115
+ To configure the gem to use an existing GQL schema use the `--mount` option.
118
116
  For instance the executing:
119
117
 
120
118
  ```bash
@@ -130,8 +128,8 @@ Will do the following:
130
128
  - Add `SchemaPlugin` to the specified schema.
131
129
 
132
130
 
133
- ##### Important
134
- - When using the `--mount` option the `mount_path` params is ignored.
131
+ **Important**
132
+ - When using the `--mount` option the `mount_path` param is ignored.
135
133
  - The generator will look for your schema under `app/graphql/` directory. We are expecting the name of the file is the same as the as the one passed in the mount option transformed with `underscore`. In the example, passing `MySchema`, will try to find the file `app/graphql/my_schema.rb`.
136
134
  - You can actually mount a resource's auth schema in a separate route and in your app's schema at the same time, but that's probably not a common scenario.
137
135
 
@@ -176,10 +174,10 @@ The second argument of the `mount_graphql_devise` method is a hash of options wh
176
174
  customize how the queries and mutations are mounted into the schema. For a list of available
177
175
  options go [here](#available-mount-options)
178
176
 
179
- ### Mounting Operations Into Your Own Schema
177
+ ### Mounting Operations In an Existing Schema
180
178
 
181
- Starting with `v0.12.0` you can now mount the GQL operations provided by this gem into your
182
- app's main schema.
179
+ Starting with `v0.12.0` you can mount the GQL operations provided by this gem into an
180
+ existing schema in you app.
183
181
 
184
182
  ```ruby
185
183
  # app/graphql/dummy_schema.rb
@@ -353,10 +351,11 @@ to call a different update method on your resource,`update_with_email`.
353
351
  When the resource is not reconfirmable or the email is not updated, this method behaves exactly
354
352
  the same as ActiveRecord's `update`.
355
353
 
354
+ #### Current flow
356
355
  `update_with_email` requires one additional attribute when email will change or an error
357
356
  will be raised:
358
357
 
359
- 1. `confirmation_url`: The full url of your client application. The confirmation email will contain this url plus
358
+ - `confirmation_url`: The full url of your client application. The confirmation email will contain this url plus
360
359
  a confirmation token. You need to call `confirmRegistrationWithToken` with the given token on
361
360
  your client application.
362
361
 
@@ -374,12 +373,12 @@ user.update_with_email(
374
373
  `update_with_email` requires two additional attributes when email will change or an error
375
374
  will be raised:
376
375
 
377
- 1. `schema_url`: The full url where your GQL schema is mounted. You can get this value from the
376
+ - `schema_url`: The full url where your GQL schema is mounted. You can get this value from the
378
377
  controller available in the context of your mutations and queries like this:
379
378
  ```ruby
380
379
  context[:controller].full_url_without_params
381
380
  ```
382
- 1. `confirmation_success_url`: This the full url where you want users to be redirected after
381
+ - `confirmation_success_url`: This the full url where you want users to be redirected after
383
382
  the email has changed successfully (usually a front-end url). This value is mandatory
384
383
  unless you have set `default_confirm_success_url` in your devise_token_auth initializer.
385
384
 
@@ -459,7 +458,7 @@ schema. Configure the plugin as explained [here](#mounting-operations-into-your-
459
458
  so this can work.
460
459
 
461
460
  ##### Authentication Options
462
- Wether you setup authentications as a default in the plugin, or you do it at the field level,
461
+ Whether you setup authentications as a default in the plugin, or you do it at the field level,
463
462
  these are the options you can use:
464
463
  1. **Any truthy value:** If `current_resource` is not `.present?`, query will return an authentication error.
465
464
  1. **A callable object:** Provided object will be called with `current_resource` as the only argument if `current_resource` is `.present?`. If return value of the callable object is false, query will return an authentication error.
@@ -501,7 +500,7 @@ end
501
500
  The install generator can include the concern in you application controller.
502
501
  If authentication fails for a request, execution will halt and a REST error will be returned since the request never reaches your GQL schema.
503
502
 
504
- #### Authenticate in Your GQL Schema (Deprecated)
503
+ #### Authenticate in an Existing Schema (Deprecated)
505
504
  For this you will need to add the `GraphqlDevise::SchemaPlugin` to your schema as described
506
505
  [here](#mounting-operations-into-your-own-schema).
507
506
 
@@ -537,7 +536,7 @@ schema. Configure the plugin as explained [here](#mounting-operations-into-your-
537
536
  so this can work.
538
537
 
539
538
  ##### Authentication Options
540
- Wether you setup authentications as a default in the plugin, or you do it at the field level,
539
+ Whether you setup authentications as a default in the plugin, or you do it at the field level,
541
540
  these are the options you can use:
542
541
  1. **Any truthy value:** If `current_resource` is not `.present?`, query will return an authentication error.
543
542
  1. **A callable object:** Provided object will be called with `current_resource` as the only argument if `current_resource` is `.present?`. If return value of the callable object is false, query will return an authentication error.
@@ -24,6 +24,8 @@ module GraphqlDevise
24
24
 
25
25
  yield resource if block_given?
26
26
 
27
+ context[:current_resource] = resource if context[:current_resource].nil?
28
+
27
29
  { authenticatable: resource, credentials: new_headers }
28
30
  elsif resource && !active_for_authentication?(resource)
29
31
  if locked?(resource)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlDevise
4
- VERSION = '0.17.0'.freeze
4
+ VERSION = '0.17.1'.freeze
5
5
  end
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.17.0
4
+ version: 0.17.1
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: 2021-06-09 00:00:00.000000000 Z
12
+ date: 2021-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: devise_token_auth