sorbet-runtime 0.5.6239 → 0.5.6262
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/types/configuration.rb +26 -0
- data/lib/types/private/methods/signature.rb +4 -0
- data/lib/types/props/decorator.rb +3 -2
- data/lib/types/props/serializable.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 120b55b23f68b8c30bdbcf57ee7321dc146fd332cc68f61779dc28ab66994e59
|
4
|
+
data.tar.gz: d2521efb553ac1495ab93bdf837365026f68a3281886572e8f9c6e316d8404a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66c4b082d3fa1d150ca1cc59bd8e5ead17ff5661c53f059630085a37b7df0d880b4305183d352495f0a2fb8dc646361c457f134083ea466f320f4c2e2aabbaea
|
7
|
+
data.tar.gz: 4b1765c13fb06a849456d5a848fac0623481dd158191a323deb69d19190accfc2189896d2b5a56d57ce9c42ac3cdb5f64c374931f715104ffa0ba400ebbc737e
|
data/lib/types/configuration.rb
CHANGED
@@ -412,6 +412,32 @@ module T::Configuration
|
|
412
412
|
@module_name_mangler = handler
|
413
413
|
end
|
414
414
|
|
415
|
+
# Set to a PII handler function. This will be called with the `sensitivity:`
|
416
|
+
# annotations on things that use `T::Props` and can modify them ahead-of-time.
|
417
|
+
#
|
418
|
+
# @param [Lambda, Proc, nil] value Proc that takes a hash mapping symbols to the
|
419
|
+
# prop values. Pass nil to avoid changing `sensitivity:` annotations.
|
420
|
+
def self.normalize_sensitivity_and_pii_handler=(handler)
|
421
|
+
@sensitivity_and_pii_handler = handler
|
422
|
+
end
|
423
|
+
|
424
|
+
def self.normalize_sensitivity_and_pii_handler
|
425
|
+
@sensitivity_and_pii_handler
|
426
|
+
end
|
427
|
+
|
428
|
+
# Set to a function which can get the 'owner' of a class. This is
|
429
|
+
# used in reporting deserialization errors
|
430
|
+
#
|
431
|
+
# @param [Lambda, Proc, nil] value Proc that takes a class and
|
432
|
+
# produces its owner, or `nil` if it does not have one.
|
433
|
+
def self.class_owner_finder=(handler)
|
434
|
+
@class_owner_finder = handler
|
435
|
+
end
|
436
|
+
|
437
|
+
def self.class_owner_finder
|
438
|
+
@class_owner_finder
|
439
|
+
end
|
440
|
+
|
415
441
|
# Temporarily disable ruby warnings while executing the given block. This is
|
416
442
|
# useful when doing something that would normally cause a warning to be
|
417
443
|
# emitted in Ruby verbose mode ($VERBOSE = true).
|
@@ -11,6 +11,10 @@ class T::Private::Methods::Signature
|
|
11
11
|
# Using `Untyped` ensures we'll get an error if we ever try validation on these.
|
12
12
|
not_typed = T::Private::Types::NotTyped.new
|
13
13
|
raw_return_type = not_typed
|
14
|
+
# Map missing parameter names to "argN" positionally
|
15
|
+
parameters = parameters.each_with_index.map do |(param_kind, param_name), index|
|
16
|
+
[param_kind, param_name || "arg#{index}"]
|
17
|
+
end
|
14
18
|
raw_arg_types = parameters.map do |_param_kind, param_name|
|
15
19
|
[param_name, not_typed]
|
16
20
|
end.to_h
|
@@ -306,8 +306,9 @@ class T::Props::Decorator
|
|
306
306
|
type = T::Utils::Nilable.get_underlying_type(type)
|
307
307
|
|
308
308
|
sensitivity_and_pii = {sensitivity: rules[:sensitivity]}
|
309
|
-
|
310
|
-
|
309
|
+
normalize = T::Configuration.normalize_sensitivity_and_pii_handler
|
310
|
+
if normalize
|
311
|
+
sensitivity_and_pii = normalize.call(sensitivity_and_pii)
|
311
312
|
|
312
313
|
# We check for Class so this is only applied on concrete
|
313
314
|
# documents/models; We allow mixins containing props to not
|
@@ -246,11 +246,11 @@ module T::Props::Serializable::DecoratorMethods
|
|
246
246
|
|
247
247
|
# Notify the model owner if it exists, and always notify the API owner.
|
248
248
|
begin
|
249
|
-
if
|
249
|
+
if T::Configuration.class_owner_finder && (owner = T::Configuration.class_owner_finder.call(decorated_class))
|
250
250
|
T::Configuration.hard_assert_handler(
|
251
251
|
msg,
|
252
252
|
storytime: storytime,
|
253
|
-
project:
|
253
|
+
project: owner
|
254
254
|
)
|
255
255
|
end
|
256
256
|
ensure
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorbet-runtime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6262
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|