libredte-lib-core-bridge 0.1.0__py3-none-any.whl
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.
- libredte_lib_core_bridge/__init__.py +6 -0
- libredte_lib_core_bridge/dispatcher.py +62 -0
- libredte_lib_core_bridge/exceptions.py +15 -0
- libredte_lib_core_bridge/py.typed +0 -0
- libredte_lib_core_bridge-0.1.0.dist-info/METADATA +737 -0
- libredte_lib_core_bridge-0.1.0.dist-info/RECORD +8 -0
- libredte_lib_core_bridge-0.1.0.dist-info/WHEEL +4 -0
- libredte_lib_core_bridge-0.1.0.dist-info/licenses/COPYING +661 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Bridge Python para la biblioteca real `libredte-lib-core`."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from derafu_backbone_bridge import ExceptionRegistry, GenericDispatcher
|
|
6
|
+
|
|
7
|
+
from .exceptions import LibredteLibCoreError
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Dispatcher(GenericDispatcher):
|
|
11
|
+
"""
|
|
12
|
+
Pre-cableado para levantar `libredte-lib-core` con su propio dispatcher.
|
|
13
|
+
|
|
14
|
+
El propio `Bootstrap::boot()` (método estático) de
|
|
15
|
+
`libredte-lib-core-dispatcher` ya cablea todo lo necesario —cada
|
|
16
|
+
Deserializer y la cadena completa de `derafu/backbone-dispatcher`— de
|
|
17
|
+
forma declarativa, en el `config/services.yaml` de ese paquete.
|
|
18
|
+
|
|
19
|
+
Expone muchos paquetes/componentes/workers, así que acá solo se fija
|
|
20
|
+
el paso de arranque: quien lo use sigue indicando paquete, componente,
|
|
21
|
+
worker y operación a través del `dispatch()` heredado.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
_BOOTSTRAP_CLASS = 'libredte\\lib\\CoreDispatcher\\Bootstrap'
|
|
25
|
+
|
|
26
|
+
# Namespaces de PHP cuyas excepciones se agrupan bajo
|
|
27
|
+
# `LibredteLibCoreError` — no solo las propias de `libredte-lib-core`,
|
|
28
|
+
# también las de las bibliotecas Derafu que sus Deserializer envuelven
|
|
29
|
+
# directamente sin atraparlas (ver docstring de `LibredteLibCoreError`).
|
|
30
|
+
_DOMAIN_NAMESPACES = (
|
|
31
|
+
'libredte\\lib\\Core\\',
|
|
32
|
+
'Derafu\\Xml\\',
|
|
33
|
+
'Derafu\\Certificate\\',
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
def __init__(
|
|
37
|
+
self,
|
|
38
|
+
environment: str = 'prod',
|
|
39
|
+
debug: bool = False,
|
|
40
|
+
autoload_path: str | None = None,
|
|
41
|
+
exception_registry: ExceptionRegistry | None = None,
|
|
42
|
+
) -> None:
|
|
43
|
+
"""
|
|
44
|
+
Levanta `libredte-lib-core` para `environment`, con/sin `debug`.
|
|
45
|
+
|
|
46
|
+
`exception_registry` es opcional: si no se pasa, se crea uno
|
|
47
|
+
nuevo. En cualquier caso, acá se registran los namespaces de
|
|
48
|
+
`_DOMAIN_NAMESPACES` hacia `LibredteLibCoreError` sobre esa
|
|
49
|
+
instancia antes de pasarla al dispatcher real — permite que un
|
|
50
|
+
bridge que herede de este pase su propio `exception_registry` ya
|
|
51
|
+
con namespaces adicionales registrados, sin perderlos.
|
|
52
|
+
"""
|
|
53
|
+
registry = exception_registry or ExceptionRegistry()
|
|
54
|
+
for namespace in self._DOMAIN_NAMESPACES:
|
|
55
|
+
registry.register(namespace, LibredteLibCoreError)
|
|
56
|
+
|
|
57
|
+
super().__init__(
|
|
58
|
+
self._BOOTSTRAP_CLASS,
|
|
59
|
+
bootstrap_args=(environment, debug),
|
|
60
|
+
exception_registry=registry,
|
|
61
|
+
autoload_path=autoload_path,
|
|
62
|
+
)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Excepción de dominio para `libredte-lib-core`."""
|
|
2
|
+
|
|
3
|
+
from derafu_backbone_bridge import BackboneBridgeError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class LibredteLibCoreError(BackboneBridgeError):
|
|
7
|
+
r"""
|
|
8
|
+
Cualquier error real de `libredte-lib-core`.
|
|
9
|
+
|
|
10
|
+
También cubre `Derafu\Xml\Exception\*` y
|
|
11
|
+
`Derafu\Certificate\Exception\*`: los Deserializer de
|
|
12
|
+
`libredte-lib-core-dispatcher` que envuelven esos tipos (XML,
|
|
13
|
+
certificados) no atrapan sus excepciones para volver a lanzarlas como
|
|
14
|
+
algo propio de `libredte-lib-core` — se filtran tal cual.
|
|
15
|
+
"""
|
|
File without changes
|