graphql_scaffold_fan 0.2.5 → 0.2.6

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: 6fd748283918d5930f5362003773250fee8431e809120a3cbef546662110b404
4
- data.tar.gz: 533cc9e4867e83c327da5b3121d9a111f289670a185a0ef8cb5352aa3ceb63e8
3
+ metadata.gz: 132d797967560ca9aff1ca078a4ad7fe8d0febc255baebde4e6a5202c078b659
4
+ data.tar.gz: 8effbef5b823d3e242c8820128cbc66c096adbee8e710a448ddbedf714980c08
5
5
  SHA512:
6
- metadata.gz: dfdaa2f0554c2e30367137be386784fa4d1eba0853a07855d0af62346843eaa950fa0a65dd5bb26d833fd472c1bc28e535f450bcc655483a143c55f9adeed13b
7
- data.tar.gz: f3dbf2b6fcb54f85e0bf259398b99aee011fc60c045bb361ab60c36beee701c5c8a79f83c36979140807bd697335eacdfc2a65d5a43bb1ac992ad01a0358fe7d
6
+ metadata.gz: f65c5dba53e8772e766221bdd284b5306c58239a18913b1b3d5fb170b1dc41f3a8e8322acfbbd3712012d5bc9908fb52171e76165c034516be69e48f4fd97cd2
7
+ data.tar.gz: c690eade0d07e8aec469266b284b45a59ba31b77bd7775686a2a01711d88377988b72e8c8e56ff9ff79efc04db1ab4291c720cfa0658e48f8fd64d749a526c46
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql_scaffold_fan (0.2.5)
4
+ graphql_scaffold_fan (0.2.6)
5
5
  graphql
6
6
  graphql_playground-rails
7
7
 
@@ -40,6 +40,28 @@ module GraphqlScaffold
40
40
  end
41
41
  end
42
42
 
43
+ def create_mutation_type_file
44
+ mutation_type_dir_path = 'app/graphql/types/admin'
45
+ generator_dir_path = mutation_type_dir_path
46
+ generator_path = generator_dir_path + '/mutation_type.rb'
47
+
48
+ FileUtils.mkdir_p(mutation_type_dir_path) unless File.exist?(mutation_type_dir_path)
49
+ FileUtils.mkdir_p(generator_dir_path) unless File.exist?(generator_dir_path)
50
+
51
+ template 'mutation_type.haml', generator_path if !File.exist?(generator_path)
52
+ end
53
+
54
+ def create_query_type_file
55
+ query_type_dir_path = 'app/graphql/types/admin'
56
+ generator_dir_path = query_type_dir_path
57
+ generator_path = generator_dir_path + '/query_type.rb'
58
+
59
+ FileUtils.mkdir_p(query_type_dir_path) unless File.exist?(query_type_dir_path)
60
+ FileUtils.mkdir_p(generator_dir_path) unless File.exist?(generator_dir_path)
61
+
62
+ template 'query_type.haml', generator_path if !File.exist?(generator_path)
63
+ end
64
+
43
65
  def add_route
44
66
  route_dir_path = 'config'
45
67
  route_file_path = route_dir_path + '/routes.rb'
@@ -104,7 +104,7 @@ module GraphqlScaffold
104
104
  end
105
105
  end
106
106
 
107
- def create_mutation_type_file
107
+ def write_to_mutation_type_file
108
108
  mutation_type_dir_path = 'app/graphql/types/admin'
109
109
  generator_dir_path = mutation_type_dir_path
110
110
  generator_path = generator_dir_path + '/mutation_type.rb'
@@ -36,7 +36,7 @@ module GraphqlScaffold
36
36
  template 'admin_filter.haml', generator_path
37
37
  end
38
38
 
39
- def create_query_type_file
39
+ def write_to_query_type_file
40
40
  query_type_dir_path = 'app/graphql/types/admin'
41
41
  generator_dir_path = query_type_dir_path
42
42
  generator_path = generator_dir_path + '/query_type.rb'
@@ -4,17 +4,19 @@
4
4
  class <%= class_name %>AdminSchema < GraphQL::Schema
5
5
  use GraphQL::Tracing::NewRelicTracing, set_transaction_name: true
6
6
  use GraphqlDevise::SchemaPlugin.new(
7
- query: Types::Query::AdminUserQueryType,
8
- mutation: Types::Mutation::AdminUserMutationType,
7
+ query: Types::Admin::QueryType,
8
+ mutation: Types::Admin::MutationType,
9
9
  resource_loaders: [
10
- GraphqlDevise::ResourceLoader.new(AdminUser, only: %i[login logout])
10
+ GraphqlDevise::ResourceLoader.new(AdminUser,
11
+ operations: {
12
+ login: Mutations::Admin::Auth::Login
13
+ },
14
+ only: %i[login logout])
11
15
  ]
12
16
  )
13
17
 
14
- mutation(Types::Mutation::AdminUserMutationType)
15
- query(Types::Query::AdminUserQueryType)
16
-
17
- use GraphQL::Batch
18
+ mutation(Types::Admin::MutationType)
19
+ query(Types::Admin::QueryType)
18
20
 
19
21
  # Union and Interface Resolution
20
22
  def self.resolve_type(_abstract_type, _obj, _ctx)
@@ -26,17 +28,17 @@ class <%= class_name %>AdminSchema < GraphQL::Schema
26
28
  # Relay-style Object Identification:
27
29
 
28
30
  # Return a string UUID for `object`
29
- def self.id_from_object(object, type_definition, _query_ctx)
31
+ def self.id_from_object(object, type_definition, query_ctx)
30
32
  # Here's a simple implementation which:
31
33
  # - joins the type name & object.id
32
34
  # - encodes it with base64:
33
- GraphQL::Schema::UniqueWithinType.encode(type_definition.name, object.id)
35
+ # GraphQL::Schema::UniqueWithinType.encode(type_definition.name, object.id)
34
36
  end
35
37
 
36
38
  # Given a string UUID, find the object
37
- def self.object_from_id(id, _query_ctx)
39
+ def self.object_from_id(id, query_ctx)
38
40
  # For example, to decode the UUIDs generated above:
39
- type_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id)
41
+ # type_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id)
40
42
  #
41
43
  # Then, based on `type_name` and `id`
42
44
  # find an object in your application
@@ -3,7 +3,7 @@
3
3
  module Types
4
4
  module Admin
5
5
  class MutationType < Types::BaseObject
6
- has_admin_mutation :<%= class_name %>
6
+
7
7
  end
8
8
  end
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Types
4
4
  module Admin
5
5
  class QueryType < Types::BaseObject
6
- has_admin_fields :<%= class_name %>
6
+
7
7
  end
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlScaffoldFan
4
- VERSION = '0.2.5'
4
+ VERSION = '0.2.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql_scaffold_fan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
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-07-28 00:00:00.000000000 Z
11
+ date: 2022-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql