souls 0.63.3 → 0.64.0
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 +4 -4
- data/README.md +4 -35
- data/lib/souls/cli/generate/mutation.rb +70 -53
- data/lib/souls/cli/init/index.rb +3 -1
- data/lib/souls/version.rb +1 -1
- data/lib/souls/versions/.souls_api_version +1 -1
- data/lib/souls/versions/.souls_worker_version +1 -1
- metadata +12 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23d8aab2a3e72d2c2f77b43659b3761f33c485c61365ffc1917ec45df7098511
|
4
|
+
data.tar.gz: 4220a7d02bc34809ed5089b4ad9a89ee2bda32e9def06a4abb8bd99583e1bce2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acac2e0a5c746fd6420834a8fe03f25dd0eda1de887d9526e474b6ff6f78ecc13b06918ac057ff4939b56367014340ceef2963392d6a3770dabc497fdd6e1636
|
7
|
+
data.tar.gz: c756718c2c35fb7f8e02951a90be8d73a13c126c25814e47868328b16145b01baed9a028eb839107c264f679a4228552c2cc1d3267f4f5caa582513dbb82fe75
|
data/README.md
CHANGED
@@ -21,17 +21,12 @@
|
|
21
21
|
|
22
22
|
Welcome to SOULs Serverless Application Framework!
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
- Focus on business logic in serverless environment
|
25
|
+
- Maximize development efficiency with CI / CD standard schema-driven Scaffold
|
26
|
+
- Achieve global scale with lower management costs
|
26
27
|
|
27
|
-
SOULs
|
28
|
-
`API` は主にデータをフロントエンドへ提供します。`Worker` は主に `タスク` の処理を行います
|
28
|
+

|
29
29
|
|
30
|
-

|
31
|
-
|
32
|
-
現在のバージョンでは SOULs `API` と `Worker` を Github Actions を使って Google Cloud Run へそれぞれデプロイします。
|
33
|
-
|
34
|
-
SOULs フレームワークでは [Monorepo](https://en.wikipedia.org/wiki/Monorepo) によって一つのパッケージでアプリケーションを管理します。
|
35
30
|
|
36
31
|
SOULs creates 2 types of framework.
|
37
32
|
|
@@ -79,41 +74,15 @@ And Create Your APP
|
|
79
74
|
|
80
75
|
$ souls new app_name
|
81
76
|
$ cd apps/api/app_name
|
82
|
-
$ bundle
|
83
77
|
$ souls s
|
84
78
|
|
85
79
|
Check your GraphQL PlayGround
|
86
80
|
|
87
81
|
[localhost:4000/playground](localhost:4000/playground)
|
88
82
|
|
89
|
-
## Gemfile 自動更新アップデート
|
90
|
-
|
91
|
-
`Gemfile`, `Gemfile.lock` を最新のバージョンに自動更新します。
|
92
|
-
|
93
|
-
```
|
94
|
-
souls upgrade gemfile
|
95
|
-
```
|
96
|
-
|
97
|
-
除外したい `gem` は `config/souls.rb` 内の
|
98
|
-
`config.fixed_gems` の配列に追加します。
|
99
|
-
|
100
|
-
```ruby
|
101
|
-
Souls.configure do |config|
|
102
|
-
config.app = "souls-api"
|
103
|
-
config.project_id = "souls-api"
|
104
|
-
config.region = "asia-northeast1"
|
105
|
-
config.endpoint = "/endpoint"
|
106
|
-
config.strain = "api"
|
107
|
-
config.fixed_gems = ["selenium-webdriver"]
|
108
|
-
config.workers = []
|
109
|
-
end
|
110
|
-
```
|
111
83
|
|
112
84
|
## SOULs Serverless Application Framework Document
|
113
85
|
|
114
|
-
SOULs サーバーレスアプリケーションフレームワーク
|
115
|
-
ドキュメントはこちらから
|
116
|
-
|
117
86
|
- [SOULs Document](https://souls.elsoul.nl/)
|
118
87
|
|
119
88
|
## Development
|
@@ -3,17 +3,18 @@ module Souls
|
|
3
3
|
desc "mutation [CLASS_NAME]", "Generate GraphQL Mutation from schema.rb"
|
4
4
|
def mutation(class_name)
|
5
5
|
singularized_class_name = class_name.singularize
|
6
|
-
file_dir = "./app/graphql/mutations/base"
|
7
|
-
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
8
|
-
file_path = "./app/graphql/mutations/base/#{singularized_class_name}/create_#{singularized_class_name}.rb"
|
9
|
-
return "Mutation already exist! #{file_path}" if File.exist?(file_path)
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
Dir.chdir(Souls.get_api_path.to_s) do
|
8
|
+
file_dir = "./app/graphql/mutations/base"
|
9
|
+
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
10
|
+
file_path = "./app/graphql/mutations/base/#{singularized_class_name}/create_#{singularized_class_name}.rb"
|
11
|
+
return "Mutation already exist! #{file_path}" if File.exist?(file_path)
|
12
|
+
|
13
|
+
create_mutation(class_name: singularized_class_name)
|
14
|
+
update_mutation(class_name: singularized_class_name)
|
15
|
+
delete_mutation(class_name: singularized_class_name)
|
16
|
+
destroy_delete_mutation(class_name: singularized_class_name)
|
17
|
+
end
|
17
18
|
rescue Thor::Error => e
|
18
19
|
raise(Thor::Error, e)
|
19
20
|
end
|
@@ -21,64 +22,77 @@ module Souls
|
|
21
22
|
private
|
22
23
|
|
23
24
|
def create_mutation(class_name: "user")
|
24
|
-
file_path = ""
|
25
25
|
singularized_class_name = class_name.singularize.underscore
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
raise(Thor::Error, "Mutation RBS already exist! #{file_path}") if File.exist?(file_path)
|
31
|
-
|
32
|
-
params = Souls.get_relation_params(class_name: singularized_class_name, col: "mutation")
|
33
|
-
File.open(file_path, "w") do |f|
|
34
|
-
f.write(<<~TEXT)
|
35
|
-
module Mutations
|
36
|
-
module Base::#{singularized_class_name.camelize}
|
37
|
-
class Create#{singularized_class_name.camelize} < BaseMutation
|
38
|
-
field :#{singularized_class_name}_edge, Types::#{singularized_class_name.camelize}Type.edge_type, null: false
|
39
|
-
field :error, String, null: true
|
40
|
-
#{' '}
|
41
|
-
def resolve(args)
|
42
|
-
TEXT
|
43
|
-
end
|
44
|
-
File.open(file_path, "a") do |f|
|
45
|
-
if params[:relation_params]
|
46
|
-
f.write(" user_id = context[:user][:id]\n") if params[:user_exist]
|
47
|
-
params[:relation_params].each_with_index do |col, _i|
|
48
|
-
next if col[:column_name] == "user_id"
|
26
|
+
file_dir = "./app/graphql/mutations/base/#{singularized_class_name}"
|
27
|
+
FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
|
28
|
+
file_path = "#{file_dir}/create_#{singularized_class_name}.rb"
|
29
|
+
raise(Thor::Error, "Mutation RBS already exist! #{file_path}") if File.exist?(file_path)
|
49
30
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
31
|
+
params = Souls.get_relation_params(class_name: singularized_class_name, col: "mutation")
|
32
|
+
File.open(file_path, "w") do |f|
|
33
|
+
f.write(<<~TEXT)
|
34
|
+
module Mutations
|
35
|
+
module Base::#{singularized_class_name.camelize}
|
36
|
+
class Create#{singularized_class_name.camelize} < BaseMutation
|
37
|
+
field :#{singularized_class_name}_edge, Types::#{singularized_class_name.camelize}Type.edge_type, null: false
|
38
|
+
field :error, String, null: true
|
39
|
+
|
40
|
+
TEXT
|
41
|
+
end
|
42
|
+
|
43
|
+
File.open(file_path, "a") do |f|
|
44
|
+
params[:params].each_with_index do |param, i|
|
45
|
+
type = Souls.rbs_type_check(param[:type])
|
46
|
+
type = "[#{type}]" if param[:array]
|
47
|
+
if i == params[:params].size - 1
|
48
|
+
f.write(" argument :#{param[:column_name]}, #{type}, null: true\n\n")
|
49
|
+
f.write(" def resolve(args)\n")
|
58
50
|
else
|
59
|
-
f.write("
|
51
|
+
f.write(" argument :#{param[:column_name]}, #{type}, null: true\n")
|
60
52
|
end
|
61
53
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
54
|
+
end
|
55
|
+
|
56
|
+
File.open(file_path, "a") do |f|
|
57
|
+
if params[:relation_params]
|
58
|
+
f.write(" user_id = context[:user][:id]\n") if params[:user_exist]
|
59
|
+
params[:relation_params].each_with_index do |col, _i|
|
60
|
+
next if col[:column_name] == "user_id"
|
65
61
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
62
|
+
f.write(" #{col[:column_name]} = SoulsApiSchema.from_global_id(args[:#{col[:column_name]}])\n")
|
63
|
+
end
|
64
|
+
relation_params =
|
65
|
+
params[:relation_params].map do |n|
|
66
|
+
", #{n[:column_name]}: #{n[:column_name]}"
|
67
|
+
end
|
68
|
+
f.write(" new_record = { **args #{relation_params.compact.join} }\n")
|
69
|
+
f.write(" data = ::#{singularized_class_name.camelize}.new(new_record)\n")
|
70
|
+
else
|
71
|
+
f.write(" data = ::#{singularized_class_name.camelize}.new(args)\n")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
File.open(file_path, "a") do |new_line|
|
75
|
+
new_line.write(<<~TEXT)
|
76
|
+
raise(StandardError, data.errors.full_messages) unless data.save
|
77
|
+
|
78
|
+
{ #{singularized_class_name}_edge: { node: data } }
|
79
|
+
rescue StandardError => error
|
80
|
+
GraphQL::ExecutionError.new(error.message)
|
70
81
|
end
|
71
82
|
end
|
72
83
|
end
|
73
|
-
|
74
|
-
|
84
|
+
end
|
85
|
+
TEXT
|
75
86
|
end
|
87
|
+
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
76
88
|
file_path
|
77
89
|
end
|
78
90
|
|
79
91
|
## 2.Mutation - Update
|
80
92
|
def update_mutation_head(class_name: "user")
|
81
|
-
|
93
|
+
singularized_class_name = class_name.singularize.underscore
|
94
|
+
file_dir = "./app/graphql/mutations/base/#{singularized_class_name}"
|
95
|
+
file_path = "#{file_dir}/update_#{class_name}.rb"
|
82
96
|
File.open(file_path, "w") do |new_line|
|
83
97
|
new_line.write(<<~TEXT)
|
84
98
|
module Mutations
|
@@ -170,6 +184,7 @@ module Souls
|
|
170
184
|
end
|
171
185
|
TEXT
|
172
186
|
end
|
187
|
+
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
173
188
|
file_path
|
174
189
|
end
|
175
190
|
|
@@ -209,6 +224,7 @@ module Souls
|
|
209
224
|
end
|
210
225
|
TEXT
|
211
226
|
end
|
227
|
+
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
212
228
|
file_path
|
213
229
|
end
|
214
230
|
|
@@ -238,6 +254,7 @@ module Souls
|
|
238
254
|
end
|
239
255
|
TEXT
|
240
256
|
end
|
257
|
+
puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
|
241
258
|
file_path
|
242
259
|
rescue StandardError => e
|
243
260
|
puts(e)
|
data/lib/souls/cli/init/index.rb
CHANGED
@@ -14,9 +14,11 @@ module Souls
|
|
14
14
|
download_github_actions(app_name: app_name)
|
15
15
|
initial_config_init(app_name: app_name, service_name: service_name)
|
16
16
|
system("cd #{app_name} && git init --initial-branch=main")
|
17
|
+
|
17
18
|
system(
|
18
19
|
"
|
19
|
-
cd #{app_name} &&
|
20
|
+
cd #{app_name} &&
|
21
|
+
git submodule add -f https://github.com/ruby/gem_rbs_collection.git vendor/rbs/gem_rbs_collection
|
20
22
|
"
|
21
23
|
)
|
22
24
|
souls_api_credit(app_name: app_name, service_name: service_name)
|
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.43.0
|
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.43.0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: souls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.64.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- POPPIN-FUMI
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-10-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -111,8 +111,13 @@ dependencies:
|
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: 1.1.0
|
113
113
|
description: |-
|
114
|
-
|
115
|
-
|
114
|
+
Welcome to SOULs Serverless Application Framework!
|
115
|
+
|
116
|
+
- Focus on business logic in serverless environment
|
117
|
+
|
118
|
+
- Maximize development efficiency with CI / CD standard schema-driven Scaffold
|
119
|
+
|
120
|
+
- Achieve global scale with lower management costs
|
116
121
|
email:
|
117
122
|
- f.kawasaki@elsoul.nl
|
118
123
|
- s.kishi@elsoul.nl
|
@@ -220,6 +225,7 @@ requirements: []
|
|
220
225
|
rubygems_version: 3.2.22
|
221
226
|
signing_key:
|
222
227
|
specification_version: 4
|
223
|
-
summary: SOULs
|
224
|
-
|
228
|
+
summary: Welcome to SOULs Serverless Application Framework! - Focus on business logic
|
229
|
+
in serverless environment - Maximize development efficiency with CI / CD standard
|
230
|
+
schema-driven Scaffold - Achieve global scale with lower management costs
|
225
231
|
test_files: []
|