sorbet-runtime 0.5.6239 → 0.5.6249

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd529ffe10dcd180d0586c9be21e5d526dac6f9c8795425a144af3e33200465e
4
- data.tar.gz: 8eb08915e3e6a94e058edf51ecf14ea6907fdc4e75a51d916621a55ace1c8e51
3
+ metadata.gz: 836a1fbf0f8401ea225ae5124205ba0cdcfccab4164ab3b1e342bf285d7ea19b
4
+ data.tar.gz: 8758dcc34d96534830fc097a269d45c307f6841a9f20643c633be33eca142816
5
5
  SHA512:
6
- metadata.gz: 17552e97e54a5e41d77317b5cc663b3ad137e7fed471ea74eacced944b5366dd180863fa0962e2cddc354edb0fd1decf9775f8a5803f54437db732e34380ef3e
7
- data.tar.gz: 1a1428f72c9ad09630a15b49701dcce5620ec5f78c3b65f6b77ba8ee02f5cc270889edd2983dc4776dc6eccf507c1eb8aec8b7b3a25ec84d652dbc4a5a39b9c1
6
+ metadata.gz: 54ad13d894a1a35e28735d4e20f785e8cee486c8acf2786587639c1084ad2a881c36e0e3b8799553fb9fcc73bb7354fb085cd59402a83ff4259c7a0ef34fc935
7
+ data.tar.gz: 854336ccb394ab1524e171a29f130227dfc1cc8d8cf72b1ce6453c4c2a773d9e1ecd02393b0084eca6e6cdd1e9b5c5d999305c48bee051902b917ab754b07988
@@ -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).
@@ -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
- if defined?(Opus) && defined?(Opus::Sensitivity) && defined?(Opus::Sensitivity::Utils)
310
- sensitivity_and_pii = Opus::Sensitivity::Utils.normalize_sensitivity_and_pii_annotation(sensitivity_and_pii)
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 defined?(Opus) && defined?(Opus::Ownership) && decorated_class < Opus::Ownership
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: decorated_class.get_owner
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.6239
4
+ version: 0.5.6249
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-26 00:00:00.000000000 Z
11
+ date: 2021-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest