souls 1.9.14 → 1.10.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 +1 -1
- data/lib/souls/app/graphql/souls_mutation.rb +61 -0
- data/lib/souls/app/index.rb +2 -0
- data/lib/souls/app/utils/firebase_id_token.rb +3 -0
- data/lib/souls/cli/docker/index.rb +8 -0
- data/lib/souls/cli/gcloud/iam/index.rb +1 -1
- data/lib/souls/cli/gcloud/pubsub/subscriptions.rb +1 -2
- data/lib/souls/cli/generate/resolver.rb +1 -3
- data/lib/souls/cli/generate/resolver_rbs.rb +2 -4
- data/lib/souls/cli/release/release.rb +2 -2
- data/lib/souls/index.rb +1 -0
- 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 +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6c497eec55aae48fa1912a49afaf7be8bf0dcd168d470f636e59c6e66673952
|
4
|
+
data.tar.gz: 8f65a33d00b9748c03b533e534c8b11a737445c8be576050d6ed6c394c652274
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 681dd439e9da5f57011eb049952f3ccdf78a21827f21e1e376f21103a87177569824c6edb805d1fca7f9cd0aa89390c500dc21f7f1046fe401c472f7de27ec41
|
7
|
+
data.tar.gz: 05c940c0e58cf77cc90749a432a2860c2c98afa134956a5e6d06f24a405b394a7c5bedbacfb10e6b77862b116961fae2d90726fb89c32e76d54ede485752aeec
|
data/README.md
CHANGED
@@ -52,7 +52,7 @@ Powered by Ruby GraphQL, RBS/Steep, Active Record, RSpec, RuboCop, and Google Cl
|
|
52
52
|
|
53
53
|

|
54
54
|
|
55
|
-
SOULs creates 2 types of
|
55
|
+
SOULs creates 2 types of App.
|
56
56
|
|
57
57
|
1. API - GraphQL (Ruby) - Simple API - Cloud Run
|
58
58
|
2. Worker - Google Pub/Sub Messaging Worker API (Ruby) - Cloud Run
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Souls
|
2
|
+
class SoulsMutation < GraphQL::Schema::RelayClassicMutation
|
3
|
+
def souls_fb_auth(token:)
|
4
|
+
FirebaseIdToken::Certificates.request!
|
5
|
+
sleep(3) if ENV["RACK_ENV"] == "development"
|
6
|
+
user = FirebaseIdToken::Signature.verify(token)
|
7
|
+
raise(ArgumentError, "Invalid or Missing Token") if user.blank?
|
8
|
+
|
9
|
+
user
|
10
|
+
end
|
11
|
+
|
12
|
+
def publish_pubsub_queue(topic_name: "send-mail-job", message: "text!")
|
13
|
+
pubsub = Google::Cloud::Pubsub.new(project: ENV["SOULS_GCP_PROJECT_ID"])
|
14
|
+
topic = pubsub.topic(topic_name)
|
15
|
+
topic.publish(message)
|
16
|
+
end
|
17
|
+
|
18
|
+
def make_graphql_query(query: "newCommentMailer", args: {})
|
19
|
+
if args.blank?
|
20
|
+
query_string = %(query { #{query.to_s.underscore.camelize(:lower)} { response } })
|
21
|
+
else
|
22
|
+
inputs = ""
|
23
|
+
args.each do |key, value|
|
24
|
+
inputs +=
|
25
|
+
if value.instance_of?(String)
|
26
|
+
"#{key.to_s.underscore.camelize(:lower)}: \"#{value}\" "
|
27
|
+
else
|
28
|
+
"#{key.to_s.underscore.camelize(:lower)}: #{value} "
|
29
|
+
end
|
30
|
+
end
|
31
|
+
query_string = %(query { #{query.to_s.underscore.camelize(:lower)}(#{inputs}) { response } })
|
32
|
+
end
|
33
|
+
query_string
|
34
|
+
end
|
35
|
+
|
36
|
+
def post_to_dev(worker_name: "", query_string: "")
|
37
|
+
app = Souls.configuration.app
|
38
|
+
port = get_worker(worker_name: "souls-#{app}-#{worker_name}")[0][:port]
|
39
|
+
endpoint = Souls.configuration.endpoint
|
40
|
+
res = Net::HTTP.post_form(URI.parse("http://localhost:#{port}#{endpoint}"), { query: query_string })
|
41
|
+
res.body
|
42
|
+
end
|
43
|
+
|
44
|
+
def get_worker(worker_name: "")
|
45
|
+
workers = Souls.configuration.workers
|
46
|
+
workers.filter { |n| n[:name] == worker_name }
|
47
|
+
end
|
48
|
+
|
49
|
+
def auth_check(context)
|
50
|
+
raise(GraphQL::ExecutionError, "You need to sign in!!") if context[:user].nil?
|
51
|
+
end
|
52
|
+
|
53
|
+
def production?
|
54
|
+
ENV["RACK_ENV"] == "production"
|
55
|
+
end
|
56
|
+
|
57
|
+
def get_instance_id
|
58
|
+
`curl http://metadata.google.internal/computeMetadata/v1/instance/id -H Metadata-Flavor:Google`
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/souls/app/index.rb
CHANGED
@@ -4,6 +4,7 @@ module Souls
|
|
4
4
|
def psql
|
5
5
|
system(
|
6
6
|
"docker run --rm -d \
|
7
|
+
--name souls-psql \
|
7
8
|
-p 5433:5432 \
|
8
9
|
-v postgres-tmp:/var/lib/postgresql/data \
|
9
10
|
-e POSTGRES_USER=postgres \
|
@@ -18,6 +19,7 @@ module Souls
|
|
18
19
|
def mysql
|
19
20
|
system(
|
20
21
|
"docker run --rm -d \
|
22
|
+
--name souls-mysql \
|
21
23
|
-p 3306:3306 \
|
22
24
|
-v mysql-tmp:/var/lib/mysql \
|
23
25
|
-e MYSQL_USER=mysql \
|
@@ -27,5 +29,11 @@ module Souls
|
|
27
29
|
)
|
28
30
|
system("docker ps")
|
29
31
|
end
|
32
|
+
|
33
|
+
desc "redis", "Run Redis Docker Container"
|
34
|
+
def redis
|
35
|
+
system("docker run --rm -d --name souls-redis -p 6379:6379 redis:latest")
|
36
|
+
system("docker ps")
|
37
|
+
end
|
30
38
|
end
|
31
39
|
end
|
@@ -24,7 +24,7 @@ module Souls
|
|
24
24
|
File.open(file_path, "w") do |f|
|
25
25
|
f.write(<<~TEXT)
|
26
26
|
module Resolvers
|
27
|
-
class #{class_name.camelize}Search <
|
27
|
+
class #{class_name.camelize}Search < BaseResolver
|
28
28
|
include SearchObject.module(:graphql)
|
29
29
|
scope { ::#{class_name.camelize}.all }
|
30
30
|
type Types::#{class_name.camelize}Type.connection_type, null: false
|
@@ -78,8 +78,6 @@ module Souls
|
|
78
78
|
end
|
79
79
|
|
80
80
|
option :filter, type: #{class_name.camelize}Filter, with: :apply_filter
|
81
|
-
option :first, type: types.Int, with: :apply_first
|
82
|
-
option :skip, type: types.Int, with: :apply_skip
|
83
81
|
|
84
82
|
def apply_filter(scope, value)
|
85
83
|
branches = normalize_filters(value).inject { |a, b| a.or(b) }
|
@@ -12,15 +12,13 @@ module Souls
|
|
12
12
|
|
13
13
|
File.open(file_path, "w") do |f|
|
14
14
|
f.write(<<~TEXT)
|
15
|
-
class
|
15
|
+
class BaseResolver
|
16
16
|
end
|
17
|
-
class #{singularized_class_name.camelize}Search <
|
17
|
+
class #{singularized_class_name.camelize}Search < BaseResolver
|
18
18
|
include SearchObject
|
19
19
|
def self.scope: () ?{ () -> nil } -> [Hash[Symbol, untyped]]
|
20
20
|
def self.type: (*untyped) -> String
|
21
21
|
def self.option: (:filter, type: untyped, with: :apply_filter) -> String
|
22
|
-
| (:first, type: untyped, with: :apply_first) -> String
|
23
|
-
| (:skip, type: untyped, with: :apply_skip) -> String
|
24
22
|
def self.description: (String) -> String
|
25
23
|
def self.types: (*untyped) -> String
|
26
24
|
def decode_global_key: (String value) -> Integer
|
@@ -139,9 +139,9 @@ module Souls
|
|
139
139
|
write_txt +=
|
140
140
|
if gem[0] == "souls"
|
141
141
|
if local
|
142
|
-
"
|
142
|
+
"gem \"souls\", \"#{version}\", path: \"~/.local_souls/\"\n"
|
143
143
|
else
|
144
|
-
"
|
144
|
+
"gem \"souls\", \"#{version}\"\n"
|
145
145
|
end
|
146
146
|
else
|
147
147
|
line
|
data/lib/souls/index.rb
CHANGED
data/lib/souls/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.10.0
|
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.10.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: 1.
|
4
|
+
version: 1.10.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-12-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -40,6 +40,20 @@ dependencies:
|
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 0.87.2
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: firebase_id_token
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 2.4.0
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 2.4.0
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: google-cloud-pubsub
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,6 +68,20 @@ dependencies:
|
|
54
68
|
- - ">="
|
55
69
|
- !ruby/object:Gem::Version
|
56
70
|
version: 2.8.0
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: graphql
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.12.19
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 1.12.19
|
57
85
|
- !ruby/object:Gem::Dependency
|
58
86
|
name: paint
|
59
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,8 +156,10 @@ files:
|
|
128
156
|
- README.md
|
129
157
|
- exe/souls
|
130
158
|
- lib/souls.rb
|
159
|
+
- lib/souls/app/graphql/souls_mutation.rb
|
131
160
|
- lib/souls/app/graphql/souls_query.rb
|
132
161
|
- lib/souls/app/index.rb
|
162
|
+
- lib/souls/app/utils/firebase_id_token.rb
|
133
163
|
- lib/souls/app/utils/souls_logger.rb
|
134
164
|
- lib/souls/cli.rb
|
135
165
|
- lib/souls/cli/cli_exception.rb
|