b24api 2.6.0__tar.gz → 2.6.2__tar.gz

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.
Files changed (152) hide show
  1. {b24api-2.6.0/b24api.egg-info → b24api-2.6.2}/PKG-INFO +59 -15
  2. {b24api-2.6.0 → b24api-2.6.2}/README.md +58 -14
  3. {b24api-2.6.0 → b24api-2.6.2}/b24api/_diagnostics.py +21 -2
  4. {b24api-2.6.0 → b24api-2.6.2}/b24api/batch/outcome.py +3 -3
  5. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/__init__.py +2 -1
  6. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/json.py +4 -3
  7. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/keyset_capability.py +9 -11
  8. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/page_stop.py +14 -2
  9. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/policy.py +9 -2
  10. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/positional.py +3 -3
  11. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/reference.py +3 -3
  12. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/request.py +2 -2
  13. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/response.py +4 -4
  14. b24api-2.6.2/b24api/contracts/v3_codes.py +115 -0
  15. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/wire_body.py +2 -2
  16. {b24api-2.6.0 → b24api-2.6.2}/b24api/errors.py +14 -3
  17. {b24api-2.6.0 → b24api-2.6.2}/b24api/redaction.py +18 -0
  18. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/budget_view.py +21 -6
  19. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/dispatch.py +67 -18
  20. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/keyset_run.py +31 -15
  21. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/outcome.py +3 -3
  22. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/program.py +1 -1
  23. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/scheduler.py +20 -5
  24. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/wave_engine.py +20 -2
  25. {b24api-2.6.0 → b24api-2.6.2}/b24api/transport/base.py +2 -2
  26. {b24api-2.6.0 → b24api-2.6.2}/b24api/transport/protocol.py +3 -1
  27. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/continuation.py +2 -2
  28. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/counted.py +2 -2
  29. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/facade.py +2 -3
  30. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/identity.py +2 -2
  31. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_context.py +21 -4
  32. b24api-2.6.2/b24api/traversal/keyset_engine.py +62 -0
  33. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_fast_stream.py +2 -2
  34. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_runtime.py +13 -3
  35. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_transaction_contract.py +0 -2
  36. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_transactions.py +87 -35
  37. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/stream.py +5 -3
  38. {b24api-2.6.0 → b24api-2.6.2/b24api.egg-info}/PKG-INFO +59 -15
  39. {b24api-2.6.0 → b24api-2.6.2}/b24api.egg-info/SOURCES.txt +1 -0
  40. b24api-2.6.0/b24api/contracts/v3_codes.py +0 -61
  41. {b24api-2.6.0 → b24api-2.6.2}/LICENSE +0 -0
  42. {b24api-2.6.0 → b24api-2.6.2}/MANIFEST.in +0 -0
  43. {b24api-2.6.0 → b24api-2.6.2}/b24api/__init__.py +0 -0
  44. {b24api-2.6.0 → b24api-2.6.2}/b24api/_client_traversal.py +0 -0
  45. {b24api-2.6.0 → b24api-2.6.2}/b24api/_error_types.py +0 -0
  46. {b24api-2.6.0 → b24api-2.6.2}/b24api/_sources.py +0 -0
  47. {b24api-2.6.0 → b24api-2.6.2}/b24api/batch/__init__.py +0 -0
  48. {b24api-2.6.0 → b24api-2.6.2}/b24api/batch/correlation.py +0 -0
  49. {b24api-2.6.0 → b24api-2.6.2}/b24api/batch/engine.py +0 -0
  50. {b24api-2.6.0 → b24api-2.6.2}/b24api/batch/facade.py +0 -0
  51. {b24api-2.6.0 → b24api-2.6.2}/b24api/batch/logical.py +0 -0
  52. {b24api-2.6.0 → b24api-2.6.2}/b24api/batch/stream.py +0 -0
  53. {b24api-2.6.0 → b24api-2.6.2}/b24api/batch/v3.py +0 -0
  54. {b24api-2.6.0 → b24api-2.6.2}/b24api/cli.py +0 -0
  55. {b24api-2.6.0 → b24api-2.6.2}/b24api/cli_contract.py +0 -0
  56. {b24api-2.6.0 → b24api-2.6.2}/b24api/client.py +0 -0
  57. {b24api-2.6.0 → b24api-2.6.2}/b24api/completion/__init__.py +0 -0
  58. {b24api-2.6.0 → b24api-2.6.2}/b24api/completion/closure.py +0 -0
  59. {b24api-2.6.0 → b24api-2.6.2}/b24api/completion/fast_recorder.py +0 -0
  60. {b24api-2.6.0 → b24api-2.6.2}/b24api/completion/gate.py +0 -0
  61. {b24api-2.6.0 → b24api-2.6.2}/b24api/completion/operation_stream.py +0 -0
  62. {b24api-2.6.0 → b24api-2.6.2}/b24api/completion/recorder.py +0 -0
  63. {b24api-2.6.0 → b24api-2.6.2}/b24api/completion/reference_recorder.py +0 -0
  64. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/bounded_range.py +0 -0
  65. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/command.py +0 -0
  66. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/completion.py +0 -0
  67. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/continuation.py +0 -0
  68. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/dispatch.py +0 -0
  69. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/error_base.py +0 -0
  70. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/evidence.py +0 -0
  71. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/identity_store.py +0 -0
  72. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/keyset_execution.py +0 -0
  73. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/page.py +0 -0
  74. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/reference_source.py +0 -0
  75. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/report.py +0 -0
  76. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/request_summary.py +0 -0
  77. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/stream.py +0 -0
  78. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/traversal.py +0 -0
  79. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/violation.py +0 -0
  80. {b24api-2.6.0 → b24api-2.6.2}/b24api/contracts/wire.py +0 -0
  81. {b24api-2.6.0 → b24api-2.6.2}/b24api/encoding.py +0 -0
  82. {b24api-2.6.0 → b24api-2.6.2}/b24api/execution/__init__.py +0 -0
  83. {b24api-2.6.0 → b24api-2.6.2}/b24api/execution/boundary.py +0 -0
  84. {b24api-2.6.0 → b24api-2.6.2}/b24api/execution/cleanup.py +0 -0
  85. {b24api-2.6.0 → b24api-2.6.2}/b24api/execution/context.py +0 -0
  86. {b24api-2.6.0 → b24api-2.6.2}/b24api/execution/executor.py +0 -0
  87. {b24api-2.6.0 → b24api-2.6.2}/b24api/execution/failure.py +0 -0
  88. {b24api-2.6.0 → b24api-2.6.2}/b24api/execution/lifecycle.py +0 -0
  89. {b24api-2.6.0 → b24api-2.6.2}/b24api/execution/rate.py +0 -0
  90. {b24api-2.6.0 → b24api-2.6.2}/b24api/execution/snapshot.py +0 -0
  91. {b24api-2.6.0 → b24api-2.6.2}/b24api/execution/throttle.py +0 -0
  92. {b24api-2.6.0 → b24api-2.6.2}/b24api/migration.py +0 -0
  93. {b24api-2.6.0 → b24api-2.6.2}/b24api/py.typed +0 -0
  94. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/__init__.py +0 -0
  95. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/binding.py +0 -0
  96. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/compatibility.py +0 -0
  97. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/counted_io.py +0 -0
  98. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/dispatch_plan.py +0 -0
  99. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/facade.py +0 -0
  100. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/fanout.py +0 -0
  101. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/run.py +0 -0
  102. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/sources.py +0 -0
  103. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/stream.py +0 -0
  104. {b24api-2.6.0 → b24api-2.6.2}/b24api/references/support.py +0 -0
  105. {b24api-2.6.0 → b24api-2.6.2}/b24api/settings.py +0 -0
  106. {b24api-2.6.0 → b24api-2.6.2}/b24api/testing/__init__.py +0 -0
  107. {b24api-2.6.0 → b24api-2.6.2}/b24api/testing/_isolation.py +0 -0
  108. {b24api-2.6.0 → b24api-2.6.2}/b24api/testing/scripted.py +0 -0
  109. {b24api-2.6.0 → b24api-2.6.2}/b24api/testing/transport.py +0 -0
  110. {b24api-2.6.0 → b24api-2.6.2}/b24api/transport/__init__.py +0 -0
  111. {b24api-2.6.0 → b24api-2.6.2}/b24api/transport/decoding.py +0 -0
  112. {b24api-2.6.0 → b24api-2.6.2}/b24api/transport/disposition.py +0 -0
  113. {b24api-2.6.0 → b24api-2.6.2}/b24api/transport/httpx.py +0 -0
  114. {b24api-2.6.0 → b24api-2.6.2}/b24api/transport/log_records.py +0 -0
  115. {b24api-2.6.0 → b24api-2.6.2}/b24api/transport/logging_shield.py +0 -0
  116. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/__init__.py +0 -0
  117. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/control_preflight.py +0 -0
  118. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/counted_batch.py +0 -0
  119. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/counted_io.py +0 -0
  120. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/counted_rules.py +0 -0
  121. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/cursor.py +0 -0
  122. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/cursor_domain.py +0 -0
  123. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/driver.py +0 -0
  124. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/facade_support.py +0 -0
  125. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/identity_ledger.py +0 -0
  126. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/inclusive_window.py +0 -0
  127. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset.py +0 -0
  128. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_auto.py +0 -0
  129. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_capability.py +0 -0
  130. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_eligibility.py +0 -0
  131. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_fast_plan.py +0 -0
  132. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_geometry.py +0 -0
  133. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_observation.py +0 -0
  134. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_ordered_admission.py +0 -0
  135. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_page_validation.py +0 -0
  136. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_plan.py +0 -0
  137. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_reporting.py +0 -0
  138. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_step.py +0 -0
  139. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/keyset_verifier.py +0 -0
  140. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/offset_rules.py +0 -0
  141. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/page_adaptation.py +0 -0
  142. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/plans.py +0 -0
  143. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/sequential.py +0 -0
  144. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/sparse.py +0 -0
  145. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/strategy_context.py +0 -0
  146. {b24api-2.6.0 → b24api-2.6.2}/b24api/traversal/values.py +0 -0
  147. {b24api-2.6.0 → b24api-2.6.2}/b24api.egg-info/dependency_links.txt +0 -0
  148. {b24api-2.6.0 → b24api-2.6.2}/b24api.egg-info/entry_points.txt +0 -0
  149. {b24api-2.6.0 → b24api-2.6.2}/b24api.egg-info/requires.txt +0 -0
  150. {b24api-2.6.0 → b24api-2.6.2}/b24api.egg-info/top_level.txt +0 -0
  151. {b24api-2.6.0 → b24api-2.6.2}/pyproject.toml +0 -0
  152. {b24api-2.6.0 → b24api-2.6.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: b24api
3
- Version: 2.6.0
3
+ Version: 2.6.2
4
4
  Summary: Bitrix24 API
5
5
  Author-email: Shkarupa Alex <shkarupa.alex@gmail.com>
6
6
  License-Expression: MIT
@@ -127,8 +127,9 @@ may already have reached Bitrix:
127
127
 
128
128
  A failure that proves the request did not run is retried whatever its safety: a transport failure
129
129
  before dispatch, or a refusal listed in `AmbiguityPolicy`, which by default is an unstructured 423, 425
130
- or 429 (`refusal_http_statuses`) or a `QUERY_LIMIT_EXCEEDED` / `OPERATION_TIME_LIMIT` refusal
131
- (`refusal_api_codes`). A code or status added only to `RetryPolicy` is retried for `SAFE` work alone.
130
+ or 429 (`refusal_http_statuses`) or a `QUERY_LIMIT_EXCEEDED` / `OPERATION_TIME_LIMIT` /
131
+ REST 3.0 `BITRIX_REST_V3_EXCEPTION_RATELIMITEXCEPTION` refusal (`refusal_api_codes`). A code or
132
+ status added only to `RetryPolicy` is retried for `SAFE` work alone.
132
133
  A physical batch applies these rules to each command: after a failure, only the commands that
133
134
  may run again are sent again, in a smaller batch, and an `UNSAFE` command of a batch that may have run
134
135
  arrives as unknown. Replay rounds spend the same attempt and retry-time budget as the sends before
@@ -161,6 +162,42 @@ one_attempt = dataclasses.replace(ExecutionPolicy.from_settings(settings), max_a
161
162
  result = await client.call(request, policy=one_attempt)
162
163
  ```
163
164
 
165
+ ### Error codes
166
+
167
+ A structured refusal raises `ApiResponseError`. Its message, `wire_code`, `normalized_code`, `code`
168
+ (lower case) and `to_safe_dict()` name the server's code, so failures can be told apart:
169
+
170
+ ```text
171
+ API error [BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION]: Access denied
172
+ API error [NOTE_EMPTY_UPDATE]: Nothing to update
173
+ ```
174
+
175
+ A REST 3.0 `error.code` is shown verbatim whenever it is a snake-case identifier: upper case, such
176
+ as `BITRIX_REST_V3_EXCEPTION_INVALIDSELECTEXCEPTION` or `FEATURE_NOT_AVAILABLE_ON_CURRENT_PLAN`, or
177
+ lower case of letters only, such as `invalid_select_field`; the server's set is open, so no list is
178
+ kept. Error texts, classic
179
+ `{"error": ...}` codes and response previews keep the conservative redaction, so a long run of
180
+ letters and digits there still renders as `[REDACTED]`. A code that equals or contains your
181
+ webhook token or a credential of the request, in any letter case, is always `[REDACTED]`; one that
182
+ names a field of your request is shown as its `field#N` alias, or as `[REDACTED]` when only its
183
+ letter case differs.
184
+
185
+ Recognizing a code does not make it retryable. By default only the REST 3.0 load limits are retried,
186
+ after the server's `Retry-After`:
187
+
188
+ | Code | Status | Retried |
189
+ |---|---|---|
190
+ | `BITRIX_REST_V3_EXCEPTION_RATELIMITEXCEPTION` | 429 | Any direct request: the limiter refuses before the method runs. In a REST 3.0 batch envelope only `SAFE` commands, as for any structured envelope error. |
191
+ | `BITRIX_REST_V3_EXCEPTION_LIMITER_QUERYTIMELIMITEXCEPTION` | 503 | `SAFE` requests only: the method may have run. |
192
+
193
+ Every other REST 3.0 code is a deterministic refusal and is raised at once, including a 429 or 503
194
+ that a module declares for a longer-lived state (`LANDING_AI_SITE_MODERATION_BLOCK_LIMIT`,
195
+ `LANDING_AI_MODULE_UNAVAILABLE`). List more codes in `RetryPolicy.transient_api_codes` (and in
196
+ `AmbiguityPolicy.refusal_api_codes` when the code proves the method did not run). The request
197
+ faults `BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION` and
198
+ `BITRIX_REST_V3_EXCEPTION_METHODNOTFOUNDEXCEPTION` in a REST 3.0 error envelope are never retried,
199
+ even when listed.
200
+
164
201
  ## Logical batch and correlation
165
202
 
166
203
  `batch()` accepts an arbitrary-length synchronous or asynchronous command source. It consumes the
@@ -518,7 +555,8 @@ never reports the source as exhausted.
518
555
  For newest-first lists that resume from an inclusive timestamp and may also return pinned rows,
519
556
  `iter_list_window()` sends the oldest paging timestamp of each page unchanged, delivers rows
520
557
  repeated by the overlap once and fails as non-progress, without another request, when the boundary
521
- does not move. See
558
+ does not move. Its `page_stop` callback receives every validated page, empty closing page
559
+ included, and `PageBoundary.result` carries that page's server result for response-level fields. See
522
560
  [Inclusive timestamp windows](https://github.com/shkarupa-alex/b24api/blob/master/docs/recipes.md#inclusive-timestamp-windows).
523
561
 
524
562
  For multiple parent-bound cursor chains, `iter_cursors()` keeps cursor progress and correlation
@@ -624,17 +662,23 @@ rather than fabricating a reference outcome. Already accepted bindings retain th
624
662
  ### Keyset references
625
663
 
626
664
  `KeysetTraversal` bindings run sequentially by default (`SequentialKeysetExecution()`), unlike
627
- `iter_list_keyset()`, whose default is automatic. Pass `AutoKeysetExecution`,
628
- `RangeKeysetExecution` or `PartitionedKeysetExecution` as the traversal's `execution` to opt in. A
629
- binding with automatic, range or partitioned execution runs its own planning barrier and selection;
630
- its waves travel through the shared batch queue beside other bindings' pages, and its
631
- `ReferenceComplete` carries the binding's `keyset_selection` and, when the fast path ran, its
632
- `keyset_execution`. From its first request to its terminal event the binding holds a fixed share of
633
- `ExecutionPolicy.max_buffered_rows` and plans every wave within it; requests, pages, attempts and
634
- elapsed time stay on the one operation budget. An automatic binding whose planning floor exceeds the
635
- whole row budget waits to run alone with all of it (under `INPUT` delivery, once it is the next
636
- binding to deliver); a binding that cannot obtain its floor while no other binding can release rows
637
- fails with `BudgetExceededError`, and waiting for a share never outlasts `max_elapsed`.
665
+ `iter_list_keyset()`, whose default is automatic. Pass `AutoKeysetExecution`, `RangeKeysetExecution`
666
+ or `PartitionedKeysetExecution` as the traversal's `execution` to opt in. A binding with automatic,
667
+ range or partitioned execution runs its own planning barrier and selection; its waves and its final
668
+ confirmation pages travel through the shared batch queue beside other bindings' pages, so a cohort
669
+ of small parents shares physical batches instead of confirming each parent with a direct request.
670
+ Its `ReferenceComplete` carries the binding's `keyset_selection` and, when the fast path ran, its
671
+ `keyset_execution`. From its first request to its terminal event the binding holds a share of
672
+ `ExecutionPolicy.max_buffered_rows` and plans every wave within it; once a sequential or
673
+ boundary-only plan is chosen, the binding keeps only the rows that plan can still hold and returns
674
+ the rest to the bindings waiting for a share. Under `INPUT` delivery row capacity is granted in
675
+ binding order: while a binding waits for its share, no later binding is granted a share or reserves
676
+ an ordinary page. A binding whose batch was lost in transit ends with `ReferenceOutcomeUnknown`.
677
+ Requests, pages, attempts and elapsed time stay on the one operation budget. An automatic binding
678
+ whose planning floor exceeds the whole row budget waits to run alone with all of it (under `INPUT`
679
+ delivery, once it is the next binding to deliver); a binding that cannot obtain its floor while no
680
+ other binding can release rows fails with `BudgetExceededError`, and waiting for a share never
681
+ outlasts `max_elapsed`.
638
682
 
639
683
  Fast and automatic keyset references need `BatchDispatch`. With a `page_stop`, automatic execution
640
684
  runs sequentially and reports `PAGE_STOP`; an explicit fast mode with a `page_stop` or
@@ -96,8 +96,9 @@ may already have reached Bitrix:
96
96
 
97
97
  A failure that proves the request did not run is retried whatever its safety: a transport failure
98
98
  before dispatch, or a refusal listed in `AmbiguityPolicy`, which by default is an unstructured 423, 425
99
- or 429 (`refusal_http_statuses`) or a `QUERY_LIMIT_EXCEEDED` / `OPERATION_TIME_LIMIT` refusal
100
- (`refusal_api_codes`). A code or status added only to `RetryPolicy` is retried for `SAFE` work alone.
99
+ or 429 (`refusal_http_statuses`) or a `QUERY_LIMIT_EXCEEDED` / `OPERATION_TIME_LIMIT` /
100
+ REST 3.0 `BITRIX_REST_V3_EXCEPTION_RATELIMITEXCEPTION` refusal (`refusal_api_codes`). A code or
101
+ status added only to `RetryPolicy` is retried for `SAFE` work alone.
101
102
  A physical batch applies these rules to each command: after a failure, only the commands that
102
103
  may run again are sent again, in a smaller batch, and an `UNSAFE` command of a batch that may have run
103
104
  arrives as unknown. Replay rounds spend the same attempt and retry-time budget as the sends before
@@ -130,6 +131,42 @@ one_attempt = dataclasses.replace(ExecutionPolicy.from_settings(settings), max_a
130
131
  result = await client.call(request, policy=one_attempt)
131
132
  ```
132
133
 
134
+ ### Error codes
135
+
136
+ A structured refusal raises `ApiResponseError`. Its message, `wire_code`, `normalized_code`, `code`
137
+ (lower case) and `to_safe_dict()` name the server's code, so failures can be told apart:
138
+
139
+ ```text
140
+ API error [BITRIX_REST_V3_EXCEPTION_ACCESSDENIEDEXCEPTION]: Access denied
141
+ API error [NOTE_EMPTY_UPDATE]: Nothing to update
142
+ ```
143
+
144
+ A REST 3.0 `error.code` is shown verbatim whenever it is a snake-case identifier: upper case, such
145
+ as `BITRIX_REST_V3_EXCEPTION_INVALIDSELECTEXCEPTION` or `FEATURE_NOT_AVAILABLE_ON_CURRENT_PLAN`, or
146
+ lower case of letters only, such as `invalid_select_field`; the server's set is open, so no list is
147
+ kept. Error texts, classic
148
+ `{"error": ...}` codes and response previews keep the conservative redaction, so a long run of
149
+ letters and digits there still renders as `[REDACTED]`. A code that equals or contains your
150
+ webhook token or a credential of the request, in any letter case, is always `[REDACTED]`; one that
151
+ names a field of your request is shown as its `field#N` alias, or as `[REDACTED]` when only its
152
+ letter case differs.
153
+
154
+ Recognizing a code does not make it retryable. By default only the REST 3.0 load limits are retried,
155
+ after the server's `Retry-After`:
156
+
157
+ | Code | Status | Retried |
158
+ |---|---|---|
159
+ | `BITRIX_REST_V3_EXCEPTION_RATELIMITEXCEPTION` | 429 | Any direct request: the limiter refuses before the method runs. In a REST 3.0 batch envelope only `SAFE` commands, as for any structured envelope error. |
160
+ | `BITRIX_REST_V3_EXCEPTION_LIMITER_QUERYTIMELIMITEXCEPTION` | 503 | `SAFE` requests only: the method may have run. |
161
+
162
+ Every other REST 3.0 code is a deterministic refusal and is raised at once, including a 429 or 503
163
+ that a module declares for a longer-lived state (`LANDING_AI_SITE_MODERATION_BLOCK_LIMIT`,
164
+ `LANDING_AI_MODULE_UNAVAILABLE`). List more codes in `RetryPolicy.transient_api_codes` (and in
165
+ `AmbiguityPolicy.refusal_api_codes` when the code proves the method did not run). The request
166
+ faults `BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION` and
167
+ `BITRIX_REST_V3_EXCEPTION_METHODNOTFOUNDEXCEPTION` in a REST 3.0 error envelope are never retried,
168
+ even when listed.
169
+
133
170
  ## Logical batch and correlation
134
171
 
135
172
  `batch()` accepts an arbitrary-length synchronous or asynchronous command source. It consumes the
@@ -487,7 +524,8 @@ never reports the source as exhausted.
487
524
  For newest-first lists that resume from an inclusive timestamp and may also return pinned rows,
488
525
  `iter_list_window()` sends the oldest paging timestamp of each page unchanged, delivers rows
489
526
  repeated by the overlap once and fails as non-progress, without another request, when the boundary
490
- does not move. See
527
+ does not move. Its `page_stop` callback receives every validated page, empty closing page
528
+ included, and `PageBoundary.result` carries that page's server result for response-level fields. See
491
529
  [Inclusive timestamp windows](https://github.com/shkarupa-alex/b24api/blob/master/docs/recipes.md#inclusive-timestamp-windows).
492
530
 
493
531
  For multiple parent-bound cursor chains, `iter_cursors()` keeps cursor progress and correlation
@@ -593,17 +631,23 @@ rather than fabricating a reference outcome. Already accepted bindings retain th
593
631
  ### Keyset references
594
632
 
595
633
  `KeysetTraversal` bindings run sequentially by default (`SequentialKeysetExecution()`), unlike
596
- `iter_list_keyset()`, whose default is automatic. Pass `AutoKeysetExecution`,
597
- `RangeKeysetExecution` or `PartitionedKeysetExecution` as the traversal's `execution` to opt in. A
598
- binding with automatic, range or partitioned execution runs its own planning barrier and selection;
599
- its waves travel through the shared batch queue beside other bindings' pages, and its
600
- `ReferenceComplete` carries the binding's `keyset_selection` and, when the fast path ran, its
601
- `keyset_execution`. From its first request to its terminal event the binding holds a fixed share of
602
- `ExecutionPolicy.max_buffered_rows` and plans every wave within it; requests, pages, attempts and
603
- elapsed time stay on the one operation budget. An automatic binding whose planning floor exceeds the
604
- whole row budget waits to run alone with all of it (under `INPUT` delivery, once it is the next
605
- binding to deliver); a binding that cannot obtain its floor while no other binding can release rows
606
- fails with `BudgetExceededError`, and waiting for a share never outlasts `max_elapsed`.
634
+ `iter_list_keyset()`, whose default is automatic. Pass `AutoKeysetExecution`, `RangeKeysetExecution`
635
+ or `PartitionedKeysetExecution` as the traversal's `execution` to opt in. A binding with automatic,
636
+ range or partitioned execution runs its own planning barrier and selection; its waves and its final
637
+ confirmation pages travel through the shared batch queue beside other bindings' pages, so a cohort
638
+ of small parents shares physical batches instead of confirming each parent with a direct request.
639
+ Its `ReferenceComplete` carries the binding's `keyset_selection` and, when the fast path ran, its
640
+ `keyset_execution`. From its first request to its terminal event the binding holds a share of
641
+ `ExecutionPolicy.max_buffered_rows` and plans every wave within it; once a sequential or
642
+ boundary-only plan is chosen, the binding keeps only the rows that plan can still hold and returns
643
+ the rest to the bindings waiting for a share. Under `INPUT` delivery row capacity is granted in
644
+ binding order: while a binding waits for its share, no later binding is granted a share or reserves
645
+ an ordinary page. A binding whose batch was lost in transit ends with `ReferenceOutcomeUnknown`.
646
+ Requests, pages, attempts and elapsed time stay on the one operation budget. An automatic binding
647
+ whose planning floor exceeds the whole row budget waits to run alone with all of it (under `INPUT`
648
+ delivery, once it is the next binding to deliver); a binding that cannot obtain its floor while no
649
+ other binding can release rows fails with `BudgetExceededError`, and waiting for a share never
650
+ outlasts `max_elapsed`.
607
651
 
608
652
  Fast and automatic keyset references need `BatchDispatch`. With a `page_stop`, automatic execution
609
653
  runs sequentially and reports `PAGE_STOP`; an explicit fast mode with a `page_stop` or
@@ -14,7 +14,7 @@ import re
14
14
  from collections.abc import Iterable, Mapping, Sequence
15
15
  from typing import NoReturn
16
16
 
17
- from b24api.redaction import DEFAULT_SENSITIVE_KEYS, is_secret, replace_secrets, secret_values
17
+ from b24api.redaction import DEFAULT_SENSITIVE_KEYS, contains_secret, is_secret, replace_secrets, secret_values
18
18
 
19
19
  _ALIASED_PARAMETERS = frozenset({"filter", "order", "fields", "select"})
20
20
  _SENSITIVE_NAMES = frozenset(name.casefold().replace("-", "_") for name in DEFAULT_SENSITIVE_KEYS)
@@ -29,7 +29,7 @@ _MAX_SECRET_DEPTH = 32
29
29
  class DiagnosticContext:
30
30
  """Aliases and exact secrets of one canonical request, resolved on first use."""
31
31
 
32
- __slots__ = ("_aliases", "_headers", "_parameters", "_pattern", "_secrets")
32
+ __slots__ = ("_aliases", "_folded_pattern", "_headers", "_parameters", "_pattern", "_secrets")
33
33
 
34
34
  def __init__(
35
35
  self,
@@ -42,6 +42,7 @@ class DiagnosticContext:
42
42
  self._headers = tuple(headers)
43
43
  self._aliases: dict[str, str] | None = None
44
44
  self._pattern: re.Pattern[str] | None = None
45
+ self._folded_pattern: re.Pattern[str] | None = None
45
46
  self._secrets: frozenset[str] = frozenset()
46
47
 
47
48
  def __repr__(self) -> str:
@@ -65,6 +66,24 @@ class DiagnosticContext:
65
66
  self._resolved()
66
67
  return is_secret(value, self._secrets, ignore_case=ignore_case)
67
68
 
69
+ def contains_known_secret(self, text: str) -> bool:
70
+ """Report whether any of the request's own exact secrets occurs in ``text``, ignoring letter case."""
71
+ self._resolved()
72
+ return contains_secret(text, self._secrets)
73
+
74
+ def aliases_text(self, text: str) -> bool:
75
+ """Report whether ``text`` holds a whole declared field name, ignoring letter case.
76
+
77
+ Rendering aliases only the exact spelling; Bitrix field names are case-insensitive, so this check
78
+ also reports a field name the server echoed in another letter case.
79
+ """
80
+ self._resolved()
81
+ if self._pattern is None:
82
+ return False
83
+ if self._folded_pattern is None:
84
+ self._folded_pattern = re.compile(self._pattern.pattern, re.IGNORECASE)
85
+ return self._folded_pattern.search(text) is not None
86
+
68
87
  def replace_secrets(self, text: str) -> str:
69
88
  """Replace the request's own exact secrets wherever they occur."""
70
89
  self._resolved()
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
  from dataclasses import dataclass, field
5
5
  from typing import Self
6
6
 
7
- from b24api.contracts.json import FrozenJson, JsonValue, _freeze_json, _is_plain_int, _thaw_json
7
+ from b24api.contracts.json import FrozenJson, JsonValue, _freeze_json, _is_plain_int, thaw_json
8
8
  from b24api.contracts.policy import ReplayDisposition
9
9
  from b24api.contracts.request import ReplaySafety, Request
10
10
  from b24api.contracts.response import Response
@@ -70,7 +70,7 @@ class BatchSuccess:
70
70
  if response is not None and not isinstance(response, Response):
71
71
  raise TypeError("response must be a Response or None")
72
72
  frozen_result = _freeze_json(result)
73
- if response is not None and response.result != _thaw_json(frozen_result):
73
+ if response is not None and response.result != thaw_json(frozen_result):
74
74
  raise ValueError("batch response result must match the correlated command result")
75
75
  object.__setattr__(self, "command_index", command_index)
76
76
  object.__setattr__(self, "stable_key", stable_key)
@@ -118,7 +118,7 @@ class BatchSuccess:
118
118
  @property
119
119
  def result(self) -> JsonValue:
120
120
  """Return the result."""
121
- return _thaw_json(self._result)
121
+ return thaw_json(self._result)
122
122
 
123
123
  @property
124
124
  def decoded_rows(self) -> int:
@@ -39,7 +39,7 @@ from b24api.contracts.continuation import (
39
39
  )
40
40
  from b24api.contracts.dispatch import BatchDispatch, DeliveryOrder, DirectDispatch, DispatchSpec
41
41
  from b24api.contracts.identity_store import IdentityStore, identity_store_key
42
- from b24api.contracts.json import FrozenJson, FrozenMapping, JsonScalar, JsonValue
42
+ from b24api.contracts.json import FrozenJson, FrozenMapping, JsonScalar, JsonValue, thaw_json
43
43
  from b24api.contracts.keyset_capability import (
44
44
  KeysetCapabilityCheckName,
45
45
  KeysetCapabilityCheckOutcome,
@@ -311,5 +311,6 @@ __all__ = [
311
311
  "identity_store_key",
312
312
  "partition_command_outcomes",
313
313
  "partition_reference_outcomes",
314
+ "thaw_json",
314
315
  "traversal_control_paths",
315
316
  ]
@@ -108,11 +108,12 @@ def _freeze_json( # noqa: C901 - closed JSON scalar/container variants
108
108
  raise TypeError(f"unsupported JSON value type: {type(value).__name__}")
109
109
 
110
110
 
111
- def _thaw_json(value: FrozenJson) -> JsonValue:
111
+ def thaw_json(value: FrozenJson) -> JsonValue:
112
+ """Return a plain mutable JSON copy of a frozen value: dicts for mappings, lists for arrays."""
112
113
  if isinstance(value, FrozenMapping):
113
- return {key: _thaw_json(item) for key, item in value.items()}
114
+ return {key: thaw_json(item) for key, item in value.items()}
114
115
  if isinstance(value, tuple):
115
- return [_thaw_json(item) for item in value]
116
+ return [thaw_json(item) for item in value]
116
117
  return value
117
118
 
118
119
 
@@ -6,7 +6,7 @@ from dataclasses import dataclass
6
6
  from enum import StrEnum
7
7
  from typing import TYPE_CHECKING
8
8
 
9
- from b24api.contracts.json import FrozenJson, _freeze_json, _thaw_json
9
+ from b24api.contracts.json import FrozenJson, _freeze_json, thaw_json
10
10
  from b24api.contracts.report import PageRecord, Violation, ViolationSeverity
11
11
 
12
12
  if TYPE_CHECKING:
@@ -201,23 +201,21 @@ class KeysetCapabilityReport:
201
201
  "name": check.name,
202
202
  "outcome": check.outcome,
203
203
  "rows_selected": check.rows_selected,
204
- "out_of_interval_identities": tuple(
205
- _thaw_json(value) for value in check.out_of_interval_identities
206
- ),
204
+ "out_of_interval_identities": tuple(thaw_json(value) for value in check.out_of_interval_identities),
207
205
  "missing_in_interval_identities": tuple(
208
- _thaw_json(value) for value in check.missing_in_interval_identities
206
+ thaw_json(value) for value in check.missing_in_interval_identities
209
207
  ),
210
208
  "extra_in_interval_identities": tuple(
211
- _thaw_json(value) for value in check.extra_in_interval_identities
209
+ thaw_json(value) for value in check.extra_in_interval_identities
212
210
  ),
213
- "contradictory_identities": tuple(_thaw_json(value) for value in check.contradictory_identities),
211
+ "contradictory_identities": tuple(thaw_json(value) for value in check.contradictory_identities),
214
212
  "recheck": None
215
213
  if check.recheck is None
216
214
  else {
217
- "identities": tuple(_thaw_json(value) for value in check.recheck.identities),
218
- "still_observed": tuple(_thaw_json(value) for value in check.recheck.still_observed),
219
- "no_longer_observed": tuple(_thaw_json(value) for value in check.recheck.no_longer_observed),
220
- "contradictory": tuple(_thaw_json(value) for value in check.recheck.contradictory),
215
+ "identities": tuple(thaw_json(value) for value in check.recheck.identities),
216
+ "still_observed": tuple(thaw_json(value) for value in check.recheck.still_observed),
217
+ "no_longer_observed": tuple(thaw_json(value) for value in check.recheck.no_longer_observed),
218
+ "contradictory": tuple(thaw_json(value) for value in check.recheck.contradictory),
221
219
  "truncated": check.recheck.truncated,
222
220
  },
223
221
  }
@@ -1,10 +1,11 @@
1
1
  """Public whole-page callback and bounded-prefix stop decision."""
2
2
 
3
3
  from __future__ import annotations
4
- from dataclasses import dataclass
4
+ from dataclasses import dataclass, field
5
5
  from enum import StrEnum
6
6
  from typing import TYPE_CHECKING, Protocol
7
7
 
8
+ from b24api.contracts.json import FrozenMapping
8
9
  from b24api.contracts.report import PageRecord
9
10
  from b24api.redaction import DEFAULT_REDACTOR
10
11
 
@@ -18,11 +19,20 @@ _MAX_REASON_LENGTH = 128
18
19
 
19
20
  @dataclass(frozen=True, slots=True)
20
21
  class PageBoundary:
21
- """One validated whole page offered after all its rows were consumed."""
22
+ """One validated whole page offered after all its rows were consumed.
23
+
24
+ ``result`` is the page's immutable server result, the same snapshot a page adapter, a window
25
+ classifier and a continuation rule see as ``PageView.result``: response-level fields beside the
26
+ rows, such as a flag or a popup object, reach the application on every offered page, including
27
+ a page that admits no row. It is ``None`` only for a boundary built by application code. Only
28
+ its top-level type is checked: anything but a JSON scalar, a tuple or a ``FrozenMapping`` is
29
+ rejected, and nested values are the frozen values the library builds or the caller's concern.
30
+ """
22
31
 
23
32
  binding_id: int
24
33
  record: PageRecord
25
34
  rows: tuple[FrozenJson, ...]
35
+ result: FrozenJson = field(default=None, kw_only=True, repr=False)
26
36
 
27
37
  def __post_init__(self) -> None:
28
38
  """Keep correlation and page content immutable and exact."""
@@ -33,6 +43,8 @@ class PageBoundary:
33
43
  object.__setattr__(self, "rows", tuple(self.rows))
34
44
  if len(self.rows) != self.record.rows_admitted:
35
45
  raise ValueError("page boundary must contain all admitted rows")
46
+ if self.result is not None and not isinstance(self.result, str | int | float | tuple | FrozenMapping):
47
+ raise TypeError("result must be frozen JSON: a JSON scalar, a tuple or a FrozenMapping")
36
48
 
37
49
 
38
50
  class ContinuePage(StrEnum):
@@ -9,6 +9,7 @@ from typing import TYPE_CHECKING
9
9
 
10
10
  from b24api.contracts.error_base import BudgetExceededError
11
11
  from b24api.contracts.json import _is_plain_int
12
+ from b24api.contracts.v3_codes import REFUSAL_V3_ERROR_CODES, TRANSIENT_V3_ERROR_CODES
12
13
 
13
14
  if TYPE_CHECKING:
14
15
  from b24api.contracts.request_summary import RequestSummary
@@ -129,7 +130,10 @@ class AmbiguityPolicy:
129
130
 
130
131
  ambiguous_unstructured_statuses: frozenset[int] = frozenset({408, *range(500, 600)})
131
132
  refusal_http_statuses: frozenset[int] = frozenset({423, 425, 429})
132
- refusal_api_codes: frozenset[str] = frozenset({"query_limit_exceeded", "operation_time_limit"})
133
+ # The classic request and time quotas, and the REST 3.0 load limiter's refusal.
134
+ refusal_api_codes: frozenset[str] = frozenset(
135
+ {"query_limit_exceeded", "operation_time_limit", *REFUSAL_V3_ERROR_CODES}
136
+ )
133
137
 
134
138
  def __post_init__(self) -> None:
135
139
  """Validate and freeze the status and code sets."""
@@ -188,7 +192,10 @@ class RetryPolicy:
188
192
  """Explicit retry classifications and delay bounds."""
189
193
 
190
194
  transient_http_statuses: frozenset[int] = frozenset({423, 425, 429, 500, 502, 503, 507})
191
- transient_api_codes: frozenset[str] = frozenset({"query_limit_exceeded", "operation_time_limit"})
195
+ # The classic request and time quotas, and the REST 3.0 load limits; codes compare without letter case.
196
+ transient_api_codes: frozenset[str] = frozenset(
197
+ {"query_limit_exceeded", "operation_time_limit", *TRANSIENT_V3_ERROR_CODES}
198
+ )
192
199
  initial_delay: float = 0.5
193
200
  maximum_delay: float = 30.0
194
201
  backoff: float = 2.0
@@ -7,7 +7,7 @@ from dataclasses import dataclass, field
7
7
  from enum import StrEnum
8
8
  from typing import cast
9
9
 
10
- from b24api.contracts.json import FrozenJson, JsonValue, _freeze_json, _thaw_json
10
+ from b24api.contracts.json import FrozenJson, JsonValue, _freeze_json, thaw_json
11
11
 
12
12
  type SlotPathPart = str | int
13
13
  _LAYOUT_ID_RE = re.compile(r"^[A-Za-z0-9_.:-]{1,100}$")
@@ -107,7 +107,7 @@ class Present:
107
107
  @property
108
108
  def value(self) -> JsonValue:
109
109
  """Return a detached JSON value."""
110
- return _thaw_json(self._value)
110
+ return thaw_json(self._value)
111
111
 
112
112
  def __repr__(self) -> str:
113
113
  """Exclude caller data from diagnostics."""
@@ -201,7 +201,7 @@ class PositionalArguments:
201
201
  for part in path[1:-1]:
202
202
  parent = _existing_child(parent, part)
203
203
  last = path[-1]
204
- _set_existing_child(parent, last, _thaw_json(_freeze_json(value)))
204
+ _set_existing_child(parent, last, thaw_json(_freeze_json(value)))
205
205
  replacement = Present(root)
206
206
  revised = list(self.slots)
207
207
  revised[slot_index] = replacement
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
  from dataclasses import dataclass, field
5
5
  from typing import TYPE_CHECKING, cast
6
6
 
7
- from b24api.contracts.json import FrozenJson, JsonValue, _freeze_json, _thaw_json
7
+ from b24api.contracts.json import FrozenJson, JsonValue, _freeze_json, thaw_json
8
8
  from b24api.contracts.policy import ReplayDisposition
9
9
  from b24api.contracts.request import ParameterPath
10
10
  from b24api.redaction import DEFAULT_REDACTOR
@@ -37,7 +37,7 @@ class ParameterUpdate:
37
37
  @property
38
38
  def value(self) -> JsonValue:
39
39
  """Return a detached update value."""
40
- return _thaw_json(self._value)
40
+ return thaw_json(self._value)
41
41
 
42
42
 
43
43
  @dataclass(frozen=True, slots=True)
@@ -70,7 +70,7 @@ class Binding[C]:
70
70
  object.__setattr__(self, "summary", safe)
71
71
  object.__setattr__(self, "updates", updates)
72
72
  if self.start_cursor is not None:
73
- object.__setattr__(self, "start_cursor", _thaw_json(_freeze_json(self.start_cursor)))
73
+ object.__setattr__(self, "start_cursor", thaw_json(_freeze_json(self.start_cursor)))
74
74
 
75
75
 
76
76
  @dataclass(frozen=True, slots=True)
@@ -9,7 +9,7 @@ from types import MappingProxyType
9
9
  from typing import TypedDict, cast
10
10
 
11
11
  from b24api._diagnostics import DiagnosticContext
12
- from b24api.contracts.json import FrozenMapping, JsonValue, _freeze_json, _thaw_json
12
+ from b24api.contracts.json import FrozenMapping, JsonValue, _freeze_json, thaw_json
13
13
  from b24api.contracts.policy import IdentityCoercion
14
14
  from b24api.contracts.positional import PositionalArguments
15
15
  from b24api.contracts.request_summary import RequestSummary, RouteKind
@@ -314,7 +314,7 @@ class Request:
314
314
  """Return a mutable copy of the immutable request parameters."""
315
315
  if self._positional is not None:
316
316
  raise ValueError("positional arguments have no named parameter mapping")
317
- return cast("dict[str, JsonValue]", _thaw_json(self._parameters))
317
+ return cast("dict[str, JsonValue]", thaw_json(self._parameters))
318
318
 
319
319
  def to_wire_parameters(self) -> dict[str, JsonValue]:
320
320
  """Return the to wire parameters representation."""
@@ -10,7 +10,7 @@ from enum import StrEnum
10
10
  from typing import TYPE_CHECKING, cast
11
11
 
12
12
  from b24api.contracts.evidence import ResponseEvidence
13
- from b24api.contracts.json import FrozenJson, FrozenMapping, JsonValue, _freeze_json, _is_plain_int, _thaw_json
13
+ from b24api.contracts.json import FrozenJson, FrozenMapping, JsonValue, _freeze_json, _is_plain_int, thaw_json
14
14
  from b24api.contracts.request import PathPart, ResultSelector
15
15
 
16
16
  if TYPE_CHECKING:
@@ -198,7 +198,7 @@ class Response:
198
198
  @property
199
199
  def result(self) -> JsonValue:
200
200
  """Return the result."""
201
- return _thaw_json(self._result)
201
+ return thaw_json(self._result)
202
202
 
203
203
  def _frozen_result(self) -> FrozenJson:
204
204
  """Return the operation-internal immutable result snapshot."""
@@ -242,14 +242,14 @@ def inject_controls(
242
242
  frozen = _freeze_json(parameters)
243
243
  if not isinstance(frozen, FrozenMapping):
244
244
  raise TypeError("parameters must be a mapping")
245
- result = cast("dict[str, JsonValue]", _thaw_json(frozen))
245
+ result = cast("dict[str, JsonValue]", thaw_json(frozen))
246
246
  normalized_paths: set[tuple[PathPart, ...]] = set()
247
247
  for path, value in updates.items():
248
248
  normalized = tuple(part.casefold() if isinstance(part, str) else part for part in path.path)
249
249
  if normalized in normalized_paths:
250
250
  raise ValueError("two injected controls address the same case-insensitive path")
251
251
  normalized_paths.add(normalized)
252
- _inject_one(result, path.path, _thaw_json(_freeze_json(value)), allow_create=allow_create)
252
+ _inject_one(result, path.path, thaw_json(_freeze_json(value)), allow_create=allow_create)
253
253
  return result
254
254
 
255
255