graphql_scaffold_fan 0.1.5 → 0.1.8

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: 00fb9e47f055bb4553d193ea6527cc4a5168b711cbf2e8567d5ab8b79fcff526
4
- data.tar.gz: dd7cfda4ab899da2d4246a229bdbf2ff6a3d57194daecf0a65056291e53096e1
3
+ metadata.gz: 717aed26cef79af6191e2f6e18050b2e6301b852778f281a5ab8c432548a535f
4
+ data.tar.gz: '096db202b717a7a67d627414717f12e2e278f61f194215619cf7c25312e1616c'
5
5
  SHA512:
6
- metadata.gz: a153c02f23d249c3f9145d497b572cb68ac6460b77c98908213a4eddca3c991125d2f0e0602b5331e93bda301967b593b5514a085dc2202284c183bdbda6e991
7
- data.tar.gz: dd5d943dfa1d47fc0f2177efff3c58fbac0ee722a90de4d46e0048847dc149742ee7f0cd03b456e88fe1e042b7ace3f5b4433612abd6ffdf8492bf9d142f301b
6
+ metadata.gz: 4c5df0be8401e283388bfe30ea268abbf5611877bd12681147785c8170cbf0af9424350c1b0aa2b2ca45a054e3699a55a93509c3709ec9456fd76605f8e49134
7
+ data.tar.gz: 3d76435890a16e02ff32b6b583618864f8eaedcadf1270574e4b2643008b3daf57f2692378dc441e69fe626547481cc6d72c692f0f89c112ab6167206c81e9b7
data/Gemfile.lock CHANGED
@@ -1,12 +1,140 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql_scaffold_fan (0.1.5)
4
+ graphql_scaffold_fan (0.1.8)
5
+ graphql
6
+ graphql_playground-rails
5
7
 
6
8
  GEM
7
9
  remote: https://rubygems.org/
8
10
  specs:
11
+ actioncable (6.1.6.1)
12
+ actionpack (= 6.1.6.1)
13
+ activesupport (= 6.1.6.1)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ actionmailbox (6.1.6.1)
17
+ actionpack (= 6.1.6.1)
18
+ activejob (= 6.1.6.1)
19
+ activerecord (= 6.1.6.1)
20
+ activestorage (= 6.1.6.1)
21
+ activesupport (= 6.1.6.1)
22
+ mail (>= 2.7.1)
23
+ actionmailer (6.1.6.1)
24
+ actionpack (= 6.1.6.1)
25
+ actionview (= 6.1.6.1)
26
+ activejob (= 6.1.6.1)
27
+ activesupport (= 6.1.6.1)
28
+ mail (~> 2.5, >= 2.5.4)
29
+ rails-dom-testing (~> 2.0)
30
+ actionpack (6.1.6.1)
31
+ actionview (= 6.1.6.1)
32
+ activesupport (= 6.1.6.1)
33
+ rack (~> 2.0, >= 2.0.9)
34
+ rack-test (>= 0.6.3)
35
+ rails-dom-testing (~> 2.0)
36
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
+ actiontext (6.1.6.1)
38
+ actionpack (= 6.1.6.1)
39
+ activerecord (= 6.1.6.1)
40
+ activestorage (= 6.1.6.1)
41
+ activesupport (= 6.1.6.1)
42
+ nokogiri (>= 1.8.5)
43
+ actionview (6.1.6.1)
44
+ activesupport (= 6.1.6.1)
45
+ builder (~> 3.1)
46
+ erubi (~> 1.4)
47
+ rails-dom-testing (~> 2.0)
48
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
+ activejob (6.1.6.1)
50
+ activesupport (= 6.1.6.1)
51
+ globalid (>= 0.3.6)
52
+ activemodel (6.1.6.1)
53
+ activesupport (= 6.1.6.1)
54
+ activerecord (6.1.6.1)
55
+ activemodel (= 6.1.6.1)
56
+ activesupport (= 6.1.6.1)
57
+ activestorage (6.1.6.1)
58
+ actionpack (= 6.1.6.1)
59
+ activejob (= 6.1.6.1)
60
+ activerecord (= 6.1.6.1)
61
+ activesupport (= 6.1.6.1)
62
+ marcel (~> 1.0)
63
+ mini_mime (>= 1.1.0)
64
+ activesupport (6.1.6.1)
65
+ concurrent-ruby (~> 1.0, >= 1.0.2)
66
+ i18n (>= 1.6, < 2)
67
+ minitest (>= 5.1)
68
+ tzinfo (~> 2.0)
69
+ zeitwerk (~> 2.3)
70
+ builder (3.2.4)
71
+ concurrent-ruby (1.1.10)
72
+ crass (1.0.6)
73
+ erubi (1.10.0)
74
+ globalid (1.0.0)
75
+ activesupport (>= 5.0)
76
+ graphql (2.0.11)
77
+ graphql_playground-rails (2.1.0)
78
+ rails (>= 5.1.0)
79
+ i18n (1.12.0)
80
+ concurrent-ruby (~> 1.0)
81
+ loofah (2.18.0)
82
+ crass (~> 1.0.2)
83
+ nokogiri (>= 1.5.9)
84
+ mail (2.7.1)
85
+ mini_mime (>= 0.1.1)
86
+ marcel (1.0.2)
87
+ method_source (1.0.0)
88
+ mini_mime (1.1.2)
89
+ minitest (5.16.2)
90
+ nio4r (2.5.8)
91
+ nokogiri (1.13.7-x86_64-darwin)
92
+ racc (~> 1.4)
93
+ racc (1.6.0)
94
+ rack (2.2.4)
95
+ rack-test (2.0.2)
96
+ rack (>= 1.3)
97
+ rails (6.1.6.1)
98
+ actioncable (= 6.1.6.1)
99
+ actionmailbox (= 6.1.6.1)
100
+ actionmailer (= 6.1.6.1)
101
+ actionpack (= 6.1.6.1)
102
+ actiontext (= 6.1.6.1)
103
+ actionview (= 6.1.6.1)
104
+ activejob (= 6.1.6.1)
105
+ activemodel (= 6.1.6.1)
106
+ activerecord (= 6.1.6.1)
107
+ activestorage (= 6.1.6.1)
108
+ activesupport (= 6.1.6.1)
109
+ bundler (>= 1.15.0)
110
+ railties (= 6.1.6.1)
111
+ sprockets-rails (>= 2.0.0)
112
+ rails-dom-testing (2.0.3)
113
+ activesupport (>= 4.2.0)
114
+ nokogiri (>= 1.6)
115
+ rails-html-sanitizer (1.4.3)
116
+ loofah (~> 2.3)
117
+ railties (6.1.6.1)
118
+ actionpack (= 6.1.6.1)
119
+ activesupport (= 6.1.6.1)
120
+ method_source
121
+ rake (>= 12.2)
122
+ thor (~> 1.0)
9
123
  rake (13.0.6)
124
+ sprockets (4.1.1)
125
+ concurrent-ruby (~> 1.0)
126
+ rack (> 1, < 3)
127
+ sprockets-rails (3.4.2)
128
+ actionpack (>= 5.2)
129
+ activesupport (>= 5.2)
130
+ sprockets (>= 3.0.0)
131
+ thor (1.2.1)
132
+ tzinfo (2.0.4)
133
+ concurrent-ruby (~> 1.0)
134
+ websocket-driver (0.7.5)
135
+ websocket-extensions (>= 0.1.0)
136
+ websocket-extensions (0.1.5)
137
+ zeitwerk (2.6.0)
10
138
 
11
139
  PLATFORMS
12
140
  x86_64-darwin-20
data/README.md CHANGED
@@ -9,7 +9,6 @@ TODO: Delete this and the text above, and describe your gem
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'graphql'
13
12
  gem 'graphql_scaffold_fan'
14
13
  ```
15
14
 
@@ -25,10 +24,18 @@ Or install it yourself as:
25
24
 
26
25
  Run `rails generate -h` to see if the GraphqlScaffold genertors have been loaded correctly
27
26
  Example commands:
28
- `rails generate graphql_scaffold:init <ProjectName>` Initial command will use the root folder name as its ProjectName, so be free to enter any character here.
27
+ `rails generate graphql_scaffold:init <ProjectName>`
28
+
29
29
  `rails generate graphql_scaffold:mutation <MutationName>`
30
+
30
31
  `rails generate graphql_scaffold:type <TypeName>`
31
32
 
33
+ If you ever found mutation not loading in schema: pls check the following code
34
+ `config.load_defaults 6.1`
35
+ `# config.autoloader = :zeitwerk`
36
+ Reference link:
37
+ https://guides.rubyonrails.org/classic_to_zeitwerk_howto.html
38
+
32
39
 
33
40
  ## Development
34
41
 
@@ -23,7 +23,8 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  # Uncomment to register a new dependency of your gem
25
25
  # spec.add_dependency "example-gem", "~> 1.0"
26
-
26
+ spec.add_dependency 'graphql_playground-rails'
27
+ spec.add_dependency 'graphql'
27
28
  # For more information and examples about making a new gem, checkout our
28
29
  # guide at: https://bundler.io/guides/creating_gem.html
29
30
  end
@@ -30,7 +30,6 @@ module GraphqlScaffold
30
30
  end
31
31
 
32
32
  def create_admin_controller_file
33
- @top_folder_name = File.basename(Dir.getwd)
34
33
  dir_path = 'app/controllers'
35
34
  file_path = dir_path + '/admin_graphql_controller.rb'
36
35
  FileUtils.mkdir_p(dir_path) unless File.exist?(dir_path)
@@ -7,7 +7,6 @@ class AdminGraphqlController < ApplicationController
7
7
  # This allows for outside API access while preventing CSRF attacks,
8
8
  # but you'll have to authenticate your user separately
9
9
  protect_from_forgery with: :null_session
10
- after_action :track_action
11
10
 
12
11
  def execute
13
12
  variables = prepare_variables(params[:variables])
@@ -18,7 +17,7 @@ class AdminGraphqlController < ApplicationController
18
17
 
19
18
  @current_resource = context[:current_resource]
20
19
 
21
- result = <%= @top_folder_name.camelize %>AdminSchema.execute(query, variables: variables, context: context, operation_name: operation_name)
20
+ result = <%= class_name %>AdminSchema.execute(query, variables: variables, context: context, operation_name: operation_name)
22
21
  render json: result
23
22
  rescue StandardError => e
24
23
  raise e unless Rails.env.development?
@@ -54,11 +53,4 @@ class AdminGraphqlController < ApplicationController
54
53
 
55
54
  render json: { errors: [{ message: err.message, backtrace: err.backtrace }], data: {} }, status: :internal_server_error
56
55
  end
57
-
58
- def track_action
59
- variables = prepare_variables(params[:variables])
60
- query = params[:query]
61
- operation_name = params[:operationName]
62
- ahoy.track 'Admin Portal', query: query, variables: variables, operation_name: operation_name
63
- end
64
56
  end
@@ -1,4 +1,4 @@
1
- class <%= @top_folder_name.camelize %>AdminSchema < GraphQL::Schema
1
+ class <%= class_name %>AdminSchema < GraphQL::Schema
2
2
  use GraphQL::Tracing::NewRelicTracing, set_transaction_name: true
3
3
  use GraphqlDevise::SchemaPlugin.new(
4
4
  query: Types::Query::AdminUserQueryType,
@@ -6,7 +6,7 @@ module Mutations
6
6
 
7
7
  def resolve(**args)
8
8
  <%= class_name.underscore %> = <%= class_name %>.new(args)
9
- if <%= class_name.underscore %>.save
9
+ if <%= class_name.underscore %>.save
10
10
  <%= class_name.underscore %>
11
11
  else
12
12
  context.add_error(GraphQL::ExecutionError.new( <%= class_name.underscore %>.errors.full_messages.join(', ')))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlScaffoldFan
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.8'
5
5
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql_scaffold_fan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fan Zhang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-28 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2022-07-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: graphql_playground-rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: graphql
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  description: Helping creating graphql files
14
42
  email:
15
43
  - fan.zhang@pixelforce.com.au