kirei 0.7.0 → 0.8.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/kirei.gemspec +1 -1
- data/lib/cli/commands/new_app/files/db_rake.rb +1 -1
- data/lib/kirei/routing/base.rb +18 -9
- data/lib/kirei/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f72e562a33b62988fd08b474ad821c50c35e7439a2fe6eb0e5909b7310099ddc
|
4
|
+
data.tar.gz: c1550bab74543280e4314b1847c8cc2ac80c575e2175efdb2c57bddeb0cd7f95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff42246d1757114996bf8094d80b47ebe2945e1df8551837389cad6c8dc7b96138ac398131d3b6ad07c7c0360b7758a77a06c3557716f22a07e6e4f99085a8bb
|
7
|
+
data.tar.gz: c7ff2ebedf28620e1ec16774b3ff07eb4007fdc76c59c925aa9f3161c452075123e8e4ae17e2786c1a3016f81df0e0c93528813fb879a950a9cec41952351619
|
data/kirei.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
"kirei.gemspec",
|
32
32
|
".irbrc",
|
33
33
|
"lib/**/*",
|
34
|
-
# do not include RBIs for gems, because users might use different
|
34
|
+
# do not include RBIs for gems, because users might use different versions
|
35
35
|
"sorbet/rbi/dsl/**/*.rbi",
|
36
36
|
"sorbet/rbi/shims/**/*.rbi",
|
37
37
|
"LICENSE",
|
data/lib/kirei/routing/base.rb
CHANGED
@@ -35,12 +35,13 @@ module Kirei
|
|
35
35
|
# -> use https://github.com/cyu/rack-cors ?
|
36
36
|
#
|
37
37
|
|
38
|
-
|
38
|
+
lookup_verb = http_verb == Verb::HEAD ? Verb::GET : http_verb
|
39
|
+
route = router.get(lookup_verb, req_path)
|
39
40
|
return NOT_FOUND if route.nil?
|
40
41
|
|
41
42
|
router.current_env = env # expose the env to the controller
|
42
43
|
|
43
|
-
params = case
|
44
|
+
params = case http_verb
|
44
45
|
when Verb::GET
|
45
46
|
query = T.cast(env.fetch("QUERY_STRING"), String)
|
46
47
|
query.split("&").to_h do |p|
|
@@ -50,14 +51,15 @@ module Kirei
|
|
50
51
|
end
|
51
52
|
when Verb::POST, Verb::PUT, Verb::PATCH
|
52
53
|
# TODO: based on content-type, parse the body differently
|
53
|
-
#
|
54
|
+
# built-in support for JSON & XML
|
54
55
|
body = T.cast(env.fetch("rack.input"), T.any(IO, StringIO))
|
55
56
|
res = Oj.load(body.read, Kirei::OJ_OPTIONS)
|
56
57
|
body.rewind # TODO: maybe don't rewind if we don't need to?
|
57
58
|
T.cast(res, T::Hash[String, T.untyped])
|
58
|
-
|
59
|
-
Logging::Logger.logger.warn("Unsupported HTTP verb: #{http_verb.serialize} send to #{req_path}")
|
59
|
+
when Verb::HEAD, Verb::DELETE, Verb::OPTIONS, Verb::TRACE, Verb::CONNECT
|
60
60
|
{}
|
61
|
+
else
|
62
|
+
T.absurd(http_verb)
|
61
63
|
end
|
62
64
|
|
63
65
|
req_id = T.cast(env["HTTP_X_REQUEST_ID"], T.nilable(String))
|
@@ -86,10 +88,17 @@ module Kirei
|
|
86
88
|
}
|
87
89
|
Logging::Metric.inject_defaults(statsd_timing_tags)
|
88
90
|
|
89
|
-
status, headers, response_body =
|
90
|
-
|
91
|
-
|
92
|
-
|
91
|
+
status, headers, response_body = case http_verb
|
92
|
+
when Verb::HEAD, Verb::OPTIONS, Verb::TRACE, Verb::CONNECT
|
93
|
+
[200, {}, []]
|
94
|
+
when Verb::GET, Verb::POST, Verb::PUT, Verb::PATCH, Verb::DELETE
|
95
|
+
T.cast(
|
96
|
+
controller.new(params: params).public_send(route.action),
|
97
|
+
RackResponseType,
|
98
|
+
)
|
99
|
+
else
|
100
|
+
T.absurd(http_verb)
|
101
|
+
end
|
93
102
|
|
94
103
|
after_hooks = collect_hooks(controller, :after_hooks)
|
95
104
|
run_hooks(after_hooks)
|
data/lib/kirei/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kirei
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ludwig Reinmiedl
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: logger
|
@@ -216,7 +215,6 @@ licenses:
|
|
216
215
|
metadata:
|
217
216
|
rubygems_mfa_required: 'true'
|
218
217
|
homepage_uri: https://github.com/swiknaba/kirei
|
219
|
-
post_install_message:
|
220
218
|
rdoc_options: []
|
221
219
|
require_paths:
|
222
220
|
- lib
|
@@ -231,8 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
229
|
- !ruby/object:Gem::Version
|
232
230
|
version: '0'
|
233
231
|
requirements: []
|
234
|
-
rubygems_version: 3.
|
235
|
-
signing_key:
|
232
|
+
rubygems_version: 3.6.7
|
236
233
|
specification_version: 4
|
237
234
|
summary: Kirei is a typed Ruby micro/REST-framework for building scalable and performant
|
238
235
|
microservices.
|