sentry-relay 0.8.59__zip → 0.8.60__zip

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sentry-relay
3
- Version: 0.8.59
3
+ Version: 0.8.60
4
4
  Summary: A python library to access sentry relay functionality.
5
5
  Author: Sentry
6
6
  Author-email: hello@sentry.io
@@ -30,7 +30,7 @@ __all__ = [
30
30
  "validate_rule_condition",
31
31
  "validate_sampling_condition",
32
32
  "validate_sampling_configuration",
33
- "validate_project_config",
33
+ "normalize_project_config",
34
34
  "normalize_cardinality_limit_config",
35
35
  "normalize_global_config",
36
36
  ]
@@ -298,16 +298,25 @@ def validate_sampling_configuration(condition):
298
298
  raise ValueError(error)
299
299
 
300
300
 
301
- def validate_project_config(config, strict: bool):
302
- """Validate the whole project config.
301
+ def normalize_project_config(
302
+ config,
303
+ json_dumps: Callable[[Any], Any] = json.dumps,
304
+ json_loads: Callable[[str | bytes], Any] = json.loads,
305
+ ):
306
+ """Normalize a project config.
303
307
 
304
- :param strict: Whether or not to check for unknown fields.
308
+ :param config: the project config to validate.
309
+ :param json_dumps: a function that stringifies python objects
310
+ :param json_loads: a function that parses and converts JSON strings
305
311
  """
306
- assert isinstance(config, str)
307
- raw_error = rustcall(lib.relay_validate_project_config, encode_str(config), strict)
308
- error = decode_str(raw_error, free=True)
309
- if error:
310
- raise ValueError(error)
312
+ serialized = json_dumps(config)
313
+ normalized = rustcall(lib.relay_normalize_project_config, encode_str(serialized))
314
+ rv = decode_str(normalized, free=True)
315
+ try:
316
+ return json_loads(rv)
317
+ except Exception:
318
+ # Catch all errors since json.loads implementation can change.
319
+ raise ValueError(rv)
311
320
 
312
321
 
313
322
  def normalize_cardinality_limit_config(
@@ -355,7 +364,7 @@ def normalize_global_config(
355
364
  :param json_loads: a function that parses and converts JSON strings
356
365
  """
357
366
  serialized = json_dumps(config)
358
- normalized = rustcall(lib.normalize_global_config, encode_str(serialized))
367
+ normalized = rustcall(lib.relay_normalize_global_config, encode_str(serialized))
359
368
  rv = decode_str(normalized, free=True)
360
369
  try:
361
370
  return json_loads(rv)
@@ -0,0 +1 @@
1
+ 0.8.60
@@ -1 +0,0 @@
1
- 0.8.59
File without changes
File without changes