grape_sorbet 0.0.5 → 0.0.7

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: 06c4417253642117e5cc111ec8c478d5c86b12abaff504778c0dc9ca031f0e45
4
- data.tar.gz: c93127be9f1ac682c30080c0e5614a37d9470168172cfcc64b44e25d61203fa9
3
+ metadata.gz: 3f1483462bce00425216e9bd1be3137206600302347695f41aed3b8dcc1b19a7
4
+ data.tar.gz: e1f75b93fac21bf377184bcdc9224acc28da3dd8e885498fcc8359b22f0dbca7
5
5
  SHA512:
6
- metadata.gz: 7c85f6e88f351c4ff58e8fd922f025b41cd38b05d9f773c42c0647128ff2bb525ce359791b21e5462c1119db943e5cee88502b9903236ddd45ef3c06d39c62c5
7
- data.tar.gz: f504e9a4a9ee21cb7464802207cace234dfe270bd01e61f388eefc261ba39db8b96730f25d002f8fe4fc98daae75f22aaf678e0c594e16d138cf5eb10c0d0bb6
6
+ metadata.gz: b42428f7c407aa7651a7db09e37e7c85219f3998ca0d53335d4751d8b42a13e736f5c3df681f808f01830d02f34c94574dd9ab6607613f2bbbac775dd61508bf
7
+ data.tar.gz: 59ae1b6e5bd26bd0fe5add3810b789df8f2b714484d1795d32f18b4484f6b33972cb2d2c1b180bfa6e3b7df6d5bbfd6c0571c575172502424199e22b338598ab
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.2
1
+ 3.3.3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.0.7 (2024-07-03)
2
+
3
+ - Add signatures for `error!` and a few other methods
4
+
5
+ ## 0.0.6 (2024-06-25)
6
+
7
+ - Add support for `rescue_from`
8
+
1
9
  ## 0.0.5 (2024-06-24)
2
10
 
3
11
  - Ignore anonymous helpers
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- grape_sorbet (0.0.5)
4
+ grape_sorbet (0.0.7)
5
5
  activesupport
6
6
  grape (~> 2.0)
7
7
  sorbet-runtime (~> 0.5.10741)
@@ -9,7 +9,7 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (7.1.3.3)
12
+ activesupport (7.1.3.4)
13
13
  base64
14
14
  bigdecimal
15
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -23,18 +23,18 @@ GEM
23
23
  ast (2.4.2)
24
24
  base64 (0.2.0)
25
25
  bigdecimal (3.1.8)
26
- builder (3.2.4)
26
+ builder (3.3.0)
27
27
  bundler-audit (0.9.1)
28
28
  bundler (>= 1.2.0, < 3)
29
29
  thor (~> 1.0)
30
- concurrent-ruby (1.3.1)
30
+ concurrent-ruby (1.3.3)
31
31
  connection_pool (2.4.1)
32
32
  docile (1.4.0)
33
33
  drb (2.2.1)
34
34
  dry-core (1.0.1)
35
35
  concurrent-ruby (~> 1.0)
36
36
  zeitwerk (~> 2.6)
37
- dry-inflector (1.0.0)
37
+ dry-inflector (1.1.0)
38
38
  dry-logic (1.5.0)
39
39
  concurrent-ruby (~> 1.0)
40
40
  dry-core (~> 1.0, < 2)
@@ -46,45 +46,42 @@ GEM
46
46
  dry-inflector (~> 1.0)
47
47
  dry-logic (~> 1.4)
48
48
  zeitwerk (~> 2.6)
49
- erubi (1.12.0)
50
- grape (2.0.0)
51
- activesupport (>= 5)
52
- builder
49
+ erubi (1.13.0)
50
+ grape (2.1.2)
51
+ activesupport (>= 6)
53
52
  dry-types (>= 1.1)
54
- mustermann-grape (~> 1.0.0)
55
- rack (>= 1.3.0)
56
- rack-accept
53
+ mustermann-grape (~> 1.1.0)
54
+ rack (>= 2)
55
+ zeitwerk
57
56
  i18n (1.14.5)
58
57
  concurrent-ruby (~> 1.0)
59
58
  io-console (0.7.2)
60
- irb (1.13.1)
59
+ irb (1.13.2)
61
60
  rdoc (>= 4.0.0)
62
61
  reline (>= 0.4.2)
63
62
  json (2.7.2)
64
63
  language_server-protocol (3.17.0.3)
65
- minitest (5.23.1)
66
- minitest-reporters (1.6.1)
64
+ minitest (5.24.1)
65
+ minitest-reporters (1.7.1)
67
66
  ansi
68
67
  builder
69
68
  minitest (>= 5.0)
70
69
  ruby-progressbar
71
70
  mustermann (3.0.0)
72
71
  ruby2_keywords (~> 0.0.1)
73
- mustermann-grape (1.0.2)
72
+ mustermann-grape (1.1.0)
74
73
  mustermann (>= 1.0.0)
75
74
  mutex_m (0.2.0)
76
75
  netrc (0.11.0)
77
- parallel (1.24.0)
78
- parser (3.3.2.0)
76
+ parallel (1.25.1)
77
+ parser (3.3.3.0)
79
78
  ast (~> 2.4.1)
80
79
  racc
81
- prism (0.29.0)
80
+ prism (0.30.0)
82
81
  psych (5.1.2)
83
82
  stringio
84
83
  racc (1.8.0)
85
- rack (3.0.11)
86
- rack-accept (0.4.5)
87
- rack (>= 0.4)
84
+ rack (3.1.6)
88
85
  rainbow (3.1.1)
89
86
  rake (13.2.1)
90
87
  rbi (0.1.13)
@@ -93,10 +90,10 @@ GEM
93
90
  rdoc (6.7.0)
94
91
  psych (>= 4.0.0)
95
92
  regexp_parser (2.9.2)
96
- reline (0.5.8)
93
+ reline (0.5.9)
97
94
  io-console (~> 0.5)
98
- rexml (3.2.8)
99
- strscan (>= 3.0.9)
95
+ rexml (3.3.1)
96
+ strscan
100
97
  rubocop (1.64.1)
101
98
  json (~> 2.3)
102
99
  language_server-protocol (>= 3.17.0)
@@ -113,7 +110,7 @@ GEM
113
110
  rubocop-minitest (0.35.0)
114
111
  rubocop (>= 1.61, < 2.0)
115
112
  rubocop-ast (>= 1.31.1, < 2.0)
116
- rubocop-performance (1.21.0)
113
+ rubocop-performance (1.21.1)
117
114
  rubocop (>= 1.48.1, < 2.0)
118
115
  rubocop-ast (>= 1.31.1, < 2.0)
119
116
  rubocop-rake (0.6.0)
@@ -130,23 +127,23 @@ GEM
130
127
  simplecov_json_formatter (~> 0.1)
131
128
  simplecov-html (0.12.3)
132
129
  simplecov_json_formatter (0.1.4)
133
- sorbet (0.5.11406)
134
- sorbet-static (= 0.5.11406)
135
- sorbet-runtime (0.5.11406)
136
- sorbet-static (0.5.11406-aarch64-linux)
137
- sorbet-static (0.5.11406-universal-darwin)
138
- sorbet-static (0.5.11406-x86_64-linux)
139
- sorbet-static-and-runtime (0.5.11406)
140
- sorbet (= 0.5.11406)
141
- sorbet-runtime (= 0.5.11406)
130
+ sorbet (0.5.11466)
131
+ sorbet-static (= 0.5.11466)
132
+ sorbet-runtime (0.5.11466)
133
+ sorbet-static (0.5.11466-aarch64-linux)
134
+ sorbet-static (0.5.11466-universal-darwin)
135
+ sorbet-static (0.5.11466-x86_64-linux)
136
+ sorbet-static-and-runtime (0.5.11466)
137
+ sorbet (= 0.5.11466)
138
+ sorbet-runtime (= 0.5.11466)
142
139
  spoom (1.3.2)
143
140
  erubi (>= 1.10.0)
144
141
  prism (>= 0.19.0)
145
142
  sorbet-static-and-runtime (>= 0.5.10187)
146
143
  thor (>= 0.19.2)
147
- stringio (3.1.0)
144
+ stringio (3.1.1)
148
145
  strscan (3.1.0)
149
- tapioca (0.14.3)
146
+ tapioca (0.15.0)
150
147
  bundler (>= 2.2.25)
151
148
  netrc (>= 0.11.0)
152
149
  parallel (>= 1.21.0)
@@ -160,10 +157,10 @@ GEM
160
157
  concurrent-ruby (~> 1.0)
161
158
  unicode-display_width (2.5.0)
162
159
  yard (0.9.36)
163
- yard-sorbet (0.8.1)
164
- sorbet-runtime (>= 0.5)
165
- yard (>= 0.9)
166
- zeitwerk (2.6.15)
160
+ yard-sorbet (0.9.0)
161
+ sorbet-runtime
162
+ yard
163
+ zeitwerk (2.6.16)
167
164
 
168
165
  PLATFORMS
169
166
  aarch64-linux
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module GrapeSorbet
5
- VERSION = "0.0.5"
5
+ VERSION = "0.0.7"
6
6
  end
@@ -67,8 +67,10 @@ module Tapioca
67
67
  sig { override.void }
68
68
  def decorate
69
69
  create_classes_and_includes
70
- create_routing_methods
70
+
71
71
  create_callbacks_methods
72
+ create_request_response_methods
73
+ create_routing_methods
72
74
  end
73
75
 
74
76
  class << self
@@ -108,6 +110,14 @@ module Tapioca
108
110
  )
109
111
  end
110
112
 
113
+ sig { returns(RBI::Scope) }
114
+ def request_response_methods_module
115
+ @request_response_methods_module ||= T.let(
116
+ api.create_module(RequestResponseMethodsModuleName),
117
+ T.nilable(RBI::Scope),
118
+ )
119
+ end
120
+
111
121
  sig { returns(RBI::Scope) }
112
122
  def routing_methods_module
113
123
  @routing_methods_module ||= T.let(
@@ -119,6 +129,7 @@ module Tapioca
119
129
  sig { void }
120
130
  def create_classes_and_includes
121
131
  api.create_extend(CallbacksMethodsModuleName)
132
+ api.create_extend(RequestResponseMethodsModuleName)
122
133
  api.create_extend(RoutingMethodsModuleName)
123
134
  create_api_class
124
135
  create_endpoint_class
@@ -159,6 +170,21 @@ module Tapioca
159
170
  end
160
171
  end
161
172
 
173
+ sig { void }
174
+ def create_request_response_methods
175
+ request_response_methods_module.create_method(
176
+ "rescue_from",
177
+ parameters: [
178
+ create_rest_param("args", type: "T.untyped"),
179
+ create_block_param(
180
+ "block",
181
+ type: "T.nilable(T.proc.bind(#{EndpointClassName}).params(e: Exception).void)",
182
+ ),
183
+ ],
184
+ return_type: "void",
185
+ )
186
+ end
187
+
162
188
  sig { void }
163
189
  def create_routing_methods
164
190
  HTTP_VERB_METHODS.each do |verb|
@@ -8,6 +8,7 @@ module Tapioca
8
8
  extend T::Sig
9
9
 
10
10
  CallbacksMethodsModuleName = "GeneratedCallbacksMethods"
11
+ RequestResponseMethodsModuleName = "GeneratedRequestResponseMethods"
11
12
  RoutingMethodsModuleName = "GeneratedRoutingMethods"
12
13
 
13
14
  APIInstanceClassName = "PrivateAPIInstance"
data/rbi/grape.rbi CHANGED
@@ -29,9 +29,29 @@ module Grape
29
29
  end
30
30
  end
31
31
 
32
+ module InsideRoute
33
+ sig do
34
+ params(
35
+ message: T.any(String, T::Hash[Symbol, T.untyped]),
36
+ status: T.nilable(T.any(Integer, Symbol)),
37
+ additional_headers: T.nilable(T::Hash[String, String]),
38
+ ).returns(T.noreturn)
39
+ end
40
+ def error!(message, status = nil, additional_headers = nil); end
41
+
42
+ sig { params(status: T.nilable(T.any(Integer, Symbol))).returns(Integer) }
43
+ def status(status = nil); end
44
+
45
+ sig { returns(Grape::Cookies) }
46
+ def cookies; end
47
+
48
+ sig { returns(Grape::Router::Route) }
49
+ def route; end
50
+ end
51
+
32
52
  module RequestResponse
33
53
  module ClassMethods
34
- sig { params(args: T.untyped, block: T.proc.bind(Grape::Endpoint).void).void }
54
+ sig { params(args: T.untyped, block: T.proc.bind(Grape::Endpoint).params(e: Exception).void).void }
35
55
  def rescue_from(*args, &block); end
36
56
  end
37
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape_sorbet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thatch Health, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-24 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
- rubygems_version: 3.5.13
101
+ rubygems_version: 3.5.14
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Sorbet signatures and Tapioca DSL compiler for Grape.