souls 0.58.2 → 0.59.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc268f6f98c88667269b2d3e81e45ffb8da2d77fab75560ac5946794b2f8b1c7
4
- data.tar.gz: 9df29c1859e693feea435ac8ed64103c1192c49475b53bbbbb2987e34e2aa7f3
3
+ metadata.gz: 1034f25cfca4bc39ecf378335e4a42d9968c0f6e6e6489f68297c047954c1896
4
+ data.tar.gz: c7736a9966c434c866652ab3938d2c2abf9c11a7ed79ff5f02e8488e240a7e10
5
5
  SHA512:
6
- metadata.gz: c92c1a31bdbbd8db8c2a23d014cdac654d925ad16323368d21364f2295c1f604c19bbb5d3e52ce3cd98a65fd9f06ffd8532c0df8fb3bdeeddcf21b1382a0d945
7
- data.tar.gz: c7366ed35a93741a2bfdd3243935013333f0b182b497f6f22790b22af921be6369f2d84a255e3d1993590739cf535421e5bec677bbc9d2fed22bc829d66148b4
6
+ metadata.gz: ef7b5f771b35aa094f4fc65bc14cd927fde7aaf166c799a2e1164860bd1a96e9423b6c4e955166781fc5ac660d250748276b3d5627a7ea28ac8d5032400429d3
7
+ data.tar.gz: a345585731bd80f9ce3efb502d71afa1c3f5b0c3846fa64eb833051be6f673d4aa365396a73c2fd6dd1fa43cc15f6d8f7f111550ed9b22101d77cbc53c22e262
@@ -12,7 +12,7 @@ module Souls
12
12
  f.write(<<~TEXT)
13
13
  module Types
14
14
  class #{singularized_class_name.camelize}Connection < Types::BaseConnection
15
- def edge_type: (*untyped) -> untyped
15
+ def self.edge_type: (*untyped) -> untyped
16
16
  end
17
17
  end
18
18
  TEXT
@@ -31,6 +31,7 @@ module Souls
31
31
  TEXT
32
32
  end
33
33
  puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
34
+ Souls::Generate.new.invoke(:manager_rbs, [singularized_class_name], { mutation: options[:mutation] })
34
35
  file_path
35
36
  rescue Thor::Error => e
36
37
  raise(Thor::Error, e)
@@ -0,0 +1,32 @@
1
+ module Souls
2
+ class Generate < Thor
3
+ desc "manager_rbs [CLASS_NAME]", "Generate SOULs Manager RBS Template"
4
+ method_option :mutation, aliases: "--mutation", required: true, desc: "Mutation File Name"
5
+ def manager_rbs(class_name)
6
+ file_path = ""
7
+ singularized_class_name = class_name.underscore.singularize
8
+ file_dir = "./sig/api/app/graphql/mutations/managers/#{singularized_class_name}_manager"
9
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
10
+ file_path = "#{file_dir}/#{options[:mutation]}.rbs"
11
+ File.open(file_path, "w") do |f|
12
+ f.write(<<~TEXT)
13
+ module Mutations
14
+ module Managers
15
+ module #{singularized_class_name.camelize}Manager
16
+ class #{singularized_class_name.camelize}Login
17
+ def self.description: (String)-> untyped
18
+ def self.argument: (untyped, untyped, untyped)-> untyped
19
+ def self.field: (untyped, untyped, untyped)-> untyped
20
+ end
21
+ end
22
+ end
23
+ end
24
+ TEXT
25
+ puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
26
+ end
27
+ file_path
28
+ rescue Thor::Error => e
29
+ raise(Thor::Error, e)
30
+ end
31
+ end
32
+ end
@@ -159,6 +159,7 @@ module Souls
159
159
  new_line.write(<<-TEXT)
160
160
 
161
161
  def resolve args
162
+ params = args.dup
162
163
  _, params[:id] = SoulsApiSchema.from_global_id(args[:id])
163
164
  TEXT
164
165
  end
@@ -102,7 +102,11 @@ module Souls
102
102
  module Base
103
103
  module #{class_name.camelize}
104
104
  class Update#{class_name.camelize} < BaseMutation
105
+ String: String
106
+ Boolean: Boolean
107
+ Integer: Integer
105
108
  def resolve: ({
109
+ id: String,
106
110
  TEXT
107
111
  end
108
112
  File.open(file_path, "a") do |f|
@@ -127,10 +131,11 @@ module Souls
127
131
  type = Souls.type_check(param[:type])
128
132
  rbs_type = Souls.rbs_type_check(param[:type])
129
133
  type = "[#{type}]" if param[:array]
134
+ required = param[:column_name] == "id" ? "required: true" : "required: false"
130
135
  if i.zero?
131
- f.write(" def self.argument: (:#{param[:column_name]}, #{type}, required: false ) -> #{rbs_type}\n")
136
+ f.write(" def self.argument: (:#{param[:column_name]}, #{type}, #{required} ) -> #{rbs_type}\n")
132
137
  else
133
- f.write(" | (:#{param[:column_name]}, #{type}, required: false ) -> #{rbs_type}\n")
138
+ f.write(" | (:#{param[:column_name]}, #{type}, #{required} ) -> #{rbs_type}\n")
134
139
  end
135
140
  end
136
141
  end
@@ -10,12 +10,15 @@ module Souls
10
10
  file_path = "#{file_dir}/#{singularized_class_name}_search.rbs"
11
11
  raise(Thor::Error, "Mutation RBS already exist! #{file_path}") if File.exist?(file_path)
12
12
 
13
- params = Souls.get_relation_params(class_name: singularized_class_name)
14
13
  File.open(file_path, "w") do |f|
15
14
  f.write(<<~TEXT)
16
15
  class Base
17
16
  end
17
+ module SearchObject
18
+ def self.module: (Symbol) -> untyped
19
+ end
18
20
  class #{singularized_class_name.camelize}Search < Base
21
+ include SearchObject
19
22
  def self.scope: () ?{ () -> nil } -> [Hash[Symbol, untyped]]
20
23
  def self.type: (*untyped) -> String
21
24
  def self.option: (:filter, type: untyped, with: :apply_filter) -> String
@@ -25,33 +28,11 @@ module Souls
25
28
  def self.types: (*untyped) -> String
26
29
  def decode_global_key: (String value) -> Integer
27
30
  def apply_filter: (untyped scope, untyped value) -> untyped
28
- def normalize_filters: (untyped value, ?Array[untyped] branches) -> Array[untyped]
29
31
 
30
32
  class #{singularized_class_name.camelize}Filter
31
33
  String: String
32
34
  Boolean: Boolean
33
35
  Integer: Integer
34
- TEXT
35
- end
36
- File.open(file_path, "a") do |f|
37
- params[:params].each_with_index do |param, i|
38
- type = Souls.rbs_type_check(param[:type])
39
- type = "[#{type}]" if param[:array]
40
- rbs_type = Souls.rbs_type_check(param[:type])
41
- if i.zero?
42
- f.write(" def self.argument: (:OR, [self], required: false) -> String\n")
43
- else
44
- f.write(" | (:#{param[:column_name]}, #{type}, required: false) -> #{rbs_type}\n")
45
- end
46
- end
47
- end
48
-
49
- File.open(file_path, "a") do |f|
50
- f.write(<<~TEXT)
51
- end
52
- end
53
- module Types
54
- class BaseBaseInputObject
55
36
  end
56
37
  end
57
38
  TEXT
@@ -21,13 +21,13 @@ module Souls
21
21
  end
22
22
  File.open(file_path, "a") do |f|
23
23
  params[:params].each_with_index do |param, i|
24
- type = Souls.rbs_type_check(param[:type])
24
+ type = Souls.type_check(param[:type])
25
25
  type = "[#{type}]" if param[:array]
26
26
  rbs_type = Souls.rbs_type_check(param[:type])
27
27
  if i.zero?
28
- f.write(" def self.field: (:#{param[:column_name]}, #{type}, null: false) -> #{rbs_type}\n")
28
+ f.write(" def self.field: (:#{param[:column_name]}, #{type}, null: true) -> #{rbs_type}\n")
29
29
  else
30
- f.write(" | (:#{param[:column_name]}, #{type}, null: false) -> #{rbs_type}\n")
30
+ f.write(" | (:#{param[:column_name]}, #{type}, null: true) -> #{rbs_type}\n")
31
31
  end
32
32
  end
33
33
  end
@@ -14,7 +14,7 @@ module Souls
14
14
 
15
15
  def update_gem
16
16
  file_path = "./Gemfile"
17
- tmp_file = "./tmp/Gemfile"
17
+ tmp_file = "./config/Gemfile"
18
18
  new_gems = gemfile_latest_version
19
19
  logs = []
20
20
  message = Paint["\nAlready Up to date!", :green]
@@ -70,7 +70,7 @@ module Souls
70
70
  end
71
71
  FileUtils.rm("./Gemfile")
72
72
  FileUtils.rm("./Gemfile.lock")
73
- FileUtils.mv("./tmp/Gemfile", "./Gemfile")
73
+ FileUtils.mv("./config/Gemfile", "./Gemfile")
74
74
  system("bundle update")
75
75
  success = Paint["\n\nSuccessfully Updated These Gems!\n", :green]
76
76
  puts(success)
data/lib/souls/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Souls
2
- VERSION = "0.58.2".freeze
2
+ VERSION = "0.59.2".freeze
3
3
  public_constant :VERSION
4
4
  end
@@ -1 +1 @@
1
- 0.37.2
1
+ 0.38.2
@@ -1 +1 @@
1
- 0.37.2
1
+ 0.38.2
@@ -1,2 +1 @@
1
- require_relative "./mailer"
2
1
  require_relative "./job"
@@ -1,8 +1,13 @@
1
1
  module Souls
2
2
  class Generate < Thor
3
3
  desc "job [CLASS_NAME]", "Generate Job File in Worker"
4
+ method_option :mutation, type: :boolean, aliases: "--mailer", default: false, desc: "Mailer Option"
4
5
  def job(class_name)
5
- create_mutation(class_name: class_name)
6
+ if options[:mailer]
7
+ mailgun_mailer(class_name: class_name)
8
+ else
9
+ create_mutation(class_name: class_name)
10
+ end
6
11
  rescue Thor::Error => e
7
12
  raise(Thor::Error, e)
8
13
  end
@@ -36,5 +41,44 @@ module Souls
36
41
  puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
37
42
  file_path
38
43
  end
44
+
45
+ def mailgun_mailer(class_name: "mailer")
46
+ file_dir = "./app/graphql/mutations/"
47
+ FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
48
+ file_path = "#{file_dir}#{class_name.singularize}.rb"
49
+ raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path)
50
+
51
+ File.open(file_path, "w") do |f|
52
+ f.write(<<~TEXT)
53
+ module Mutations
54
+ class #{class_name.camelize} < BaseMutation
55
+ description "Mail を送信します。"
56
+ field :response, String, null: false
57
+
58
+ def resolve
59
+ # First, instantiate the Mailgun Client with your API key
60
+ mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
61
+
62
+ # Define your message parameters
63
+ message_params = {
64
+ from: "postmaster@YOUR-DOMAIN",
65
+ to: "sending@to.mail.com",
66
+ subject: "SOULs Mailer test!",
67
+ text: "It is really easy to send a message!"
68
+ }
69
+
70
+ # Send your message through the client
71
+ mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
72
+ { response: "Job done!" }
73
+ rescue StandardError => e
74
+ GraphQL::ExecutionError.new(e.to_s)
75
+ end
76
+ end
77
+ end
78
+ TEXT
79
+ end
80
+ puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
81
+ file_path
82
+ end
39
83
  end
40
84
  end
File without changes
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.58.2
4
+ version: 0.59.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI
8
8
  - KishiTheMechanic
9
9
  - James Neve
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-09-25 00:00:00.000000000 Z
13
+ date: 2021-09-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -134,6 +134,7 @@ files:
134
134
  - lib/souls/api/generate/edge_rbs.rb
135
135
  - lib/souls/api/generate/index.rb
136
136
  - lib/souls/api/generate/manager.rb
137
+ - lib/souls/api/generate/manager_rbs.rb
137
138
  - lib/souls/api/generate/model.rb
138
139
  - lib/souls/api/generate/model_rbs.rb
139
140
  - lib/souls/api/generate/mutation.rb
@@ -191,7 +192,7 @@ files:
191
192
  - lib/souls/versions/.souls_worker_version
192
193
  - lib/souls/worker/generate/index.rb
193
194
  - lib/souls/worker/generate/job.rb
194
- - lib/souls/worker/generate/mailer.rb
195
+ - lib/souls/worker/generate/job_rbs.rb
195
196
  - lib/souls/worker/index.rb
196
197
  homepage: https://souls.elsoul.nl
197
198
  licenses:
@@ -200,7 +201,7 @@ metadata:
200
201
  homepage_uri: https://souls.elsoul.nl
201
202
  source_code_uri: https://github.com/elsoul/souls
202
203
  changelog_uri: https://github.com/elsoul/souls
203
- post_install_message:
204
+ post_install_message:
204
205
  rdoc_options: []
205
206
  require_paths:
206
207
  - lib
@@ -216,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
217
  version: '0'
217
218
  requirements: []
218
219
  rubygems_version: 3.2.22
219
- signing_key:
220
+ signing_key:
220
221
  specification_version: 4
221
222
  summary: SOULs はサーバーレスフルスタックフレームワークです。柔軟な Ruby GraphQL API と Worker はルーティングの必要がありません。
222
223
  クラウド環境への自動デプロイ、CI/CD ワークフローを標準装備。開発者がビジネスロジックに集中し、楽しくコードが書けるような環境を目指しています。
@@ -1,51 +0,0 @@
1
- module Souls
2
- class Generate < Thor
3
- desc "mailer [MAILER_NAME]", "Generate Mailer Template in Worker"
4
- def mailer(class_name)
5
- mailgun_mailer(class_name: class_name)
6
- rescue Thor::Error => e
7
- raise(Thor::Error, e)
8
- end
9
-
10
- private
11
-
12
- def mailgun_mailer(class_name: "mailer")
13
- file_dir = "./app/graphql/mutations/"
14
- FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
15
- file_path = "#{file_dir}#{class_name.singularize}.rb"
16
- raise(StandardError, "Mailer already exist! #{file_path}") if File.exist?(file_path)
17
-
18
- File.open(file_path, "w") do |f|
19
- f.write(<<~TEXT)
20
- module Mutations
21
- class #{class_name.camelize} < BaseMutation
22
- description "Mail を送信します。"
23
- field :response, String, null: false
24
-
25
- def resolve
26
- # First, instantiate the Mailgun Client with your API key
27
- mg_client = ::Mailgun::Client.new("YOUR-API-KEY")
28
-
29
- # Define your message parameters
30
- message_params = {
31
- from: "postmaster@YOUR-DOMAIN",
32
- to: "sending@to.mail.com",
33
- subject: "SOULs Mailer test!",
34
- text: "It is really easy to send a message!"
35
- }
36
-
37
- # Send your message through the client
38
- mg_client.send_message("YOUR-MAILGUN-DOMAIN", message_params)
39
- { response: "Job done!" }
40
- rescue StandardError => e
41
- GraphQL::ExecutionError.new(e.to_s)
42
- end
43
- end
44
- end
45
- TEXT
46
- end
47
- puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
48
- file_path
49
- end
50
- end
51
- end